@mark1russell7/packing 0.2.3 → 0.2.5
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 +28 -2
- package/build/index.d.ts +146 -31
- package/build/index.d.ts.map +1 -1
- package/build/index.js +725 -42
- package/build/index.js.map +1 -1
- package/package.json +1 -1
- package/src/adapters.ts +110 -23
- package/src/frame.ts +37 -10
- package/src/index.ts +13 -2
- package/src/maxrects.ts +367 -0
- package/src/measures.ts +18 -7
- package/src/moves.ts +32 -3
- package/src/pack.ts +17 -5
- package/src/registry.ts +2 -2
- package/src/shelf.ts +200 -0
- package/src/space.ts +36 -1
package/README.md
CHANGED
|
@@ -35,6 +35,31 @@ pack(rects, outer, { strategy: "skyline", sortOrder: "area-desc" });
|
|
|
35
35
|
- `packSkyline`: each rectangle goes to the lowest place where it fits. It packs around a `locked` rectangle.
|
|
36
36
|
- `packShelf`: it fills rows left to right in the sort order, and goes around each `locked` rectangle. With the sort order `input`, the rows read in your order.
|
|
37
37
|
|
|
38
|
+
Since 0.2.4, `packShelf` and the strategy `shelf` have the option `fit`. `SHELF_FITS` lists its values. Without `fit`, the shelf packing does not change.
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
pack(rects, outer, { strategy: "shelf", fit: "best" });
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
- `fit: "next"`: each rectangle uses only the open shelf. A short rectangle can also stack above a shorter rectangle.
|
|
45
|
+
- `fit: "first"`: each rectangle goes on the first shelf from the top where it fits.
|
|
46
|
+
- `fit: "best"`: each rectangle goes on the shelf with the least height left over above it.
|
|
47
|
+
- With a `fit`, the shelves open only in the free spans of each container shape. `docs/PACKER.md` tells the rules.
|
|
48
|
+
|
|
49
|
+
Since 0.2.5, `packMaxRects` and the strategy `maxrects` pack with a list of maximal free rectangles. `MAXRECTS_RULES` lists the rules of the option `rule`.
|
|
50
|
+
|
|
51
|
+
```ts
|
|
52
|
+
pack(rects, outer, { strategy: "maxrects", rule: "cp" });
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
- `rule: "bssf"` (the default): the free rectangle with the smallest leftover short side. Its move is `move.bssf`.
|
|
56
|
+
- `rule: "blsf"`: the free rectangle with the smallest leftover long side. Its move is `move.blsf`.
|
|
57
|
+
- `rule: "baf"`: the free rectangle with the smallest leftover area. Its move is `move.baf`.
|
|
58
|
+
- `rule: "bl"`: the highest place, then the leftmost place. Its move is `move.split`, a box that cuts 2 free rectangles or more.
|
|
59
|
+
- `rule: "cp"`: the place that touches the most length of edges. Its move is `move.cp`.
|
|
60
|
+
- The move of each rule other than `bl` counts a box when the rule chooses a place that `bl` does not choose.
|
|
61
|
+
- A shape that is not a rectangle gets bands. The option `bandHeight` sets their largest height. The default is the height divided by `MAXRECTS_BANDS`.
|
|
62
|
+
|
|
38
63
|
Both functions also work alone, in an outer rectangle with a width that you set. They do not change the width.
|
|
39
64
|
|
|
40
65
|
A `locked` rectangle keeps its position. `packSkyline` and `packShelf` put the other rectangles around it. `packRows` only keeps its position.
|
|
@@ -101,10 +126,11 @@ output.size; // the size of the container
|
|
|
101
126
|
checkHard(input, output); // { "no-overlap": 0, "in-container": 0, "locked-kept": 0, complete: 0 }
|
|
102
127
|
```
|
|
103
128
|
|
|
104
|
-
- The registry `strategies` has `rows`, `skyline`, `shelf` and `
|
|
129
|
+
- The registry `strategies` has `rows`, `skyline`, `shelf`, `push` and `maxrects`. `strategy(id)` gives one, and `packWith(id, input, options, seed)` packs with it.
|
|
105
130
|
- `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
131
|
- 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
|
-
-
|
|
132
|
+
- Only `maxrects` accepts a turnable item, and it turns items only with `rotate: true`. The other strategies give `UnsupportedCell` for a turnable item.
|
|
133
|
+
- No strategy reads groups or packs shapes. A group or a shape gives `UnsupportedCell`.
|
|
108
134
|
- `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
135
|
- `fromRects` and `toRects` connect the interface to the `Rect` objects.
|
|
110
136
|
|
package/build/index.d.ts
CHANGED
|
@@ -142,6 +142,98 @@ interface FreeSpace {
|
|
|
142
142
|
* frame is the corner of the container, moved in by the inset and out by half the gap. `FreeSpace` tells the methods.
|
|
143
143
|
*/
|
|
144
144
|
export declare function freeSpace(input: PackInput): FreeSpace;
|
|
145
|
+
/**
|
|
146
|
+
* The rules of `maxrects` to choose a free rectangle for a box.
|
|
147
|
+
*
|
|
148
|
+
* - `bssf`: the best short side fit. The smaller leftover side is the smallest.
|
|
149
|
+
* - `blsf`: the best long side fit. The larger leftover side is the smallest.
|
|
150
|
+
* - `baf`: the best area fit. The leftover area is the smallest.
|
|
151
|
+
* - `bl`: the bottom-left rule. The bottom edge of the box is the highest, then the left edge is the leftmost.
|
|
152
|
+
* - `cp`: the contact point rule. The box touches the most length of the edges of the frame, the boxes and the obstacles.
|
|
153
|
+
*/
|
|
154
|
+
export declare const MAXRECTS_RULES: readonly ["bssf", "blsf", "baf", "bl", "cp"];
|
|
155
|
+
/** A rule of `maxrects`: `bssf`, `blsf`, `baf`, `bl` or `cp`. `MAXRECTS_RULES` tells each rule. */
|
|
156
|
+
type MaxRectsRule = (typeof MAXRECTS_RULES)[number];
|
|
157
|
+
/** The number of bands that the default band height gives. The default band height is the height to cut divided by this number. */
|
|
158
|
+
export declare const MAXRECTS_BANDS = 128;
|
|
159
|
+
/** The options of `packMaxRects` */
|
|
160
|
+
interface MaxRectsOptions {
|
|
161
|
+
/** The order of the rectangles before the packing. The default is `height-desc`. */
|
|
162
|
+
sortOrder?: SortOrder;
|
|
163
|
+
/**
|
|
164
|
+
* The free space of the container: `freeSpace` of the input. Without it, or when it is plain, the free rectangles are
|
|
165
|
+
* exact: the outer rectangle less the locked rectangles. Another space gives an inner approximation with bands.
|
|
166
|
+
*/
|
|
167
|
+
space?: FreeSpace;
|
|
168
|
+
/** The rule to choose a free rectangle. The default is `bssf`. */
|
|
169
|
+
rule?: MaxRectsRule;
|
|
170
|
+
/**
|
|
171
|
+
* The largest height of a band of the approximation of a space that is not plain. The bands have equal heights. The
|
|
172
|
+
* default is the height to cut divided by `MAXRECTS_BANDS`. A fixed height cuts the height. A free height cuts to the
|
|
173
|
+
* lowest edge of the obstacles that are not rectangles.
|
|
174
|
+
*/
|
|
175
|
+
bandHeight?: number;
|
|
176
|
+
/** The rectangles that can turn by 90 degrees. Without it, no rectangle turns. A locked rectangle does not turn. */
|
|
177
|
+
turnable?: ReadonlySet<unknown>;
|
|
178
|
+
/**
|
|
179
|
+
* The rectangles that the packing turned. Each call turns back the rectangles of this set first, and then it clears the
|
|
180
|
+
* set. Thus a size search can pack the same rectangles many times.
|
|
181
|
+
*/
|
|
182
|
+
turned?: Set<unknown>;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* This function packs rectangles into an outer rectangle with MaxRects of Jylänki (2010). It keeps the list of the maximal
|
|
186
|
+
* free rectangles, and it does not change the width of the outer rectangle.
|
|
187
|
+
*
|
|
188
|
+
* - Each box goes to the top-left corner of the free rectangle that `options.rule` chooses. `MAXRECTS_RULES` tells the rules.
|
|
189
|
+
* - A tie goes to the higher place, then to the place on the left, then to the first free rectangle of the list.
|
|
190
|
+
* - A `locked` rectangle keeps its position, and the free rectangles go around it.
|
|
191
|
+
* - With a space that is not plain, the free rectangles start from bands of the outline. `MaxRectsOptions` tells the bands.
|
|
192
|
+
* - Without `fixedSize`, the height of the outer rectangle grows to the content. With `fixedSize`, a box that does not fit
|
|
193
|
+
* is not packed: its `wasPacked` stays `false`.
|
|
194
|
+
* - The default sort order is `height-desc`. The order of the array of the caller stays.
|
|
195
|
+
*/
|
|
196
|
+
export declare function packMaxRects<T>(rects: Rect<T>[], outer: Rect<T>, options?: MaxRectsOptions): Rect<T>;
|
|
197
|
+
/**
|
|
198
|
+
* The rule of a shelf packing to choose the shelf of a rectangle. `packShelf` tells each rule.
|
|
199
|
+
*
|
|
200
|
+
* - `next`: only the open shelf, the last shelf that the packing opened.
|
|
201
|
+
* - `first`: the first shelf from the top where the rectangle fits.
|
|
202
|
+
* - `best`: the shelf with the least height left over above the rectangle.
|
|
203
|
+
*/
|
|
204
|
+
type ShelfFit = "next" | "first" | "best";
|
|
205
|
+
/** This constant lists each shelf fit. */
|
|
206
|
+
export declare const SHELF_FITS: readonly ShelfFit[];
|
|
207
|
+
/** The options of `packShelf` */
|
|
208
|
+
interface ShelfOptions {
|
|
209
|
+
/** The order of the rectangles before the packing. The default is `height-desc`. */
|
|
210
|
+
sortOrder?: SortOrder;
|
|
211
|
+
/**
|
|
212
|
+
* The free space of the container: `freeSpace` of the input. Without it, or when it is plain, the packer uses only the
|
|
213
|
+
* outer rectangle and the locked rectangles.
|
|
214
|
+
*/
|
|
215
|
+
space?: FreeSpace;
|
|
216
|
+
/**
|
|
217
|
+
* The rule to choose a shelf. Without it, `packShelf` packs as in 0.2.3. With it, `packShelf` uses its own shelves in
|
|
218
|
+
* each container shape, and it stacks rectangles in the strips above the shorter rectangles.
|
|
219
|
+
*/
|
|
220
|
+
fit?: ShelfFit;
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* This function packs rectangles into shelves: rows that it fills left to right in the sort order, and does not fill
|
|
224
|
+
* again. It goes around each `locked` rectangle. It sets the position of each rectangle and gives the outer rectangle.
|
|
225
|
+
*
|
|
226
|
+
* - With the sort order `input`, the rows read in the order of the array: left to right, and top to bottom.
|
|
227
|
+
* - With `height-desc` (the default), it is the classic Next-Fit Decreasing Height packing.
|
|
228
|
+
* - A rectangle goes to the first x in the row where it crosses no locked rectangle. If no such x is in the width,
|
|
229
|
+
* a new row starts under the current row.
|
|
230
|
+
* - A rectangle wider than the outer rectangle goes on its own row, at the left edge, and overflows.
|
|
231
|
+
* - It does not change the width. Without `fixedSize`, the height grows to the content. With `fixedSize`, a
|
|
232
|
+
* rectangle that does not fit is not packed: its `wasPacked` stays `false`.
|
|
233
|
+
* - With a space that is not plain, `packRowsInSpace` packs the rows into the outline of the space and around its holes.
|
|
234
|
+
* - With `fit`, `packShelvesInSpace` packs the rectangles, in each container shape. A `fit` that is not in `SHELF_FITS` throws a `RangeError`.
|
|
235
|
+
*/
|
|
236
|
+
export declare function packShelf<T>(rects: Rect<T>[], outer: Rect<T>, options?: ShelfOptions): Rect<T>;
|
|
145
237
|
/** The options of `pack` and `packRows` */
|
|
146
238
|
interface PackOptions {
|
|
147
239
|
/** The order of the rectangles before the packing. The default is `height-desc`. */
|
|
@@ -155,10 +247,20 @@ interface PackOptions {
|
|
|
155
247
|
/** The options of `pack` */
|
|
156
248
|
interface PackLayoutOptions extends PackOptions {
|
|
157
249
|
/**
|
|
158
|
-
* The packing: `rows` (the default), `skyline` or `
|
|
159
|
-
* Use `shelf` with the sort order `input` to keep the order of the array around locked rectangles.
|
|
250
|
+
* The packing: `rows` (the default), `skyline`, `shelf` or `maxrects`. `skyline`, `shelf` and `maxrects` pack around
|
|
251
|
+
* locked rectangles. Use `shelf` with the sort order `input` to keep the order of the array around locked rectangles.
|
|
160
252
|
*/
|
|
161
|
-
strategy?: "rows" | "skyline" | "shelf";
|
|
253
|
+
strategy?: "rows" | "skyline" | "shelf" | "maxrects";
|
|
254
|
+
/** The rule of `shelf` to choose a shelf. Only `shelf` reads it. `ShelfOptions` tells it. Without it, `shelf` packs as in 0.2.3. */
|
|
255
|
+
fit?: ShelfFit;
|
|
256
|
+
/** The rule of `maxrects` to choose a free rectangle. Only `maxrects` reads it. The default is `bssf`. */
|
|
257
|
+
rule?: MaxRectsRule;
|
|
258
|
+
/** The largest height of a band of `maxrects` in a space that is not plain. Only `maxrects` reads it. `MaxRectsOptions` tells it. */
|
|
259
|
+
bandHeight?: number;
|
|
260
|
+
/** The rectangles that `maxrects` can turn by 90 degrees. Only `maxrects` reads it. */
|
|
261
|
+
turnable?: ReadonlySet<unknown>;
|
|
262
|
+
/** The rectangles that `maxrects` turned. Only `maxrects` reads it. `MaxRectsOptions` tells it. */
|
|
263
|
+
turned?: Set<unknown>;
|
|
162
264
|
}
|
|
163
265
|
/**
|
|
164
266
|
* This function packs rectangles into an outer rectangle of a given width with a guillotine row packing. It does
|
|
@@ -177,7 +279,7 @@ export declare function packRows<T>(rects: Rect<T>[], outer: Rect<T>, options?:
|
|
|
177
279
|
* This width is not less than the width of the widest rectangle. The height grows until all rectangles fit.
|
|
178
280
|
* - With `fixedWidth`, the width stays. A rectangle wider than that width goes on its own row and overflows.
|
|
179
281
|
* - With `fixedSize`, a rectangle that does not fit is not packed: its `wasPacked` stays `false`.
|
|
180
|
-
* - `options.strategy` selects `packRows` (the default), `packSkyline` or `
|
|
282
|
+
* - `options.strategy` selects `packRows` (the default), `packSkyline`, `packShelf` or `packMaxRects` after the width is set.
|
|
181
283
|
*/
|
|
182
284
|
export declare function pack<T>(rects: Rect<T>[], outer?: Rect<T>, options?: PackLayoutOptions): Rect<T>;
|
|
183
285
|
/**
|
|
@@ -217,30 +319,6 @@ interface SkylineOptions {
|
|
|
217
319
|
* the obstacles and the locked items, thus the locked rectangles only keep their positions.
|
|
218
320
|
*/
|
|
219
321
|
export declare function packSkyline<T>(rects: Rect<T>[], outer: Rect<T>, options?: SkylineOptions): Rect<T>;
|
|
220
|
-
/** The options of `packShelf` */
|
|
221
|
-
interface ShelfOptions {
|
|
222
|
-
/** The order of the rectangles before the packing. The default is `height-desc`. */
|
|
223
|
-
sortOrder?: SortOrder;
|
|
224
|
-
/**
|
|
225
|
-
* The free space of the container: `freeSpace` of the input. Without it, or when it is plain, the packer uses only the
|
|
226
|
-
* outer rectangle and the locked rectangles.
|
|
227
|
-
*/
|
|
228
|
-
space?: FreeSpace;
|
|
229
|
-
}
|
|
230
|
-
/**
|
|
231
|
-
* This function packs rectangles into shelves: rows that it fills left to right in the sort order, and does not fill
|
|
232
|
-
* again. It goes around each `locked` rectangle. It sets the position of each rectangle and gives the outer rectangle.
|
|
233
|
-
*
|
|
234
|
-
* - With the sort order `input`, the rows read in the order of the array: left to right, and top to bottom.
|
|
235
|
-
* - With `height-desc` (the default), it is the classic Next-Fit Decreasing Height packing.
|
|
236
|
-
* - A rectangle goes to the first x in the row where it crosses no locked rectangle. If no such x is in the width,
|
|
237
|
-
* a new row starts under the current row.
|
|
238
|
-
* - A rectangle wider than the outer rectangle goes on its own row, at the left edge, and overflows.
|
|
239
|
-
* - It does not change the width. Without `fixedSize`, the height grows to the content. With `fixedSize`, a
|
|
240
|
-
* rectangle that does not fit is not packed: its `wasPacked` stays `false`.
|
|
241
|
-
* - With a space that is not plain, `packRowsInSpace` packs the rows into the outline of the space and around its holes.
|
|
242
|
-
*/
|
|
243
|
-
export declare function packShelf<T>(rects: Rect<T>[], outer: Rect<T>, options?: ShelfOptions): Rect<T>;
|
|
244
322
|
/** The options of `packFree` */
|
|
245
323
|
interface FreeWidthOptions extends PackLayoutOptions {
|
|
246
324
|
/** The target aspect: the width divided by the height. The default is 1, a square. */
|
|
@@ -387,9 +465,16 @@ interface LayoutMeasures {
|
|
|
387
465
|
"pack.overflow.rate": number;
|
|
388
466
|
"pack.overflow.area": number;
|
|
389
467
|
"pack.overflow.forced": number;
|
|
468
|
+
/** The tight lower bound of `pack.overflow.area`. `docs/MEASURES.md` defines it. */
|
|
390
469
|
"pack.overflow.forcedArea": number;
|
|
391
470
|
"pack.overflow.excess": number;
|
|
471
|
+
/**
|
|
472
|
+
* This measure is an alias of `pack.overflow.forcedArea`, with the same value.
|
|
473
|
+
*
|
|
474
|
+
* @deprecated Use `pack.overflow.forcedArea`. The alias stays until the next minor version.
|
|
475
|
+
*/
|
|
392
476
|
"pack.overflow.forcedAreaMin": number;
|
|
477
|
+
/** The overflow area above its bound: `pack.overflow.area` less `pack.overflow.forcedArea`. */
|
|
393
478
|
"pack.overflow.excessArea": number;
|
|
394
479
|
"pack.search.widths": number;
|
|
395
480
|
"pack.search.ms": number;
|
|
@@ -416,6 +501,8 @@ interface MeasureOptions {
|
|
|
416
501
|
* - A share of an area from 0 to 1 has 0.005. A guard has its tolerance.
|
|
417
502
|
* - An area and a ratio of lengths have `{ rel: 0.01 }`: 1% of the larger value.
|
|
418
503
|
* - The time has no minimum effect, because the times of CI change each time.
|
|
504
|
+
* - `pack.overflow.forcedAreaMin` is a deprecated alias of `pack.overflow.forcedArea`. Its spec is the same, except the id.
|
|
505
|
+
* The alias stays until the next minor version.
|
|
419
506
|
*/
|
|
420
507
|
export declare const MEASURE_SPECS: Readonly<Record<MeasureId, MeasureSpec>>;
|
|
421
508
|
/**
|
|
@@ -427,7 +514,8 @@ export declare const MEASURE_SPECS: Readonly<Record<MeasureId, MeasureSpec>>;
|
|
|
427
514
|
* - The time `pack.search.ms` comes from the trace. It is not part of the determinism rule.
|
|
428
515
|
* - The overflow measures count each id once. `pack.overflow.forced` is the lower bound of `overflowBound`.
|
|
429
516
|
* - `pack.overflow.excess` is the overflow less the forced overflow. A container with no fixed side gives 0 for both.
|
|
430
|
-
* - `pack.overflow.
|
|
517
|
+
* - `pack.overflow.forcedArea` is a lower bound of the overflow area. `pack.overflow.excessArea` is the overflow area above it.
|
|
518
|
+
* - `pack.overflow.forcedAreaMin` is a deprecated alias of `pack.overflow.forcedArea`, with the same value.
|
|
431
519
|
*
|
|
432
520
|
* @example
|
|
433
521
|
* ```ts
|
|
@@ -587,6 +675,23 @@ interface LayoutStrategyOptions {
|
|
|
587
675
|
sortOrder: SortOrder;
|
|
588
676
|
/** The number of widths that the first pass of the size search `log-sweep` tries. */
|
|
589
677
|
samples: number;
|
|
678
|
+
/**
|
|
679
|
+
* The rule of `shelf` to choose a shelf: `next`, `first` or `best`. Only `shelf` reads it. Without it, `shelf` packs
|
|
680
|
+
* as in 0.2.3. With it, the trace also counts `move.firstFit` and `move.bestFit`.
|
|
681
|
+
*/
|
|
682
|
+
fit?: ShelfFit;
|
|
683
|
+
}
|
|
684
|
+
/** The options of the strategy `maxrects`. The strategy does not read `fit`. */
|
|
685
|
+
interface MaxRectsStrategyOptions extends LayoutStrategyOptions {
|
|
686
|
+
/** The rule to choose a free rectangle: `bssf` (the default), `blsf`, `baf`, `bl` or `cp`. `MAXRECTS_RULES` tells each rule. */
|
|
687
|
+
rule: MaxRectsRule;
|
|
688
|
+
/** The value `true` lets each turnable item that is not locked turn by 90 degrees. The default is `false`. */
|
|
689
|
+
rotate: boolean;
|
|
690
|
+
/**
|
|
691
|
+
* The largest height of a band of the approximation of a container that is not a plain rectangle. `MaxRectsOptions`
|
|
692
|
+
* tells the default.
|
|
693
|
+
*/
|
|
694
|
+
bandHeight?: number;
|
|
590
695
|
}
|
|
591
696
|
/** The options of the strategy `push`. */
|
|
592
697
|
interface PushStrategyOptions {
|
|
@@ -609,11 +714,21 @@ export declare const skyline: Strategy<LayoutStrategyOptions>;
|
|
|
609
714
|
/**
|
|
610
715
|
* The strategy `shelf` uses `packShelf`: rows filled left to right, around the locked items and the fixed obstacles.
|
|
611
716
|
* With the sort order `input`, the rows keep the rank order. Turnable items, groups and item shapes throw `UnsupportedCell`.
|
|
717
|
+
* The option `fit` selects a shelf rule of roadmap item k21: `next`, `first` or `best`. The default has no `fit`.
|
|
612
718
|
*/
|
|
613
719
|
export declare const shelf: Strategy<LayoutStrategyOptions>;
|
|
720
|
+
/**
|
|
721
|
+
* The strategy `maxrects` uses `packMaxRects`: the MaxRects packer of roadmap item k24. It keeps the list of the maximal
|
|
722
|
+
* free rectangles, and the option `rule` chooses the free rectangle for each item. The default rule is `bssf`.
|
|
723
|
+
*
|
|
724
|
+
* - The free rectangles go around the locked items and the fixed obstacles. A plain rectangle container gives exact free
|
|
725
|
+
* rectangles. Another shape gives an inner approximation with horizontal bands.
|
|
726
|
+
* - With `rotate`, each turnable item that is not locked can turn by 90 degrees. Groups and item shapes throw `UnsupportedCell`.
|
|
727
|
+
*/
|
|
728
|
+
export declare const maxrects: Strategy<MaxRectsStrategyOptions>;
|
|
614
729
|
/**
|
|
615
730
|
* The size search `log-sweep` uses `packFree` of 0.1.2: widths on a log scale, then the widths near the best width. It
|
|
616
|
-
* wraps `rows`, `skyline` and `
|
|
731
|
+
* wraps `rows`, `skyline`, `shelf` and `maxrects`. The objective is the area of the frame times `1 + aspectWeight * aspectError`.
|
|
617
732
|
*/
|
|
618
733
|
export declare const logSweep: SizeSearch;
|
|
619
734
|
/**
|
|
@@ -837,5 +952,5 @@ interface Corpus {
|
|
|
837
952
|
* `RangeError` for an unknown generator, a different version or 2 inputs with the same id.
|
|
838
953
|
*/
|
|
839
954
|
export declare function corpus(name: string, specs: readonly CorpusSpec[]): Corpus;
|
|
840
|
-
export { type Cell, type ChangeMeasures, type ContainerTest, 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 FreeSpace, type FreeSpan, 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 SkylineOptions, type SortOrder, type SpaceRect, type StageTrace, type Strategy, type Supports, type Tolerance, type UiParams, checkInput, turnPoint, turnPort, turnRegion };
|
|
955
|
+
export { type Cell, type ChangeMeasures, type ContainerTest, 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 FreeSpace, type FreeSpan, 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 MaxRectsOptions, type MaxRectsRule, type MaxRectsStrategyOptions, 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 ShelfFit, type ShelfOptions, type Side, type Sides, type SizeDistribution, type SizeSearch, type SkylineOptions, type SortOrder, type SpaceRect, type StageTrace, type Strategy, type Supports, type Tolerance, type UiParams, checkInput, turnPoint, turnPort, turnRegion };
|
|
841
956
|
//# sourceMappingURL=index.d.ts.map
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":["Item","Sides","ContractMeasureSpec","Direction","ContainerTest","PackHard","LayoutContainer","LayoutEdge","LayoutInput"],"sources":["../src/vector.ts","../src/rect.ts","../src/order.ts","../src/contract.ts","../src/space.ts","../src/
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":["Item","Sides","ContractMeasureSpec","Direction","ContainerTest","PackHard","LayoutContainer","LayoutEdge","LayoutInput"],"sources":["../src/vector.ts","../src/rect.ts","../src/order.ts","../src/contract.ts","../src/space.ts","../src/maxrects.ts","../src/shelf.ts","../src/pack.ts","../src/skyline.ts","../src/free.ts","../src/push.ts","../src/metrics.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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