@sentropic/diagram-core 0.5.0 → 0.6.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/dist/index.d.ts CHANGED
@@ -34,5 +34,6 @@ export { relationBaseType, relationSchema } from "./relation-types.js";
34
34
  export { withFlowTypes, validateFlows, flowIndex, type FlowStep, type FlowScenario, type FlowIndex } from "./flows.js";
35
35
  export * from "./erd.js";
36
36
  export * from "./layout-hints.js";
37
+ export * from "./layout-hints-v2.js";
37
38
  export * from "./notation.js";
38
39
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -34,5 +34,6 @@ export { relationBaseType, relationSchema } from "./relation-types.js";
34
34
  export { withFlowTypes, validateFlows, flowIndex } from "./flows.js";
35
35
  export * from "./erd.js";
36
36
  export * from "./layout-hints.js";
37
+ export * from "./layout-hints-v2.js";
37
38
  export * from "./notation.js";
38
39
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,204 @@
1
+ import { type Diagnostic } from "./diagnostics.js";
2
+ import { type DsLayoutHints, type LayoutHintsContext, type LoweredLayoutHints } from "./layout-hints.js";
3
+ import type { EntityRef } from "./refs.js";
4
+ export declare const DS_LAYOUT_V2_VOCABULARY = "ds-layout-hints@2";
5
+ export declare const DS_LAYOUT_HINTS_V2_SCHEMA_ID = "https://sentropic.dev/schemas/diagram/layout-hints/v2";
6
+ declare const alignments: readonly ["start", "center", "end", "stretch"];
7
+ declare const sides: readonly ["start", "end"];
8
+ declare const axes: readonly ["row", "column"];
9
+ declare const aspects: readonly ["16:9", "free"];
10
+ declare const fanModes: readonly ["comb", "separate"];
11
+ declare const legends: readonly ["right", "bottom", "free-cell", "none"];
12
+ export type LayoutCellAlign = (typeof alignments)[number];
13
+ export interface LayoutBand {
14
+ readonly id: string;
15
+ readonly items: readonly EntityRef[];
16
+ }
17
+ export interface LayoutPeripheralColumn {
18
+ readonly id: string;
19
+ readonly side: (typeof sides)[number];
20
+ readonly items: readonly EntityRef[];
21
+ readonly from_band?: string;
22
+ }
23
+ export interface LayoutCell {
24
+ readonly column?: string;
25
+ readonly to_column?: string;
26
+ readonly to_band?: string;
27
+ readonly justify?: LayoutCellAlign;
28
+ readonly align?: LayoutCellAlign;
29
+ }
30
+ export interface LayoutGrid {
31
+ readonly stage_columns?: readonly string[] | "inherit";
32
+ readonly transverse_bands: readonly LayoutBand[];
33
+ readonly peripheral_columns?: readonly LayoutPeripheralColumn[];
34
+ readonly cells?: Readonly<Partial<Record<EntityRef, LayoutCell>>>;
35
+ }
36
+ export interface LayoutStack {
37
+ readonly axis: (typeof axes)[number];
38
+ readonly align?: LayoutCellAlign;
39
+ }
40
+ export interface LayoutComposition {
41
+ readonly grids: {
42
+ readonly root: LayoutGrid;
43
+ } & Readonly<Partial<Record<EntityRef, LayoutGrid>>>;
44
+ readonly stacks: Readonly<Partial<Record<EntityRef, LayoutStack>>>;
45
+ readonly aspect: (typeof aspects)[number];
46
+ readonly fanIn: (typeof fanModes)[number];
47
+ readonly fanOut: (typeof fanModes)[number];
48
+ /** "host" uses the scene option and its default. */
49
+ readonly legend: (typeof legends)[number] | "host";
50
+ }
51
+ type ComposedLayoutHints = Pick<DsLayoutHints, "rootOrder" | "ordering"> & Partial<LayoutComposition> & {
52
+ readonly mode: "stage-columns";
53
+ readonly grids: LayoutComposition["grids"];
54
+ readonly legend?: (typeof legends)[number];
55
+ };
56
+ export type DsLayoutHintsV2 = {
57
+ readonly vocabulary: typeof DS_LAYOUT_V2_VOCABULARY;
58
+ } & (Omit<DsLayoutHints, "vocabulary"> | ComposedLayoutHints);
59
+ export interface LoweredLayoutHintsV2 extends LoweredLayoutHints {
60
+ readonly composition?: LayoutComposition;
61
+ }
62
+ export declare const DS_LAYOUT_HINTS_V2_SCHEMA: {
63
+ dependentSchemas: {
64
+ grouping: {
65
+ properties: {
66
+ grouping_axis: boolean;
67
+ };
68
+ };
69
+ };
70
+ allOf: {
71
+ if: {
72
+ properties: {
73
+ mode: {
74
+ const: "auto-pack" | "layered-flow" | "stage-columns";
75
+ };
76
+ };
77
+ required: string[];
78
+ };
79
+ then: {
80
+ required?: string[];
81
+ properties: {
82
+ grids?: {
83
+ $ref: string;
84
+ };
85
+ };
86
+ };
87
+ }[];
88
+ $defs: {
89
+ mode: {
90
+ enum: readonly ["auto-pack", "layered-flow", "stage-columns"];
91
+ };
92
+ forbiddenHint: {
93
+ enum: readonly ["cardGapX", "cardGapY", "density", "edge_label_orientation", "gapAfter", "height", "rankGap", "width", "x", "y", "zoneGapX", "zoneGapY", "anchor", "bottom", "dc", "dx", "dy", "gap", "gutter", "labelAt", "label_at", "left", "margin", "offset", "padding", "pin", "pins", "points", "position", "right", "scale", "size", "top", "via", "waypoints", "zoom"];
94
+ };
95
+ futureHint: {
96
+ enum: readonly ["compared_panels", "loop_corridor", "foldable", "direction", "rotate_labels"];
97
+ };
98
+ futureBandValue: {
99
+ enum: string[];
100
+ };
101
+ futureMode: {
102
+ enum: readonly ["tree"];
103
+ };
104
+ supersededMode: {
105
+ enum: readonly ["lane-stack", "matrix-grid"];
106
+ };
107
+ modeScope: {
108
+ [k: string]: {
109
+ enum: readonly ["grids", "stacks", "aspect", "fanIn", "fanOut", "legend"] | readonly ["grouping", "grouping_axis", "stretch"] | readonly ["grouping", "grouping_axis", "ordering", "rootOrder", "stretch", "grids", "stacks", "aspect", "fanIn", "fanOut", "legend"];
110
+ };
111
+ };
112
+ id: {
113
+ type: string;
114
+ pattern: string;
115
+ };
116
+ align: {
117
+ enum: readonly ["start", "center", "end", "stretch"];
118
+ };
119
+ grids: {
120
+ properties: {
121
+ root: {
122
+ $ref: string;
123
+ };
124
+ };
125
+ required: string[];
126
+ type: string;
127
+ patternProperties: {
128
+ "^entity:[A-Za-z0-9][A-Za-z0-9._-]*$": {
129
+ $ref: string;
130
+ };
131
+ };
132
+ additionalProperties: boolean;
133
+ };
134
+ grid: {
135
+ additionalProperties: boolean;
136
+ required?: readonly string[];
137
+ type: string;
138
+ properties: Record<string, unknown>;
139
+ };
140
+ band: {
141
+ additionalProperties: boolean;
142
+ required?: readonly string[];
143
+ type: string;
144
+ properties: Record<string, unknown>;
145
+ };
146
+ peripheralColumn: {
147
+ additionalProperties: boolean;
148
+ required?: readonly string[];
149
+ type: string;
150
+ properties: Record<string, unknown>;
151
+ };
152
+ cell: {
153
+ additionalProperties: boolean;
154
+ required?: readonly string[];
155
+ type: string;
156
+ properties: Record<string, unknown>;
157
+ };
158
+ stack: {
159
+ additionalProperties: boolean;
160
+ required?: readonly string[];
161
+ type: string;
162
+ properties: Record<string, unknown>;
163
+ };
164
+ };
165
+ additionalProperties: boolean;
166
+ required?: readonly string[];
167
+ type: string;
168
+ properties: Record<string, unknown>;
169
+ $schema: string;
170
+ $id: string;
171
+ title: string;
172
+ };
173
+ export declare const DS_LAYOUT_HINTS_V2_SCHEMA_DIGEST: string;
174
+ export declare const DS_LAYOUT_V2_VOCABULARY_PIN: {
175
+ id: string;
176
+ version: string;
177
+ contentDigest: string;
178
+ };
179
+ export declare const DS_LAYOUT_HINTS_V2_RULES: {
180
+ vocabulary: string;
181
+ modes: {
182
+ implemented: readonly ["auto-pack", "layered-flow", "stage-columns"];
183
+ future: readonly ["tree"];
184
+ superseded: readonly ["lane-stack", "matrix-grid"];
185
+ futureVocabulary: string;
186
+ };
187
+ hints: {
188
+ forbidden: readonly ["cardGapX", "cardGapY", "density", "edge_label_orientation", "gapAfter", "height", "rankGap", "width", "x", "y", "zoneGapX", "zoneGapY", "anchor", "bottom", "dc", "dx", "dy", "gap", "gutter", "labelAt", "label_at", "left", "margin", "offset", "padding", "pin", "pins", "points", "position", "right", "scale", "size", "top", "via", "waypoints", "zoom"];
189
+ future: readonly ["compared_panels", "loop_corridor", "foldable", "direction", "rotate_labels"];
190
+ futureBandValues: string[];
191
+ };
192
+ modeScope: {
193
+ readonly "auto-pack": readonly ["grids", "stacks", "aspect", "fanIn", "fanOut", "legend"];
194
+ readonly "layered-flow": readonly ["grouping", "grouping_axis", "ordering", "rootOrder", "stretch", "grids", "stacks", "aspect", "fanIn", "fanOut", "legend"];
195
+ readonly "stage-columns": readonly ["grouping", "grouping_axis", "stretch"];
196
+ };
197
+ };
198
+ /** Validate the closed @2 vocabulary, then verify identities and span occupancy. */
199
+ export declare function validateLayoutHintsV2(input: unknown, context?: LayoutHintsContext): readonly Diagnostic[];
200
+ export declare function validateAnyLayoutHints(value: unknown, context?: LayoutHintsContext): readonly Diagnostic[];
201
+ /** Lower a validated @2 declaration. Legacy modes share the @1 lowering. */
202
+ export declare function lowerLayoutHintsV2(hints: DsLayoutHintsV2, roots?: readonly EntityRef[]): LoweredLayoutHintsV2;
203
+ export {};
204
+ //# sourceMappingURL=layout-hints-v2.d.ts.map
@@ -0,0 +1,508 @@
1
+ import { diagnostic } from "./diagnostics.js";
2
+ import { DS_LAYOUT_FORBIDDEN_HINTS, DS_LAYOUT_HINTS_SCHEMA, DS_LAYOUT_MEASURED_HINTS, DS_LAYOUT_VOCABULARY, lowerLayoutHints, validateLayoutHints, } from "./layout-hints.js";
3
+ import { canonicalBytes, sha256Hex } from "./sha256.js";
4
+ export const DS_LAYOUT_V2_VOCABULARY = "ds-layout-hints@2";
5
+ export const DS_LAYOUT_HINTS_V2_SCHEMA_ID = "https://sentropic.dev/schemas/diagram/layout-hints/v2";
6
+ const modes = ["auto-pack", "layered-flow", "stage-columns"];
7
+ const alignments = ["start", "center", "end", "stretch"];
8
+ const sides = ["start", "end"];
9
+ const axes = ["row", "column"];
10
+ const aspects = ["16:9", "free"];
11
+ const fanModes = ["comb", "separate"];
12
+ const legends = ["right", "bottom", "free-cell", "none"];
13
+ const compositionKeys = ["grids", "stacks", "aspect", "fanIn", "fanOut", "legend"];
14
+ const autoPackKeys = ["grouping", "grouping_axis", "stretch"];
15
+ const futureHints = ["compared_panels", "loop_corridor", "foldable", "direction", "rotate_labels"];
16
+ const futureModes = ["tree"];
17
+ const supersededModes = ["lane-stack", "matrix-grid"];
18
+ const futureVocabulary = "ds-layout-hints@3";
19
+ const forbiddenHints = [
20
+ ...DS_LAYOUT_FORBIDDEN_HINTS,
21
+ "anchor", "bottom", "dc", "dx", "dy", "gap", "gutter", "labelAt", "label_at", "left", "margin",
22
+ "offset", "padding", "pin", "pins", "points", "position", "right", "scale", "size", "top", "via",
23
+ "waypoints", "zoom",
24
+ ];
25
+ const modeScope = {
26
+ "auto-pack": compositionKeys,
27
+ "layered-flow": [...DS_LAYOUT_MEASURED_HINTS, ...compositionKeys],
28
+ "stage-columns": autoPackKeys,
29
+ };
30
+ const entityPattern = "^entity:[A-Za-z0-9][A-Za-z0-9._-]*$";
31
+ const idPattern = "^[a-z][a-z0-9-]{0,39}$";
32
+ const entityRef = new RegExp(entityPattern);
33
+ const trackId = new RegExp(idPattern);
34
+ // Retain the @1 structural contract for all the words shared by both versions.
35
+ const shared = DS_LAYOUT_HINTS_SCHEMA;
36
+ const close = (properties, required = []) => ({
37
+ type: "object",
38
+ properties,
39
+ ...(required.length === 0 ? {} : { required }),
40
+ additionalProperties: false,
41
+ });
42
+ const ref = (name) => ({ $ref: `#/$defs/${name}` });
43
+ const entries = (name) => ({ type: "object", patternProperties: { [entityPattern]: ref(name) }, additionalProperties: false });
44
+ const list = (name, minItems, maxItems) => ({
45
+ type: "array", items: ref(name), minItems, ...(maxItems === undefined ? {} : { maxItems }),
46
+ });
47
+ const schema = {
48
+ $schema: "https://json-schema.org/draft/2020-12/schema",
49
+ $id: DS_LAYOUT_HINTS_V2_SCHEMA_ID,
50
+ title: DS_LAYOUT_V2_VOCABULARY,
51
+ ...close({
52
+ ...shared.properties,
53
+ vocabulary: { const: DS_LAYOUT_V2_VOCABULARY },
54
+ grids: ref("grids"),
55
+ stacks: entries("stack"),
56
+ aspect: { enum: aspects },
57
+ fanIn: { enum: fanModes },
58
+ fanOut: { enum: fanModes },
59
+ legend: { enum: legends },
60
+ }, ["vocabulary", "mode"]),
61
+ dependentSchemas: { grouping: { properties: { grouping_axis: false } } },
62
+ allOf: modes.map((mode) => ({
63
+ if: { properties: { mode: { const: mode } }, required: ["mode"] },
64
+ then: {
65
+ properties: {
66
+ ...Object.fromEntries(modeScope[mode].map((word) => [word, false])),
67
+ ...(mode === "stage-columns" ? { grids: ref("grids") } : {}),
68
+ },
69
+ ...(mode === "stage-columns" ? { required: ["grids"] } : {}),
70
+ },
71
+ })),
72
+ $defs: {
73
+ ...shared.$defs,
74
+ mode: { enum: modes },
75
+ forbiddenHint: { enum: forbiddenHints },
76
+ futureHint: { enum: futureHints },
77
+ futureBandValue: { enum: ["inherit"] },
78
+ futureMode: { enum: futureModes },
79
+ supersededMode: { enum: supersededModes },
80
+ modeScope: Object.fromEntries(modes.map((mode) => [mode, { enum: modeScope[mode] }])),
81
+ id: { type: "string", pattern: idPattern },
82
+ align: { enum: alignments },
83
+ grids: { ...entries("grid"), properties: { root: ref("grid") }, required: ["root"] },
84
+ grid: close({
85
+ stage_columns: { anyOf: [list("id", 1, 16), { const: "inherit" }] },
86
+ transverse_bands: list("band", 1, 24),
87
+ peripheral_columns: list("peripheralColumn", 0),
88
+ cells: entries("cell"),
89
+ }, ["transverse_bands"]),
90
+ band: close({ id: ref("id"), items: list("entityRef", 0, 32) }, ["id", "items"]),
91
+ peripheralColumn: close({
92
+ id: ref("id"), side: { enum: sides }, items: list("entityRef", 1, 16), from_band: ref("id"),
93
+ }, ["id", "side", "items"]),
94
+ cell: close({ column: ref("id"), to_column: ref("id"), to_band: ref("id"), justify: ref("align"), align: ref("align") }),
95
+ stack: close({ axis: { enum: axes }, align: ref("align") }, ["axis"]),
96
+ },
97
+ };
98
+ function freeze(value) {
99
+ if (value !== null && typeof value === "object" && !Object.isFrozen(value)) {
100
+ for (const child of Object.values(value))
101
+ freeze(child);
102
+ Object.freeze(value);
103
+ }
104
+ return value;
105
+ }
106
+ export const DS_LAYOUT_HINTS_V2_SCHEMA = freeze(schema);
107
+ export const DS_LAYOUT_HINTS_V2_SCHEMA_DIGEST = sha256Hex(canonicalBytes(schema));
108
+ export const DS_LAYOUT_V2_VOCABULARY_PIN = freeze({
109
+ id: DS_LAYOUT_HINTS_V2_SCHEMA_ID,
110
+ version: DS_LAYOUT_V2_VOCABULARY,
111
+ contentDigest: DS_LAYOUT_HINTS_V2_SCHEMA_DIGEST,
112
+ });
113
+ export const DS_LAYOUT_HINTS_V2_RULES = freeze({
114
+ vocabulary: DS_LAYOUT_V2_VOCABULARY,
115
+ modes: { implemented: modes, future: futureModes, superseded: supersededModes, futureVocabulary },
116
+ hints: { forbidden: forbiddenHints, future: futureHints, futureBandValues: schema.$defs.futureBandValue.enum },
117
+ modeScope,
118
+ });
119
+ function isObject(value) {
120
+ if (value === null || typeof value !== "object" || Array.isArray(value))
121
+ return false;
122
+ const prototype = Object.getPrototypeOf(value);
123
+ return prototype === null || prototype === Object.prototype;
124
+ }
125
+ function vocabularyOf(value) {
126
+ if (!isObject(value))
127
+ return undefined;
128
+ return Object.getOwnPropertyDescriptor(value, "vocabulary")?.value;
129
+ }
130
+ /** Read only plain data. Never invoke accessors or mutate a caller's object. */
131
+ function snapshot(value, path, report, ancestors = new Set()) {
132
+ if (typeof value === "number")
133
+ report("layout-hints-invalid", path, "numeric values are forbidden");
134
+ if (value === null || typeof value !== "object")
135
+ return value;
136
+ if ((!isObject(value) && !Array.isArray(value)) || ancestors.has(value)) {
137
+ throw new TypeError("expected an acyclic JSON object");
138
+ }
139
+ ancestors.add(value);
140
+ const descriptors = Object.getOwnPropertyDescriptors(value);
141
+ const read = (key) => {
142
+ const descriptor = Object.hasOwn(descriptors, key) ? descriptors[key] : undefined;
143
+ if (descriptor === undefined || !("value" in descriptor))
144
+ throw new TypeError("expected a data property");
145
+ return snapshot(descriptor.value, path ? `${path}.${key}` : key, report, ancestors);
146
+ };
147
+ let result;
148
+ if (Array.isArray(value)) {
149
+ const length = descriptors["length"]?.value;
150
+ const keys = Object.keys(descriptors).filter((key) => key !== "length");
151
+ if (keys.length !== length || keys.some((key, index) => key !== String(index)))
152
+ throw new TypeError("expected a dense JSON array");
153
+ result = keys.map(read);
154
+ }
155
+ else {
156
+ result = Object.assign(Object.create(null), Object.fromEntries(Object.keys(descriptors).sort().map((key) => [key, read(key)])));
157
+ }
158
+ ancestors.delete(value);
159
+ return result;
160
+ }
161
+ function checkShape(value, report) {
162
+ const invalid = (path, message) => report("layout-hints-invalid", path, message);
163
+ const unknown = (key, path) => {
164
+ if (forbiddenHints.includes(key)) {
165
+ report("layout-hint-forbidden", path, `${key} is a geometry override`, { hint: key });
166
+ }
167
+ else if (futureHints.includes(key)) {
168
+ report("layout-hint-not-implemented", path, `${key} requires ${futureVocabulary}`, { hint: key, vocabulary: futureVocabulary });
169
+ }
170
+ else {
171
+ report("layout-hint-unknown", path, `${key} is not a layout property`, { hint: key });
172
+ }
173
+ };
174
+ const object = (entry, path, keys) => {
175
+ if (!isObject(entry)) {
176
+ invalid(path, "expected an object");
177
+ return Object.create(null);
178
+ }
179
+ for (const key of Object.keys(entry))
180
+ if (!keys.includes(key))
181
+ unknown(key, path ? `${path}.${key}` : key);
182
+ return entry;
183
+ };
184
+ const table = (entry, path, check, root = false) => {
185
+ if (!isObject(entry))
186
+ return invalid(path, "expected an object keyed by entity");
187
+ for (const [key, item] of Object.entries(entry)) {
188
+ const itemPath = `${path}.${key}`;
189
+ if (entityRef.test(key) || (root && key === "root"))
190
+ check(item, itemPath, key);
191
+ else
192
+ unknown(key, itemPath);
193
+ }
194
+ };
195
+ const array = (entry, path, min, max, check) => {
196
+ if (!Array.isArray(entry) || entry.length < min || entry.length > max) {
197
+ return invalid(path, `expected a list with ${min}${Number.isFinite(max) ? `–${max}` : "+"} items`);
198
+ }
199
+ entry.forEach((item, index) => check(item, `${path}.${index}`));
200
+ };
201
+ const word = (entry, path, words) => {
202
+ if (typeof entry !== "string" || !words.includes(entry))
203
+ invalid(path, `expected one of ${words.join(", ")}`);
204
+ };
205
+ const pattern = (entry, path, regex) => {
206
+ if (typeof entry !== "string" || !regex.test(entry))
207
+ invalid(path, `expected a string matching ${regex.source}`);
208
+ };
209
+ const id = (entry, path) => pattern(entry, path, trackId);
210
+ const items = (entry, path, min, max) => {
211
+ array(entry, path, min, max, (item, itemPath) => pattern(item, itemPath, entityRef));
212
+ };
213
+ const mode = value["mode"];
214
+ object(value, "", [...Object.keys(schema.properties)]);
215
+ if (modes.includes(mode)) {
216
+ for (const key of modeScope[mode]) {
217
+ if (Object.hasOwn(value, key))
218
+ report("layout-hint-out-of-scope", key, `${key} is out of scope for ${mode}`, { hint: key, mode });
219
+ }
220
+ }
221
+ else if (mode === undefined) {
222
+ invalid("mode", "mode is required");
223
+ }
224
+ else if (futureModes.includes(mode)) {
225
+ report("layout-mode-not-implemented", "mode", `${mode} is reserved`, { mode, vocabulary: futureVocabulary });
226
+ }
227
+ else if (supersededModes.includes(mode)) {
228
+ report("layout-mode-not-implemented", "mode", `${mode} is superseded by stage-columns`, { mode, supersededBy: "stage-columns" });
229
+ }
230
+ else {
231
+ report("layout-mode-unknown", "mode", "unknown layout mode", typeof mode === "string" ? { mode } : undefined);
232
+ }
233
+ for (const [key, words] of Object.entries({ aspect: aspects, fanIn: fanModes, fanOut: fanModes, legend: legends })) {
234
+ if (Object.hasOwn(value, key))
235
+ word(value[key], key, words);
236
+ }
237
+ if (mode === "stage-columns" && (!isObject(value["grids"]) || !Object.hasOwn(value["grids"], "root"))) {
238
+ invalid("grids.root", "stage-columns requires a root grid");
239
+ }
240
+ if (Object.hasOwn(value, "grids"))
241
+ table(value["grids"], "grids", (entry, path) => {
242
+ const grid = object(entry, path, ["stage_columns", "transverse_bands", "peripheral_columns", "cells"]);
243
+ if (Object.hasOwn(grid, "stage_columns") && grid["stage_columns"] !== "inherit") {
244
+ array(grid["stage_columns"], `${path}.stage_columns`, 1, 16, id);
245
+ }
246
+ if (grid["transverse_bands"] === "inherit") {
247
+ report("layout-hint-not-implemented", `${path}.transverse_bands`, "inherited bands are reserved", {
248
+ hint: "transverse_bands", vocabulary: futureVocabulary,
249
+ });
250
+ }
251
+ else {
252
+ array(grid["transverse_bands"], `${path}.transverse_bands`, 1, 24, (item, itemPath) => {
253
+ const band = object(item, itemPath, ["id", "items"]);
254
+ id(band["id"], `${itemPath}.id`);
255
+ items(band["items"], `${itemPath}.items`, 0, 32);
256
+ });
257
+ }
258
+ if (Object.hasOwn(grid, "peripheral_columns")) {
259
+ array(grid["peripheral_columns"], `${path}.peripheral_columns`, 0, Infinity, (item, itemPath) => {
260
+ const column = object(item, itemPath, ["id", "side", "items", "from_band"]);
261
+ id(column["id"], `${itemPath}.id`);
262
+ word(column["side"], `${itemPath}.side`, sides);
263
+ items(column["items"], `${itemPath}.items`, 1, 16);
264
+ if (Object.hasOwn(column, "from_band"))
265
+ id(column["from_band"], `${itemPath}.from_band`);
266
+ });
267
+ }
268
+ if (Object.hasOwn(grid, "cells"))
269
+ table(grid["cells"], `${path}.cells`, (item, itemPath) => {
270
+ const cell = object(item, itemPath, ["column", "to_column", "to_band", "justify", "align"]);
271
+ for (const key of ["column", "to_column", "to_band"])
272
+ if (Object.hasOwn(cell, key))
273
+ id(cell[key], `${itemPath}.${key}`);
274
+ for (const key of ["justify", "align"])
275
+ if (Object.hasOwn(cell, key))
276
+ word(cell[key], `${itemPath}.${key}`, alignments);
277
+ });
278
+ }, true);
279
+ if (Object.hasOwn(value, "stacks"))
280
+ table(value["stacks"], "stacks", (entry, path) => {
281
+ const stack = object(entry, path, ["axis", "align"]);
282
+ word(stack["axis"], `${path}.axis`, axes);
283
+ if (Object.hasOwn(stack, "align"))
284
+ word(stack["align"], `${path}.align`, alignments);
285
+ });
286
+ // These are still @1 words, including recursive groups and layered-flow scope.
287
+ // Classify the additional geometry keys when the old validator encounters them.
288
+ if (Array.isArray(value["grouping"])) {
289
+ const scanGroup = (group, path) => {
290
+ if (!isObject(group))
291
+ return;
292
+ for (const key of Object.keys(group)) {
293
+ if (!["id", "direction", "items", "stretch"].includes(key))
294
+ unknown(key, `${path}.${key}`);
295
+ }
296
+ const children = group["items"];
297
+ if (Array.isArray(children))
298
+ children.forEach((child, index) => scanGroup(child, `${path}.items.${index}`));
299
+ };
300
+ value["grouping"].forEach((group, index) => scanGroup(group, `grouping.${index}`));
301
+ }
302
+ }
303
+ function checkIdentity(value, report) {
304
+ const conflict = (path, message) => report("layout-hint-conflict", path, message);
305
+ const grids = new Map(Object.entries(value.grids));
306
+ const placed = new Set();
307
+ const bandOwner = new Map();
308
+ for (const [scope, grid] of grids) {
309
+ const path = `grids.${scope}`;
310
+ const ids = new Set();
311
+ const track = (id, trackPath) => {
312
+ if (ids.has(id))
313
+ conflict(trackPath, `duplicate track id ${id}`);
314
+ ids.add(id);
315
+ };
316
+ const place = (items, itemPath) => {
317
+ items.forEach((item, index) => {
318
+ if (placed.has(item))
319
+ conflict(`${itemPath}.${index}`, `${item} is already placed`);
320
+ placed.add(item);
321
+ });
322
+ };
323
+ if (grid.stage_columns !== undefined && grid.stage_columns !== "inherit") {
324
+ grid.stage_columns.forEach((id, index) => track(id, `${path}.stage_columns.${index}`));
325
+ }
326
+ grid.transverse_bands.forEach((band, index) => {
327
+ track(band.id, `${path}.transverse_bands.${index}.id`);
328
+ place(band.items, `${path}.transverse_bands.${index}.items`);
329
+ for (const item of band.items)
330
+ if (!bandOwner.has(item))
331
+ bandOwner.set(item, scope);
332
+ });
333
+ grid.peripheral_columns?.forEach((column, index) => {
334
+ const columnPath = `${path}.peripheral_columns.${index}`;
335
+ track(column.id, `${columnPath}.id`);
336
+ place(column.items, `${columnPath}.items`);
337
+ if (column.from_band !== undefined && !grid.transverse_bands.some((band) => band.id === column.from_band)) {
338
+ conflict(`${columnPath}.from_band`, "unknown starting band");
339
+ }
340
+ });
341
+ if (value.stacks?.[scope] !== undefined)
342
+ conflict(`stacks.${scope}`, "a scope cannot be both a grid and a stack");
343
+ }
344
+ const resolved = new Map();
345
+ const resolving = new Set();
346
+ function columnsOf(scope) {
347
+ const cached = resolved.get(scope);
348
+ if (cached !== undefined)
349
+ return cached;
350
+ const own = grids.get(scope)?.stage_columns;
351
+ if (own !== "inherit")
352
+ return own ?? [];
353
+ const parent = bandOwner.get(scope);
354
+ const parentGrid = parent === undefined ? undefined : grids.get(parent);
355
+ const cell = parentGrid?.cells?.[scope];
356
+ if (scope === "root" || parent === undefined || parentGrid?.stage_columns === undefined ||
357
+ cell?.column === undefined || resolving.has(scope)) {
358
+ conflict(`grids.${scope}.stage_columns`, "inherit requires a cell in an enclosing staged grid");
359
+ return [];
360
+ }
361
+ resolving.add(scope);
362
+ const ids = columnsOf(parent);
363
+ resolving.delete(scope);
364
+ const first = ids.indexOf(cell.column);
365
+ const last = ids.indexOf(cell.to_column ?? cell.column);
366
+ const ownColumns = first >= 0 && last >= first ? ids.slice(first, last + 1) : [];
367
+ resolved.set(scope, ownColumns);
368
+ return ownColumns;
369
+ }
370
+ for (const [scope, grid] of grids) {
371
+ const path = `grids.${scope}`;
372
+ const columns = columnsOf(scope);
373
+ if (grid.stage_columns === "inherit" && columns.length > 0) {
374
+ const inherited = new Set(columns);
375
+ grid.transverse_bands.forEach((band, index) => {
376
+ if (inherited.has(band.id))
377
+ conflict(`${path}.transverse_bands.${index}.id`, `duplicate track id ${band.id}`);
378
+ });
379
+ grid.peripheral_columns?.forEach((column, index) => {
380
+ if (inherited.has(column.id))
381
+ conflict(`${path}.peripheral_columns.${index}.id`, `duplicate track id ${column.id}`);
382
+ });
383
+ }
384
+ const bandIds = grid.transverse_bands.map((band) => band.id);
385
+ const bandItems = new Set(grid.transverse_bands.flatMap((band) => band.items));
386
+ const covered = new Set();
387
+ const slots = new Set();
388
+ const staged = grid.stage_columns !== undefined;
389
+ for (const key of Object.keys(grid.cells ?? {})) {
390
+ if (!bandItems.has(key))
391
+ conflict(`${path}.cells.${key}`, "a cell must belong to a band item of its grid");
392
+ }
393
+ grid.transverse_bands.forEach((band, startBand) => {
394
+ for (const item of band.items) {
395
+ const cell = grid.cells?.[item];
396
+ const cellPath = `${path}.cells.${item}`;
397
+ if (!staged) {
398
+ for (const key of ["column", "to_column", "to_band", "justify"]) {
399
+ if (cell !== undefined && Object.hasOwn(cell, key))
400
+ conflict(`${cellPath}.${key}`, "this field requires stage columns");
401
+ }
402
+ continue;
403
+ }
404
+ if (cell?.column === undefined) {
405
+ conflict(`${cellPath}.column`, "a staged band item requires a cell column");
406
+ continue;
407
+ }
408
+ const first = columns.indexOf(cell.column);
409
+ const last = columns.indexOf(cell.to_column ?? cell.column);
410
+ const endBand = cell.to_band === undefined ? startBand : bandIds.indexOf(cell.to_band);
411
+ if (first < 0)
412
+ conflict(`${cellPath}.column`, "unknown stage column");
413
+ if (cell.to_column !== undefined && (last < 0 || last < first)) {
414
+ conflict(`${cellPath}.to_column`, "the end column must be known and at or after the start column");
415
+ }
416
+ if (endBand < startBand)
417
+ conflict(`${cellPath}.to_band`, "the end band must be known and at or after the start band");
418
+ if (first < 0 || last < first || endBand < startBand)
419
+ continue;
420
+ let overlap = false;
421
+ for (let row = startBand; row <= endBand; row++) {
422
+ if (row > startBand)
423
+ covered.add(row);
424
+ for (let column = first; column <= last; column++) {
425
+ const slot = row * columns.length + column;
426
+ overlap ||= slots.has(slot);
427
+ slots.add(slot);
428
+ }
429
+ }
430
+ if (overlap)
431
+ conflict(cellPath, "cells cannot cover the same slot");
432
+ }
433
+ });
434
+ grid.transverse_bands.forEach((band, index) => {
435
+ if (band.items.length === 0 && !covered.has(index)) {
436
+ conflict(`${path}.transverse_bands.${index}.items`, "an empty band requires a cell spanning it from an earlier band");
437
+ }
438
+ });
439
+ }
440
+ }
441
+ /** Validate the closed @2 vocabulary, then verify identities and span occupancy. */
442
+ export function validateLayoutHintsV2(input, context) {
443
+ const found = [];
444
+ const report = (code, path, message, details) => {
445
+ const item = diagnostic({ code, path: path ? `layout.${path}` : "layout", message, ...(details === undefined ? {} : { details }) });
446
+ if (!found.some((entry) => entry.code === item.code && entry.path === item.path))
447
+ found.push(item);
448
+ };
449
+ try {
450
+ if (!isObject(input)) {
451
+ report("layout-hints-invalid", "", "expected a layout-hint object");
452
+ }
453
+ else if (vocabularyOf(input) !== DS_LAYOUT_V2_VOCABULARY) {
454
+ report("layout-vocabulary-unknown", "vocabulary", `expected ${DS_LAYOUT_V2_VOCABULARY}`);
455
+ }
456
+ else {
457
+ const value = snapshot(input, "", report);
458
+ checkShape(value, report);
459
+ const mode = value["mode"];
460
+ const twin = { vocabulary: DS_LAYOUT_VOCABULARY, mode: mode === "layered-flow" ? mode : "auto-pack" };
461
+ for (const key of DS_LAYOUT_MEASURED_HINTS)
462
+ if (Object.hasOwn(value, key))
463
+ twin[key] = value[key];
464
+ for (const entry of validateLayoutHints(twin, context)) {
465
+ const samePath = found.filter((item) => item.path === entry.path);
466
+ if (samePath.some((item) => item.code === entry.code))
467
+ continue;
468
+ if (entry.code === "layout-hint-unknown" && samePath.length > 0)
469
+ continue;
470
+ found.push(entry);
471
+ }
472
+ if (found.length === 0 && mode === "stage-columns")
473
+ checkIdentity(value, report);
474
+ }
475
+ }
476
+ catch {
477
+ report("layout-hints-invalid", "", "expected a plain, acyclic layout-hint payload");
478
+ }
479
+ return found.sort((a, b) => a.path < b.path ? -1 : a.path > b.path ? 1 : a.code < b.code ? -1 : a.code > b.code ? 1 : 0);
480
+ }
481
+ export function validateAnyLayoutHints(value, context) {
482
+ try {
483
+ return vocabularyOf(value) === DS_LAYOUT_V2_VOCABULARY
484
+ ? validateLayoutHintsV2(value, context)
485
+ : validateLayoutHints(value, context);
486
+ }
487
+ catch {
488
+ return [diagnostic({ code: "layout-hints-invalid", path: "layout", message: "expected a plain layout-hint payload" })];
489
+ }
490
+ }
491
+ /** Lower a validated @2 declaration. Legacy modes share the @1 lowering. */
492
+ export function lowerLayoutHintsV2(hints, roots = []) {
493
+ if (hints.mode !== "stage-columns")
494
+ return lowerLayoutHints({ ...hints, vocabulary: DS_LAYOUT_VOCABULARY }, roots);
495
+ return {
496
+ ...(hints.rootOrder === undefined ? {} : { rootOrder: hints.rootOrder }),
497
+ ...(hints.ordering === undefined ? {} : { ordering: hints.ordering }),
498
+ composition: {
499
+ grids: hints.grids,
500
+ stacks: hints.stacks ?? {},
501
+ aspect: hints.aspect ?? "free",
502
+ fanIn: hints.fanIn ?? "separate",
503
+ fanOut: hints.fanOut ?? "separate",
504
+ legend: hints.legend ?? "host",
505
+ },
506
+ };
507
+ }
508
+ //# sourceMappingURL=layout-hints-v2.js.map
@@ -1,5 +1,5 @@
1
1
  declare const PRIVATE_PACKAGED_CATALOG: {
2
- readonly compatibilityAdapter: "ds:rhanka/sent-tech-design-system/packages/diagram-core/src/presentation-validate.ts@e3bc10cc9e59d48bb807afc41173ba83f6698940#sha256=488d8499b8f4e624af56d0c4f4c07496cc09863ec1e65e9f522c6fc05a4db06e";
2
+ readonly compatibilityAdapter: "ds:rhanka/sent-tech-design-system/packages/diagram-core/src/presentation-validate.ts@ab7d1a7fd0142217672b5be6d40465b3e5309e50#sha256=488d8499b8f4e624af56d0c4f4c07496cc09863ec1e65e9f522c6fc05a4db06e";
3
3
  readonly adapterBytes: string;
4
4
  readonly schemaPin: {
5
5
  readonly id: "diagram-presentation-schema";
@@ -87,8 +87,8 @@ declare const PRIVATE_PACKAGED_CATALOG: {
87
87
  readonly migrations: readonly [];
88
88
  readonly consumers: readonly [];
89
89
  readonly compatibility: {
90
- readonly renderer: "ds:rhanka/sent-tech-design-system/packages/diagram-core/src/presentation-apply.ts@e3bc10cc9e59d48bb807afc41173ba83f6698940#sha256=28c3607e5c4868d44c137b66fe8e6f6ed99cb578fc52a52f67442cca41802cd8";
91
- readonly adapter: "ds:rhanka/sent-tech-design-system/packages/diagram-core/src/presentation-validate.ts@e3bc10cc9e59d48bb807afc41173ba83f6698940#sha256=488d8499b8f4e624af56d0c4f4c07496cc09863ec1e65e9f522c6fc05a4db06e";
90
+ readonly renderer: "ds:rhanka/sent-tech-design-system/packages/diagram-core/src/presentation-apply.ts@ab7d1a7fd0142217672b5be6d40465b3e5309e50#sha256=28c3607e5c4868d44c137b66fe8e6f6ed99cb578fc52a52f67442cca41802cd8";
91
+ readonly adapter: "ds:rhanka/sent-tech-design-system/packages/diagram-core/src/presentation-validate.ts@ab7d1a7fd0142217672b5be6d40465b3e5309e50#sha256=488d8499b8f4e624af56d0c4f4c07496cc09863ec1e65e9f522c6fc05a4db06e";
92
92
  };
93
93
  readonly visibility: "public";
94
94
  readonly linkedTools: readonly [];
@@ -222,8 +222,8 @@ const PRIVATE_ENTRY_2 = {
222
222
  "migrations": [],
223
223
  "consumers": [],
224
224
  "compatibility": {
225
- "renderer": "ds:rhanka/sent-tech-design-system/packages/diagram-core/src/presentation-apply.ts@e3bc10cc9e59d48bb807afc41173ba83f6698940#sha256=28c3607e5c4868d44c137b66fe8e6f6ed99cb578fc52a52f67442cca41802cd8",
226
- "adapter": "ds:rhanka/sent-tech-design-system/packages/diagram-core/src/presentation-validate.ts@e3bc10cc9e59d48bb807afc41173ba83f6698940#sha256=488d8499b8f4e624af56d0c4f4c07496cc09863ec1e65e9f522c6fc05a4db06e"
225
+ "renderer": "ds:rhanka/sent-tech-design-system/packages/diagram-core/src/presentation-apply.ts@ab7d1a7fd0142217672b5be6d40465b3e5309e50#sha256=28c3607e5c4868d44c137b66fe8e6f6ed99cb578fc52a52f67442cca41802cd8",
226
+ "adapter": "ds:rhanka/sent-tech-design-system/packages/diagram-core/src/presentation-validate.ts@ab7d1a7fd0142217672b5be6d40465b3e5309e50#sha256=488d8499b8f4e624af56d0c4f4c07496cc09863ec1e65e9f522c6fc05a4db06e"
227
227
  },
228
228
  "visibility": "public",
229
229
  "linkedTools": [],
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Exact adapter entry bytes at e3bc10cc9e59d48bb807afc41173ba83f6698940.
2
+ * Exact adapter entry bytes at ab7d1a7fd0142217672b5be6d40465b3e5309e50.
3
3
  * Data for catalog authentication, never evaluated or imported as code.
4
4
  * SHA-256: 488d8499b8f4e624af56d0c4f4c07496cc09863ec1e65e9f522c6fc05a4db06e.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Exact adapter entry bytes at e3bc10cc9e59d48bb807afc41173ba83f6698940.
2
+ * Exact adapter entry bytes at ab7d1a7fd0142217672b5be6d40465b3e5309e50.
3
3
  * Data for catalog authentication, never evaluated or imported as code.
4
4
  * SHA-256: 488d8499b8f4e624af56d0c4f4c07496cc09863ec1e65e9f522c6fc05a4db06e.
5
5
  */
@@ -120,8 +120,8 @@ export declare const DIAGRAM_PRESENTATION_RECORD: {
120
120
  };
121
121
  /** Qualified executor/adapter refs from Engram catalog entry 2. */
122
122
  export declare const DIAGRAM_PRESENTATION_COMPATIBILITY: {
123
- readonly renderer: "ds:rhanka/sent-tech-design-system/packages/diagram-core/src/presentation-apply.ts@e3bc10cc9e59d48bb807afc41173ba83f6698940#sha256=28c3607e5c4868d44c137b66fe8e6f6ed99cb578fc52a52f67442cca41802cd8";
124
- readonly adapter: "ds:rhanka/sent-tech-design-system/packages/diagram-core/src/presentation-validate.ts@e3bc10cc9e59d48bb807afc41173ba83f6698940#sha256=488d8499b8f4e624af56d0c4f4c07496cc09863ec1e65e9f522c6fc05a4db06e";
123
+ readonly renderer: "ds:rhanka/sent-tech-design-system/packages/diagram-core/src/presentation-apply.ts@ab7d1a7fd0142217672b5be6d40465b3e5309e50#sha256=28c3607e5c4868d44c137b66fe8e6f6ed99cb578fc52a52f67442cca41802cd8";
124
+ readonly adapter: "ds:rhanka/sent-tech-design-system/packages/diagram-core/src/presentation-validate.ts@ab7d1a7fd0142217672b5be6d40465b3e5309e50#sha256=488d8499b8f4e624af56d0c4f4c07496cc09863ec1e65e9f522c6fc05a4db06e";
125
125
  };
126
126
  /**
127
127
  * Resolved contract catalog entry used by application authentication.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentropic/diagram-core",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "description": "Typed semantic core for diagrams: versioned documents and profiles, views with occurrences, transactional commands with logical inverses. No runtime dependency, no DOM, no framework.",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -28,7 +28,9 @@
28
28
  "./schemas/diagram-view-schema-4.json": "./schemas/diagram-view-schema-4.json",
29
29
  "./schemas/diagram-view-schema-4.sha256": "./schemas/diagram-view-schema-4.sha256",
30
30
  "./schemas/ds-layout-hints-1.json": "./schemas/ds-layout-hints-1.json",
31
- "./schemas/ds-layout-hints-1.sha256": "./schemas/ds-layout-hints-1.sha256"
31
+ "./schemas/ds-layout-hints-1.sha256": "./schemas/ds-layout-hints-1.sha256",
32
+ "./schemas/ds-layout-hints-2.json": "./schemas/ds-layout-hints-2.json",
33
+ "./schemas/ds-layout-hints-2.sha256": "./schemas/ds-layout-hints-2.sha256"
32
34
  },
33
35
  "types": "./dist/index.d.ts",
34
36
  "main": "./dist/index.js",
@@ -0,0 +1 @@
1
+ {"$defs":{"align":{"enum":["start","center","end","stretch"]},"axis":{"enum":["rows","columns"]},"band":{"additionalProperties":false,"properties":{"id":{"$ref":"#/$defs/id"},"items":{"items":{"$ref":"#/$defs/entityRef"},"maxItems":32,"minItems":0,"type":"array"}},"required":["id","items"],"type":"object"},"cell":{"additionalProperties":false,"properties":{"align":{"$ref":"#/$defs/align"},"column":{"$ref":"#/$defs/id"},"justify":{"$ref":"#/$defs/align"},"to_band":{"$ref":"#/$defs/id"},"to_column":{"$ref":"#/$defs/id"}},"type":"object"},"entityRef":{"pattern":"^entity:[A-Za-z0-9][A-Za-z0-9._-]*$","type":"string"},"entityRefList":{"items":{"$ref":"#/$defs/entityRef"},"type":"array","uniqueItems":true},"forbiddenHint":{"enum":["cardGapX","cardGapY","density","edge_label_orientation","gapAfter","height","rankGap","width","x","y","zoneGapX","zoneGapY","anchor","bottom","dc","dx","dy","gap","gutter","labelAt","label_at","left","margin","offset","padding","pin","pins","points","position","right","scale","size","top","via","waypoints","zoom"]},"futureBandValue":{"enum":["inherit"]},"futureHint":{"enum":["compared_panels","loop_corridor","foldable","direction","rotate_labels"]},"futureMode":{"enum":["tree"]},"grid":{"additionalProperties":false,"properties":{"cells":{"additionalProperties":false,"patternProperties":{"^entity:[A-Za-z0-9][A-Za-z0-9._-]*$":{"$ref":"#/$defs/cell"}},"type":"object"},"peripheral_columns":{"items":{"$ref":"#/$defs/peripheralColumn"},"minItems":0,"type":"array"},"stage_columns":{"anyOf":[{"items":{"$ref":"#/$defs/id"},"maxItems":16,"minItems":1,"type":"array"},{"const":"inherit"}]},"transverse_bands":{"items":{"$ref":"#/$defs/band"},"maxItems":24,"minItems":1,"type":"array"}},"required":["transverse_bands"],"type":"object"},"grids":{"additionalProperties":false,"patternProperties":{"^entity:[A-Za-z0-9][A-Za-z0-9._-]*$":{"$ref":"#/$defs/grid"}},"properties":{"root":{"$ref":"#/$defs/grid"}},"required":["root"],"type":"object"},"group":{"additionalProperties":false,"properties":{"direction":{"$ref":"#/$defs/axis"},"id":{"maxLength":80,"minLength":1,"type":"string"},"items":{"items":{"anyOf":[{"$ref":"#/$defs/entityRef"},{"$ref":"#/$defs/group"}]},"minItems":1,"type":"array"},"stretch":{"type":"boolean"}},"required":["id","direction","items"],"type":"object"},"id":{"pattern":"^[a-z][a-z0-9-]{0,39}$","type":"string"},"layeredFlowScope":{"properties":{"diagramPresentation":{"const":false},"presentationVocabulary":false,"profiles":{"items":{"const":"generic@1"},"minItems":1,"type":"array"}},"required":["profiles","diagramPresentation"],"type":"object"},"measuredHint":{"enum":["grouping","grouping_axis","ordering","rootOrder","stretch"]},"mode":{"enum":["auto-pack","layered-flow","stage-columns"]},"modeScope":{"auto-pack":{"enum":["grids","stacks","aspect","fanIn","fanOut","legend"]},"layered-flow":{"enum":["grouping","grouping_axis","ordering","rootOrder","stretch","grids","stacks","aspect","fanIn","fanOut","legend"]},"stage-columns":{"enum":["grouping","grouping_axis","stretch"]}},"peripheralColumn":{"additionalProperties":false,"properties":{"from_band":{"$ref":"#/$defs/id"},"id":{"$ref":"#/$defs/id"},"items":{"items":{"$ref":"#/$defs/entityRef"},"maxItems":16,"minItems":1,"type":"array"},"side":{"enum":["start","end"]}},"required":["id","side","items"],"type":"object"},"stack":{"additionalProperties":false,"properties":{"align":{"$ref":"#/$defs/align"},"axis":{"enum":["row","column"]}},"required":["axis"],"type":"object"},"supersededMode":{"enum":["lane-stack","matrix-grid"]}},"$id":"https://sentropic.dev/schemas/diagram/layout-hints/v2","$schema":"https://json-schema.org/draft/2020-12/schema","additionalProperties":false,"allOf":[{"if":{"properties":{"mode":{"const":"auto-pack"}},"required":["mode"]},"then":{"properties":{"aspect":false,"fanIn":false,"fanOut":false,"grids":false,"legend":false,"stacks":false}}},{"if":{"properties":{"mode":{"const":"layered-flow"}},"required":["mode"]},"then":{"properties":{"aspect":false,"fanIn":false,"fanOut":false,"grids":false,"grouping":false,"grouping_axis":false,"legend":false,"ordering":false,"rootOrder":false,"stacks":false,"stretch":false}}},{"if":{"properties":{"mode":{"const":"stage-columns"}},"required":["mode"]},"then":{"properties":{"grids":{"$ref":"#/$defs/grids"},"grouping":false,"grouping_axis":false,"stretch":false},"required":["grids"]}}],"dependentSchemas":{"grouping":{"properties":{"grouping_axis":false}}},"properties":{"aspect":{"enum":["16:9","free"]},"fanIn":{"enum":["comb","separate"]},"fanOut":{"enum":["comb","separate"]},"grids":{"$ref":"#/$defs/grids"},"grouping":{"items":{"$ref":"#/$defs/group"},"type":"array"},"grouping_axis":{"$ref":"#/$defs/axis"},"legend":{"enum":["right","bottom","free-cell","none"]},"mode":{"$ref":"#/$defs/mode"},"ordering":{"additionalProperties":{"$ref":"#/$defs/entityRefList"},"propertyNames":{"$ref":"#/$defs/entityRef"},"type":"object"},"rootOrder":{"$ref":"#/$defs/entityRefList"},"stacks":{"additionalProperties":false,"patternProperties":{"^entity:[A-Za-z0-9][A-Za-z0-9._-]*$":{"$ref":"#/$defs/stack"}},"type":"object"},"stretch":{"type":"boolean"},"vocabulary":{"const":"ds-layout-hints@2"}},"required":["vocabulary","mode"],"title":"ds-layout-hints@2","type":"object"}
@@ -0,0 +1 @@
1
+ f67182ff68bbd5119575c7cb482f2115616b033b59af4455d03fca6f7b64b4a7