@sushichan044/kg-core 0.9.3 → 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.d.mts CHANGED
@@ -5,7 +5,7 @@ import * as v from "valibot";
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, ComposeError, type ComposeManuscriptOptions, type ComposedAnnotationFragment, type ComposedGlue, type ComposedGlyph, type ComposedInlineItem, type ComposedKern, type ComposedManuscript, type CompositionStatistics, type DiagnosticOrigin, type DiagnosticSeverity, type DisplayRange, type EmphasisAnnotation, FontPreset, FontPresetId, FontSizePt, type GraphemeRange, type InlineSpan, type ItalicAnnotation, type LineBreakResult, type LineOffset, type ManuscriptAnnotation, ManuscriptAppearanceSettings, ManuscriptDiagnostic, type ManuscriptDiagnosticInput, ManuscriptGeometry, ManuscriptOffsets, ManuscriptRange, type ManuscriptRangeInput, ManuscriptResult, type NovelComposedManuscript, NovelCompositionSettings, NovelFlowSettings, type NovelLayout, type NovelLine, type NovelPage, type NovelStage, PaperSize, PaperSizeId, ParseError, type ParseManuscriptOptions, type ParsedGrapheme, type ParsedManuscript, type RubyAnnotation, type RubyKind, type RubyReading, type SourcePosition, type SourceRange, type SuppressedInlineItem, type TextRange, type VerticalTextPresentation, composeManuscript, kakuyomuParser, novelComposer, parseManuscript, pixivParser, plainTextParser };
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
- 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-DRgsEA2s.mjs";
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.d.mts CHANGED
@@ -5,13 +5,13 @@ import * as v from "valibot";
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 { type ComposedProofreadingRule, type ConsistentKanjiOpeningOptions, type DashOptions, InvalidRuleOptions, type KanjiOpeningPair, type MaxArabicNumeralDigitsOptions, type ParagraphOpeningOptions, type ParsedProofreadingRule, ProofreadError, type ProofreadOptions, type ProofreadingReport, type ProofreadingRule, type ProofreadingRuleContext, type ProofreadingRuleMessages, ProofreadingRuleMeta, consistentKanjiOpeningRule, consistentLatinWidthRule, consistentNumeralWidthRule, createConsistentKanjiOpeningRule, createDashRule, createDefaultProofreadingRules, createMaxArabicNumeralDigitsRule, createParagraphOpeningRule, dashRule, ellipsisCharacterRule, evenEllipsisRule, fullwidthJapanesePunctuationRule, maxArabicNumeralDigitsRule, minusBeforeNumberRule, noConsecutiveInterpunctRule, noConsecutivePunctuationRule, paragraphOpeningRule, proofreadManuscript, punctuationBeforeClosingQuoteRule, spaceAfterQuestionOrExclamationRule, variantCharacterRule };
461
+ export type { ComposedProofreadingRule, ConsistentKanjiOpeningOptions, DashOptions, KanjiOpeningPair, MaxArabicNumeralDigitsOptions, ParagraphOpeningOptions, ParsedProofreadingRule, ProofreadOptions, ProofreadingReport, ProofreadingRule, ProofreadingRuleContext, ProofreadingRuleMessages };
package/dist/lint.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { a as characterClass, c as ManuscriptResult, d as NamespacedId, f as ManuscriptRange, h as readonlyObject, i as OPENING_BRACKETS, l as ManuscriptDiagnostic, m as readonlyArray, n as leadingSpaces, o as graphemeSegmenter, r as CLOSING_BRACKETS, s as ValidationIssue, t as questionOrExclamationSpacings, u as DiagnosticSeverity } from "./question-or-exclamation-spacing-B5o23ZLf.mjs";
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 { c as ManuscriptResult, d as NamespacedId, f as ManuscriptRange, h as readonlyObject, i as OPENING_BRACKETS, m as readonlyArray, o as graphemeSegmenter, p as nonNegativeInteger, r as CLOSING_BRACKETS, t as questionOrExclamationSpacings } from "./question-or-exclamation-spacing-B5o23ZLf.mjs";
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) width = Math.max(width, eastAsianWidth(codePoint, { ambiguousAsWide: true }));
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 DIVIDING_PUNCTUATION = /* @__PURE__ */ new Set("!?‼⁇⁈⁉");
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 (DIVIDING_PUNCTUATION.has(value)) return "cl-04";
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 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-DRgsEA2s.mjs";
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 = /[?!]+/gu;
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 fullwidth question or exclamation marks in one display
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 { characterClass as a, ManuscriptResult as c, NamespacedId as d, ManuscriptRange as f, readonlyObject as h, OPENING_BRACKETS as i, ManuscriptDiagnostic as l, readonlyArray as m, leadingSpaces as n, graphemeSegmenter as o, nonNegativeInteger as p, CLOSING_BRACKETS as r, ValidationIssue as s, questionOrExclamationSpacings as t, DiagnosticSeverity as u };
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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sushichan044/kg-core",
3
- "version": "0.9.3",
3
+ "version": "0.9.5",
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.0"
63
+ "vite-plus": "0.3.1"
64
64
  },
65
65
  "engines": {
66
66
  "node": ">=22.12.0"