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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (228) hide show
  1. package/dist/haxe/crypto/Sha256.d.ts +19 -0
  2. package/dist/haxe/crypto/Sha256.js +194 -0
  3. package/dist/org/tiqian/clreq/AdjustmentStylePolicy.d.ts +11 -0
  4. package/dist/org/tiqian/clreq/AdjustmentStylePolicy.js +21 -0
  5. package/dist/org/tiqian/clreq/AutoSpaceMode.d.ts +16 -0
  6. package/dist/org/tiqian/clreq/AutoSpaceMode.js +17 -0
  7. package/dist/org/tiqian/clreq/AutoSpacePolicy.d.ts +13 -0
  8. package/dist/org/tiqian/clreq/AutoSpacePolicy.js +23 -0
  9. package/dist/org/tiqian/clreq/BopomofoReading.d.ts +12 -0
  10. package/dist/org/tiqian/clreq/BopomofoReading.js +86 -0
  11. package/dist/org/tiqian/clreq/BopomofoTone.d.ts +28 -0
  12. package/dist/org/tiqian/clreq/BopomofoTone.js +26 -0
  13. package/dist/org/tiqian/clreq/CjkPunctuationGlyphPolicy.d.ts +16 -0
  14. package/dist/org/tiqian/clreq/CjkPunctuationGlyphPolicy.js +17 -0
  15. package/dist/org/tiqian/clreq/ClreqProfile.d.ts +27 -0
  16. package/dist/org/tiqian/clreq/ClreqProfile.js +58 -0
  17. package/dist/org/tiqian/clreq/ClreqRegion.d.ts +20 -0
  18. package/dist/org/tiqian/clreq/ClreqRegion.js +20 -0
  19. package/dist/org/tiqian/clreq/ClreqStrictness.d.ts +16 -0
  20. package/dist/org/tiqian/clreq/ClreqStrictness.js +17 -0
  21. package/dist/org/tiqian/clreq/GlueSide.d.ts +16 -0
  22. package/dist/org/tiqian/clreq/GlueSide.js +17 -0
  23. package/dist/org/tiqian/clreq/HangingPunctuationStyle.d.ts +12 -0
  24. package/dist/org/tiqian/clreq/HangingPunctuationStyle.js +14 -0
  25. package/dist/org/tiqian/clreq/InteriorPunctuationStyle.d.ts +12 -0
  26. package/dist/org/tiqian/clreq/InteriorPunctuationStyle.js +14 -0
  27. package/dist/org/tiqian/clreq/KinsokuLevel.d.ts +20 -0
  28. package/dist/org/tiqian/clreq/KinsokuLevel.js +20 -0
  29. package/dist/org/tiqian/clreq/KinsokuMode.d.ts +14 -0
  30. package/dist/org/tiqian/clreq/KinsokuMode.js +2 -0
  31. package/dist/org/tiqian/clreq/KinsokuModes.d.ts +11 -0
  32. package/dist/org/tiqian/clreq/KinsokuModes.js +71 -0
  33. package/dist/org/tiqian/clreq/LineAdjustmentStrategy.d.ts +16 -0
  34. package/dist/org/tiqian/clreq/LineAdjustmentStrategy.js +17 -0
  35. package/dist/org/tiqian/clreq/LineEndPunctuationStyle.d.ts +12 -0
  36. package/dist/org/tiqian/clreq/LineEndPunctuationStyle.js +14 -0
  37. package/dist/org/tiqian/clreq/PunctuationClass.d.ts +44 -0
  38. package/dist/org/tiqian/clreq/PunctuationClass.js +38 -0
  39. package/dist/org/tiqian/clreq/PunctuationGluePlacement.d.ts +12 -0
  40. package/dist/org/tiqian/clreq/PunctuationGluePlacement.js +14 -0
  41. package/dist/org/tiqian/clreq/PunctuationGluePlacements.d.ts +9 -0
  42. package/dist/org/tiqian/clreq/PunctuationGluePlacements.js +49 -0
  43. package/dist/org/tiqian/clreq/PunctuationWidthPolicy.d.ts +8 -0
  44. package/dist/org/tiqian/clreq/PunctuationWidthPolicy.js +16 -0
  45. package/dist/org/tiqian/clreq/ResolvedKinsoku.d.ts +12 -0
  46. package/dist/org/tiqian/clreq/ResolvedKinsoku.js +43 -0
  47. package/dist/org/tiqian/core/Cluster.d.ts +13 -0
  48. package/dist/org/tiqian/core/Cluster.js +24 -0
  49. package/dist/org/tiqian/core/EastAsianSpacingData.d.ts +4 -0
  50. package/dist/org/tiqian/core/EastAsianSpacingData.js +399 -0
  51. package/dist/org/tiqian/core/EastAsianSpacingEdges.d.ts +8 -0
  52. package/dist/org/tiqian/core/EastAsianSpacingEdges.js +14 -0
  53. package/dist/org/tiqian/core/EastAsianSpacingValue.d.ts +20 -0
  54. package/dist/org/tiqian/core/EastAsianSpacingValue.js +20 -0
  55. package/dist/org/tiqian/core/Ic.d.ts +7 -0
  56. package/dist/org/tiqian/core/Ic.js +17 -0
  57. package/dist/org/tiqian/core/IllegalStateException.d.ts +4 -0
  58. package/dist/org/tiqian/core/IllegalStateException.js +8 -0
  59. package/dist/org/tiqian/core/IntRange.d.ts +12 -0
  60. package/dist/org/tiqian/core/IntRange.js +30 -0
  61. package/dist/org/tiqian/core/LineEndReason.d.ts +16 -0
  62. package/dist/org/tiqian/core/LineEndReason.js +17 -0
  63. package/dist/org/tiqian/core/SourceBoundaryBias.d.ts +16 -0
  64. package/dist/org/tiqian/core/SourceBoundaryBias.js +17 -0
  65. package/dist/org/tiqian/core/SourceInteractionBoundaries.d.ts +29 -0
  66. package/dist/org/tiqian/core/SourceInteractionBoundaries.js +193 -0
  67. package/dist/org/tiqian/core/TextRange.d.ts +11 -0
  68. package/dist/org/tiqian/core/TextRange.js +40 -0
  69. package/dist/org/tiqian/core/TextRangeError.d.ts +11 -0
  70. package/dist/org/tiqian/core/TextRangeError.js +2 -0
  71. package/dist/org/tiqian/core/TiqianIllegalArgumentException.d.ts +6 -0
  72. package/dist/org/tiqian/core/TiqianIllegalArgumentException.js +21 -0
  73. package/dist/org/tiqian/core/TiqianNoSuchElementException.d.ts +10 -0
  74. package/dist/org/tiqian/core/TiqianNoSuchElementException.js +16 -0
  75. package/dist/org/tiqian/core/UnicodeCombiningMarkData.d.ts +3 -0
  76. package/dist/org/tiqian/core/UnicodeCombiningMarkData.js +109 -0
  77. package/dist/org/tiqian/core/UnicodeEastAsianSpacing.d.ts +16 -0
  78. package/dist/org/tiqian/core/UnicodeEastAsianSpacing.js +88 -0
  79. package/dist/org/tiqian/core/UnicodeEmojiModifierBaseData.d.ts +3 -0
  80. package/dist/org/tiqian/core/UnicodeEmojiModifierBaseData.js +35 -0
  81. package/dist/org/tiqian/core/UnicodeExtendedPictographicData.d.ts +3 -0
  82. package/dist/org/tiqian/core/UnicodeExtendedPictographicData.js +64 -0
  83. package/dist/org/tiqian/core/UnicodeNumber.d.ts +3 -0
  84. package/dist/org/tiqian/core/UnicodeNumber.js +14 -0
  85. package/dist/org/tiqian/core/UnicodeNumberData.d.ts +3 -0
  86. package/dist/org/tiqian/core/UnicodeNumberData.js +64 -0
  87. package/dist/org/tiqian/core/UnicodeScriptEvidence.d.ts +16 -0
  88. package/dist/org/tiqian/core/UnicodeScriptEvidence.js +17 -0
  89. package/dist/org/tiqian/core/UnicodeScriptEvidenceClassifier.d.ts +7 -0
  90. package/dist/org/tiqian/core/UnicodeScriptEvidenceClassifier.js +17 -0
  91. package/dist/org/tiqian/core/UnicodeScriptEvidenceData.d.ts +4 -0
  92. package/dist/org/tiqian/core/UnicodeScriptEvidenceData.js +295 -0
  93. package/dist/org/tiqian/core/UnicodeWordCharacter.d.ts +6 -0
  94. package/dist/org/tiqian/core/UnicodeWordCharacter.js +17 -0
  95. package/dist/org/tiqian/core/UnicodeWordCharacterData.d.ts +3 -0
  96. package/dist/org/tiqian/core/UnicodeWordCharacterData.js +234 -0
  97. package/dist/org/tiqian/font/FontRole.d.ts +28 -0
  98. package/dist/org/tiqian/font/FontRole.js +26 -0
  99. package/dist/org/tiqian/font/FontRoleContext.d.ts +13 -0
  100. package/dist/org/tiqian/font/FontRoleContext.js +28 -0
  101. package/dist/org/tiqian/layout/ContextualQuoteRoleResolver.d.ts +51 -0
  102. package/dist/org/tiqian/layout/ContextualQuoteRoleResolver.js +305 -0
  103. package/dist/org/tiqian/layout/LineOptimization.d.ts +124 -0
  104. package/dist/org/tiqian/layout/LineOptimization.js +298 -0
  105. package/dist/org/tiqian/layout/ProgressiveBreakDecisions.d.ts +86 -0
  106. package/dist/org/tiqian/layout/ProgressiveBreakDecisions.js +415 -0
  107. package/dist/org/tiqian/layout/ProgressiveBreakTierPriority.d.ts +5 -0
  108. package/dist/org/tiqian/layout/ProgressiveBreakTierPriority.js +33 -0
  109. package/dist/org/tiqian/layout/QuotePairAnalyzer.d.ts +63 -0
  110. package/dist/org/tiqian/layout/QuotePairAnalyzer.js +251 -0
  111. package/dist/org/tiqian/linebreak/BreakKind.d.ts +20 -0
  112. package/dist/org/tiqian/linebreak/BreakKind.js +20 -0
  113. package/dist/org/tiqian/protocol/Canonical.d.ts +55 -0
  114. package/dist/org/tiqian/protocol/Canonical.js +471 -0
  115. package/dist/org/tiqian/protocol/DecorationInput.d.ts +6 -0
  116. package/dist/org/tiqian/protocol/DecorationInput.js +12 -0
  117. package/dist/org/tiqian/protocol/EncodeResult.d.ts +9 -0
  118. package/dist/org/tiqian/protocol/EncodeResult.js +2 -0
  119. package/dist/org/tiqian/protocol/FaceInfo.d.ts +13 -0
  120. package/dist/org/tiqian/protocol/FaceInfo.js +2 -0
  121. package/dist/org/tiqian/protocol/FontContract.d.ts +25 -0
  122. package/dist/org/tiqian/protocol/FontContract.js +317 -0
  123. package/dist/org/tiqian/protocol/FontFaceRecord.d.ts +6 -0
  124. package/dist/org/tiqian/protocol/FontFaceRecord.js +2 -0
  125. package/dist/org/tiqian/protocol/FontFaceSpec.d.ts +11 -0
  126. package/dist/org/tiqian/protocol/FontFaceSpec.js +2 -0
  127. package/dist/org/tiqian/protocol/FontWeightSpec.d.ts +10 -0
  128. package/dist/org/tiqian/protocol/FontWeightSpec.js +2 -0
  129. package/dist/org/tiqian/protocol/InlineBoxInput.d.ts +7 -0
  130. package/dist/org/tiqian/protocol/InlineBoxInput.js +2 -0
  131. package/dist/org/tiqian/protocol/InlineObjectInput.d.ts +7 -0
  132. package/dist/org/tiqian/protocol/InlineObjectInput.js +2 -0
  133. package/dist/org/tiqian/protocol/JsCoerce.d.ts +19 -0
  134. package/dist/org/tiqian/protocol/JsCoerce.js +394 -0
  135. package/dist/org/tiqian/protocol/LayoutAttribute.d.ts +5 -0
  136. package/dist/org/tiqian/protocol/LayoutAttribute.js +10 -0
  137. package/dist/org/tiqian/protocol/LayoutFloatShape.d.ts +14 -0
  138. package/dist/org/tiqian/protocol/LayoutFloatShape.js +2 -0
  139. package/dist/org/tiqian/protocol/LayoutTree.d.ts +23 -0
  140. package/dist/org/tiqian/protocol/LayoutTree.js +2 -0
  141. package/dist/org/tiqian/protocol/LayoutVertex.d.ts +4 -0
  142. package/dist/org/tiqian/protocol/LayoutVertex.js +2 -0
  143. package/dist/org/tiqian/protocol/LineBreakSpanInput.d.ts +6 -0
  144. package/dist/org/tiqian/protocol/LineBreakSpanInput.js +12 -0
  145. package/dist/org/tiqian/protocol/MetricEntry.d.ts +11 -0
  146. package/dist/org/tiqian/protocol/MetricEntry.js +21 -0
  147. package/dist/org/tiqian/protocol/NamedError.d.ts +88 -0
  148. package/dist/org/tiqian/protocol/NamedError.js +71 -0
  149. package/dist/org/tiqian/protocol/NamedErrorNames.d.ts +5 -0
  150. package/dist/org/tiqian/protocol/NamedErrorNames.js +53 -0
  151. package/dist/org/tiqian/protocol/ParagraphRequest.d.ts +25 -0
  152. package/dist/org/tiqian/protocol/ParagraphRequest.js +2 -0
  153. package/dist/org/tiqian/protocol/ParagraphRequestChecks.d.ts +8 -0
  154. package/dist/org/tiqian/protocol/ParagraphRequestChecks.js +145 -0
  155. package/dist/org/tiqian/protocol/ParagraphRequestException.d.ts +6 -0
  156. package/dist/org/tiqian/protocol/ParagraphRequestException.js +55 -0
  157. package/dist/org/tiqian/protocol/ParagraphRequestFields.d.ts +3 -0
  158. package/dist/org/tiqian/protocol/ParagraphRequestFields.js +4 -0
  159. package/dist/org/tiqian/protocol/Plan.d.ts +101 -0
  160. package/dist/org/tiqian/protocol/Plan.js +10 -0
  161. package/dist/org/tiqian/protocol/PlanEndReason.d.ts +16 -0
  162. package/dist/org/tiqian/protocol/PlanEndReason.js +17 -0
  163. package/dist/org/tiqian/protocol/PlanJsonNumber.d.ts +43 -0
  164. package/dist/org/tiqian/protocol/PlanJsonNumber.js +362 -0
  165. package/dist/org/tiqian/protocol/PlanSchema.d.ts +4 -0
  166. package/dist/org/tiqian/protocol/PlanSchema.js +5 -0
  167. package/dist/org/tiqian/protocol/PlanStyleDelta.d.ts +5 -0
  168. package/dist/org/tiqian/protocol/PlanStyleDelta.js +2 -0
  169. package/dist/org/tiqian/protocol/Revision.d.ts +11 -0
  170. package/dist/org/tiqian/protocol/Revision.js +12 -0
  171. package/dist/org/tiqian/protocol/SessionFaceSpec.d.ts +5 -0
  172. package/dist/org/tiqian/protocol/SessionFaceSpec.js +2 -0
  173. package/dist/org/tiqian/protocol/SnapshotTableBinary.d.ts +55 -0
  174. package/dist/org/tiqian/protocol/SnapshotTableBinary.js +657 -0
  175. package/dist/org/tiqian/protocol/SnapshotTypography.d.ts +14 -0
  176. package/dist/org/tiqian/protocol/SnapshotTypography.js +2 -0
  177. package/dist/org/tiqian/protocol/StyleRow.d.ts +8 -0
  178. package/dist/org/tiqian/protocol/StyleRow.js +15 -0
  179. package/dist/org/tiqian/protocol/TableData.d.ts +25 -0
  180. package/dist/org/tiqian/protocol/TableData.js +45 -0
  181. package/dist/org/tiqian/protocol/TableInput.d.ts +13 -0
  182. package/dist/org/tiqian/protocol/TableInput.js +21 -0
  183. package/dist/org/tiqian/protocol/TableMetricRow.d.ts +9 -0
  184. package/dist/org/tiqian/protocol/TableMetricRow.js +17 -0
  185. package/dist/org/tiqian/protocol/TableProbe.d.ts +11 -0
  186. package/dist/org/tiqian/protocol/TableProbe.js +21 -0
  187. package/dist/org/tiqian/protocol/TextSpanInput.d.ts +9 -0
  188. package/dist/org/tiqian/protocol/TextSpanInput.js +2 -0
  189. package/dist/org/tiqian/protocol/ValueRow.d.ts +4 -0
  190. package/dist/org/tiqian/protocol/ValueRow.js +7 -0
  191. package/dist/org/tiqian/protocol/WireField.d.ts +5 -0
  192. package/dist/org/tiqian/protocol/WireField.js +2 -0
  193. package/dist/org/tiqian/protocol/WireValue.d.ts +25 -0
  194. package/dist/org/tiqian/protocol/WireValue.js +2 -0
  195. package/dist/org/tiqian/test/TestHelpers.d.ts +5 -0
  196. package/dist/org/tiqian/test/TestHelpers.js +27 -0
  197. package/dist/org/tiqian/test/trace/TestTrace.d.ts +6 -0
  198. package/dist/org/tiqian/test/trace/TestTrace.js +8 -0
  199. package/dist/org/tiqian/test/trace/TestTracePlatform.d.ts +6 -0
  200. package/dist/org/tiqian/test/trace/TestTracePlatform.js +78 -0
  201. package/dist/org/tiqian/test/trace/TestTraceRecorder.d.ts +9 -0
  202. package/dist/org/tiqian/test/trace/TestTraceRecorder.js +36 -0
  203. package/dist/org/tiqian/test/trace/TestTraceRender.d.ts +47 -0
  204. package/dist/org/tiqian/test/trace/TestTraceRender.js +690 -0
  205. package/dist/org/tiqian/test/trace/TestTraceStore.d.ts +18 -0
  206. package/dist/org/tiqian/test/trace/TestTraceStore.js +149 -0
  207. package/dist/org/tiqian/test/trace/TraceAssertionError.d.ts +5 -0
  208. package/dist/org/tiqian/test/trace/TraceAssertionError.js +2 -0
  209. package/dist/org/tiqian/test/trace/TraceAssertionException.d.ts +6 -0
  210. package/dist/org/tiqian/test/trace/TraceAssertionException.js +16 -0
  211. package/dist/org/tiqian/test/trace/TraceField.d.ts +5 -0
  212. package/dist/org/tiqian/test/trace/TraceField.js +10 -0
  213. package/dist/org/tiqian/test/trace/TraceFormat.d.ts +21 -0
  214. package/dist/org/tiqian/test/trace/TraceFormat.js +184 -0
  215. package/dist/org/tiqian/test/trace/TracedAssertions.d.ts +78 -0
  216. package/dist/org/tiqian/test/trace/TracedAssertions.js +749 -0
  217. package/dist/runtime.d.ts +96 -0
  218. package/dist/runtime.js +1612 -0
  219. package/dist/std/FsError.d.ts +48 -0
  220. package/dist/std/FsError.js +2 -0
  221. package/dist/std/FsException.d.ts +6 -0
  222. package/dist/std/FsException.js +45 -0
  223. package/dist/std/UStringException.d.ts +6 -0
  224. package/dist/std/UStringException.js +21 -0
  225. package/dist/std/UStringFault.d.ts +9 -0
  226. package/dist/std/UStringFault.js +2 -0
  227. package/package.json +26 -4
  228. package/README.md +0 -3
