@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.
Files changed (97) hide show
  1. package/LICENSE +675 -0
  2. package/dist/.tsbuildinfo +1 -0
  3. package/dist/common.d.ts +136 -0
  4. package/dist/common.d.ts.map +1 -0
  5. package/dist/common.js +181 -0
  6. package/dist/common.js.map +1 -0
  7. package/dist/errors.d.ts +71 -0
  8. package/dist/errors.d.ts.map +1 -0
  9. package/dist/errors.js +43 -0
  10. package/dist/errors.js.map +1 -0
  11. package/dist/index.d.ts +10 -0
  12. package/dist/index.d.ts.map +1 -0
  13. package/dist/index.js +10 -0
  14. package/dist/index.js.map +1 -0
  15. package/dist/json-schema.d.ts +3 -0
  16. package/dist/json-schema.d.ts.map +1 -0
  17. package/dist/json-schema.js +16 -0
  18. package/dist/json-schema.js.map +1 -0
  19. package/dist/kinds/array.d.ts +171 -0
  20. package/dist/kinds/array.d.ts.map +1 -0
  21. package/dist/kinds/array.js +179 -0
  22. package/dist/kinds/array.js.map +1 -0
  23. package/dist/kinds/btree.d.ts +190 -0
  24. package/dist/kinds/btree.d.ts.map +1 -0
  25. package/dist/kinds/btree.js +274 -0
  26. package/dist/kinds/btree.js.map +1 -0
  27. package/dist/kinds/graph.d.ts +227 -0
  28. package/dist/kinds/graph.d.ts.map +1 -0
  29. package/dist/kinds/graph.js +229 -0
  30. package/dist/kinds/graph.js.map +1 -0
  31. package/dist/kinds/hash-table.d.ts +108 -0
  32. package/dist/kinds/hash-table.d.ts.map +1 -0
  33. package/dist/kinds/hash-table.js +133 -0
  34. package/dist/kinds/hash-table.js.map +1 -0
  35. package/dist/kinds/index.d.ts +98 -0
  36. package/dist/kinds/index.d.ts.map +1 -0
  37. package/dist/kinds/index.js +53 -0
  38. package/dist/kinds/index.js.map +1 -0
  39. package/dist/kinds/kind.d.ts +73 -0
  40. package/dist/kinds/kind.d.ts.map +1 -0
  41. package/dist/kinds/kind.js +4 -0
  42. package/dist/kinds/kind.js.map +1 -0
  43. package/dist/kinds/linear.d.ts +24 -0
  44. package/dist/kinds/linear.d.ts.map +1 -0
  45. package/dist/kinds/linear.js +26 -0
  46. package/dist/kinds/linear.js.map +1 -0
  47. package/dist/kinds/linked-list.d.ts +132 -0
  48. package/dist/kinds/linked-list.d.ts.map +1 -0
  49. package/dist/kinds/linked-list.js +95 -0
  50. package/dist/kinds/linked-list.js.map +1 -0
  51. package/dist/kinds/plane.d.ts +190 -0
  52. package/dist/kinds/plane.d.ts.map +1 -0
  53. package/dist/kinds/plane.js +206 -0
  54. package/dist/kinds/plane.js.map +1 -0
  55. package/dist/kinds/priority-queue.d.ts +120 -0
  56. package/dist/kinds/priority-queue.d.ts.map +1 -0
  57. package/dist/kinds/priority-queue.js +108 -0
  58. package/dist/kinds/priority-queue.js.map +1 -0
  59. package/dist/kinds/queue.d.ts +94 -0
  60. package/dist/kinds/queue.d.ts.map +1 -0
  61. package/dist/kinds/queue.js +59 -0
  62. package/dist/kinds/queue.js.map +1 -0
  63. package/dist/kinds/stack.d.ts +70 -0
  64. package/dist/kinds/stack.d.ts.map +1 -0
  65. package/dist/kinds/stack.js +50 -0
  66. package/dist/kinds/stack.js.map +1 -0
  67. package/dist/kinds/table.d.ts +65 -0
  68. package/dist/kinds/table.d.ts.map +1 -0
  69. package/dist/kinds/table.js +116 -0
  70. package/dist/kinds/table.js.map +1 -0
  71. package/dist/kinds/tree.d.ts +272 -0
  72. package/dist/kinds/tree.d.ts.map +1 -0
  73. package/dist/kinds/tree.js +380 -0
  74. package/dist/kinds/tree.js.map +1 -0
  75. package/dist/parse.d.ts +26 -0
  76. package/dist/parse.d.ts.map +1 -0
  77. package/dist/parse.js +380 -0
  78. package/dist/parse.js.map +1 -0
  79. package/dist/result.d.ts +16 -0
  80. package/dist/result.d.ts.map +1 -0
  81. package/dist/result.js +3 -0
  82. package/dist/result.js.map +1 -0
  83. package/dist/share.d.ts +68 -0
  84. package/dist/share.d.ts.map +1 -0
  85. package/dist/share.js +319 -0
  86. package/dist/share.js.map +1 -0
  87. package/dist/version.d.ts +108 -0
  88. package/dist/version.d.ts.map +1 -0
  89. package/dist/version.js +167 -0
  90. package/dist/version.js.map +1 -0
  91. package/dist/visualization.d.ts +3591 -0
  92. package/dist/visualization.d.ts.map +1 -0
  93. package/dist/visualization.js +131 -0
  94. package/dist/visualization.js.map +1 -0
  95. package/package.json +45 -4
  96. package/schema/visualization.schema.json +5717 -0
  97. package/README.md +0 -3
