@willcgage/module-schematic 0.105.0 → 0.106.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
@@ -3009,8 +3009,9 @@ interface TurnoutIdentity {
3009
3009
  statedPartId?: string | null;
3010
3010
  /** The part this turnout converts to; null = the owner has to say. */
3011
3011
  partId: string | null;
3012
- /** How `partId` was arrived at. */
3013
- from: "named" | "frog-number" | "unresolved";
3012
+ /** How `partId` was arrived at. `assembly` = this is a crossover's own
3013
+ * point-set, and the crossover product answers for it. */
3014
+ from: "named" | "frog-number" | "unresolved" | "assembly";
3014
3015
  /**
3015
3016
  * The weakest provenance behind the chosen part's geometry, so a caller can
3016
3017
  * tell a turnout placed from real readings from one placed off a catalogue
package/dist/index.d.ts CHANGED
@@ -3009,8 +3009,9 @@ interface TurnoutIdentity {
3009
3009
  statedPartId?: string | null;
3010
3010
  /** The part this turnout converts to; null = the owner has to say. */
3011
3011
  partId: string | null;
3012
- /** How `partId` was arrived at. */
3013
- from: "named" | "frog-number" | "unresolved";
3012
+ /** How `partId` was arrived at. `assembly` = this is a crossover's own
3013
+ * point-set, and the crossover product answers for it. */
3014
+ from: "named" | "frog-number" | "unresolved" | "assembly";
3014
3015
  /**
3015
3016
  * The weakest provenance behind the chosen part's geometry, so a caller can
3016
3017
  * tell a turnout placed from real readings from one placed off a catalogue
package/dist/index.js CHANGED
@@ -3180,7 +3180,29 @@ function moduleConversionReport(doc, library = BUILT_IN_TRACK_PARTS) {
3180
3180
  const straight = placeableTurnoutParts(library, ["turnout"]);
3181
3181
  const curved = placeableTurnoutParts(library, ["curved-turnout"]);
3182
3182
  const blockers = [];
3183
+ const assemblyPart = /* @__PURE__ */ new Map();
3184
+ for (const t of doc.tracks ?? []) {
3185
+ if (t.role !== "crossover" || !t.crossoverPartId) continue;
3186
+ const part = library.find((p) => p.id === t.crossoverPartId);
3187
+ if (!part || part.kind !== "crossover" || partGeometryGap(part)) continue;
3188
+ for (const sw of doc.turnouts ?? [])
3189
+ if (sw.divergeTrack === t.id) assemblyPart.set(sw.id, part);
3190
+ }
3183
3191
  const turnouts = (doc.turnouts ?? []).map((t) => {
3192
+ const asm = assemblyPart.get(t.id);
3193
+ if (asm)
3194
+ return {
3195
+ id: t.id,
3196
+ name: t.name,
3197
+ pos: t.pos,
3198
+ size: t.size,
3199
+ statedPartId: t.partId,
3200
+ partId: asm.id,
3201
+ from: "assembly",
3202
+ source: partGeometry(asm, library)?.source ?? null,
3203
+ why: null,
3204
+ candidates: []
3205
+ };
3184
3206
  const wantCurved = t.curved === true;
3185
3207
  const pool = wantCurved ? curved : straight;
3186
3208
  const base = {