@mark1russell7/layout-contract 0.9.2 → 0.9.3

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/build/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as CorpusSplit, A as shapeKindsOf, At as overlapOf, B as LayoutInput, C as checkShapes, Ct as Sides, D as ruleLevel, Dt as dropIndex, E as itemShapeOf, Et as crossingPoint, F as LayoutBox, Ft as toSizedRect, G as PairGap, H as PackInput, I as LayoutCell, It as translate, J as packLinks, K as Port, L as LayoutContainer, M as shapeSupportProblems, Mt as regionArea, N as shapesOf, Nt as segmentsCross, O as shapeKindOf, Ot as grow, P as Item, Pt as toRect, Q as CorpusEntry, R as LayoutEdge, S as boxArea, St as Side, T as isShapeKind, Tt as boundsOf, U as PackInputOptions, V as Obstacle, W as PackLink, X as toPackInput, Y as portPoint, Z as ClaimBreak, _ as ShapeKind, _t as Margin, a as MeasureSpec, at as SPLIT_SCHEMA, b as ShapeLimit, bt as Region, c as minEffectOf, ct as checkDeclared, d as SHAPE_KINDS, dt as declaredClaimOf, et as DeclaredClaim, f as SHAPE_KIND_IDS, ft as declaredCounts, g as ShapeInput, gt as splitFolds, h as ShapeGeometry, ht as splitFileName, i as JointMeasureId, it as FamilyCell, j as shapeLevel, jt as pointSegmentDistance, k as shapeKindProblem, kt as marginSides, l as DEFAULT_SHAPES, lt as checkSplit, m as ShapeCheck, mt as leaveOneSeedOut, n as JOINT_MEASURES, nt as FAMILY_ANY_KIND, o as Verdict, ot as SplitCorpus, p as ShapeBound, pt as familyOf, q as canonicalInput, r as JOINT_MOVED_MIN, rt as FamilyBy, s as compareMeasure, st as SplitFold, t as Direction, tt as Declares, u as RuleLevel, ut as corpusHashOf, v as ShapeKindSpec, vt as Point, w as inputShapeLevel, wt as SizedRect, x as ShapeSupport, xt as SIDES, y as ShapeLevel, yt as Rect, z as LayoutGenerator } from "./measures-DGKAulWv.js";
1
+ import { $ as CorpusSplit, A as shapeKindsOf, At as overlapOf, B as LayoutInput, C as checkShapes, Ct as Sides, D as ruleLevel, Dt as dropIndex, E as itemShapeOf, Et as crossingPoint, F as LayoutBox, Ft as toRect, G as PairGap, H as PackInput, I as LayoutCell, It as toSizedRect, J as packLinks, K as Port, L as LayoutContainer, Lt as translate, M as shapeSupportProblems, Mt as regionArea, N as shapesOf, Nt as segmentsCross, O as shapeKindOf, Ot as grow, P as Item, Pt as snapRect, Q as CorpusEntry, R as LayoutEdge, S as boxArea, St as Side, T as isShapeKind, Tt as boundsOf, U as PackInputOptions, V as Obstacle, W as PackLink, X as toPackInput, Y as portPoint, Z as ClaimBreak, _ as ShapeKind, _t as Margin, a as MeasureSpec, at as SPLIT_SCHEMA, b as ShapeLimit, bt as Region, c as minEffectOf, ct as checkDeclared, d as SHAPE_KINDS, dt as declaredClaimOf, et as DeclaredClaim, f as SHAPE_KIND_IDS, ft as declaredCounts, g as ShapeInput, gt as splitFolds, h as ShapeGeometry, ht as splitFileName, i as JointMeasureId, it as FamilyCell, j as shapeLevel, jt as pointSegmentDistance, k as shapeKindProblem, kt as marginSides, l as DEFAULT_SHAPES, lt as checkSplit, m as ShapeCheck, mt as leaveOneSeedOut, n as JOINT_MEASURES, nt as FAMILY_ANY_KIND, o as Verdict, ot as SplitCorpus, p as ShapeBound, pt as familyOf, q as canonicalInput, r as JOINT_MOVED_MIN, rt as FamilyBy, s as compareMeasure, st as SplitFold, t as Direction, tt as Declares, u as RuleLevel, ut as corpusHashOf, v as ShapeKindSpec, vt as Point, w as inputShapeLevel, wt as SizedRect, x as ShapeSupport, xt as SIDES, y as ShapeLevel, yt as Rect, z as LayoutGenerator } from "./measures-O-NfAbmJ.js";
2
2
  import { AnyOption, BooleanOption, DeclaredStrategy, EnumOption, EnumerateOptions, EnumerateOptions as EnumerateOptions$1, GridOptions, KindOptions, KindOptions as KindOptions$1, ListItem, MemberRule, NoDefault, NoDefaultReason, NumberOption, OptionDeclaration, OptionIssue, OptionRef, OptionScale, OptionSchema, OptionSetting, OptionSupports, ParamKind, ParamValue, ParamWhen, STRATEGY_SPACE_SCHEMA, SampleOptions, ShapeFilter, SpaceConstraint, SpaceParam, SpaceSize, SpaceSize as SpaceSize$1, SpaceSizeOptions, SpaceSizeOptions as SpaceSizeOptions$1, SpaceStage, StageChoice, StageOption, StrategyConfig, StrategyConfig as StrategyConfig$1, StrategySpace, StrategySpace as StrategySpace$1, SweepOptions, ValueOption, canonicalConfig, checkConfig, checkOptions, checkSchema, clampOptions, configId, declarationIssues, joinConfigs, listOptions, optionDefaults, optionIssue, paramActive, paramLevels, paramProblem, paramValue, productSpace, splitConfig, sweepGrid, sweepOf, sweepValues } from "@mark1russell7/strategy-space";
