@algomotion/spec 0.0.0-stage → 1.0.0-alpha.1
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 +675 -0
- package/dist/.tsbuildinfo +1 -0
- package/dist/common.d.ts +136 -0
- package/dist/common.d.ts.map +1 -0
- package/dist/common.js +181 -0
- package/dist/common.js.map +1 -0
- package/dist/errors.d.ts +71 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +43 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/json-schema.d.ts +3 -0
- package/dist/json-schema.d.ts.map +1 -0
- package/dist/json-schema.js +16 -0
- package/dist/json-schema.js.map +1 -0
- package/dist/kinds/array.d.ts +171 -0
- package/dist/kinds/array.d.ts.map +1 -0
- package/dist/kinds/array.js +179 -0
- package/dist/kinds/array.js.map +1 -0
- package/dist/kinds/btree.d.ts +190 -0
- package/dist/kinds/btree.d.ts.map +1 -0
- package/dist/kinds/btree.js +274 -0
- package/dist/kinds/btree.js.map +1 -0
- package/dist/kinds/graph.d.ts +227 -0
- package/dist/kinds/graph.d.ts.map +1 -0
- package/dist/kinds/graph.js +229 -0
- package/dist/kinds/graph.js.map +1 -0
- package/dist/kinds/hash-table.d.ts +108 -0
- package/dist/kinds/hash-table.d.ts.map +1 -0
- package/dist/kinds/hash-table.js +133 -0
- package/dist/kinds/hash-table.js.map +1 -0
- package/dist/kinds/index.d.ts +98 -0
- package/dist/kinds/index.d.ts.map +1 -0
- package/dist/kinds/index.js +53 -0
- package/dist/kinds/index.js.map +1 -0
- package/dist/kinds/kind.d.ts +73 -0
- package/dist/kinds/kind.d.ts.map +1 -0
- package/dist/kinds/kind.js +4 -0
- package/dist/kinds/kind.js.map +1 -0
- package/dist/kinds/linear.d.ts +24 -0
- package/dist/kinds/linear.d.ts.map +1 -0
- package/dist/kinds/linear.js +26 -0
- package/dist/kinds/linear.js.map +1 -0
- package/dist/kinds/linked-list.d.ts +132 -0
- package/dist/kinds/linked-list.d.ts.map +1 -0
- package/dist/kinds/linked-list.js +95 -0
- package/dist/kinds/linked-list.js.map +1 -0
- package/dist/kinds/plane.d.ts +190 -0
- package/dist/kinds/plane.d.ts.map +1 -0
- package/dist/kinds/plane.js +206 -0
- package/dist/kinds/plane.js.map +1 -0
- package/dist/kinds/priority-queue.d.ts +120 -0
- package/dist/kinds/priority-queue.d.ts.map +1 -0
- package/dist/kinds/priority-queue.js +108 -0
- package/dist/kinds/priority-queue.js.map +1 -0
- package/dist/kinds/queue.d.ts +94 -0
- package/dist/kinds/queue.d.ts.map +1 -0
- package/dist/kinds/queue.js +59 -0
- package/dist/kinds/queue.js.map +1 -0
- package/dist/kinds/stack.d.ts +70 -0
- package/dist/kinds/stack.d.ts.map +1 -0
- package/dist/kinds/stack.js +50 -0
- package/dist/kinds/stack.js.map +1 -0
- package/dist/kinds/table.d.ts +65 -0
- package/dist/kinds/table.d.ts.map +1 -0
- package/dist/kinds/table.js +116 -0
- package/dist/kinds/table.js.map +1 -0
- package/dist/kinds/tree.d.ts +272 -0
- package/dist/kinds/tree.d.ts.map +1 -0
- package/dist/kinds/tree.js +380 -0
- package/dist/kinds/tree.js.map +1 -0
- package/dist/parse.d.ts +26 -0
- package/dist/parse.d.ts.map +1 -0
- package/dist/parse.js +380 -0
- package/dist/parse.js.map +1 -0
- package/dist/result.d.ts +16 -0
- package/dist/result.d.ts.map +1 -0
- package/dist/result.js +3 -0
- package/dist/result.js.map +1 -0
- package/dist/share.d.ts +68 -0
- package/dist/share.d.ts.map +1 -0
- package/dist/share.js +319 -0
- package/dist/share.js.map +1 -0
- package/dist/version.d.ts +108 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +167 -0
- package/dist/version.js.map +1 -0
- package/dist/visualization.d.ts +3591 -0
- package/dist/visualization.d.ts.map +1 -0
- package/dist/visualization.js +131 -0
- package/dist/visualization.js.map +1 -0
- package/package.json +45 -4
- package/schema/visualization.schema.json +5717 -0
- package/README.md +0 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"visualization.d.ts","sourceRoot":"","sources":["../src/visualization.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAoFxB,wEAAwE;AACxE,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8BAYzB,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAE5D,wEAAwE;AACxE,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAK9B,CAAC;AACF,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAEpE;;;;GAIG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAGpB,CAAC"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Top-level document schemas.
|
|
3
|
+
*
|
|
4
|
+
* Two forms exist (ADR 0007):
|
|
5
|
+
* - `VisualizationInput` is what people and LLMs write; it allows shorthands.
|
|
6
|
+
* - `Visualization` is the canonical form that `parseVisualization` returns
|
|
7
|
+
* and that renderers consume.
|
|
8
|
+
*/
|
|
9
|
+
import { z } from 'zod';
|
|
10
|
+
import { AnchoredSource, LIMITS, Section, Source, StepMeta, StructureName, } from "./common.js";
|
|
11
|
+
import { ArrayAction, ArrayActionInput, ArrayDecl, ArrayDeclInput, LinkedListAction, LinkedListActionInput, LinkedListDecl, LinkedListDeclInput, QueueAction, QueueActionInput, QueueDecl, QueueDeclInput, StackAction, StackActionInput, StackDecl, StackDeclInput, TreeAction, TreeActionInput, TreeDecl, TreeDeclInput, GraphAction, GraphActionInput, GraphDecl, GraphDeclInput, HashTableAction, HashTableActionInput, HashTableDecl, HashTableDeclInput, PriorityQueueAction, PriorityQueueActionInput, PriorityQueueDecl, PriorityQueueDeclInput, BTreeAction, BTreeActionInput, BTreeDecl, BTreeDeclInput, PlaneAction, PlaneActionInput, PlaneDecl, PlaneDeclInput, TableAction, TableDecl, TableDeclInput, } from "./kinds/index.js";
|
|
12
|
+
import { PROTOCOL_VERSIONS } from "./version.js";
|
|
13
|
+
const targetField = {
|
|
14
|
+
target: StructureName.describe('Name of the structure this action applies to.'),
|
|
15
|
+
};
|
|
16
|
+
const withTargets = (options) => options.map((option) => option.extend(targetField));
|
|
17
|
+
/*
|
|
18
|
+
* One entry per kind (ADR 0012). Kinds may share action names (`highlight`
|
|
19
|
+
* exists for arrays and graphs with different fields), so the top level is a
|
|
20
|
+
* plain union of per-kind unions; the parser picks the right one by the
|
|
21
|
+
* target's kind.
|
|
22
|
+
*/
|
|
23
|
+
/** Any built-in action in canonical form, tagged with its structure. */
|
|
24
|
+
export const TargetedAction = z.union([
|
|
25
|
+
z.discriminatedUnion('type', withTargets(ArrayAction.options)),
|
|
26
|
+
z.discriminatedUnion('type', withTargets(StackAction.options)),
|
|
27
|
+
z.discriminatedUnion('type', withTargets(QueueAction.options)),
|
|
28
|
+
z.discriminatedUnion('type', withTargets(LinkedListAction.options)),
|
|
29
|
+
z.discriminatedUnion('type', withTargets(TreeAction.options)),
|
|
30
|
+
z.discriminatedUnion('type', withTargets(GraphAction.options)),
|
|
31
|
+
z.discriminatedUnion('type', withTargets(TableAction.options)),
|
|
32
|
+
z.discriminatedUnion('type', withTargets(HashTableAction.options)),
|
|
33
|
+
z.discriminatedUnion('type', withTargets(PriorityQueueAction.options)),
|
|
34
|
+
z.discriminatedUnion('type', withTargets(BTreeAction.options)),
|
|
35
|
+
z.discriminatedUnion('type', withTargets(PlaneAction.options)),
|
|
36
|
+
]);
|
|
37
|
+
/** Any built-in action in authoring form, tagged with its structure. */
|
|
38
|
+
export const TargetedActionInput = z.union([
|
|
39
|
+
z.discriminatedUnion('type', withTargets(ArrayActionInput.options)),
|
|
40
|
+
z.discriminatedUnion('type', withTargets(StackActionInput.options)),
|
|
41
|
+
z.discriminatedUnion('type', withTargets(QueueActionInput.options)),
|
|
42
|
+
z.discriminatedUnion('type', withTargets(LinkedListActionInput.options)),
|
|
43
|
+
z.discriminatedUnion('type', withTargets(TreeActionInput.options)),
|
|
44
|
+
z.discriminatedUnion('type', withTargets(GraphActionInput.options)),
|
|
45
|
+
z.discriminatedUnion('type', withTargets(TableAction.options)),
|
|
46
|
+
z.discriminatedUnion('type', withTargets(HashTableActionInput.options)),
|
|
47
|
+
z.discriminatedUnion('type', withTargets(PriorityQueueActionInput.options)),
|
|
48
|
+
z.discriminatedUnion('type', withTargets(BTreeActionInput.options)),
|
|
49
|
+
z.discriminatedUnion('type', withTargets(PlaneActionInput.options)),
|
|
50
|
+
]);
|
|
51
|
+
export const StructureDecl = z.discriminatedUnion('kind', [
|
|
52
|
+
ArrayDecl,
|
|
53
|
+
StackDecl,
|
|
54
|
+
QueueDecl,
|
|
55
|
+
LinkedListDecl,
|
|
56
|
+
TreeDecl,
|
|
57
|
+
GraphDecl,
|
|
58
|
+
TableDecl,
|
|
59
|
+
HashTableDecl,
|
|
60
|
+
PriorityQueueDecl,
|
|
61
|
+
BTreeDecl,
|
|
62
|
+
PlaneDecl,
|
|
63
|
+
]);
|
|
64
|
+
export const StructureDeclInput = z.discriminatedUnion('kind', [
|
|
65
|
+
ArrayDeclInput,
|
|
66
|
+
StackDeclInput,
|
|
67
|
+
QueueDeclInput,
|
|
68
|
+
LinkedListDeclInput,
|
|
69
|
+
TreeDeclInput,
|
|
70
|
+
GraphDeclInput,
|
|
71
|
+
TableDeclInput,
|
|
72
|
+
HashTableDeclInput,
|
|
73
|
+
PriorityQueueDeclInput,
|
|
74
|
+
BTreeDeclInput,
|
|
75
|
+
PlaneDeclInput,
|
|
76
|
+
]);
|
|
77
|
+
const steps = (action) => z
|
|
78
|
+
.array(z
|
|
79
|
+
.strictObject({
|
|
80
|
+
actions: z
|
|
81
|
+
.array(action)
|
|
82
|
+
.max(LIMITS.actionsPerStep)
|
|
83
|
+
.describe('Actions applied in order; a step may have none and only narrate.'),
|
|
84
|
+
meta: StepMeta.optional(),
|
|
85
|
+
})
|
|
86
|
+
.describe('One point on the timeline the learner can step to.'))
|
|
87
|
+
.max(LIMITS.steps);
|
|
88
|
+
const structures = (decl) => z
|
|
89
|
+
.record(StructureName, decl)
|
|
90
|
+
.refine((r) => Object.keys(r).length > 0, {
|
|
91
|
+
message: 'Declare at least one structure',
|
|
92
|
+
})
|
|
93
|
+
.refine((r) => Object.keys(r).length <= LIMITS.structures, {
|
|
94
|
+
message: `Declare at most ${LIMITS.structures} structures`,
|
|
95
|
+
})
|
|
96
|
+
.describe('Structures shown in the visualization, keyed by name.')
|
|
97
|
+
// The refinements above are invisible to JSON Schema; state them there too.
|
|
98
|
+
.meta({ minProperties: 1, maxProperties: LIMITS.structures });
|
|
99
|
+
const document = (decl, action) => z
|
|
100
|
+
.strictObject({
|
|
101
|
+
version: z
|
|
102
|
+
.enum(PROTOCOL_VERSIONS)
|
|
103
|
+
.describe('Protocol version, "major.minor": the oldest version that has every feature the document uses. Readers also accept a 0.x version and read the document as 1.0; this schema lists only the versions to write.'),
|
|
104
|
+
title: z.string().max(LIMITS.textLength).optional(),
|
|
105
|
+
source: Source.optional(),
|
|
106
|
+
sources: z
|
|
107
|
+
.array(AnchoredSource)
|
|
108
|
+
.min(1)
|
|
109
|
+
.max(LIMITS.sources)
|
|
110
|
+
.optional()
|
|
111
|
+
.describe('The code in one or more languages, one entry per language, instead of `source`. Steps point into every language at once with `meta.at`.'),
|
|
112
|
+
structures: structures(decl),
|
|
113
|
+
steps: steps(action),
|
|
114
|
+
sections: z
|
|
115
|
+
.array(Section)
|
|
116
|
+
.max(LIMITS.sections)
|
|
117
|
+
.optional()
|
|
118
|
+
.describe('Sections in order of their first step, e.g. one per operation. Steps before the first section belong to none.'),
|
|
119
|
+
})
|
|
120
|
+
// The parser reports both with its own error; state the rule for JSON
|
|
121
|
+
// Schema validators too.
|
|
122
|
+
.meta({ not: { required: ['source', 'sources'] } });
|
|
123
|
+
export const Visualization = document(StructureDecl, TargetedAction).describe('A step-by-step visualization in canonical form.');
|
|
124
|
+
export const VisualizationInput = document(StructureDeclInput, TargetedActionInput).describe('A step-by-step visualization: declared structures plus a timeline of steps, each applying actions to those structures.');
|
|
125
|
+
/**
|
|
126
|
+
* First-pass schema used by the parser: actions are only checked for
|
|
127
|
+
* `target` and `type`, so that their payload can then be validated against
|
|
128
|
+
* the schema of the target's kind with precise error messages.
|
|
129
|
+
*/
|
|
130
|
+
export const Envelope = document(StructureDeclInput, z.looseObject({ target: StructureName, type: z.string().min(1) }));
|
|
131
|
+
//# sourceMappingURL=visualization.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"visualization.js","sourceRoot":"","sources":["../src/visualization.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,cAAc,EACd,MAAM,EACN,OAAO,EACP,MAAM,EACN,QAAQ,EACR,aAAa,GACd,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,SAAS,EACT,cAAc,EACd,gBAAgB,EAChB,qBAAqB,EACrB,cAAc,EACd,mBAAmB,EACnB,WAAW,EACX,gBAAgB,EAChB,SAAS,EACT,cAAc,EACd,WAAW,EACX,gBAAgB,EAChB,SAAS,EACT,cAAc,EACd,UAAU,EACV,eAAe,EACf,QAAQ,EACR,aAAa,EACb,WAAW,EACX,gBAAgB,EAChB,SAAS,EACT,cAAc,EACd,eAAe,EACf,oBAAoB,EACpB,aAAa,EACb,kBAAkB,EAClB,mBAAmB,EACnB,wBAAwB,EACxB,iBAAiB,EACjB,sBAAsB,EACtB,WAAW,EACX,gBAAgB,EAChB,SAAS,EACT,cAAc,EACd,WAAW,EACX,gBAAgB,EAChB,SAAS,EACT,cAAc,EACd,WAAW,EACX,SAAS,EACT,cAAc,GACf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEjD,MAAM,WAAW,GAA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C,MAAM,QAAQ,GAAG,QAAQ,CAC9B,kBAAkB,EAClB,CAAC,CAAC,WAAW,CAAC,EAAE,MAAM,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAClE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,47 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@algomotion/spec",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.0.0-alpha.1",
|
|
4
|
+
"description": "Protocol schemas, types and validation for algomotion traces.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"algorithms",
|
|
7
|
+
"visualization",
|
|
8
|
+
"education",
|
|
9
|
+
"schema",
|
|
10
|
+
"protocol"
|
|
11
|
+
],
|
|
12
|
+
"license": "GPL-3.0-or-later",
|
|
13
|
+
"homepage": "https://algomotion.turing2234.com",
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git+https://github.com/Eryc123Y/algorithm-visualizer.git",
|
|
17
|
+
"directory": "packages/spec"
|
|
18
|
+
},
|
|
19
|
+
"bugs": {
|
|
20
|
+
"url": "https://github.com/Eryc123Y/algorithm-visualizer/issues"
|
|
21
|
+
},
|
|
22
|
+
"type": "module",
|
|
23
|
+
"sideEffects": false,
|
|
24
|
+
"exports": {
|
|
25
|
+
".": {
|
|
26
|
+
"@algomotion/source": "./src/index.ts",
|
|
27
|
+
"types": "./dist/index.d.ts",
|
|
28
|
+
"default": "./dist/index.js"
|
|
29
|
+
},
|
|
30
|
+
"./visualization.schema.json": "./schema/visualization.schema.json"
|
|
31
|
+
},
|
|
32
|
+
"files": [
|
|
33
|
+
"dist",
|
|
34
|
+
"schema"
|
|
35
|
+
],
|
|
36
|
+
"scripts": {
|
|
37
|
+
"build": "tsc --build tsconfig.lib.json",
|
|
38
|
+
"generate:schema": "node scripts/generate-schema.ts"
|
|
39
|
+
},
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"zod": "^4.6.7"
|
|
42
|
+
},
|
|
43
|
+
"publishConfig": {
|
|
44
|
+
"access": "public",
|
|
45
|
+
"tag": "alpha"
|
|
46
|
+
}
|
|
47
|
+
}
|