@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,477 @@
|
|
|
1
|
+
// Generated by the reflaxe TypeScript target. Do not edit.
|
|
2
|
+
import { Evidence } from "./Evidence.js";
|
|
3
|
+
import { Markup } from "./Markup.js";
|
|
4
|
+
import { PreparedDom } from "./PreparedDom.js";
|
|
5
|
+
import { PreparedDomException } from "./PreparedDomException.js";
|
|
6
|
+
export class PreparedArtifact {
|
|
7
|
+
static renderPreparedParagraphArtifact(plan, locale, options) {
|
|
8
|
+
const semantics = options.semantics;
|
|
9
|
+
const renderTextSpans = options.renderTextSpans;
|
|
10
|
+
const emphasisRanges = plan.emphasisRanges;
|
|
11
|
+
const inlineBoxes = PreparedArtifact.inlineBoxesFor(plan.inlineEdges, options.inlineBoxes);
|
|
12
|
+
const state = PreparedArtifact.newArtifactState(options.cjkStrongSemantics, options.liveSource);
|
|
13
|
+
const styleClassFor = options.styleClassFor;
|
|
14
|
+
let inlineObjectCount = 0;
|
|
15
|
+
let dustEpsilon = PreparedDom.SPACING_DUST_EPSILON;
|
|
16
|
+
let lineIndex = 0;
|
|
17
|
+
while (lineIndex < plan.lines.length) {
|
|
18
|
+
const line = plan.lines[lineIndex];
|
|
19
|
+
const height = line.bottom - line.top;
|
|
20
|
+
const first = (line.cells.length > 0 ? line.cells[0] : null);
|
|
21
|
+
const flowStart = (first !== null ? first.drawX - first.leadingLayoutAdvance : 0.0);
|
|
22
|
+
const firstInlineStart = (first !== null ? PreparedArtifact.inlineStartAt(inlineBoxes, first.rangeStart) : 0.0);
|
|
23
|
+
if (first !== null && Math.abs(first.leadingLayoutAdvance - firstInlineStart) > PreparedDom.RENDER_FLOW_EPSILON_PX) {
|
|
24
|
+
throw new PreparedDomException({ kind: "SnapshotRenderFlowMismatch", detail: `line=${lineIndex};leading-layout-advance` });
|
|
25
|
+
}
|
|
26
|
+
const cells = [];
|
|
27
|
+
let cellIndex = 0;
|
|
28
|
+
while (cellIndex < line.cells.length) {
|
|
29
|
+
const cell = line.cells[cellIndex];
|
|
30
|
+
const next = (cellIndex + 1 < line.cells.length ? line.cells[cellIndex + 1] : null);
|
|
31
|
+
const trailingInlineEdge = PreparedArtifact.inlineEndAt(inlineBoxes, cell.rangeEnd);
|
|
32
|
+
const nextLeadingInlineEdge = (next !== null ? PreparedArtifact.inlineStartAt(inlineBoxes, next.rangeStart) : 0.0);
|
|
33
|
+
const rawTrailingGap = (next !== null ? next.drawX - cell.drawX - cell.naturalWidth - trailingInlineEdge - nextLeadingInlineEdge : (line.hyphenAdvance > 0 ? 0.0 : line.indent + line.visualWidth - cell.drawX - cell.naturalWidth - trailingInlineEdge));
|
|
34
|
+
const layoutTrailingGap = (Math.abs(rawTrailingGap) < dustEpsilon ? 0.0 : rawTrailingGap);
|
|
35
|
+
const bopomofoHere = PreparedArtifact.bopomofoAt(plan.bopomofoDecisions, cell.rangeEnd);
|
|
36
|
+
const hasBopomofo = bopomofoHere.length > 0;
|
|
37
|
+
const naturalAdvance = (cell.advance !== null ? cell.advance : cell.naturalWidth);
|
|
38
|
+
const bopomofoAdvanceWidth = (!hasBopomofo ? 0.0 : (next !== null ? Math.max(layoutTrailingGap, 0.0) : Math.max(naturalAdvance - cell.naturalWidth - trailingInlineEdge, 0.0)));
|
|
39
|
+
const trailingGap = (hasBopomofo ? 0.0 : layoutTrailingGap);
|
|
40
|
+
const styleItalic = cell.style !== null && cell.style.italic === true;
|
|
41
|
+
const run = { rangeStart: cell.rangeStart, rangeEnd: cell.rangeEnd, source: cell.source, display: cell.display, drawX: cell.drawX, naturalWidth: cell.naturalWidth, shapingBoundary: cell.shapingBoundary, openTypeFeatures: cell.openTypeFeatures, renderFontFamilies: PreparedArtifact.renderFontFamiliesFor(renderTextSpans, cell.rangeStart, cell.rangeEnd), trailingGap, spacing: PreparedDom.preparedSpacing(cell.display, cell.naturalWidth, trailingGap, dustEpsilon), semanticPath: PreparedArtifact.semanticsFor(semantics, cell.rangeStart, cell.rangeEnd), styleDelta: cell.style, italicEffect: styleItalic || cell.latin && PreparedArtifact.rangeContains(emphasisRanges, cell.rangeStart), dashStrategy: cell.dashStrategy, shapingLanguage: cell.shapingLanguage, resolvedFace: cell.resolvedFace, glyphIds: cell.glyphIds, shapingEvidence: cell.shapingEvidence, punctuationInkFloor: cell.punctuationInkFloor, punctuationBodyWidth: cell.punctuationBodyWidth, evidenceRenderFontFamily: cell.renderFontFamily, inlineObjectAdvance: cell.inlineObject, bopomofoAdvanceWidth, styleSignature: cell.styleSignature, punctuationSignature: cell.punctuationSignature, semanticSignature: null };
|
|
42
|
+
cells.push(run);
|
|
43
|
+
cellIndex += 1;
|
|
44
|
+
}
|
|
45
|
+
let signatureIndex = 0;
|
|
46
|
+
while (signatureIndex < cells.length) {
|
|
47
|
+
cells[signatureIndex].semanticSignature = PreparedArtifact.pathSignature(cells[signatureIndex].semanticPath);
|
|
48
|
+
signatureIndex += 1;
|
|
49
|
+
}
|
|
50
|
+
const children = [];
|
|
51
|
+
let pending = null;
|
|
52
|
+
let childIndex = 0;
|
|
53
|
+
while (childIndex < cells.length) {
|
|
54
|
+
const cell2 = cells[childIndex];
|
|
55
|
+
if (cell2.inlineObjectAdvance !== null) {
|
|
56
|
+
if (pending !== null) {
|
|
57
|
+
children.push(PreparedArtifact.runChild((pending)));
|
|
58
|
+
pending = null;
|
|
59
|
+
}
|
|
60
|
+
children.push(PreparedArtifact.inlineObjectChild(cell2));
|
|
61
|
+
childIndex += 1;
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
if (pending !== null && PreparedDom.canMergePreparedRun((pending), cell2)) {
|
|
65
|
+
PreparedDom.mergePreparedRun((pending), cell2);
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
if (pending !== null) {
|
|
69
|
+
children.push(PreparedArtifact.runChild((pending)));
|
|
70
|
+
}
|
|
71
|
+
pending = cell2;
|
|
72
|
+
}
|
|
73
|
+
const rubyAtEnd = PreparedArtifact.rubyAt(plan.rubyDecisions, cell2.rangeEnd);
|
|
74
|
+
const bopomofoAtEnd = PreparedArtifact.bopomofoAt(plan.bopomofoDecisions, cell2.rangeEnd);
|
|
75
|
+
if (rubyAtEnd !== null || bopomofoAtEnd.length > 0) {
|
|
76
|
+
if (pending !== null) {
|
|
77
|
+
children.push(PreparedArtifact.runChild((pending)));
|
|
78
|
+
pending = null;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
if (rubyAtEnd !== null) {
|
|
82
|
+
const ruby = rubyAtEnd;
|
|
83
|
+
children.push(PreparedArtifact.rubyChild(ruby, line.top, cell2.semanticPath));
|
|
84
|
+
}
|
|
85
|
+
let zoneIndex = 0;
|
|
86
|
+
while (zoneIndex < bopomofoAtEnd.length) {
|
|
87
|
+
const zone = bopomofoAtEnd[zoneIndex];
|
|
88
|
+
children.push(PreparedArtifact.bopomofoChild(zone, cell2.bopomofoAdvanceWidth, line.top, line.bottom - line.top, cell2.semanticPath));
|
|
89
|
+
zoneIndex += 1;
|
|
90
|
+
}
|
|
91
|
+
childIndex += 1;
|
|
92
|
+
}
|
|
93
|
+
if (pending !== null) {
|
|
94
|
+
children.push(PreparedArtifact.runChild((pending)));
|
|
95
|
+
pending = null;
|
|
96
|
+
}
|
|
97
|
+
const last = (line.cells.length > 0 ? line.cells[line.cells.length - 1] : null);
|
|
98
|
+
const flowEnd = (last !== null ? last.drawX + last.naturalWidth + PreparedArtifact.inlineEndAt(inlineBoxes, last.rangeEnd) : 0.0);
|
|
99
|
+
const hyphenLeadingGap = (line.hyphenAdvance > 0 ? line.indent + line.visualWidth - flowEnd : 0.0);
|
|
100
|
+
let inlineEdgeWidth = 0.0;
|
|
101
|
+
let edgeIndex = 0;
|
|
102
|
+
while (edgeIndex < line.cells.length) {
|
|
103
|
+
inlineEdgeWidth += PreparedArtifact.inlineStartAt(inlineBoxes, line.cells[edgeIndex].rangeStart) + PreparedArtifact.inlineEndAt(inlineBoxes, line.cells[edgeIndex].rangeEnd);
|
|
104
|
+
edgeIndex += 1;
|
|
105
|
+
}
|
|
106
|
+
let childFlow = 0.0;
|
|
107
|
+
let flowIndex = 0;
|
|
108
|
+
while (flowIndex < children.length) {
|
|
109
|
+
const child = children[flowIndex];
|
|
110
|
+
if (child.kind === "run") {
|
|
111
|
+
const run2 = child.run;
|
|
112
|
+
childFlow += run2.naturalWidth + run2.trailingGap;
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
if (child.kind === "inlineObject") {
|
|
116
|
+
const cell3 = child.cell;
|
|
117
|
+
childFlow += cell3.naturalWidth + (Math.abs(child.carrierMargin) >= PreparedDom.SPACING_EPSILON ? child.carrierMargin : 0.0);
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
if (child.kind === "bopomofo") {
|
|
121
|
+
childFlow += child.width;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
flowIndex += 1;
|
|
126
|
+
}
|
|
127
|
+
const expectedFlowWidth = flowStart + inlineEdgeWidth + childFlow + hyphenLeadingGap + line.hyphenAdvance;
|
|
128
|
+
const coreLineWidth = line.indent + line.visualWidth + line.hyphenAdvance;
|
|
129
|
+
if (Math.abs(expectedFlowWidth - coreLineWidth) > PreparedDom.RENDER_FLOW_EPSILON_PX) {
|
|
130
|
+
if (dustEpsilon === PreparedDom.SPACING_DUST_EPSILON) {
|
|
131
|
+
dustEpsilon = PreparedDom.FALLBACK_SPACING_DUST_EPSILON;
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
134
|
+
throw new PreparedDomException({ kind: "SnapshotRenderFlowMismatch", detail: `line=${lineIndex}` });
|
|
135
|
+
}
|
|
136
|
+
dustEpsilon = PreparedDom.SPACING_DUST_EPSILON;
|
|
137
|
+
const markerStyles = [`--tq-line-height:${Markup.px(height)}!important`, `--tq-line-baseline-offset:${Markup.px(-(line.bottom - line.baseline))}!important`];
|
|
138
|
+
if (Math.abs(flowStart) >= PreparedDom.SPACING_EPSILON) {
|
|
139
|
+
markerStyles.push(`--tq-line-flow-start:${Markup.px(flowStart)}!important`);
|
|
140
|
+
}
|
|
141
|
+
const markerAttributes = [];
|
|
142
|
+
Markup.setAttribute(markerAttributes, "aria-hidden", "true");
|
|
143
|
+
Markup.setAttribute(markerAttributes, "class", "tq-line");
|
|
144
|
+
Markup.setAttribute(markerAttributes, "data-tq-copy-ignore", "true");
|
|
145
|
+
Markup.setAttribute(markerAttributes, "data-tq-geometry", "true");
|
|
146
|
+
Markup.setAttribute(markerAttributes, "data-tq-line-empty", `${line.cells.length === 0}`);
|
|
147
|
+
Markup.setAttribute(markerAttributes, "data-tq-line-end", line.endReason);
|
|
148
|
+
Markup.setAttribute(markerAttributes, "data-tq-line-top", `${line.top}`);
|
|
149
|
+
Markup.setAttribute(markerAttributes, "data-tq-line-bottom", `${line.bottom}`);
|
|
150
|
+
Markup.setAttribute(markerAttributes, "data-tq-line-baseline", `${line.baseline}`);
|
|
151
|
+
Markup.setAttribute(markerAttributes, "data-tq-line-flow-width", `${expectedFlowWidth}`);
|
|
152
|
+
Markup.setAttribute(markerAttributes, "data-tq-line-index", `${lineIndex}`);
|
|
153
|
+
Markup.setAttribute(markerAttributes, "data-tq-line-range", `${line.rangeStart}-${line.rangeEnd}`);
|
|
154
|
+
if (Math.abs(flowStart) >= PreparedDom.SPACING_EPSILON) {
|
|
155
|
+
Markup.setAttribute(markerAttributes, "data-tq-line-shift", "true");
|
|
156
|
+
}
|
|
157
|
+
Markup.setAttribute(markerAttributes, "data-tq-line-width", `${coreLineWidth}`);
|
|
158
|
+
Markup.setAttribute(markerAttributes, "data-tq-paragraph-height", `${plan.height}`);
|
|
159
|
+
Markup.applyDynamicStyles(markerAttributes, markerStyles, styleClassFor);
|
|
160
|
+
PreparedArtifact.semanticContainerFor(state, state.activeSemantics).push(Markup.renderedElement("span", markerAttributes, null, false));
|
|
161
|
+
let renderIndex = 0;
|
|
162
|
+
while (renderIndex < children.length) {
|
|
163
|
+
const child2 = children[renderIndex];
|
|
164
|
+
const container = PreparedArtifact.semanticContainerFor(state, child2.semanticPath);
|
|
165
|
+
if (child2.kind === "run") {
|
|
166
|
+
const run3 = child2.run;
|
|
167
|
+
const spacingBoundary = (run3.spacing.kind === "trailing-letter" ? PreparedArtifact.endingTags(run3) : "");
|
|
168
|
+
container.push(PreparedDom.renderRun(run3, styleClassFor, spacingBoundary));
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
if (child2.kind === "inlineObject") {
|
|
172
|
+
const cell4 = child2.cell;
|
|
173
|
+
container.push(Evidence.inlineObjectPlaceholder(cell4, child2.carrierMargin, styleClassFor));
|
|
174
|
+
inlineObjectCount += 1;
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
if (child2.kind === "ruby") {
|
|
178
|
+
const ruby2 = child2.ruby;
|
|
179
|
+
container.push(Evidence.rubyAnnotationSpan(ruby2, child2.lineTop, styleClassFor));
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
const zone2 = child2.zone;
|
|
183
|
+
container.push(Evidence.bopomofoAnnotationSpan(zone2, child2.width, child2.lineTop, child2.lineHeight, styleClassFor));
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
renderIndex += 1;
|
|
188
|
+
}
|
|
189
|
+
if (line.hyphenAdvance > 0) {
|
|
190
|
+
const hyphenAttributes = [];
|
|
191
|
+
Markup.setAttribute(hyphenAttributes, "aria-hidden", "true");
|
|
192
|
+
Markup.setAttribute(hyphenAttributes, "data-tq-advance", `${line.hyphenAdvance}`);
|
|
193
|
+
Markup.setAttribute(hyphenAttributes, "data-tq-copy-ignore", "true");
|
|
194
|
+
Markup.setAttribute(hyphenAttributes, "data-tq-engine-hyphen", "true");
|
|
195
|
+
Markup.setAttribute(hyphenAttributes, "data-tq-geometry", "true");
|
|
196
|
+
Markup.setAttribute(hyphenAttributes, "data-tq-x", `${line.indent + line.visualWidth}`);
|
|
197
|
+
Markup.setAttribute(hyphenAttributes, "lang", locale);
|
|
198
|
+
const hyphenStyles = [];
|
|
199
|
+
if (Math.abs(hyphenLeadingGap) >= PreparedDom.SPACING_EPSILON) {
|
|
200
|
+
hyphenStyles.push(`margin-left:${Markup.px(hyphenLeadingGap)}!important`);
|
|
201
|
+
}
|
|
202
|
+
Markup.applyDynamicStyles(hyphenAttributes, hyphenStyles, styleClassFor);
|
|
203
|
+
PreparedArtifact.semanticContainerFor(state, state.activeSemantics).push(Markup.renderedElement("span", hyphenAttributes, "-", false));
|
|
204
|
+
}
|
|
205
|
+
const boundaryContainer = PreparedArtifact.semanticContainerFor(state, PreparedArtifact.crossingSpans(semantics, line.rangeEnd));
|
|
206
|
+
const sentinelAttributes = [];
|
|
207
|
+
Markup.setAttribute(sentinelAttributes, "aria-hidden", "true");
|
|
208
|
+
Markup.setAttribute(sentinelAttributes, "data-tq-copy-ignore", "true");
|
|
209
|
+
Markup.setAttribute(sentinelAttributes, "data-tq-geometry", "true");
|
|
210
|
+
Markup.setAttribute(sentinelAttributes, "data-tq-line-end-sentinel", `${lineIndex}`);
|
|
211
|
+
boundaryContainer.push(Markup.renderedElement("span", sentinelAttributes, null, false));
|
|
212
|
+
if (line.endReason === "MandatoryBreak") {
|
|
213
|
+
const hardBreakAttributes = [];
|
|
214
|
+
Markup.setAttribute(hardBreakAttributes, "data-tq-geometry", "true");
|
|
215
|
+
Markup.setAttribute(hardBreakAttributes, "data-tq-hard-break", "true");
|
|
216
|
+
Markup.setAttribute(hardBreakAttributes, "data-tq-src", "\n");
|
|
217
|
+
boundaryContainer.push(Markup.renderedElement("span", hardBreakAttributes, null, false));
|
|
218
|
+
}
|
|
219
|
+
if (lineIndex < plan.lines.length - 1) {
|
|
220
|
+
const breakAttributes = [];
|
|
221
|
+
Markup.setAttribute(breakAttributes, "data-tq-engine-break", line.endReason);
|
|
222
|
+
if (line.endReason !== "MandatoryBreak") {
|
|
223
|
+
Markup.setAttribute(breakAttributes, "aria-hidden", "true");
|
|
224
|
+
Markup.setAttribute(breakAttributes, "data-tq-copy-ignore", "true");
|
|
225
|
+
}
|
|
226
|
+
boundaryContainer.push(Markup.renderedElement("br", breakAttributes, null, true));
|
|
227
|
+
}
|
|
228
|
+
lineIndex += 1;
|
|
229
|
+
}
|
|
230
|
+
PreparedArtifact.semanticContainerFor(state, []);
|
|
231
|
+
if (plan.lines.length > 0) {
|
|
232
|
+
const endAttributes = [];
|
|
233
|
+
Markup.setAttribute(endAttributes, "aria-hidden", "true");
|
|
234
|
+
Markup.setAttribute(endAttributes, "data-tq-copy-ignore", "true");
|
|
235
|
+
Markup.setAttribute(endAttributes, "data-tq-selection-end", "true");
|
|
236
|
+
state.nodes.push(Markup.renderedElement("span", endAttributes, "", false));
|
|
237
|
+
}
|
|
238
|
+
const overlayPlan = { decorationSegments: plan.decorationSegments, emphasisDots: plan.emphasisDots, fontSize: plan.fontSize, overlayWidth: plan.overlayWidth, height: plan.height };
|
|
239
|
+
const overlayOptions = { emphasisDotColor: options.emphasisDotColor };
|
|
240
|
+
Evidence.appendEvidenceOverlays(state.nodes, overlayPlan, overlayOptions);
|
|
241
|
+
const artifacts = [];
|
|
242
|
+
let htmlOut = "";
|
|
243
|
+
let nodeIndex = 0;
|
|
244
|
+
while (nodeIndex < state.nodes.length) {
|
|
245
|
+
htmlOut += state.nodes[nodeIndex].html;
|
|
246
|
+
artifacts.push(state.nodes[nodeIndex].artifact);
|
|
247
|
+
nodeIndex += 1;
|
|
248
|
+
}
|
|
249
|
+
return { html: htmlOut, artifact: artifacts, liveSemanticCount: (options.liveSource ? semantics.length : 0), inlineObjectCount, markerCount: plan.lines.length };
|
|
250
|
+
}
|
|
251
|
+
static newArtifactState(cjkStrong, liveSource) {
|
|
252
|
+
return { nodes: [], activeSemantics: [], activeContainers: [], cjkStrong, liveSource };
|
|
253
|
+
}
|
|
254
|
+
static semanticContainerFor(state, path) {
|
|
255
|
+
const active = state.activeSemantics;
|
|
256
|
+
const limit = (active.length < path.length ? active.length : path.length);
|
|
257
|
+
let common = 0;
|
|
258
|
+
while (common < limit && active[common].index === path[common].index) {
|
|
259
|
+
common += 1;
|
|
260
|
+
}
|
|
261
|
+
const nextActive = [];
|
|
262
|
+
let keepIndex = 0;
|
|
263
|
+
while (keepIndex < common) {
|
|
264
|
+
nextActive.push(active[keepIndex]);
|
|
265
|
+
keepIndex += 1;
|
|
266
|
+
}
|
|
267
|
+
state.activeSemantics = nextActive;
|
|
268
|
+
const nextContainers = [];
|
|
269
|
+
let keepContainer = 0;
|
|
270
|
+
while (keepContainer < common) {
|
|
271
|
+
nextContainers.push(state.activeContainers[keepContainer]);
|
|
272
|
+
keepContainer += 1;
|
|
273
|
+
}
|
|
274
|
+
state.activeContainers = nextContainers;
|
|
275
|
+
let container = state.nodes;
|
|
276
|
+
if (state.activeContainers.length > 0) {
|
|
277
|
+
container = state.activeContainers[state.activeContainers.length - 1].children;
|
|
278
|
+
}
|
|
279
|
+
let pathIndex = common;
|
|
280
|
+
while (pathIndex < path.length) {
|
|
281
|
+
const semantic = path[pathIndex];
|
|
282
|
+
let cjkWeight = null;
|
|
283
|
+
let strongIndex = 0;
|
|
284
|
+
while (strongIndex < state.cjkStrong.length) {
|
|
285
|
+
const strong = state.cjkStrong[strongIndex];
|
|
286
|
+
if (strong.start === semantic.start && strong.end === semantic.end) {
|
|
287
|
+
cjkWeight = strong.weight;
|
|
288
|
+
break;
|
|
289
|
+
}
|
|
290
|
+
strongIndex += 1;
|
|
291
|
+
}
|
|
292
|
+
const attributes = [];
|
|
293
|
+
let wrapper;
|
|
294
|
+
if (state.liveSource) {
|
|
295
|
+
Markup.setAttribute(attributes, PreparedDom.LIVE_SEMANTIC_INDEX_ATTRIBUTE, `${semantic.sourceIndex}`);
|
|
296
|
+
wrapper = Markup.renderedContainer("span", attributes);
|
|
297
|
+
}
|
|
298
|
+
else {
|
|
299
|
+
let attrIndex = 0;
|
|
300
|
+
while (attrIndex < semantic.attributes.length) {
|
|
301
|
+
attributes.push({ name: semantic.attributes[attrIndex].name, value: semantic.attributes[attrIndex].value });
|
|
302
|
+
attrIndex += 1;
|
|
303
|
+
}
|
|
304
|
+
Markup.setAttribute(attributes, "data-tq-source-semantic", "true");
|
|
305
|
+
if (cjkWeight !== null) {
|
|
306
|
+
const weight = cjkWeight;
|
|
307
|
+
Markup.setAttribute(attributes, "data-tq-cjk-emphasis", "true");
|
|
308
|
+
Markup.setAttribute(attributes, "style", `font-weight:${weight}!important`);
|
|
309
|
+
}
|
|
310
|
+
wrapper = Markup.renderedContainer(semantic.tagName, attributes);
|
|
311
|
+
}
|
|
312
|
+
container.push(wrapper);
|
|
313
|
+
state.activeSemantics.push(semantic);
|
|
314
|
+
state.activeContainers.push(wrapper);
|
|
315
|
+
container = wrapper.children;
|
|
316
|
+
pathIndex += 1;
|
|
317
|
+
}
|
|
318
|
+
return container;
|
|
319
|
+
}
|
|
320
|
+
static inlineBoxesFor(edges, optionBoxes) {
|
|
321
|
+
if (edges.length === 0) {
|
|
322
|
+
return optionBoxes;
|
|
323
|
+
}
|
|
324
|
+
const entries = [];
|
|
325
|
+
let index = 0;
|
|
326
|
+
while (index < edges.length) {
|
|
327
|
+
const edge = edges[index];
|
|
328
|
+
if (edge.inlineStart !== null) {
|
|
329
|
+
const startPx = edge.inlineStart;
|
|
330
|
+
entries.push({ start: edge.offset, end: edge.offset, inlineStartPx: startPx, inlineEndPx: 0.0 });
|
|
331
|
+
}
|
|
332
|
+
if (edge.inlineEnd !== null) {
|
|
333
|
+
const endPx = edge.inlineEnd;
|
|
334
|
+
entries.push({ start: edge.offset, end: edge.offset, inlineStartPx: 0.0, inlineEndPx: endPx });
|
|
335
|
+
}
|
|
336
|
+
index += 1;
|
|
337
|
+
}
|
|
338
|
+
return entries;
|
|
339
|
+
}
|
|
340
|
+
static inlineStartAt(boxes, offset) {
|
|
341
|
+
let sum = 0.0;
|
|
342
|
+
let index = 0;
|
|
343
|
+
while (index < boxes.length) {
|
|
344
|
+
if (boxes[index].start === offset) {
|
|
345
|
+
sum += boxes[index].inlineStartPx;
|
|
346
|
+
}
|
|
347
|
+
index += 1;
|
|
348
|
+
}
|
|
349
|
+
return sum;
|
|
350
|
+
}
|
|
351
|
+
static inlineEndAt(boxes, offset) {
|
|
352
|
+
let sum = 0.0;
|
|
353
|
+
let index = 0;
|
|
354
|
+
while (index < boxes.length) {
|
|
355
|
+
if (boxes[index].end === offset) {
|
|
356
|
+
sum += boxes[index].inlineEndPx;
|
|
357
|
+
}
|
|
358
|
+
index += 1;
|
|
359
|
+
}
|
|
360
|
+
return sum;
|
|
361
|
+
}
|
|
362
|
+
static rubyAt(rubies, end) {
|
|
363
|
+
let index = 0;
|
|
364
|
+
while (index < rubies.length) {
|
|
365
|
+
if (rubies[index].baseRangeEnd === end) {
|
|
366
|
+
return rubies[index];
|
|
367
|
+
}
|
|
368
|
+
index += 1;
|
|
369
|
+
}
|
|
370
|
+
return null;
|
|
371
|
+
}
|
|
372
|
+
static bopomofoAt(zones, end) {
|
|
373
|
+
const matches = [];
|
|
374
|
+
let index = 0;
|
|
375
|
+
while (index < zones.length) {
|
|
376
|
+
if (zones[index].baseRangeEnd === end) {
|
|
377
|
+
matches.push(zones[index]);
|
|
378
|
+
}
|
|
379
|
+
index += 1;
|
|
380
|
+
}
|
|
381
|
+
return matches;
|
|
382
|
+
}
|
|
383
|
+
static semanticsFor(semantics, rangeStart, rangeEnd) {
|
|
384
|
+
const matches = [];
|
|
385
|
+
let index = 0;
|
|
386
|
+
while (index < semantics.length) {
|
|
387
|
+
const span = semantics[index];
|
|
388
|
+
if (rangeStart >= span.start && rangeEnd <= span.end) {
|
|
389
|
+
matches.push(span);
|
|
390
|
+
}
|
|
391
|
+
index += 1;
|
|
392
|
+
}
|
|
393
|
+
return matches;
|
|
394
|
+
}
|
|
395
|
+
static endingTags(run) {
|
|
396
|
+
const tags = [];
|
|
397
|
+
{
|
|
398
|
+
const _g1 = run.semanticPath;
|
|
399
|
+
for (let _g_index = 0, count = _g1.length; _g_index < count; _g_index += 1) {
|
|
400
|
+
const span = _g1[_g_index];
|
|
401
|
+
if (span.end === run.rangeEnd) {
|
|
402
|
+
tags.push(span.tagName);
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
return tags.join(" ");
|
|
407
|
+
}
|
|
408
|
+
static crossingSpans(semantics, offset) {
|
|
409
|
+
const matches = [];
|
|
410
|
+
let index = 0;
|
|
411
|
+
while (index < semantics.length) {
|
|
412
|
+
const span = semantics[index];
|
|
413
|
+
if (offset > span.start && offset < span.end) {
|
|
414
|
+
matches.push(span);
|
|
415
|
+
}
|
|
416
|
+
index += 1;
|
|
417
|
+
}
|
|
418
|
+
return matches;
|
|
419
|
+
}
|
|
420
|
+
static renderFontFamiliesFor(spans, rangeStart, rangeEnd) {
|
|
421
|
+
const owners = [];
|
|
422
|
+
let index = 0;
|
|
423
|
+
while (index < spans.length) {
|
|
424
|
+
const span = spans[index];
|
|
425
|
+
if (rangeStart >= span.start && rangeEnd <= span.end) {
|
|
426
|
+
owners.push(span);
|
|
427
|
+
}
|
|
428
|
+
index += 1;
|
|
429
|
+
}
|
|
430
|
+
if (owners.length === 0) {
|
|
431
|
+
return [];
|
|
432
|
+
}
|
|
433
|
+
const signature = owners[0].signature;
|
|
434
|
+
let ownerIndex = 1;
|
|
435
|
+
while (ownerIndex < owners.length) {
|
|
436
|
+
if (owners[ownerIndex].signature !== signature) {
|
|
437
|
+
throw new PreparedDomException({ kind: "ConflictingPreparedRenderTextSpan" });
|
|
438
|
+
}
|
|
439
|
+
ownerIndex += 1;
|
|
440
|
+
}
|
|
441
|
+
return owners[0].fontFamilies;
|
|
442
|
+
}
|
|
443
|
+
static rangeContains(ranges, offset) {
|
|
444
|
+
let index = 0;
|
|
445
|
+
while (index < ranges.length) {
|
|
446
|
+
if (offset >= ranges[index].start && offset < ranges[index].end) {
|
|
447
|
+
return true;
|
|
448
|
+
}
|
|
449
|
+
index += 1;
|
|
450
|
+
}
|
|
451
|
+
return false;
|
|
452
|
+
}
|
|
453
|
+
static pathSignature(path) {
|
|
454
|
+
let out = "[";
|
|
455
|
+
let index = 0;
|
|
456
|
+
while (index < path.length) {
|
|
457
|
+
if (index > 0) {
|
|
458
|
+
out += ",";
|
|
459
|
+
}
|
|
460
|
+
out += path[index].signature;
|
|
461
|
+
index += 1;
|
|
462
|
+
}
|
|
463
|
+
return out + "]";
|
|
464
|
+
}
|
|
465
|
+
static runChild(run) {
|
|
466
|
+
return { kind: "run", run, cell: null, carrierMargin: 0.0, ruby: null, zone: null, width: 0.0, lineTop: 0.0, lineHeight: 0.0, semanticPath: run.semanticPath };
|
|
467
|
+
}
|
|
468
|
+
static inlineObjectChild(cell) {
|
|
469
|
+
return { kind: "inlineObject", run: null, cell, carrierMargin: cell.trailingGap, ruby: null, zone: null, width: 0.0, lineTop: 0.0, lineHeight: 0.0, semanticPath: cell.semanticPath };
|
|
470
|
+
}
|
|
471
|
+
static rubyChild(ruby, lineTop, semanticPath) {
|
|
472
|
+
return { kind: "ruby", run: null, cell: null, carrierMargin: 0.0, ruby, zone: null, width: 0.0, lineTop, lineHeight: 0.0, semanticPath };
|
|
473
|
+
}
|
|
474
|
+
static bopomofoChild(zone, width, lineTop, lineHeight, semanticPath) {
|
|
475
|
+
return { kind: "bopomofo", run: null, cell: null, carrierMargin: 0.0, ruby: null, zone, width, lineTop, lineHeight, semanticPath };
|
|
476
|
+
}
|
|
477
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type EmphasisDotColorResolver } from "./EmphasisDotColorResolver.js";
|
|
2
|
+
import { type InlineBoxEntry } from "./InlineBoxEntry.js";
|
|
3
|
+
import { type PreparedCjkStrongSemantic } from "./PreparedCjkStrongSemantic.js";
|
|
4
|
+
import { type PreparedRenderTextSpan } from "./PreparedRenderTextSpan.js";
|
|
5
|
+
import { type PreparedSemanticSpan } from "./PreparedSemanticSpan.js";
|
|
6
|
+
import { type StyleClassResolver } from "./StyleClassResolver.js";
|
|
7
|
+
export interface PreparedArtifactOptions {
|
|
8
|
+
styleClassFor: StyleClassResolver | null;
|
|
9
|
+
liveSource: boolean;
|
|
10
|
+
semantics: PreparedSemanticSpan[];
|
|
11
|
+
renderTextSpans: PreparedRenderTextSpan[];
|
|
12
|
+
cjkStrongSemantics: PreparedCjkStrongSemantic[];
|
|
13
|
+
inlineBoxes: InlineBoxEntry[];
|
|
14
|
+
emphasisDotColor: EmphasisDotColorResolver | null;
|
|
15
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type MarkupNode } from "./MarkupNode.js";
|
|
2
|
+
import { type PreparedCjkStrongSemantic } from "./PreparedCjkStrongSemantic.js";
|
|
3
|
+
import { type PreparedSemanticSpan } from "./PreparedSemanticSpan.js";
|
|
4
|
+
import { type RenderedMarkupContainer } from "./RenderedMarkupContainer.js";
|
|
5
|
+
export interface PreparedArtifactState {
|
|
6
|
+
nodes: MarkupNode[];
|
|
7
|
+
activeSemantics: PreparedSemanticSpan[];
|
|
8
|
+
activeContainers: RenderedMarkupContainer[];
|
|
9
|
+
cjkStrong: PreparedCjkStrongSemantic[];
|
|
10
|
+
liveSource: boolean;
|
|
11
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type MarkupNode } from "./MarkupNode.js";
|
|
2
|
+
import { type PreparedRunRenderInput } from "./PreparedRunRenderInput.js";
|
|
3
|
+
import { type PreparedRunSignature } from "./PreparedRunSignature.js";
|
|
4
|
+
import { type PreparedSpacingResult } from "./PreparedSpacingResult.js";
|
|
5
|
+
import { type StyleClassResolver } from "./StyleClassResolver.js";
|
|
6
|
+
export declare class PreparedDom {
|
|
7
|
+
static ROOT_SELECTOR: string;
|
|
8
|
+
static LINE_MARKER_SELECTOR: string;
|
|
9
|
+
static VALUE_STYLE_SCOPE_ATTRIBUTE: string;
|
|
10
|
+
static VALUE_STYLE_ELEMENT_ATTRIBUTE: string;
|
|
11
|
+
static LIVE_SEMANTIC_INDEX_ATTRIBUTE: string;
|
|
12
|
+
static SNAPSHOT_STYLE_OWNER: string;
|
|
13
|
+
static DEFAULT_LOCALE: string;
|
|
14
|
+
static SPACING_EPSILON: number;
|
|
15
|
+
static SPACING_DUST_EPSILON: number;
|
|
16
|
+
static FALLBACK_SPACING_DUST_EPSILON: number;
|
|
17
|
+
static RENDER_FLOW_EPSILON_PX: number;
|
|
18
|
+
private static BASE36;
|
|
19
|
+
static snapshotValueStyleClass(index: number): string;
|
|
20
|
+
static runtimeValueStyleClass(key: string): string;
|
|
21
|
+
static preparedSpacing(display: string, naturalWidth: number, trailingGap: number, dustEpsilon?: number | null): PreparedSpacingResult;
|
|
22
|
+
static preparedFeatureSignature(openTypeFeatures: string[] | null): string;
|
|
23
|
+
static preparedRenderFontSignature(renderFontFamilies: string[]): string;
|
|
24
|
+
static isPreparedOpenTypeFeatureSignature(signature: string): boolean;
|
|
25
|
+
static canMergePreparedRun(left: PreparedRunSignature, right: PreparedRunSignature): boolean;
|
|
26
|
+
static mergePreparedRun(left: PreparedRunSignature, right: PreparedRunSignature): void;
|
|
27
|
+
static renderRun(input: PreparedRunRenderInput, styleClassFor: StyleClassResolver | null, spacingBoundary: string): MarkupNode;
|
|
28
|
+
private static base36;
|
|
29
|
+
}
|