@nakafa/aksara-contracts 0.30.0 → 0.31.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.
@@ -0,0 +1,15 @@
1
+ import { Effect, Schema } from "effect";
2
+ import { decodeContract } from "#contracts/decode";
3
+ import { PlaneMathVisualSchema } from "#contracts/math/plane";
4
+ import { SpaceMathVisualSchema } from "#contracts/math/space";
5
+ /** Pure mathematical scene data shared by Aksara authoring and Nakafa. */
6
+ export const MathVisualSchema = Schema.Union([
7
+ PlaneMathVisualSchema,
8
+ SpaceMathVisualSchema,
9
+ ]);
10
+ /** Strictly decodes one untrusted mathematical scene into its stable contract. */
11
+ export const decodeMathVisual = Effect.fn("AksaraContracts.decodeMathVisual")((input) => decodeContract(MathVisualSchema, "MathVisual", input));
12
+ /** Returns every rich-label key in authored anchor order. */
13
+ export function mathVisualLabelKeys(visual) {
14
+ return (visual.labels ?? []).map(({ key }) => key);
15
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nakafa/aksara-contracts",
3
- "version": "0.30.0",
3
+ "version": "0.31.0",
4
4
  "description": "Schemas and verification contracts for Nakafa content releases.",
5
5
  "homepage": "https://github.com/nakafaai/aksara#readme",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -92,6 +92,10 @@
92
92
  "types": "./dist/locale.d.ts",
93
93
  "import": "./dist/locale.js"
94
94
  },
95
+ "./math/visual": {
96
+ "types": "./dist/math/visual.d.ts",
97
+ "import": "./dist/math/visual.js"
98
+ },
95
99
  "./material/domain": {
96
100
  "types": "./dist/material/domain.d.ts",
97
101
  "import": "./dist/material/domain.js"