@sushichan044/kg-core 0.12.0 → 0.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{composed-manuscript-C0f3mxKs.d.mts → composed-manuscript-QgIdae8p.d.mts} +52 -52
- package/dist/index.d.mts +308 -308
- package/dist/index.mjs +1 -1
- package/dist/lint.d.mts +1 -1
- package/dist/{novel-composer-DNsKrJIP.mjs → novel-composer-Dz7b30nf.mjs} +19 -8
- package/dist/plugin.d.mts +2 -2
- package/dist/plugin.mjs +1 -1
- package/dist/{presentation-kind-B9FtjZvc.d.mts → presentation-kind-PauRP22i.d.mts} +987 -987
- package/package.json +1 -1
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-QgIdae8p.mjs";
|
|
2
2
|
import * as v from "valibot";
|
|
3
3
|
//#region src/proofreading/invalid-rule-options.d.ts
|
|
4
4
|
/**
|
|
@@ -854,7 +854,8 @@ const CandidateLine = { resolve: (context, lineLengthEm) => {
|
|
|
854
854
|
break: { kind: "paragraph-end" },
|
|
855
855
|
hangingIndex: null,
|
|
856
856
|
deformationRatio: 0,
|
|
857
|
-
deformationCost: 0
|
|
857
|
+
deformationCost: 0,
|
|
858
|
+
finalExpansionBadness: 0
|
|
858
859
|
};
|
|
859
860
|
if (Math.abs(overflow) <= EPSILON$5) return {
|
|
860
861
|
start,
|
|
@@ -866,7 +867,8 @@ const CandidateLine = { resolve: (context, lineLengthEm) => {
|
|
|
866
867
|
break: { kind: "natural" },
|
|
867
868
|
hangingIndex: null,
|
|
868
869
|
deformationRatio: 0,
|
|
869
|
-
deformationCost: 0
|
|
870
|
+
deformationCost: 0,
|
|
871
|
+
finalExpansionBadness: 0
|
|
870
872
|
};
|
|
871
873
|
const shrunk = overflow > 0 && overflow <= capacity + EPSILON$5 ? resolveSpacings(pairValues, units, "shrink", overflow, finalExpansion) : null;
|
|
872
874
|
if (shrunk !== null && shrunk.unabsorbedEm <= EPSILON$5) {
|
|
@@ -882,7 +884,8 @@ const CandidateLine = { resolve: (context, lineLengthEm) => {
|
|
|
882
884
|
break: { kind: "shrunk" },
|
|
883
885
|
hangingIndex: null,
|
|
884
886
|
deformationRatio: chargeableCapacity <= EPSILON$5 ? 0 : chargeableShrink / chargeableCapacity,
|
|
885
|
-
deformationCost: shrunk.deformationCost
|
|
887
|
+
deformationCost: shrunk.deformationCost,
|
|
888
|
+
finalExpansionBadness: 0
|
|
886
889
|
};
|
|
887
890
|
}
|
|
888
891
|
if (!terminal && overflow > 0 && lastVisible !== void 0 && canHang && naturalSizeEm - lastAdvance - trailingSpacing <= lineLengthEm + EPSILON$5) return {
|
|
@@ -895,7 +898,8 @@ const CandidateLine = { resolve: (context, lineLengthEm) => {
|
|
|
895
898
|
break: { kind: "hanging" },
|
|
896
899
|
hangingIndex: lastVisible,
|
|
897
900
|
deformationRatio: overflow / Math.max(lastAdvance, EPSILON$5),
|
|
898
|
-
deformationCost: 0
|
|
901
|
+
deformationCost: 0,
|
|
902
|
+
finalExpansionBadness: 0
|
|
899
903
|
};
|
|
900
904
|
const stretched = !terminal && underflow > EPSILON$5 && (underflow <= capacity + EPSILON$5 || hasFinalStretch) ? resolveSpacings(pairValues, units, "stretch", underflow, finalExpansion) : null;
|
|
901
905
|
if (stretched !== null && stretched.unabsorbedEm <= EPSILON$5) return {
|
|
@@ -908,7 +912,8 @@ const CandidateLine = { resolve: (context, lineLengthEm) => {
|
|
|
908
912
|
break: { kind: "stretched" },
|
|
909
913
|
hangingIndex: null,
|
|
910
914
|
deformationRatio: stretched.finalStretchPerSlotEm > 0 ? 1 + stretched.finalStretchPerSlotEm : capacity === 0 ? 0 : underflow / capacity,
|
|
911
|
-
deformationCost: stretched.deformationCost
|
|
915
|
+
deformationCost: stretched.deformationCost,
|
|
916
|
+
finalExpansionBadness: finalExpansion.slots.length * stretched.finalStretchPerSlotEm ** 3
|
|
912
917
|
};
|
|
913
918
|
return {
|
|
914
919
|
start,
|
|
@@ -920,7 +925,8 @@ const CandidateLine = { resolve: (context, lineLengthEm) => {
|
|
|
920
925
|
break: { kind: "forced" },
|
|
921
926
|
hangingIndex: null,
|
|
922
927
|
deformationRatio: Math.abs(naturalSizeEm - lineLengthEm) / Math.max(lineLengthEm, EPSILON$5),
|
|
923
|
-
deformationCost: 0
|
|
928
|
+
deformationCost: 0,
|
|
929
|
+
finalExpansionBadness: 0
|
|
924
930
|
};
|
|
925
931
|
} };
|
|
926
932
|
//#endregion
|
|
@@ -2180,6 +2186,7 @@ function scoreFor(line, previousFitness) {
|
|
|
2180
2186
|
return {
|
|
2181
2187
|
score: [
|
|
2182
2188
|
modeCounts.forced,
|
|
2189
|
+
line.finalExpansionBadness,
|
|
2183
2190
|
modeCounts.stretched,
|
|
2184
2191
|
modeCounts.hanging,
|
|
2185
2192
|
modeCounts.shrunk,
|
|
@@ -2198,7 +2205,8 @@ function addScore(left, right) {
|
|
|
2198
2205
|
left[3] + right[3],
|
|
2199
2206
|
left[4] + right[4],
|
|
2200
2207
|
left[5] + right[5],
|
|
2201
|
-
left[6] + right[6]
|
|
2208
|
+
left[6] + right[6],
|
|
2209
|
+
left[7] + right[7]
|
|
2202
2210
|
];
|
|
2203
2211
|
}
|
|
2204
2212
|
const defaultParagraphEvaluation = { scoreFor };
|
|
@@ -2249,7 +2257,9 @@ function compareBreaks(left, right) {
|
|
|
2249
2257
|
function isBetter(candidateState, current, states) {
|
|
2250
2258
|
if (current === void 0) return true;
|
|
2251
2259
|
for (let index = 0; index < candidateState.score.length; index += 1) {
|
|
2252
|
-
const
|
|
2260
|
+
const candidate = candidateState.score[index] ?? 0;
|
|
2261
|
+
const existing = current.score[index] ?? 0;
|
|
2262
|
+
const difference = index === 1 ? Math.cbrt(candidate) - Math.cbrt(existing) : candidate - existing;
|
|
2253
2263
|
if (Math.abs(difference) > EPSILON$2) return difference < 0;
|
|
2254
2264
|
}
|
|
2255
2265
|
return compareBreaks(breaksOf(candidateState, states), breaksOf(current, states)) < 0;
|
|
@@ -2265,6 +2275,7 @@ function layoutParagraph(atoms, lineLengthEm, resolveCandidate, boundaryAllowed,
|
|
|
2265
2275
|
0,
|
|
2266
2276
|
0,
|
|
2267
2277
|
0,
|
|
2278
|
+
0,
|
|
2268
2279
|
0
|
|
2269
2280
|
],
|
|
2270
2281
|
fitness: 0,
|
package/dist/plugin.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as ManuscriptResult, i as ParsedManuscript, n as ValidationIssue, r as NamespacedId } from "./composed-manuscript-
|
|
2
|
-
import { a as RunMeasurer, c as MeasurementRequest, f as ManuscriptComposer, m as Rejection, o as logicalRunMeasurer, p as ManuscriptParser, r as createNovelComposer, s as RunMeasurement, t as PresentationKind } from "./presentation-kind-
|
|
1
|
+
import { a as ManuscriptResult, i as ParsedManuscript, n as ValidationIssue, r as NamespacedId } from "./composed-manuscript-QgIdae8p.mjs";
|
|
2
|
+
import { a as RunMeasurer, c as MeasurementRequest, f as ManuscriptComposer, m as Rejection, o as logicalRunMeasurer, p as ManuscriptParser, r as createNovelComposer, s as RunMeasurement, t as PresentationKind } from "./presentation-kind-PauRP22i.mjs";
|
|
3
3
|
import * as v from "valibot";
|
|
4
4
|
//#region src/composer/measurement-text-range.d.ts
|
|
5
5
|
declare const MeasurementTextRangeSchema: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
|
package/dist/plugin.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { f as ValidationIssue, g as NamespacedId, p as ManuscriptResult, x as readonlyObject } from "./question-or-exclamation-spacing-D7TSDUG8.mjs";
|
|
2
|
-
import { _ as ParsedManuscript, a as MeasuredCluster, g as FontPresetId, h as FontSizeQ, i as RunMeasurement, o as MeasurementTextRange, r as logicalRunMeasurer, t as createNovelComposer } from "./novel-composer-
|
|
2
|
+
import { _ as ParsedManuscript, a as MeasuredCluster, g as FontPresetId, h as FontSizeQ, i as RunMeasurement, o as MeasurementTextRange, r as logicalRunMeasurer, t as createNovelComposer } from "./novel-composer-Dz7b30nf.mjs";
|
|
3
3
|
import * as v from "valibot";
|
|
4
4
|
const PresentationKind = { schema: v.picklist([
|
|
5
5
|
"mixed",
|