@tiqian/protocol 0.0.0-stage.1 → 0.1.0-alpha.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/haxe/crypto/Sha256.d.ts +19 -0
- package/dist/haxe/crypto/Sha256.js +194 -0
- package/dist/org/tiqian/clreq/AdjustmentStylePolicy.d.ts +11 -0
- package/dist/org/tiqian/clreq/AdjustmentStylePolicy.js +21 -0
- package/dist/org/tiqian/clreq/AutoSpaceMode.d.ts +16 -0
- package/dist/org/tiqian/clreq/AutoSpaceMode.js +17 -0
- package/dist/org/tiqian/clreq/AutoSpacePolicy.d.ts +13 -0
- package/dist/org/tiqian/clreq/AutoSpacePolicy.js +23 -0
- package/dist/org/tiqian/clreq/BopomofoReading.d.ts +12 -0
- package/dist/org/tiqian/clreq/BopomofoReading.js +86 -0
- package/dist/org/tiqian/clreq/BopomofoTone.d.ts +28 -0
- package/dist/org/tiqian/clreq/BopomofoTone.js +26 -0
- package/dist/org/tiqian/clreq/CjkPunctuationGlyphPolicy.d.ts +16 -0
- package/dist/org/tiqian/clreq/CjkPunctuationGlyphPolicy.js +17 -0
- package/dist/org/tiqian/clreq/ClreqProfile.d.ts +27 -0
- package/dist/org/tiqian/clreq/ClreqProfile.js +58 -0
- package/dist/org/tiqian/clreq/ClreqRegion.d.ts +20 -0
- package/dist/org/tiqian/clreq/ClreqRegion.js +20 -0
- package/dist/org/tiqian/clreq/ClreqStrictness.d.ts +16 -0
- package/dist/org/tiqian/clreq/ClreqStrictness.js +17 -0
- package/dist/org/tiqian/clreq/GlueSide.d.ts +16 -0
- package/dist/org/tiqian/clreq/GlueSide.js +17 -0
- package/dist/org/tiqian/clreq/HangingPunctuationStyle.d.ts +12 -0
- package/dist/org/tiqian/clreq/HangingPunctuationStyle.js +14 -0
- package/dist/org/tiqian/clreq/InteriorPunctuationStyle.d.ts +12 -0
- package/dist/org/tiqian/clreq/InteriorPunctuationStyle.js +14 -0
- package/dist/org/tiqian/clreq/KinsokuLevel.d.ts +20 -0
- package/dist/org/tiqian/clreq/KinsokuLevel.js +20 -0
- package/dist/org/tiqian/clreq/KinsokuMode.d.ts +14 -0
- package/dist/org/tiqian/clreq/KinsokuMode.js +2 -0
- package/dist/org/tiqian/clreq/KinsokuModes.d.ts +11 -0
- package/dist/org/tiqian/clreq/KinsokuModes.js +71 -0
- package/dist/org/tiqian/clreq/LineAdjustmentStrategy.d.ts +16 -0
- package/dist/org/tiqian/clreq/LineAdjustmentStrategy.js +17 -0
- package/dist/org/tiqian/clreq/LineEndPunctuationStyle.d.ts +12 -0
- package/dist/org/tiqian/clreq/LineEndPunctuationStyle.js +14 -0
- package/dist/org/tiqian/clreq/PunctuationClass.d.ts +44 -0
- package/dist/org/tiqian/clreq/PunctuationClass.js +38 -0
- package/dist/org/tiqian/clreq/PunctuationGluePlacement.d.ts +12 -0
- package/dist/org/tiqian/clreq/PunctuationGluePlacement.js +14 -0
- package/dist/org/tiqian/clreq/PunctuationGluePlacements.d.ts +9 -0
- package/dist/org/tiqian/clreq/PunctuationGluePlacements.js +49 -0
- package/dist/org/tiqian/clreq/PunctuationWidthPolicy.d.ts +8 -0
- package/dist/org/tiqian/clreq/PunctuationWidthPolicy.js +16 -0
- package/dist/org/tiqian/clreq/ResolvedKinsoku.d.ts +12 -0
- package/dist/org/tiqian/clreq/ResolvedKinsoku.js +43 -0
- package/dist/org/tiqian/core/Cluster.d.ts +13 -0
- package/dist/org/tiqian/core/Cluster.js +24 -0
- package/dist/org/tiqian/core/EastAsianSpacingData.d.ts +4 -0
- package/dist/org/tiqian/core/EastAsianSpacingData.js +399 -0
- package/dist/org/tiqian/core/EastAsianSpacingEdges.d.ts +8 -0
- package/dist/org/tiqian/core/EastAsianSpacingEdges.js +14 -0
- package/dist/org/tiqian/core/EastAsianSpacingValue.d.ts +20 -0
- package/dist/org/tiqian/core/EastAsianSpacingValue.js +20 -0
- package/dist/org/tiqian/core/Ic.d.ts +7 -0
- package/dist/org/tiqian/core/Ic.js +17 -0
- package/dist/org/tiqian/core/IllegalStateException.d.ts +4 -0
- package/dist/org/tiqian/core/IllegalStateException.js +8 -0
- package/dist/org/tiqian/core/IntRange.d.ts +12 -0
- package/dist/org/tiqian/core/IntRange.js +30 -0
- package/dist/org/tiqian/core/LineEndReason.d.ts +16 -0
- package/dist/org/tiqian/core/LineEndReason.js +17 -0
- package/dist/org/tiqian/core/SourceBoundaryBias.d.ts +16 -0
- package/dist/org/tiqian/core/SourceBoundaryBias.js +17 -0
- package/dist/org/tiqian/core/SourceInteractionBoundaries.d.ts +29 -0
- package/dist/org/tiqian/core/SourceInteractionBoundaries.js +193 -0
- package/dist/org/tiqian/core/TextRange.d.ts +11 -0
- package/dist/org/tiqian/core/TextRange.js +40 -0
- package/dist/org/tiqian/core/TextRangeError.d.ts +11 -0
- package/dist/org/tiqian/core/TextRangeError.js +2 -0
- package/dist/org/tiqian/core/TiqianIllegalArgumentException.d.ts +6 -0
- package/dist/org/tiqian/core/TiqianIllegalArgumentException.js +21 -0
- package/dist/org/tiqian/core/TiqianNoSuchElementException.d.ts +10 -0
- package/dist/org/tiqian/core/TiqianNoSuchElementException.js +16 -0
- package/dist/org/tiqian/core/UnicodeCombiningMarkData.d.ts +3 -0
- package/dist/org/tiqian/core/UnicodeCombiningMarkData.js +109 -0
- package/dist/org/tiqian/core/UnicodeEastAsianSpacing.d.ts +16 -0
- package/dist/org/tiqian/core/UnicodeEastAsianSpacing.js +88 -0
- package/dist/org/tiqian/core/UnicodeEmojiModifierBaseData.d.ts +3 -0
- package/dist/org/tiqian/core/UnicodeEmojiModifierBaseData.js +35 -0
- package/dist/org/tiqian/core/UnicodeExtendedPictographicData.d.ts +3 -0
- package/dist/org/tiqian/core/UnicodeExtendedPictographicData.js +64 -0
- package/dist/org/tiqian/core/UnicodeNumber.d.ts +3 -0
- package/dist/org/tiqian/core/UnicodeNumber.js +14 -0
- package/dist/org/tiqian/core/UnicodeNumberData.d.ts +3 -0
- package/dist/org/tiqian/core/UnicodeNumberData.js +64 -0
- package/dist/org/tiqian/core/UnicodeScriptEvidence.d.ts +16 -0
- package/dist/org/tiqian/core/UnicodeScriptEvidence.js +17 -0
- package/dist/org/tiqian/core/UnicodeScriptEvidenceClassifier.d.ts +7 -0
- package/dist/org/tiqian/core/UnicodeScriptEvidenceClassifier.js +17 -0
- package/dist/org/tiqian/core/UnicodeScriptEvidenceData.d.ts +4 -0
- package/dist/org/tiqian/core/UnicodeScriptEvidenceData.js +295 -0
- package/dist/org/tiqian/core/UnicodeWordCharacter.d.ts +6 -0
- package/dist/org/tiqian/core/UnicodeWordCharacter.js +17 -0
- package/dist/org/tiqian/core/UnicodeWordCharacterData.d.ts +3 -0
- package/dist/org/tiqian/core/UnicodeWordCharacterData.js +234 -0
- package/dist/org/tiqian/font/FontRole.d.ts +28 -0
- package/dist/org/tiqian/font/FontRole.js +26 -0
- package/dist/org/tiqian/font/FontRoleContext.d.ts +13 -0
- package/dist/org/tiqian/font/FontRoleContext.js +28 -0
- package/dist/org/tiqian/layout/ContextualQuoteRoleResolver.d.ts +51 -0
- package/dist/org/tiqian/layout/ContextualQuoteRoleResolver.js +305 -0
- package/dist/org/tiqian/layout/LineOptimization.d.ts +124 -0
- package/dist/org/tiqian/layout/LineOptimization.js +298 -0
- package/dist/org/tiqian/layout/ProgressiveBreakDecisions.d.ts +86 -0
- package/dist/org/tiqian/layout/ProgressiveBreakDecisions.js +415 -0
- package/dist/org/tiqian/layout/ProgressiveBreakTierPriority.d.ts +5 -0
- package/dist/org/tiqian/layout/ProgressiveBreakTierPriority.js +33 -0
- package/dist/org/tiqian/layout/QuotePairAnalyzer.d.ts +63 -0
- package/dist/org/tiqian/layout/QuotePairAnalyzer.js +251 -0
- package/dist/org/tiqian/linebreak/BreakKind.d.ts +20 -0
- package/dist/org/tiqian/linebreak/BreakKind.js +20 -0
- package/dist/org/tiqian/protocol/Canonical.d.ts +55 -0
- package/dist/org/tiqian/protocol/Canonical.js +471 -0
- package/dist/org/tiqian/protocol/DecorationInput.d.ts +6 -0
- package/dist/org/tiqian/protocol/DecorationInput.js +12 -0
- package/dist/org/tiqian/protocol/EncodeResult.d.ts +9 -0
- package/dist/org/tiqian/protocol/EncodeResult.js +2 -0
- package/dist/org/tiqian/protocol/FaceInfo.d.ts +13 -0
- package/dist/org/tiqian/protocol/FaceInfo.js +2 -0
- package/dist/org/tiqian/protocol/FontContract.d.ts +25 -0
- package/dist/org/tiqian/protocol/FontContract.js +317 -0
- package/dist/org/tiqian/protocol/FontFaceRecord.d.ts +6 -0
- package/dist/org/tiqian/protocol/FontFaceRecord.js +2 -0
- package/dist/org/tiqian/protocol/FontFaceSpec.d.ts +11 -0
- package/dist/org/tiqian/protocol/FontFaceSpec.js +2 -0
- package/dist/org/tiqian/protocol/FontWeightSpec.d.ts +10 -0
- package/dist/org/tiqian/protocol/FontWeightSpec.js +2 -0
- package/dist/org/tiqian/protocol/InlineBoxInput.d.ts +7 -0
- package/dist/org/tiqian/protocol/InlineBoxInput.js +2 -0
- package/dist/org/tiqian/protocol/InlineObjectInput.d.ts +7 -0
- package/dist/org/tiqian/protocol/InlineObjectInput.js +2 -0
- package/dist/org/tiqian/protocol/JsCoerce.d.ts +19 -0
- package/dist/org/tiqian/protocol/JsCoerce.js +394 -0
- package/dist/org/tiqian/protocol/LayoutAttribute.d.ts +5 -0
- package/dist/org/tiqian/protocol/LayoutAttribute.js +10 -0
- package/dist/org/tiqian/protocol/LayoutFloatShape.d.ts +14 -0
- package/dist/org/tiqian/protocol/LayoutFloatShape.js +2 -0
- package/dist/org/tiqian/protocol/LayoutTree.d.ts +23 -0
- package/dist/org/tiqian/protocol/LayoutTree.js +2 -0
- package/dist/org/tiqian/protocol/LayoutVertex.d.ts +4 -0
- package/dist/org/tiqian/protocol/LayoutVertex.js +2 -0
- package/dist/org/tiqian/protocol/LineBreakSpanInput.d.ts +6 -0
- package/dist/org/tiqian/protocol/LineBreakSpanInput.js +12 -0
- package/dist/org/tiqian/protocol/MetricEntry.d.ts +11 -0
- package/dist/org/tiqian/protocol/MetricEntry.js +21 -0
- package/dist/org/tiqian/protocol/NamedError.d.ts +88 -0
- package/dist/org/tiqian/protocol/NamedError.js +71 -0
- package/dist/org/tiqian/protocol/NamedErrorNames.d.ts +5 -0
- package/dist/org/tiqian/protocol/NamedErrorNames.js +53 -0
- package/dist/org/tiqian/protocol/ParagraphRequest.d.ts +25 -0
- package/dist/org/tiqian/protocol/ParagraphRequest.js +2 -0
- package/dist/org/tiqian/protocol/ParagraphRequestChecks.d.ts +8 -0
- package/dist/org/tiqian/protocol/ParagraphRequestChecks.js +145 -0
- package/dist/org/tiqian/protocol/ParagraphRequestException.d.ts +6 -0
- package/dist/org/tiqian/protocol/ParagraphRequestException.js +55 -0
- package/dist/org/tiqian/protocol/ParagraphRequestFields.d.ts +3 -0
- package/dist/org/tiqian/protocol/ParagraphRequestFields.js +4 -0
- package/dist/org/tiqian/protocol/Plan.d.ts +101 -0
- package/dist/org/tiqian/protocol/Plan.js +10 -0
- package/dist/org/tiqian/protocol/PlanEndReason.d.ts +16 -0
- package/dist/org/tiqian/protocol/PlanEndReason.js +17 -0
- package/dist/org/tiqian/protocol/PlanJsonNumber.d.ts +43 -0
- package/dist/org/tiqian/protocol/PlanJsonNumber.js +362 -0
- package/dist/org/tiqian/protocol/PlanSchema.d.ts +4 -0
- package/dist/org/tiqian/protocol/PlanSchema.js +5 -0
- package/dist/org/tiqian/protocol/PlanStyleDelta.d.ts +5 -0
- package/dist/org/tiqian/protocol/PlanStyleDelta.js +2 -0
- package/dist/org/tiqian/protocol/Revision.d.ts +11 -0
- package/dist/org/tiqian/protocol/Revision.js +12 -0
- package/dist/org/tiqian/protocol/SessionFaceSpec.d.ts +5 -0
- package/dist/org/tiqian/protocol/SessionFaceSpec.js +2 -0
- package/dist/org/tiqian/protocol/SnapshotTableBinary.d.ts +55 -0
- package/dist/org/tiqian/protocol/SnapshotTableBinary.js +657 -0
- package/dist/org/tiqian/protocol/SnapshotTypography.d.ts +14 -0
- package/dist/org/tiqian/protocol/SnapshotTypography.js +2 -0
- package/dist/org/tiqian/protocol/StyleRow.d.ts +8 -0
- package/dist/org/tiqian/protocol/StyleRow.js +15 -0
- package/dist/org/tiqian/protocol/TableData.d.ts +25 -0
- package/dist/org/tiqian/protocol/TableData.js +45 -0
- package/dist/org/tiqian/protocol/TableInput.d.ts +13 -0
- package/dist/org/tiqian/protocol/TableInput.js +21 -0
- package/dist/org/tiqian/protocol/TableMetricRow.d.ts +9 -0
- package/dist/org/tiqian/protocol/TableMetricRow.js +17 -0
- package/dist/org/tiqian/protocol/TableProbe.d.ts +11 -0
- package/dist/org/tiqian/protocol/TableProbe.js +21 -0
- package/dist/org/tiqian/protocol/TextSpanInput.d.ts +9 -0
- package/dist/org/tiqian/protocol/TextSpanInput.js +2 -0
- package/dist/org/tiqian/protocol/ValueRow.d.ts +4 -0
- package/dist/org/tiqian/protocol/ValueRow.js +7 -0
- package/dist/org/tiqian/protocol/WireField.d.ts +5 -0
- package/dist/org/tiqian/protocol/WireField.js +2 -0
- package/dist/org/tiqian/protocol/WireValue.d.ts +25 -0
- package/dist/org/tiqian/protocol/WireValue.js +2 -0
- package/dist/org/tiqian/test/TestHelpers.d.ts +5 -0
- package/dist/org/tiqian/test/TestHelpers.js +27 -0
- package/dist/org/tiqian/test/trace/TestTrace.d.ts +6 -0
- package/dist/org/tiqian/test/trace/TestTrace.js +8 -0
- package/dist/org/tiqian/test/trace/TestTracePlatform.d.ts +6 -0
- package/dist/org/tiqian/test/trace/TestTracePlatform.js +78 -0
- package/dist/org/tiqian/test/trace/TestTraceRecorder.d.ts +9 -0
- package/dist/org/tiqian/test/trace/TestTraceRecorder.js +36 -0
- package/dist/org/tiqian/test/trace/TestTraceRender.d.ts +47 -0
- package/dist/org/tiqian/test/trace/TestTraceRender.js +690 -0
- package/dist/org/tiqian/test/trace/TestTraceStore.d.ts +18 -0
- package/dist/org/tiqian/test/trace/TestTraceStore.js +149 -0
- package/dist/org/tiqian/test/trace/TraceAssertionError.d.ts +5 -0
- package/dist/org/tiqian/test/trace/TraceAssertionError.js +2 -0
- package/dist/org/tiqian/test/trace/TraceAssertionException.d.ts +6 -0
- package/dist/org/tiqian/test/trace/TraceAssertionException.js +16 -0
- package/dist/org/tiqian/test/trace/TraceField.d.ts +5 -0
- package/dist/org/tiqian/test/trace/TraceField.js +10 -0
- package/dist/org/tiqian/test/trace/TraceFormat.d.ts +21 -0
- package/dist/org/tiqian/test/trace/TraceFormat.js +184 -0
- package/dist/org/tiqian/test/trace/TracedAssertions.d.ts +78 -0
- package/dist/org/tiqian/test/trace/TracedAssertions.js +749 -0
- package/dist/runtime.d.ts +96 -0
- package/dist/runtime.js +1612 -0
- package/dist/std/FsError.d.ts +48 -0
- package/dist/std/FsError.js +2 -0
- package/dist/std/FsException.d.ts +6 -0
- package/dist/std/FsException.js +45 -0
- package/dist/std/UStringException.d.ts +6 -0
- package/dist/std/UStringException.js +21 -0
- package/dist/std/UStringFault.d.ts +9 -0
- package/dist/std/UStringFault.js +2 -0
- package/package.json +26 -4
- package/README.md +0 -3
|
@@ -0,0 +1,362 @@
|
|
|
1
|
+
// Generated by the reflaxe TypeScript target. Do not edit.
|
|
2
|
+
import { floatToI32, formatFloatRuntime, i32ToFloat, readUnit } from "../../../runtime.js";
|
|
3
|
+
export class PlanJsonNumber {
|
|
4
|
+
static fivePowers = [];
|
|
5
|
+
static twoPowers = [];
|
|
6
|
+
static ecmaJsonNumber(floatValue) {
|
|
7
|
+
return formatFloatRuntime(i32ToFloat(floatToI32(floatValue)));
|
|
8
|
+
}
|
|
9
|
+
static appendJsonString(out, value) {
|
|
10
|
+
out.push("\"");
|
|
11
|
+
for (let i = 0, count = value.length; i < count; i += 1) {
|
|
12
|
+
const c = (Number.isNaN(value.charCodeAt(i)) ? null : value.charCodeAt(i));
|
|
13
|
+
if (c === 34) {
|
|
14
|
+
out.push("\\\"");
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
if (c === 92) {
|
|
18
|
+
out.push("\\\\");
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
if (c === 8) {
|
|
22
|
+
out.push("\\b");
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
if (c === 12) {
|
|
26
|
+
out.push("\\f");
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
if (c === 10) {
|
|
30
|
+
out.push("\\n");
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
if (c === 13) {
|
|
34
|
+
out.push("\\r");
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
if (c === 9) {
|
|
38
|
+
out.push("\\t");
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
if (c < 32) {
|
|
42
|
+
out.push(`\\u${(((c)) >>> 0).toString(16).toUpperCase().padStart(4, "0").toLowerCase()}`);
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
out.push(String.fromCodePoint((c)));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
out.push("\"");
|
|
56
|
+
}
|
|
57
|
+
static shortestRoundTripDigits(magnitude) {
|
|
58
|
+
const d = PlanJsonNumber.decompose(magnitude);
|
|
59
|
+
const f = d.exp2;
|
|
60
|
+
const expansion = PlanJsonNumber.dyadicDecimal(d.mantissa, f);
|
|
61
|
+
const exact = PlanJsonNumber.trimZeros(expansion.digits);
|
|
62
|
+
const n = expansion.exponent;
|
|
63
|
+
const base = d.mantissa;
|
|
64
|
+
const doubled = PlanJsonNumber.timesSmall(base, 2);
|
|
65
|
+
const hi = PlanJsonNumber.dyadicDecimalString(PlanJsonNumber.addDecimal(doubled, "1"), d.exp2 - 1);
|
|
66
|
+
let lo;
|
|
67
|
+
if (base === "4503599627370496") {
|
|
68
|
+
lo = PlanJsonNumber.dyadicDecimalString(PlanJsonNumber.decrementDecimal(PlanJsonNumber.timesSmall(base, 4)), d.exp2 - 2);
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
lo = PlanJsonNumber.dyadicDecimalString(PlanJsonNumber.decrementDecimal(doubled), d.exp2 - 1);
|
|
72
|
+
}
|
|
73
|
+
const inclusive = (readUnit(base, base.length - 1) - 48) % 2 === 0;
|
|
74
|
+
let length = 1;
|
|
75
|
+
while (length <= 17) {
|
|
76
|
+
const keep = exact.substr(0, length);
|
|
77
|
+
const up = PlanJsonNumber.incrementDecimal(keep);
|
|
78
|
+
const upN = n + up.length - length;
|
|
79
|
+
if (PlanJsonNumber.inInterval(keep, n, lo, hi, inclusive) || PlanJsonNumber.inInterval(up, upN, lo, hi, inclusive)) {
|
|
80
|
+
const rounded = PlanJsonNumber.roundToSignificant(exact, length);
|
|
81
|
+
return { digits: rounded.digits, exponent: n + rounded.exponent };
|
|
82
|
+
}
|
|
83
|
+
length += 1;
|
|
84
|
+
}
|
|
85
|
+
return { digits: exact, exponent: n };
|
|
86
|
+
}
|
|
87
|
+
static inInterval(digits, n, lo, hi, inclusive) {
|
|
88
|
+
const low = PlanJsonNumber.compareDecimal(digits, n, lo.digits, lo.exponent);
|
|
89
|
+
const high = PlanJsonNumber.compareDecimal(digits, n, hi.digits, hi.exponent);
|
|
90
|
+
return (low > 0 || low === 0 && inclusive) && (high < 0 || high === 0 && inclusive);
|
|
91
|
+
}
|
|
92
|
+
static canonicalFloatDigits(magnitude, doubleDigits) {
|
|
93
|
+
const d = PlanJsonNumber.decomposeF32(magnitude);
|
|
94
|
+
const exact = (d.mant24 === 0 ? "0" : (d.exp2 >= 0 ? PlanJsonNumber.timesLong(PlanJsonNumber.twoToThe(d.exp2), d.mant24) : PlanJsonNumber.timesLong(PlanJsonNumber.fiveToThe(-d.exp2), d.mant24)));
|
|
95
|
+
const stripped = PlanJsonNumber.trimZeros(exact);
|
|
96
|
+
if (stripped.length <= doubleDigits.length) {
|
|
97
|
+
return doubleDigits;
|
|
98
|
+
}
|
|
99
|
+
const rounded = PlanJsonNumber.roundToSignificant(stripped, doubleDigits.length);
|
|
100
|
+
return (rounded.digits.length === doubleDigits.length ? rounded.digits : doubleDigits);
|
|
101
|
+
}
|
|
102
|
+
static dyadicDecimal(p, f) {
|
|
103
|
+
return PlanJsonNumber.dyadicDecimalString(p, f);
|
|
104
|
+
}
|
|
105
|
+
static dyadicDecimalString(p, f) {
|
|
106
|
+
const digits = (f < 0 ? PlanJsonNumber.multiplyDecimal(PlanJsonNumber.fiveToThe(-f), p) : PlanJsonNumber.multiplyDecimal(PlanJsonNumber.twoToThe(f), p));
|
|
107
|
+
return { digits, exponent: (f < 0 ? digits.length + f : digits.length) };
|
|
108
|
+
}
|
|
109
|
+
static multiplyDecimal(a, b) {
|
|
110
|
+
let result = "0";
|
|
111
|
+
let shift = 0;
|
|
112
|
+
let i = b.length - 1;
|
|
113
|
+
while (i >= 0) {
|
|
114
|
+
const digit = (Number.isNaN(b.charCodeAt(i)) ? null : b.charCodeAt(i)) - 48;
|
|
115
|
+
if (digit !== 0) {
|
|
116
|
+
let part = PlanJsonNumber.timesSmall(a, digit);
|
|
117
|
+
if (shift > 0) {
|
|
118
|
+
part += PlanJsonNumber.zeros(shift);
|
|
119
|
+
}
|
|
120
|
+
result = PlanJsonNumber.addDecimal(result, part);
|
|
121
|
+
}
|
|
122
|
+
shift++;
|
|
123
|
+
i--;
|
|
124
|
+
}
|
|
125
|
+
return result;
|
|
126
|
+
}
|
|
127
|
+
static fiveToThe(k) {
|
|
128
|
+
if (PlanJsonNumber.fivePowers.length === 0) {
|
|
129
|
+
PlanJsonNumber.fivePowers = PlanJsonNumber.powerTable(5, 200);
|
|
130
|
+
}
|
|
131
|
+
if (k < PlanJsonNumber.fivePowers.length) {
|
|
132
|
+
return PlanJsonNumber.fivePowers[k];
|
|
133
|
+
}
|
|
134
|
+
return PlanJsonNumber.powerTable(5, k + 1)[k];
|
|
135
|
+
}
|
|
136
|
+
static twoToThe(k) {
|
|
137
|
+
if (PlanJsonNumber.twoPowers.length === 0) {
|
|
138
|
+
PlanJsonNumber.twoPowers = PlanJsonNumber.powerTable(2, 200);
|
|
139
|
+
}
|
|
140
|
+
if (k < PlanJsonNumber.twoPowers.length) {
|
|
141
|
+
return PlanJsonNumber.twoPowers[k];
|
|
142
|
+
}
|
|
143
|
+
return PlanJsonNumber.powerTable(2, k + 1)[k];
|
|
144
|
+
}
|
|
145
|
+
static powerTable(base, entries) {
|
|
146
|
+
const table = ["1"];
|
|
147
|
+
let digits = "1";
|
|
148
|
+
for (let i = 1; i < entries; i += 1) {
|
|
149
|
+
digits = PlanJsonNumber.timesSmall(digits, base);
|
|
150
|
+
table.push(digits);
|
|
151
|
+
}
|
|
152
|
+
return table;
|
|
153
|
+
}
|
|
154
|
+
static timesLong(digits, factor) {
|
|
155
|
+
if (factor === 0) {
|
|
156
|
+
return "0";
|
|
157
|
+
}
|
|
158
|
+
let result = null;
|
|
159
|
+
let shift = 0;
|
|
160
|
+
let remaining = factor;
|
|
161
|
+
while (remaining > 0) {
|
|
162
|
+
const chunk = remaining % 100000000;
|
|
163
|
+
remaining = Math.trunc(remaining / 100000000);
|
|
164
|
+
if (chunk !== 0) {
|
|
165
|
+
let part = PlanJsonNumber.timesSmall(digits, chunk);
|
|
166
|
+
if (shift > 0) {
|
|
167
|
+
part += PlanJsonNumber.zeros(shift);
|
|
168
|
+
}
|
|
169
|
+
result = (result === null ? part : PlanJsonNumber.addDecimal(result, part));
|
|
170
|
+
}
|
|
171
|
+
shift += 8;
|
|
172
|
+
}
|
|
173
|
+
return (result === null ? "0" : result);
|
|
174
|
+
}
|
|
175
|
+
static addDecimal(a, b) {
|
|
176
|
+
const out = [];
|
|
177
|
+
let i = a.length - 1;
|
|
178
|
+
let j = b.length - 1;
|
|
179
|
+
let carry = 0;
|
|
180
|
+
while (i >= 0 || j >= 0 || carry > 0) {
|
|
181
|
+
const sum = (i >= 0 ? (Number.isNaN(a.charCodeAt(i)) ? null : a.charCodeAt(i)) - 48 : 0) + (j >= 0 ? (Number.isNaN(b.charCodeAt(j)) ? null : b.charCodeAt(j)) - 48 : 0) + carry;
|
|
182
|
+
out.push(String.fromCodePoint(48 + sum % 10));
|
|
183
|
+
carry = Math.trunc(sum / 10);
|
|
184
|
+
i--;
|
|
185
|
+
j--;
|
|
186
|
+
}
|
|
187
|
+
const text = out.join("");
|
|
188
|
+
return PlanJsonNumber.reverse(text);
|
|
189
|
+
}
|
|
190
|
+
static roundToSignificant(exact, length) {
|
|
191
|
+
if (length >= exact.length) {
|
|
192
|
+
return { digits: exact, exponent: 0 };
|
|
193
|
+
}
|
|
194
|
+
const keep = exact.substr(0, length);
|
|
195
|
+
const rem = exact.substr(length);
|
|
196
|
+
let up = false;
|
|
197
|
+
if ((Number.isNaN(rem.charCodeAt(0)) ? null : rem.charCodeAt(0)) > 53) {
|
|
198
|
+
up = true;
|
|
199
|
+
}
|
|
200
|
+
else {
|
|
201
|
+
if ((Number.isNaN(rem.charCodeAt(0)) ? null : rem.charCodeAt(0)) === 53) {
|
|
202
|
+
let tail = 1;
|
|
203
|
+
while (tail < rem.length && (Number.isNaN(rem.charCodeAt(tail)) ? null : rem.charCodeAt(tail)) === 48) {
|
|
204
|
+
tail++;
|
|
205
|
+
}
|
|
206
|
+
up = tail < rem.length || (readUnit(keep, keep.length - 1) - 48) % 2 !== 0;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
const rounded = (up ? PlanJsonNumber.incrementDecimal(keep) : keep);
|
|
210
|
+
return { digits: PlanJsonNumber.trimZeros(rounded), exponent: rounded.length - length };
|
|
211
|
+
}
|
|
212
|
+
static compareDecimal(a, nA, b, nB) {
|
|
213
|
+
const eA = nA - a.length;
|
|
214
|
+
const eB = nB - b.length;
|
|
215
|
+
const aa = (eA >= eB ? a + PlanJsonNumber.zeros(eA - eB) : a);
|
|
216
|
+
const bb = (eB >= eA ? b + PlanJsonNumber.zeros(eB - eA) : b);
|
|
217
|
+
if (aa.length !== bb.length) {
|
|
218
|
+
return aa.length - bb.length;
|
|
219
|
+
}
|
|
220
|
+
return PlanJsonNumber.compareDigitStrings(aa, bb);
|
|
221
|
+
}
|
|
222
|
+
static timesSmall(digits, factor) {
|
|
223
|
+
const out = [];
|
|
224
|
+
let carry = 0;
|
|
225
|
+
let i = digits.length - 1;
|
|
226
|
+
while (i >= 0) {
|
|
227
|
+
const product = ((Number.isNaN(digits.charCodeAt(i)) ? null : digits.charCodeAt(i)) - 48) * factor + carry;
|
|
228
|
+
out.push(String.fromCodePoint(48 + product % 10));
|
|
229
|
+
carry = Math.trunc(product / 10);
|
|
230
|
+
i--;
|
|
231
|
+
}
|
|
232
|
+
while (carry > 0) {
|
|
233
|
+
out.push(String.fromCodePoint(48 + carry % 10));
|
|
234
|
+
carry = Math.trunc(carry / 10);
|
|
235
|
+
}
|
|
236
|
+
const text = out.join("");
|
|
237
|
+
return PlanJsonNumber.reverse(text);
|
|
238
|
+
}
|
|
239
|
+
static incrementDecimal(digits) {
|
|
240
|
+
const a = digits.split("");
|
|
241
|
+
let i = a.length - 1;
|
|
242
|
+
while (true) {
|
|
243
|
+
if (a[i] !== "9") {
|
|
244
|
+
a[i] = String.fromCodePoint(readUnit(a[i], 0) + 1);
|
|
245
|
+
return a.join("");
|
|
246
|
+
}
|
|
247
|
+
a[i] = "0";
|
|
248
|
+
if (i === 0) {
|
|
249
|
+
return `1${a.join("")}`;
|
|
250
|
+
}
|
|
251
|
+
i--;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
static decrementDecimal(digits) {
|
|
255
|
+
const a = digits.split("");
|
|
256
|
+
let i = a.length - 1;
|
|
257
|
+
while (i >= 0 && a[i] === "0") {
|
|
258
|
+
a[i] = "9";
|
|
259
|
+
i--;
|
|
260
|
+
}
|
|
261
|
+
if (i >= 0) {
|
|
262
|
+
a[i] = String.fromCodePoint(readUnit(a[i], 0) - 1);
|
|
263
|
+
}
|
|
264
|
+
const out = a.join("");
|
|
265
|
+
let start = 0;
|
|
266
|
+
while (start < out.length - 1 && (Number.isNaN(out.charCodeAt(start)) ? null : out.charCodeAt(start)) === 48) {
|
|
267
|
+
start++;
|
|
268
|
+
}
|
|
269
|
+
return out.substr(start);
|
|
270
|
+
}
|
|
271
|
+
static decompose(v) {
|
|
272
|
+
const f = PlanJsonNumber.decomposeF32(v);
|
|
273
|
+
let mantissa = String(f.mant24);
|
|
274
|
+
let exponent = f.exp2;
|
|
275
|
+
if (f.mant24 >= 8388608) {
|
|
276
|
+
mantissa = PlanJsonNumber.timesLong(mantissa, 536870912);
|
|
277
|
+
exponent -= 29;
|
|
278
|
+
}
|
|
279
|
+
while (mantissa.length < 16 || mantissa.length === 16 && PlanJsonNumber.compareDigitStrings(mantissa, "4503599627370496") < 0) {
|
|
280
|
+
mantissa = PlanJsonNumber.timesSmall(mantissa, 2);
|
|
281
|
+
exponent--;
|
|
282
|
+
}
|
|
283
|
+
return { mantissa, exp2: exponent };
|
|
284
|
+
}
|
|
285
|
+
static decomposeF32(v) {
|
|
286
|
+
const bits = floatToI32(v);
|
|
287
|
+
const rawExponent = (bits >>> 23) & 255;
|
|
288
|
+
const rawMantissa = bits & 8388607;
|
|
289
|
+
if (rawExponent === 0) {
|
|
290
|
+
return { mant24: rawMantissa, exp2: -149 };
|
|
291
|
+
}
|
|
292
|
+
return { mant24: rawMantissa | 8388608, exp2: rawExponent - 150 };
|
|
293
|
+
}
|
|
294
|
+
static compareDigitStrings(a, b) {
|
|
295
|
+
if (a.length !== b.length) {
|
|
296
|
+
return a.length - b.length;
|
|
297
|
+
}
|
|
298
|
+
let i = 0;
|
|
299
|
+
while (i < a.length) {
|
|
300
|
+
const da = (Number.isNaN(a.charCodeAt(i)) ? null : a.charCodeAt(i));
|
|
301
|
+
const db = (Number.isNaN(b.charCodeAt(i)) ? null : b.charCodeAt(i));
|
|
302
|
+
if (da !== db) {
|
|
303
|
+
return da - db;
|
|
304
|
+
}
|
|
305
|
+
i++;
|
|
306
|
+
}
|
|
307
|
+
return 0;
|
|
308
|
+
}
|
|
309
|
+
static zeros(n) {
|
|
310
|
+
let buf_b = "";
|
|
311
|
+
for (let i = 0; i < n; i += 1) {
|
|
312
|
+
buf_b += "0";
|
|
313
|
+
}
|
|
314
|
+
return buf_b;
|
|
315
|
+
}
|
|
316
|
+
static trimZeros(s) {
|
|
317
|
+
let e = s.length;
|
|
318
|
+
while (e > 1 && readUnit(s, e - 1) === 48) {
|
|
319
|
+
e--;
|
|
320
|
+
}
|
|
321
|
+
return s.substr(0, e);
|
|
322
|
+
}
|
|
323
|
+
static reverse(s) {
|
|
324
|
+
let buf_b = "";
|
|
325
|
+
let i = s.length - 1;
|
|
326
|
+
while (i >= 0) {
|
|
327
|
+
{
|
|
328
|
+
const c = (Number.isNaN(s.charCodeAt(i)) ? null : s.charCodeAt(i));
|
|
329
|
+
buf_b += String.fromCodePoint(c);
|
|
330
|
+
}
|
|
331
|
+
i--;
|
|
332
|
+
}
|
|
333
|
+
return buf_b;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
export function comparePlanJsonDigitsAndExponent(a, b) {
|
|
337
|
+
if (a === b)
|
|
338
|
+
return 0;
|
|
339
|
+
if (a.digits !== b.digits)
|
|
340
|
+
return a.digits < b.digits ? -1 : 1;
|
|
341
|
+
if (a.exponent !== b.exponent)
|
|
342
|
+
return a.exponent - b.exponent;
|
|
343
|
+
return 0;
|
|
344
|
+
}
|
|
345
|
+
export function comparePlanJsonDecomposed(a, b) {
|
|
346
|
+
if (a === b)
|
|
347
|
+
return 0;
|
|
348
|
+
if (a.mantissa !== b.mantissa)
|
|
349
|
+
return a.mantissa < b.mantissa ? -1 : 1;
|
|
350
|
+
if (a.exp2 !== b.exp2)
|
|
351
|
+
return a.exp2 - b.exp2;
|
|
352
|
+
return 0;
|
|
353
|
+
}
|
|
354
|
+
export function comparePlanJsonF32Decomposed(a, b) {
|
|
355
|
+
if (a === b)
|
|
356
|
+
return 0;
|
|
357
|
+
if (a.mant24 !== b.mant24)
|
|
358
|
+
return a.mant24 - b.mant24;
|
|
359
|
+
if (a.exp2 !== b.exp2)
|
|
360
|
+
return a.exp2 - b.exp2;
|
|
361
|
+
return 0;
|
|
362
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare class Revision {
|
|
2
|
+
static readonly SNAPSHOT_SCHEMA: number;
|
|
3
|
+
static readonly SNAPSHOT_TABLES_SCHEMA: number;
|
|
4
|
+
static readonly LAYOUT_REVISION: string;
|
|
5
|
+
static readonly RENDER_REVISION: string;
|
|
6
|
+
static readonly FONT_SOURCE_POLICY: string;
|
|
7
|
+
static readonly FONT_BACKEND_REVISION: string;
|
|
8
|
+
static readonly FONT_REPLAY_REVISION: string;
|
|
9
|
+
static readonly FONT_REPLAY_TRANSPORT: string;
|
|
10
|
+
static readonly FONT_BACKEND_PROTOCOL_REVISION: number;
|
|
11
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Generated by the reflaxe TypeScript target. Do not edit.
|
|
2
|
+
export class Revision {
|
|
3
|
+
static SNAPSHOT_SCHEMA = 1;
|
|
4
|
+
static SNAPSHOT_TABLES_SCHEMA = 2;
|
|
5
|
+
static LAYOUT_REVISION = "tiqian-layout-v2";
|
|
6
|
+
static RENDER_REVISION = "prebroken-dom-v16";
|
|
7
|
+
static FONT_SOURCE_POLICY = "host-compatible-stylesheet-v1";
|
|
8
|
+
static FONT_BACKEND_REVISION = "tiqian-shared-harfbuzz-v5";
|
|
9
|
+
static FONT_REPLAY_REVISION = "tiqian-server-shaping-replay-v1";
|
|
10
|
+
static FONT_REPLAY_TRANSPORT = "shared-strings-v1";
|
|
11
|
+
static FONT_BACKEND_PROTOCOL_REVISION = 2;
|
|
12
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { MetricEntry } from "./MetricEntry.js";
|
|
2
|
+
import { TableData } from "./TableData.js";
|
|
3
|
+
import { type TableInput } from "./TableInput.js";
|
|
4
|
+
export declare class SnapshotTableBinary {
|
|
5
|
+
static encode(table: TableInput): Uint8Array;
|
|
6
|
+
static encodeData(data: TableData): Uint8Array;
|
|
7
|
+
static decodeInto(bytes: Uint8Array, data: TableData): string;
|
|
8
|
+
static sortMetricRows(rows: MetricEntry[]): MetricEntry[];
|
|
9
|
+
private static metricBefore;
|
|
10
|
+
private static lower;
|
|
11
|
+
private static copyTexts;
|
|
12
|
+
private static poolRefOf;
|
|
13
|
+
private static sameValues;
|
|
14
|
+
private static f64BitsEqual;
|
|
15
|
+
private static pooledFloat;
|
|
16
|
+
private static pooledStyle;
|
|
17
|
+
private static pooledFeatures;
|
|
18
|
+
private static sameRefs;
|
|
19
|
+
private static writeTextRegion;
|
|
20
|
+
private static writeValueRow;
|
|
21
|
+
private static featureRowBytes;
|
|
22
|
+
private static readValueRow;
|
|
23
|
+
}
|
|
24
|
+
export declare class StringInterner {
|
|
25
|
+
readonly strings: string[];
|
|
26
|
+
constructor(replayStrings: string[]);
|
|
27
|
+
intern(text: string): number;
|
|
28
|
+
}
|
|
29
|
+
export declare class TableWriter {
|
|
30
|
+
private readonly buf;
|
|
31
|
+
constructor();
|
|
32
|
+
raw(bytes: Uint8Array): void;
|
|
33
|
+
u8(value: number): void;
|
|
34
|
+
u16(value: number): void;
|
|
35
|
+
u32(value: number): void;
|
|
36
|
+
f64(value: number): void;
|
|
37
|
+
absentF64(): void;
|
|
38
|
+
finish(): Uint8Array;
|
|
39
|
+
}
|
|
40
|
+
export declare class TableReader {
|
|
41
|
+
private readonly bytes;
|
|
42
|
+
private pos;
|
|
43
|
+
failed: boolean;
|
|
44
|
+
issue: string;
|
|
45
|
+
constructor(bytes: Uint8Array);
|
|
46
|
+
u8(): number;
|
|
47
|
+
u16(): number;
|
|
48
|
+
u32(): number;
|
|
49
|
+
f64(): number;
|
|
50
|
+
matchMagic(): boolean;
|
|
51
|
+
featureRow(): number[];
|
|
52
|
+
textRegion(count: number): string[];
|
|
53
|
+
restText(): string;
|
|
54
|
+
private need;
|
|
55
|
+
}
|