@mark1russell7/packing 0.1.6 → 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/README.md +1 -1
- package/build/index.d.ts +66 -215
- package/build/index.d.ts.map +1 -1
- package/build/index.js +210 -292
- package/build/index.js.map +1 -1
- package/package.json +5 -2
- package/src/adapters.ts +16 -13
- package/src/check.ts +44 -30
- package/src/contract.ts +30 -190
- package/src/convert.ts +11 -15
- package/src/corpus.ts +3 -3
- package/src/frame.ts +37 -50
- package/src/generators.ts +11 -12
- package/src/index.ts +7 -3
- package/src/layout-input.ts +34 -41
- package/src/measures.ts +43 -28
- package/src/strategy.ts +3 -3
package/README.md
CHANGED
|
@@ -105,7 +105,7 @@ checkHard(input, output); // { "no-overlap": 0, "in-container": 0, "locked-kept"
|
|
|
105
105
|
- `fixed` is `size`, `width`, `height` or `none`. A fixed height turns the axes. The value `none` uses the size search `logSweep`, which wraps `packFree`.
|
|
106
106
|
- Each strategy declares its cells in `supports`. `cellOf(input)` gives the cell of an input. A strategy throws `UnsupportedCell` for an input outside its cells.
|
|
107
107
|
- The strategies of this version do not turn items, read groups or pack shapes. A turnable item, a group or a shape gives `UnsupportedCell`.
|
|
108
|
-
- `checkHard` counts the breaks of the hard rules: `no-overlap`, `in-container`, `locked-kept` and `complete`.
|
|
108
|
+
- `checkHard` counts the breaks of the hard rules: `no-overlap`, `in-container`, `locked-kept` and `complete`. It reads the true shape of each obstacle, as `packHard` of `@mark1russell7/layout-contract` does.
|
|
109
109
|
- `fromRects` and `toRects` connect the interface to the `Rect` objects.
|
|
110
110
|
|
|
111
111
|
`docs/PACKER.md` in the repository gives the interface in full.
|
package/build/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DEFAULT_TOLERANCE, Direction, Direction as Direction$1, EPS, Item, Item as Item$1, LayoutContainer, LayoutContainer as LayoutContainer$1, LayoutEdge, LayoutEdge as LayoutEdge$1, LayoutGenerator, LayoutInput, LayoutInput as LayoutInput$1, Margin, MeasureSpec as MeasureSpec$1, Obstacle, PackHard, PackHard as PackHard$1, PackInput, PackOutput, Placement, Port, RECORD_EPS, Region, Side, Sides, Sides as Sides$1, StageTrace, Tolerance, checkInput, turnPoint, turnPort, turnRegion } from "@mark1russell7/layout-contract";
|
|
1
2
|
/** A mutable two-dimensional vector. */
|
|
2
3
|
export declare class Vector {
|
|
3
4
|
#private;
|
|
@@ -258,179 +259,39 @@ interface MetricsOptions {
|
|
|
258
259
|
* ```
|
|
259
260
|
*/
|
|
260
261
|
export declare function packingMetrics(rects: readonly Rect[], options?: MetricsOptions): PackingMetrics;
|
|
261
|
-
/** A region. The forms and the rules are those of `docs/FORMAT.md`. The y axis points down. */
|
|
262
|
-
type Region = {
|
|
263
|
-
kind: "rect";
|
|
264
|
-
x: number;
|
|
265
|
-
y: number;
|
|
266
|
-
w: number;
|
|
267
|
-
h: number;
|
|
268
|
-
} | {
|
|
269
|
-
kind: "polygon";
|
|
270
|
-
points: [number, number][];
|
|
271
|
-
holes?: [number, number][][];
|
|
272
|
-
} | {
|
|
273
|
-
kind: "circle";
|
|
274
|
-
cx: number;
|
|
275
|
-
cy: number;
|
|
276
|
-
r: number;
|
|
277
|
-
} | {
|
|
278
|
-
kind: "ellipse";
|
|
279
|
-
cx: number;
|
|
280
|
-
cy: number;
|
|
281
|
-
rx: number;
|
|
282
|
-
ry: number;
|
|
283
|
-
};
|
|
284
|
-
/** The container of a packing. */
|
|
285
|
-
interface Container {
|
|
286
|
-
/** The width. Without it, the packer searches the width. */
|
|
287
|
-
w?: number;
|
|
288
|
-
/** The height. Without it, the packer searches the height. */
|
|
289
|
-
h?: number;
|
|
290
|
-
/** The sides that stay: `size` keeps `w` and `h`, `width` keeps `w`, `height` keeps `h`, and `none` searches both. */
|
|
291
|
-
fixed: "size" | "width" | "height" | "none";
|
|
292
|
-
/** The target aspect (the width divided by the height) for the value `none` of `fixed`. The default is 1. */
|
|
293
|
-
aspect?: number;
|
|
294
|
-
/** The weight of the aspect error in the objective. The value 0 gives the least area. The default is 1. */
|
|
295
|
-
aspectWeight?: number;
|
|
296
|
-
/** The shape. Without it, the container is the rectangle from 0, 0 to `w`, `h`. */
|
|
297
|
-
shape?: Region;
|
|
298
|
-
/** The space between the border and the items with their margins. The default is 0. */
|
|
299
|
-
inset?: number;
|
|
300
|
-
}
|
|
301
|
-
/** An obstacle: an area that no item enters. */
|
|
302
|
-
interface Obstacle {
|
|
303
|
-
id: string;
|
|
304
|
-
region: Region;
|
|
305
|
-
/** Without it, the obstacle stays. With it, the packer can move the obstacle for `cost` times the distance. */
|
|
306
|
-
move?: {
|
|
307
|
-
cost: number;
|
|
308
|
-
};
|
|
309
|
-
}
|
|
310
|
-
/** The margin of an item on each side. */
|
|
311
|
-
interface Margin {
|
|
312
|
-
top: number;
|
|
313
|
-
right: number;
|
|
314
|
-
bottom: number;
|
|
315
|
-
left: number;
|
|
316
|
-
}
|
|
317
|
-
/** A port on the border of an item. */
|
|
318
|
-
interface Port {
|
|
319
|
-
id: string;
|
|
320
|
-
side: "top" | "right" | "bottom" | "left";
|
|
321
|
-
/** The point on the border of the item, relative to its top-left corner. Without it, the router chooses the point. */
|
|
322
|
-
x?: number;
|
|
323
|
-
y?: number;
|
|
324
|
-
}
|
|
325
|
-
/** An item to pack. The file format names it a box. */
|
|
326
|
-
interface Item {
|
|
327
|
-
id: string;
|
|
328
|
-
w: number;
|
|
329
|
-
h: number;
|
|
330
|
-
/** The reading order. Without it, the index in the array is the rank. */
|
|
331
|
-
rank?: number;
|
|
332
|
-
group?: string;
|
|
333
|
-
parent?: string;
|
|
334
|
-
/** A shape relative to the origin of the item. Without it, the item is the rectangle `w` by `h`. */
|
|
335
|
-
shape?: Region;
|
|
336
|
-
/** A locked item keeps `x` and `y`. The packer reads it as an obstacle. */
|
|
337
|
-
locked?: boolean;
|
|
338
|
-
x?: number;
|
|
339
|
-
y?: number;
|
|
340
|
-
/** The value `true` lets the packer turn the item by 90 degrees. The default is `false`. */
|
|
341
|
-
turnable?: boolean;
|
|
342
|
-
/** A ring around the item that no other item and no route enters. The default is 0. */
|
|
343
|
-
margin?: number | Margin;
|
|
344
|
-
/** The ports. The packer keeps them, and turns them with the item. */
|
|
345
|
-
ports?: Port[];
|
|
346
|
-
}
|
|
347
|
-
/** The input of a packing: a `layout-input/1` file without `edges`, with `items` for `boxes`. */
|
|
348
|
-
interface PackInput {
|
|
349
|
-
container: Container;
|
|
350
|
-
items: Item[];
|
|
351
|
-
obstacles?: Obstacle[];
|
|
352
|
-
/** The free space between two items with their margins. Routes use this space. The default is 0. */
|
|
353
|
-
gap?: number;
|
|
354
|
-
}
|
|
355
|
-
/** The position of one item after the packing. */
|
|
356
|
-
interface Placement {
|
|
357
|
-
id: string;
|
|
358
|
-
x: number;
|
|
359
|
-
y: number;
|
|
360
|
-
/** The turn: 0 or 90, only for an item with `turnable` set to `true`. */
|
|
361
|
-
turn?: 0 | 90;
|
|
362
|
-
}
|
|
363
|
-
/** The facts of one stage of a packing. */
|
|
364
|
-
interface StageTrace {
|
|
365
|
-
/** The id of the stage, for example `skyline` or `log-sweep`. */
|
|
366
|
-
id: string;
|
|
367
|
-
/** The time of the stage in milliseconds. */
|
|
368
|
-
ms: number;
|
|
369
|
-
/** The measures of the stage, by the names of `docs/FORMAT.md`. */
|
|
370
|
-
measures: Record<string, number>;
|
|
371
|
-
}
|
|
372
|
-
/** The output of a packing. The output does not change the input. */
|
|
373
|
-
interface PackOutput {
|
|
374
|
-
placements: Placement[];
|
|
375
|
-
/** The ids of the items that the packer did not place. */
|
|
376
|
-
overflow: string[];
|
|
377
|
-
/** The size of the container after the packing. For a free size, the size that the search found. */
|
|
378
|
-
size: {
|
|
379
|
-
w: number;
|
|
380
|
-
h: number;
|
|
381
|
-
};
|
|
382
|
-
/** The new positions of the obstacles that moved. */
|
|
383
|
-
moved: {
|
|
384
|
-
id: string;
|
|
385
|
-
x: number;
|
|
386
|
-
y: number;
|
|
387
|
-
}[];
|
|
388
|
-
/** The facts of each stage, for the site and the records. */
|
|
389
|
-
trace: StageTrace[];
|
|
390
|
-
}
|
|
391
|
-
/** The tolerances of the hard rules. */
|
|
392
|
-
interface Tolerance {
|
|
393
|
-
/** The rule `no-overlap`: two boxes overlap only by more than this value. */
|
|
394
|
-
overlap: number;
|
|
395
|
-
/** The router rule that a route does not go through a box. */
|
|
396
|
-
through: number;
|
|
397
|
-
}
|
|
398
|
-
/** The tolerance for the comparison of two numbers in an engine. */
|
|
399
|
-
export declare const EPS = 1e-6;
|
|
400
|
-
/** The tolerance for the comparison of two numbers of a file. The files round to 3 decimals. */
|
|
401
|
-
export declare const RECORD_EPS = .001;
|
|
402
|
-
/** The default tolerances of the hard rules. Each record writes its tolerances in its top-level field `tolerance`. */
|
|
403
|
-
export declare const DEFAULT_TOLERANCE: Readonly<Tolerance>;
|
|
404
262
|
/** This function gives the margin of an item on each side. A number is the same margin on each side. */
|
|
405
|
-
export declare function marginOf(item: Pick<Item, "margin">):
|
|
406
|
-
/** This function gives the point `px`, `py` of an item of height `h` after a turn of 90 degrees clockwise. */
|
|
407
|
-
export declare function turnPoint(px: number, py: number, h: number): [number, number];
|
|
408
|
-
/** This function turns a port of an item of height `h` by 90 degrees clockwise. The side turns from top to right. */
|
|
409
|
-
export declare function turnPort(port: Port, h: number): Port;
|
|
410
|
-
/** This function turns a region relative to an item of height `h` by 90 degrees clockwise. */
|
|
411
|
-
export declare function turnRegion(region: Region, h: number): Region;
|
|
263
|
+
export declare function marginOf(item: Pick<Item$1, "margin">): Sides$1;
|
|
412
264
|
/**
|
|
413
265
|
* This function gives an item after a turn of 90 degrees clockwise, with the y axis down (decision 1 of
|
|
414
266
|
* `docs/PACKER.md`). The width and the height change places. The top-left corner, the id and the other fields stay.
|
|
415
267
|
* The ports, the shape and the margin turn with the item. The function does not change its argument.
|
|
268
|
+
* It is `turnBox` of the contract.
|
|
416
269
|
*/
|
|
417
|
-
export declare function turnItem(item: Item): Item;
|
|
418
|
-
/** The direction of a measure: `lower` when a lower value is better, `higher` when a higher value is better. */
|
|
419
|
-
type Direction = "lower" | "higher";
|
|
270
|
+
export declare function turnItem(item: Item$1): Item$1;
|
|
420
271
|
/** The family of a measure. Each family has a section in `docs/MEASURES.md`. */
|
|
421
272
|
type MeasureFamily = "density" | "aspect" | "order" | "raggedness" | "overflow" | "stability" | "determinism" | "speed";
|
|
422
273
|
/** The id of a measure of the packer. The ids are those of `docs/FORMAT.md`, and `highways` uses the same ids. */
|
|
423
274
|
type MeasureId = "pack.area" | "pack.fill" | "pack.whitespace" | "pack.aspect" | "pack.aspectError" | "pack.order.inversions" | "pack.order.breaks" | "pack.raggedness" | "pack.overflow" | "pack.stability.moved" | "pack.stability.mean" | "pack.stability.q95" | "pack.deterministic" | "pack.search.widths" | "pack.search.ms";
|
|
424
|
-
/**
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
/**
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
275
|
+
/**
|
|
276
|
+
* The facts of one measure: its family, its unit, its direction and its range.
|
|
277
|
+
* It is `MeasureSpec` of the contract for a packer measure id, with a family.
|
|
278
|
+
*/
|
|
279
|
+
interface MeasureSpec extends MeasureSpec$1<MeasureId> {
|
|
280
|
+
readonly family: MeasureFamily;
|
|
281
|
+
/**
|
|
282
|
+
* The floor is the best value of a guard measure. The floor rule of `docs/PROMOTION.md` of `highways` reads it. Each
|
|
283
|
+
* guard of the packer has the floor 0. A measure without a floor has no floor rule.
|
|
284
|
+
*/
|
|
285
|
+
readonly floor?: number;
|
|
286
|
+
/**
|
|
287
|
+
* The tolerance is the absolute tolerance at the floor. A candidate within the tolerance ties with a default at the floor.
|
|
288
|
+
*
|
|
289
|
+
* - `pack.order.inversions` and `pack.overflow` have the tolerance 0. Thus each new inversion and each new unplaced item is a loss.
|
|
290
|
+
* - `pack.aspectError` has 0.01, approximately 1% of the aspect. An exact tiling gives the default an error of 0.
|
|
291
|
+
* - `pack.stability.mean` has 0.005 container widths, and `pack.stability.q95` has 0.01. The default often moves no item.
|
|
292
|
+
* - `pack.stability.moved` has 0.02: 2% of the items that stay. On a small change, the default often moves no item.
|
|
293
|
+
*/
|
|
294
|
+
readonly tol?: number;
|
|
434
295
|
}
|
|
435
296
|
/** The measures of one layout, by id. `measure` gives them. The values are not rounded. */
|
|
436
297
|
interface LayoutMeasures {
|
|
@@ -460,7 +321,10 @@ interface MeasureOptions {
|
|
|
460
321
|
*/
|
|
461
322
|
rowTolerance?: number;
|
|
462
323
|
}
|
|
463
|
-
/**
|
|
324
|
+
/**
|
|
325
|
+
* The facts of each measure, by id. `docs/MEASURES.md` gives the full definitions. This record is the source of the floor
|
|
326
|
+
* and the tolerance of each guard of the packer.
|
|
327
|
+
*/
|
|
464
328
|
export declare const MEASURE_SPECS: Readonly<Record<MeasureId, MeasureSpec>>;
|
|
465
329
|
/**
|
|
466
330
|
* This function gives the measures of one layout, by the ids of `docs/MEASURES.md`. The values are not rounded. A
|
|
@@ -509,7 +373,7 @@ export declare function roundMeasures<T extends object>(measures: T): T;
|
|
|
509
373
|
* - When both values are 0, the ratio is 1. When only the divisor is 0, the ratio is `Infinity`.
|
|
510
374
|
* - The values are 0 or more. A negative value or `NaN` throws a `RangeError`.
|
|
511
375
|
*/
|
|
512
|
-
export declare function pairedRatio(candidate: number, current: number, direction: Direction): number;
|
|
376
|
+
export declare function pairedRatio(candidate: number, current: number, direction: Direction$1): number;
|
|
513
377
|
/**
|
|
514
378
|
* This function gives the quantile `q` of a list of numbers, with linear interpolation between the sorted values. The
|
|
515
379
|
* position in the sorted list is `(n - 1) * q`. An empty list or a `q` outside 0 to 1 throws a `RangeError`.
|
|
@@ -684,64 +548,48 @@ export declare function strategy(id: string): Strategy;
|
|
|
684
548
|
* context gets `mulberry32` with the seed. The default seed is 0.
|
|
685
549
|
*/
|
|
686
550
|
export declare function packWith(id: string, input: PackInput, options?: unknown, seed?: number): PackOutput;
|
|
687
|
-
/** The count of the breaks of each hard rule of the packer (`docs/FORMAT.md`). A good run has 0 for each rule. */
|
|
688
|
-
interface HardBreaks {
|
|
689
|
-
"no-overlap": number;
|
|
690
|
-
"in-container": number;
|
|
691
|
-
"locked-kept": number;
|
|
692
|
-
complete: number;
|
|
693
|
-
}
|
|
694
551
|
/**
|
|
695
552
|
* This function counts the breaks of the 4 hard rules of the packer for an output.
|
|
696
553
|
*
|
|
697
554
|
* - `no-overlap`: each pair of items with their margins, and each pair of an item and an obstacle, that overlap by more than `tolerance.overlap`.
|
|
698
555
|
* - `in-container`: each item with its margin that goes out of a fixed side by more than `tolerance.overlap`. The inset of
|
|
699
556
|
* the container makes each fixed side smaller (decision 3 of `docs/PACKER.md`).
|
|
700
|
-
* - `locked-kept`: each locked item that moved by more than `RECORD_EPS`, or that has no
|
|
701
|
-
* - `complete`: each item with no
|
|
557
|
+
* - `locked-kept`: each locked item that moved by more than `RECORD_EPS`, or that has no placement.
|
|
558
|
+
* - `complete`: each item with no placement that is not in the overflow. A locked item breaks `locked-kept` in its place.
|
|
559
|
+
*
|
|
560
|
+
* A locked item with no placement stays at its input position for `no-overlap` and `in-container`. A locked item with no
|
|
561
|
+
* `x` or no `y` in the input is a bad input. The rules skip it, as `packHard` of the contract does. `checkInput` finds it.
|
|
702
562
|
*
|
|
703
|
-
* The
|
|
704
|
-
*
|
|
563
|
+
* The test of an obstacle is exact: a circle, an ellipse and a polygon with holes count only their insides, as in `packHard`.
|
|
564
|
+
* The rules read a shape of the container or of an item as its bounding box (decision 5). The bounding box of an item
|
|
565
|
+
* shape is relative to the position of the item. The result has no tolerance in it.
|
|
705
566
|
*/
|
|
706
|
-
export declare function checkHard(input: PackInput, output: PackOutput, tolerance?: Pick<Tolerance, "overlap">):
|
|
707
|
-
/** An edge between two boxes. The router reads it, and the packer ignores it. */
|
|
708
|
-
interface Edge {
|
|
709
|
-
id: string;
|
|
710
|
-
source: string;
|
|
711
|
-
target: string;
|
|
712
|
-
sourcePort?: string;
|
|
713
|
-
targetPort?: string;
|
|
714
|
-
}
|
|
567
|
+
export declare function checkHard(input: PackInput, output: PackOutput, tolerance?: Pick<Tolerance, "overlap">): PackHard$1;
|
|
715
568
|
/** The parameters of a generator: a name and a string or a number for each parameter. */
|
|
716
569
|
type GeneratorParams = Record<string, string | number>;
|
|
717
|
-
/**
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
570
|
+
/**
|
|
571
|
+
* The stamp of a generated input: the generator, its version, the full parameters and the seed.
|
|
572
|
+
* It is `LayoutGenerator` of the contract with a string or a number for each parameter.
|
|
573
|
+
*/
|
|
574
|
+
interface GeneratorStamp extends LayoutGenerator {
|
|
575
|
+
readonly params: Readonly<GeneratorParams>;
|
|
723
576
|
}
|
|
724
|
-
/**
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
577
|
+
/**
|
|
578
|
+
* A generated input file `layout-input/1`. It is a `LayoutInput` with each field that a generator writes.
|
|
579
|
+
* `docs/FORMAT.md` gives each field.
|
|
580
|
+
*/
|
|
581
|
+
interface GeneratedInput extends LayoutInput$1 {
|
|
582
|
+
readonly set: string;
|
|
583
|
+
readonly family: string;
|
|
584
|
+
readonly seed: number;
|
|
731
585
|
/** The origin: `made-up`, `published:<set>` or `known-best:<construction>`. */
|
|
732
|
-
source: string;
|
|
586
|
+
readonly source: string;
|
|
733
587
|
/** The generator of a generated input. A hand-made or published input has `null`. */
|
|
734
|
-
generator: GeneratorStamp | null;
|
|
735
|
-
container:
|
|
736
|
-
|
|
737
|
-
gap?: number;
|
|
738
|
-
boxes: Item[];
|
|
739
|
-
edges: Edge[];
|
|
740
|
-
base?: string;
|
|
741
|
-
change?: string;
|
|
742
|
-
step?: number;
|
|
588
|
+
readonly generator: GeneratorStamp | null;
|
|
589
|
+
readonly container: LayoutContainer$1;
|
|
590
|
+
readonly edges: readonly LayoutEdge$1[];
|
|
743
591
|
/** The first 16 hex characters of the SHA-256 of the canonical form of the other fields. */
|
|
744
|
-
hash: string;
|
|
592
|
+
readonly hash: string;
|
|
745
593
|
}
|
|
746
594
|
/** The layout of the obstacles (`docs/research/TAXONOMY.md`, dimension 3). */
|
|
747
595
|
type ObstacleLayout = "none" | "center" | "scattered" | "wall" | "corridors" | "touching" | "edge";
|
|
@@ -769,11 +617,14 @@ export declare function round3(x: number): number;
|
|
|
769
617
|
*/
|
|
770
618
|
export declare function canonicalJson(value: unknown): string;
|
|
771
619
|
/** This function gives the hash of an input file: the first 16 hex characters of the SHA-256 of its canonical form without `hash`. */
|
|
772
|
-
export declare function hashInput(file:
|
|
620
|
+
export declare function hashInput(file: LayoutInput$1): string;
|
|
773
621
|
/** This function gives the scale of a count: the nearest of 1, 10, 100, 1000 and 10000 on a log scale. The count 0 gives `1`. */
|
|
774
622
|
export declare function countCell(count: number): CountScale;
|
|
775
|
-
/**
|
|
776
|
-
|
|
623
|
+
/**
|
|
624
|
+
* This function gives the packing input of a file. The boxes become the items, and the edges go.
|
|
625
|
+
* A file without a container gets `{ fixed: "none" }`, so the packer picks the size. It is `toPackInput` of the contract.
|
|
626
|
+
*/
|
|
627
|
+
export declare function toPackInput(file: Pick<LayoutInput$1, "container" | "boxes" | "obstacles" | "gap">): PackInput;
|
|
777
628
|
/** A seeded generator of `layout-input/1` files. The same version, parameters and seed give the same file, byte for byte. */
|
|
778
629
|
interface CorpusGenerator<P extends GeneratorParams = GeneratorParams> {
|
|
779
630
|
/** The name. The file writes it in `generator.name`. */
|
|
@@ -791,7 +642,7 @@ interface CorpusGenerator<P extends GeneratorParams = GeneratorParams> {
|
|
|
791
642
|
/** This method gives the cell of each input of the parameters. The cell does not depend on the seed. */
|
|
792
643
|
cell(params?: Partial<P>): CorpusCell;
|
|
793
644
|
/** This method gives the input file of a seed. The `id` is `<set>/<family>/s<seed>`. */
|
|
794
|
-
generate(seed: number, params?: Partial<P>, set?: string):
|
|
645
|
+
generate(seed: number, params?: Partial<P>, set?: string): GeneratedInput;
|
|
795
646
|
}
|
|
796
647
|
/** The parameters of `rect-scattered`. */
|
|
797
648
|
type RectScatteredParams = {
|
|
@@ -879,12 +730,12 @@ interface CorpusManifest {
|
|
|
879
730
|
/** A corpus: the manifest and the input files, in the order of the specs and the seeds. */
|
|
880
731
|
interface Corpus {
|
|
881
732
|
manifest: CorpusManifest;
|
|
882
|
-
inputs:
|
|
733
|
+
inputs: GeneratedInput[];
|
|
883
734
|
}
|
|
884
735
|
/**
|
|
885
736
|
* This function generates a corpus from specs. Each input gets the name of the corpus as its set. The function throws a
|
|
886
737
|
* `RangeError` for an unknown generator, a different version or 2 inputs with the same id.
|
|
887
738
|
*/
|
|
888
739
|
export declare function corpus(name: string, specs: readonly CorpusSpec[]): Corpus;
|
|
889
|
-
export type
|
|
740
|
+
export { type Cell, type ChangeMeasures, type Corpus, type CorpusCell, type CorpusEntry, type CorpusGenerator, type CorpusManifest, type CorpusSpec, type CountScale, DEFAULT_TOLERANCE, type Dimension, type DimensionValue, type Direction, EPS, type EdgeCase, type EdgeCaseParams, type FreeWidthOptions, type FreeWidthResult, type FreeWidthTry, type GeneratedInput, type GeneratorParams, type GeneratorStamp, type Item, type LayoutContainer, type LayoutEdge, type LayoutInput, type LayoutMeasures, type LayoutStrategyOptions, type Margin, type MeasureFamily, type MeasureId, type MeasureOptions, type MeasureSpec, type MetricsOptions, type Obstacle, type ObstacleLayout, type PackContext, type PackHard, type PackInput, type PackLayoutOptions, type PackOptions, type PackOutput, type PackingMetrics, type Placement, type Port, type PushOptions, type PushStrategyOptions, RECORD_EPS, type RectGridParams, type RectScatteredParams, type Region, type ShelfOptions, type Side, type Sides, type SizeDistribution, type SizeSearch, type SortOrder, type StageTrace, type Strategy, type Supports, type Tolerance, type UiParams, checkInput, turnPoint, turnPort, turnRegion };
|
|
890
741
|
//# sourceMappingURL=index.d.ts.map
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/vector.ts","../src/rect.ts","../src/order.ts","../src/pack.ts","../src/skyline.ts","../src/shelf.ts","../src/free.ts","../src/push.ts","../src/metrics.ts","../src/contract.ts","../src/measures.ts","../src/strategy.ts","../src/adapters.ts","../src/convert.ts","../src/registry.ts","../src/check.ts","../src/layout-input.ts","../src/generators.ts","../src/corpus.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":["Item","Sides","ContractMeasureSpec","Direction","PackHard","LayoutContainer","LayoutEdge","LayoutInput"],"sources":["../src/vector.ts","../src/rect.ts","../src/order.ts","../src/pack.ts","../src/skyline.ts","../src/shelf.ts","../src/free.ts","../src/push.ts","../src/metrics.ts","../src/contract.ts","../src/measures.ts","../src/strategy.ts","../src/adapters.ts","../src/convert.ts","../src/registry.ts","../src/check.ts","../src/layout-input.ts","../src/generators.ts","../src/corpus.ts"],"mappings":";;qBACa;;EAIX,YAAY,YAAO;;MAMf;MACA,EAAE;;MAEF;MACA,EAAE;;EAGN,IAAI,WAAW;;EAMf,MAAM,GAAG;;EAMT,IAAI,OAAO,SAAS;;EAKpB;;EAKA,SAAS;;EAKT,MAAM,KAAK,QAAQ,KAAK,SAAS;;SAQ1B,GAAG,iBAAiB;;SAKpB,IAAI,SAAS,WAAW;;SASxB,IAAI,SAAS,WAAW;;aASpB,YAAY;;;qBCxEZ,KAAK;;;EAKhB,KAAK;;EAEL;;EAEA;;EAEA;;;;;EAKA;;MAGI,YAAY;;MAEZ,QAAQ;;EAGZ;;EAEA;;EAGA,WAAW;;EAOX,YAAY,QAAQ;;EAMpB;;SAGO,OAAO,GAAG,OAAO,KAAK,OAAO,KAAK;;SAKlC,SAAS,GAAG,OAAO,KAAK,OAAO,KAAK;;SAKpC,YAAY,GAAG,OAAO,KAAK;;SAK3B,SAAS,GAAG,OAAO,KAAK;;SAKxB,UAAU,GAAG,OAAO,KAAK;;;;;;KC/DtB;;qBAGC,sBAAsB;;wBAGnB,aAAa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