@tiqian/protocol 0.0.0-stage → 0.1.0-alpha.9
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/haxe/crypto/Sha256.d.ts +19 -0
- package/dist/haxe/crypto/Sha256.js +194 -0
- package/dist/org/tiqian/clreq/AdjustmentStylePolicy.d.ts +11 -0
- package/dist/org/tiqian/clreq/AdjustmentStylePolicy.js +21 -0
- package/dist/org/tiqian/clreq/AutoSpaceMode.d.ts +16 -0
- package/dist/org/tiqian/clreq/AutoSpaceMode.js +17 -0
- package/dist/org/tiqian/clreq/AutoSpacePolicy.d.ts +13 -0
- package/dist/org/tiqian/clreq/AutoSpacePolicy.js +23 -0
- package/dist/org/tiqian/clreq/BopomofoReading.d.ts +12 -0
- package/dist/org/tiqian/clreq/BopomofoReading.js +86 -0
- package/dist/org/tiqian/clreq/BopomofoTone.d.ts +28 -0
- package/dist/org/tiqian/clreq/BopomofoTone.js +26 -0
- package/dist/org/tiqian/clreq/CjkPunctuationGlyphPolicy.d.ts +16 -0
- package/dist/org/tiqian/clreq/CjkPunctuationGlyphPolicy.js +17 -0
- package/dist/org/tiqian/clreq/ClreqProfile.d.ts +27 -0
- package/dist/org/tiqian/clreq/ClreqProfile.js +58 -0
- package/dist/org/tiqian/clreq/ClreqRegion.d.ts +20 -0
- package/dist/org/tiqian/clreq/ClreqRegion.js +20 -0
- package/dist/org/tiqian/clreq/ClreqStrictness.d.ts +16 -0
- package/dist/org/tiqian/clreq/ClreqStrictness.js +17 -0
- package/dist/org/tiqian/clreq/GlueSide.d.ts +16 -0
- package/dist/org/tiqian/clreq/GlueSide.js +17 -0
- package/dist/org/tiqian/clreq/HangingPunctuationStyle.d.ts +12 -0
- package/dist/org/tiqian/clreq/HangingPunctuationStyle.js +14 -0
- package/dist/org/tiqian/clreq/InteriorPunctuationStyle.d.ts +12 -0
- package/dist/org/tiqian/clreq/InteriorPunctuationStyle.js +14 -0
- package/dist/org/tiqian/clreq/KinsokuLevel.d.ts +20 -0
- package/dist/org/tiqian/clreq/KinsokuLevel.js +20 -0
- package/dist/org/tiqian/clreq/KinsokuMode.d.ts +14 -0
- package/dist/org/tiqian/clreq/KinsokuMode.js +2 -0
- package/dist/org/tiqian/clreq/KinsokuModes.d.ts +11 -0
- package/dist/org/tiqian/clreq/KinsokuModes.js +71 -0
- package/dist/org/tiqian/clreq/LineAdjustmentStrategy.d.ts +16 -0
- package/dist/org/tiqian/clreq/LineAdjustmentStrategy.js +17 -0
- package/dist/org/tiqian/clreq/LineEndPunctuationStyle.d.ts +12 -0
- package/dist/org/tiqian/clreq/LineEndPunctuationStyle.js +14 -0
- package/dist/org/tiqian/clreq/PunctuationClass.d.ts +44 -0
- package/dist/org/tiqian/clreq/PunctuationClass.js +38 -0
- package/dist/org/tiqian/clreq/PunctuationGluePlacement.d.ts +12 -0
- package/dist/org/tiqian/clreq/PunctuationGluePlacement.js +14 -0
- package/dist/org/tiqian/clreq/PunctuationGluePlacements.d.ts +9 -0
- package/dist/org/tiqian/clreq/PunctuationGluePlacements.js +49 -0
- package/dist/org/tiqian/clreq/PunctuationWidthPolicy.d.ts +8 -0
- package/dist/org/tiqian/clreq/PunctuationWidthPolicy.js +16 -0
- package/dist/org/tiqian/clreq/ResolvedKinsoku.d.ts +12 -0
- package/dist/org/tiqian/clreq/ResolvedKinsoku.js +43 -0
- package/dist/org/tiqian/core/Cluster.d.ts +13 -0
- package/dist/org/tiqian/core/Cluster.js +24 -0
- package/dist/org/tiqian/core/EastAsianSpacingData.d.ts +4 -0
- package/dist/org/tiqian/core/EastAsianSpacingData.js +399 -0
- package/dist/org/tiqian/core/EastAsianSpacingEdges.d.ts +8 -0
- package/dist/org/tiqian/core/EastAsianSpacingEdges.js +14 -0
- package/dist/org/tiqian/core/EastAsianSpacingValue.d.ts +20 -0
- package/dist/org/tiqian/core/EastAsianSpacingValue.js +20 -0
- package/dist/org/tiqian/core/Ic.d.ts +7 -0
- package/dist/org/tiqian/core/Ic.js +17 -0
- package/dist/org/tiqian/core/IllegalStateException.d.ts +4 -0
- package/dist/org/tiqian/core/IllegalStateException.js +8 -0
- package/dist/org/tiqian/core/IntRange.d.ts +12 -0
- package/dist/org/tiqian/core/IntRange.js +30 -0
- package/dist/org/tiqian/core/LineEndReason.d.ts +16 -0
- package/dist/org/tiqian/core/LineEndReason.js +17 -0
- package/dist/org/tiqian/core/SourceBoundaryBias.d.ts +16 -0
- package/dist/org/tiqian/core/SourceBoundaryBias.js +17 -0
- package/dist/org/tiqian/core/SourceInteractionBoundaries.d.ts +29 -0
- package/dist/org/tiqian/core/SourceInteractionBoundaries.js +193 -0
- package/dist/org/tiqian/core/TextRange.d.ts +11 -0
- package/dist/org/tiqian/core/TextRange.js +40 -0
- package/dist/org/tiqian/core/TextRangeError.d.ts +11 -0
- package/dist/org/tiqian/core/TextRangeError.js +2 -0
- package/dist/org/tiqian/core/TiqianIllegalArgumentException.d.ts +6 -0
- package/dist/org/tiqian/core/TiqianIllegalArgumentException.js +21 -0
- package/dist/org/tiqian/core/TiqianNoSuchElementException.d.ts +10 -0
- package/dist/org/tiqian/core/TiqianNoSuchElementException.js +16 -0
- package/dist/org/tiqian/core/UnicodeCombiningMarkData.d.ts +3 -0
- package/dist/org/tiqian/core/UnicodeCombiningMarkData.js +109 -0
- package/dist/org/tiqian/core/UnicodeEastAsianSpacing.d.ts +16 -0
- package/dist/org/tiqian/core/UnicodeEastAsianSpacing.js +88 -0
- package/dist/org/tiqian/core/UnicodeEmojiModifierBaseData.d.ts +3 -0
- package/dist/org/tiqian/core/UnicodeEmojiModifierBaseData.js +35 -0
- package/dist/org/tiqian/core/UnicodeExtendedPictographicData.d.ts +3 -0
- package/dist/org/tiqian/core/UnicodeExtendedPictographicData.js +64 -0
- package/dist/org/tiqian/core/UnicodeNumber.d.ts +3 -0
- package/dist/org/tiqian/core/UnicodeNumber.js +14 -0
- package/dist/org/tiqian/core/UnicodeNumberData.d.ts +3 -0
- package/dist/org/tiqian/core/UnicodeNumberData.js +64 -0
- package/dist/org/tiqian/core/UnicodeScriptEvidence.d.ts +16 -0
- package/dist/org/tiqian/core/UnicodeScriptEvidence.js +17 -0
- package/dist/org/tiqian/core/UnicodeScriptEvidenceClassifier.d.ts +7 -0
- package/dist/org/tiqian/core/UnicodeScriptEvidenceClassifier.js +17 -0
- package/dist/org/tiqian/core/UnicodeScriptEvidenceData.d.ts +4 -0
- package/dist/org/tiqian/core/UnicodeScriptEvidenceData.js +295 -0
- package/dist/org/tiqian/core/UnicodeWordCharacter.d.ts +6 -0
- package/dist/org/tiqian/core/UnicodeWordCharacter.js +17 -0
- package/dist/org/tiqian/core/UnicodeWordCharacterData.d.ts +3 -0
- package/dist/org/tiqian/core/UnicodeWordCharacterData.js +234 -0
- package/dist/org/tiqian/font/FontRole.d.ts +28 -0
- package/dist/org/tiqian/font/FontRole.js +26 -0
- package/dist/org/tiqian/font/FontRoleContext.d.ts +13 -0
- package/dist/org/tiqian/font/FontRoleContext.js +28 -0
- package/dist/org/tiqian/layout/ContextualQuoteRoleResolver.d.ts +51 -0
- package/dist/org/tiqian/layout/ContextualQuoteRoleResolver.js +305 -0
- package/dist/org/tiqian/layout/LineOptimization.d.ts +124 -0
- package/dist/org/tiqian/layout/LineOptimization.js +298 -0
- package/dist/org/tiqian/layout/ProgressiveBreakDecisions.d.ts +86 -0
- package/dist/org/tiqian/layout/ProgressiveBreakDecisions.js +415 -0
- package/dist/org/tiqian/layout/ProgressiveBreakTierPriority.d.ts +5 -0
- package/dist/org/tiqian/layout/ProgressiveBreakTierPriority.js +33 -0
- package/dist/org/tiqian/layout/QuotePairAnalyzer.d.ts +63 -0
- package/dist/org/tiqian/layout/QuotePairAnalyzer.js +251 -0
- package/dist/org/tiqian/linebreak/BreakKind.d.ts +20 -0
- package/dist/org/tiqian/linebreak/BreakKind.js +20 -0
- package/dist/org/tiqian/protocol/Canonical.d.ts +55 -0
- package/dist/org/tiqian/protocol/Canonical.js +471 -0
- package/dist/org/tiqian/protocol/DecorationInput.d.ts +6 -0
- package/dist/org/tiqian/protocol/DecorationInput.js +12 -0
- package/dist/org/tiqian/protocol/EncodeResult.d.ts +9 -0
- package/dist/org/tiqian/protocol/EncodeResult.js +2 -0
- package/dist/org/tiqian/protocol/FaceInfo.d.ts +13 -0
- package/dist/org/tiqian/protocol/FaceInfo.js +2 -0
- package/dist/org/tiqian/protocol/FontContract.d.ts +25 -0
- package/dist/org/tiqian/protocol/FontContract.js +317 -0
- package/dist/org/tiqian/protocol/FontFaceRecord.d.ts +6 -0
- package/dist/org/tiqian/protocol/FontFaceRecord.js +2 -0
- package/dist/org/tiqian/protocol/FontFaceSpec.d.ts +11 -0
- package/dist/org/tiqian/protocol/FontFaceSpec.js +2 -0
- package/dist/org/tiqian/protocol/FontWeightSpec.d.ts +10 -0
- package/dist/org/tiqian/protocol/FontWeightSpec.js +2 -0
- package/dist/org/tiqian/protocol/InlineBoxInput.d.ts +7 -0
- package/dist/org/tiqian/protocol/InlineBoxInput.js +2 -0
- package/dist/org/tiqian/protocol/InlineObjectInput.d.ts +7 -0
- package/dist/org/tiqian/protocol/InlineObjectInput.js +2 -0
- package/dist/org/tiqian/protocol/JsCoerce.d.ts +19 -0
- package/dist/org/tiqian/protocol/JsCoerce.js +394 -0
- package/dist/org/tiqian/protocol/LayoutAttribute.d.ts +5 -0
- package/dist/org/tiqian/protocol/LayoutAttribute.js +10 -0
- package/dist/org/tiqian/protocol/LayoutFloatShape.d.ts +14 -0
- package/dist/org/tiqian/protocol/LayoutFloatShape.js +2 -0
- package/dist/org/tiqian/protocol/LayoutTree.d.ts +23 -0
- package/dist/org/tiqian/protocol/LayoutTree.js +2 -0
- package/dist/org/tiqian/protocol/LayoutVertex.d.ts +4 -0
- package/dist/org/tiqian/protocol/LayoutVertex.js +2 -0
- package/dist/org/tiqian/protocol/LineBreakSpanInput.d.ts +6 -0
- package/dist/org/tiqian/protocol/LineBreakSpanInput.js +12 -0
- package/dist/org/tiqian/protocol/MetricEntry.d.ts +11 -0
- package/dist/org/tiqian/protocol/MetricEntry.js +21 -0
- package/dist/org/tiqian/protocol/NamedError.d.ts +88 -0
- package/dist/org/tiqian/protocol/NamedError.js +71 -0
- package/dist/org/tiqian/protocol/NamedErrorNames.d.ts +5 -0
- package/dist/org/tiqian/protocol/NamedErrorNames.js +53 -0
- package/dist/org/tiqian/protocol/ParagraphRequest.d.ts +25 -0
- package/dist/org/tiqian/protocol/ParagraphRequest.js +2 -0
- package/dist/org/tiqian/protocol/ParagraphRequestChecks.d.ts +8 -0
- package/dist/org/tiqian/protocol/ParagraphRequestChecks.js +145 -0
- package/dist/org/tiqian/protocol/ParagraphRequestException.d.ts +6 -0
- package/dist/org/tiqian/protocol/ParagraphRequestException.js +55 -0
- package/dist/org/tiqian/protocol/ParagraphRequestFields.d.ts +3 -0
- package/dist/org/tiqian/protocol/ParagraphRequestFields.js +4 -0
- package/dist/org/tiqian/protocol/Plan.d.ts +101 -0
- package/dist/org/tiqian/protocol/Plan.js +10 -0
- package/dist/org/tiqian/protocol/PlanEndReason.d.ts +16 -0
- package/dist/org/tiqian/protocol/PlanEndReason.js +17 -0
- package/dist/org/tiqian/protocol/PlanJsonNumber.d.ts +43 -0
- package/dist/org/tiqian/protocol/PlanJsonNumber.js +362 -0
- package/dist/org/tiqian/protocol/PlanSchema.d.ts +4 -0
- package/dist/org/tiqian/protocol/PlanSchema.js +5 -0
- package/dist/org/tiqian/protocol/PlanStyleDelta.d.ts +5 -0
- package/dist/org/tiqian/protocol/PlanStyleDelta.js +2 -0
- package/dist/org/tiqian/protocol/Revision.d.ts +11 -0
- package/dist/org/tiqian/protocol/Revision.js +12 -0
- package/dist/org/tiqian/protocol/SessionFaceSpec.d.ts +5 -0
- package/dist/org/tiqian/protocol/SessionFaceSpec.js +2 -0
- package/dist/org/tiqian/protocol/SnapshotTableBinary.d.ts +55 -0
- package/dist/org/tiqian/protocol/SnapshotTableBinary.js +657 -0
- package/dist/org/tiqian/protocol/SnapshotTypography.d.ts +14 -0
- package/dist/org/tiqian/protocol/SnapshotTypography.js +2 -0
- package/dist/org/tiqian/protocol/StyleRow.d.ts +8 -0
- package/dist/org/tiqian/protocol/StyleRow.js +15 -0
- package/dist/org/tiqian/protocol/TableData.d.ts +25 -0
- package/dist/org/tiqian/protocol/TableData.js +45 -0
- package/dist/org/tiqian/protocol/TableInput.d.ts +13 -0
- package/dist/org/tiqian/protocol/TableInput.js +21 -0
- package/dist/org/tiqian/protocol/TableMetricRow.d.ts +9 -0
- package/dist/org/tiqian/protocol/TableMetricRow.js +17 -0
- package/dist/org/tiqian/protocol/TableProbe.d.ts +11 -0
- package/dist/org/tiqian/protocol/TableProbe.js +21 -0
- package/dist/org/tiqian/protocol/TextSpanInput.d.ts +9 -0
- package/dist/org/tiqian/protocol/TextSpanInput.js +2 -0
- package/dist/org/tiqian/protocol/ValueRow.d.ts +4 -0
- package/dist/org/tiqian/protocol/ValueRow.js +7 -0
- package/dist/org/tiqian/protocol/WireField.d.ts +5 -0
- package/dist/org/tiqian/protocol/WireField.js +2 -0
- package/dist/org/tiqian/protocol/WireValue.d.ts +25 -0
- package/dist/org/tiqian/protocol/WireValue.js +2 -0
- package/dist/org/tiqian/test/TestHelpers.d.ts +5 -0
- package/dist/org/tiqian/test/TestHelpers.js +27 -0
- package/dist/org/tiqian/test/trace/TestTrace.d.ts +6 -0
- package/dist/org/tiqian/test/trace/TestTrace.js +8 -0
- package/dist/org/tiqian/test/trace/TestTracePlatform.d.ts +6 -0
- package/dist/org/tiqian/test/trace/TestTracePlatform.js +78 -0
- package/dist/org/tiqian/test/trace/TestTraceRecorder.d.ts +9 -0
- package/dist/org/tiqian/test/trace/TestTraceRecorder.js +36 -0
- package/dist/org/tiqian/test/trace/TestTraceRender.d.ts +47 -0
- package/dist/org/tiqian/test/trace/TestTraceRender.js +690 -0
- package/dist/org/tiqian/test/trace/TestTraceStore.d.ts +18 -0
- package/dist/org/tiqian/test/trace/TestTraceStore.js +149 -0
- package/dist/org/tiqian/test/trace/TraceAssertionError.d.ts +5 -0
- package/dist/org/tiqian/test/trace/TraceAssertionError.js +2 -0
- package/dist/org/tiqian/test/trace/TraceAssertionException.d.ts +6 -0
- package/dist/org/tiqian/test/trace/TraceAssertionException.js +16 -0
- package/dist/org/tiqian/test/trace/TraceField.d.ts +5 -0
- package/dist/org/tiqian/test/trace/TraceField.js +10 -0
- package/dist/org/tiqian/test/trace/TraceFormat.d.ts +21 -0
- package/dist/org/tiqian/test/trace/TraceFormat.js +184 -0
- package/dist/org/tiqian/test/trace/TracedAssertions.d.ts +78 -0
- package/dist/org/tiqian/test/trace/TracedAssertions.js +749 -0
- package/dist/runtime.d.ts +96 -0
- package/dist/runtime.js +1612 -0
- package/dist/std/FsError.d.ts +48 -0
- package/dist/std/FsError.js +2 -0
- package/dist/std/FsException.d.ts +6 -0
- package/dist/std/FsException.js +45 -0
- package/dist/std/UStringException.d.ts +6 -0
- package/dist/std/UStringException.js +21 -0
- package/dist/std/UStringFault.d.ts +9 -0
- package/dist/std/UStringFault.js +2 -0
- package/package.json +26 -4
- package/README.md +0 -3
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
// Generated by the reflaxe TypeScript target. Do not edit.
|
|
2
|
+
import { IntRange } from "./../core/IntRange.js";
|
|
3
|
+
import { LineEndReason } from "./../core/LineEndReason.js";
|
|
4
|
+
import { TiqianIllegalArgumentException } from "./../core/TiqianIllegalArgumentException.js";
|
|
5
|
+
import { ShrinkChannel } from "./ProgressiveBreakDecisions.js";
|
|
6
|
+
import { SortedTable } from "../../../runtime.js";
|
|
7
|
+
export class BreakCandidate {
|
|
8
|
+
index;
|
|
9
|
+
kind;
|
|
10
|
+
naturalWidth;
|
|
11
|
+
compressedWidth;
|
|
12
|
+
expandedWidth;
|
|
13
|
+
forbiddenReason;
|
|
14
|
+
repairOptions;
|
|
15
|
+
constructor(index, kind, naturalWidth, compressedWidth, expandedWidth, forbiddenReason, repairOptions = null) {
|
|
16
|
+
forbiddenReason = forbiddenReason ?? null;
|
|
17
|
+
this.index = index;
|
|
18
|
+
this.kind = kind;
|
|
19
|
+
this.naturalWidth = naturalWidth;
|
|
20
|
+
this.compressedWidth = compressedWidth;
|
|
21
|
+
this.expandedWidth = expandedWidth;
|
|
22
|
+
this.forbiddenReason = forbiddenReason;
|
|
23
|
+
this.repairOptions = repairOptions ?? [];
|
|
24
|
+
}
|
|
25
|
+
toString() {
|
|
26
|
+
return `BreakCandidate(index=${this.index}, kind=${this.kind.kind}, naturalWidth=${this.naturalWidth}, compressedWidth=${this.compressedWidth}, expandedWidth=${this.expandedWidth}, forbiddenReason=${this.forbiddenReason}, repairOptions=${(() => { let out = "["; const n = this.repairOptions.length; for (let i = 0; i < n; i += 1) {
|
|
27
|
+
if (i > 0) {
|
|
28
|
+
out += ", ";
|
|
29
|
+
}
|
|
30
|
+
out += this.repairOptions[i].kind === "LeaveRagged" ? ("LeaveRagged(penalty=" + this.repairOptions[i].penalty + ", reason=" + this.repairOptions[i].reason + ", offenderClusterIndex=" + this.repairOptions[i].offenderClusterIndex + ")") : this.repairOptions[i].kind === "CarryNext" ? ("CarryNext(penalty=" + this.repairOptions[i].penalty + ", reason=" + this.repairOptions[i].reason + ", movedClusterIndex=" + this.repairOptions[i].movedClusterIndex + ")") : this.repairOptions[i].kind === "CarryPrevious" ? ("CarryPrevious(penalty=" + this.repairOptions[i].penalty + ", reason=" + this.repairOptions[i].reason + ", offenderClusterIndex=" + this.repairOptions[i].offenderClusterIndex + ", carriedClusterIndex=" + this.repairOptions[i].carriedClusterIndex + ")") : this.repairOptions[i].kind === "Hang" ? ("Hang(penalty=" + this.repairOptions[i].penalty + ", reason=" + this.repairOptions[i].reason + ", offenderClusterIndex=" + this.repairOptions[i].offenderClusterIndex + ")") : ("PushIn(penalty=" + this.repairOptions[i].penalty + ", reason=" + this.repairOptions[i].reason + ", offenderClusterIndex=" + this.repairOptions[i].offenderClusterIndex + ", allocations=" + (() => { let out = "["; const n = this.repairOptions[i].allocations.length; for (let i = 0; i < n; i += 1) {
|
|
31
|
+
if (i > 0) {
|
|
32
|
+
out += ", ";
|
|
33
|
+
}
|
|
34
|
+
out += this.repairOptions[i].allocations[i].toString();
|
|
35
|
+
} out += "]"; return out; })() + ", totalShrink=" + this.repairOptions[i].totalShrink + ", totalAvailableCapacity=" + this.repairOptions[i].totalAvailableCapacity + ")");
|
|
36
|
+
} out += "]"; return out; })()})`;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
export class RepairOptions {
|
|
40
|
+
static penalty(o) {
|
|
41
|
+
switch (o.kind) {
|
|
42
|
+
case "PushIn":
|
|
43
|
+
{
|
|
44
|
+
return o.penalty;
|
|
45
|
+
}
|
|
46
|
+
case "Hang":
|
|
47
|
+
{
|
|
48
|
+
return o.penalty;
|
|
49
|
+
}
|
|
50
|
+
case "CarryPrevious":
|
|
51
|
+
{
|
|
52
|
+
return o.penalty;
|
|
53
|
+
}
|
|
54
|
+
case "CarryNext":
|
|
55
|
+
{
|
|
56
|
+
return o.penalty;
|
|
57
|
+
}
|
|
58
|
+
case "LeaveRagged":
|
|
59
|
+
{
|
|
60
|
+
return o.penalty;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
static reason(o) {
|
|
65
|
+
switch (o.kind) {
|
|
66
|
+
case "PushIn":
|
|
67
|
+
{
|
|
68
|
+
return o.reason;
|
|
69
|
+
}
|
|
70
|
+
case "Hang":
|
|
71
|
+
{
|
|
72
|
+
return o.reason;
|
|
73
|
+
}
|
|
74
|
+
case "CarryPrevious":
|
|
75
|
+
{
|
|
76
|
+
return o.reason;
|
|
77
|
+
}
|
|
78
|
+
case "CarryNext":
|
|
79
|
+
{
|
|
80
|
+
return o.reason;
|
|
81
|
+
}
|
|
82
|
+
case "LeaveRagged":
|
|
83
|
+
{
|
|
84
|
+
return o.reason;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
static hangOffender(o) {
|
|
89
|
+
switch (o.kind) {
|
|
90
|
+
case "PushIn":
|
|
91
|
+
return null;
|
|
92
|
+
case "Hang":
|
|
93
|
+
{
|
|
94
|
+
return o.offenderClusterIndex;
|
|
95
|
+
}
|
|
96
|
+
case "CarryPrevious":
|
|
97
|
+
return null;
|
|
98
|
+
case "CarryNext":
|
|
99
|
+
return null;
|
|
100
|
+
case "LeaveRagged":
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
static pushInReasonOf(o) {
|
|
105
|
+
switch (o.kind) {
|
|
106
|
+
case "PushIn":
|
|
107
|
+
{
|
|
108
|
+
return o.reason;
|
|
109
|
+
}
|
|
110
|
+
case "Hang":
|
|
111
|
+
return null;
|
|
112
|
+
case "CarryPrevious":
|
|
113
|
+
return null;
|
|
114
|
+
case "CarryNext":
|
|
115
|
+
return null;
|
|
116
|
+
case "LeaveRagged":
|
|
117
|
+
return null;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
static pushInAllocations(o) {
|
|
121
|
+
switch (o.kind) {
|
|
122
|
+
case "PushIn":
|
|
123
|
+
{
|
|
124
|
+
return o.allocations;
|
|
125
|
+
}
|
|
126
|
+
case "Hang":
|
|
127
|
+
return null;
|
|
128
|
+
case "CarryPrevious":
|
|
129
|
+
return null;
|
|
130
|
+
case "CarryNext":
|
|
131
|
+
return null;
|
|
132
|
+
case "LeaveRagged":
|
|
133
|
+
return null;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
export class PushInAllocation {
|
|
138
|
+
clusterIndex;
|
|
139
|
+
shrink;
|
|
140
|
+
availableCapacity;
|
|
141
|
+
channel;
|
|
142
|
+
constructor(clusterIndex, shrink, availableCapacity, channel = null) {
|
|
143
|
+
this.clusterIndex = clusterIndex;
|
|
144
|
+
this.shrink = shrink;
|
|
145
|
+
this.availableCapacity = availableCapacity;
|
|
146
|
+
this.channel = channel ?? ShrinkChannel.TrailingGlue;
|
|
147
|
+
}
|
|
148
|
+
toString() {
|
|
149
|
+
return `PushInAllocation(clusterIndex=${this.clusterIndex}, shrink=${this.shrink}, availableCapacity=${this.availableCapacity}, channel=${this.channel.kind})`;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
export class LineCandidate {
|
|
153
|
+
clusterRange;
|
|
154
|
+
sourceRange;
|
|
155
|
+
naturalWidth;
|
|
156
|
+
adjustedWidth;
|
|
157
|
+
endReason;
|
|
158
|
+
repair;
|
|
159
|
+
repairCandidates;
|
|
160
|
+
hangingClusterIndices;
|
|
161
|
+
constructor(clusterRange, sourceRange, naturalWidth, adjustedWidth, endReason = null, repair, repairCandidates = null, hangingClusterIndices = null) {
|
|
162
|
+
repair = repair ?? null;
|
|
163
|
+
this.clusterRange = clusterRange;
|
|
164
|
+
this.sourceRange = sourceRange;
|
|
165
|
+
this.naturalWidth = naturalWidth;
|
|
166
|
+
this.adjustedWidth = adjustedWidth;
|
|
167
|
+
this.endReason = endReason ?? LineEndReason.AutoWrap;
|
|
168
|
+
this.repair = repair;
|
|
169
|
+
this.repairCandidates = repairCandidates ?? [];
|
|
170
|
+
this.hangingClusterIndices = hangingClusterIndices ?? LineCandidate.emptyHanging();
|
|
171
|
+
if (this.hangingClusterIndices.size() > 0) {
|
|
172
|
+
const firstHanging = this.hangingClusterIndices.at(0);
|
|
173
|
+
const lastHanging = this.hangingClusterIndices.at(this.hangingClusterIndices.size() - 1);
|
|
174
|
+
if (!(clusterRange.start <= firstHanging && firstHanging <= clusterRange.end && lastHanging === clusterRange.end)) {
|
|
175
|
+
throw new TiqianIllegalArgumentException({ kind: "Message", text: `Hanging clusters must be a trailing line suffix: line=${LineCandidates.renderRange(clusterRange)} hanging=${(() => { let out = "["; const n = this.hangingClusterIndices.size(); for (let i = 0; i < n; i += 1) {
|
|
176
|
+
if (i > 0) {
|
|
177
|
+
out += ", ";
|
|
178
|
+
}
|
|
179
|
+
out += this.hangingClusterIndices.at(i);
|
|
180
|
+
} out += "]"; return out; })()}` });
|
|
181
|
+
}
|
|
182
|
+
if (this.hangingClusterIndices.size() !== clusterRange.end - firstHanging + 1) {
|
|
183
|
+
throw new TiqianIllegalArgumentException({ kind: "Message", text: `Hanging clusters must be contiguous: line=${LineCandidates.renderRange(clusterRange)} hanging=${(() => { let out = "["; const n = this.hangingClusterIndices.size(); for (let i = 0; i < n; i += 1) {
|
|
184
|
+
if (i > 0) {
|
|
185
|
+
out += ", ";
|
|
186
|
+
}
|
|
187
|
+
out += this.hangingClusterIndices.at(i);
|
|
188
|
+
} out += "]"; return out; })()}` });
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
get hangingClusterIndex() {
|
|
193
|
+
return this.get_hangingClusterIndex();
|
|
194
|
+
}
|
|
195
|
+
get_hangingClusterIndex() {
|
|
196
|
+
const fromRepair = (this.repair === null ? null : RepairOptions.hangOffender((this.repair)));
|
|
197
|
+
const last = (this.hangingClusterIndices.size() === 0 ? null : this.hangingClusterIndices.at(this.hangingClusterIndices.size() - 1));
|
|
198
|
+
return (fromRepair !== null ? fromRepair : last);
|
|
199
|
+
}
|
|
200
|
+
get inMeasureClusterRange() {
|
|
201
|
+
return this.get_inMeasureClusterRange();
|
|
202
|
+
}
|
|
203
|
+
get_inMeasureClusterRange() {
|
|
204
|
+
const firstHanging = (this.hangingClusterIndices.size() === 0 ? null : this.hangingClusterIndices.at(0));
|
|
205
|
+
return (firstHanging === null ? this.clusterRange : new IntRange(this.clusterRange.start, firstHanging - 1));
|
|
206
|
+
}
|
|
207
|
+
toString() {
|
|
208
|
+
return `LineCandidate(clusterRange=${this.clusterRange.toString()}, sourceRange=${this.sourceRange.toString()}, naturalWidth=${this.naturalWidth}, adjustedWidth=${this.adjustedWidth}, endReason=${this.endReason.kind}, repair=${(this.repair === null ? "null" : this.repair.kind === "LeaveRagged" ? ("LeaveRagged(penalty=" + this.repair.penalty + ", reason=" + this.repair.reason + ", offenderClusterIndex=" + this.repair.offenderClusterIndex + ")") : this.repair.kind === "CarryNext" ? ("CarryNext(penalty=" + this.repair.penalty + ", reason=" + this.repair.reason + ", movedClusterIndex=" + this.repair.movedClusterIndex + ")") : this.repair.kind === "CarryPrevious" ? ("CarryPrevious(penalty=" + this.repair.penalty + ", reason=" + this.repair.reason + ", offenderClusterIndex=" + this.repair.offenderClusterIndex + ", carriedClusterIndex=" + this.repair.carriedClusterIndex + ")") : this.repair.kind === "Hang" ? ("Hang(penalty=" + this.repair.penalty + ", reason=" + this.repair.reason + ", offenderClusterIndex=" + this.repair.offenderClusterIndex + ")") : ("PushIn(penalty=" + this.repair.penalty + ", reason=" + this.repair.reason + ", offenderClusterIndex=" + this.repair.offenderClusterIndex + ", allocations=" + (() => { let out = "["; const n = this.repair.allocations.length; for (let i = 0; i < n; i += 1) {
|
|
209
|
+
if (i > 0) {
|
|
210
|
+
out += ", ";
|
|
211
|
+
}
|
|
212
|
+
out += this.repair.allocations[i].toString();
|
|
213
|
+
} out += "]"; return out; })() + ", totalShrink=" + this.repair.totalShrink + ", totalAvailableCapacity=" + this.repair.totalAvailableCapacity + ")"))}, repairCandidates=${(() => { let out = "["; const n = this.repairCandidates.length; for (let i = 0; i < n; i += 1) {
|
|
214
|
+
if (i > 0) {
|
|
215
|
+
out += ", ";
|
|
216
|
+
}
|
|
217
|
+
out += this.repairCandidates[i].toString();
|
|
218
|
+
} out += "]"; return out; })()}, hangingClusterIndices=${(() => { let out = "["; const n = this.hangingClusterIndices.size(); for (let i = 0; i < n; i += 1) {
|
|
219
|
+
if (i > 0) {
|
|
220
|
+
out += ", ";
|
|
221
|
+
}
|
|
222
|
+
out += this.hangingClusterIndices.at(i);
|
|
223
|
+
} out += "]"; return out; })()})`;
|
|
224
|
+
}
|
|
225
|
+
static emptyHanging() {
|
|
226
|
+
const b = SortedTable.setBuilder(SortedTable.compareInts);
|
|
227
|
+
return b.build();
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
export class LineCandidates {
|
|
231
|
+
static renderRange(r) {
|
|
232
|
+
return r.start + ".." + r.end;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
export class RepairCandidate {
|
|
236
|
+
kind;
|
|
237
|
+
reasonCode;
|
|
238
|
+
offenderClusterIndex;
|
|
239
|
+
penalty;
|
|
240
|
+
accepted;
|
|
241
|
+
rejectionReason;
|
|
242
|
+
targetClusterIndex;
|
|
243
|
+
carriedClusterIndex;
|
|
244
|
+
shrink;
|
|
245
|
+
requiredShrink;
|
|
246
|
+
availableCapacity;
|
|
247
|
+
constructor(kind, reasonCode, offenderClusterIndex, penalty, accepted, rejectionReason, targetClusterIndex, carriedClusterIndex, shrink = null, requiredShrink = null, availableCapacity = null) {
|
|
248
|
+
rejectionReason = rejectionReason ?? null;
|
|
249
|
+
targetClusterIndex = targetClusterIndex ?? null;
|
|
250
|
+
carriedClusterIndex = carriedClusterIndex ?? null;
|
|
251
|
+
this.kind = kind;
|
|
252
|
+
this.reasonCode = reasonCode;
|
|
253
|
+
this.offenderClusterIndex = offenderClusterIndex;
|
|
254
|
+
this.penalty = penalty;
|
|
255
|
+
this.accepted = accepted;
|
|
256
|
+
this.rejectionReason = rejectionReason;
|
|
257
|
+
this.targetClusterIndex = targetClusterIndex;
|
|
258
|
+
this.carriedClusterIndex = carriedClusterIndex;
|
|
259
|
+
this.shrink = shrink ?? 0;
|
|
260
|
+
this.requiredShrink = requiredShrink ?? 0;
|
|
261
|
+
this.availableCapacity = availableCapacity ?? 0;
|
|
262
|
+
}
|
|
263
|
+
toString() {
|
|
264
|
+
return `RepairCandidate(kind=${this.kind}, reasonCode=${this.reasonCode}, offenderClusterIndex=${this.offenderClusterIndex}, penalty=${this.penalty}, accepted=${this.accepted}, rejectionReason=${this.rejectionReason}, targetClusterIndex=${this.targetClusterIndex}, carriedClusterIndex=${this.carriedClusterIndex}, shrink=${this.shrink}, requiredShrink=${this.requiredShrink}, availableCapacity=${this.availableCapacity})`;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
export class LineSolution {
|
|
268
|
+
lines;
|
|
269
|
+
totalBadness;
|
|
270
|
+
constructor(lines = null, totalBadness = null) {
|
|
271
|
+
this.lines = lines ?? [];
|
|
272
|
+
this.totalBadness = totalBadness ?? 0;
|
|
273
|
+
}
|
|
274
|
+
toString() {
|
|
275
|
+
return `LineSolution(lines=${(() => { let out = "["; const n = this.lines.length; for (let i = 0; i < n; i += 1) {
|
|
276
|
+
if (i > 0) {
|
|
277
|
+
out += ", ";
|
|
278
|
+
}
|
|
279
|
+
out += this.lines[i].toString();
|
|
280
|
+
} out += "]"; return out; })()}, totalBadness=${this.totalBadness})`;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
export const LineOptimizationStrategy = Object.freeze({
|
|
284
|
+
Greedy: Object.freeze({ kind: "Greedy" }),
|
|
285
|
+
Lookahead: Object.freeze({ kind: "Lookahead" }),
|
|
286
|
+
ParagraphDynamicProgramming: Object.freeze({ kind: "ParagraphDynamicProgramming" })
|
|
287
|
+
});
|
|
288
|
+
export function compareLineOptimizationStrategy(a, b) {
|
|
289
|
+
if (a === b)
|
|
290
|
+
return 0;
|
|
291
|
+
if (a.kind === "Greedy")
|
|
292
|
+
return 0 - (b.kind === "Greedy" ? 0 : 0);
|
|
293
|
+
if (a.kind === "Lookahead")
|
|
294
|
+
return 1 - (b.kind === "Lookahead" ? 1 : 0);
|
|
295
|
+
if (a.kind === "ParagraphDynamicProgramming")
|
|
296
|
+
return 2 - (b.kind === "ParagraphDynamicProgramming" ? 2 : 0);
|
|
297
|
+
return 0;
|
|
298
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { type Cluster } from "./../core/Cluster.js";
|
|
2
|
+
import { type IntRange } from "./../core/IntRange.js";
|
|
3
|
+
import { type TextRange } from "./../core/TextRange.js";
|
|
4
|
+
import { SortedMapTable, SortedSetTable } from "../../../runtime.js";
|
|
5
|
+
export declare class ProgressiveBreakOpportunity {
|
|
6
|
+
readonly tier: ProgressiveBreakTier;
|
|
7
|
+
readonly spanRange: TextRange;
|
|
8
|
+
readonly precedingWhitespaceStretchCapacity: number;
|
|
9
|
+
constructor(tier: ProgressiveBreakTier, spanRange: TextRange, precedingWhitespaceStretchCapacity?: number | null);
|
|
10
|
+
toString(): string;
|
|
11
|
+
}
|
|
12
|
+
export declare function lineLimit(maxWidth: number, firstLineIndent: number, lineStartCluster: number): number;
|
|
13
|
+
export declare class ProgressiveBreakDecisions {
|
|
14
|
+
static decideProgressiveBreak(lineStart: number, overflowAt: number, opportunities: SortedMapTable<number, ProgressiveBreakOpportunity>, adjustedClusters?: Cluster[] | null, lineLimit?: number | null, cjkInterCharBoundaries?: SortedSetTable<number> | null, maxCjkStretchPerGap?: number | null, sinoWesternBoundaries?: SortedSetTable<number> | null, sinoWesternStretchCap?: number | null): number;
|
|
15
|
+
static progressiveCandidateAllowed(lineStart: number, rawGreedy: number, candidateEnd: number, opportunities: SortedMapTable<number, ProgressiveBreakOpportunity>, adjustedClusters?: Cluster[] | null, lineLimit?: number | null, cjkInterCharBoundaries?: SortedSetTable<number> | null, maxCjkStretchPerGap?: number | null, sinoWesternBoundaries?: SortedSetTable<number> | null, sinoWesternStretchCap?: number | null): boolean;
|
|
16
|
+
private static progressiveBreakPriorityForLine;
|
|
17
|
+
private static progressiveCandidateStretchDensity;
|
|
18
|
+
private static hasWhitespaceUnit;
|
|
19
|
+
static decideHyphenBreak(lineStart: number, overflowAt: number, adjustedClusters: Cluster[], lineLimit: number, hyphenBreakClusters: SortedSetTable<number>, cjkInterCharBoundaries: SortedSetTable<number>, maxCjkStretchPerGap: number, sinoWesternBoundaries?: SortedSetTable<number> | null, sinoWesternStretchCap?: number | null): number;
|
|
20
|
+
static adjustBreakForLineEnd(breakAt: number, lineStart: number, forbiddenLineEndClusters: SortedSetTable<number>): number;
|
|
21
|
+
static adjustBreakForUnbreakables(breakAt: number, lineStart: number, unbreakableRanges: UnbreakableRanges): number;
|
|
22
|
+
}
|
|
23
|
+
export declare class ShrinkOpportunity {
|
|
24
|
+
readonly clusterIndex: number;
|
|
25
|
+
readonly tier: number;
|
|
26
|
+
readonly capacity: number;
|
|
27
|
+
readonly channel: ShrinkChannel;
|
|
28
|
+
readonly lineEndOnly: boolean;
|
|
29
|
+
constructor(clusterIndex: number, tier: number, capacity: number, channel: ShrinkChannel, lineEndOnly?: boolean | null);
|
|
30
|
+
toString(): string;
|
|
31
|
+
}
|
|
32
|
+
export declare class UnbreakableRanges {
|
|
33
|
+
readonly ranges: IntRange[];
|
|
34
|
+
private readonly byStart;
|
|
35
|
+
private readonly startsSorted;
|
|
36
|
+
private readonly prefixMaxLast;
|
|
37
|
+
static readonly Empty: UnbreakableRanges;
|
|
38
|
+
constructor(ranges: IntRange[]);
|
|
39
|
+
containsBoundary(candidate: number): boolean;
|
|
40
|
+
containingOrNull(candidate: number): IntRange | null;
|
|
41
|
+
containingFromClosedStartOrNull(index: number): IntRange | null;
|
|
42
|
+
}
|
|
43
|
+
export interface Whitespace {
|
|
44
|
+
readonly kind: "Whitespace";
|
|
45
|
+
}
|
|
46
|
+
export interface Structural {
|
|
47
|
+
readonly kind: "Structural";
|
|
48
|
+
}
|
|
49
|
+
export interface Syllable {
|
|
50
|
+
readonly kind: "Syllable";
|
|
51
|
+
}
|
|
52
|
+
export interface WholeToken {
|
|
53
|
+
readonly kind: "WholeToken";
|
|
54
|
+
}
|
|
55
|
+
export interface Emergency {
|
|
56
|
+
readonly kind: "Emergency";
|
|
57
|
+
}
|
|
58
|
+
export type ProgressiveBreakTier = Whitespace | Structural | Syllable | WholeToken | Emergency;
|
|
59
|
+
export declare const ProgressiveBreakTier: Readonly<{
|
|
60
|
+
Whitespace: Readonly<Whitespace>;
|
|
61
|
+
Structural: Readonly<Structural>;
|
|
62
|
+
Syllable: Readonly<Syllable>;
|
|
63
|
+
WholeToken: Readonly<WholeToken>;
|
|
64
|
+
Emergency: Readonly<Emergency>;
|
|
65
|
+
}>;
|
|
66
|
+
export declare function compareProgressiveBreakTier(a: ProgressiveBreakTier, b: ProgressiveBreakTier): number;
|
|
67
|
+
export interface TrailingGlue {
|
|
68
|
+
readonly kind: "TrailingGlue";
|
|
69
|
+
}
|
|
70
|
+
export interface LeadingGlue {
|
|
71
|
+
readonly kind: "LeadingGlue";
|
|
72
|
+
}
|
|
73
|
+
export interface LeadingAndTrailingGlue {
|
|
74
|
+
readonly kind: "LeadingAndTrailingGlue";
|
|
75
|
+
}
|
|
76
|
+
export interface RawAdvance {
|
|
77
|
+
readonly kind: "RawAdvance";
|
|
78
|
+
}
|
|
79
|
+
export type ShrinkChannel = TrailingGlue | LeadingGlue | LeadingAndTrailingGlue | RawAdvance;
|
|
80
|
+
export declare const ShrinkChannel: Readonly<{
|
|
81
|
+
TrailingGlue: Readonly<TrailingGlue>;
|
|
82
|
+
LeadingGlue: Readonly<LeadingGlue>;
|
|
83
|
+
LeadingAndTrailingGlue: Readonly<LeadingAndTrailingGlue>;
|
|
84
|
+
RawAdvance: Readonly<RawAdvance>;
|
|
85
|
+
}>;
|
|
86
|
+
export declare function compareShrinkChannel(a: ShrinkChannel, b: ShrinkChannel): number;
|