@mark1russell7/layout-contract 0.6.1 → 0.6.2

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 pointSegmentDistance, B as LayoutInput, C as checkShapes, Ct as Sides, D as ruleLevel, Dt as grow, E as itemShapeOf, Et as crossingPoint, F as LayoutBox, Ft as translate, G as PairGap, H as PackInput, I as LayoutCell, J as packLinks, K as Port, L as LayoutContainer, M as shapeSupportProblems, Mt as segmentsCross, N as shapesOf, Nt as toRect, O as shapeKindOf, Ot as marginSides, P as Item, Pt as toSizedRect, 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 regionArea, k as shapeKindProblem, kt as overlapOf, 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-COqcrCzv.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 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";
2
2
  /** The epsilon for the float compares in an engine. */
3
3
  export declare const EPS = 1e-6;
4
4
  /** The count of `EPS` steps in one layout unit. It is the integer equal to `1 / EPS`. */
@@ -1772,5 +1772,5 @@ export declare const CIRCLE_SCATTERED: CorpusFamily<LayoutInput>;
1772
1772
  * The steps `container`, `obstacles` and `boxes` each have a stream of `stepRandom`. Each value is a whole number, so the family is `exact`.
1773
1773
  */
1774
1774
  export declare const RECT_SCATTERED: CorpusFamily<LayoutInput>;
1775
- export { ClaimBreak, CorpusEntry, CorpusSplit, DEFAULT_SHAPES, DeclaredClaim, Declares, Direction, FAMILY_ANY_KIND, FamilyBy, FamilyCell, Item, JOINT_MEASURES, JOINT_MOVED_MIN, JointMeasureId, LayoutBox, LayoutCell, LayoutContainer, LayoutEdge, LayoutGenerator, LayoutInput, Margin, MeasureSpec, Obstacle, PackInput, PackInputOptions, PackLink, PairGap, Point, Port, Rect, Region, RuleLevel, SHAPE_KINDS, SHAPE_KIND_IDS, SIDES, SPLIT_SCHEMA, ShapeBound, ShapeCheck, ShapeGeometry, ShapeInput, ShapeKind, ShapeKindSpec, ShapeLevel, ShapeLimit, ShapeSupport, Side, Sides, SizedRect, SplitCorpus, SplitFold, Verdict, boundsOf, boxArea, canonicalInput, checkDeclared, checkShapes, checkSplit, compareMeasure, corpusHashOf, crossingPoint, declaredClaimOf, declaredCounts, familyOf, grow, inputShapeLevel, isShapeKind, itemShapeOf, leaveOneSeedOut, marginSides, minEffectOf, overlapOf, packLinks, pointSegmentDistance, portPoint, regionArea, ruleLevel, segmentsCross, shapeKindOf, shapeKindProblem, shapeKindsOf, shapeLevel, shapeSupportProblems, shapesOf, splitFileName, splitFolds, toPackInput, toRect, toSizedRect, translate };
1775
+ export { ClaimBreak, CorpusEntry, CorpusSplit, DEFAULT_SHAPES, DeclaredClaim, Declares, Direction, FAMILY_ANY_KIND, FamilyBy, FamilyCell, Item, JOINT_MEASURES, JOINT_MOVED_MIN, JointMeasureId, LayoutBox, LayoutCell, LayoutContainer, LayoutEdge, LayoutGenerator, LayoutInput, Margin, MeasureSpec, Obstacle, PackInput, PackInputOptions, PackLink, PairGap, Point, Port, Rect, Region, RuleLevel, SHAPE_KINDS, SHAPE_KIND_IDS, SIDES, SPLIT_SCHEMA, ShapeBound, ShapeCheck, ShapeGeometry, ShapeInput, ShapeKind, ShapeKindSpec, ShapeLevel, ShapeLimit, ShapeSupport, Side, Sides, SizedRect, SplitCorpus, SplitFold, Verdict, boundsOf, boxArea, canonicalInput, checkDeclared, checkShapes, checkSplit, compareMeasure, corpusHashOf, crossingPoint, declaredClaimOf, declaredCounts, dropIndex, familyOf, grow, inputShapeLevel, isShapeKind, itemShapeOf, leaveOneSeedOut, marginSides, minEffectOf, overlapOf, packLinks, pointSegmentDistance, portPoint, regionArea, ruleLevel, segmentsCross, shapeKindOf, shapeKindProblem, shapeKindsOf, shapeLevel, shapeSupportProblems, shapesOf, splitFileName, splitFolds, toPackInput, toRect, toSizedRect, translate };
1776
1776
  //# sourceMappingURL=index.d.ts.map
