@dojo-video-engine/layout 0.0.0-stage → 1.1.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.
- package/LICENSE +21 -0
- package/README.md +109 -2
- package/dist/index.d.ts +27 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +48 -0
- package/dist/index.js.map +1 -0
- package/dist/schema.d.ts +2109 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/schema.js +371 -0
- package/dist/schema.js.map +1 -0
- package/dist/solver.d.ts +6 -0
- package/dist/solver.d.ts.map +1 -0
- package/dist/solver.js +1736 -0
- package/dist/solver.js.map +1 -0
- package/dist/text.d.ts +136 -0
- package/dist/text.d.ts.map +1 -0
- package/dist/text.js +1359 -0
- package/dist/text.js.map +1 -0
- package/dist/types.d.ts +126 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +39 -0
- package/dist/types.js.map +1 -0
- package/package.json +54 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAG3B,eAAO,MAAM,uBAAuB,EAAG,CAAU,CAAC;AAClD,eAAO,MAAM,WAAW,EAAG,OAAgB,CAAC;AAC5C,eAAO,MAAM,qBAAqB,EAAG,IAAc,CAAC;AAkBpD,eAAO,MAAM,kBAAkB,wCAG7B,CAAC;AACH,eAAO,MAAM,kBAAkB,wCAAwC,CAAC;AACxE,eAAO,MAAM,kBAAkB,iGAI7B,CAAC;AAaH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;IAG7B,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;EAQnB,CAAC;AAEZ,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAwBjC,CAAC;AAEH,eAAO,MA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M,GAAG,MAAM,CAAC,CAAC;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAClC;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,UAAU,CAAA;CAAE,GAC9B;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,yBAAyB,EAAE,CAAA;CAAE,CAAC;AAEvD,iFAAiF;AACjF,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,0BAA0B,CAiB7E;AAYD,gFAAgF;AAChF,wBAAgB,oBAAoB,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAE9D"}
|
package/dist/schema.js
ADDED
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
import { z } from "zod/v3";
|
|
2
|
+
import { zodToJsonSchema } from "zod-to-json-schema";
|
|
3
|
+
export const LAYOUT_CONTRACT_VERSION = 1;
|
|
4
|
+
export const LAYOUT_ROOT = "$root";
|
|
5
|
+
export const MAX_LAYOUT_GRID_INDEX = 4_095;
|
|
6
|
+
const finite = z.number().finite();
|
|
7
|
+
const nonnegative = finite.nonnegative();
|
|
8
|
+
const weight = finite.min(0).max(1_000);
|
|
9
|
+
const nonnegativeLengthString = z
|
|
10
|
+
.string()
|
|
11
|
+
.regex(/^(?:\d+(?:\.\d+)?|\.\d+)(?:px|%)$/, "Expected a non-negative px or % length.");
|
|
12
|
+
const signedLengthString = z
|
|
13
|
+
.string()
|
|
14
|
+
.regex(/^-?(?:\d+(?:\.\d+)?|\.\d+)(?:px|%)$/, "Expected a finite px or % length.");
|
|
15
|
+
export const layoutLengthSchema = z.union([
|
|
16
|
+
nonnegative,
|
|
17
|
+
nonnegativeLengthString,
|
|
18
|
+
]);
|
|
19
|
+
export const layoutOffsetSchema = z.union([finite, signedLengthString]);
|
|
20
|
+
export const layoutSizingSchema = z.union([
|
|
21
|
+
z.literal("hug"),
|
|
22
|
+
z.literal("fill"),
|
|
23
|
+
layoutLengthSchema,
|
|
24
|
+
]);
|
|
25
|
+
const insetObjectSchema = z
|
|
26
|
+
.object({
|
|
27
|
+
top: layoutLengthSchema.optional(),
|
|
28
|
+
right: layoutLengthSchema.optional(),
|
|
29
|
+
bottom: layoutLengthSchema.optional(),
|
|
30
|
+
left: layoutLengthSchema.optional(),
|
|
31
|
+
x: layoutLengthSchema.optional(),
|
|
32
|
+
y: layoutLengthSchema.optional(),
|
|
33
|
+
})
|
|
34
|
+
.strict();
|
|
35
|
+
export const layoutInsetsSchema = z.union([
|
|
36
|
+
layoutLengthSchema,
|
|
37
|
+
insetObjectSchema,
|
|
38
|
+
]);
|
|
39
|
+
export const layoutTrackSchema = z
|
|
40
|
+
.object({
|
|
41
|
+
size: layoutSizingSchema,
|
|
42
|
+
grow: weight.optional(),
|
|
43
|
+
shrink: weight.optional(),
|
|
44
|
+
min: layoutLengthSchema.optional(),
|
|
45
|
+
max: layoutLengthSchema.optional(),
|
|
46
|
+
})
|
|
47
|
+
.strict();
|
|
48
|
+
export const layoutConstraintSchema = z.discriminatedUnion("kind", [
|
|
49
|
+
z
|
|
50
|
+
.object({
|
|
51
|
+
kind: z.literal("align"),
|
|
52
|
+
target: z.string().min(1).max(191),
|
|
53
|
+
axis: z.enum(["x", "y"]),
|
|
54
|
+
edge: z.enum(["start", "center", "end"]),
|
|
55
|
+
})
|
|
56
|
+
.strict(),
|
|
57
|
+
z
|
|
58
|
+
.object({
|
|
59
|
+
kind: z.enum(["after", "before"]),
|
|
60
|
+
target: z.string().min(1).max(191),
|
|
61
|
+
axis: z.enum(["x", "y"]),
|
|
62
|
+
gap: layoutLengthSchema.optional(),
|
|
63
|
+
})
|
|
64
|
+
.strict(),
|
|
65
|
+
z
|
|
66
|
+
.object({
|
|
67
|
+
kind: z.literal("match"),
|
|
68
|
+
target: z.string().min(1).max(191),
|
|
69
|
+
dimension: z.enum(["width", "height"]),
|
|
70
|
+
})
|
|
71
|
+
.strict(),
|
|
72
|
+
]);
|
|
73
|
+
export const overlayAnchors = [
|
|
74
|
+
"top-left",
|
|
75
|
+
"top-center",
|
|
76
|
+
"top-right",
|
|
77
|
+
"center-left",
|
|
78
|
+
"center",
|
|
79
|
+
"center-right",
|
|
80
|
+
"bottom-left",
|
|
81
|
+
"bottom-center",
|
|
82
|
+
"bottom-right",
|
|
83
|
+
];
|
|
84
|
+
export const layoutItemSchema = z
|
|
85
|
+
.object({
|
|
86
|
+
id: z.string().min(1).max(191),
|
|
87
|
+
width: layoutSizingSchema.optional(),
|
|
88
|
+
height: layoutSizingSchema.optional(),
|
|
89
|
+
minWidth: layoutLengthSchema.optional(),
|
|
90
|
+
minHeight: layoutLengthSchema.optional(),
|
|
91
|
+
maxWidth: layoutLengthSchema.optional(),
|
|
92
|
+
maxHeight: layoutLengthSchema.optional(),
|
|
93
|
+
aspectRatio: finite.positive().max(10_000).optional(),
|
|
94
|
+
grow: weight.optional(),
|
|
95
|
+
shrink: weight.optional(),
|
|
96
|
+
margin: layoutInsetsSchema.optional(),
|
|
97
|
+
alignSelf: z.enum(["start", "center", "end", "stretch"]).optional(),
|
|
98
|
+
justifySelf: z.enum(["start", "center", "end", "stretch"]).optional(),
|
|
99
|
+
anchor: z.enum(overlayAnchors).optional(),
|
|
100
|
+
offsetX: layoutOffsetSchema.optional(),
|
|
101
|
+
offsetY: layoutOffsetSchema.optional(),
|
|
102
|
+
grid: z
|
|
103
|
+
.object({
|
|
104
|
+
row: z
|
|
105
|
+
.number()
|
|
106
|
+
.int()
|
|
107
|
+
.nonnegative()
|
|
108
|
+
.max(MAX_LAYOUT_GRID_INDEX)
|
|
109
|
+
.optional(),
|
|
110
|
+
column: z
|
|
111
|
+
.number()
|
|
112
|
+
.int()
|
|
113
|
+
.nonnegative()
|
|
114
|
+
.max(MAX_LAYOUT_GRID_INDEX)
|
|
115
|
+
.optional(),
|
|
116
|
+
rowSpan: z.number().int().min(1).max(64).optional(),
|
|
117
|
+
columnSpan: z.number().int().min(1).max(64).optional(),
|
|
118
|
+
})
|
|
119
|
+
.strict()
|
|
120
|
+
.optional(),
|
|
121
|
+
constraints: z.array(layoutConstraintSchema).max(8).optional(),
|
|
122
|
+
})
|
|
123
|
+
.strict();
|
|
124
|
+
const containerCommon = {
|
|
125
|
+
gap: layoutLengthSchema.optional(),
|
|
126
|
+
rowGap: layoutLengthSchema.optional(),
|
|
127
|
+
columnGap: layoutLengthSchema.optional(),
|
|
128
|
+
padding: layoutInsetsSchema.optional(),
|
|
129
|
+
safeArea: layoutInsetsSchema.optional(),
|
|
130
|
+
};
|
|
131
|
+
export const stackLayoutSchema = z
|
|
132
|
+
.object({
|
|
133
|
+
kind: z.literal("stack"),
|
|
134
|
+
axis: z.enum(["row", "column"]),
|
|
135
|
+
wrap: z.enum(["nowrap", "wrap"]).optional(),
|
|
136
|
+
justify: z
|
|
137
|
+
.enum([
|
|
138
|
+
"start",
|
|
139
|
+
"center",
|
|
140
|
+
"end",
|
|
141
|
+
"space-between",
|
|
142
|
+
"space-around",
|
|
143
|
+
"space-evenly",
|
|
144
|
+
])
|
|
145
|
+
.optional(),
|
|
146
|
+
align: z.enum(["start", "center", "end", "stretch"]).optional(),
|
|
147
|
+
alignContent: z
|
|
148
|
+
.enum([
|
|
149
|
+
"start",
|
|
150
|
+
"center",
|
|
151
|
+
"end",
|
|
152
|
+
"stretch",
|
|
153
|
+
"space-between",
|
|
154
|
+
"space-around",
|
|
155
|
+
"space-evenly",
|
|
156
|
+
])
|
|
157
|
+
.optional(),
|
|
158
|
+
...containerCommon,
|
|
159
|
+
})
|
|
160
|
+
.strict();
|
|
161
|
+
export const gridLayoutSchema = z
|
|
162
|
+
.object({
|
|
163
|
+
kind: z.literal("grid"),
|
|
164
|
+
columns: z.array(layoutTrackSchema).min(1).max(64),
|
|
165
|
+
rows: z.array(layoutTrackSchema).min(1).max(64).optional(),
|
|
166
|
+
autoFlow: z.enum(["row", "column"]).optional(),
|
|
167
|
+
justifyItems: z.enum(["start", "center", "end", "stretch"]).optional(),
|
|
168
|
+
alignItems: z.enum(["start", "center", "end", "stretch"]).optional(),
|
|
169
|
+
...containerCommon,
|
|
170
|
+
})
|
|
171
|
+
.strict();
|
|
172
|
+
export const overlayLayoutSchema = z
|
|
173
|
+
.object({
|
|
174
|
+
kind: z.literal("overlay"),
|
|
175
|
+
defaultAnchor: z.enum(overlayAnchors).optional(),
|
|
176
|
+
padding: layoutInsetsSchema.optional(),
|
|
177
|
+
safeArea: layoutInsetsSchema.optional(),
|
|
178
|
+
})
|
|
179
|
+
.strict();
|
|
180
|
+
export const layoutContainerSchema = z.discriminatedUnion("kind", [
|
|
181
|
+
stackLayoutSchema,
|
|
182
|
+
gridLayoutSchema,
|
|
183
|
+
overlayLayoutSchema,
|
|
184
|
+
]);
|
|
185
|
+
export const layoutPlanSchema = z
|
|
186
|
+
.object({
|
|
187
|
+
layoutVersion: z.literal(LAYOUT_CONTRACT_VERSION),
|
|
188
|
+
containerId: z.string().min(1).max(191).default(LAYOUT_ROOT),
|
|
189
|
+
layout: layoutContainerSchema,
|
|
190
|
+
items: z.array(layoutItemSchema).max(4_096),
|
|
191
|
+
})
|
|
192
|
+
.strict()
|
|
193
|
+
.superRefine((plan, ctx) => {
|
|
194
|
+
if (plan.layout.kind === "grid" &&
|
|
195
|
+
plan.layout.autoFlow === "column" &&
|
|
196
|
+
plan.layout.rows === undefined) {
|
|
197
|
+
ctx.addIssue({
|
|
198
|
+
code: z.ZodIssueCode.custom,
|
|
199
|
+
params: { layoutCode: "column_flow_rows_required" },
|
|
200
|
+
path: ["layout", "rows"],
|
|
201
|
+
message: "Column auto-flow requires explicit rows so geometry never depends on a host budget.",
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
const ids = new Set();
|
|
205
|
+
for (let index = 0; index < plan.items.length; index += 1) {
|
|
206
|
+
const item = plan.items[index];
|
|
207
|
+
if (ids.has(item.id)) {
|
|
208
|
+
ctx.addIssue({
|
|
209
|
+
code: z.ZodIssueCode.custom,
|
|
210
|
+
params: { layoutCode: "duplicate_item" },
|
|
211
|
+
path: ["items", index, "id"],
|
|
212
|
+
message: `Layout item id ${JSON.stringify(item.id)} is duplicated.`,
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
ids.add(item.id);
|
|
216
|
+
if (plan.layout.kind !== "grid" && item.grid !== undefined) {
|
|
217
|
+
ctx.addIssue({
|
|
218
|
+
code: z.ZodIssueCode.custom,
|
|
219
|
+
params: { layoutCode: "field_not_consumed" },
|
|
220
|
+
path: ["items", index, "grid"],
|
|
221
|
+
message: "grid placement only applies to grid layouts.",
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
if (plan.layout.kind !== "overlay" &&
|
|
225
|
+
(item.anchor !== undefined ||
|
|
226
|
+
item.offsetX !== undefined ||
|
|
227
|
+
item.offsetY !== undefined ||
|
|
228
|
+
item.constraints !== undefined)) {
|
|
229
|
+
ctx.addIssue({
|
|
230
|
+
code: z.ZodIssueCode.custom,
|
|
231
|
+
params: { layoutCode: "field_not_consumed" },
|
|
232
|
+
path: ["items", index],
|
|
233
|
+
message: "anchor, offsets, and sibling constraints only apply to overlay layouts.",
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
if (plan.layout.kind === "stack" && item.justifySelf !== undefined) {
|
|
237
|
+
ignoredItemField(ctx, index, "justifySelf", "stack");
|
|
238
|
+
}
|
|
239
|
+
if (plan.layout.kind === "grid" &&
|
|
240
|
+
(item.grow !== undefined || item.shrink !== undefined)) {
|
|
241
|
+
if (item.grow !== undefined)
|
|
242
|
+
ignoredItemField(ctx, index, "grow", "grid");
|
|
243
|
+
if (item.shrink !== undefined)
|
|
244
|
+
ignoredItemField(ctx, index, "shrink", "grid");
|
|
245
|
+
}
|
|
246
|
+
if (plan.layout.kind === "overlay") {
|
|
247
|
+
for (const field of [
|
|
248
|
+
"grow",
|
|
249
|
+
"shrink",
|
|
250
|
+
"alignSelf",
|
|
251
|
+
"justifySelf",
|
|
252
|
+
]) {
|
|
253
|
+
if (item[field] !== undefined)
|
|
254
|
+
ignoredItemField(ctx, index, field, "overlay");
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
});
|
|
259
|
+
function ignoredItemField(ctx, index, field, kind) {
|
|
260
|
+
ctx.addIssue({
|
|
261
|
+
code: z.ZodIssueCode.custom,
|
|
262
|
+
params: { layoutCode: "field_not_consumed" },
|
|
263
|
+
path: ["items", index, field],
|
|
264
|
+
message: `${field} is not consumed by ${kind} layout; remove it instead of relying on ignored input.`,
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
/** Validates, normalizes, and defensively clones a flat Layout Contract plan. */
|
|
268
|
+
export function validateLayoutPlan(input) {
|
|
269
|
+
const result = layoutPlanSchema.safeParse(input);
|
|
270
|
+
if (!result.success) {
|
|
271
|
+
return {
|
|
272
|
+
ok: false,
|
|
273
|
+
issues: result.error.issues.map((issue) => ({
|
|
274
|
+
path: [...issue.path],
|
|
275
|
+
code: issue.code === z.ZodIssueCode.custom &&
|
|
276
|
+
typeof issue.params?.layoutCode === "string"
|
|
277
|
+
? issue.params.layoutCode
|
|
278
|
+
: issue.code,
|
|
279
|
+
message: issue.message,
|
|
280
|
+
})),
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
return { ok: true, plan: structuredClone(result.data) };
|
|
284
|
+
}
|
|
285
|
+
const generatedLayoutPlanJsonSchema = Object.freeze(decorateLayoutPlanJsonSchema(zodToJsonSchema(layoutPlanSchema, {
|
|
286
|
+
name: "DojoVideoEngineLayoutPlanV1",
|
|
287
|
+
target: "jsonSchema7",
|
|
288
|
+
$refStrategy: "none",
|
|
289
|
+
})));
|
|
290
|
+
/** Detached draft-07 schema suitable for function tools and host validation. */
|
|
291
|
+
export function layoutPlanJsonSchema() {
|
|
292
|
+
return structuredClone(generatedLayoutPlanJsonSchema);
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Zod refinements do not appear in generated JSON Schema automatically.
|
|
296
|
+
* Draft-07 can encode kind-specific forbidden fields, so add those conditions
|
|
297
|
+
* here. Uniqueness by an object's `id` value is not expressible in draft-07;
|
|
298
|
+
* callers must still run validateLayoutPlan() before compilation.
|
|
299
|
+
*/
|
|
300
|
+
function decorateLayoutPlanJsonSchema(schema) {
|
|
301
|
+
const definitions = schema.definitions;
|
|
302
|
+
const root = definitions?.DojoVideoEngineLayoutPlanV1;
|
|
303
|
+
if (!root)
|
|
304
|
+
throw new Error("Generated LayoutPlan JSON Schema lost its root definition.");
|
|
305
|
+
const condition = (kind, forbidden) => ({
|
|
306
|
+
if: {
|
|
307
|
+
properties: {
|
|
308
|
+
layout: {
|
|
309
|
+
properties: { kind: { const: kind } },
|
|
310
|
+
required: ["kind"],
|
|
311
|
+
},
|
|
312
|
+
},
|
|
313
|
+
required: ["layout"],
|
|
314
|
+
},
|
|
315
|
+
then: {
|
|
316
|
+
properties: {
|
|
317
|
+
items: {
|
|
318
|
+
items: {
|
|
319
|
+
not: { anyOf: forbidden.map((field) => ({ required: [field] })) },
|
|
320
|
+
},
|
|
321
|
+
},
|
|
322
|
+
},
|
|
323
|
+
},
|
|
324
|
+
});
|
|
325
|
+
root.allOf = [
|
|
326
|
+
condition("stack", [
|
|
327
|
+
"grid",
|
|
328
|
+
"anchor",
|
|
329
|
+
"offsetX",
|
|
330
|
+
"offsetY",
|
|
331
|
+
"constraints",
|
|
332
|
+
"justifySelf",
|
|
333
|
+
]),
|
|
334
|
+
condition("grid", [
|
|
335
|
+
"anchor",
|
|
336
|
+
"offsetX",
|
|
337
|
+
"offsetY",
|
|
338
|
+
"constraints",
|
|
339
|
+
"grow",
|
|
340
|
+
"shrink",
|
|
341
|
+
]),
|
|
342
|
+
condition("overlay", [
|
|
343
|
+
"grid",
|
|
344
|
+
"grow",
|
|
345
|
+
"shrink",
|
|
346
|
+
"alignSelf",
|
|
347
|
+
"justifySelf",
|
|
348
|
+
]),
|
|
349
|
+
{
|
|
350
|
+
if: {
|
|
351
|
+
properties: {
|
|
352
|
+
layout: {
|
|
353
|
+
properties: {
|
|
354
|
+
kind: { const: "grid" },
|
|
355
|
+
autoFlow: { const: "column" },
|
|
356
|
+
},
|
|
357
|
+
required: ["kind", "autoFlow"],
|
|
358
|
+
},
|
|
359
|
+
},
|
|
360
|
+
required: ["layout"],
|
|
361
|
+
},
|
|
362
|
+
then: {
|
|
363
|
+
properties: {
|
|
364
|
+
layout: { required: ["rows"] },
|
|
365
|
+
},
|
|
366
|
+
},
|
|
367
|
+
},
|
|
368
|
+
];
|
|
369
|
+
return schema;
|
|
370
|
+
}
|
|
371
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAC3B,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAU,CAAC;AAClD,MAAM,CAAC,MAAM,WAAW,GAAG,OAAgB,CAAC;AAC5C,MAAM,CAAC,MAAM,qBAAqB,GAAG,KAAc,CAAC;AAEpD,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,CAAC;AACnC,MAAM,WAAW,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC;AACzC,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACxC,MAAM,uBAAuB,GAAG,CAAC;KAC9B,MAAM,EAAE;KACR,KAAK,CACJ,mCAAmC,EACnC,yCAAyC,CAC1C,CAAC;AACJ,MAAM,kBAAkB,GAAG,CAAC;KACzB,MAAM,EAAE;KACR,KAAK,CACJ,qCAAqC,EACrC,mCAAmC,CACpC,CAAC;AAEJ,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,C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gBACF,UAAU,EAAE;oBACV,MAAM,EAAE;wBACN,UAAU,EAAE;4BACV,IAAI,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE;4BACvB,QAAQ,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE;yBAC9B;wBACD,QAAQ,EAAE,CAAC,MAAM,EAAE,UAAU,CAAC;qBAC/B;iBACF;gBACD,QAAQ,EAAE,CAAC,QAAQ,CAAC;aACrB;YACD,IAAI,EAAE;gBACJ,UAAU,EAAE;oBACV,MAAM,EAAE,EAAE,QAAQ,EAAE,CAAC,MAAM,CAAC,EAAE;iBAC/B;aACF;SACF;KACF,CAAC;IACF,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/dist/solver.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type Scene } from "@dojo-video-engine/schema";
|
|
2
|
+
import { type CompileLayoutOptions, type LayoutCompileResult, type TryCompileLayoutResult } from "./types.js";
|
|
3
|
+
/** Compiles one flat semantic layout plan into ordinary Scene v1 geometry. */
|
|
4
|
+
export declare function compileLayout(sceneInput: Scene, planInput: unknown, options?: CompileLayoutOptions): LayoutCompileResult;
|
|
5
|
+
export declare function tryCompileLayout(sceneInput: Scene, planInput: unknown, options?: CompileLayoutOptions): TryCompileLayoutResult;
|
|
6
|
+
//# sourceMappingURL=solver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"solver.d.ts","sourceRoot":"","sources":["../src/solver.ts"],"names":[],"mappings":"AAWA,OAAO,EAEL,KAAK,KAAK,EAIX,MAAM,2BAA2B,CAAC;AAqBnC,OAAO,EAIL,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EAKxB,KAAK,sBAAsB,EAC5B,MAAM,YAAY,CAAC;AAkGpB,8EAA8E;AAC9E,wBAAgB,aAAa,CAC3B,UAAU,EAAE,KAAK,EACjB,SAAS,EAAE,OAAO,EAClB,OAAO,GAAE,oBAAyB,GACjC,mBAAmB,CASrB;AAED,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,KAAK,EACjB,SAAS,EAAE,OAAO,EAClB,OAAO,GAAE,oBAAyB,GACjC,sBAAsB,CAmBxB"}
|