@mark1russell7/packing 0.2.14 → 0.2.15

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package",
3
3
  "name": "@mark1russell7/packing",
4
- "version": "0.2.14",
4
+ "version": "0.2.15",
5
5
  "description": "Rectangle packing: shelf, guillotine and skyline strategies, push cascades and measures of a layout.",
6
6
  "keywords": [
7
7
  "rectangle-packing",
package/src/index.ts CHANGED
@@ -79,7 +79,7 @@ export {
79
79
  type PushStrategyOptions,
80
80
  } from "./adapters.ts";
81
81
  export { fromRects, toRects } from "./convert.ts";
82
- export { aspectFitStrategy, composites, packWith, strategies, strategy, type AspectFitStrategyOptions } from "./registry.ts";
82
+ export { aspectFitStrategy, composites, DEFAULT_STRATEGY, packDefault, packWith, strategies, strategy, type AspectFitStrategyOptions } from "./registry.ts";
83
83
  export { ASPECT_FIT_FACTORS, ASPECT_FIT_LEVELS, ASPECT_FIT_STAGE, aspectFit, type AspectFitOptions } from "./aspect-fit.ts";
84
84
  export { hardBreaks, packPortfolio, PORTFOLIO_LEVELS, PORTFOLIO_STAGE, type PackPortfolioOptions, type PortfolioEntry } from "./portfolio.ts";
85
85
  export {
package/src/registry.ts CHANGED
@@ -72,3 +72,14 @@ export function packWith(id: string, input: PackInput, options?: unknown, seed =
72
72
  const merged: unknown = { ...(s.defaults as object), ...(options as object | undefined) };
73
73
  return s.pack(input, merged, createContext(seed));
74
74
  }
75
+
76
+ /**
77
+ * The id of the default strategy of an input: `select`. It passed two fresh-seed confirmations against `rows` (roadmap
78
+ * item k66). `pack` does not read it.
79
+ */
80
+ export const DEFAULT_STRATEGY = "select";
81
+
82
+ /** This function packs an input with `DEFAULT_STRATEGY` and its defaults. The default seed is 0. */
83
+ export function packDefault(input: PackInput, seed = 0): PackOutput {
84
+ return packWith(DEFAULT_STRATEGY, input, undefined, seed);
85
+ }