@nakafa/aksara-contracts 0.31.0 → 0.33.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.
@@ -1,27 +1,6 @@
1
1
  import { Schema } from "effect";
2
2
  /** Mathematical objects supported by a Cartesian space scene. */
3
3
  export declare const SpaceMathObjectSchema: Schema.Union<readonly [Schema.Struct<{
4
- readonly appearance: Schema.Literals<readonly ["answer", "construction", "highlight", "primary", "reference", "secondary", "warning"]>;
5
- readonly id: Schema.String;
6
- readonly kind: Schema.Literal<"closed-spline">;
7
- readonly samples: Schema.TupleWithRest<Schema.Tuple<readonly [Schema.Struct<{
8
- readonly x: Schema.Finite;
9
- readonly y: Schema.Finite;
10
- readonly z: Schema.Finite;
11
- }>, Schema.Struct<{
12
- readonly x: Schema.Finite;
13
- readonly y: Schema.Finite;
14
- readonly z: Schema.Finite;
15
- }>, Schema.Struct<{
16
- readonly x: Schema.Finite;
17
- readonly y: Schema.Finite;
18
- readonly z: Schema.Finite;
19
- }>]>, readonly [Schema.Struct<{
20
- readonly x: Schema.Finite;
21
- readonly y: Schema.Finite;
22
- readonly z: Schema.Finite;
23
- }>]>;
24
- }>, Schema.Struct<{
25
4
  readonly appearance: Schema.Literals<readonly ["answer", "construction", "highlight", "primary", "reference", "secondary", "warning"]>;
26
5
  readonly id: Schema.String;
27
6
  readonly center: Schema.Struct<{
@@ -123,28 +102,8 @@ export declare const SpaceMathObjectSchema: Schema.Union<readonly [Schema.Struct
123
102
  readonly y: Schema.Finite;
124
103
  readonly z: Schema.Finite;
125
104
  }>;
126
- }>, Schema.Struct<{
127
- readonly appearance: Schema.Literals<readonly ["answer", "construction", "highlight", "primary", "reference", "secondary", "warning"]>;
128
- readonly id: Schema.String;
129
- readonly kind: Schema.Literal<"spline">;
130
- readonly samples: Schema.TupleWithRest<Schema.Tuple<readonly [Schema.Struct<{
131
- readonly x: Schema.Finite;
132
- readonly y: Schema.Finite;
133
- readonly z: Schema.Finite;
134
- }>, Schema.Struct<{
135
- readonly x: Schema.Finite;
136
- readonly y: Schema.Finite;
137
- readonly z: Schema.Finite;
138
- }>, Schema.Struct<{
139
- readonly x: Schema.Finite;
140
- readonly y: Schema.Finite;
141
- readonly z: Schema.Finite;
142
- }>]>, readonly [Schema.Struct<{
143
- readonly x: Schema.Finite;
144
- readonly y: Schema.Finite;
145
- readonly z: Schema.Finite;
146
- }>]>;
147
105
  }>]>;
106
+ export type SpaceMathObject = typeof SpaceMathObjectSchema.Type;
148
107
  /** Exact Cartesian frame presented behind a space construction. */
149
108
  export declare const SpaceMathFrameSchema: Schema.Struct<{
150
109
  readonly axes: Schema.Literals<readonly ["hidden", "visible"]>;
@@ -163,6 +122,7 @@ export declare const SpaceMathFrameSchema: Schema.Struct<{
163
122
  readonly min: Schema.Finite;
164
123
  }>;
165
124
  }>;
125
+ export type SpaceMathFrame = typeof SpaceMathFrameSchema.Type;
166
126
  /** Minimal semantic views supported by one space scene. */
167
127
  export declare const SpaceMathViewSchema: Schema.Union<readonly [Schema.Struct<{
168
128
  readonly kind: Schema.Literal<"camera">;
@@ -197,6 +157,7 @@ export declare const SpaceLabelAnchorSchema: Schema.Struct<{
197
157
  readonly key: Schema.String;
198
158
  readonly placement: Schema.optionalKey<Schema.Literals<readonly ["above", "above-left", "above-right", "below", "below-left", "below-right", "center", "left", "right"]>>;
199
159
  }>;
160
+ export type SpaceLabelAnchor = typeof SpaceLabelAnchorSchema.Type;
200
161
  /** Complete stable space visual before rich labels are attached. */
201
162
  export declare const SpaceMathVisualSchema: Schema.Struct<{
202
163
  readonly frame: Schema.Struct<{
@@ -226,27 +187,6 @@ export declare const SpaceMathVisualSchema: Schema.Struct<{
226
187
  readonly placement: Schema.optionalKey<Schema.Literals<readonly ["above", "above-left", "above-right", "below", "below-left", "below-right", "center", "left", "right"]>>;
227
188
  }>>>;
228
189
  readonly objects: Schema.NonEmptyArray<Schema.Union<readonly [Schema.Struct<{
229
- readonly appearance: Schema.Literals<readonly ["answer", "construction", "highlight", "primary", "reference", "secondary", "warning"]>;
230
- readonly id: Schema.String;
231
- readonly kind: Schema.Literal<"closed-spline">;
232
- readonly samples: Schema.TupleWithRest<Schema.Tuple<readonly [Schema.Struct<{
233
- readonly x: Schema.Finite;
234
- readonly y: Schema.Finite;
235
- readonly z: Schema.Finite;
236
- }>, Schema.Struct<{
237
- readonly x: Schema.Finite;
238
- readonly y: Schema.Finite;
239
- readonly z: Schema.Finite;
240
- }>, Schema.Struct<{
241
- readonly x: Schema.Finite;
242
- readonly y: Schema.Finite;
243
- readonly z: Schema.Finite;
244
- }>]>, readonly [Schema.Struct<{
245
- readonly x: Schema.Finite;
246
- readonly y: Schema.Finite;
247
- readonly z: Schema.Finite;
248
- }>]>;
249
- }>, Schema.Struct<{
250
190
  readonly appearance: Schema.Literals<readonly ["answer", "construction", "highlight", "primary", "reference", "secondary", "warning"]>;
251
191
  readonly id: Schema.String;
252
192
  readonly center: Schema.Struct<{
@@ -348,27 +288,6 @@ export declare const SpaceMathVisualSchema: Schema.Struct<{
348
288
  readonly y: Schema.Finite;
349
289
  readonly z: Schema.Finite;
350
290
  }>;
351
- }>, Schema.Struct<{
352
- readonly appearance: Schema.Literals<readonly ["answer", "construction", "highlight", "primary", "reference", "secondary", "warning"]>;
353
- readonly id: Schema.String;
354
- readonly kind: Schema.Literal<"spline">;
355
- readonly samples: Schema.TupleWithRest<Schema.Tuple<readonly [Schema.Struct<{
356
- readonly x: Schema.Finite;
357
- readonly y: Schema.Finite;
358
- readonly z: Schema.Finite;
359
- }>, Schema.Struct<{
360
- readonly x: Schema.Finite;
361
- readonly y: Schema.Finite;
362
- readonly z: Schema.Finite;
363
- }>, Schema.Struct<{
364
- readonly x: Schema.Finite;
365
- readonly y: Schema.Finite;
366
- readonly z: Schema.Finite;
367
- }>]>, readonly [Schema.Struct<{
368
- readonly x: Schema.Finite;
369
- readonly y: Schema.Finite;
370
- readonly z: Schema.Finite;
371
- }>]>;
372
291
  }>]>>;
373
292
  readonly space: Schema.Literal<"space">;
374
293
  readonly view: Schema.Union<readonly [Schema.Struct<{
@@ -1,5 +1,6 @@
1
1
  import { Schema } from "effect";
2
2
  import { hasUniquePositions, MathAppearanceSchema, MathAxisRangeSchema, MathFeatureVisibilitySchema, MathLabelPlacementSchema, MathViewPaddingSchema, MathVisualKeySchema, mathVisualIdentityIssues, PositiveMeasureSchema, SpacePointSchema, sameSpacePoint, } from "#contracts/math/base";
3
+ import { spaceBoundsIssues } from "#contracts/math/bounds";
3
4
  import { hasCoplanarArea } from "#contracts/math/vector";
4
5
  const ObjectFields = {
5
6
  appearance: MathAppearanceSchema,
@@ -48,18 +49,6 @@ const SpacePolygonObjectSchema = Schema.Struct({
48
49
  hasCoplanarArea(vertices), {
49
50
  message: "Expected unique, coplanar vertices forming a non-degenerate polygon.",
50
51
  })));
51
- const SpaceSplineObjectSchema = Schema.Struct({
52
- ...ObjectFields,
53
- kind: Schema.Literal("spline"),
54
- samples: SpaceShapeSchema,
55
- }).pipe(Schema.check(Schema.makeFilter(({ samples }) => hasUniquePositions(samples, sameSpacePoint), { message: "Expected at least three unique spline samples." })));
56
- const SpaceClosedSplineObjectSchema = Schema.Struct({
57
- ...ObjectFields,
58
- kind: Schema.Literal("closed-spline"),
59
- samples: SpaceShapeSchema,
60
- }).pipe(Schema.check(Schema.makeFilter(({ samples }) => hasUniquePositions(samples, sameSpacePoint), {
61
- message: "Expected unique closed-spline samples without a repeated closing sample.",
62
- })));
63
52
  /**
64
53
  * Axis-aligned cuboid whose length spans x, height spans y, and width spans z.
65
54
  */
@@ -75,7 +64,6 @@ const SpaceCuboidObjectSchema = Schema.Struct({
75
64
  });
76
65
  /** Mathematical objects supported by a Cartesian space scene. */
77
66
  export const SpaceMathObjectSchema = Schema.Union([
78
- SpaceClosedSplineObjectSchema,
79
67
  SpaceCuboidObjectSchema,
80
68
  SpaceLineObjectSchema,
81
69
  SpacePointObjectSchema,
@@ -83,7 +71,6 @@ export const SpaceMathObjectSchema = Schema.Union([
83
71
  SpacePolylineObjectSchema,
84
72
  SpaceRayObjectSchema,
85
73
  SpaceSegmentObjectSchema,
86
- SpaceSplineObjectSchema,
87
74
  ]);
88
75
  /** Exact Cartesian frame presented behind a space construction. */
89
76
  export const SpaceMathFrameSchema = Schema.Struct({
@@ -126,4 +113,7 @@ export const SpaceMathVisualSchema = Schema.Struct({
126
113
  objects: Schema.NonEmptyArray(SpaceMathObjectSchema),
127
114
  space: Schema.Literal("space"),
128
115
  view: SpaceMathViewSchema,
129
- }).pipe(Schema.check(Schema.makeFilter(({ labels = [], objects }) => mathVisualIdentityIssues(objects, labels))));
116
+ }).pipe(Schema.check(Schema.makeFilter(({ frame, labels = [], objects }) => [
117
+ ...mathVisualIdentityIssues(objects, labels),
118
+ ...spaceBoundsIssues(frame, objects, labels),
119
+ ])));