3
3
  /** The epsilon for the float compares in an engine. */
4
4
  export declare const EPS = 1e-6;
@@ -1474,5 +1474,5 @@ export declare const CIRCLE_SCATTERED: CorpusFamily<LayoutInput>;
1474
1474
  * The steps `container`, `obstacles` and `boxes` each have a stream of `stepRandom`. Each value is a whole number, so the family is `exact`.
1475
1475
  */
1476
1476
  export declare const RECT_SCATTERED: CorpusFamily<LayoutInput>;
1477
- export { type AnyOption, type BooleanOption, ClaimBreak, CorpusEntry, CorpusSplit, DEFAULT_SHAPES, DeclaredClaim, type DeclaredStrategy, Declares, Direction, type EnumOption, type EnumerateOptions, FAMILY_ANY_KIND, FamilyBy, FamilyCell, type GridOptions, Item, JOINT_MEASURES, JOINT_MOVED_MIN, JointMeasureId, type KindOptions, LayoutBox, LayoutCell, LayoutContainer, LayoutEdge, LayoutGenerator, LayoutInput, type ListItem, Margin, MeasureSpec, type MemberRule, type NoDefault, type NoDefaultReason, type NumberOption, Obstacle, type OptionDeclaration, type OptionIssue, type OptionRef, type OptionScale, type OptionSchema, type OptionSetting, type OptionSupports, PackInput, PackInputOptions, PackLink, PairGap, type ParamKind, type ParamValue, type ParamWhen, Point, Port, Rect, Region, RuleLevel, SHAPE_KINDS, SHAPE_KIND_IDS, SIDES, SPLIT_SCHEMA, STRATEGY_SPACE_SCHEMA, type SampleOptions, ShapeBound, ShapeCheck, type ShapeFilter, ShapeGeometry, ShapeInput, ShapeKind, ShapeKindSpec, ShapeLevel, ShapeLimit, ShapeSupport, Side, Sides, SizedRect, type SpaceConstraint, type SpaceParam, type SpaceSize, type SpaceSizeOptions, type SpaceStage, SplitCorpus, SplitFold, type StageChoice, type StageOption, type StrategyConfig, type StrategySpace, type SweepOptions, type ValueOption, Verdict, boundsOf, boxArea, canonicalConfig, canonicalInput, checkConfig, checkDeclared, checkOptions, checkSchema, checkShapes, checkSplit, clampOptions, compareMeasure, configId, corpusHashOf, crossingPoint, declarationIssues, declaredClaimOf, declaredCounts, dropIndex, familyOf, grow, inputShapeLevel, isShapeKind, itemShapeOf, joinConfigs, leaveOneSeedOut, listOptions, marginSides, minEffectOf, optionDefaults, optionIssue, overlapOf, packLinks, paramActive, paramLevels, paramProblem, paramValue, pointSegmentDistance, portPoint, productSpace, regionArea, ruleLevel, segmentsCross, shapeKindOf, shapeKindProblem, shapeKindsOf, shapeLevel, shapeSupportProblems, shapesOf, splitConfig, splitFileName, splitFolds, sweepGrid, sweepOf, sweepValues, toPackInput, toRect, toSizedRect, translate };
1477
+ export { type AnyOption, type BooleanOption, ClaimBreak, CorpusEntry, CorpusSplit, DEFAULT_SHAPES, DeclaredClaim, type DeclaredStrategy, Declares, Direction, type EnumOption, type EnumerateOptions, FAMILY_ANY_KIND, FamilyBy, FamilyCell, type GridOptions, Item, JOINT_MEASURES, JOINT_MOVED_MIN, JointMeasureId, type KindOptions, LayoutBox, LayoutCell, LayoutContainer, LayoutEdge, LayoutGenerator, LayoutInput, type ListItem, Margin, MeasureSpec, type MemberRule, type NoDefault, type NoDefaultReason, type NumberOption, Obstacle, type OptionDeclaration, type OptionIssue, type OptionRef, type OptionScale, type OptionSchema, type OptionSetting, type OptionSupports, PackInput, PackInputOptions, PackLink, PairGap, type ParamKind, type ParamValue, type ParamWhen, Point, Port, Rect, Region, RuleLevel, SHAPE_KINDS, SHAPE_KIND_IDS, SIDES, SPLIT_SCHEMA, STRATEGY_SPACE_SCHEMA, type SampleOptions, ShapeBound, ShapeCheck, type ShapeFilter, ShapeGeometry, ShapeInput, ShapeKind, ShapeKindSpec, ShapeLevel, ShapeLimit, ShapeSupport, Side, Sides, SizedRect, type SpaceConstraint, type SpaceParam, type SpaceSize, type SpaceSizeOptions, type SpaceStage, SplitCorpus, SplitFold, type StageChoice, type StageOption, type StrategyConfig, type StrategySpace, type SweepOptions, type ValueOption, Verdict, boundsOf, boxArea, canonicalConfig, canonicalInput, checkConfig, checkDeclared, checkOptions, checkSchema, checkShapes, checkSplit, clampOptions, compareMeasure, configId, corpusHashOf, crossingPoint, declarationIssues, declaredClaimOf, declaredCounts, dropIndex, familyOf, grow, inputShapeLevel, isShapeKind, itemShapeOf, joinConfigs, leaveOneSeedOut, listOptions, marginSides, minEffectOf, optionDefaults, optionIssue, overlapOf, packLinks, paramActive, paramLevels, paramProblem, paramValue, pointSegmentDistance, portPoint, productSpace, regionArea, ruleLevel, segmentsCross, shapeKindOf, shapeKindProblem, shapeKindsOf, shapeLevel, shapeSupportProblems, shapesOf, snapRect, splitConfig, splitFileName, splitFolds, sweepGrid, sweepOf, sweepValues, toPackInput, toRect, toSizedRect, translate };
1478
1478
  //# sourceMappingURL=index.d.ts.map
