@willcgage/module-schematic 0.21.0 → 0.23.0

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/dist/index.d.cts CHANGED
@@ -211,6 +211,10 @@ interface ModuleSchematicDoc {
211
211
  * +y up). Stored as an open ring; renderers close it. Absent = derive an
212
212
  * approximate band from the endplate widths. */
213
213
  outline?: BenchworkPoint[];
214
+ /** Internal section joints — inches from endplate A where the module's boards
215
+ * split into sections. Operationally one unit; these mark construction/transport
216
+ * seams (exempt from the end-interface standards). Empty/absent = one section. */
217
+ sectionBreaks?: number[];
214
218
  /** @deprecated pre-grouping flat signals; read for back-compat. */
215
219
  signals?: SchematicSignal[];
216
220
  /** Authored mainline centre-line (module-local inches, open path with arcs).
@@ -438,6 +442,9 @@ interface EditorState {
438
442
  * (endplate A's track point at the origin, mainline +x, perpendicular +y up).
439
443
  * Empty = no authored outline (fall back to the endplate-width band). */
440
444
  outline: BenchworkPoint[];
445
+ /** Internal section joints — inches from endplate A where the boards split
446
+ * into sections. Empty = a single section (#48). */
447
+ sectionBreaks: number[];
441
448
  controlPoints: EditorControlPoint[];
442
449
  /** Rail-served industries — car-spot spans on a track (#industries). */
443
450
  industries: EditorIndustry[];
package/dist/index.d.ts CHANGED
@@ -211,6 +211,10 @@ interface ModuleSchematicDoc {
211
211
  * +y up). Stored as an open ring; renderers close it. Absent = derive an
212
212
  * approximate band from the endplate widths. */
213
213
  outline?: BenchworkPoint[];
214
+ /** Internal section joints — inches from endplate A where the module's boards
215
+ * split into sections. Operationally one unit; these mark construction/transport
216
+ * seams (exempt from the end-interface standards). Empty/absent = one section. */
217
+ sectionBreaks?: number[];
214
218
  /** @deprecated pre-grouping flat signals; read for back-compat. */
215
219
  signals?: SchematicSignal[];
216
220
  /** Authored mainline centre-line (module-local inches, open path with arcs).
@@ -438,6 +442,9 @@ interface EditorState {
438
442
  * (endplate A's track point at the origin, mainline +x, perpendicular +y up).
439
443
  * Empty = no authored outline (fall back to the endplate-width band). */
440
444
  outline: BenchworkPoint[];
445
+ /** Internal section joints — inches from endplate A where the boards split
446
+ * into sections. Empty = a single section (#48). */
447
+ sectionBreaks: number[];
441
448
  controlPoints: EditorControlPoint[];
442
449
  /** Rail-served industries — car-spot spans on a track (#industries). */
443
450
  industries: EditorIndustry[];
package/dist/index.js CHANGED
@@ -106,6 +106,7 @@ var DEG_FP = Math.PI / 180;
106
106
  function moduleCenterline(input) {
107
107
  const drawn = trackPath(input.mainPath);
108
108
  if (drawn) return samplePath(drawn);
109
+ if (!input.geometryType) return [];
109
110
  const L = input.lengthInches > 0 ? input.lengthInches : 24;
110
111
  const gt = input.geometryType;
111
112
  if (gt === "dead_end") return [{ x: 0, y: 0 }];
@@ -214,6 +215,7 @@ function emptyEditorState(lengthInches) {
214
215
  poseOverrides: {},
215
216
  endplateWidths: {},
216
217
  outline: [],
218
+ sectionBreaks: [],
217
219
  controlPoints: [],
218
220
  industries: [],
219
221
  mainPath: []
@@ -407,6 +409,8 @@ function stateToDoc(state, recordNumber) {
407
409
  // Benchwork footprint outline (module-local inches); only when it's a real
408
410
  // ring (≥ 3 vertices).
409
411
  ...state.outline.length >= 3 ? { outline: state.outline } : {},
412
+ // Internal section joints (inches from A), when the module has more than one.
413
+ ...state.sectionBreaks.length ? { sectionBreaks: state.sectionBreaks } : {},
410
414
  // Authored mainline path (module-local inches); only when it's a real path.
411
415
  ...state.mainPath.length >= 2 ? { mainPath: state.mainPath } : {}
412
416
  };
@@ -506,6 +510,7 @@ function docToState(doc, fallbackLength, moduleTracks = []) {
506
510
  poseOverrides,
507
511
  endplateWidths,
508
512
  outline,
513
+ sectionBreaks: (d.sectionBreaks ?? []).filter((n) => Number.isFinite(n)).map((n) => sc(n)),
509
514
  mainPath,
510
515
  crossings: (d.crossings ?? []).map((x) => ({
511
516
  id: x.id,