@mark1russell7/layout-contract 0.9.0 → 0.9.2

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/README.md CHANGED
@@ -105,6 +105,7 @@ The comments of the source name each doc as `docs/<NAME>.md`. The docs are in th
105
105
  | Doc | The subject |
106
106
  |---|---|
107
107
  | [`docs/BALANCE.md`](https://github.com/mark1russell7/layout-contract/blob/main/docs/BALANCE.md) | The balance and stability measures of a pack and of a joint layout |
108
+ | [`docs/FRAMES.md`](https://github.com/mark1russell7/layout-contract/blob/main/docs/FRAMES.md) | The frame record `layout-frame/1`, the frames between two layouts and their laws |
108
109
  | [`docs/TEXT.md`](https://github.com/mark1russell7/layout-contract/blob/main/docs/TEXT.md) | The text layout of the subpath `/text`: the rules, the units and the measures |
109
110
  | [`docs/CORPUS.md`](https://github.com/mark1russell7/layout-contract/blob/main/docs/CORPUS.md) | The shared corpus registry, its dimensions and families |
110
111
  | [`docs/CORPUS-CHECKS.md`](https://github.com/mark1russell7/layout-contract/blob/main/docs/CORPUS-CHECKS.md) | The corpus checks and the split files |
package/build/index.d.ts CHANGED
@@ -424,6 +424,62 @@ export declare function balanceMeasures<S extends string>(stage: S, balance: Bal
424
424
  * The balance measures read the area of each box, so they support only `rect`. The stability measures read only the centers.
425
425
  */
426
426
  export declare function balanceMeasureSpecs<S extends string>(stage: S): readonly MeasureSpec<`${S}.${BalanceMeasureSuffix}`>[];
427
+ /** The schema of a frame. */
428
+ export declare const FRAME_SCHEMA = "layout-frame/1";
429
+ /** The states of a box in a frame: in the two layouts, only in the end layout, or only in the start layout. */
430
+ export declare const FRAME_STATES: readonly ["stay", "enter", "leave"];
431
+ /** The state of a box in a frame. */
432
+ export type FrameState = (typeof FRAME_STATES)[number];
433
+ /** One box of a frame: its rectangle, its turn, its presence and its state. */
434
+ export interface FrameBox extends PlacedBox {
435
+ readonly turn?: 0 | 90;
436
+ /** The visible share of the box, from 0 (not visible) to 1 (fully visible). */
437
+ readonly presence: number;
438
+ readonly state: FrameState;
439
+ }
440
+ /** A frame: the boxes of a layout by id, at one time of a change. Each id occurs one time. */
441
+ export interface LayoutFrame {
442
+ readonly schema: typeof FRAME_SCHEMA;
443
+ readonly boxes: readonly FrameBox[];
444
+ }
445
+ /**
446
+ * The change of the presence of a box that enters or leaves.
447
+ * With `fade`, the presence changes in a straight line with the time.
448
+ * With `cut`, an entering box is fully visible after the time 0, and a leaving box is fully visible before the time 1.
449
+ */
450
+ export type Presence = "fade" | "cut";
451
+ /** The options of `frameAt`. The default of each is `fade`. */
452
+ export interface FrameAtOptions {
453
+ readonly enter?: Presence;
454
+ readonly leave?: Presence;
455
+ }
456
+ /** One box of a layout for `frameOf`: a placed rectangle, with an optional turn. */
457
+ export interface FrameSource extends PlacedBox {
458
+ readonly turn?: 0 | 90;
459
+ }
460
+ /** This function makes a frame of a layout. Each box has the state `stay` and the presence 1. */
461
+ export declare function frameOf(boxes: readonly FrameSource[]): LayoutFrame;
462
+ /** This function gives the placements of a frame: the boxes with the state `stay` or `enter`, in the order of the frame. An engine starts a layout from them. */
463
+ export declare function outputOf(frame: LayoutFrame): Placement[];
464
+ /**
465
+ * This function gives the frame at the time `t` of the change from `from` to `to`. The time is a number from 0 to 1.
466
+ * A box in the two frames moves on a straight line, and its size and presence change on a straight line. It keeps the turn of `from` before the time 1.
467
+ *
468
+ * A box only in `to` enters at its place in `to`. A box only in `from` leaves at its place in `from`. `options` sets how their presence changes.
469
+ * At the time 1, the result has the boxes of `to`. At the time 0, the result has the boxes of `from` and the entering boxes.
470
+ * The order of the result: the boxes of `to`, then the leaving boxes in the order of `from`.
471
+ */
472
+ export declare function frameAt(from: LayoutFrame, to: LayoutFrame, t: number, options?: FrameAtOptions): LayoutFrame;
473
+ /**
474
+ * This function gives the move from `a` to `b`: the sum of the distances of the box centers, over the ids in the two frames.
475
+ * A box that enters or leaves does not move, so it adds nothing. A start frame that an engine does not change gives 0.
476
+ */
477
+ export declare function frameMove(a: LayoutFrame, b: LayoutFrame): number;
478
+ /**
479
+ * This function gives the move of an engine from a start frame: `frameMove(start, run(start))`.
480
+ * The gate of a start: a start that is a fixed point of the engine gives 0.
481
+ */
482
+ export declare function fixedPointMove(start: LayoutFrame, run: (start: LayoutFrame) => LayoutFrame): number;
427
483
  /**
428
484
  * The common fields of a strategy of an engine. Each engine adds its own function, for example `pack` or `route`.
429
485
  * `O` is the type of the options, and `S` is the type of `supports`.
@@ -732,6 +788,57 @@ export declare function pickMoves(trace: Pick<PortfolioTrace, "picked">): {
732
788
  * It also throws a `RangeError` for an empty list of members, or for two members with the same id.
733
789
  */
734
790
  export declare function portfolio<I, O>(id: string, members: readonly Member<I, O>[] | ((input: I) => readonly Member<I, O>[]), key: PortfolioKey<I, O>, options?: PortfolioOptions): Portfolio<I, O>;
791
+ /** The schema of a corpus manifest. */
792
+ export declare const CORPUS_MANIFEST_SCHEMA = "layout-corpus/1";
793
+ /** The held-out split of a portfolio report: a seed, or `all` when each input is held out. */
794
+ export type HeldOut = number | "all";
795
+ /** The claims of a corpus that each bench reads. `declared` is the count of the inputs of each declared property. */
796
+ export interface ManifestClaims {
797
+ readonly declared?: DeclaredClaim;
798
+ }
799
+ /**
800
+ * A corpus manifest: the name, the specs of the inputs and, as an option, the held-out split, the claims and the inputs.
801
+ * `Spec`, `Claims` and `Input` are the types of the bench that writes the manifest.
802
+ */
803
+ export interface CorpusManifest<Spec = unknown, Claims extends object = ManifestClaims, Input = unknown> {
804
+ readonly schema: typeof CORPUS_MANIFEST_SCHEMA;
805
+ readonly corpus: string;
806
+ readonly heldOut?: HeldOut;
807
+ readonly claims?: Claims;
808
+ readonly specs: readonly Spec[];
809
+ readonly inputs?: readonly Input[];
810
+ }
811
+ /**
812
+ * The form of a JSON value on one line.
813
+ * With `spaced`, a space comes after each colon and each comma. With `compact`, the text is the text of `JSON.stringify`.
814
+ */
815
+ export type JsonStyle = "spaced" | "compact";
816
+ /** This function gives a JSON value on one line, in the style `style`. The keys of an object keep their order. */
817
+ export declare function lineJson(value: unknown, style?: JsonStyle): string;
818
+ /** One field of a manifest text. */
819
+ export interface ManifestField {
820
+ readonly key: string;
821
+ /** The value. With `rows`, it is an array, and each item gets its own line. */
822
+ readonly value: unknown;
823
+ readonly rows?: boolean;
824
+ /** The style of the value or of each item. The default is the style of the options. */
825
+ readonly style?: JsonStyle;
826
+ }
827
+ /** The options of `manifestText`. */
828
+ export interface ManifestTextOptions {
829
+ /** The style of each field with no style of its own. The default is `spaced`. */
830
+ readonly style?: JsonStyle;
831
+ /** The text of a list with no item: `[]` (the default), or `[` and `]` with an empty line between them. */
832
+ readonly emptyRows?: "brackets" | "line";
833
+ }
834
+ /** This function gives the text of a manifest: `{`, one line for each field in the order of `fields`, `}` and a newline. */
835
+ export declare function manifestText(fields: readonly ManifestField[], options?: ManifestTextOptions): string;
836
+ /**
837
+ * This function gives the text of a corpus manifest.
838
+ * The fields come in the order `schema`, `corpus`, `heldOut`, `claims`, `specs` and `inputs`. A field with no value is not in the text.
839
+ * `specs` and `inputs` have one line for each item.
840
+ */
841
+ export declare function corpusManifestText<Spec, Claims extends object, Input>(manifest: CorpusManifest<Spec, Claims, Input>, options?: ManifestTextOptions): string;
735
842
  /**
736
843
  * This function checks a space with `checkSpace` of `@mark1russell7/strategy-space`.
737
844
  * Without `kinds`, a shape kind of a `supports` that is not in `SHAPE_KIND_IDS` gives the claim `shape`.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":["StrategySpace","KindOptions","SpaceSizeOptions","SpaceSize","EnumerateOptions","StrategyConfig"],"sources":["../src/tolerance.ts","../src/output.ts","../src/record.ts","../src/rules.ts","../src/turn.ts","../src/balance.ts","../src/strategy.ts","../src/random.ts","../src/edges.ts","../src/hash.ts","../src/portfolio.ts","../src/strategy-space.ts","../src/strategy-catalog.ts","../src/verdict.ts","../src/families.ts"],"mappings":";;;qBACa;;qBAGA;;;;;qBAMA;;;;;qBAMA;;;;;iBAMI;;WAEN;;WAEA;;;;;;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Ac,mBAAmB;;EAE/C,MAAM,cAAc,oBAAoB,cAAc,OAAO,SAAS,eAAe;;EAErF,YAAY;;;qBAID,mBAAmB;;;;;qBAwCnB,mBAAmB,SAAS,eAAe;;;;;wBA4BxC,gBAAgB,cAAc,QAAO,QAAQ,mBAAwB;;YAUzE,qBAAqB,KAAK;;;;;;wBAOtB,eAAe,cAAc,MAAM,qBAAqB;;;;;wBA+BxD,kBAAkB,KAAK,iBAAiB;;;;;wBA+FxC,YAAY,KAAK,YAAY;;wBAa7B,cAAc,KAAK,YAAY;;;;;;wBAsB/B,SAAS,KAAK,iBAAiB,iBAAiB;;;;;;;;wBAsChD,kBACd,qBAAqB,mBACrB,OAAM,SAAS,eAAe,cAC9B,gBACA,cACC;;wBA8Ha,qBAAqB,IAAI,aAAa,WAAU,SAAS,aAAa,MAAW,eAAe;;iBA2G/F;WACN;WACA;;WAEA;WACA;;WAEA,qBAAqB;;WAErB;WACA,aAAa;;WAEb,cAAc,MAAM;;EAE7B,MAAM,OAAO,aAAa,cAAc,MAAM,kBAAkB;;;iBAIjD;;WAEN;;WAEA;WACA;;WAEA,QAAQ,OAAO;;;;;;;wBAWV,cAAc,MAAM,aAAa,cAAc,gBAAgB,cAAc,UAAS,iBAAsB,aAAa;;;;;qBA+D5H,YAAY;;;;qBA0BZ,eAAe;;;;;;;;;qBAuBf,kBAAkB,aAAa;;;;;;qBAqD/B,gBAAgB,aAAa"}
1
+ {"version":3,"file":"index.d.ts","names":["StrategySpace","KindOptions","SpaceSizeOptions","SpaceSize","EnumerateOptions","StrategyConfig"],"sources":["../src/tolerance.ts","../src/output.ts","../src/record.ts","../src/rules.ts","../src/turn.ts","../src/balance.ts","../src/frame.ts","../src/strategy.ts","../src/random.ts","../src/edges.ts","../src/hash.ts","../src/portfolio.ts","../src/corpus-manifest.ts","../src/strategy-space.ts","../src/strategy-catalog.ts","../src/verdict.ts","../src/families.ts"],"mappings":";;;qBACa;;qBAGA;;;;;qBAMA;;;;;qBAMA;;;;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qB,mBACrB,OAAM,SAAS,eAAe,cAC9B,gBACA,cACC;;wBA8Ha,qBAAqB,IAAI,aAAa,WAAU,SAAS,aAAa,MAAW,eAAe;;iBA2G/F;WACN;WACA;;WAEA;WACA;;WAEA,qBAAqB;;WAErB;WACA,aAAa;;WAEb,cAAc,MAAM;;EAE7B,MAAM,OAAO,aAAa,cAAc,MAAM,kBAAkB;;;iBAIjD;;WAEN;;WAEA;WACA;;WAEA,QAAQ,OAAO;;;;;;;wBAWV,cAAc,MAAM,aAAa,cAAc,gBAAgB,cAAc,UAAS,iBAAsB,aAAa;;;;;qBA+D5H,YAAY;;;;qBA0BZ,eAAe;;;;;;;;;qBAuBf,kBAAkB,aAAa;;;;;;qBAqD/B,gBAAgB,aAAa"}
package/build/index.js CHANGED
@@ -1931,6 +1931,164 @@ function balanceMeasureSpecs(stage) {
1931
1931
  }
1932
1932
  ]);
1933
1933
  }
1934
+ // src/frame.ts
1935
+ /** The schema of a frame. */
1936
+ const FRAME_SCHEMA = "layout-frame/1";
1937
+ /** The states of a box in a frame: in the two layouts, only in the end layout, or only in the start layout. */
1938
+ const FRAME_STATES = [
1939
+ "stay",
1940
+ "enter",
1941
+ "leave"
1942
+ ];
1943
+ /** This function throws a `RangeError` for a value that is not a finite number. */
1944
+ function finite(value, name) {
1945
+ if (!Number.isFinite(value)) throw new RangeError(`layout-frame: the ${name} ${value} is not a finite number.`);
1946
+ }
1947
+ /** This function gives the boxes of a frame by id. An id two times or a bad value causes a `RangeError`. */
1948
+ function byId$1(frame, name) {
1949
+ if (frame.schema !== "layout-frame/1") throw new RangeError(`layout-frame: the ${name} frame has the schema ${String(frame.schema)}, not ${FRAME_SCHEMA}.`);
1950
+ const map = /* @__PURE__ */ new Map();
1951
+ for (const b of frame.boxes) {
1952
+ if (map.has(b.id)) throw new RangeError(`layout-frame: the id ${b.id} occurs two times in the ${name} frame.`);
1953
+ for (const k of [
1954
+ "x",
1955
+ "y",
1956
+ "w",
1957
+ "h",
1958
+ "presence"
1959
+ ]) finite(b[k], `${k} of ${b.id}`);
1960
+ if (b.presence < 0 || b.presence > 1) throw new RangeError(`layout-frame: the presence ${b.presence} of ${b.id} is not between 0 and 1.`);
1961
+ if (b.turn !== void 0 && b.turn !== 0 && b.turn !== 90) throw new RangeError(`layout-frame: the turn ${String(b.turn)} of ${b.id} is not 0 or 90.`);
1962
+ if (!FRAME_STATES.includes(b.state)) throw new RangeError(`layout-frame: the state ${String(b.state)} of ${b.id} is not one of ${FRAME_STATES.join(", ")}.`);
1963
+ map.set(b.id, b);
1964
+ }
1965
+ return map;
1966
+ }
1967
+ /** This function gives a box with the optional turn of `turn`. */
1968
+ function withTurn(box, turn) {
1969
+ return turn === void 0 ? box : {
1970
+ ...box,
1971
+ turn
1972
+ };
1973
+ }
1974
+ /** This function makes a frame of a layout. Each box has the state `stay` and the presence 1. */
1975
+ function frameOf(boxes) {
1976
+ const frame = {
1977
+ schema: FRAME_SCHEMA,
1978
+ boxes: boxes.map((b) => withTurn({
1979
+ id: b.id,
1980
+ x: b.x,
1981
+ y: b.y,
1982
+ w: b.w,
1983
+ h: b.h,
1984
+ presence: 1,
1985
+ state: "stay"
1986
+ }, b.turn))
1987
+ };
1988
+ byId$1(frame, "made");
1989
+ return frame;
1990
+ }
1991
+ /** This function gives the placements of a frame: the boxes with the state `stay` or `enter`, in the order of the frame. An engine starts a layout from them. */
1992
+ function outputOf(frame) {
1993
+ byId$1(frame, "given");
1994
+ return frame.boxes.filter((b) => b.state !== "leave").map((b) => b.turn === void 0 ? {
1995
+ id: b.id,
1996
+ x: b.x,
1997
+ y: b.y
1998
+ } : {
1999
+ id: b.id,
2000
+ x: b.x,
2001
+ y: b.y,
2002
+ turn: b.turn
2003
+ });
2004
+ }
2005
+ /** This function gives the presence of a box that enters (`up`) or leaves, at the time `t`. */
2006
+ function presenceAt(mode, up, from, t) {
2007
+ const to = up ? 1 : 0;
2008
+ if (mode === "fade") return from + (to - from) * t;
2009
+ if (up) return t > 0 ? 1 : from;
2010
+ return t < 1 ? from : 0;
2011
+ }
2012
+ /**
2013
+ * This function gives the frame at the time `t` of the change from `from` to `to`. The time is a number from 0 to 1.
2014
+ * A box in the two frames moves on a straight line, and its size and presence change on a straight line. It keeps the turn of `from` before the time 1.
2015
+ *
2016
+ * A box only in `to` enters at its place in `to`. A box only in `from` leaves at its place in `from`. `options` sets how their presence changes.
2017
+ * At the time 1, the result has the boxes of `to`. At the time 0, the result has the boxes of `from` and the entering boxes.
2018
+ * The order of the result: the boxes of `to`, then the leaving boxes in the order of `from`.
2019
+ */
2020
+ function frameAt(from, to, t, options = {}) {
2021
+ finite(t, "time");
2022
+ if (t < 0 || t > 1) throw new RangeError(`layout-frame: the time ${t} is not between 0 and 1.`);
2023
+ const a = byId$1(from, "start");
2024
+ byId$1(to, "end");
2025
+ if (t === 1) return {
2026
+ schema: FRAME_SCHEMA,
2027
+ boxes: [...to.boxes]
2028
+ };
2029
+ const enter = options.enter ?? "fade";
2030
+ const leave = options.leave ?? "fade";
2031
+ const lerp = (p, q) => p + (q - p) * t;
2032
+ const boxes = [];
2033
+ const seen = /* @__PURE__ */ new Set();
2034
+ for (const q of to.boxes) {
2035
+ seen.add(q.id);
2036
+ const p = a.get(q.id);
2037
+ if (p === void 0) {
2038
+ boxes.push({
2039
+ ...q,
2040
+ presence: presenceAt(enter, true, 0, t),
2041
+ state: "enter"
2042
+ });
2043
+ continue;
2044
+ }
2045
+ const state = p.state === "stay" ? q.state : p.state;
2046
+ const presence = p.state === "enter" ? presenceAt(enter, true, p.presence, t) : p.state === "leave" && q.state === "leave" ? presenceAt(leave, false, p.presence, t) : lerp(p.presence, q.presence);
2047
+ boxes.push(withTurn({
2048
+ id: q.id,
2049
+ x: lerp(p.x, q.x),
2050
+ y: lerp(p.y, q.y),
2051
+ w: lerp(p.w, q.w),
2052
+ h: lerp(p.h, q.h),
2053
+ presence,
2054
+ state
2055
+ }, p.turn));
2056
+ }
2057
+ for (const p of from.boxes) {
2058
+ if (seen.has(p.id)) continue;
2059
+ boxes.push({
2060
+ ...p,
2061
+ presence: presenceAt(leave, false, p.presence, t),
2062
+ state: "leave"
2063
+ });
2064
+ }
2065
+ return {
2066
+ schema: FRAME_SCHEMA,
2067
+ boxes
2068
+ };
2069
+ }
2070
+ /**
2071
+ * This function gives the move from `a` to `b`: the sum of the distances of the box centers, over the ids in the two frames.
2072
+ * A box that enters or leaves does not move, so it adds nothing. A start frame that an engine does not change gives 0.
2073
+ */
2074
+ function frameMove(a, b) {
2075
+ const before = byId$1(a, "first");
2076
+ byId$1(b, "second");
2077
+ let sum = 0;
2078
+ for (const q of b.boxes) {
2079
+ const p = before.get(q.id);
2080
+ if (p === void 0) continue;
2081
+ sum += Math.hypot(q.x + q.w / 2 - (p.x + p.w / 2), q.y + q.h / 2 - (p.y + p.h / 2));
2082
+ }
2083
+ return sum;
2084
+ }
2085
+ /**
2086
+ * This function gives the move of an engine from a start frame: `frameMove(start, run(start))`.
2087
+ * The gate of a start: a start that is a fixed point of the engine gives 0.
2088
+ */
2089
+ function fixedPointMove(start, run) {
2090
+ return frameMove(start, run(start));
2091
+ }
1934
2092
  // src/random.ts
1935
2093
  /**
1936
2094
  * This function gives a generator of random numbers in [0, 1). It is `mulberry32`, as in `docs/FORMAT.md` of `packing`.
@@ -2873,6 +3031,65 @@ function leaveOneSeedOut(seeds) {
2873
3031
  heldOut: [s]
2874
3032
  }));
2875
3033
  }
3034
+ // src/corpus-manifest.ts
3035
+ /** The schema of a corpus manifest. */
3036
+ const CORPUS_MANIFEST_SCHEMA = "layout-corpus/1";
3037
+ /** This function gives a JSON value on one line, in the style `style`. The keys of an object keep their order. */
3038
+ function lineJson(value, style = "spaced") {
3039
+ if (style === "compact") return JSON.stringify(value);
3040
+ if (Array.isArray(value)) return `[${value.map((v) => lineJson(v)).join(", ")}]`;
3041
+ if (value !== null && typeof value === "object") return `{${Object.entries(value).map(([k, v]) => `${JSON.stringify(k)}: ${lineJson(v)}`).join(", ")}}`;
3042
+ return JSON.stringify(value);
3043
+ }
3044
+ /** This function gives the text of a manifest: `{`, one line for each field in the order of `fields`, `}` and a newline. */
3045
+ function manifestText(fields, options = {}) {
3046
+ const keys = /* @__PURE__ */ new Set();
3047
+ return `{\n${fields.map((field, i) => {
3048
+ if (keys.has(field.key)) throw new RangeError(`manifestText: the key ${field.key} occurs two times.`);
3049
+ keys.add(field.key);
3050
+ const style = field.style ?? options.style ?? "spaced";
3051
+ const end = i === fields.length - 1 ? "" : ",";
3052
+ const head = ` ${JSON.stringify(field.key)}: `;
3053
+ if (field.rows !== true) return `${head}${lineJson(field.value, style)}${end}`;
3054
+ if (!Array.isArray(field.value)) throw new RangeError(`manifestText: the field ${field.key} has rows, so its value is an array.`);
3055
+ if (field.value.length === 0 && options.emptyRows !== "line") return `${head}[]${end}`;
3056
+ return `${head}[\n${field.value.map((item) => ` ${lineJson(item, style)}`).join(",\n")}\n ]${end}`;
3057
+ }).join("\n")}\n}\n`;
3058
+ }
3059
+ /**
3060
+ * This function gives the text of a corpus manifest.
3061
+ * The fields come in the order `schema`, `corpus`, `heldOut`, `claims`, `specs` and `inputs`. A field with no value is not in the text.
3062
+ * `specs` and `inputs` have one line for each item.
3063
+ */
3064
+ function corpusManifestText(manifest, options = {}) {
3065
+ if (manifest.schema !== "layout-corpus/1") throw new RangeError(`corpusManifestText: the schema is ${String(manifest.schema)}, not ${CORPUS_MANIFEST_SCHEMA}.`);
3066
+ const fields = [{
3067
+ key: "schema",
3068
+ value: manifest.schema
3069
+ }, {
3070
+ key: "corpus",
3071
+ value: manifest.corpus
3072
+ }];
3073
+ if (manifest.heldOut !== void 0) fields.push({
3074
+ key: "heldOut",
3075
+ value: manifest.heldOut
3076
+ });
3077
+ if (manifest.claims !== void 0) fields.push({
3078
+ key: "claims",
3079
+ value: manifest.claims
3080
+ });
3081
+ fields.push({
3082
+ key: "specs",
3083
+ value: manifest.specs,
3084
+ rows: true
3085
+ });
3086
+ if (manifest.inputs !== void 0) fields.push({
3087
+ key: "inputs",
3088
+ value: manifest.inputs,
3089
+ rows: true
3090
+ });
3091
+ return manifestText(fields, options);
3092
+ }
2876
3093
  // src/strategy-space.ts
2877
3094
  /** This function gives the known shape kinds of a check: the list of the caller, or `SHAPE_KIND_IDS`. */
2878
3095
  const withKinds = (options) => ({
@@ -4897,6 +5114,6 @@ const RECT_SCATTERED = /* @__PURE__ */ Object.freeze({
4897
5114
  };
4898
5115
  }
4899
5116
  });
4900
- export { BALANCE_MEASURE_SUFFIXES, BALANCE_SIDE_DEPTH, CIRCLE_SCATTERED, CORPUS_DIMENSIONS, DEFAULT_FAMILY_BY, DEFAULT_RNG, DEFAULT_SHAPES, DEFAULT_TOLERANCE, EDGES_STEP, EDGE_DENSITY, EDGE_KEY_STEP, EDGE_KEY_STEP_VERSION, EDGE_STEP_VERSION, EPS, EPS_STEPS, FAMILY_ANY_KIND, HARD_RULE_VERSION, INVALIDATED_FIELD, JOINT_MEASURES, JOINT_MOVED_MIN, NODE_POSITIONS_DIMENSION, OUTPUT_CLASS_MIN_INPUTS, OUTPUT_GRID_PROPERTIES, OUTPUT_NEAR_WHOLE, PACK_HARD_RULES, RECORD_EPS, RECORD_SCALE, RECT_SCATTERED, REFUSED_PROBE, SHAPE_KINDS, SHAPE_KIND_IDS, SIDES, SPLIT_SCHEMA, STRATEGY_CATALOG_SCHEMA, STRATEGY_CATALOG_SCHEMAS, STRATEGY_SPACE_SCHEMA, VERDICT_DRAWS, VERDICT_EXACT_CAP, VERDICT_EXACT_MAX, VERDICT_RUNS, VERDICT_SEED, applyPack, balanceMeasureSpecs, balanceMeasures, balanceOf, boundsOf, boxArea, canonicalConfig, canonicalInput, canonicalJson, carryRecord, catalogChoices, catalogDefaults, catalogKey, catalogOptions, checkCatalog, checkConfig, checkDeclared, checkInput, checkLayoutRecord, checkOptions, checkSchema, checkShapes, checkSpace, checkSplit, circleOverlaps, circlesOutside, clampOptions, compareMeasure, composeFamily, configId, corpusHashOf, countLinksThroughShapes, countObstacleHits, countOutside, countOverlaps, countPortsOffBorder, createFamilyRegistry, crossingPoint, declarationIssues, declaredClaimOf, declaredCounts, decodeOptionValue, dimensionAt, dimensionSupports, dimensionUnit, documentHash, dropIndex, edgeKeyStep, edgeStep, encodeOptionValue, enumerateSpace, exercised, familyKind, familyOf, fingerprintOf, fnv1a32, grow, hardRuleOf, inputShapeLevel, isShapeKind, itemShapeOf, joinConfigs, leaveOneSeedOut, levelsOf, listOptions, marginSides, minEffectOf, mulberry32, nearestGaps, optionDefaults, optionIssue, outputGridClass, outputGroups, outputHash, overlapOf, ownerDimension, packHard, packLinks, packOutputForm, paramActive, paramLevels, paramProblem, paramValue, parseLayoutRecord, parseStrategyCatalog, perChange, pickMoves, placedCircle, placedRect, pointSegmentDistance, portPoint, portfolio, probeHash, procrustesOf, productSpace, randomInt, rectInRegion, regionArea, regionHitsRect, resolveDimensions, ruleLevel, segmentThroughShape, segmentsCross, selectBest, sha256Hex, shapeKindOf, shapeKindProblem, shapeKindsOf, shapeLevel, shapeSupportProblems, shapesOf, shapesOverlap, sharedDimension, spaceShapeKinds, spaceSize, splitConfig, splitFileName, splitFolds, stepRandom, sweepGrid, sweepOf, sweepValues, toLayoutRecord, toPackInput, toRect, toSizedRect, translate, turnBox, turnMargin, turnPoint, turnPort, turnRegion, turnSide, verdict, writeStrategyCatalog };
5117
+ export { BALANCE_MEASURE_SUFFIXES, BALANCE_SIDE_DEPTH, CIRCLE_SCATTERED, CORPUS_DIMENSIONS, CORPUS_MANIFEST_SCHEMA, DEFAULT_FAMILY_BY, DEFAULT_RNG, DEFAULT_SHAPES, DEFAULT_TOLERANCE, EDGES_STEP, EDGE_DENSITY, EDGE_KEY_STEP, EDGE_KEY_STEP_VERSION, EDGE_STEP_VERSION, EPS, EPS_STEPS, FAMILY_ANY_KIND, FRAME_SCHEMA, FRAME_STATES, HARD_RULE_VERSION, INVALIDATED_FIELD, JOINT_MEASURES, JOINT_MOVED_MIN, NODE_POSITIONS_DIMENSION, OUTPUT_CLASS_MIN_INPUTS, OUTPUT_GRID_PROPERTIES, OUTPUT_NEAR_WHOLE, PACK_HARD_RULES, RECORD_EPS, RECORD_SCALE, RECT_SCATTERED, REFUSED_PROBE, SHAPE_KINDS, SHAPE_KIND_IDS, SIDES, SPLIT_SCHEMA, STRATEGY_CATALOG_SCHEMA, STRATEGY_CATALOG_SCHEMAS, STRATEGY_SPACE_SCHEMA, VERDICT_DRAWS, VERDICT_EXACT_CAP, VERDICT_EXACT_MAX, VERDICT_RUNS, VERDICT_SEED, applyPack, balanceMeasureSpecs, balanceMeasures, balanceOf, boundsOf, boxArea, canonicalConfig, canonicalInput, canonicalJson, carryRecord, catalogChoices, catalogDefaults, catalogKey, catalogOptions, checkCatalog, checkConfig, checkDeclared, checkInput, checkLayoutRecord, checkOptions, checkSchema, checkShapes, checkSpace, checkSplit, circleOverlaps, circlesOutside, clampOptions, compareMeasure, composeFamily, configId, corpusHashOf, corpusManifestText, countLinksThroughShapes, countObstacleHits, countOutside, countOverlaps, countPortsOffBorder, createFamilyRegistry, crossingPoint, declarationIssues, declaredClaimOf, declaredCounts, decodeOptionValue, dimensionAt, dimensionSupports, dimensionUnit, documentHash, dropIndex, edgeKeyStep, edgeStep, encodeOptionValue, enumerateSpace, exercised, familyKind, familyOf, fingerprintOf, fixedPointMove, fnv1a32, frameAt, frameMove, frameOf, grow, hardRuleOf, inputShapeLevel, isShapeKind, itemShapeOf, joinConfigs, leaveOneSeedOut, levelsOf, lineJson, listOptions, manifestText, marginSides, minEffectOf, mulberry32, nearestGaps, optionDefaults, optionIssue, outputGridClass, outputGroups, outputHash, outputOf, overlapOf, ownerDimension, packHard, packLinks, packOutputForm, paramActive, paramLevels, paramProblem, paramValue, parseLayoutRecord, parseStrategyCatalog, perChange, pickMoves, placedCircle, placedRect, pointSegmentDistance, portPoint, portfolio, probeHash, procrustesOf, productSpace, randomInt, rectInRegion, regionArea, regionHitsRect, resolveDimensions, ruleLevel, segmentThroughShape, segmentsCross, selectBest, sha256Hex, shapeKindOf, shapeKindProblem, shapeKindsOf, shapeLevel, shapeSupportProblems, shapesOf, shapesOverlap, sharedDimension, spaceShapeKinds, spaceSize, splitConfig, splitFileName, splitFolds, stepRandom, sweepGrid, sweepOf, sweepValues, toLayoutRecord, toPackInput, toRect, toSizedRect, translate, turnBox, turnMargin, turnPoint, turnPort, turnRegion, turnSide, verdict, writeStrategyCatalog };
4901
5118
 
4902
5119
  //# sourceMappingURL=index.js.map