@tiqian/shared 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.
- 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/shared/SnapshotValueStyle.d.ts +11 -0
- package/dist/org/tiqian/shared/SnapshotValueStyle.js +64 -0
- package/dist/org/tiqian/shared/ValueStyleInterner.d.ts +7 -0
- package/dist/org/tiqian/shared/ValueStyleInterner.js +23 -0
- package/dist/org/tiqian/shared/html/CompoundSelector.d.ts +28 -0
- package/dist/org/tiqian/shared/html/CompoundSelector.js +247 -0
- package/dist/org/tiqian/shared/html/DomAttribute.d.ts +5 -0
- package/dist/org/tiqian/shared/html/DomAttribute.js +10 -0
- package/dist/org/tiqian/shared/html/DomNode.d.ts +10 -0
- package/dist/org/tiqian/shared/html/DomNode.js +2 -0
- package/dist/org/tiqian/shared/html/DomParser.d.ts +16 -0
- package/dist/org/tiqian/shared/html/DomParser.js +84 -0
- package/dist/org/tiqian/shared/html/HtmlAttributeInsertion.d.ts +4 -0
- package/dist/org/tiqian/shared/html/HtmlAttributeInsertion.js +2 -0
- package/dist/org/tiqian/shared/html/HtmlError.d.ts +16 -0
- package/dist/org/tiqian/shared/html/HtmlError.js +17 -0
- package/dist/org/tiqian/shared/html/HtmlNameCase.d.ts +3 -0
- package/dist/org/tiqian/shared/html/HtmlNameCase.js +20 -0
- package/dist/org/tiqian/shared/html/HtmlOpeningTag.d.ts +6 -0
- package/dist/org/tiqian/shared/html/HtmlOpeningTag.js +12 -0
- package/dist/org/tiqian/shared/html/HtmlParseException.d.ts +6 -0
- package/dist/org/tiqian/shared/html/HtmlParseException.js +19 -0
- package/dist/org/tiqian/shared/html/HtmlScan.d.ts +16 -0
- package/dist/org/tiqian/shared/html/HtmlScan.js +191 -0
- package/dist/org/tiqian/shared/prepared_dom/AttributeEntry.d.ts +5 -0
- package/dist/org/tiqian/shared/prepared_dom/AttributeEntry.js +10 -0
- package/dist/org/tiqian/shared/prepared_dom/BopomofoPlacement.d.ts +8 -0
- package/dist/org/tiqian/shared/prepared_dom/BopomofoPlacement.js +2 -0
- package/dist/org/tiqian/shared/prepared_dom/BopomofoPlacementCss.d.ts +6 -0
- package/dist/org/tiqian/shared/prepared_dom/BopomofoPlacementCss.js +2 -0
- package/dist/org/tiqian/shared/prepared_dom/BopomofoZone.d.ts +7 -0
- package/dist/org/tiqian/shared/prepared_dom/BopomofoZone.js +2 -0
- package/dist/org/tiqian/shared/prepared_dom/EmphasisDotColorResolver.d.ts +4 -0
- package/dist/org/tiqian/shared/prepared_dom/EmphasisDotColorResolver.js +2 -0
- package/dist/org/tiqian/shared/prepared_dom/Evidence.d.ts +33 -0
- package/dist/org/tiqian/shared/prepared_dom/Evidence.js +251 -0
- package/dist/org/tiqian/shared/prepared_dom/EvidenceDecorationKind.d.ts +12 -0
- package/dist/org/tiqian/shared/prepared_dom/EvidenceDecorationKind.js +14 -0
- package/dist/org/tiqian/shared/prepared_dom/EvidenceDecorationSegment.d.ts +7 -0
- package/dist/org/tiqian/shared/prepared_dom/EvidenceDecorationSegment.js +2 -0
- package/dist/org/tiqian/shared/prepared_dom/EvidenceEmphasisDot.d.ts +6 -0
- package/dist/org/tiqian/shared/prepared_dom/EvidenceEmphasisDot.js +2 -0
- package/dist/org/tiqian/shared/prepared_dom/EvidenceOverlayOptions.d.ts +4 -0
- package/dist/org/tiqian/shared/prepared_dom/EvidenceOverlayOptions.js +2 -0
- package/dist/org/tiqian/shared/prepared_dom/EvidenceOverlayPlan.d.ts +9 -0
- package/dist/org/tiqian/shared/prepared_dom/EvidenceOverlayPlan.js +2 -0
- package/dist/org/tiqian/shared/prepared_dom/FixedEmphasisDotColor.d.ts +5 -0
- package/dist/org/tiqian/shared/prepared_dom/FixedEmphasisDotColor.js +8 -0
- package/dist/org/tiqian/shared/prepared_dom/InlineBoxEntry.d.ts +6 -0
- package/dist/org/tiqian/shared/prepared_dom/InlineBoxEntry.js +2 -0
- package/dist/org/tiqian/shared/prepared_dom/InlineEdgeEntry.d.ts +5 -0
- package/dist/org/tiqian/shared/prepared_dom/InlineEdgeEntry.js +2 -0
- package/dist/org/tiqian/shared/prepared_dom/InlineObjectPlaceholderCell.d.ts +6 -0
- package/dist/org/tiqian/shared/prepared_dom/InlineObjectPlaceholderCell.js +2 -0
- package/dist/org/tiqian/shared/prepared_dom/Markup.d.ts +30 -0
- package/dist/org/tiqian/shared/prepared_dom/Markup.js +344 -0
- package/dist/org/tiqian/shared/prepared_dom/MarkupArtifact.d.ts +12 -0
- package/dist/org/tiqian/shared/prepared_dom/MarkupArtifact.js +2 -0
- package/dist/org/tiqian/shared/prepared_dom/MarkupContainer.d.ts +7 -0
- package/dist/org/tiqian/shared/prepared_dom/MarkupContainer.js +2 -0
- package/dist/org/tiqian/shared/prepared_dom/MarkupNode.d.ts +5 -0
- package/dist/org/tiqian/shared/prepared_dom/MarkupNode.js +2 -0
- package/dist/org/tiqian/shared/prepared_dom/NumericFeatureContract.d.ts +4 -0
- package/dist/org/tiqian/shared/prepared_dom/NumericFeatureContract.js +2 -0
- package/dist/org/tiqian/shared/prepared_dom/NumericFeatures.d.ts +8 -0
- package/dist/org/tiqian/shared/prepared_dom/NumericFeatures.js +50 -0
- package/dist/org/tiqian/shared/prepared_dom/PlanBopomofoZone.d.ts +8 -0
- package/dist/org/tiqian/shared/prepared_dom/PlanBopomofoZone.js +2 -0
- package/dist/org/tiqian/shared/prepared_dom/PlanRubyAnnotation.d.ts +10 -0
- package/dist/org/tiqian/shared/prepared_dom/PlanRubyAnnotation.js +2 -0
- package/dist/org/tiqian/shared/prepared_dom/PreparedArtifact.d.ts +23 -0
- package/dist/org/tiqian/shared/prepared_dom/PreparedArtifact.js +477 -0
- package/dist/org/tiqian/shared/prepared_dom/PreparedArtifactOptions.d.ts +15 -0
- package/dist/org/tiqian/shared/prepared_dom/PreparedArtifactOptions.js +2 -0
- package/dist/org/tiqian/shared/prepared_dom/PreparedArtifactResult.d.ts +8 -0
- package/dist/org/tiqian/shared/prepared_dom/PreparedArtifactResult.js +2 -0
- package/dist/org/tiqian/shared/prepared_dom/PreparedArtifactState.d.ts +11 -0
- package/dist/org/tiqian/shared/prepared_dom/PreparedArtifactState.js +2 -0
- package/dist/org/tiqian/shared/prepared_dom/PreparedCjkStrongSemantic.d.ts +5 -0
- package/dist/org/tiqian/shared/prepared_dom/PreparedCjkStrongSemantic.js +2 -0
- package/dist/org/tiqian/shared/prepared_dom/PreparedDom.d.ts +29 -0
- package/dist/org/tiqian/shared/prepared_dom/PreparedDom.js +191 -0
- package/dist/org/tiqian/shared/prepared_dom/PreparedDomError.d.ts +15 -0
- package/dist/org/tiqian/shared/prepared_dom/PreparedDomError.js +2 -0
- package/dist/org/tiqian/shared/prepared_dom/PreparedDomException.d.ts +6 -0
- package/dist/org/tiqian/shared/prepared_dom/PreparedDomException.js +25 -0
- package/dist/org/tiqian/shared/prepared_dom/PreparedDomTestSupport.d.ts +11 -0
- package/dist/org/tiqian/shared/prepared_dom/PreparedDomTestSupport.js +93 -0
- package/dist/org/tiqian/shared/prepared_dom/PreparedEmphasisRange.d.ts +4 -0
- package/dist/org/tiqian/shared/prepared_dom/PreparedEmphasisRange.js +2 -0
- package/dist/org/tiqian/shared/prepared_dom/PreparedLineChild.d.ts +16 -0
- package/dist/org/tiqian/shared/prepared_dom/PreparedLineChild.js +2 -0
- package/dist/org/tiqian/shared/prepared_dom/PreparedPlan.d.ts +19 -0
- package/dist/org/tiqian/shared/prepared_dom/PreparedPlan.js +2 -0
- package/dist/org/tiqian/shared/prepared_dom/PreparedPlanCell.d.ts +26 -0
- package/dist/org/tiqian/shared/prepared_dom/PreparedPlanCell.js +2 -0
- package/dist/org/tiqian/shared/prepared_dom/PreparedPlanLine.d.ts +13 -0
- package/dist/org/tiqian/shared/prepared_dom/PreparedPlanLine.js +2 -0
- package/dist/org/tiqian/shared/prepared_dom/PreparedRenderTextSpan.d.ts +6 -0
- package/dist/org/tiqian/shared/prepared_dom/PreparedRenderTextSpan.js +2 -0
- package/dist/org/tiqian/shared/prepared_dom/PreparedRunRenderInput.d.ts +23 -0
- package/dist/org/tiqian/shared/prepared_dom/PreparedRunRenderInput.js +2 -0
- package/dist/org/tiqian/shared/prepared_dom/PreparedRunSignature.d.ts +19 -0
- package/dist/org/tiqian/shared/prepared_dom/PreparedRunSignature.js +2 -0
- package/dist/org/tiqian/shared/prepared_dom/PreparedRunTyped.d.ts +32 -0
- package/dist/org/tiqian/shared/prepared_dom/PreparedRunTyped.js +2 -0
- package/dist/org/tiqian/shared/prepared_dom/PreparedSemanticSpan.d.ts +10 -0
- package/dist/org/tiqian/shared/prepared_dom/PreparedSemanticSpan.js +2 -0
- package/dist/org/tiqian/shared/prepared_dom/PreparedSpacingResult.d.ts +4 -0
- package/dist/org/tiqian/shared/prepared_dom/PreparedSpacingResult.js +2 -0
- package/dist/org/tiqian/shared/prepared_dom/RenderedMarkupContainer.d.ts +16 -0
- package/dist/org/tiqian/shared/prepared_dom/RenderedMarkupContainer.js +48 -0
- package/dist/org/tiqian/shared/prepared_dom/RenderedMarkupNode.d.ts +11 -0
- package/dist/org/tiqian/shared/prepared_dom/RenderedMarkupNode.js +21 -0
- package/dist/org/tiqian/shared/prepared_dom/RubyAnnotation.d.ts +9 -0
- package/dist/org/tiqian/shared/prepared_dom/RubyAnnotation.js +2 -0
- package/dist/org/tiqian/shared/prepared_dom/StyleClassResolver.d.ts +4 -0
- package/dist/org/tiqian/shared/prepared_dom/StyleClassResolver.js +2 -0
- package/dist/org/tiqian/shared/prepared_dom/StyleDelta.d.ts +5 -0
- package/dist/org/tiqian/shared/prepared_dom/StyleDelta.js +2 -0
- package/dist/org/tiqian/shared/snapshot/SnapshotSource.d.ts +24 -0
- package/dist/org/tiqian/shared/snapshot/SnapshotSource.js +135 -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/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 +22 -4
- package/README.md +0 -3
|
@@ -0,0 +1,415 @@
|
|
|
1
|
+
// Generated by the reflaxe TypeScript target. Do not edit.
|
|
2
|
+
import { ProgressiveBreakTierPriority } from "./ProgressiveBreakTierPriority.js";
|
|
3
|
+
import { SortedTable } from "../../../runtime.js";
|
|
4
|
+
export class ProgressiveBreakOpportunity {
|
|
5
|
+
tier;
|
|
6
|
+
spanRange;
|
|
7
|
+
precedingWhitespaceStretchCapacity;
|
|
8
|
+
constructor(tier, spanRange, precedingWhitespaceStretchCapacity = null) {
|
|
9
|
+
this.tier = tier;
|
|
10
|
+
this.spanRange = spanRange;
|
|
11
|
+
this.precedingWhitespaceStretchCapacity = precedingWhitespaceStretchCapacity ?? 0.0;
|
|
12
|
+
}
|
|
13
|
+
toString() {
|
|
14
|
+
return `ProgressiveBreakOpportunity(tier=${this.tier.kind}, spanRange=${this.spanRange.toString()}, precedingWhitespaceStretchCapacity=${this.precedingWhitespaceStretchCapacity})`;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export function lineLimit(maxWidth, firstLineIndent, lineStartCluster) {
|
|
18
|
+
return (lineStartCluster === 0 ? maxWidth - firstLineIndent : maxWidth);
|
|
19
|
+
}
|
|
20
|
+
export class ProgressiveBreakDecisions {
|
|
21
|
+
static decideProgressiveBreak(lineStart, overflowAt, opportunities, adjustedClusters, lineLimit, cjkInterCharBoundaries, maxCjkStretchPerGap, sinoWesternBoundaries, sinoWesternStretchCap) {
|
|
22
|
+
adjustedClusters = adjustedClusters ?? null;
|
|
23
|
+
lineLimit = lineLimit ?? null;
|
|
24
|
+
cjkInterCharBoundaries = cjkInterCharBoundaries ?? null;
|
|
25
|
+
maxCjkStretchPerGap = maxCjkStretchPerGap ?? null;
|
|
26
|
+
sinoWesternBoundaries = sinoWesternBoundaries ?? null;
|
|
27
|
+
sinoWesternStretchCap = sinoWesternStretchCap ?? null;
|
|
28
|
+
const limit = lineLimit ?? Infinity;
|
|
29
|
+
const cjk = cjkInterCharBoundaries ?? SortedTable.setBuilder(SortedTable.compareInts).build();
|
|
30
|
+
const max = maxCjkStretchPerGap ?? Infinity;
|
|
31
|
+
const sino = sinoWesternBoundaries ?? SortedTable.setBuilder(SortedTable.compareInts).build();
|
|
32
|
+
const cap = sinoWesternStretchCap ?? 0.0;
|
|
33
|
+
const active = opportunities.get(overflowAt);
|
|
34
|
+
if (active === null) {
|
|
35
|
+
return overflowAt;
|
|
36
|
+
}
|
|
37
|
+
const bestPriority = ProgressiveBreakDecisions.progressiveBreakPriorityForLine(lineStart, overflowAt, (active), opportunities, adjustedClusters, (limit), (cjk), (max), (sino), (cap));
|
|
38
|
+
let best = null;
|
|
39
|
+
let boundary = lineStart + 1;
|
|
40
|
+
while (boundary <= overflowAt) {
|
|
41
|
+
const o = opportunities.get(boundary);
|
|
42
|
+
if (o !== null && o.spanRange.start === active.spanRange.start && o.spanRange.end === active.spanRange.end && ProgressiveBreakTierPriority.priority(o.tier) === bestPriority && (best === null || boundary > best)) {
|
|
43
|
+
best = boundary;
|
|
44
|
+
}
|
|
45
|
+
boundary++;
|
|
46
|
+
}
|
|
47
|
+
return (best === null ? overflowAt : best);
|
|
48
|
+
}
|
|
49
|
+
static progressiveCandidateAllowed(lineStart, rawGreedy, candidateEnd, opportunities, adjustedClusters, lineLimit, cjkInterCharBoundaries, maxCjkStretchPerGap, sinoWesternBoundaries, sinoWesternStretchCap) {
|
|
50
|
+
adjustedClusters = adjustedClusters ?? null;
|
|
51
|
+
lineLimit = lineLimit ?? null;
|
|
52
|
+
cjkInterCharBoundaries = cjkInterCharBoundaries ?? null;
|
|
53
|
+
maxCjkStretchPerGap = maxCjkStretchPerGap ?? null;
|
|
54
|
+
sinoWesternBoundaries = sinoWesternBoundaries ?? null;
|
|
55
|
+
sinoWesternStretchCap = sinoWesternStretchCap ?? null;
|
|
56
|
+
const limit = lineLimit ?? Infinity;
|
|
57
|
+
const cjk = cjkInterCharBoundaries ?? SortedTable.setBuilder(SortedTable.compareInts).build();
|
|
58
|
+
const max = maxCjkStretchPerGap ?? Infinity;
|
|
59
|
+
const sino = sinoWesternBoundaries ?? SortedTable.setBuilder(SortedTable.compareInts).build();
|
|
60
|
+
const cap = sinoWesternStretchCap ?? 0.0;
|
|
61
|
+
const active = opportunities.get(rawGreedy);
|
|
62
|
+
if (active === null) {
|
|
63
|
+
return true;
|
|
64
|
+
}
|
|
65
|
+
const candidate = opportunities.get(candidateEnd);
|
|
66
|
+
if (candidate === null) {
|
|
67
|
+
if (adjustedClusters === null || candidateEnd < 0 || candidateEnd >= adjustedClusters.length) {
|
|
68
|
+
return true;
|
|
69
|
+
}
|
|
70
|
+
const source = adjustedClusters[candidateEnd].range.start;
|
|
71
|
+
return source <= active.spanRange.start || source >= active.spanRange.end;
|
|
72
|
+
}
|
|
73
|
+
if (candidate.spanRange.start !== active.spanRange.start || candidate.spanRange.end !== active.spanRange.end) {
|
|
74
|
+
return true;
|
|
75
|
+
}
|
|
76
|
+
if (candidateEnd > rawGreedy) {
|
|
77
|
+
return ProgressiveBreakTierPriority.priority(candidate.tier) <= ProgressiveBreakTierPriority.priority(active.tier);
|
|
78
|
+
}
|
|
79
|
+
const selected = ProgressiveBreakDecisions.decideProgressiveBreak(lineStart, rawGreedy, opportunities, adjustedClusters, limit, cjk, max, sino, cap);
|
|
80
|
+
return candidateEnd === selected;
|
|
81
|
+
}
|
|
82
|
+
static progressiveBreakPriorityForLine(lineStart, overflowAt, active, opportunities, adjustedClusters, lineLimit, cjkInterCharBoundaries, maxCjkStretchPerGap, sinoWesternBoundaries, sinoWesternStretchCap) {
|
|
83
|
+
const prioritiesBuilder = SortedTable.setBuilder(SortedTable.compareInts);
|
|
84
|
+
let i = lineStart + 1;
|
|
85
|
+
while (i <= overflowAt) {
|
|
86
|
+
const o = opportunities.get(i);
|
|
87
|
+
if (o !== null && o.spanRange.start === active.spanRange.start && o.spanRange.end === active.spanRange.end) {
|
|
88
|
+
prioritiesBuilder.put(ProgressiveBreakTierPriority.priority(o.tier));
|
|
89
|
+
}
|
|
90
|
+
i++;
|
|
91
|
+
}
|
|
92
|
+
const priorities = prioritiesBuilder.build();
|
|
93
|
+
if (priorities.size() === 0) {
|
|
94
|
+
return ProgressiveBreakTierPriority.priority(active.tier);
|
|
95
|
+
}
|
|
96
|
+
if (adjustedClusters === null || !Number.isFinite(lineLimit) || !Number.isFinite(maxCjkStretchPerGap)) {
|
|
97
|
+
return priorities.at(0);
|
|
98
|
+
}
|
|
99
|
+
const stretch = maxCjkStretchPerGap * 0.0;
|
|
100
|
+
let least = priorities.at(0);
|
|
101
|
+
let density = Infinity;
|
|
102
|
+
let leastBoundary = lineStart + 1;
|
|
103
|
+
let pi = 0;
|
|
104
|
+
while (pi < priorities.size()) {
|
|
105
|
+
const priority = priorities.at(pi);
|
|
106
|
+
let b = 0;
|
|
107
|
+
i = lineStart + 1;
|
|
108
|
+
while (i <= overflowAt) {
|
|
109
|
+
const o2 = opportunities.get(i);
|
|
110
|
+
if (o2 !== null && o2.spanRange.start === active.spanRange.start && o2.spanRange.end === active.spanRange.end && ProgressiveBreakTierPriority.priority(o2.tier) === priority) {
|
|
111
|
+
b = i;
|
|
112
|
+
}
|
|
113
|
+
i++;
|
|
114
|
+
}
|
|
115
|
+
if (b === 0) {
|
|
116
|
+
pi++;
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
const d = ProgressiveBreakDecisions.progressiveCandidateStretchDensity(lineStart, b, opportunities, (adjustedClusters), lineLimit, cjkInterCharBoundaries, sinoWesternBoundaries, sinoWesternStretchCap);
|
|
120
|
+
if (d < density) {
|
|
121
|
+
density = d;
|
|
122
|
+
least = priority;
|
|
123
|
+
leastBoundary = b;
|
|
124
|
+
}
|
|
125
|
+
if (d <= stretch) {
|
|
126
|
+
return priority;
|
|
127
|
+
}
|
|
128
|
+
pi++;
|
|
129
|
+
}
|
|
130
|
+
let emergency = 0;
|
|
131
|
+
i = lineStart + 1;
|
|
132
|
+
while (i <= overflowAt) {
|
|
133
|
+
const o3 = opportunities.get(i);
|
|
134
|
+
if (o3 !== null && o3.spanRange.start === active.spanRange.start && o3.spanRange.end === active.spanRange.end && o3.tier.kind === "Emergency") {
|
|
135
|
+
emergency = i;
|
|
136
|
+
}
|
|
137
|
+
i++;
|
|
138
|
+
}
|
|
139
|
+
return (emergency !== 0 && emergency >= leastBoundary ? ProgressiveBreakTierPriority.priority(ProgressiveBreakTier.Emergency) : least);
|
|
140
|
+
}
|
|
141
|
+
static progressiveCandidateStretchDensity(lineStart, boundary, opportunities, adjustedClusters, lineLimit, cjkInterCharBoundaries, sinoWesternBoundaries, sinoWesternStretchCap) {
|
|
142
|
+
let width = 0.0;
|
|
143
|
+
let i = lineStart;
|
|
144
|
+
while (i < boundary) {
|
|
145
|
+
width += adjustedClusters[i].advance;
|
|
146
|
+
i++;
|
|
147
|
+
}
|
|
148
|
+
const deficit = Math.max(lineLimit - width, 0);
|
|
149
|
+
let technical = 0.0;
|
|
150
|
+
i = lineStart + 1;
|
|
151
|
+
while (i < boundary) {
|
|
152
|
+
const o = opportunities.get(i);
|
|
153
|
+
if (o !== null && o.tier.kind === "Whitespace") {
|
|
154
|
+
technical += o.precedingWhitespaceStretchCapacity;
|
|
155
|
+
}
|
|
156
|
+
i++;
|
|
157
|
+
}
|
|
158
|
+
let sino = 0;
|
|
159
|
+
i = lineStart + 1;
|
|
160
|
+
while (i < boundary) {
|
|
161
|
+
if (sinoWesternBoundaries.has(i)) {
|
|
162
|
+
sino++;
|
|
163
|
+
}
|
|
164
|
+
i++;
|
|
165
|
+
}
|
|
166
|
+
const cjkDeficit = Math.max(deficit - technical - sino * sinoWesternStretchCap, 0);
|
|
167
|
+
const active = opportunities.get(boundary);
|
|
168
|
+
let units = 0;
|
|
169
|
+
if (active !== null) {
|
|
170
|
+
i = lineStart;
|
|
171
|
+
while (i < boundary) {
|
|
172
|
+
const c = adjustedClusters[i];
|
|
173
|
+
if (c.range.start >= active.spanRange.start && c.range.end <= active.spanRange.end && !ProgressiveBreakDecisions.hasWhitespaceUnit(c.text)) {
|
|
174
|
+
units += c.text.length;
|
|
175
|
+
}
|
|
176
|
+
i++;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
const technicalGaps = Math.max(units - 1, 0);
|
|
180
|
+
if (technicalGaps > 0) {
|
|
181
|
+
return cjkDeficit / technicalGaps;
|
|
182
|
+
}
|
|
183
|
+
let gaps = 0;
|
|
184
|
+
i = lineStart + 1;
|
|
185
|
+
while (i < boundary) {
|
|
186
|
+
if (cjkInterCharBoundaries.has(i)) {
|
|
187
|
+
gaps++;
|
|
188
|
+
}
|
|
189
|
+
i++;
|
|
190
|
+
}
|
|
191
|
+
return (gaps === 0 ? cjkDeficit : cjkDeficit / gaps);
|
|
192
|
+
}
|
|
193
|
+
static hasWhitespaceUnit(s) {
|
|
194
|
+
let i = 0;
|
|
195
|
+
while (i < s.length) {
|
|
196
|
+
const c = (Number.isNaN(s.charCodeAt(i)) ? null : s.charCodeAt(i));
|
|
197
|
+
if (c >= 9 && c <= 13 || c >= 28 && c <= 32 || c === 160 || c === 5760 || c >= 8192 && c <= 8202 || c === 8232 || c === 8233 || c === 8239 || c === 8287 || c === 12288) {
|
|
198
|
+
return true;
|
|
199
|
+
}
|
|
200
|
+
i++;
|
|
201
|
+
}
|
|
202
|
+
return false;
|
|
203
|
+
}
|
|
204
|
+
static decideHyphenBreak(lineStart, overflowAt, adjustedClusters, lineLimit, hyphenBreakClusters, cjkInterCharBoundaries, maxCjkStretchPerGap, sinoWesternBoundaries, sinoWesternStretchCap) {
|
|
205
|
+
sinoWesternBoundaries = sinoWesternBoundaries ?? null;
|
|
206
|
+
sinoWesternStretchCap = sinoWesternStretchCap ?? null;
|
|
207
|
+
const sino = sinoWesternBoundaries ?? SortedTable.setBuilder(SortedTable.compareInts).build();
|
|
208
|
+
const cap = sinoWesternStretchCap ?? 0.0;
|
|
209
|
+
if (!hyphenBreakClusters.has(overflowAt)) {
|
|
210
|
+
return overflowAt;
|
|
211
|
+
}
|
|
212
|
+
let whole = overflowAt;
|
|
213
|
+
while (whole > lineStart && hyphenBreakClusters.has(whole)) {
|
|
214
|
+
whole--;
|
|
215
|
+
}
|
|
216
|
+
if (whole <= lineStart) {
|
|
217
|
+
return overflowAt;
|
|
218
|
+
}
|
|
219
|
+
let width = 0.0;
|
|
220
|
+
let k = lineStart;
|
|
221
|
+
while (k < whole) {
|
|
222
|
+
width += adjustedClusters[k].advance;
|
|
223
|
+
k++;
|
|
224
|
+
}
|
|
225
|
+
const deficit = lineLimit - width;
|
|
226
|
+
if (deficit <= 0) {
|
|
227
|
+
return whole;
|
|
228
|
+
}
|
|
229
|
+
let sw = 0;
|
|
230
|
+
k = lineStart + 1;
|
|
231
|
+
while (k < whole) {
|
|
232
|
+
if (sino.has(k)) {
|
|
233
|
+
sw++;
|
|
234
|
+
}
|
|
235
|
+
k++;
|
|
236
|
+
}
|
|
237
|
+
const cjk = Math.max(deficit - sw * cap, 0);
|
|
238
|
+
let gaps = 0;
|
|
239
|
+
k = lineStart + 1;
|
|
240
|
+
while (k < whole) {
|
|
241
|
+
if (cjkInterCharBoundaries.has(k)) {
|
|
242
|
+
gaps++;
|
|
243
|
+
}
|
|
244
|
+
k++;
|
|
245
|
+
}
|
|
246
|
+
return (gaps === 0 || cjk / gaps > maxCjkStretchPerGap ? overflowAt : whole);
|
|
247
|
+
}
|
|
248
|
+
static adjustBreakForLineEnd(breakAt, lineStart, forbiddenLineEndClusters) {
|
|
249
|
+
let b = breakAt;
|
|
250
|
+
while (b - 1 > lineStart && forbiddenLineEndClusters.has(b - 1)) {
|
|
251
|
+
b--;
|
|
252
|
+
}
|
|
253
|
+
return b;
|
|
254
|
+
}
|
|
255
|
+
static adjustBreakForUnbreakables(breakAt, lineStart, unbreakableRanges) {
|
|
256
|
+
let candidate = breakAt;
|
|
257
|
+
while (true) {
|
|
258
|
+
const containing = unbreakableRanges.containingOrNull(candidate);
|
|
259
|
+
if (containing === null) {
|
|
260
|
+
return candidate;
|
|
261
|
+
}
|
|
262
|
+
if (containing.start <= lineStart) {
|
|
263
|
+
return breakAt;
|
|
264
|
+
}
|
|
265
|
+
candidate = containing.start;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
export class ShrinkOpportunity {
|
|
270
|
+
clusterIndex;
|
|
271
|
+
tier;
|
|
272
|
+
capacity;
|
|
273
|
+
channel;
|
|
274
|
+
lineEndOnly;
|
|
275
|
+
constructor(clusterIndex, tier, capacity, channel, lineEndOnly = null) {
|
|
276
|
+
this.clusterIndex = clusterIndex;
|
|
277
|
+
this.tier = tier;
|
|
278
|
+
this.capacity = capacity;
|
|
279
|
+
this.channel = channel;
|
|
280
|
+
this.lineEndOnly = lineEndOnly ?? false;
|
|
281
|
+
}
|
|
282
|
+
toString() {
|
|
283
|
+
return `ShrinkOpportunity(clusterIndex=${this.clusterIndex}, tier=${this.tier}, capacity=${this.capacity}, channel=${this.channel.kind}, lineEndOnly=${this.lineEndOnly})`;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
export class UnbreakableRanges {
|
|
287
|
+
ranges;
|
|
288
|
+
byStart;
|
|
289
|
+
startsSorted;
|
|
290
|
+
prefixMaxLast;
|
|
291
|
+
static Empty = new UnbreakableRanges([]);
|
|
292
|
+
constructor(ranges) {
|
|
293
|
+
this.ranges = ranges;
|
|
294
|
+
this.byStart = ranges.slice();
|
|
295
|
+
let s0 = 1;
|
|
296
|
+
while (s0 < this.byStart.length) {
|
|
297
|
+
const key = this.byStart[s0];
|
|
298
|
+
let s1 = s0;
|
|
299
|
+
while (s1 > 0 && this.byStart[s1 - 1].start > key.start) {
|
|
300
|
+
this.byStart[s1] = this.byStart[s1 - 1];
|
|
301
|
+
s1--;
|
|
302
|
+
}
|
|
303
|
+
this.byStart[s1] = key;
|
|
304
|
+
s0++;
|
|
305
|
+
}
|
|
306
|
+
this.startsSorted = [];
|
|
307
|
+
let si = 0;
|
|
308
|
+
while (si < this.byStart.length) {
|
|
309
|
+
this.startsSorted.push(this.byStart[si].start);
|
|
310
|
+
si++;
|
|
311
|
+
}
|
|
312
|
+
this.prefixMaxLast = [];
|
|
313
|
+
let running = -2147483648;
|
|
314
|
+
let sj = 0;
|
|
315
|
+
while (sj < this.byStart.length) {
|
|
316
|
+
running = Math.trunc(Math.max(running, this.byStart[sj].end));
|
|
317
|
+
this.prefixMaxLast.push(running);
|
|
318
|
+
sj++;
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
containsBoundary(candidate) {
|
|
322
|
+
let low = 0;
|
|
323
|
+
let high = this.startsSorted.length;
|
|
324
|
+
while (low < high) {
|
|
325
|
+
const mid = low + high >> 1;
|
|
326
|
+
if (this.startsSorted[mid] < candidate) {
|
|
327
|
+
low = mid + 1;
|
|
328
|
+
}
|
|
329
|
+
else {
|
|
330
|
+
high = mid;
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
return low > 0 && this.prefixMaxLast[low - 1] >= candidate;
|
|
334
|
+
}
|
|
335
|
+
containingOrNull(candidate) {
|
|
336
|
+
if (!this.containsBoundary(candidate)) {
|
|
337
|
+
return null;
|
|
338
|
+
}
|
|
339
|
+
let ri = 0;
|
|
340
|
+
while (ri < this.ranges.length) {
|
|
341
|
+
const r = this.ranges[ri];
|
|
342
|
+
if (candidate > r.start && candidate <= r.end) {
|
|
343
|
+
return r;
|
|
344
|
+
}
|
|
345
|
+
ri++;
|
|
346
|
+
}
|
|
347
|
+
return null;
|
|
348
|
+
}
|
|
349
|
+
containingFromClosedStartOrNull(index) {
|
|
350
|
+
let low = 0;
|
|
351
|
+
let high = this.startsSorted.length;
|
|
352
|
+
while (low < high) {
|
|
353
|
+
const mid = low + high >> 1;
|
|
354
|
+
if (this.startsSorted[mid] <= index) {
|
|
355
|
+
low = mid + 1;
|
|
356
|
+
}
|
|
357
|
+
else {
|
|
358
|
+
high = mid;
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
if (low === 0 || this.prefixMaxLast[low - 1] <= index) {
|
|
362
|
+
return null;
|
|
363
|
+
}
|
|
364
|
+
let rj = 0;
|
|
365
|
+
while (rj < this.ranges.length) {
|
|
366
|
+
const r = this.ranges[rj];
|
|
367
|
+
if (index >= r.start && index <= r.end && r.end > index) {
|
|
368
|
+
return r;
|
|
369
|
+
}
|
|
370
|
+
rj++;
|
|
371
|
+
}
|
|
372
|
+
return null;
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
export const ProgressiveBreakTier = Object.freeze({
|
|
376
|
+
Whitespace: Object.freeze({ kind: "Whitespace" }),
|
|
377
|
+
Structural: Object.freeze({ kind: "Structural" }),
|
|
378
|
+
Syllable: Object.freeze({ kind: "Syllable" }),
|
|
379
|
+
WholeToken: Object.freeze({ kind: "WholeToken" }),
|
|
380
|
+
Emergency: Object.freeze({ kind: "Emergency" })
|
|
381
|
+
});
|
|
382
|
+
export function compareProgressiveBreakTier(a, b) {
|
|
383
|
+
if (a === b)
|
|
384
|
+
return 0;
|
|
385
|
+
if (a.kind === "Whitespace")
|
|
386
|
+
return 0 - (b.kind === "Whitespace" ? 0 : 0);
|
|
387
|
+
if (a.kind === "Structural")
|
|
388
|
+
return 1 - (b.kind === "Structural" ? 1 : 0);
|
|
389
|
+
if (a.kind === "Syllable")
|
|
390
|
+
return 2 - (b.kind === "Syllable" ? 2 : 0);
|
|
391
|
+
if (a.kind === "WholeToken")
|
|
392
|
+
return 3 - (b.kind === "WholeToken" ? 3 : 0);
|
|
393
|
+
if (a.kind === "Emergency")
|
|
394
|
+
return 4 - (b.kind === "Emergency" ? 4 : 0);
|
|
395
|
+
return 0;
|
|
396
|
+
}
|
|
397
|
+
export const ShrinkChannel = Object.freeze({
|
|
398
|
+
TrailingGlue: Object.freeze({ kind: "TrailingGlue" }),
|
|
399
|
+
LeadingGlue: Object.freeze({ kind: "LeadingGlue" }),
|
|
400
|
+
LeadingAndTrailingGlue: Object.freeze({ kind: "LeadingAndTrailingGlue" }),
|
|
401
|
+
RawAdvance: Object.freeze({ kind: "RawAdvance" })
|
|
402
|
+
});
|
|
403
|
+
export function compareShrinkChannel(a, b) {
|
|
404
|
+
if (a === b)
|
|
405
|
+
return 0;
|
|
406
|
+
if (a.kind === "TrailingGlue")
|
|
407
|
+
return 0 - (b.kind === "TrailingGlue" ? 0 : 0);
|
|
408
|
+
if (a.kind === "LeadingGlue")
|
|
409
|
+
return 1 - (b.kind === "LeadingGlue" ? 1 : 0);
|
|
410
|
+
if (a.kind === "LeadingAndTrailingGlue")
|
|
411
|
+
return 2 - (b.kind === "LeadingAndTrailingGlue" ? 2 : 0);
|
|
412
|
+
if (a.kind === "RawAdvance")
|
|
413
|
+
return 3 - (b.kind === "RawAdvance" ? 3 : 0);
|
|
414
|
+
return 0;
|
|
415
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// Generated by the reflaxe TypeScript target. Do not edit.
|
|
2
|
+
import { ProgressiveBreakTier } from "./ProgressiveBreakDecisions.js";
|
|
3
|
+
export class ProgressiveBreakTierPriority {
|
|
4
|
+
static priority(tier) {
|
|
5
|
+
switch (tier.kind) {
|
|
6
|
+
case "Whitespace":
|
|
7
|
+
return 0;
|
|
8
|
+
case "Structural":
|
|
9
|
+
return 1;
|
|
10
|
+
case "Syllable":
|
|
11
|
+
return 2;
|
|
12
|
+
case "WholeToken":
|
|
13
|
+
return 3;
|
|
14
|
+
case "Emergency":
|
|
15
|
+
return 4;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
static fromPriority(value) {
|
|
19
|
+
if (value === 0) {
|
|
20
|
+
return ProgressiveBreakTier.Whitespace;
|
|
21
|
+
}
|
|
22
|
+
if (value === 1) {
|
|
23
|
+
return ProgressiveBreakTier.Structural;
|
|
24
|
+
}
|
|
25
|
+
if (value === 2) {
|
|
26
|
+
return ProgressiveBreakTier.Syllable;
|
|
27
|
+
}
|
|
28
|
+
if (value === 3) {
|
|
29
|
+
return ProgressiveBreakTier.WholeToken;
|
|
30
|
+
}
|
|
31
|
+
return ProgressiveBreakTier.Emergency;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { type TextRange } from "./../core/TextRange.js";
|
|
2
|
+
import { type FontRole } from "./../font/FontRole.js";
|
|
3
|
+
import { type FontRoleClassifier, FontRoleContext } from "./../font/FontRoleContext.js";
|
|
4
|
+
import { SortedMapTable } from "../../../runtime.js";
|
|
5
|
+
export declare class QuotePair {
|
|
6
|
+
readonly openIndex: number;
|
|
7
|
+
readonly closeIndex: number;
|
|
8
|
+
readonly quoteType: QuoteType;
|
|
9
|
+
constructor(openIndex: number, closeIndex: number, quoteType: QuoteType);
|
|
10
|
+
toString(): string;
|
|
11
|
+
}
|
|
12
|
+
export declare function QuotePairquoteTypeOrder(v: QuoteType): number;
|
|
13
|
+
export declare function compareQuotePair(a: QuotePair, b: QuotePair): number;
|
|
14
|
+
export declare class QuoteRoleDecision {
|
|
15
|
+
readonly index: number;
|
|
16
|
+
readonly role: FontRole;
|
|
17
|
+
readonly source: string;
|
|
18
|
+
readonly reason: string;
|
|
19
|
+
constructor(index: number, role: FontRole, source: string, reason: string);
|
|
20
|
+
toString(): string;
|
|
21
|
+
}
|
|
22
|
+
export declare function QuoteRoleDecisionroleOrder(v: FontRole): number;
|
|
23
|
+
export declare function compareQuoteRoleDecision(a: QuoteRoleDecision, b: QuoteRoleDecision): number;
|
|
24
|
+
export declare class QuotePairAnalyzer {
|
|
25
|
+
constructor();
|
|
26
|
+
analyze(text: string): QuotePair[];
|
|
27
|
+
classifyPairs(text: string, pairs: QuotePair[], context?: FontRoleContext | null): SortedMapTable<number, FontRole>;
|
|
28
|
+
classifyPairsWithClassifier(text: string, pairs: QuotePair[], _fontRoleClassifier: FontRoleClassifier, context?: FontRoleContext | null): SortedMapTable<number, FontRole>;
|
|
29
|
+
classifyQuoteRoles(text: string, pairs: QuotePair[], context?: FontRoleContext | null): QuoteRoleDecision[];
|
|
30
|
+
classifyQuoteRolesWithClassifier(text: string, pairs: QuotePair[], _fontRoleClassifier: FontRoleClassifier, context?: FontRoleContext | null): QuoteRoleDecision[];
|
|
31
|
+
private static mapDecisions;
|
|
32
|
+
static isNonCjkInWordApostrophe(text: string, index: number): boolean;
|
|
33
|
+
static isDigitBoundClosingQuote(text: string, index: number): boolean;
|
|
34
|
+
static isNonCjkWordInternalQuotePair(text: string, pair: QuotePair): boolean;
|
|
35
|
+
private static isNonCjkWordCharacter;
|
|
36
|
+
private static isNonCjkNonNumericWordCharacter;
|
|
37
|
+
private static isFullwidthEastAsianWidth;
|
|
38
|
+
static codePointBefore(text: string, index: number): number | null;
|
|
39
|
+
static codePointAtOrNull(text: string, index: number): number | null;
|
|
40
|
+
}
|
|
41
|
+
export declare class QuotePairAwareFontRoleClassifier implements FontRoleClassifier {
|
|
42
|
+
private readonly delegate;
|
|
43
|
+
private readonly quoteRoles;
|
|
44
|
+
constructor(delegate: FontRoleClassifier, quoteRoles: SortedMapTable<number, FontRole>);
|
|
45
|
+
classify(text: string, range: TextRange, context?: FontRoleContext | null): FontRole;
|
|
46
|
+
static withContextualQuoteRoles(base: FontRoleClassifier, text: string, context?: FontRoleContext | null): FontRoleClassifier;
|
|
47
|
+
}
|
|
48
|
+
export interface Double {
|
|
49
|
+
readonly kind: "Double";
|
|
50
|
+
}
|
|
51
|
+
export interface Single {
|
|
52
|
+
readonly kind: "Single";
|
|
53
|
+
}
|
|
54
|
+
export type QuoteType = Double | Single;
|
|
55
|
+
export declare const QuoteType: Readonly<{
|
|
56
|
+
Double: Readonly<Double>;
|
|
57
|
+
Single: Readonly<Single>;
|
|
58
|
+
}>;
|
|
59
|
+
export declare function compareQuoteType(a: QuoteType, b: QuoteType): number;
|
|
60
|
+
export interface OpenQuoteEntry {
|
|
61
|
+
index: number;
|
|
62
|
+
type: QuoteType;
|
|
63
|
+
}
|