@mark1russell7/packing 0.2.14 → 0.2.16

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
@@ -162,6 +162,7 @@ checkHard(input, output); // { "no-overlap": 0, "in-container": 0, "locked-kept"
162
162
  ```
163
163
 
164
164
  - The registry `strategies` has `rows`, `skyline`, `shelf`, `push` and `maxrects`. `strategy(id)` gives one, and `packWith(id, input, options, seed)` packs with it.
165
+ - `packDefault(input, seed)` packs with `DEFAULT_STRATEGY`, the composite strategy `select`. It passed the win test against `rows` on two fresh-seed corpora.
165
166
  - `fixed` is `size`, `width`, `height` or `none`. A fixed height turns the axes. The value `none` uses the size search `logSweep`, which wraps `packFree`.
166
167
  - 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.
167
168
  - Only `maxrects` accepts a turnable item, and it turns items only with `rotate: true`. The other strategies give `UnsupportedCell` for a turnable item.
package/build/index.d.ts CHANGED
@@ -779,6 +779,13 @@ export declare function strategy(id: string): Strategy;
779
779
  * context gets `mulberry32` with the seed. The default seed is 0.
780
780
  */
781
781
  export declare function packWith(id: string, input: PackInput, options?: unknown, seed?: number): PackOutput;
782
+ /**
783
+ * The id of the default strategy of an input: `select`. It passed two fresh-seed confirmations against `rows` (roadmap
784
+ * item k66). `pack` does not read it.
785
+ */
786
+ export declare const DEFAULT_STRATEGY = "select";
787
+ /** This function packs an input with `DEFAULT_STRATEGY` and its defaults. The default seed is 0. */
788
+ export declare function packDefault(input: PackInput, seed?: number): PackOutput;
782
789
  /** The options of `aspectFit` */
783
790
  interface AspectFitOptions {
784
791
  /** The target aspect: the width divided by the height. The default is `aspect` of the container, else 1. */
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":["Item","Sides","ContractMeasureSpec","Direction","SelectLevel","SelectLevel","Portfolio","LayoutContainer","LayoutEdge","LayoutInput","ContainerTest","PackHard"],"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/aspect-fit.ts","../src/select-key.ts","../src/portfolio.ts","../src/layout-input.ts","../src/portfolio-cell.ts","../src/portfolio-sets.ts","../src/portfolio-strategy.ts","../src/select.ts","../src/check.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,OAAO,aAAa,GAAG,GAAG,KAAK,IAAI,GAAG,KAAK;;wBCiBxD,SAAS,MAAM,KAAKA,oBAAkBC;;;;;;;wBAWtC,SAAS,MAAMD,SAAOA;;UC/BrB;WACN;WACA;;;UAIM;WACN;WACA;WACA;WACA;;;;;;;;;;;UAYM;;WAEN;;WAEA;;;;;WAKA;;EAET,KAAK,YAAY,a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AgB;;cA2BjC;;KAGM,mBAAmB;EAC7B,eAAe;;;;;;qBAOJ,YAAY,gBAAgB;;KA0B7B;EACV,eAAe;EACf;;;qBA0BW,SAAS,gBAAgB;;qBAWzB,WAAW,gBAAgB;;qBAS3B,OAAO,gBAAgB;;qBAUvB,WAAW,gBAAgB;;KAY5B;;KAGA;EAAmB,MAAM;EAAU;;;;;;;;;;;qBAoBlC,WAAW,gBAAgB;;qBAwF3B,qBAAqB;;;;;wBAMlB,UAAU,cAAc,mBAAmB;;UCxsB1C;;EAEf;;EAEA;;EAEA,SAAS;EACT;;;UAIe;EACf;EACA;EACA,MAAM;;;UAIS;EACf;;EAEA;;EAEA;IAAS;IAAmB;IAAiB,QAAQ;IAAiB;;EACtE,QAAQ;;;UAIO;EACf,UAAU;EACV,QAAQ;;;;;;wBAOM,OAAO,cAAc,gBAAgB,eAAe"}
1
+ {"version":3,"file":"index.d.ts","names":["Item","Sides","ContractMeasureSpec","Direction","SelectLevel","SelectLevel","Portfolio","LayoutContainer","LayoutEdge","LayoutInput","ContainerTest","PackHard"],"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/aspect-fit.ts","../src/select-key.ts","../src/portfolio.ts","../src/layout-input.ts","../src/portfolio-cell.ts","../src/portfolio-sets.ts","../src/portfolio-strategy.ts","../src/select.ts","../src/check.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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M,OAAO,cAAc,gBAAgB,eAAe"}
package/build/index.js CHANGED
@@ -1858,11 +1858,11 @@ function packSkylineInSpace(rects, outer, order, space) {
1858
1858
  // src/pack.ts
1859
1859
  /** The depth of the calls of `packInto`. Only the outer gap fill counts its rectangles as moves. */
1860
1860
  let fillDepth = 0;
1861
- function packInto(rects, region, offset, order) {
1862
- const unpacked = Rect.unpacked(rects);
1861
+ function packInto(byOrder, region, offset, order) {
1862
+ const unpacked = Rect.unpacked(byOrder);
1863
1863
  fillDepth++;
1864
1864
  try {
1865
- pack(unpacked, region, { sortOrder: order });
1865
+ packSortedRows(unpacked, region, order);
1866
1866
  } finally {
1867
1867
  fillDepth--;
1868
1868
  }
@@ -1870,13 +1870,12 @@ function packInto(rects, region, offset, order) {
1870
1870
  if (fillDepth === 0) countMove(MOVES.rows, placed.length);
1871
1871
  for (const r of placed) r.translateBy(offset);
1872
1872
  }
1873
- function packRow(rects, outer, order) {
1873
+ function packRow(byOrder, outer, order) {
1874
1874
  const row = [];
1875
- const byHeight = rects.toSorted(compareRects(order));
1876
1875
  const fillGaps = order !== "input";
1877
1876
  const rowRect = new Rect();
1878
1877
  rowRect.size.set(outer.size.x, 0);
1879
- for (const rect of byHeight) {
1878
+ for (const rect of byOrder) {
1880
1879
  if (rect.wasPacked) continue;
1881
1880
  if (rect.size.x > rowRect.size.x) {
1882
1881
  if (outer.fixedSize && rect.size.x > outer.size.x) continue;
@@ -1884,7 +1883,7 @@ function packRow(rects, outer, order) {
1884
1883
  outerLeft.position.setTo(rowRect.position);
1885
1884
  outerLeft.size.set(outer.size.x - rowRect.position.x, rowRect.size.y);
1886
1885
  outerLeft.fixedSize = true;
1887
- if (fillGaps) packInto(rects, outerLeft, outer.position, order);
1886
+ if (fillGaps) packInto(byOrder, outerLeft, outer.position, order);
1888
1887
  rowRect.position.set(0, rowRect.bottom());
1889
1888
  rowRect.size.set(outer.size.x, 0);
1890
1889
  row.length = 0;
@@ -1893,7 +1892,7 @@ function packRow(rects, outer, order) {
1893
1892
  if (outer.fixedSize) continue;
1894
1893
  outer.size.y += rect.size.y;
1895
1894
  if (!outer.fixedWidth && !outer.size.x) outer.size.x = rect.size.x;
1896
- Rect.resetPacked(rects);
1895
+ Rect.resetPacked(byOrder);
1897
1896
  return false;
1898
1897
  }
1899
1898
  row.push(rect);
@@ -1908,12 +1907,20 @@ function packRow(rects, outer, order) {
1908
1907
  outerLeft.size.set(rectInRow.size.x, rowRect.size.y - rectInRow.size.y);
1909
1908
  outerLeft.fixedWidth = true;
1910
1909
  outerLeft.fixedSize = true;
1911
- packInto(rects, outerLeft, outer.position, order);
1910
+ packInto(byOrder, outerLeft, outer.position, order);
1912
1911
  }
1913
1912
  }
1914
1913
  return true;
1915
1914
  }
1916
1915
  /**
1916
+ * This function packs rows of rectangles that are in the order `order` already. A stable sort orders by the key and then
1917
+ * by the position in the input, and a filter keeps that order. Thus a gap fill gives the layout of a sort again.
1918
+ */
1919
+ function packSortedRows(byOrder, outer, order) {
1920
+ for (const r of byOrder) if (r.locked) r.wasPacked = true;
1921
+ while (!packRow(byOrder, outer, order)) if (fillDepth === 0) clearMoves(MOVES.rows);
1922
+ }
1923
+ /**
1917
1924
  * This function packs rectangles into an outer rectangle of a given width with a guillotine row packing. It does
1918
1925
  * not change the width. Without `fixedSize`, the height grows until all rectangles fit. A `locked` rectangle keeps
1919
1926
  * its position, but the rows do not go around it. `pack` sets the width first and then uses this function.
@@ -1925,8 +1932,7 @@ function packRows(rects, outer, options = {}) {
1925
1932
  const order = options.sortOrder ?? "height-desc";
1926
1933
  const space = options.space;
1927
1934
  if (space !== void 0 && (!space.plain || rects.some((r) => r.locked))) return packRowsInSpace(rects, outer, order, space);
1928
- for (const r of rects) if (r.locked) r.wasPacked = true;
1929
- while (!packRow(rects, outer, order)) if (fillDepth === 0) clearMoves(MOVES.rows);
1935
+ packSortedRows(rects.toSorted(compareRects(order)), outer, order);
1930
1936
  return outer;
1931
1937
  }
1932
1938
  /**
@@ -6560,6 +6566,15 @@ function packWith(id, input, options, seed = 0) {
6560
6566
  };
6561
6567
  return s.pack(input, merged, createContext(seed));
6562
6568
  }
6569
+ /**
6570
+ * The id of the default strategy of an input: `select`. It passed two fresh-seed confirmations against `rows` (roadmap
6571
+ * item k66). `pack` does not read it.
6572
+ */
6573
+ const DEFAULT_STRATEGY = "select";
6574
+ /** This function packs an input with `DEFAULT_STRATEGY` and its defaults. The default seed is 0. */
6575
+ function packDefault(input, seed = 0) {
6576
+ return packWith(DEFAULT_STRATEGY, input, void 0, seed);
6577
+ }
6563
6578
  // src/generators.ts
6564
6579
  /** The largest count of boxes that a generator makes. */
6565
6580
  const MAX_COUNT = 1e5;
@@ -7528,6 +7543,6 @@ function corpus(name, specs) {
7528
7543
  inputs
7529
7544
  };
7530
7545
  }
7531
- export { ASPECT_FIT_FACTORS, ASPECT_FIT_LEVELS, ASPECT_FIT_STAGE, DEFAULT_TOLERANCE, EPS, MAXRECTS_BANDS, MAXRECTS_RULES, MEASURE_SPECS, PORTFOLIO_FRAME_MS, PORTFOLIO_LEVELS, PORTFOLIO_SETS, PORTFOLIO_STAGE, RECORD_EPS, Rect, SELECT_MAX_DEPTH, SELECT_MEMBERS, SELECT_STAGE, SELECT_TABLE, SHELF_FITS, SORT_ORDERS, SPREAD_THRESHOLDS, THIN_INPUTS, UnsupportedCell, Vector, aspectError, aspectFit, aspectFitStrategy, assertSupported, canonicalJson, cards, cellKey, cellOf, checkHard, checkInput, checkSelectTable, compareRects, composites, corpus, countCell, createContext, dashboard, edgeCases, fnv1a32, freeSpace, fromRects, gallery, generator, generators, hardBreaks, hashInput, isDeterministic, logSweep, lowestWindow, marginOf, maxrects, measure, measureChange, medianRatio, mulberry32, outputHash, pack, packFree, packMaxRects, packPortfolio, packRows, packShelf, packSkyline, packWith, packingMetrics, pairedRatio, portfolioCell, portfolioDefaultMembers, portfolioMembers, portfolioSetOf, portfolioStrategy, push, pushCascade, quantile, rectGrid, rectGridV2, rectScattered, round3, roundMeasures, rows, selectFeatures, selectLeaf, selectStrategy, shelf, skyline, spreadBand, spreadOf, strategies, strategy, supportsCell, tailShare, toPackInput, toRects, turnItem, turnPoint, turnPort, turnRegion, unsupportedOf, wordCloud };
7546
+ export { ASPECT_FIT_FACTORS, ASPECT_FIT_LEVELS, ASPECT_FIT_STAGE, DEFAULT_STRATEGY, DEFAULT_TOLERANCE, EPS, MAXRECTS_BANDS, MAXRECTS_RULES, MEASURE_SPECS, PORTFOLIO_FRAME_MS, PORTFOLIO_LEVELS, PORTFOLIO_SETS, PORTFOLIO_STAGE, RECORD_EPS, Rect, SELECT_MAX_DEPTH, SELECT_MEMBERS, SELECT_STAGE, SELECT_TABLE, SHELF_FITS, SORT_ORDERS, SPREAD_THRESHOLDS, THIN_INPUTS, UnsupportedCell, Vector, aspectError, aspectFit, aspectFitStrategy, assertSupported, canonicalJson, cards, cellKey, cellOf, checkHard, checkInput, checkSelectTable, compareRects, composites, corpus, countCell, createContext, dashboard, edgeCases, fnv1a32, freeSpace, fromRects, gallery, generator, generators, hardBreaks, hashInput, isDeterministic, logSweep, lowestWindow, marginOf, maxrects, measure, measureChange, medianRatio, mulberry32, outputHash, pack, packDefault, packFree, packMaxRects, packPortfolio, packRows, packShelf, packSkyline, packWith, packingMetrics, pairedRatio, portfolioCell, portfolioDefaultMembers, portfolioMembers, portfolioSetOf, portfolioStrategy, push, pushCascade, quantile, rectGrid, rectGridV2, rectScattered, round3, roundMeasures, rows, selectFeatures, selectLeaf, selectStrategy, shelf, skyline, spreadBand, spreadOf, strategies, strategy, supportsCell, tailShare, toPackInput, toRects, turnItem, turnPoint, turnPort, turnRegion, unsupportedOf, wordCloud };
7532
7547
 
7533
7548
  //# sourceMappingURL=index.js.map