@tiqian/protocol 0.0.0-stage.1 → 0.1.0-alpha.10

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.
Files changed (228) hide show
  1. package/dist/haxe/crypto/Sha256.d.ts +19 -0
  2. package/dist/haxe/crypto/Sha256.js +194 -0
  3. package/dist/org/tiqian/clreq/AdjustmentStylePolicy.d.ts +11 -0
  4. package/dist/org/tiqian/clreq/AdjustmentStylePolicy.js +21 -0
  5. package/dist/org/tiqian/clreq/AutoSpaceMode.d.ts +16 -0
  6. package/dist/org/tiqian/clreq/AutoSpaceMode.js +17 -0
  7. package/dist/org/tiqian/clreq/AutoSpacePolicy.d.ts +13 -0
  8. package/dist/org/tiqian/clreq/AutoSpacePolicy.js +23 -0
  9. package/dist/org/tiqian/clreq/BopomofoReading.d.ts +12 -0
  10. package/dist/org/tiqian/clreq/BopomofoReading.js +86 -0
  11. package/dist/org/tiqian/clreq/BopomofoTone.d.ts +28 -0
  12. package/dist/org/tiqian/clreq/BopomofoTone.js +26 -0
  13. package/dist/org/tiqian/clreq/CjkPunctuationGlyphPolicy.d.ts +16 -0
  14. package/dist/org/tiqian/clreq/CjkPunctuationGlyphPolicy.js +17 -0
  15. package/dist/org/tiqian/clreq/ClreqProfile.d.ts +27 -0
  16. package/dist/org/tiqian/clreq/ClreqProfile.js +58 -0
  17. package/dist/org/tiqian/clreq/ClreqRegion.d.ts +20 -0
  18. package/dist/org/tiqian/clreq/ClreqRegion.js +20 -0
  19. package/dist/org/tiqian/clreq/ClreqStrictness.d.ts +16 -0
  20. package/dist/org/tiqian/clreq/ClreqStrictness.js +17 -0
  21. package/dist/org/tiqian/clreq/GlueSide.d.ts +16 -0
  22. package/dist/org/tiqian/clreq/GlueSide.js +17 -0
  23. package/dist/org/tiqian/clreq/HangingPunctuationStyle.d.ts +12 -0
  24. package/dist/org/tiqian/clreq/HangingPunctuationStyle.js +14 -0
  25. package/dist/org/tiqian/clreq/InteriorPunctuationStyle.d.ts +12 -0
  26. package/dist/org/tiqian/clreq/InteriorPunctuationStyle.js +14 -0
  27. package/dist/org/tiqian/clreq/KinsokuLevel.d.ts +20 -0
  28. package/dist/org/tiqian/clreq/KinsokuLevel.js +20 -0
  29. package/dist/org/tiqian/clreq/KinsokuMode.d.ts +14 -0
  30. package/dist/org/tiqian/clreq/KinsokuMode.js +2 -0
  31. package/dist/org/tiqian/clreq/KinsokuModes.d.ts +11 -0
  32. package/dist/org/tiqian/clreq/KinsokuModes.js +71 -0
  33. package/dist/org/tiqian/clreq/LineAdjustmentStrategy.d.ts +16 -0
  34. package/dist/org/tiqian/clreq/LineAdjustmentStrategy.js +17 -0
  35. package/dist/org/tiqian/clreq/LineEndPunctuationStyle.d.ts +12 -0
  36. package/dist/org/tiqian/clreq/LineEndPunctuationStyle.js +14 -0
  37. package/dist/org/tiqian/clreq/PunctuationClass.d.ts +44 -0
  38. package/dist/org/tiqian/clreq/PunctuationClass.js +38 -0
  39. package/dist/org/tiqian/clreq/PunctuationGluePlacement.d.ts +12 -0
  40. package/dist/org/tiqian/clreq/PunctuationGluePlacement.js +14 -0
  41. package/dist/org/tiqian/clreq/PunctuationGluePlacements.d.ts +9 -0
  42. package/dist/org/tiqian/clreq/PunctuationGluePlacements.js +49 -0
  43. package/dist/org/tiqian/clreq/PunctuationWidthPolicy.d.ts +8 -0
  44. package/dist/org/tiqian/clreq/PunctuationWidthPolicy.js +16 -0
  45. package/dist/org/tiqian/clreq/ResolvedKinsoku.d.ts +12 -0
  46. package/dist/org/tiqian/clreq/ResolvedKinsoku.js +43 -0
  47. package/dist/org/tiqian/core/Cluster.d.ts +13 -0
  48. package/dist/org/tiqian/core/Cluster.js +24 -0
  49. package/dist/org/tiqian/core/EastAsianSpacingData.d.ts +4 -0
  50. package/dist/org/tiqian/core/EastAsianSpacingData.js +399 -0
  51. package/dist/org/tiqian/core/EastAsianSpacingEdges.d.ts +8 -0
  52. package/dist/org/tiqian/core/EastAsianSpacingEdges.js +14 -0
  53. package/dist/org/tiqian/core/EastAsianSpacingValue.d.ts +20 -0
  54. package/dist/org/tiqian/core/EastAsianSpacingValue.js +20 -0
  55. package/dist/org/tiqian/core/Ic.d.ts +7 -0
  56. package/dist/org/tiqian/core/Ic.js +17 -0
  57. package/dist/org/tiqian/core/IllegalStateException.d.ts +4 -0
  58. package/dist/org/tiqian/core/IllegalStateException.js +8 -0
  59. package/dist/org/tiqian/core/IntRange.d.ts +12 -0
  60. package/dist/org/tiqian/core/IntRange.js +30 -0
  61. package/dist/org/tiqian/core/LineEndReason.d.ts +16 -0
  62. package/dist/org/tiqian/core/LineEndReason.js +17 -0
  63. package/dist/org/tiqian/core/SourceBoundaryBias.d.ts +16 -0
  64. package/dist/org/tiqian/core/SourceBoundaryBias.js +17 -0
  65. package/dist/org/tiqian/core/SourceInteractionBoundaries.d.ts +29 -0
  66. package/dist/org/tiqian/core/SourceInteractionBoundaries.js +193 -0
  67. package/dist/org/tiqian/core/TextRange.d.ts +11 -0
  68. package/dist/org/tiqian/core/TextRange.js +40 -0
  69. package/dist/org/tiqian/core/TextRangeError.d.ts +11 -0
  70. package/dist/org/tiqian/core/TextRangeError.js +2 -0
  71. package/dist/org/tiqian/core/TiqianIllegalArgumentException.d.ts +6 -0
  72. package/dist/org/tiqian/core/TiqianIllegalArgumentException.js +21 -0
  73. package/dist/org/tiqian/core/TiqianNoSuchElementException.d.ts +10 -0
  74. package/dist/org/tiqian/core/TiqianNoSuchElementException.js +16 -0
  75. package/dist/org/tiqian/core/UnicodeCombiningMarkData.d.ts +3 -0
  76. package/dist/org/tiqian/core/UnicodeCombiningMarkData.js +109 -0
  77. package/dist/org/tiqian/core/UnicodeEastAsianSpacing.d.ts +16 -0
  78. package/dist/org/tiqian/core/UnicodeEastAsianSpacing.js +88 -0
  79. package/dist/org/tiqian/core/UnicodeEmojiModifierBaseData.d.ts +3 -0
  80. package/dist/org/tiqian/core/UnicodeEmojiModifierBaseData.js +35 -0
  81. package/dist/org/tiqian/core/UnicodeExtendedPictographicData.d.ts +3 -0
  82. package/dist/org/tiqian/core/UnicodeExtendedPictographicData.js +64 -0
  83. package/dist/org/tiqian/core/UnicodeNumber.d.ts +3 -0
  84. package/dist/org/tiqian/core/UnicodeNumber.js +14 -0
  85. package/dist/org/tiqian/core/UnicodeNumberData.d.ts +3 -0
  86. package/dist/org/tiqian/core/UnicodeNumberData.js +64 -0
  87. package/dist/org/tiqian/core/UnicodeScriptEvidence.d.ts +16 -0
  88. package/dist/org/tiqian/core/UnicodeScriptEvidence.js +17 -0
  89. package/dist/org/tiqian/core/UnicodeScriptEvidenceClassifier.d.ts +7 -0
  90. package/dist/org/tiqian/core/UnicodeScriptEvidenceClassifier.js +17 -0
  91. package/dist/org/tiqian/core/UnicodeScriptEvidenceData.d.ts +4 -0
  92. package/dist/org/tiqian/core/UnicodeScriptEvidenceData.js +295 -0
  93. package/dist/org/tiqian/core/UnicodeWordCharacter.d.ts +6 -0
  94. package/dist/org/tiqian/core/UnicodeWordCharacter.js +17 -0
  95. package/dist/org/tiqian/core/UnicodeWordCharacterData.d.ts +3 -0
  96. package/dist/org/tiqian/core/UnicodeWordCharacterData.js +234 -0
  97. package/dist/org/tiqian/font/FontRole.d.ts +28 -0
  98. package/dist/org/tiqian/font/FontRole.js +26 -0
  99. package/dist/org/tiqian/font/FontRoleContext.d.ts +13 -0
  100. package/dist/org/tiqian/font/FontRoleContext.js +28 -0
  101. package/dist/org/tiqian/layout/ContextualQuoteRoleResolver.d.ts +51 -0
  102. package/dist/org/tiqian/layout/ContextualQuoteRoleResolver.js +305 -0
  103. package/dist/org/tiqian/layout/LineOptimization.d.ts +124 -0
  104. package/dist/org/tiqian/layout/LineOptimization.js +298 -0
  105. package/dist/org/tiqian/layout/ProgressiveBreakDecisions.d.ts +86 -0
  106. package/dist/org/tiqian/layout/ProgressiveBreakDecisions.js +415 -0
  107. package/dist/org/tiqian/layout/ProgressiveBreakTierPriority.d.ts +5 -0
  108. package/dist/org/tiqian/layout/ProgressiveBreakTierPriority.js +33 -0
  109. package/dist/org/tiqian/layout/QuotePairAnalyzer.d.ts +63 -0
  110. package/dist/org/tiqian/layout/QuotePairAnalyzer.js +251 -0
  111. package/dist/org/tiqian/linebreak/BreakKind.d.ts +20 -0
  112. package/dist/org/tiqian/linebreak/BreakKind.js +20 -0
  113. package/dist/org/tiqian/protocol/Canonical.d.ts +55 -0
  114. package/dist/org/tiqian/protocol/Canonical.js +471 -0
  115. package/dist/org/tiqian/protocol/DecorationInput.d.ts +6 -0
  116. package/dist/org/tiqian/protocol/DecorationInput.js +12 -0
  117. package/dist/org/tiqian/protocol/EncodeResult.d.ts +9 -0
  118. package/dist/org/tiqian/protocol/EncodeResult.js +2 -0
  119. package/dist/org/tiqian/protocol/FaceInfo.d.ts +13 -0
  120. package/dist/org/tiqian/protocol/FaceInfo.js +2 -0
  121. package/dist/org/tiqian/protocol/FontContract.d.ts +25 -0
  122. package/dist/org/tiqian/protocol/FontContract.js +317 -0
  123. package/dist/org/tiqian/protocol/FontFaceRecord.d.ts +6 -0
  124. package/dist/org/tiqian/protocol/FontFaceRecord.js +2 -0
  125. package/dist/org/tiqian/protocol/FontFaceSpec.d.ts +11 -0
  126. package/dist/org/tiqian/protocol/FontFaceSpec.js +2 -0
  127. package/dist/org/tiqian/protocol/FontWeightSpec.d.ts +10 -0
  128. package/dist/org/tiqian/protocol/FontWeightSpec.js +2 -0
  129. package/dist/org/tiqian/protocol/InlineBoxInput.d.ts +7 -0
  130. package/dist/org/tiqian/protocol/InlineBoxInput.js +2 -0
  131. package/dist/org/tiqian/protocol/InlineObjectInput.d.ts +7 -0
  132. package/dist/org/tiqian/protocol/InlineObjectInput.js +2 -0
  133. package/dist/org/tiqian/protocol/JsCoerce.d.ts +19 -0
  134. package/dist/org/tiqian/protocol/JsCoerce.js +394 -0
  135. package/dist/org/tiqian/protocol/LayoutAttribute.d.ts +5 -0
  136. package/dist/org/tiqian/protocol/LayoutAttribute.js +10 -0
  137. package/dist/org/tiqian/protocol/LayoutFloatShape.d.ts +14 -0
  138. package/dist/org/tiqian/protocol/LayoutFloatShape.js +2 -0
  139. package/dist/org/tiqian/protocol/LayoutTree.d.ts +23 -0
  140. package/dist/org/tiqian/protocol/LayoutTree.js +2 -0
  141. package/dist/org/tiqian/protocol/LayoutVertex.d.ts +4 -0
  142. package/dist/org/tiqian/protocol/LayoutVertex.js +2 -0
  143. package/dist/org/tiqian/protocol/LineBreakSpanInput.d.ts +6 -0
  144. package/dist/org/tiqian/protocol/LineBreakSpanInput.js +12 -0
  145. package/dist/org/tiqian/protocol/MetricEntry.d.ts +11 -0
  146. package/dist/org/tiqian/protocol/MetricEntry.js +21 -0
  147. package/dist/org/tiqian/protocol/NamedError.d.ts +88 -0
  148. package/dist/org/tiqian/protocol/NamedError.js +71 -0
  149. package/dist/org/tiqian/protocol/NamedErrorNames.d.ts +5 -0
  150. package/dist/org/tiqian/protocol/NamedErrorNames.js +53 -0
  151. package/dist/org/tiqian/protocol/ParagraphRequest.d.ts +25 -0
  152. package/dist/org/tiqian/protocol/ParagraphRequest.js +2 -0
  153. package/dist/org/tiqian/protocol/ParagraphRequestChecks.d.ts +8 -0
  154. package/dist/org/tiqian/protocol/ParagraphRequestChecks.js +145 -0
  155. package/dist/org/tiqian/protocol/ParagraphRequestException.d.ts +6 -0
  156. package/dist/org/tiqian/protocol/ParagraphRequestException.js +55 -0
  157. package/dist/org/tiqian/protocol/ParagraphRequestFields.d.ts +3 -0
  158. package/dist/org/tiqian/protocol/ParagraphRequestFields.js +4 -0
  159. package/dist/org/tiqian/protocol/Plan.d.ts +101 -0
  160. package/dist/org/tiqian/protocol/Plan.js +10 -0
  161. package/dist/org/tiqian/protocol/PlanEndReason.d.ts +16 -0
  162. package/dist/org/tiqian/protocol/PlanEndReason.js +17 -0
  163. package/dist/org/tiqian/protocol/PlanJsonNumber.d.ts +43 -0
  164. package/dist/org/tiqian/protocol/PlanJsonNumber.js +362 -0
  165. package/dist/org/tiqian/protocol/PlanSchema.d.ts +4 -0
  166. package/dist/org/tiqian/protocol/PlanSchema.js +5 -0
  167. package/dist/org/tiqian/protocol/PlanStyleDelta.d.ts +5 -0
  168. package/dist/org/tiqian/protocol/PlanStyleDelta.js +2 -0
  169. package/dist/org/tiqian/protocol/Revision.d.ts +11 -0
  170. package/dist/org/tiqian/protocol/Revision.js +12 -0
  171. package/dist/org/tiqian/protocol/SessionFaceSpec.d.ts +5 -0
  172. package/dist/org/tiqian/protocol/SessionFaceSpec.js +2 -0
  173. package/dist/org/tiqian/protocol/SnapshotTableBinary.d.ts +55 -0
  174. package/dist/org/tiqian/protocol/SnapshotTableBinary.js +657 -0
  175. package/dist/org/tiqian/protocol/SnapshotTypography.d.ts +14 -0
  176. package/dist/org/tiqian/protocol/SnapshotTypography.js +2 -0
  177. package/dist/org/tiqian/protocol/StyleRow.d.ts +8 -0
  178. package/dist/org/tiqian/protocol/StyleRow.js +15 -0
  179. package/dist/org/tiqian/protocol/TableData.d.ts +25 -0
  180. package/dist/org/tiqian/protocol/TableData.js +45 -0
  181. package/dist/org/tiqian/protocol/TableInput.d.ts +13 -0
  182. package/dist/org/tiqian/protocol/TableInput.js +21 -0
  183. package/dist/org/tiqian/protocol/TableMetricRow.d.ts +9 -0
  184. package/dist/org/tiqian/protocol/TableMetricRow.js +17 -0
  185. package/dist/org/tiqian/protocol/TableProbe.d.ts +11 -0
  186. package/dist/org/tiqian/protocol/TableProbe.js +21 -0
  187. package/dist/org/tiqian/protocol/TextSpanInput.d.ts +9 -0
  188. package/dist/org/tiqian/protocol/TextSpanInput.js +2 -0
  189. package/dist/org/tiqian/protocol/ValueRow.d.ts +4 -0
  190. package/dist/org/tiqian/protocol/ValueRow.js +7 -0
  191. package/dist/org/tiqian/protocol/WireField.d.ts +5 -0
  192. package/dist/org/tiqian/protocol/WireField.js +2 -0
  193. package/dist/org/tiqian/protocol/WireValue.d.ts +25 -0
  194. package/dist/org/tiqian/protocol/WireValue.js +2 -0
  195. package/dist/org/tiqian/test/TestHelpers.d.ts +5 -0
  196. package/dist/org/tiqian/test/TestHelpers.js +27 -0
  197. package/dist/org/tiqian/test/trace/TestTrace.d.ts +6 -0
  198. package/dist/org/tiqian/test/trace/TestTrace.js +8 -0
  199. package/dist/org/tiqian/test/trace/TestTracePlatform.d.ts +6 -0
  200. package/dist/org/tiqian/test/trace/TestTracePlatform.js +78 -0
  201. package/dist/org/tiqian/test/trace/TestTraceRecorder.d.ts +9 -0
  202. package/dist/org/tiqian/test/trace/TestTraceRecorder.js +36 -0
  203. package/dist/org/tiqian/test/trace/TestTraceRender.d.ts +47 -0
  204. package/dist/org/tiqian/test/trace/TestTraceRender.js +690 -0
  205. package/dist/org/tiqian/test/trace/TestTraceStore.d.ts +18 -0
  206. package/dist/org/tiqian/test/trace/TestTraceStore.js +149 -0
  207. package/dist/org/tiqian/test/trace/TraceAssertionError.d.ts +5 -0
  208. package/dist/org/tiqian/test/trace/TraceAssertionError.js +2 -0
  209. package/dist/org/tiqian/test/trace/TraceAssertionException.d.ts +6 -0
  210. package/dist/org/tiqian/test/trace/TraceAssertionException.js +16 -0
  211. package/dist/org/tiqian/test/trace/TraceField.d.ts +5 -0
  212. package/dist/org/tiqian/test/trace/TraceField.js +10 -0
  213. package/dist/org/tiqian/test/trace/TraceFormat.d.ts +21 -0
  214. package/dist/org/tiqian/test/trace/TraceFormat.js +184 -0
  215. package/dist/org/tiqian/test/trace/TracedAssertions.d.ts +78 -0
  216. package/dist/org/tiqian/test/trace/TracedAssertions.js +749 -0
  217. package/dist/runtime.d.ts +96 -0
  218. package/dist/runtime.js +1612 -0
  219. package/dist/std/FsError.d.ts +48 -0
  220. package/dist/std/FsError.js +2 -0
  221. package/dist/std/FsException.d.ts +6 -0
  222. package/dist/std/FsException.js +45 -0
  223. package/dist/std/UStringException.d.ts +6 -0
  224. package/dist/std/UStringException.js +21 -0
  225. package/dist/std/UStringFault.d.ts +9 -0
  226. package/dist/std/UStringFault.js +2 -0
  227. package/package.json +26 -4
  228. 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;