package/build/index.js CHANGED
@@ -27,6 +27,22 @@ function toSizedRect(rect) {
27
27
  height: rect.h
28
28
  };
29
29
  }
30
+ /** This function rounds a number to a whole number with `Math.round`. It gives 0, not -0, for a small negative number. */
31
+ const roundEdge = (value) => Math.round(value) + 0;
32
+ /**
33
+ * This function gives a rectangle on whole pixels. It rounds each edge with `Math.round`, not the size. Thus two
34
+ * rectangles that touch still touch after the rounding, and no gap or overlap of one pixel comes between them.
35
+ */
36
+ function snapRect(rect) {
37
+ const x = roundEdge(rect.x);
38
+ const y = roundEdge(rect.y);
39
+ return {
40
+ x,
41
+ y,
42
+ w: roundEdge(rect.x + rect.w) - x,
43
+ h: roundEdge(rect.y + rect.h) - y
44
+ };
45
+ }
30
46
  /** This function gives the value of each side of a margin. No margin gives 0 on each side. */
31
47
  function marginSides(margin) {
32
48
  if (margin === void 0) return {
@@ -5114,6 +5130,6 @@ const RECT_SCATTERED = /* @__PURE__ */ Object.freeze({
5114
5130
  };
5115
5131
  }
5116
5132
  });
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 };
5133
+ 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, snapRect, spaceShapeKinds, spaceSize, splitConfig, splitFileName, splitFolds, stepRandom, sweepGrid, sweepOf, sweepValues, toLayoutRecord, toPackInput, toRect, toSizedRect, translate, turnBox, turnMargin, turnPoint, turnPort, turnRegion, turnSide, verdict, writeStrategyCatalog };
5118
5134
 
5119
5135
  //# sourceMappingURL=index.js.map