@@ -0,0 +1,73 @@
1
+ /**
2
+ * The contract every structure kind implements on the protocol side
3
+ * (ADR 0012). The parser only talks to kinds through this interface, so a
4
+ * new kind (a Turing machine tape, a number line, …) is one new module plus
5
+ * one registry entry.
6
+ */
7
+ import type { z } from 'zod';
8
+ /** An id together with where it appears, relative to its declaration or action. */
9
+ export interface IdRef {
10
+ readonly id: string;
11
+ readonly path: readonly PropertyKey[];
12
+ }
13
+ /** A structural problem in a declaration. */
14
+ export interface DeclIssue {
15
+ readonly path: readonly PropertyKey[];
16
+ readonly message: string;
17
+ readonly hint?: string;
18
+ }
19
+ /** Services the parser offers while normalising an action. */
20
+ export interface ActionContext {
21
+ /**
22
+ * Returns an id of the form `${prefix}${n}` that is not yet used in this
23
+ * structure, and reserves it. Used to give shorthand elements ids.
24
+ */
25
+ allocateId(prefix: string): string;
26
+ }
27
+ /** The types a kind is made of. */
28
+ export interface KindTypes {
29
+ /** Canonical declaration, as renderers see it. */
30
+ readonly decl: {
31
+ readonly kind: string;
32
+ };
33
+ /** Authoring declaration; may allow shorthands. */
34
+ readonly declInput: {
35
+ readonly kind: string;
36
+ };
37
+ /** Canonical action. */
38
+ readonly action: {
39
+ readonly type: string;
40
+ };
41
+ /** Authoring action; may allow shorthands. */
42
+ readonly actionInput: {
43
+ readonly type: string;
44
+ };
45
+ }
46
+ export interface KindSpec<T extends KindTypes> {
47
+ readonly kind: T['decl']['kind'];
48
+ readonly decl: z.ZodType<T['decl']>;
49
+ readonly declInput: z.ZodType<T['declInput']>;
50
+ readonly action: z.ZodType<T['action']>;
51
+ readonly actionInput: z.ZodType<T['actionInput']>;
52
+ /** Every action `type` the kind defines, for error hints. */
53
+ readonly actionTypes: readonly string[];
54
+ /** Expands declaration shorthands into the canonical form. */
55
+ normalizeDecl(input: T['declInput']): T['decl'];
56
+ /** Ids present in a declaration; they must be unique within it. */
57
+ declIds(decl: T['decl']): readonly IdRef[];
58
+ /**
59
+ * Structural rules a schema cannot express, e.g. that a tree has no
60
+ * cycles. Returns problems with paths relative to the declaration.
61
+ */
62
+ validateDecl?(decl: T['decl']): readonly DeclIssue[];
63
+ /** Expands action shorthands, allocating ids where needed. */
64
+ normalizeAction(input: T['actionInput'], ctx: ActionContext): T['action'];
65
+ /** Ids an action introduces; they must not have been used before. */
66
+ introducedIds(action: T['action']): readonly IdRef[];
67
+ }
68
+ /** The action `type` literals of a discriminated union of object schemas. */
69
+ export declare const typesOf: (union: z.ZodDiscriminatedUnion<readonly z.ZodObject<{
70
+ type: z.ZodLiteral<string>;
71
+ }>[]>) => string[];
72
+ export declare const noIds: () => readonly IdRef[];
73
+ //# sourceMappingURL=kind.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kind.d.ts","sourceRoot":"","sources":["../../src/kinds/kind.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B,mFAAmF;AACnF,MAAM,WAAW,KAAK;IACpB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,SAAS,WAAW,EAAE,CAAC;CACvC;AAED,6CAA6C;AAC7C,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,IAAI,EAAE,SAAS,WAAW,EAAE,CAAC;IACtC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;CACxB;A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AAC;IAChD,mEAAmE;IACnE,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,GAAG,SAAS,KAAK,EAAE,CAAC;IAC3C;;;OAGG;IACH,YAAY,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,GAAG,SAAS,SAAS,EAAE,CAAC;IACrD,8DAA8D;IAC9D,eAAe,CAAC,KAAK,EAAE,CAAC,CAAC,aAAa,CAAC,EAAE,GAAG,EAAE,aAAa,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC;IAC1E,qEAAqE;IACrE,aAAa,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,CAAC,GAAG,SAAS,KAAK,EAAE,CAAC;CACtD;AAED,6EAA6E;AAC7E,eAAO,MAAM,OAAO,GAClB,OAAO,CAAC,CAAC,qBAAqB,CAC5B,SAAS,CAAC,CAAC,SAAS,CAAC;IAAE,IAAI,EAAE,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,CAAA;CAAE,CAAC,EAAE,CACvD,KACA,MAAM,EAA4D,CAAC;AAEtE,eAAO,MAAM,KAAK,QAAO,SAAS,KAAK,EAAQ,CAAC"}
@@ -0,0 +1,4 @@
1
+ /** The action `type` literals of a discriminated union of object schemas. */
2
+ export const typesOf = (union) => union.options.map((option) => option.shape.type.value);
3
+ export const noIds = () => [];
4
+ //# sourceMappingURL=kind.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kind.js","sourceRoot":"","sources":["../../src/kinds/kind.ts"],"names":[],"mappings":"AAiEA,6EAA6E;AAC7E,MAAM,CAAC,MAAM,OAAO,GAAG,CACrB,KAEC,EACS,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAEtE,MAAM,CAAC,MAAM,KAAK,GAAG,GAAqB,EAAE,CAAC,EAAE,CAAC"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Shared pieces of the linear element kinds (stack, queue, linked list).
3
+ */
4
+ import { z } from 'zod';
5
+ import { Element, Scalar } from '../common.ts';
6
+ import type { ActionContext, IdRef } from './kind.ts';
7
+ export declare const Elements: z.ZodArray<z.ZodObject<{
8
+ id: z.ZodString;
9
+ value: z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodBoolean, z.ZodNull]>;
10
+ }, z.core.$strict>>;
11
+ /** Bare values or explicit elements; bare values get ids e0, e1, … */
12
+ export declare const ElementsInput: z.ZodUnion<readonly [z.ZodArray<z.ZodObject<{
13
+ id: z.ZodString;
14
+ value: z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodBoolean, z.ZodNull]>;
15
+ }, z.core.$strict>>, z.ZodArray<z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodBoolean, z.ZodNull]>>]>;
16
+ export declare const normalizeElements: (input: readonly (Element | Scalar)[]) => Element[];
17
+ export declare const Indices: z.ZodArray<z.ZodInt>;
18
+ export declare const elementIds: (elements: readonly Element[], key?: string) => IdRef[];
19
+ /** Gives a bare-value `element` field, if the action has one, a generated id. */
20
+ export declare function normalizeElementField<A extends object>(action: A, ctx: ActionContext): A;
21
+ export declare const elementFieldIds: (action: {
22
+ element: Element;
23
+ }) => IdRef[];
24
+ //# sourceMappingURL=linear.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"linear.d.ts","sourceRoot":"","sources":["../../src/kinds/linear.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,OAAO,EAA4B,MAAM,EAAE,MAAM,cAAc,CAAC;AACzE,OAAO,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAEtD,eAAO,MAAM,QAAQ;;;mBAAoD,CAAC;AAE1E,sEAAsE;AACtE,eAAO,MAAM,aAAa;;;2GAIvB,CAAC;AAEJ,eAAO,MAAM,iBAAiB,GAC5B,OAAO,SAAS,CAAC,OAAO,GAAG,MAAM,CAAC,EAAE,KACnC,OAAO,EAC2D,CAAC;AAEtE,eAAO,MAAM,OAAO,sBAAyD,CAAC;AAE9E,eAAO,MAAM,UAAU,GACrB,UAAU,SAAS,OAAO,EAAE,EAC5B,YAAe,KACd,KAAK,EAAkE,CAAC;AAE3E,iFAAiF;AACjF,wBAAgB,qBAAqB,CAAC,CAAC,SAAS,MAAM,EACpD,MAAM,EAAE,CAAC,EACT,GAAG,EAAE,aAAa,GACjB,CAAC,CAKH;AAED,eAAO,MAAM,eAAe,GAAI,QAAQ;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,KAAG,KAAK,EAEnE,CAAC"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Shared pieces of the linear element kinds (stack, queue, linked list).
3
+ */
4
+ import { z } from 'zod';
5
+ import { Element, Index, isElement, LIMITS, Scalar } from "../common.js";
6
+ export const Elements = z.array(Element).max(LIMITS.elementsPerStructure);
7
+ /** Bare values or explicit elements; bare values get ids e0, e1, … */
8
+ export const ElementsInput = z
9
+ .union([Elements, z.array(Scalar).max(LIMITS.elementsPerStructure)])
10
+ .describe('Initial contents: bare values like [5, 3] (ids "e0", "e1", … are generated) or elements like [{ "id": "a", "value": 5 }].');
11
+ export const normalizeElements = (input) => input.map((x, k) => (isElement(x) ? x : { id: `e${k}`, value: x }));
12
+ export const Indices = z.array(Index).min(1).max(LIMITS.elementsPerStructure);
13
+ export const elementIds = (elements, key = 'initial') => elements.map((e, k) => ({ id: e.id, path: [key, k, 'id'] }));
14
+ /** Gives a bare-value `element` field, if the action has one, a generated id. */
15
+ export function normalizeElementField(action, ctx) {
16
+ if (!('element' in action))
17
+ return action;
18
+ const element = action.element;
19
+ if (isElement(element))
20
+ return action;
21
+ return { ...action, element: { id: ctx.allocateId('e'), value: element } };
22
+ }
23
+ export const elementFieldIds = (action) => [
24
+ { id: action.element.id, path: ['element', 'id'] },
25
+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AAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,CAAC,GAAG,EAAE,CAAC,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;AAE3E,iFAAiF;AACjF,MAAM,UAAU,qBAAqB,CACnC,MAAS,EACT,GAAkB;IAElB,IAAI,CAAC,CAAC,SAAS,IAAI,MAAM,CAAC;QAAE,OAAO,MAAM,CAAC;IAC1C,MAAM,OAAO,GAAG,MAAM,CAAC,OAAuB,CAAC;IAC/C,IAAI,SAAS,CAAC,OAAO,CAAC;QAAE,OAAO,MAAM,CAAC;IACtC,OAAO,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,CAAC;AAC7E,CAAC;AAED,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,MAA4B,EAAW,EAAE,CAAC;IACxE,EAAE,EAAE,EAAE,MAAM,CAAC,OAAO,CAAC,EAAE,EAAE,IAAI,EAAE,CAAC,SAAS,EAAE,IAAI,CAAC,EAAE;CACnD,CAAC"}
@@ -0,0 +1,132 @@
1
+ /**
2
+ * The `linkedList` kind: nodes laid out in a row, with explicit `next` (and,
3
+ * for doubly linked lists, `prev`) pointers.
4
+ *
5
+ * Positions refer to the row, from the left (0). Links are independent of
6
+ * the row, so a reversal can be shown one pointer at a time. `insert` only
7
+ * places a node and `move` only moves one along the row (ADR 0036); wire
8
+ * them in with `link`, as the code being taught would.
9
+ *
10
+ * Marks: `highlight` lasts one step; `visit`, `settle` and `pointer` persist.
11
+ */
12
+ import { z } from 'zod';
13
+ import { type KindSpec } from './kind.ts';
14
+ export declare const LinkedListDecl: z.ZodObject<{
15
+ initial: z.ZodArray<z.ZodObject<{
16
+ id: z.ZodString;
17
+ value: z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodBoolean, z.ZodNull]>;
18
+ }, z.core.$strict>>;
19
+ kind: z.ZodLiteral<"linkedList">;
20
+ label: z.ZodOptional<z.ZodString>;
21
+ place: z.ZodOptional<z.ZodEnum<{
22
+ main: "main";
23
+ side: "side";
24
+ }>>;
25
+ doubly: z.ZodOptional<z.ZodBoolean>;
26
+ circular: z.ZodOptional<z.ZodBoolean>;
27
+ }, z.core.$strict>;
28
+ export type LinkedListDecl = z.infer<typeof LinkedListDecl>;
29
+ export declare const LinkedListDeclInput: z.ZodObject<{
30
+ initial: z.ZodUnion<readonly [z.ZodArray<z.ZodObject<{
31
+ id: z.ZodString;
32
+ value: z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodBoolean, z.ZodNull]>;
33
+ }, z.core.$strict>>, z.ZodArray<z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodBoolean, z.ZodNull]>>]>;
34
+ kind: z.ZodLiteral<"linkedList">;
35
+ label: z.ZodOptional<z.ZodString>;
36
+ place: z.ZodOptional<z.ZodEnum<{
37
+ main: "main";
38
+ side: "side";
39
+ }>>;
40
+ doubly: z.ZodOptional<z.ZodBoolean>;
41
+ circular: z.ZodOptional<z.ZodBoolean>;
42
+ }, z.core.$strict>;
43
+ export type LinkedListDeclInput = z.infer<typeof LinkedListDeclInput>;
44
+ export declare const LinkedListAction: z.ZodDiscriminatedUnion<[z.ZodObject<{
45
+ type: z.ZodLiteral<"insert">;
46
+ index: z.ZodInt;
47
+ element: z.ZodObject<{
48
+ id: z.ZodString;
49
+ value: z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodBoolean, z.ZodNull]>;
50
+ }, z.core.$strict>;
51
+ }, z.core.$strict>, z.ZodObject<{
52
+ type: z.ZodLiteral<"remove">;
53
+ index: z.ZodInt;
54
+ }, z.core.$strict>, z.ZodObject<{
55
+ type: z.ZodLiteral<"set">;
56
+ index: z.ZodInt;
57
+ value: z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodBoolean, z.ZodNull]>;
58
+ }, z.core.$strict>, z.ZodObject<{
59
+ type: z.ZodLiteral<"move">;
60
+ from: z.ZodInt;
61
+ to: z.ZodInt;
62
+ }, z.core.$strict>, z.ZodObject<{
63
+ type: z.ZodLiteral<"link">;
64
+ from: z.ZodInt;
65
+ to: z.ZodNullable<z.ZodInt>;
66
+ field: z.ZodOptional<z.ZodEnum<{
67
+ next: "next";
68
+ prev: "prev";
69
+ }>>;
70
+ }, z.core.$strict>, z.ZodObject<{
71
+ type: z.ZodLiteral<"pointer">;
72
+ name: z.ZodString;
73
+ index: z.ZodNullable<z.ZodInt>;
74
+ }, z.core.$strict>, z.ZodObject<{
75
+ type: z.ZodLiteral<"highlight">;
76
+ indices: z.ZodArray<z.ZodInt>;
77
+ }, z.core.$strict>, z.ZodObject<{
78
+ type: z.ZodLiteral<"visit">;
79
+ index: z.ZodInt;
80
+ }, z.core.$strict>, z.ZodObject<{
81
+ type: z.ZodLiteral<"settle">;
82
+ index: z.ZodInt;
83
+ }, z.core.$strict>], "type">;
84
+ export type LinkedListAction = z.infer<typeof LinkedListAction>;
85
+ export declare const LinkedListActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
86
+ type: z.ZodLiteral<"insert">;
87
+ index: z.ZodInt;
88
+ element: z.ZodUnion<readonly [z.ZodObject<{
89
+ id: z.ZodString;
90
+ value: z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodBoolean, z.ZodNull]>;
91
+ }, z.core.$strict>, z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodBoolean, z.ZodNull]>]>;
92
+ }, z.core.$strict>, z.ZodObject<{
93
+ type: z.ZodLiteral<"remove">;
94
+ index: z.ZodInt;
95
+ }, z.core.$strict>, z.ZodObject<{
96
+ type: z.ZodLiteral<"set">;
97
+ index: z.ZodInt;
98
+ value: z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodBoolean, z.ZodNull]>;
99
+ }, z.core.$strict>, z.ZodObject<{
100
+ type: z.ZodLiteral<"move">;
101
+ from: z.ZodInt;
102
+ to: z.ZodInt;
103
+ }, z.core.$strict>, z.ZodObject<{
104
+ type: z.ZodLiteral<"link">;
105
+ from: z.ZodInt;
106
+ to: z.ZodNullable<z.ZodInt>;
107
+ field: z.ZodOptional<z.ZodEnum<{
108
+ next: "next";
109
+ prev: "prev";
110
+ }>>;
111
+ }, z.core.$strict>, z.ZodObject<{
112
+ type: z.ZodLiteral<"pointer">;
113
+ name: z.ZodString;
114
+ index: z.ZodNullable<z.ZodInt>;
115
+ }, z.core.$strict>, z.ZodObject<{
116
+ type: z.ZodLiteral<"highlight">;
117
+ indices: z.ZodArray<z.ZodInt>;
118
+ }, z.core.$strict>, z.ZodObject<{
119
+ type: z.ZodLiteral<"visit">;
120
+ index: z.ZodInt;
121
+ }, z.core.$strict>, z.ZodObject<{
122
+ type: z.ZodLiteral<"settle">;
123
+ index: z.ZodInt;
124
+ }, z.core.$strict>], "type">;
125
+ export type LinkedListActionInput = z.infer<typeof LinkedListActionInput>;
126
+ export declare const linkedListSpec: KindSpec<{
127
+ decl: LinkedListDecl;
128
+ declInput: LinkedListDeclInput;
129
+ action: LinkedListAction;
130
+ actionInput: LinkedListActionInput;
131
+ }>;
132
+ //# sourceMappingURL=linked-list.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"linked-list.d.ts","sourceRoot":"","sources":["../../src/kinds/linked-list.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAWxB,OAAO,EAAW,KAAK,QAAQ,EAAE,MAAM,WAAW,CAAC;AAyBnD,eAAO,MAAM,cAAc;;;;;;;;;;;;;kBAOmB,CAAC;AAC/C,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAE5D,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;kBAG9B,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAsDtE,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4BAAmB,CAAC;AACjD,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAChE,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4BAAwB,CAAC;AAC3D,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAE1E,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC;IACpC,IAAI,EAAE,cAAc,CAAC;IACrB,SAAS,EAAE,mBAAmB,CAAC;IAC/B,MAAM,EAAE,gBAAgB,CAAC;IACzB,WAAW,EAAE,qBAAqB,CAAC;CACpC,CAgBA,CAAC"}
@@ -0,0 +1,95 @@
1
+ /**
2
+ * The `linkedList` kind: nodes laid out in a row, with explicit `next` (and,
3
+ * for doubly linked lists, `prev`) pointers.
4
+ *
5
+ * Positions refer to the row, from the left (0). Links are independent of
6
+ * the row, so a reversal can be shown one pointer at a time. `insert` only
7
+ * places a node and `move` only moves one along the row (ADR 0036); wire
8
+ * them in with `link`, as the code being taught would.
9
+ *
10
+ * Marks: `highlight` lasts one step; `visit`, `settle` and `pointer` persist.
11
+ */
12
+ import { z } from 'zod';
13
+ import { Element, ElementInput, Index, LIMITS, Place, PointerName, Scalar, } from "../common.js";
14
+ import { typesOf } from "./kind.js";
15
+ import { elementFieldIds, elementIds, Elements, ElementsInput, Indices, normalizeElementField, normalizeElements, } from "./linear.js";
16
+ const shape = {
17
+ kind: z.literal('linkedList'),
18
+ label: z.string().max(LIMITS.textLength).optional(),
19
+ place: Place.optional(),
20
+ doubly: z
21
+ .boolean()
22
+ .optional()
23
+ .describe('Also keep `prev` pointers (default false).'),
24
+ circular: z
25
+ .boolean()
26
+ .optional()
27
+ .describe('Link the last node back to the first (default false).'),
28
+ };
29
+ export const LinkedListDecl = z
30
+ .strictObject({
31
+ ...shape,
32
+ initial: Elements.describe('Nodes in order; each is linked to the next (and previous, if doubly linked).'),
33
+ })
34
+ .describe('A singly or doubly linked list.');
35
+ export const LinkedListDeclInput = z.strictObject({
36
+ ...shape,
37
+ initial: ElementsInput,
38
+ });
39
+ const Field = z.enum(['next', 'prev']);
40
+ const actions = (element) => z.discriminatedUnion('type', [
41
+ z
42
+ .strictObject({ type: z.literal('insert'), index: Index, element })
43
+ .describe('Place a new, unlinked node at row position `index` (equal to the length appends). Use `link` to wire it in.'),
44
+ z
45
+ .strictObject({ type: z.literal('remove'), index: Index })
46
+ .describe('Remove the node at `index`; links that pointed to it become null.'),
47
+ z
48
+ .strictObject({ type: z.literal('set'), index: Index, value: Scalar })
49
+ .describe('Change a node value.'),
50
+ z
51
+ .strictObject({ type: z.literal('move'), from: Index, to: Index })
52
+ .describe('Move the node at row position `from` to position `to`; the nodes between shift one place. Links do not change: relink with `link` in the same step.'),
53
+ z
54
+ .strictObject({
55
+ type: z.literal('link'),
56
+ from: Index,
57
+ to: Index.nullable(),
58
+ field: Field.optional(),
59
+ })
60
+ .describe('Set the `field` pointer (default "next") of node `from` to node `to`, or null.'),
61
+ z
62
+ .strictObject({
63
+ type: z.literal('pointer'),
64
+ name: PointerName,
65
+ index: Index.nullable(),
66
+ })
67
+ .describe('Point a named pointer (e.g. "head", "curr") at a node; null removes it.'),
68
+ z
69
+ .strictObject({ type: z.literal('highlight'), indices: Indices })
70
+ .describe('Highlight nodes (this step only).'),
71
+ z
72
+ .strictObject({ type: z.literal('visit'), index: Index })
73
+ .describe('Mark a node as visited (persists).'),
74
+ z
75
+ .strictObject({ type: z.literal('settle'), index: Index })
76
+ .describe('Mark a node as final or found (persists).'),
77
+ ]);
78
+ export const LinkedListAction = actions(Element);
79
+ export const LinkedListActionInput = actions(ElementInput);
80
+ export const linkedListSpec = {
81
+ kind: 'linkedList',
82
+ decl: LinkedListDecl,
83
+ declInput: LinkedListDeclInput,
84
+ action: LinkedListAction,
85
+ actionInput: LinkedListActionInput,
86
+ actionTypes: typesOf(LinkedListAction),
87
+ normalizeDecl: (input) => ({
88
+ ...input,
89
+ initial: normalizeElements(input.initial),
90
+ }),
91
+ declIds: (decl) => elementIds(decl.initial),
92
+ normalizeAction: (action, ctx) => normalizeElementField(action, ctx),
93
+ introducedIds: (action) => action.type === 'insert' ? elementFieldIds(action) : [],
94
+ };
95
+ //# sourceMappingURL=linked-list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"linked-list.js","sourceRoot":"","sources":["../../src/kinds/linked-list.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,OAAO,EACP,YAAY,EACZ,KAAK,EACL,MAAM,EACN,KAAK,EACL,WAAW,EACX,MAAM,GACP,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,OAAO,EAAiB,MAAM,WAAW,CAAC;AACnD,OAAO,EACL,eAAe,EACf,UAAU,EACV,QAAQ,EACR,aAAa,EACb,OAAO,EACP,qBAAqB,EACrB,iBAAiB,GAClB,MAAM,aAAa,CAAC;AAErB,MAAM,KAAK,GAAG;IACZ,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC;IAC7B,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,QAAQ,EAAE;IACnD,KAAK,EAAE,KAAK,CAAC,QAAQ,EAAE;IACvB,MAAM,EAAE,CAAC;SACN,OAAO,EAAE;SACT,QAAQ,EAAE;SACV,QAAQ,CAAC,4CAA4C,CAAC;IACzD,QAAQ,EAAE,CAAC;SACR,OAAO,EAAE;SACT,QAAQ,EAAE;SACV,QAAQ,CAAC,uDAAuD,CAAC;CACrE,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC;KAC5B,YAA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iB,CAAC,KAAK,CAAC,OAAO,CAAC;KAC1C,CAAC;IACF,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC;IAC3C,eAAe,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,EAAE,CAC/B,qBAAqB,CAAC,MAAM,EAAE,GAAG,CAAqB;IACxD,aAAa,EAAE,CAAC,MAAM,EAAE,EAAE,CACxB,MAAM,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE;CAC1D,CAAC"}
@@ -0,0 +1,190 @@
1
+ /**
2
+ * The `plane` kind (ADR 0038): points at coordinates and the segments
3
+ * between them, with named vertical lines (a sweep line, a dividing line)
4
+ * and optional axes, for computational geometry. Points and segments have
5
+ * ids, unique within the structure; a segment names its two end points.
6
+ *
7
+ * Marks: `highlight` and `compare` last one step; `visit`, `settle`,
8
+ * `select`, `pointer` and `line` persist.
9
+ */
10
+ import { z } from 'zod';
11
+ import { type DeclIssue, type KindSpec } from './kind.ts';
12
+ /** Most points, segments and lines a plane holds. */
13
+ export declare const MAX_POINTS = 64;
14
+ export declare const MAX_SEGMENTS = 128;
15
+ export declare const MAX_LINES = 8;
16
+ /** A coordinate: a finite number from −10⁶ to 10⁶. */
17
+ export declare const Coordinate: z.ZodNumber;
18
+ export declare const PlanePoint: z.ZodObject<{
19
+ id: z.ZodString;
20
+ x: z.ZodNumber;
21
+ y: z.ZodNumber;
22
+ label: z.ZodOptional<z.ZodString>;
23
+ }, z.core.$strict>;
24
+ export type PlanePoint = z.infer<typeof PlanePoint>;
25
+ export declare const PlaneSegment: z.ZodObject<{
26
+ id: z.ZodString;
27
+ from: z.ZodString;
28
+ to: z.ZodString;
29
+ label: z.ZodOptional<z.ZodString>;
30
+ }, z.core.$strict>;
31
+ export type PlaneSegment = z.infer<typeof PlaneSegment>;
32
+ export declare const PlaneDecl: z.ZodObject<{
33
+ points: z.ZodArray<z.ZodObject<{
34
+ id: z.ZodString;
35
+ x: z.ZodNumber;
36
+ y: z.ZodNumber;
37
+ label: z.ZodOptional<z.ZodString>;
38
+ }, z.core.$strict>>;
39
+ segments: z.ZodOptional<z.ZodArray<z.ZodObject<{
40
+ id: z.ZodString;
41
+ from: z.ZodString;
42
+ to: z.ZodString;
43
+ label: z.ZodOptional<z.ZodString>;
44
+ }, z.core.$strict>>>;
45
+ kind: z.ZodLiteral<"plane">;
46
+ label: z.ZodOptional<z.ZodString>;
47
+ place: z.ZodOptional<z.ZodEnum<{
48
+ main: "main";
49
+ side: "side";
50
+ }>>;
51
+ axes: z.ZodOptional<z.ZodBoolean>;
52
+ }, z.core.$strict>;
53
+ export type PlaneDecl = z.infer<typeof PlaneDecl>;
54
+ export declare const PlaneDeclInput: z.ZodObject<{
55
+ points: z.ZodOptional<z.ZodArray<z.ZodObject<{
56
+ id: z.ZodString;
57
+ x: z.ZodNumber;
58
+ y: z.ZodNumber;
59
+ label: z.ZodOptional<z.ZodString>;
60
+ }, z.core.$strict>>>;
61
+ segments: z.ZodOptional<z.ZodArray<z.ZodObject<{
62
+ id: z.ZodString;
63
+ from: z.ZodString;
64
+ to: z.ZodString;
65
+ label: z.ZodOptional<z.ZodString>;
66
+ }, z.core.$strict>>>;
67
+ kind: z.ZodLiteral<"plane">;
68
+ label: z.ZodOptional<z.ZodString>;
69
+ place: z.ZodOptional<z.ZodEnum<{
70
+ main: "main";
71
+ side: "side";
72
+ }>>;
73
+ axes: z.ZodOptional<z.ZodBoolean>;
74
+ }, z.core.$strict>;
75
+ export type PlaneDeclInput = z.infer<typeof PlaneDeclInput>;
76
+ /** Points apart, segment ends known and distinct, one segment per pair. */
77
+ export declare function validatePlaneDecl(decl: PlaneDecl): DeclIssue[];
78
+ export declare const PlaneAction: z.ZodDiscriminatedUnion<[z.ZodObject<{
79
+ type: z.ZodLiteral<"addPoint">;
80
+ point: z.ZodObject<{
81
+ id: z.ZodString;
82
+ x: z.ZodNumber;
83
+ y: z.ZodNumber;
84
+ label: z.ZodOptional<z.ZodString>;
85
+ }, z.core.$strict>;
86
+ }, z.core.$strict>, z.ZodObject<{
87
+ type: z.ZodLiteral<"removePoint">;
88
+ id: z.ZodString;
89
+ }, z.core.$strict>, z.ZodObject<{
90
+ type: z.ZodLiteral<"addSegment">;
91
+ segment: z.ZodObject<{
92
+ id: z.ZodString;
93
+ from: z.ZodString;
94
+ to: z.ZodString;
95
+ label: z.ZodOptional<z.ZodString>;
96
+ }, z.core.$strict>;
97
+ }, z.core.$strict>, z.ZodObject<{
98
+ type: z.ZodLiteral<"removeSegment">;
99
+ id: z.ZodString;
100
+ }, z.core.$strict>, z.ZodObject<{
101
+ type: z.ZodLiteral<"label">;
102
+ segment: z.ZodString;
103
+ text: z.ZodNullable<z.ZodString>;
104
+ }, z.core.$strict>, z.ZodObject<{
105
+ type: z.ZodLiteral<"highlight">;
106
+ points: z.ZodOptional<z.ZodArray<z.ZodString>>;
107
+ segments: z.ZodOptional<z.ZodArray<z.ZodString>>;
108
+ }, z.core.$strict>, z.ZodObject<{
109
+ type: z.ZodLiteral<"compare">;
110
+ points: z.ZodArray<z.ZodString>;
111
+ }, z.core.$strict>, z.ZodObject<{
112
+ type: z.ZodLiteral<"visit">;
113
+ point: z.ZodString;
114
+ }, z.core.$strict>, z.ZodObject<{
115
+ type: z.ZodLiteral<"settle">;
116
+ point: z.ZodString;
117
+ }, z.core.$strict>, z.ZodObject<{
118
+ type: z.ZodLiteral<"select">;
119
+ segment: z.ZodString;
120
+ on: z.ZodBoolean;
121
+ }, z.core.$strict>, z.ZodObject<{
122
+ type: z.ZodLiteral<"pointer">;
123
+ name: z.ZodString;
124
+ point: z.ZodNullable<z.ZodString>;
125
+ }, z.core.$strict>, z.ZodObject<{
126
+ type: z.ZodLiteral<"line">;
127
+ name: z.ZodString;
128
+ x: z.ZodNullable<z.ZodNumber>;
129
+ }, z.core.$strict>], "type">;
130
+ export type PlaneAction = z.infer<typeof PlaneAction>;
131
+ export declare const PlaneActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
132
+ type: z.ZodLiteral<"addPoint">;
133
+ point: z.ZodObject<{
134
+ id: z.ZodString;
135
+ x: z.ZodNumber;
136
+ y: z.ZodNumber;
137
+ label: z.ZodOptional<z.ZodString>;
138
+ }, z.core.$strict>;
139
+ }, z.core.$strict>, z.ZodObject<{
140
+ type: z.ZodLiteral<"removePoint">;
141
+ id: z.ZodString;
142
+ }, z.core.$strict>, z.ZodObject<{
143
+ type: z.ZodLiteral<"addSegment">;
144
+ segment: z.ZodObject<{
145
+ id: z.ZodString;
146
+ from: z.ZodString;
147
+ to: z.ZodString;
148
+ label: z.ZodOptional<z.ZodString>;
149
+ }, z.core.$strict>;
150
+ }, z.core.$strict>, z.ZodObject<{
151
+ type: z.ZodLiteral<"removeSegment">;
152
+ id: z.ZodString;
153
+ }, z.core.$strict>, z.ZodObject<{
154
+ type: z.ZodLiteral<"label">;
155
+ segment: z.ZodString;
156
+ text: z.ZodNullable<z.ZodString>;
157
+ }, z.core.$strict>, z.ZodObject<{
158
+ type: z.ZodLiteral<"highlight">;
159
+ points: z.ZodOptional<z.ZodArray<z.ZodString>>;
160
+ segments: z.ZodOptional<z.ZodArray<z.ZodString>>;
161
+ }, z.core.$strict>, z.ZodObject<{
162
+ type: z.ZodLiteral<"compare">;
163
+ points: z.ZodArray<z.ZodString>;
164
+ }, z.core.$strict>, z.ZodObject<{
165
+ type: z.ZodLiteral<"visit">;
166
+ point: z.ZodString;
167
+ }, z.core.$strict>, z.ZodObject<{
168
+ type: z.ZodLiteral<"settle">;
169
+ point: z.ZodString;
170
+ }, z.core.$strict>, z.ZodObject<{
171
+ type: z.ZodLiteral<"select">;
172
+ segment: z.ZodString;
173
+ on: z.ZodBoolean;
174
+ }, z.core.$strict>, z.ZodObject<{
175
+ type: z.ZodLiteral<"pointer">;
176
+ name: z.ZodString;
177
+ point: z.ZodNullable<z.ZodString>;
178
+ }, z.core.$strict>, z.ZodObject<{
179
+ type: z.ZodLiteral<"line">;
180
+ name: z.ZodString;
181
+ x: z.ZodNullable<z.ZodNumber>;
182
+ }, z.core.$strict>], "type">;
183
+ export type PlaneActionInput = PlaneAction;
184
+ export declare const planeSpec: KindSpec<{
185
+ decl: PlaneDecl;
186
+ declInput: PlaneDeclInput;
187
+ action: PlaneAction;
188
+ actionInput: PlaneActionInput;
189
+ }>;
190
+ //# sourceMappingURL=plane.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plane.d.ts","sourceRoot":"","sources":["../../src/kinds/plane.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAW,KAAK,SAAS,EAAc,KAAK,QAAQ,EAAE,MAAM,WAAW,CAAC;AAE/E,qDAAqD;AACrD,eAAO,MAAM,UAAU,KAAK,CAAC;AAC7B,eAAO,MAAM,YAAY,MAAM,CAAC;AAChC,eAAO,MAAM,SAAS,IAAI,CAAC;AAE3B,sDAAsD;AACtD,eAAO,MAAM,UAAU,aAAgC,CAAC;AAIxD,eAAO,MAAM,UAAU;;;;;kBASU,CAAC;AAClC,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAEpD,eAAO,MAAM,YAAY;;;;;kBAOmB,CAAC;AAC7C,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAYxD,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;kBAMsD,CAAC;AAC7E,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAC;AAElD,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;kBAUiD,CAAC;AAC7E,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAK5D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