@@ -0,0 +1,471 @@
1
+ // Generated by the reflaxe TypeScript target. Do not edit.
2
+ import { Sha256 } from "./../../../haxe/crypto/Sha256.js";
3
+ import { JsCoerce } from "./JsCoerce.js";
4
+ import { BytesBuffer, doubleToI64 } from "../../../runtime.js";
5
+ export class Canonical {
6
+ static digest(data) {
7
+ return Sha256.make(data);
8
+ }
9
+ static encode(input, kind) {
10
+ const writer = new Writer();
11
+ writer.begin(kind);
12
+ const text = Canonical.member(input, "text");
13
+ let textValue = "";
14
+ if (!Canonical.isWireNull(text)) {
15
+ textValue = JsCoerce.toString(text);
16
+ }
17
+ writer.str(textValue);
18
+ if (kind === 0) {
19
+ Canonical.numberField(writer, Canonical.numberMember(input, "maxWidthPx"));
20
+ }
21
+ const semantics = Canonical.encodeSemantics(writer, Canonical.member(input, "semantics"));
22
+ if (semantics !== "") {
23
+ return { kind: "CErr", issue: semantics };
24
+ }
25
+ const spans = Canonical.encodeTextSpans(writer, Canonical.member(input, "textSpans"));
26
+ if (spans !== "") {
27
+ return { kind: "CErr", issue: spans };
28
+ }
29
+ const boxes = Canonical.encodeInlineBoxes(writer, Canonical.member(input, "inlineBoxes"));
30
+ if (boxes !== "") {
31
+ return { kind: "CErr", issue: boxes };
32
+ }
33
+ const boundaries = Canonical.arrOfNullable(Canonical.member(input, "sourceBoundaries"));
34
+ writer.u32(boundaries.length);
35
+ let boundaryIndexIdx = 0;
36
+ while (boundaryIndexIdx < boundaries.length) {
37
+ const boundary = boundaries[boundaryIndexIdx];
38
+ const value = Canonical.canonicalF64(JsCoerce.toNumber(boundary));
39
+ writer.f64(((value === null ? 0.0 : value)));
40
+ boundaryIndexIdx++;
41
+ }
42
+ return { kind: "COk", bytes: writer.finish() };
43
+ }
44
+ static member(input, name) {
45
+ if (Canonical.isWireObj(input)) {
46
+ return Canonical.memberOfFields(Canonical.objFields(input), name);
47
+ }
48
+ return { kind: "WNull" };
49
+ }
50
+ static memberOfFields(fields, name) {
51
+ let fieldIndexIdx = 0;
52
+ while (fieldIndexIdx < fields.length) {
53
+ const field = fields[fieldIndexIdx];
54
+ if (field.name === name) {
55
+ return field.value;
56
+ }
57
+ fieldIndexIdx++;
58
+ }
59
+ return { kind: "WNull" };
60
+ }
61
+ static canonicalF64(value) {
62
+ if (!Number.isFinite(value)) {
63
+ return null;
64
+ }
65
+ return (value === 0.0 ? 0.0 : value);
66
+ }
67
+ static numberMember(input, name) {
68
+ const resolved = Canonical.member(input, name);
69
+ if (resolved.kind === "WNull") {
70
+ return null;
71
+ }
72
+ return Canonical.canonicalF64(JsCoerce.toNumber(resolved));
73
+ }
74
+ static numberField(writer, value) {
75
+ if (value === null) {
76
+ writer.u8(0);
77
+ }
78
+ else {
79
+ writer.u8(1);
80
+ writer.f64((value));
81
+ }
82
+ }
83
+ static listMember(value) {
84
+ if (Canonical.isWireNull(value)) {
85
+ return { kind: "LAbsent" };
86
+ }
87
+ if (Canonical.isWireArr(value)) {
88
+ return { kind: "LArr", items: Canonical.arrOf(value) };
89
+ }
90
+ return { kind: "LBad" };
91
+ }
92
+ static isWireNull(value) {
93
+ switch (value.kind) {
94
+ case "WNull":
95
+ return true;
96
+ case "WBool":
97
+ return false;
98
+ case "WNum":
99
+ return false;
100
+ case "WStr":
101
+ return false;
102
+ case "WArr":
103
+ return false;
104
+ case "WObj":
105
+ return false;
106
+ }
107
+ }
108
+ static isWireArr(value) {
109
+ switch (value.kind) {
110
+ case "WNull":
111
+ return false;
112
+ case "WBool":
113
+ return false;
114
+ case "WNum":
115
+ return false;
116
+ case "WStr":
117
+ return false;
118
+ case "WArr":
119
+ return true;
120
+ case "WObj":
121
+ return false;
122
+ }
123
+ }
124
+ static isWireObj(value) {
125
+ switch (value.kind) {
126
+ case "WNull":
127
+ return false;
128
+ case "WBool":
129
+ return false;
130
+ case "WNum":
131
+ return false;
132
+ case "WStr":
133
+ return false;
134
+ case "WArr":
135
+ return false;
136
+ case "WObj":
137
+ return true;
138
+ }
139
+ }
140
+ static arrOf(value) {
141
+ switch (value.kind) {
142
+ case "WNull":
143
+ return new Array();
144
+ case "WBool":
145
+ return new Array();
146
+ case "WNum":
147
+ return new Array();
148
+ case "WStr":
149
+ return new Array();
150
+ case "WArr":
151
+ {
152
+ return value.items;
153
+ }
154
+ case "WObj":
155
+ return new Array();
156
+ }
157
+ }
158
+ static arrOfNullable(value) {
159
+ switch (value.kind) {
160
+ case "WNull":
161
+ return new Array();
162
+ case "WBool":
163
+ return new Array();
164
+ case "WNum":
165
+ return new Array();
166
+ case "WStr":
167
+ return new Array();
168
+ case "WArr":
169
+ {
170
+ return value.items;
171
+ }
172
+ case "WObj":
173
+ return new Array();
174
+ }
175
+ }
176
+ static objFields(value) {
177
+ switch (value.kind) {
178
+ case "WNull":
179
+ return new Array();
180
+ case "WBool":
181
+ return new Array();
182
+ case "WNum":
183
+ return new Array();
184
+ case "WStr":
185
+ return new Array();
186
+ case "WArr":
187
+ return new Array();
188
+ case "WObj":
189
+ {
190
+ return value.fields;
191
+ }
192
+ }
193
+ }
194
+ static isBadShape(shape) {
195
+ switch (shape.kind) {
196
+ case "LAbsent":
197
+ return false;
198
+ case "LArr":
199
+ return false;
200
+ case "LBad":
201
+ return true;
202
+ }
203
+ }
204
+ static shapeItems(shape) {
205
+ switch (shape.kind) {
206
+ case "LAbsent":
207
+ return new Array();
208
+ case "LArr":
209
+ {
210
+ return shape.items;
211
+ }
212
+ case "LBad":
213
+ return new Array();
214
+ }
215
+ }
216
+ static encodeSemantics(writer, value) {
217
+ const shape = Canonical.listMember(value);
218
+ if (Canonical.isBadShape(shape)) {
219
+ return "InvalidSnapshotSemantics";
220
+ }
221
+ const items = Canonical.shapeItems(shape);
222
+ writer.u32(items.length);
223
+ let spanIndexIdx = 0;
224
+ while (spanIndexIdx < items.length) {
225
+ const span = items[spanIndexIdx];
226
+ const attributes = Canonical.member(span, "attributes");
227
+ const order = Canonical.numberMember(span, "order");
228
+ const tagName = Canonical.member(span, "tagName");
229
+ let flags = 0;
230
+ if (attributes.kind !== "WNull") {
231
+ flags |= 1;
232
+ }
233
+ if (order !== null) {
234
+ flags |= 2;
235
+ }
236
+ if (tagName.kind !== "WNull") {
237
+ flags |= 4;
238
+ }
239
+ writer.u8(flags);
240
+ Canonical.numberField(writer, Canonical.numberMember(span, "start"));
241
+ Canonical.numberField(writer, Canonical.numberMember(span, "end"));
242
+ if (tagName.kind !== "WNull") {
243
+ writer.str(JsCoerce.toString(tagName));
244
+ }
245
+ if (order !== null) {
246
+ writer.f64((order));
247
+ }
248
+ if (attributes.kind !== "WNull") {
249
+ Canonical.encodeAttributes(writer, attributes);
250
+ }
251
+ spanIndexIdx++;
252
+ }
253
+ return "";
254
+ }
255
+ static encodeTextSpans(writer, value) {
256
+ const shape = Canonical.listMember(value);
257
+ if (Canonical.isBadShape(shape)) {
258
+ return "InvalidSnapshotTextSpans";
259
+ }
260
+ const items = Canonical.shapeItems(shape);
261
+ writer.u32(items.length);
262
+ let spanIndexIdx = 0;
263
+ while (spanIndexIdx < items.length) {
264
+ const span = items[spanIndexIdx];
265
+ const hasFamilies = Canonical.familiesPresent(span);
266
+ const families = Canonical.familiesOf(span);
267
+ const fontSizePx = Canonical.numberMember(span, "fontSizePx");
268
+ const fontWeight = Canonical.numberMember(span, "fontWeight");
269
+ const hasItalic = Canonical.italicPresent(span);
270
+ const italicValue = Canonical.italicValueOf(span);
271
+ const baselineShiftPx = Canonical.numberMember(span, "baselineShiftPx");
272
+ let flags = 0;
273
+ if (hasFamilies) {
274
+ flags |= 1;
275
+ }
276
+ if (fontSizePx !== null) {
277
+ flags |= 2;
278
+ }
279
+ if (fontWeight !== null) {
280
+ flags |= 4;
281
+ }
282
+ if (hasItalic) {
283
+ flags |= 8;
284
+ }
285
+ if (baselineShiftPx !== null) {
286
+ flags |= 16;
287
+ }
288
+ writer.u8(flags);
289
+ Canonical.numberField(writer, Canonical.numberMember(span, "start"));
290
+ Canonical.numberField(writer, Canonical.numberMember(span, "end"));
291
+ if (hasFamilies) {
292
+ writer.u32(families.length);
293
+ let nameIndexIdx = 0;
294
+ while (nameIndexIdx < families.length) {
295
+ writer.str(families[nameIndexIdx]);
296
+ nameIndexIdx++;
297
+ }
298
+ }
299
+ if (fontSizePx !== null) {
300
+ writer.f64((fontSizePx));
301
+ }
302
+ if (fontWeight !== null) {
303
+ writer.f64((fontWeight));
304
+ }
305
+ if (hasItalic) {
306
+ writer.u8((italicValue ? 1 : 0));
307
+ }
308
+ if (baselineShiftPx !== null) {
309
+ writer.f64((baselineShiftPx));
310
+ }
311
+ spanIndexIdx++;
312
+ }
313
+ return "";
314
+ }
315
+ static encodeInlineBoxes(writer, value) {
316
+ const shape = Canonical.listMember(value);
317
+ if (Canonical.isBadShape(shape)) {
318
+ return "InvalidSnapshotInlineBoxes";
319
+ }
320
+ const items = Canonical.shapeItems(shape);
321
+ writer.u32(items.length);
322
+ let itemIndexIdx = 0;
323
+ while (itemIndexIdx < items.length) {
324
+ const item = items[itemIndexIdx];
325
+ const inlineStartPx = Canonical.numberMember(item, "inlineStartPx");
326
+ const inlineEndPx = Canonical.numberMember(item, "inlineEndPx");
327
+ const outerSpacing = Canonical.member(item, "outerSpacing");
328
+ let flags = 0;
329
+ if (inlineStartPx !== null) {
330
+ flags |= 1;
331
+ }
332
+ if (inlineEndPx !== null) {
333
+ flags |= 2;
334
+ }
335
+ if (outerSpacing.kind !== "WNull") {
336
+ flags |= 4;
337
+ }
338
+ writer.u8(flags);
339
+ Canonical.numberField(writer, Canonical.numberMember(item, "start"));
340
+ Canonical.numberField(writer, Canonical.numberMember(item, "end"));
341
+ if (inlineStartPx !== null) {
342
+ writer.f64((inlineStartPx));
343
+ }
344
+ if (inlineEndPx !== null) {
345
+ writer.f64((inlineEndPx));
346
+ }
347
+ if (outerSpacing.kind !== "WNull") {
348
+ writer.str(JsCoerce.toString(outerSpacing));
349
+ }
350
+ itemIndexIdx++;
351
+ }
352
+ return "";
353
+ }
354
+ static familiesPresent(span) {
355
+ return Canonical.isWireArr(Canonical.member(span, "fontFamilies"));
356
+ }
357
+ static familiesOf(span) {
358
+ return Canonical.familiesFromList(Canonical.arrOf(Canonical.member(span, "fontFamilies")));
359
+ }
360
+ static familiesFromList(list) {
361
+ const names = new Array();
362
+ let itemIndexIdx = 0;
363
+ while (itemIndexIdx < list.length) {
364
+ names.push(JsCoerce.toString(list[itemIndexIdx]));
365
+ itemIndexIdx++;
366
+ }
367
+ return names;
368
+ }
369
+ static italicPresent(span) {
370
+ return Canonical.isWireBool(Canonical.member(span, "italic"));
371
+ }
372
+ static italicValueOf(span) {
373
+ return Canonical.boolOf(Canonical.member(span, "italic"));
374
+ }
375
+ static isWireBool(value) {
376
+ switch (value.kind) {
377
+ case "WNull":
378
+ return false;
379
+ case "WBool":
380
+ return true;
381
+ case "WNum":
382
+ return false;
383
+ case "WStr":
384
+ return false;
385
+ case "WArr":
386
+ return false;
387
+ case "WObj":
388
+ return false;
389
+ }
390
+ }
391
+ static boolOf(value) {
392
+ switch (value.kind) {
393
+ case "WNull":
394
+ return false;
395
+ case "WBool":
396
+ {
397
+ return value.value;
398
+ }
399
+ case "WNum":
400
+ return false;
401
+ case "WStr":
402
+ return false;
403
+ case "WArr":
404
+ return false;
405
+ case "WObj":
406
+ return false;
407
+ }
408
+ }
409
+ static encodeAttributes(writer, value) {
410
+ if (Canonical.isWireObj(value)) {
411
+ Canonical.encodeObjectAttributes(writer, Canonical.objFields(value));
412
+ return;
413
+ }
414
+ if (Canonical.isWireArr(value)) {
415
+ writer.u8(2);
416
+ writer.str(JsCoerce.renderJson(value));
417
+ return;
418
+ }
419
+ writer.u8(0);
420
+ }
421
+ static encodeObjectAttributes(writer, fields) {
422
+ writer.u8(1);
423
+ writer.u32(fields.length);
424
+ let fieldIndexIdx = 0;
425
+ while (fieldIndexIdx < fields.length) {
426
+ const field = fields[fieldIndexIdx];
427
+ writer.str(field.name);
428
+ writer.str(JsCoerce.toString(field.value));
429
+ fieldIndexIdx++;
430
+ }
431
+ }
432
+ }
433
+ export class Writer {
434
+ buf;
435
+ constructor() {
436
+ this.buf = new BytesBuffer();
437
+ }
438
+ begin(kind) {
439
+ this.writeMagic();
440
+ this.u8(1);
441
+ this.u8(kind);
442
+ }
443
+ writeMagic() {
444
+ this.buf.add(new TextEncoder().encode("TQCS"));
445
+ }
446
+ u8(value) {
447
+ this.buf.addByte(value & 255);
448
+ }
449
+ u32(value) {
450
+ this.emitBits(value);
451
+ }
452
+ f64(value) {
453
+ const bits = doubleToI64(value);
454
+ this.emitBits(bits.low);
455
+ this.emitBits(bits.high);
456
+ }
457
+ emitBits(value) {
458
+ this.buf.addByte(value & 255);
459
+ this.buf.addByte((value >>> 8) & 255);
460
+ this.buf.addByte((value >>> 16) & 255);
461
+ this.buf.addByte((value >>> 24) & 255);
462
+ }
463
+ str(value) {
464
+ const encoded = new TextEncoder().encode(value);
465
+ this.u32(encoded.length);
466
+ this.buf.add(encoded);
467
+ }
468
+ finish() {
469
+ return this.buf.getBytes();
470
+ }
471
+ }
@@ -0,0 +1,6 @@
1
+ export interface DecorationInput {
2
+ start: number;
3
+ end: number;
4
+ kind: string;
5
+ }
6
+ export declare function compareDecorationInput(a: DecorationInput, b: DecorationInput): number;
@@ -0,0 +1,12 @@
1
+ // Generated by the reflaxe TypeScript target. Do not edit.
2
+ export function compareDecorationInput(a, b) {
3
+ if (a === b)
4
+ return 0;
5
+ if (a.start !== b.start)
6
+ return a.start - b.start;
7
+ if (a.end !== b.end)
8
+ return a.end - b.end;
9
+ if (a.kind !== b.kind)
10
+ return a.kind < b.kind ? -1 : 1;
11
+ return 0;
12
+ }
@@ -0,0 +1,9 @@
1
+ export interface COk {
2
+ readonly kind: "COk";
3
+ readonly bytes: Uint8Array;
4
+ }
5
+ export interface CErr {
6
+ readonly kind: "CErr";
7
+ readonly issue: string;
8
+ }
9
+ export type EncodeResult = COk | CErr;
@@ -0,0 +1,2 @@
1
+ // Generated by the reflaxe TypeScript target. Do not edit.
2
+ export {};
@@ -0,0 +1,13 @@
1
+ export interface FaceInfo {
2
+ family: string;
3
+ style: string;
4
+ weight: number[];
5
+ unicodeRange: string;
6
+ publicUrl: string;
7
+ sourceSha256: string;
8
+ sfntSha256: string;
9
+ faceIndex: number;
10
+ sourceOrder: number;
11
+ axisTags: string[];
12
+ localNames: string[];
13
+ }
@@ -0,0 +1,2 @@
1
+ // Generated by the reflaxe TypeScript target. Do not edit.
2
+ export {};
@@ -0,0 +1,25 @@
1
+ import { type SnapshotTypography } from "./SnapshotTypography.js";
2
+ import { type WireValue } from "./WireValue.js";
3
+ export declare class FontContract {
4
+ static requiredCjkDashContractInput(key: WireValue, text: WireValue, textSpans: WireValue, typography: SnapshotTypography): WireValue | null;
5
+ private static matchedSpanAt;
6
+ private static resolvedStyleAt;
7
+ private static dashStyleToJson;
8
+ private static mapStrings;
9
+ private static isWireNull;
10
+ private static isWireArr;
11
+ private static arrOf;
12
+ private static objFields;
13
+ private static isRawNumber;
14
+ private static rawNumber;
15
+ private static coerceNumberOr;
16
+ private static italicOr;
17
+ private static isSafeInteger;
18
+ }
19
+ export interface DashStyle {
20
+ fontFamilies: string[];
21
+ fontSizePx: number;
22
+ fontWeight: number;
23
+ italic: WireValue;
24
+ baselineShiftPx: number;
25
+ }