@nakafa/aksara-contracts 0.48.4 → 0.48.6
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/dist/content.d.ts +2 -2
- package/dist/content.js +2 -1
- package/dist/delivery.d.ts +3 -0
- package/dist/delivery.js +5 -0
- package/dist/math/base.d.ts +6 -6
- package/dist/math/base.js +2 -0
- package/dist/math/collision.js +2 -1
- package/dist/math/coordinate.d.ts +3 -3
- package/dist/math/coordinate.js +3 -2
- package/dist/math/extent.js +2 -2
- package/dist/math/intersection.d.ts +2 -1
- package/dist/math/intersection.js +1 -0
- package/dist/math/object.d.ts +24 -0
- package/dist/math/object.js +27 -0
- package/dist/math/plane.js +16 -24
- package/dist/math/precision.d.ts +2 -2
- package/dist/math/resolution.js +10 -7
- package/dist/math/space.js +14 -22
- package/dist/projection/verify.d.ts +114 -114
- package/dist/projection/verify.js +13 -20
- package/dist/question/response.d.ts +20 -0
- package/dist/question/response.js +6 -3
- package/dist/question/rubric.js +4 -1
- package/dist/quran/notes.js +5 -6
- package/dist/quran/provenance.js +1 -1
- package/dist/quran/snapshot/row.d.ts +2 -0
- package/dist/quran/snapshot/row.js +3 -1
- package/dist/release/head.js +15 -33
- package/dist/release/items.js +14 -18
- package/dist/release/mismatch.d.ts +12 -0
- package/dist/release/mismatch.js +14 -0
- package/dist/release/result/digest.js +8 -17
- package/dist/release/rollback/digest.js +3 -10
- package/dist/release/route/verify.d.ts +1 -1
- package/dist/release/route/verify.js +8 -11
- package/dist/release/snapshot/evidence/requirement.d.ts +2 -1
- package/dist/release/snapshot/evidence/requirement.js +2 -1
- package/dist/release/snapshot/spec.d.ts +4 -1
- package/dist/release/snapshot/spec.js +6 -1
- package/dist/release/snapshot/verify.d.ts +52 -52
- package/dist/runtime/protected/spec.js +4 -3
- package/dist/runtime/spec.d.ts +23 -23
- package/dist/runtime/verify.d.ts +30 -30
- package/dist/runtime/verify.js +10 -9
- package/dist/transport/group.js +2 -5
- package/dist/transport/request.d.ts +4442 -4442
- package/dist/transport/response.d.ts +56 -56
- package/dist/transport/response.js +22 -105
- package/dist/transport/success.d.ts +12 -0
- package/dist/transport/success.js +13 -0
- package/dist/tryout/catalog.d.ts +2 -0
- package/dist/tryout/catalog.js +5 -1
- package/dist/tryout/hash/catalog.d.ts +23 -23
- package/dist/tryout/scoring.d.ts +113 -8
- package/package.json +1 -1
package/dist/content.d.ts
CHANGED
|
@@ -9,7 +9,8 @@ export declare const ContentAuthorSchema: Schema.Struct<{
|
|
|
9
9
|
readonly name: Schema.String;
|
|
10
10
|
}>;
|
|
11
11
|
export type ContentAuthor = typeof ContentAuthorSchema.Type;
|
|
12
|
-
|
|
12
|
+
/** Language-specific content head identity that artifacts and heads share. */
|
|
13
|
+
export declare const ContentHeadIdentitySchema: Schema.Struct<{
|
|
13
14
|
readonly artifactLocale: Schema.brand<Schema.Literals<readonly ["en", "id", "de"]>, "@NakafaAI/AksaraArtifactLocale">;
|
|
14
15
|
readonly contentKey: Schema.brand<Schema.String, "@NakafaAI/AksaraContentKey">;
|
|
15
16
|
}>;
|
|
@@ -127,4 +128,3 @@ export declare const decodeCompileDocumentSource: (input: unknown) => Effect.Eff
|
|
|
127
128
|
readonly rendererDomain: "ai-ds" | "biology" | "chemistry" | "mathematics" | "physics" | "politics" | "site" | "snbt-general" | "snbt-math" | "snbt-plain" | "snbt-quant" | "tka-math";
|
|
128
129
|
readonly sourcePath: string & import("effect/Brand").Brand<"@NakafaAI/AksaraCorpusSourcePath">;
|
|
129
130
|
}, import("./errors.js").ContractDecodeError, never>;
|
|
130
|
-
export {};
|
package/dist/content.js
CHANGED
|
@@ -16,7 +16,8 @@ export const ContentFamilySchema = Schema.Literals([
|
|
|
16
16
|
]);
|
|
17
17
|
/** Exact authored person identity exposed by Nakafa content metadata. */
|
|
18
18
|
export const ContentAuthorSchema = Schema.Struct({ name: Schema.String });
|
|
19
|
-
|
|
19
|
+
/** Language-specific content head identity that artifacts and heads share. */
|
|
20
|
+
export const ContentHeadIdentitySchema = Schema.Struct({
|
|
20
21
|
artifactLocale: ArtifactLocaleSchema,
|
|
21
22
|
contentKey: ContentKeySchema,
|
|
22
23
|
});
|
package/dist/delivery.d.ts
CHANGED
|
@@ -2,3 +2,6 @@ import { Schema } from "effect";
|
|
|
2
2
|
/** Access boundary enforced before any published artifact body is returned. */
|
|
3
3
|
export declare const ContentDeliveryClassSchema: Schema.Literals<readonly ["public", "authenticated", "entitled"]>;
|
|
4
4
|
export type ContentDeliveryClass = typeof ContentDeliveryClassSchema.Type;
|
|
5
|
+
/** Delivery classes whose artifact bodies need a product-authorized runtime read. */
|
|
6
|
+
export declare const ProtectedContentDeliverySchema: Schema.Literals<readonly ["authenticated", "entitled"]>;
|
|
7
|
+
export type ProtectedContentDelivery = typeof ProtectedContentDeliverySchema.Type;
|
package/dist/delivery.js
CHANGED
|
@@ -5,3 +5,8 @@ export const ContentDeliveryClassSchema = Schema.Literals([
|
|
|
5
5
|
"authenticated",
|
|
6
6
|
"entitled",
|
|
7
7
|
]);
|
|
8
|
+
/** Delivery classes whose artifact bodies need a product-authorized runtime read. */
|
|
9
|
+
export const ProtectedContentDeliverySchema = ContentDeliveryClassSchema.pick([
|
|
10
|
+
"authenticated",
|
|
11
|
+
"entitled",
|
|
12
|
+
]);
|
package/dist/math/base.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
|
+
import type { PlaneLabelAnchor, PlaneMathObject } from "#contracts/math/plane";
|
|
3
|
+
import type { SpaceLabelAnchor, SpaceMathObject } from "#contracts/math/space";
|
|
2
4
|
/** Relative floating-point tolerance used by normalized geometry predicates. */
|
|
3
5
|
export declare const GEOMETRY_TOLERANCE: number;
|
|
4
6
|
/** Stable source identity shared by visual objects and rich-label anchors. */
|
|
@@ -16,6 +18,9 @@ export declare const SpacePointSchema: Schema.Struct<{
|
|
|
16
18
|
readonly z: Schema.Finite;
|
|
17
19
|
}>;
|
|
18
20
|
export type SpacePoint = typeof SpacePointSchema.Type;
|
|
21
|
+
/** Cartesian axis names shared by scene coordinates, frames, and resolution. */
|
|
22
|
+
export declare const SceneAxisSchema: Schema.Literals<readonly ["x", "y", "z"]>;
|
|
23
|
+
export type SceneAxis = typeof SceneAxisSchema.Type;
|
|
19
24
|
/** Ordered visible interval for one Cartesian axis. */
|
|
20
25
|
export declare const MathAxisRangeSchema: Schema.Struct<{
|
|
21
26
|
readonly max: Schema.Finite;
|
|
@@ -38,11 +43,6 @@ export declare function samePlanePoint(left: PlanePoint, right: PlanePoint): boo
|
|
|
38
43
|
/** Returns whether two space positions are exactly the same authored point. */
|
|
39
44
|
export declare function sameSpacePoint(left: SpacePoint, right: SpacePoint): boolean;
|
|
40
45
|
/** Reports every repeated scene identity at its exact authored key path. */
|
|
41
|
-
export declare function mathVisualIdentityIssues(objects: readonly
|
|
42
|
-
readonly id: string;
|
|
43
|
-
}[], labels: readonly {
|
|
44
|
-
readonly key: string;
|
|
45
|
-
readonly objectId: string;
|
|
46
|
-
}[]): readonly Schema.FilterIssue[];
|
|
46
|
+
export declare function mathVisualIdentityIssues(objects: readonly Pick<PlaneMathObject | SpaceMathObject, "id">[], labels: readonly Pick<PlaneLabelAnchor | SpaceLabelAnchor, "key" | "objectId">[]): readonly Schema.FilterIssue[];
|
|
47
47
|
/** Checks that an authored coordinate sequence contains no repeated position. */
|
|
48
48
|
export declare function hasUniquePositions<T>(values: readonly T[], same: (left: T, right: T) => boolean): boolean;
|
package/dist/math/base.js
CHANGED
|
@@ -17,6 +17,8 @@ export const SpacePointSchema = Schema.Struct({
|
|
|
17
17
|
y: Schema.Finite,
|
|
18
18
|
z: Schema.Finite,
|
|
19
19
|
});
|
|
20
|
+
/** Cartesian axis names shared by scene coordinates, frames, and resolution. */
|
|
21
|
+
export const SceneAxisSchema = Schema.Literals(["x", "y", "z"]);
|
|
20
22
|
/** Ordered visible interval for one Cartesian axis. */
|
|
21
23
|
export const MathAxisRangeSchema = Schema.Struct({
|
|
22
24
|
max: Schema.Finite,
|
package/dist/math/collision.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Array as Arr, MutableHashMap, MutableHashSet, Record as Rec, } from "effect";
|
|
2
|
+
import { SceneAxisSchema } from "#contracts/math/base";
|
|
2
3
|
import { unresolvedProximityIndexes } from "#contracts/math/proximity";
|
|
3
4
|
import { numberRatio } from "#contracts/math/rational";
|
|
4
5
|
import { radialGeometryPath } from "#contracts/math/scene";
|
|
@@ -13,7 +14,7 @@ function uniquePaths(paths) {
|
|
|
13
14
|
}
|
|
14
15
|
/** Finds reportable scene coordinates that collapse on the same axis. */
|
|
15
16
|
export function coordinateCollisionPaths(coordinates, threshold) {
|
|
16
|
-
const axes =
|
|
17
|
+
const axes = SceneAxisSchema.literals;
|
|
17
18
|
return uniquePaths(Arr.flatMap(axes, (axis) => {
|
|
18
19
|
const entries = Arr.filter(coordinates, (entry) => entry.axis === axis);
|
|
19
20
|
const unresolved = unresolvedProximityIndexes(entries, threshold);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { type BigDecimal, Schema } from "effect";
|
|
2
|
-
import type
|
|
2
|
+
import { type PlanePoint, type SceneAxis, type SpacePoint } from "#contracts/math/base";
|
|
3
|
+
import { type InfinitePathKind } from "#contracts/math/intersection";
|
|
3
4
|
import type { PlaneMathFrame } from "#contracts/math/plane";
|
|
4
5
|
import { type RenderThreshold } from "#contracts/math/precision";
|
|
5
6
|
import { type ExactRatio } from "#contracts/math/rational";
|
|
6
7
|
import type { SpaceMathFrame } from "#contracts/math/space";
|
|
7
|
-
export type SceneAxis = "x" | "y" | "z";
|
|
8
8
|
export declare const ScenePathSchema: Schema.mutable<Schema.$Array<Schema.Union<readonly [Schema.Finite, Schema.String]>>>;
|
|
9
9
|
export type ScenePath = typeof ScenePathSchema.Type;
|
|
10
10
|
/** One ordered exact coordinate projected from a complete visual scene. */
|
|
@@ -39,5 +39,5 @@ export declare function frameCoordinates(frame: SceneFrame): SceneCoordinate[];
|
|
|
39
39
|
/** Maps one directed path onto every axis of its authored frame. */
|
|
40
40
|
export declare function pathAxes(frame: SceneFrame, from: PlanePoint | SpacePoint, through: PlanePoint | SpacePoint): SceneAxisTraversal[];
|
|
41
41
|
/** Projects the canonical exact endpoints of one frame-clipped line or ray. */
|
|
42
|
-
export declare function clippedPathCoordinates(frame: SceneFrame, kind:
|
|
42
|
+
export declare function clippedPathCoordinates(frame: SceneFrame, kind: InfinitePathKind, from: PlanePoint | SpacePoint, through: PlanePoint | SpacePoint, path: ScenePath, threshold: RenderThreshold): SceneCoordinate[];
|
|
43
43
|
export {};
|
package/dist/math/coordinate.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { Array as Arr, Schema } from "effect";
|
|
2
|
+
import { SceneAxisSchema, } from "#contracts/math/base";
|
|
2
3
|
import { AxisTraversalSchema, infinitePathInterval, } from "#contracts/math/intersection";
|
|
3
4
|
import { visiblePathResolvable, } from "#contracts/math/precision";
|
|
4
5
|
import { affineRatio, ExactRatioSchema, numberRatio, } from "#contracts/math/rational";
|
|
5
6
|
export const ScenePathSchema = Schema.mutable(Schema.Array(Schema.Union([Schema.Finite, Schema.String])));
|
|
6
7
|
/** One ordered exact coordinate projected from a complete visual scene. */
|
|
7
8
|
const SceneCoordinateSchema = Schema.Struct({
|
|
8
|
-
axis:
|
|
9
|
+
axis: SceneAxisSchema,
|
|
9
10
|
error: Schema.optionalKey(Schema.BigDecimal),
|
|
10
11
|
path: ScenePathSchema,
|
|
11
12
|
reportable: Schema.Boolean,
|
|
@@ -13,7 +14,7 @@ const SceneCoordinateSchema = Schema.Struct({
|
|
|
13
14
|
});
|
|
14
15
|
const SceneAxisTraversalSchema = Schema.Struct({
|
|
15
16
|
...AxisTraversalSchema.fields,
|
|
16
|
-
axis:
|
|
17
|
+
axis: SceneAxisSchema,
|
|
17
18
|
});
|
|
18
19
|
/** Creates one reportable exact scene coordinate. */
|
|
19
20
|
export function sceneCoordinate(axis, path, value, reportable = true, error) {
|
package/dist/math/extent.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Array as Arr, BigDecimal, Schema } from "effect";
|
|
2
|
-
import { GEOMETRY_TOLERANCE } from "#contracts/math/base";
|
|
2
|
+
import { GEOMETRY_TOLERANCE, SceneAxisSchema } from "#contracts/math/base";
|
|
3
3
|
import { decimal, decimalRatio, ExactRatioSchema, makeRatio, numberRatio, ratioInRange, } from "#contracts/math/rational";
|
|
4
4
|
const ZERO = BigDecimal.fromBigInt(0n);
|
|
5
5
|
/** Checks one finite coordinate against its inclusive authored range. */
|
|
@@ -119,7 +119,7 @@ export function quadraticContained(frame, object) {
|
|
|
119
119
|
return Arr.every(quadraticExtrema(object), ({ output }) => ratioInRange(output, outputRange.min, outputRange.max));
|
|
120
120
|
}
|
|
121
121
|
const CuboidExtentSchema = Schema.Struct({
|
|
122
|
-
axis:
|
|
122
|
+
axis: SceneAxisSchema,
|
|
123
123
|
center: Schema.Finite,
|
|
124
124
|
dimension: Schema.Literals(["height", "length", "width"]),
|
|
125
125
|
extent: Schema.BigDecimal,
|
|
@@ -9,7 +9,8 @@ export declare const AxisTraversalSchema: Schema.Struct<{
|
|
|
9
9
|
readonly through: Schema.Finite;
|
|
10
10
|
}>;
|
|
11
11
|
export type AxisTraversal = typeof AxisTraversalSchema.Type;
|
|
12
|
-
|
|
12
|
+
declare const InfinitePathKindSchema: Schema.Literals<readonly ["line", "ray"]>;
|
|
13
|
+
export type InfinitePathKind = typeof InfinitePathKindSchema.Type;
|
|
13
14
|
/** Exact finite sides of one clipped infinite path parameter interval. */
|
|
14
15
|
declare const InfinitePathIntervalSchema: Schema.Struct<{
|
|
15
16
|
readonly entry: Schema.UndefinedOr<Schema.Struct<{
|
|
@@ -8,6 +8,7 @@ export const AxisTraversalSchema = Schema.Struct({
|
|
|
8
8
|
start: Schema.Finite,
|
|
9
9
|
through: Schema.Finite,
|
|
10
10
|
});
|
|
11
|
+
const InfinitePathKindSchema = Schema.Literals(["line", "ray"]);
|
|
11
12
|
/** Exact finite sides of one clipped infinite path parameter interval. */
|
|
12
13
|
const InfinitePathIntervalSchema = Schema.Struct({
|
|
13
14
|
entry: Schema.UndefinedOr(ExactRatioSchema),
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
/** Fields that every visual object shares, whatever its Cartesian dimension. */
|
|
3
|
+
export declare const MathObjectFields: {
|
|
4
|
+
appearance: Schema.Literals<readonly ["answer", "construction", "highlight", "primary", "reference", "secondary", "warning"]>;
|
|
5
|
+
id: Schema.String;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Fields that every rich-label anchor shares. Each dimension supplies its own
|
|
9
|
+
* point schema, so the struct built from these fields stays fully typed.
|
|
10
|
+
*/
|
|
11
|
+
export declare function mathLabelAnchorFields<Point extends Schema.Top>(at: Point): {
|
|
12
|
+
readonly at: Point;
|
|
13
|
+
readonly key: Schema.String;
|
|
14
|
+
readonly objectId: Schema.String;
|
|
15
|
+
readonly placement: Schema.optionalKey<Schema.Literals<readonly ["above", "above-left", "above-right", "below", "below-left", "below-right", "center", "left", "right"]>>;
|
|
16
|
+
};
|
|
17
|
+
/** Message for a line whose two authored positions coincide. */
|
|
18
|
+
export declare const MATH_LINE_MESSAGE = "Expected a line through two distinct positions.";
|
|
19
|
+
/** Message for a polyline that repeats one authored position. */
|
|
20
|
+
export declare const MATH_POLYLINE_MESSAGE = "Expected unique polyline vertices.";
|
|
21
|
+
/** Message for a ray whose origin and through position coincide. */
|
|
22
|
+
export declare const MATH_RAY_MESSAGE = "Expected a ray through a position distinct from its start.";
|
|
23
|
+
/** Message for a segment whose two ends coincide. */
|
|
24
|
+
export declare const MATH_SEGMENT_MESSAGE = "Expected a segment with distinct ends.";
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import { MathAppearanceSchema, MathLabelPlacementSchema, MathVisualKeySchema, } from "#contracts/math/base";
|
|
3
|
+
/** Fields that every visual object shares, whatever its Cartesian dimension. */
|
|
4
|
+
export const MathObjectFields = {
|
|
5
|
+
appearance: MathAppearanceSchema,
|
|
6
|
+
id: MathVisualKeySchema,
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Fields that every rich-label anchor shares. Each dimension supplies its own
|
|
10
|
+
* point schema, so the struct built from these fields stays fully typed.
|
|
11
|
+
*/
|
|
12
|
+
export function mathLabelAnchorFields(at) {
|
|
13
|
+
return {
|
|
14
|
+
at,
|
|
15
|
+
key: MathVisualKeySchema,
|
|
16
|
+
objectId: MathVisualKeySchema,
|
|
17
|
+
placement: Schema.optionalKey(MathLabelPlacementSchema),
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
/** Message for a line whose two authored positions coincide. */
|
|
21
|
+
export const MATH_LINE_MESSAGE = "Expected a line through two distinct positions.";
|
|
22
|
+
/** Message for a polyline that repeats one authored position. */
|
|
23
|
+
export const MATH_POLYLINE_MESSAGE = "Expected unique polyline vertices.";
|
|
24
|
+
/** Message for a ray whose origin and through position coincide. */
|
|
25
|
+
export const MATH_RAY_MESSAGE = "Expected a ray through a position distinct from its start.";
|
|
26
|
+
/** Message for a segment whose two ends coincide. */
|
|
27
|
+
export const MATH_SEGMENT_MESSAGE = "Expected a segment with distinct ends.";
|
package/dist/math/plane.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import { Array as Arr, Schema } from "effect";
|
|
2
|
-
import { ArcStartDegreesSchema, ArcSweepDegreesSchema, GEOMETRY_TOLERANCE, hasUniquePositions,
|
|
2
|
+
import { ArcStartDegreesSchema, ArcSweepDegreesSchema, GEOMETRY_TOLERANCE, hasUniquePositions, MathAxisRangeSchema, MathViewPaddingSchema, mathVisualIdentityIssues, PlanePointSchema, PositiveMeasureSchema, samePlanePoint, } from "#contracts/math/base";
|
|
3
3
|
import { planeBoundsIssues } from "#contracts/math/bounds";
|
|
4
|
+
import { MATH_LINE_MESSAGE, MATH_POLYLINE_MESSAGE, MATH_RAY_MESSAGE, MATH_SEGMENT_MESSAGE, MathObjectFields, mathLabelAnchorFields, } from "#contracts/math/object";
|
|
4
5
|
import { planeResolutionIssues } from "#contracts/math/resolution";
|
|
5
|
-
const ObjectFields = {
|
|
6
|
-
appearance: MathAppearanceSchema,
|
|
7
|
-
id: MathVisualKeySchema,
|
|
8
|
-
};
|
|
9
6
|
/** Checks a plane polygon has non-zero signed area. */
|
|
10
7
|
function hasPlaneArea(vertices) {
|
|
11
8
|
const offsets = normalizedPlaneOffsets(vertices);
|
|
@@ -46,53 +43,53 @@ function normalizedPlaneOffsets(vertices) {
|
|
|
46
43
|
return Arr.map(offsets, ({ x, y }) => ({ x: x / divisor, y: y / divisor }));
|
|
47
44
|
}
|
|
48
45
|
const PlanePointObjectSchema = Schema.Struct({
|
|
49
|
-
...
|
|
46
|
+
...MathObjectFields,
|
|
50
47
|
at: PlanePointSchema,
|
|
51
48
|
kind: Schema.Literal("point"),
|
|
52
49
|
});
|
|
53
50
|
const PlanePathSchema = Schema.TupleWithRest(Schema.Tuple([PlanePointSchema, PlanePointSchema]), [PlanePointSchema]);
|
|
54
51
|
const PlaneShapeSchema = Schema.TupleWithRest(Schema.Tuple([PlanePointSchema, PlanePointSchema, PlanePointSchema]), [PlanePointSchema]);
|
|
55
52
|
const PlaneLineObjectSchema = Schema.Struct({
|
|
56
|
-
...
|
|
53
|
+
...MathObjectFields,
|
|
57
54
|
kind: Schema.Literal("line"),
|
|
58
55
|
through: Schema.Tuple([PlanePointSchema, PlanePointSchema]),
|
|
59
56
|
}).pipe(Schema.check(Schema.makeFilter(({ through: [from, to] }) => !samePlanePoint(from, to), {
|
|
60
|
-
message:
|
|
57
|
+
message: MATH_LINE_MESSAGE,
|
|
61
58
|
})));
|
|
62
59
|
const PlaneRayObjectSchema = Schema.Struct({
|
|
63
|
-
...
|
|
60
|
+
...MathObjectFields,
|
|
64
61
|
from: PlanePointSchema,
|
|
65
62
|
kind: Schema.Literal("ray"),
|
|
66
63
|
through: PlanePointSchema,
|
|
67
64
|
}).pipe(Schema.check(Schema.makeFilter(({ from, through }) => !samePlanePoint(from, through), {
|
|
68
|
-
message:
|
|
65
|
+
message: MATH_RAY_MESSAGE,
|
|
69
66
|
})));
|
|
70
67
|
const PlaneSegmentObjectSchema = Schema.Struct({
|
|
71
|
-
...
|
|
68
|
+
...MathObjectFields,
|
|
72
69
|
from: PlanePointSchema,
|
|
73
70
|
kind: Schema.Literal("segment"),
|
|
74
71
|
to: PlanePointSchema,
|
|
75
72
|
}).pipe(Schema.check(Schema.makeFilter(({ from, to }) => !samePlanePoint(from, to), {
|
|
76
|
-
message:
|
|
73
|
+
message: MATH_SEGMENT_MESSAGE,
|
|
77
74
|
})));
|
|
78
75
|
const PlanePolylineObjectSchema = Schema.Struct({
|
|
79
|
-
...
|
|
76
|
+
...MathObjectFields,
|
|
80
77
|
kind: Schema.Literal("polyline"),
|
|
81
78
|
vertices: PlanePathSchema,
|
|
82
|
-
}).pipe(Schema.check(Schema.makeFilter(({ vertices }) => hasUniquePositions(vertices, samePlanePoint), { message:
|
|
79
|
+
}).pipe(Schema.check(Schema.makeFilter(({ vertices }) => hasUniquePositions(vertices, samePlanePoint), { message: MATH_POLYLINE_MESSAGE })));
|
|
83
80
|
const PlanePolygonObjectSchema = Schema.Struct({
|
|
84
|
-
...
|
|
81
|
+
...MathObjectFields,
|
|
85
82
|
kind: Schema.Literal("polygon"),
|
|
86
83
|
vertices: PlaneShapeSchema,
|
|
87
84
|
}).pipe(Schema.check(Schema.makeFilter(({ vertices }) => hasUniquePositions(vertices, samePlanePoint) && hasPlaneArea(vertices), { message: "Expected unique vertices forming a non-degenerate polygon." })));
|
|
88
85
|
const PlaneCircleObjectSchema = Schema.Struct({
|
|
89
|
-
...
|
|
86
|
+
...MathObjectFields,
|
|
90
87
|
center: PlanePointSchema,
|
|
91
88
|
kind: Schema.Literal("circle"),
|
|
92
89
|
radius: PositiveMeasureSchema,
|
|
93
90
|
});
|
|
94
91
|
const PlaneArcObjectSchema = Schema.Struct({
|
|
95
|
-
...
|
|
92
|
+
...MathObjectFields,
|
|
96
93
|
center: PlanePointSchema,
|
|
97
94
|
kind: Schema.Literal("arc"),
|
|
98
95
|
radius: PositiveMeasureSchema,
|
|
@@ -100,7 +97,7 @@ const PlaneArcObjectSchema = Schema.Struct({
|
|
|
100
97
|
sweepDegrees: ArcSweepDegreesSchema,
|
|
101
98
|
});
|
|
102
99
|
const PlaneQuadraticObjectSchema = Schema.Struct({
|
|
103
|
-
...
|
|
100
|
+
...MathObjectFields,
|
|
104
101
|
coefficients: Schema.Struct({
|
|
105
102
|
a: Schema.Finite.pipe(Schema.check(Schema.makeFilter((value) => value !== 0, {
|
|
106
103
|
message: "Expected a non-zero quadratic coefficient.",
|
|
@@ -136,12 +133,7 @@ export const PlaneMathViewSchema = Schema.Struct({
|
|
|
136
133
|
padding: Schema.optionalKey(MathViewPaddingSchema),
|
|
137
134
|
});
|
|
138
135
|
/** One coordinate anchor resolved against a separate rich-label map. */
|
|
139
|
-
export const PlaneLabelAnchorSchema = Schema.Struct(
|
|
140
|
-
at: PlanePointSchema,
|
|
141
|
-
key: MathVisualKeySchema,
|
|
142
|
-
objectId: MathVisualKeySchema,
|
|
143
|
-
placement: Schema.optionalKey(MathLabelPlacementSchema),
|
|
144
|
-
});
|
|
136
|
+
export const PlaneLabelAnchorSchema = Schema.Struct(mathLabelAnchorFields(PlanePointSchema));
|
|
145
137
|
/** Complete stable plane visual before rich labels are attached. */
|
|
146
138
|
export const PlaneMathVisualSchema = Schema.Struct({
|
|
147
139
|
frame: PlaneMathFrameSchema,
|
package/dist/math/precision.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BigDecimal } from "effect";
|
|
2
2
|
import type { PlanePoint, SpacePoint } from "#contracts/math/base";
|
|
3
3
|
import type { AxisRange } from "#contracts/math/extent";
|
|
4
|
-
import { type AxisTraversal } from "#contracts/math/intersection";
|
|
4
|
+
import { type AxisTraversal, type InfinitePathKind } from "#contracts/math/intersection";
|
|
5
5
|
export type RenderThreshold = BigDecimal.BigDecimal;
|
|
6
6
|
/** Returns the exact width of one finite authored axis. */
|
|
7
7
|
export declare function axisSpan(range: AxisRange): BigDecimal.BigDecimal;
|
|
@@ -14,7 +14,7 @@ export declare function renderThreshold(ranges: readonly [AxisRange, AxisRange,
|
|
|
14
14
|
/** Includes both view coordinates, their separation, and one frame axis. */
|
|
15
15
|
export declare function axisEnvelopePairs(range: AxisRange, left: number, right: number): readonly (readonly [number, number])[];
|
|
16
16
|
/** Checks that the frame-visible portion of one infinite path remains visible. */
|
|
17
|
-
export declare function visiblePathResolvable(kind:
|
|
17
|
+
export declare function visiblePathResolvable(kind: InfinitePathKind, axes: readonly AxisTraversal[], threshold: RenderThreshold): boolean;
|
|
18
18
|
/** Checks whether any non-zero polygon altitude collapses in the renderer. */
|
|
19
19
|
export declare function polygonAltitudeUnresolved(vertices: readonly [
|
|
20
20
|
PlanePoint | SpacePoint,
|
package/dist/math/resolution.js
CHANGED
|
@@ -74,17 +74,20 @@ function planeObjectIssues(frame, object, index, threshold) {
|
|
|
74
74
|
}
|
|
75
75
|
return objectResolutionIssues(frame, object, index, threshold);
|
|
76
76
|
}
|
|
77
|
-
/**
|
|
77
|
+
/**
|
|
78
|
+
* Reports every frame axis whose non-zero span collapses in the envelope. Each
|
|
79
|
+
* entry pairs one axis with its range.
|
|
80
|
+
*/
|
|
78
81
|
function frameIssues(entries, threshold) {
|
|
79
|
-
return Arr.flatMap(entries, (
|
|
82
|
+
return Arr.flatMap(entries, ([axis, range]) => spanUnresolved(range, threshold) ? [issue(["frame", axis])] : []);
|
|
80
83
|
}
|
|
81
84
|
/** Reports every plane delta that a normalized renderer cannot preserve. */
|
|
82
85
|
export function planeResolutionIssues(frame, objects, labels, view) {
|
|
83
86
|
const threshold = renderThreshold([frame.x, frame.y], view.padding ?? 0);
|
|
84
87
|
return uniqueIssues([
|
|
85
88
|
...frameIssues([
|
|
86
|
-
|
|
87
|
-
|
|
89
|
+
["x", frame.x],
|
|
90
|
+
["y", frame.y],
|
|
88
91
|
], threshold),
|
|
89
92
|
...measureIssue(view.padding ?? 0, threshold, ["view", "padding"]),
|
|
90
93
|
...Arr.map(coordinateCollisionPaths(planeSceneCoordinates(frame, objects, labels, threshold), threshold), issue),
|
|
@@ -104,9 +107,9 @@ export function spaceResolutionIssues(frame, objects, labels, view) {
|
|
|
104
107
|
const threshold = renderThreshold([frame.x, frame.y, frame.z], view.kind === "fit" ? (view.padding ?? 0) : 0, envelopePairs);
|
|
105
108
|
return uniqueIssues([
|
|
106
109
|
...frameIssues([
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
+
["x", frame.x],
|
|
111
|
+
["y", frame.y],
|
|
112
|
+
["z", frame.z],
|
|
110
113
|
], threshold),
|
|
111
114
|
...measureIssue(view.kind === "fit" ? (view.padding ?? 0) : 0, threshold, [
|
|
112
115
|
"view",
|
package/dist/math/space.js
CHANGED
|
@@ -1,49 +1,46 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
|
-
import { hasUniquePositions,
|
|
2
|
+
import { hasUniquePositions, MathAxisRangeSchema, MathViewPaddingSchema, mathVisualIdentityIssues, PositiveMeasureSchema, SpacePointSchema, sameSpacePoint, } from "#contracts/math/base";
|
|
3
3
|
import { spaceBoundsIssues } from "#contracts/math/bounds";
|
|
4
|
+
import { MATH_LINE_MESSAGE, MATH_POLYLINE_MESSAGE, MATH_RAY_MESSAGE, MATH_SEGMENT_MESSAGE, MathObjectFields, mathLabelAnchorFields, } from "#contracts/math/object";
|
|
4
5
|
import { spaceResolutionIssues } from "#contracts/math/resolution";
|
|
5
6
|
import { hasCoplanarArea } from "#contracts/math/vector";
|
|
6
|
-
const ObjectFields = {
|
|
7
|
-
appearance: MathAppearanceSchema,
|
|
8
|
-
id: MathVisualKeySchema,
|
|
9
|
-
};
|
|
10
7
|
const SpacePointObjectSchema = Schema.Struct({
|
|
11
|
-
...
|
|
8
|
+
...MathObjectFields,
|
|
12
9
|
at: SpacePointSchema,
|
|
13
10
|
kind: Schema.Literal("point"),
|
|
14
11
|
});
|
|
15
12
|
const SpacePathSchema = Schema.TupleWithRest(Schema.Tuple([SpacePointSchema, SpacePointSchema]), [SpacePointSchema]);
|
|
16
13
|
const SpaceShapeSchema = Schema.TupleWithRest(Schema.Tuple([SpacePointSchema, SpacePointSchema, SpacePointSchema]), [SpacePointSchema]);
|
|
17
14
|
const SpaceLineObjectSchema = Schema.Struct({
|
|
18
|
-
...
|
|
15
|
+
...MathObjectFields,
|
|
19
16
|
kind: Schema.Literal("line"),
|
|
20
17
|
through: Schema.Tuple([SpacePointSchema, SpacePointSchema]),
|
|
21
18
|
}).pipe(Schema.check(Schema.makeFilter(({ through: [from, to] }) => !sameSpacePoint(from, to), {
|
|
22
|
-
message:
|
|
19
|
+
message: MATH_LINE_MESSAGE,
|
|
23
20
|
})));
|
|
24
21
|
const SpaceRayObjectSchema = Schema.Struct({
|
|
25
|
-
...
|
|
22
|
+
...MathObjectFields,
|
|
26
23
|
from: SpacePointSchema,
|
|
27
24
|
kind: Schema.Literal("ray"),
|
|
28
25
|
through: SpacePointSchema,
|
|
29
26
|
}).pipe(Schema.check(Schema.makeFilter(({ from, through }) => !sameSpacePoint(from, through), {
|
|
30
|
-
message:
|
|
27
|
+
message: MATH_RAY_MESSAGE,
|
|
31
28
|
})));
|
|
32
29
|
const SpaceSegmentObjectSchema = Schema.Struct({
|
|
33
|
-
...
|
|
30
|
+
...MathObjectFields,
|
|
34
31
|
from: SpacePointSchema,
|
|
35
32
|
kind: Schema.Literal("segment"),
|
|
36
33
|
to: SpacePointSchema,
|
|
37
34
|
}).pipe(Schema.check(Schema.makeFilter(({ from, to }) => !sameSpacePoint(from, to), {
|
|
38
|
-
message:
|
|
35
|
+
message: MATH_SEGMENT_MESSAGE,
|
|
39
36
|
})));
|
|
40
37
|
const SpacePolylineObjectSchema = Schema.Struct({
|
|
41
|
-
...
|
|
38
|
+
...MathObjectFields,
|
|
42
39
|
kind: Schema.Literal("polyline"),
|
|
43
40
|
vertices: SpacePathSchema,
|
|
44
|
-
}).pipe(Schema.check(Schema.makeFilter(({ vertices }) => hasUniquePositions(vertices, sameSpacePoint), { message:
|
|
41
|
+
}).pipe(Schema.check(Schema.makeFilter(({ vertices }) => hasUniquePositions(vertices, sameSpacePoint), { message: MATH_POLYLINE_MESSAGE })));
|
|
45
42
|
const SpacePolygonObjectSchema = Schema.Struct({
|
|
46
|
-
...
|
|
43
|
+
...MathObjectFields,
|
|
47
44
|
kind: Schema.Literal("polygon"),
|
|
48
45
|
vertices: SpaceShapeSchema,
|
|
49
46
|
}).pipe(Schema.check(Schema.makeFilter(({ vertices }) => hasUniquePositions(vertices, sameSpacePoint) &&
|
|
@@ -54,7 +51,7 @@ const SpacePolygonObjectSchema = Schema.Struct({
|
|
|
54
51
|
* Axis-aligned cuboid whose length spans x, height spans y, and width spans z.
|
|
55
52
|
*/
|
|
56
53
|
const SpaceCuboidObjectSchema = Schema.Struct({
|
|
57
|
-
...
|
|
54
|
+
...MathObjectFields,
|
|
58
55
|
center: SpacePointSchema,
|
|
59
56
|
kind: Schema.Literal("cuboid"),
|
|
60
57
|
size: Schema.Struct({
|
|
@@ -100,12 +97,7 @@ export const SpaceMathViewSchema = Schema.Union([
|
|
|
100
97
|
SpaceIsometricViewSchema,
|
|
101
98
|
]);
|
|
102
99
|
/** One coordinate anchor resolved against a separate rich-label map. */
|
|
103
|
-
export const SpaceLabelAnchorSchema = Schema.Struct(
|
|
104
|
-
at: SpacePointSchema,
|
|
105
|
-
key: MathVisualKeySchema,
|
|
106
|
-
objectId: MathVisualKeySchema,
|
|
107
|
-
placement: Schema.optionalKey(MathLabelPlacementSchema),
|
|
108
|
-
});
|
|
100
|
+
export const SpaceLabelAnchorSchema = Schema.Struct(mathLabelAnchorFields(SpacePointSchema));
|
|
109
101
|
/** Complete stable space visual before rich labels are attached. */
|
|
110
102
|
export const SpaceMathVisualSchema = Schema.Struct({
|
|
111
103
|
frame: SpaceMathFrameSchema,
|