@nativemason/contracts 0.0.0-stage → 0.2.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.
- package/LICENSE +202 -0
- package/README.md +4 -2
- package/dist/accessibility.d.ts +194 -0
- package/dist/accessibility.js +21 -0
- package/dist/constraints.d.ts +804 -0
- package/dist/constraints.js +16 -0
- package/dist/design.d.ts +1652 -0
- package/dist/design.js +29 -0
- package/dist/diagnostics.d.ts +3395 -0
- package/dist/diagnostics.js +35 -0
- package/dist/evidence.d.ts +10431 -0
- package/dist/evidence.js +44 -0
- package/dist/geometry.d.ts +122 -0
- package/dist/geometry.js +4 -0
- package/dist/graph.d.ts +1916 -0
- package/dist/graph.js +36 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +12 -0
- package/dist/native-protocol.d.ts +1726 -0
- package/dist/native-protocol.js +11 -0
- package/dist/source.d.ts +221 -0
- package/dist/source.js +17 -0
- package/dist/styles.d.ts +249 -0
- package/dist/styles.js +3 -0
- package/dist/tools.d.ts +45345 -0
- package/dist/tools.js +53 -0
- package/dist/workflow.d.ts +2391 -0
- package/dist/workflow.js +18 -0
- package/package.json +33 -3
package/dist/design.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { DeviceProfileSchema, RectSchema } from './geometry.js';
|
|
3
|
+
import { ConstraintSchema, WireframeSpecSchema } from './constraints.js';
|
|
4
|
+
/** Each nested Figma node is validated independently by the bounded importer. */
|
|
5
|
+
export const FigmaNodeSchema = z.object({
|
|
6
|
+
id: z.string().min(1), type: z.string(), name: z.string().optional(),
|
|
7
|
+
absoluteBoundingBox: RectSchema.optional(),
|
|
8
|
+
layoutMode: z.enum(['NONE', 'HORIZONTAL', 'VERTICAL']).optional(),
|
|
9
|
+
itemSpacing: z.number().finite().optional(),
|
|
10
|
+
counterAxisAlignItems: z.enum(['MIN', 'CENTER', 'MAX', 'BASELINE']).optional(),
|
|
11
|
+
children: z.array(z.unknown()).max(10000).optional(),
|
|
12
|
+
}).passthrough();
|
|
13
|
+
const common = { scenarioId: z.string().min(1), profile: DeviceProfileSchema, tolerance: z.number().finite().nonnegative().default(2) };
|
|
14
|
+
export const DesignIntentSchema = z.discriminatedUnion('kind', [
|
|
15
|
+
z.object({ ...common, kind: z.literal('figma-auto-layout'), frame: FigmaNodeSchema,
|
|
16
|
+
elementMap: z.record(z.string(), z.string().min(1)),
|
|
17
|
+
logicalUnitsPerDesignUnit: z.number().finite().positive().default(1),
|
|
18
|
+
}).strict(),
|
|
19
|
+
z.object({ ...common, kind: z.literal('reference-annotations'),
|
|
20
|
+
image: z.object({ sha256: z.string().regex(/^[a-f0-9]{64}$/), width: z.number().finite().positive(), height: z.number().finite().positive() }).strict(),
|
|
21
|
+
appRootPixels: RectSchema, pixelsPerLogicalUnit: z.number().finite().positive(),
|
|
22
|
+
annotations: z.array(z.object({ elementId: z.string().min(1), rectPixels: RectSchema }).strict()).min(1).max(10000),
|
|
23
|
+
assertions: z.array(ConstraintSchema).default([]),
|
|
24
|
+
}).strict(),
|
|
25
|
+
]);
|
|
26
|
+
export const DesignIntentResultSchema = z.object({
|
|
27
|
+
spec: WireframeSpecSchema, reviewRequired: z.literal(true),
|
|
28
|
+
source: z.enum(['figma-auto-layout', 'reference-annotations']), notes: z.array(z.string()),
|
|
29
|
+
}).strict();
|