package/build/index.js CHANGED
@@ -187,6 +187,28 @@ function pointSegmentDistance(p, a, b) {
187
187
  const t = l2 === 0 ? 0 : Math.max(0, Math.min(1, ((p.x - a.x) * dx + (p.y - a.y) * dy) / l2));
188
188
  return Math.hypot(p.x - (a.x + t * dx), p.y - (a.y + t * dy));
189
189
  }
190
+ /**
191
+ * This function gives the index at which a point goes among the items of a list on the screen.
192
+ * The reading order is the rows from top to bottom, and each row from left to right.
193
+ * The index is that of the first item whose center comes after the point, from 0 to the number of items.
194
+ * A center within `rowTolerance` of the point on the vertical axis is in the row of the point.
195
+ * The tolerance has the units of the points: on a screen, the default 24 is 24 pixels.
196
+ *
197
+ * Give the centers in reading order and without the item that moves.
198
+ *
199
+ * @example
200
+ * ```ts
201
+ * const index = dropIndex(pointer, others.map(centerOf));
202
+ * ```
203
+ */
204
+ function dropIndex(point, centers, rowTolerance = 24) {
205
+ for (let i = 0; i < centers.length; i++) {
206
+ const c = centers[i];
207
+ if (point.y < c.y - rowTolerance) return i;
208
+ if (Math.abs(point.y - c.y) <= rowTolerance && point.x < c.x) return i;
209
+ }
210
+ return centers.length;
211
+ }
190
212
  // src/shapes.ts
191
213
  /**
192
214
  * The declared shape kinds, in their order. Only `rect` has all of its geometry.
@@ -6309,6 +6331,6 @@ const RECT_SCATTERED = /* @__PURE__ */ Object.freeze({
6309
6331
  };
6310
6332
  }
6311
6333
  });
6312
- export { BALANCE_MEASURE_SUFFIXES, BALANCE_SIDE_DEPTH, CIRCLE_SCATTERED, CORPUS_DIMENSIONS, 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, 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, countLinksThroughShapes, countObstacleHits, countOutside, countOverlaps, countPortsOffBorder, createFamilyRegistry, crossingPoint, declarationIssues, declaredClaimOf, declaredCounts, decodeOptionValue, dimensionAt, dimensionSupports, dimensionUnit, documentHash, edgeKeyStep, edgeStep, encodeOptionValue, enumerateSpace, exercised, familyKind, familyOf, fingerprintOf, fnv1a32, grow, hardRuleOf, inputShapeLevel, isShapeKind, itemShapeOf, joinConfigs, leaveOneSeedOut, levelsOf, listOptions, marginSides, minEffectOf, mulberry32, nearestGaps, optionDefaults, optionIssue, outputGridClass, outputGroups, outputHash, 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 };
6334
+ export { BALANCE_MEASURE_SUFFIXES, BALANCE_SIDE_DEPTH, CIRCLE_SCATTERED, CORPUS_DIMENSIONS, 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, 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, countLinksThroughShapes, countObstacleHits, countOutside, countOverlaps, countPortsOffBorder, createFamilyRegistry, crossingPoint, declarationIssues, declaredClaimOf, declaredCounts, decodeOptionValue, dimensionAt, dimensionSupports, dimensionUnit, documentHash, dropIndex, edgeKeyStep, edgeStep, encodeOptionValue, enumerateSpace, exercised, familyKind, familyOf, fingerprintOf, fnv1a32, grow, hardRuleOf, inputShapeLevel, isShapeKind, itemShapeOf, joinConfigs, leaveOneSeedOut, levelsOf, listOptions, marginSides, minEffectOf, mulberry32, nearestGaps, optionDefaults, optionIssue, outputGridClass, outputGroups, outputHash, 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 };
6313
6335
 
6314
6336
  //# sourceMappingURL=index.js.map