@meritt/gsx-wasm 0.0.0-stage → 0.1.0

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/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2026 Alexey Simonenko, alexey@simonenko.dev, https://simonenko.xyz
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,470 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://github.com/meritt/gsx.rs/schema/gsx-1.schema.json",
4
+ "title": "gsx/1 wire result",
5
+ "description": "Wire format of gsx-core::wire: a parse result, a serialize result (the canonical gsx/1 source), a projection result or the target listing. Document offsets are UTF-16 code units of the normalized input; a range is [start, end).",
6
+ "oneOf": [
7
+ {
8
+ "type": "object",
9
+ "properties": { "document": { "$ref": "#/$defs/document" } },
10
+ "required": ["document"],
11
+ "additionalProperties": false
12
+ },
13
+ {
14
+ "type": "object",
15
+ "properties": { "serialized": { "type": "string" } },
16
+ "required": ["serialized"],
17
+ "additionalProperties": false
18
+ },
19
+ {
20
+ "type": "object",
21
+ "properties": { "projection": { "$ref": "#/$defs/projection" } },
22
+ "required": ["projection"],
23
+ "additionalProperties": false
24
+ },
25
+ {
26
+ "type": "object",
27
+ "properties": { "targets": { "type": "array", "items": { "$ref": "#/$defs/target" } } },
28
+ "required": ["targets"],
29
+ "additionalProperties": false
30
+ },
31
+ {
32
+ "type": "object",
33
+ "properties": { "error": { "$ref": "#/$defs/error" } },
34
+ "required": ["error"],
35
+ "additionalProperties": false
36
+ }
37
+ ],
38
+ "$defs": {
39
+ "offset": { "type": "integer", "minimum": 0, "maximum": 4294967295 },
40
+ "range": {
41
+ "type": "array",
42
+ "prefixItems": [{ "$ref": "#/$defs/offset" }, { "$ref": "#/$defs/offset" }],
43
+ "minItems": 2,
44
+ "maxItems": 2
45
+ },
46
+ "nullableString": { "type": ["string", "null"] },
47
+ "count": { "type": "integer", "minimum": 0 },
48
+ "projection": {
49
+ "type": "object",
50
+ "properties": {
51
+ "fields": { "type": "array", "items": { "$ref": "#/$defs/field" } },
52
+ "measurements": { "type": "array", "items": { "$ref": "#/$defs/measurement" } },
53
+ "changes": { "type": "array", "items": { "$ref": "#/$defs/change" } },
54
+ "media": { "type": "array", "items": { "type": "string" } },
55
+ "blocks": {
56
+ "description": "Present for targets of the blocks/1 form only: text and media laid out in order.",
57
+ "type": "array",
58
+ "items": { "$ref": "#/$defs/block" }
59
+ }
60
+ },
61
+ "required": ["fields", "measurements", "changes", "media"],
62
+ "additionalProperties": false
63
+ },
64
+ "block": {
65
+ "oneOf": [
66
+ {
67
+ "type": "object",
68
+ "properties": { "text": { "type": "string" } },
69
+ "required": ["text"],
70
+ "additionalProperties": false
71
+ },
72
+ {
73
+ "type": "object",
74
+ "properties": {
75
+ "items": {
76
+ "type": "array",
77
+ "items": {
78
+ "type": "object",
79
+ "properties": {
80
+ "reference": { "type": "string" },
81
+ "alt": { "$ref": "#/$defs/nullableString" },
82
+ "spoiler": { "type": "boolean" }
83
+ },
84
+ "required": ["reference", "alt", "spoiler"],
85
+ "additionalProperties": false
86
+ }
87
+ },
88
+ "layout": { "enum": ["collage", "slideshow", null] }
89
+ },
90
+ "required": ["items", "layout"],
91
+ "additionalProperties": false
92
+ }
93
+ ]
94
+ },
95
+ "fieldName": { "enum": ["text", "title", "description", "alt"] },
96
+ "field": {
97
+ "type": "object",
98
+ "properties": {
99
+ "name": { "$ref": "#/$defs/fieldName" },
100
+ "text": { "type": "string" },
101
+ "links": {
102
+ "description": "UTF-16 ranges of links in the field text.",
103
+ "type": "array",
104
+ "items": { "$ref": "#/$defs/range" }
105
+ },
106
+ "entities": { "type": "array", "items": { "$ref": "#/$defs/entity" } }
107
+ },
108
+ "required": ["name", "text", "links", "entities"],
109
+ "additionalProperties": false
110
+ },
111
+ "entity": {
112
+ "type": "object",
113
+ "properties": {
114
+ "style": { "enum": ["bold", "italic", "underline", "strikethrough", "spoiler", "code", "link", "tag"] },
115
+ "range": {
116
+ "description": "Range in the field text, in the target's offsets unit (see the target listing).",
117
+ "$ref": "#/$defs/range"
118
+ },
119
+ "value": { "$ref": "#/$defs/nullableString" }
120
+ },
121
+ "required": ["style", "range", "value"],
122
+ "additionalProperties": false
123
+ },
124
+ "unit": {
125
+ "enum": [
126
+ "graphemes",
127
+ "code-points",
128
+ "utf16-code-units",
129
+ "utf8-bytes",
130
+ "x-weighted",
131
+ "mastodon-weighted",
132
+ "threads-weighted"
133
+ ]
134
+ },
135
+ "measurement": {
136
+ "type": "object",
137
+ "properties": {
138
+ "field": { "$ref": "#/$defs/fieldName" },
139
+ "unit": { "$ref": "#/$defs/unit" },
140
+ "value": { "$ref": "#/$defs/count" },
141
+ "maximum": { "oneOf": [{ "$ref": "#/$defs/count" }, { "type": "null" }] },
142
+ "block": { "description": "Index of the measured block, with item.", "$ref": "#/$defs/count" },
143
+ "item": { "description": "Index of the measured media item in the block.", "$ref": "#/$defs/count" }
144
+ },
145
+ "required": ["field", "unit", "value", "maximum"],
146
+ "dependentRequired": { "block": ["item"], "item": ["block"] },
147
+ "additionalProperties": false
148
+ },
149
+ "change": {
150
+ "type": "object",
151
+ "properties": {
152
+ "class": { "enum": ["approximated", "textual_fallback", "unwrapped", "omitted", "blocked"] },
153
+ "feature": {
154
+ "enum": [
155
+ "heading",
156
+ "thematic_break",
157
+ "blockquote",
158
+ "bullet_list",
159
+ "ordered_list",
160
+ "compound_list",
161
+ "code_block",
162
+ "table",
163
+ "task_list",
164
+ "media",
165
+ "emphasis",
166
+ "strong",
167
+ "strikethrough",
168
+ "underline",
169
+ "highlight",
170
+ "spoiler",
171
+ "inline_code",
172
+ "link",
173
+ "link_title",
174
+ "datetime",
175
+ "angle_brackets",
176
+ "text",
177
+ "title"
178
+ ]
179
+ },
180
+ "reason": { "type": "string", "pattern": "^[a-z0-9_]+$" },
181
+ "code": {
182
+ "description": "The reason in upper case when the class is blocked, else null.",
183
+ "oneOf": [{ "type": "string", "pattern": "^[A-Z0-9_]+$" }, { "type": "null" }]
184
+ },
185
+ "field": { "$ref": "#/$defs/fieldName" },
186
+ "range": { "oneOf": [{ "$ref": "#/$defs/range" }, { "type": "null" }] },
187
+ "truncated": {
188
+ "oneOf": [
189
+ {
190
+ "type": "object",
191
+ "properties": {
192
+ "unit": { "$ref": "#/$defs/unit" },
193
+ "maximum": { "$ref": "#/$defs/count" },
194
+ "value": { "$ref": "#/$defs/count" },
195
+ "exact": { "type": "boolean" }
196
+ },
197
+ "required": ["unit", "maximum", "value", "exact"],
198
+ "additionalProperties": false
199
+ },
200
+ { "type": "null" }
201
+ ]
202
+ }
203
+ },
204
+ "required": ["class", "feature", "reason", "code", "field", "range", "truncated"],
205
+ "additionalProperties": false
206
+ },
207
+ "target": {
208
+ "type": "object",
209
+ "properties": {
210
+ "name": { "type": "string" },
211
+ "form": { "enum": ["plain/1", "entities/1", "html/1", "markdown/1", "blocks/1"] },
212
+ "offsets": { "enum": ["utf8", "utf16", null] },
213
+ "digest": { "type": "string", "pattern": "^[0-9a-f]{16}$" },
214
+ "manifest": { "type": "string" }
215
+ },
216
+ "required": ["name", "form", "offsets", "digest", "manifest"],
217
+ "additionalProperties": false
218
+ },
219
+ "document": {
220
+ "type": "object",
221
+ "properties": {
222
+ "children": { "type": "array", "items": { "$ref": "#/$defs/node" } },
223
+ "markers": { "type": "array", "items": { "$ref": "#/$defs/marker" } },
224
+ "diagnostics": { "type": "array", "items": { "$ref": "#/$defs/diagnostic" } }
225
+ },
226
+ "required": ["children", "markers", "diagnostics"],
227
+ "additionalProperties": false
228
+ },
229
+ "error": {
230
+ "type": "object",
231
+ "properties": {
232
+ "code": { "$ref": "#/$defs/diagnosticCode" },
233
+ "range": { "oneOf": [{ "$ref": "#/$defs/range" }, { "type": "null" }] },
234
+ "details": { "$ref": "#/$defs/details" }
235
+ },
236
+ "required": ["code", "range", "details"],
237
+ "additionalProperties": false
238
+ },
239
+ "diagnostic": {
240
+ "type": "object",
241
+ "properties": {
242
+ "code": { "$ref": "#/$defs/diagnosticCode" },
243
+ "severity": { "enum": ["warning", "error"] },
244
+ "range": { "$ref": "#/$defs/range" },
245
+ "details": { "$ref": "#/$defs/details" }
246
+ },
247
+ "required": ["code", "severity", "range", "details"],
248
+ "additionalProperties": false
249
+ },
250
+ "diagnosticCode": {
251
+ "enum": [
252
+ "DATETIME_INVALID",
253
+ "DATETIME_TIMEZONE_REQUIRED",
254
+ "LINK_LITERALIZED",
255
+ "MARKDOWN_INVALID_TEXT",
256
+ "MARKDOWN_MALFORMED",
257
+ "MARKDOWN_TOO_COMPLEX",
258
+ "MEDIA_DIRECTIVE_INVALID",
259
+ "MEDIA_REFERENCE_CONTEXT_UNSUPPORTED",
260
+ "MEDIA_REFERENCE_COVER",
261
+ "MEDIA_REFERENCE_DUPLICATE",
262
+ "MEDIA_REFERENCE_UNKNOWN"
263
+ ]
264
+ },
265
+ "details": {
266
+ "oneOf": [
267
+ { "type": "object", "additionalProperties": false, "maxProperties": 0 },
268
+ {
269
+ "type": "object",
270
+ "properties": { "scheme": { "enum": ["http", "https", "relative", "unsupported"] } },
271
+ "required": ["scheme"],
272
+ "additionalProperties": false
273
+ },
274
+ {
275
+ "type": "object",
276
+ "properties": { "id": { "type": "string" }, "index": { "$ref": "#/$defs/offset" } },
277
+ "required": ["id"],
278
+ "additionalProperties": false
279
+ },
280
+ {
281
+ "type": "object",
282
+ "properties": {
283
+ "limit": {
284
+ "enum": [
285
+ "blockDelimiters",
286
+ "blockLabels",
287
+ "blockLabelEnds",
288
+ "containerDepth",
289
+ "documentEscapes",
290
+ "documentHardBreaks",
291
+ "documentLines",
292
+ "documentListItems",
293
+ "documentMathLiterals",
294
+ "documentPairedDelimiters",
295
+ "documentTableCells"
296
+ ]
297
+ },
298
+ "maximum": { "type": "integer", "minimum": 1 }
299
+ },
300
+ "required": ["limit", "maximum"],
301
+ "additionalProperties": false
302
+ },
303
+ {
304
+ "type": "object",
305
+ "properties": { "codePoint": { "type": "integer", "minimum": 0, "maximum": 1114111 } },
306
+ "required": ["codePoint"],
307
+ "additionalProperties": false
308
+ }
309
+ ]
310
+ },
311
+ "marker": {
312
+ "type": "object",
313
+ "properties": {
314
+ "kind": {
315
+ "enum": [
316
+ "emphasis",
317
+ "strong",
318
+ "strikethrough",
319
+ "spoiler",
320
+ "underline",
321
+ "highlight",
322
+ "codeText",
323
+ "codeFence",
324
+ "heading",
325
+ "thematicBreak",
326
+ "blockQuote",
327
+ "listItem",
328
+ "taskCheck",
329
+ "tableDelimiter",
330
+ "link",
331
+ "autolink",
332
+ "escape",
333
+ "characterReference",
334
+ "hardBreak",
335
+ "directive",
336
+ "media"
337
+ ]
338
+ },
339
+ "range": { "$ref": "#/$defs/range" }
340
+ },
341
+ "required": ["kind", "range"],
342
+ "additionalProperties": false
343
+ },
344
+ "node": {
345
+ "type": "object",
346
+ "properties": {
347
+ "range": { "$ref": "#/$defs/range" },
348
+ "provenance": { "const": "literal" },
349
+ "gapBefore": { "$ref": "#/$defs/offset" },
350
+ "children": { "type": "array", "items": { "$ref": "#/$defs/node" }, "minItems": 1 }
351
+ },
352
+ "required": ["type", "range"],
353
+ "oneOf": [
354
+ { "$ref": "#/$defs/bareNode" },
355
+ { "$ref": "#/$defs/headingNode" },
356
+ { "$ref": "#/$defs/listNode" },
357
+ { "$ref": "#/$defs/listItemNode" },
358
+ { "$ref": "#/$defs/codeNode" },
359
+ { "$ref": "#/$defs/tableNode" },
360
+ { "$ref": "#/$defs/valueNode" },
361
+ { "$ref": "#/$defs/linkNode" },
362
+ { "$ref": "#/$defs/datetimeNode" },
363
+ { "$ref": "#/$defs/mediaReferenceNode" },
364
+ { "$ref": "#/$defs/mediaGroupNode" }
365
+ ],
366
+ "unevaluatedProperties": false
367
+ },
368
+ "bareNode": {
369
+ "type": "object",
370
+ "properties": {
371
+ "type": {
372
+ "enum": [
373
+ "paragraph",
374
+ "thematicBreak",
375
+ "blockquote",
376
+ "tableRow",
377
+ "tableCell",
378
+ "emphasis",
379
+ "strong",
380
+ "delete",
381
+ "underline",
382
+ "highlight",
383
+ "spoiler",
384
+ "break"
385
+ ]
386
+ }
387
+ }
388
+ },
389
+ "headingNode": {
390
+ "type": "object",
391
+ "properties": { "type": { "const": "heading" }, "depth": { "type": "integer", "minimum": 1, "maximum": 6 } },
392
+ "required": ["depth"]
393
+ },
394
+ "listNode": {
395
+ "type": "object",
396
+ "properties": {
397
+ "type": { "const": "list" },
398
+ "ordered": { "type": "boolean" },
399
+ "start": { "oneOf": [{ "$ref": "#/$defs/offset" }, { "type": "null" }] },
400
+ "spread": { "type": "boolean" }
401
+ },
402
+ "required": ["ordered", "start", "spread"]
403
+ },
404
+ "listItemNode": {
405
+ "type": "object",
406
+ "properties": {
407
+ "type": { "const": "listItem" },
408
+ "spread": { "type": "boolean" },
409
+ "checked": { "type": ["boolean", "null"] }
410
+ },
411
+ "required": ["spread", "checked"]
412
+ },
413
+ "codeNode": {
414
+ "type": "object",
415
+ "properties": {
416
+ "type": { "const": "code" },
417
+ "lang": { "$ref": "#/$defs/nullableString" },
418
+ "meta": { "$ref": "#/$defs/nullableString" },
419
+ "value": { "type": "string" }
420
+ },
421
+ "required": ["lang", "meta", "value"]
422
+ },
423
+ "tableNode": {
424
+ "type": "object",
425
+ "properties": {
426
+ "type": { "const": "table" },
427
+ "align": { "type": "array", "items": { "enum": ["left", "right", "center", null] } }
428
+ },
429
+ "required": ["align"]
430
+ },
431
+ "valueNode": {
432
+ "type": "object",
433
+ "properties": { "type": { "enum": ["text", "inlineCode"] }, "value": { "type": "string" } },
434
+ "required": ["value"]
435
+ },
436
+ "linkNode": {
437
+ "type": "object",
438
+ "properties": {
439
+ "type": { "const": "link" },
440
+ "url": { "type": "string" },
441
+ "source": { "type": "string" },
442
+ "title": { "$ref": "#/$defs/nullableString" }
443
+ },
444
+ "required": ["url", "source", "title"]
445
+ },
446
+ "datetimeNode": {
447
+ "type": "object",
448
+ "properties": {
449
+ "type": { "const": "datetime" },
450
+ "datetime": { "$ref": "#/$defs/nullableString" },
451
+ "unix": { "type": "integer" }
452
+ },
453
+ "required": ["datetime", "unix"]
454
+ },
455
+ "mediaReferenceNode": {
456
+ "type": "object",
457
+ "properties": { "type": { "const": "mediaReference" }, "mediaId": { "type": "string" } },
458
+ "required": ["mediaId"]
459
+ },
460
+ "mediaGroupNode": {
461
+ "type": "object",
462
+ "properties": {
463
+ "type": { "const": "mediaGroup" },
464
+ "mediaIds": { "type": "array", "items": { "type": "string" } },
465
+ "layout": { "enum": ["collage", "slideshow"] }
466
+ },
467
+ "required": ["mediaIds", "layout"]
468
+ }
469
+ }
470
+ }