@chanmeng666/archlang-3d 0.3.0 → 0.4.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.
@@ -19,14 +19,15 @@ import {
19
19
  t0Shells,
20
20
  wallOwnership,
21
21
  where
22
- } from "./chunk-PRZXP6FP.js";
22
+ } from "./chunk-EG7UT2HG.js";
23
23
  import {
24
+ STAIR_MATERIAL,
24
25
  floorFinish
25
- } from "./chunk-VPYTRKMK.js";
26
+ } from "./chunk-EQBMPXB5.js";
26
27
 
27
28
  // src/adapter/adapt.ts
28
29
  import * as core from "@chanmeng666/archlang";
29
- var MIN_CORE = "1.45.0";
30
+ var MIN_CORE = "1.57.0";
30
31
  var hasHanded = (storeys) => storeys.some((s) => s.ir.elements.some((e) => e.kind === "furniture" && isHandedAsset(assetFor(e.category))));
31
32
  function mirroredIds(source, world, n) {
32
33
  const unknown = Array.from({ length: n }, () => null);
@@ -169,6 +170,141 @@ function slabRegion(footprint, floors, ledger) {
169
170
  }
170
171
  return out;
171
172
  }
173
+ var PROBE_MIN = 2;
174
+ var PROBE_OFF = 1;
175
+ function meets(a, b, c, d) {
176
+ const rx = b[0] - a[0];
177
+ const ry = b[1] - a[1];
178
+ const sx = d[0] - c[0];
179
+ const sy = d[1] - c[1];
180
+ const qx = c[0] - a[0];
181
+ const qy = c[1] - a[1];
182
+ const den = rx * sy - ry * sx;
183
+ if (den !== 0) {
184
+ const t = (qx * sy - qy * sx) / den;
185
+ const u = (qx * ry - qy * rx) / den;
186
+ return t >= 0 && t <= 1 && u >= 0 && u <= 1 ? [t] : [];
187
+ }
188
+ if (qx * ry - qy * rx !== 0) return [];
189
+ const rr = rx * rx + ry * ry;
190
+ return [qx * rx + qy * ry, (d[0] - a[0]) * rx + (d[1] - a[1]) * ry].map((x) => x / rr).filter((t) => t > 0 && t < 1);
191
+ }
192
+ function stretches(a, b, cutters) {
193
+ const len = Math.hypot(b[0] - a[0], b[1] - a[1]);
194
+ const ts = [0, 1, ...cutters.flatMap(([c, d]) => meets(a, b, c, d))].sort((x, y) => x - y);
195
+ const out = [];
196
+ for (let i = 1; i < ts.length; i++) {
197
+ const t0 = ts[i - 1];
198
+ const t1 = ts[i];
199
+ if ((t1 - t0) * len < PROBE_MIN) continue;
200
+ const t = (t0 + t1) / 2;
201
+ out.push([a[0] + (b[0] - a[0]) * t, a[1] + (b[1] - a[1]) * t]);
202
+ }
203
+ return out;
204
+ }
205
+ var edgesOf = (r) => r.map((p, i) => [p, r[(i + 1) % r.length]]);
206
+ function coveredBy(ring, region) {
207
+ if (region.length === 0 || ring.length < 3) return false;
208
+ const inRegion = (p) => region.some((s) => where(p, s.outer) !== false && !(s.holes ?? []).some((h) => where(p, h) === true));
209
+ const ringEdges = edgesOf(ring);
210
+ const regionEdges = region.flatMap((s) => [s.outer, ...s.holes ?? []].flatMap(edgesOf));
211
+ for (const [a, b] of ringEdges) {
212
+ if (!inRegion(a)) return false;
213
+ if (!stretches(a, b, regionEdges).every(inRegion)) return false;
214
+ }
215
+ for (const [a, b] of regionEdges) {
216
+ const len = Math.hypot(b[0] - a[0], b[1] - a[1]);
217
+ if (len === 0) continue;
218
+ const nx = -(b[1] - a[1]) / len * PROBE_OFF;
219
+ const ny = (b[0] - a[0]) / len * PROBE_OFF;
220
+ for (const m of stretches(a, b, ringEdges)) {
221
+ if (where(m, ring) !== true) continue;
222
+ if (!inRegion([m[0] + nx, m[1] + ny]) || !inRegion([m[0] - nx, m[1] - ny])) return false;
223
+ }
224
+ }
225
+ return true;
226
+ }
227
+
228
+ // src/mesh/stair.ts
229
+ function stairRisers(flights) {
230
+ return flights.reduce((n, f) => n + f.treads + 1, 0);
231
+ }
232
+ function runCoordinate(f, d) {
233
+ const [x, y] = f.at;
234
+ switch (f.foot) {
235
+ case "bottom":
236
+ return y + f.size.h - d;
237
+ case "top":
238
+ return y + d;
239
+ case "right":
240
+ return x + f.size.w - d;
241
+ case "left":
242
+ return x + d;
243
+ }
244
+ }
245
+ var alongY = (foot) => foot === "top" || foot === "bottom";
246
+ function sideways(section, c0, c1, runAlongY) {
247
+ const up = prism({ outer: section }, c0, c1);
248
+ if (!up) return null;
249
+ const positions = [];
250
+ for (let i = 0; i < up.positions.length; i += 3) {
251
+ const [u, h, v] = [up.positions[i], up.positions[i + 1], up.positions[i + 2]];
252
+ if (runAlongY) positions.push(h, v, u);
253
+ else positions.push(u, v, h);
254
+ }
255
+ const indices = [...up.indices];
256
+ if (!runAlongY) {
257
+ for (let t = 0; t < indices.length; t += 3) {
258
+ const b = indices[t + 1];
259
+ indices[t + 1] = indices[t + 2];
260
+ indices[t + 2] = b;
261
+ }
262
+ }
263
+ return { positions, indices };
264
+ }
265
+ function stairSolid(stair, z0, rise) {
266
+ const flights = stair.flights;
267
+ if (!flights?.length || !(rise > 0)) return null;
268
+ const R = stairRisers(flights);
269
+ const riserTop = (k) => z0 + Math.round(rise * k / R);
270
+ const shells = [];
271
+ const landingTops = [];
272
+ let dropped = 0;
273
+ let climbed = 0;
274
+ flights.forEach((f, i) => {
275
+ const n = f.treads;
276
+ const yRun = alongY(f.foot);
277
+ const run = yRun ? f.size.h : f.size.w;
278
+ const [lo, extent] = yRun ? [f.at[0], f.size.w] : [f.at[1], f.size.h];
279
+ const width = Math.min(stair.width, extent);
280
+ const c0 = lo + Math.round((extent - width) / 2);
281
+ const c1 = c0 + width;
282
+ const at = (t) => runCoordinate(f, Math.round(run * t / n));
283
+ const section = [[at(0), z0]];
284
+ for (let t = 0; t < n; t++) {
285
+ const h = riserTop(climbed + t + 1);
286
+ section.push([at(t), h], [at(t + 1), h]);
287
+ }
288
+ section.push([at(n), z0]);
289
+ const s = sideways(section, c0, c1, yRun);
290
+ if (s) shells.push(s);
291
+ else dropped++;
292
+ climbed += n + 1;
293
+ const landing = stair.landings?.[i];
294
+ if (landing && i < flights.length - 1) {
295
+ const top = riserTop(climbed);
296
+ landingTops.push(top);
297
+ const box = prism(
298
+ rect(landing.at[0], landing.at[1], landing.at[0] + landing.size.w, landing.at[1] + landing.size.h),
299
+ z0,
300
+ top
301
+ );
302
+ if (box) shells.push(box);
303
+ else dropped++;
304
+ }
305
+ });
306
+ return { shells, risers: R, landingTops, top: riserTop(R - 1), dropped };
307
+ }
172
308
 
173
309
  // src/mesh/build.ts
174
310
  var MM = 1e3;
@@ -214,7 +350,8 @@ var STAGE = {
214
350
  door: "openings",
215
351
  window: "openings",
216
352
  opening: "openings",
217
- furniture: "fixtures"
353
+ furniture: "fixtures",
354
+ stair: "walls"
218
355
  };
219
356
  var byText = (a, b) => a < b ? -1 : a > b ? 1 : 0;
220
357
  function along(a, b, d) {
@@ -311,7 +448,7 @@ function leafThroughWall(leaf, walls) {
311
448
  }
312
449
  return false;
313
450
  }
314
- function levelNodes(lv, ledger, defaulted, isTop, doors) {
451
+ function levelNodes(lv, ledger, defaulted, isTop, doors, below, above) {
315
452
  const e = lv.elevation;
316
453
  const out = [];
317
454
  let holesLeftOut = 0;
@@ -388,13 +525,123 @@ function levelNodes(lv, ledger, defaulted, isTop, doors) {
388
525
  }
389
526
  );
390
527
  });
528
+ const ceiling = above ? above.elevation - SLAB_MM * MM - e : 0;
529
+ const slabAbove = above && ceiling > 0 ? slabRegion(above.footprint, above.floors, []).flatMap((r) => lessVoids(r.outer, above.voids, "slab", [])) : [];
530
+ const stopped = (height, rings) => height > ceiling && ceiling > 0 && rings.every((r) => coveredBy(r, slabAbove));
531
+ const stopLedger = (kind, id) => {
532
+ ledger.push({
533
+ kind,
534
+ id,
535
+ field: `top_mm(L${lv.level})`,
536
+ value: ceiling / MM,
537
+ provenance: "derived",
538
+ rule: "stops-under-slab-above"
539
+ });
540
+ };
391
541
  lv.columns.forEach((c, i) => {
392
- node("column", c.id, i, [
393
- prism2(rect(c.at[0], c.at[1], c.at[0] + c.size.w, c.at[1] + c.size.h), e, e + lv.storeyHeight)
394
- ]);
542
+ const box = rect(c.at[0], c.at[1], c.at[0] + c.size.w, c.at[1] + c.size.h);
543
+ const stop = stopped(lv.storeyHeight, [box.outer]);
544
+ if (stop) stopLedger("column", c.id);
545
+ node("column", c.id, i, [prism2(box, e, e + (stop ? ceiling : lv.storeyHeight))]);
546
+ });
547
+ const climbs = [];
548
+ lv.stairs.forEach((s, i) => {
549
+ if (s.dir === "up") {
550
+ climbs.push({ s, order: i, rise: above ? above.elevation - e : lv.storeyHeight, from: "own" });
551
+ if (!above) {
552
+ ledger.push({
553
+ kind: "stair",
554
+ id: s.id,
555
+ field: "rise_mm",
556
+ value: lv.storeyHeight / MM,
557
+ provenance: "default",
558
+ rule: "stair-rise-storey-height"
559
+ });
560
+ }
561
+ } else if (!below) {
562
+ ledger.push({
563
+ kind: "stair",
564
+ id: s.id,
565
+ field: "geometry",
566
+ value: "omitted",
567
+ provenance: "default",
568
+ rule: "stair-down-no-storey-below"
569
+ });
570
+ }
571
+ });
572
+ (above?.stairs ?? []).forEach((s, i) => {
573
+ const partnered = lv.stairs.some((t) => t.id === s.id && t.dir === "up");
574
+ if (s.dir === "down" && !partnered && above)
575
+ climbs.push({ s, order: lv.stairs.length + i, rise: above.elevation - e, from: "above" });
395
576
  });
577
+ const stairFloor = e + FLOOR_FINISH_MM * MM;
578
+ for (const { s, order, rise, from } of climbs) {
579
+ const solid = stairSolid(s, stairFloor, rise);
580
+ if (!solid) {
581
+ ledger.push({
582
+ kind: "stair",
583
+ id: s.id,
584
+ field: "geometry",
585
+ value: "omitted",
586
+ provenance: "default",
587
+ rule: s.flights?.length ? "stair-rise-not-positive" : "stair-no-flights"
588
+ });
589
+ continue;
590
+ }
591
+ if (!defaulted.has("stair:defaults")) {
592
+ defaulted.add("stair:defaults");
593
+ ledger.push(
594
+ {
595
+ kind: "stair",
596
+ field: "material",
597
+ value: STAIR_MATERIAL,
598
+ provenance: "default",
599
+ rule: "stair-material-default"
600
+ },
601
+ { kind: "stair", field: "form", value: "solid", provenance: "default", rule: "stair-solid-default" }
602
+ );
603
+ }
604
+ ledger.push({
605
+ kind: "stair",
606
+ id: s.id,
607
+ field: "risers",
608
+ value: solid.risers,
609
+ provenance: "derived",
610
+ rule: "stair-risers-from-treads"
611
+ });
612
+ node("stair", s.id, order, [...solid.shells, ...Array.from({ length: solid.dropped }, () => null)], {
613
+ dir: s.dir,
614
+ width_mm: s.width / MM,
615
+ flights: s.flights?.length ?? 0,
616
+ risers: solid.risers,
617
+ rise_mm: rise / MM,
618
+ ...from === "above" ? { from_storey_above: true } : {}
619
+ });
620
+ }
396
621
  const openings = new Map(lv.openings.map((o) => [o.id, o]));
397
- const hostHeight = new Map(lv.walls.map((w) => [w.id, w.height]));
622
+ const wallHeight = new Map(
623
+ lv.walls.map((w) => {
624
+ const cut = w.cuts.flatMap((id) => {
625
+ const o = openings.get(id);
626
+ return o ? [o] : [];
627
+ });
628
+ const stop = stopped(w.height, [...w.body.map((p) => p.outer), ...cut.map((o) => o.cut)]);
629
+ if (!stop) return [w.id, w.height];
630
+ stopLedger("wall", w.id);
631
+ for (const o of cut.filter((x) => x.head > ceiling)) {
632
+ ledger.push({
633
+ kind: o.kind,
634
+ id: o.id,
635
+ field: `head_mm(L${lv.level})`,
636
+ value: ceiling / MM,
637
+ provenance: "derived",
638
+ rule: "head-at-slab-above"
639
+ });
640
+ }
641
+ return [w.id, ceiling];
642
+ })
643
+ );
644
+ const hostHeight = wallHeight;
398
645
  const splitAt = /* @__PURE__ */ new Map();
399
646
  for (const o of lv.openings) {
400
647
  const h = hostHeight.get(o.host);
@@ -407,13 +654,14 @@ function levelNodes(lv, ledger, defaulted, isTop, doors) {
407
654
  }
408
655
  const splits = (p) => (splitAt.get(`${p[0]},${p[1]}`) ?? []).map((h) => e + h);
409
656
  lv.walls.forEach((w, i) => {
410
- const top = e + w.height;
657
+ const height = wallHeight.get(w.id) ?? w.height;
658
+ const top = e + height;
411
659
  const shells = w.body.map((p) => prism2(p, e, top, splits));
412
660
  for (const id of w.cuts) {
413
661
  const o = openings.get(id);
414
662
  if (!o) continue;
415
- if (o.sill > 0) shells.push(prism2({ outer: o.cut }, e, e + Math.min(o.sill, w.height)));
416
- if (o.head < w.height) shells.push(prism2({ outer: o.cut }, e + o.head, top));
663
+ if (o.sill > 0) shells.push(prism2({ outer: o.cut }, e, e + Math.min(o.sill, height)));
664
+ if (o.head < height) shells.push(prism2({ outer: o.cut }, e + o.head, top));
417
665
  }
418
666
  node("wall", w.id, i, shells, {
419
667
  ...w.category ? { category: w.category } : {},
@@ -531,6 +779,7 @@ function levelNodes(lv, ledger, defaulted, isTop, doors) {
531
779
  });
532
780
  const floorTop = e + FLOOR_FINISH_MM * MM;
533
781
  const tallest = lv.walls.reduce((m, w) => Math.max(m, w.height), 0) || lv.storeyHeight;
782
+ const tallestBuilt = lv.walls.reduce((m, w) => Math.max(m, wallHeight.get(w.id) ?? w.height), 0) || lv.storeyHeight;
534
783
  lv.furniture.forEach((f, i) => {
535
784
  const parts = t0Shells(f, floorTop);
536
785
  const family = parts ? f.asset.slice("t0:".length) : void 0;
@@ -588,7 +837,7 @@ function levelNodes(lv, ledger, defaulted, isTop, doors) {
588
837
  rule: "furniture-mount-from-top"
589
838
  });
590
839
  }
591
- if (floorTop + h * MM > e + tallest) {
840
+ if (floorTop + h * MM > e + tallestBuilt) {
592
841
  ledger.push({
593
842
  kind: "furniture",
594
843
  id: f.id,
@@ -598,7 +847,7 @@ function levelNodes(lv, ledger, defaulted, isTop, doors) {
598
847
  rule: "furniture-hung-above-walls"
599
848
  });
600
849
  }
601
- } else if (parts && family && floorTop + h * MM > e + tallest) {
850
+ } else if (parts && family && floorTop + h * MM > e + tallestBuilt) {
602
851
  ledger.push({
603
852
  kind: "furniture",
604
853
  id: f.id,
@@ -665,17 +914,22 @@ function buildMesh(scene, opts = {}) {
665
914
  },
666
915
  { kind: "door", field: "leaf_mm", value: LEAF_MM, provenance: "default", rule: "door-leaf-40" },
667
916
  { kind: "roof", field: "thickness_mm", value: ROOF_MM, provenance: "default", rule: "roof-flat-150" },
668
- {
669
- kind: "stair",
670
- field: "geometry",
671
- value: "omitted",
672
- provenance: "default",
673
- rule: "m1-omits-stairs-outdoor-fences"
674
- }
917
+ // Narrowed by card X3 (was `m1-omits-stairs-outdoor-fences`, kind `stair`): stairs are built.
918
+ ...["outdoor", "fence"].map(
919
+ (kind) => ({
920
+ kind,
921
+ field: "geometry",
922
+ value: "omitted",
923
+ provenance: "default",
924
+ rule: "m1-omits-outdoor-fences"
925
+ })
926
+ )
675
927
  ];
676
928
  const defaulted = /* @__PURE__ */ new Set();
677
929
  const top = scene.levels.length - 1;
678
- const nodes = scene.levels.flatMap((lv, i) => levelNodes(lv, ledger, defaulted, i === top, doors));
930
+ const nodes = scene.levels.flatMap(
931
+ (lv, i) => levelNodes(lv, ledger, defaulted, i === top, doors, scene.levels[i - 1], scene.levels[i + 1])
932
+ );
679
933
  nodes.sort(
680
934
  (a, b) => a.level - b.level || byText(a.kind, b.kind) || byText(a.id, b.id) || byText(a.part ?? "", b.part ?? "")
681
935
  );
@@ -687,6 +941,8 @@ export {
687
941
  adaptPlan,
688
942
  rectsOf,
689
943
  slabRegion,
944
+ stairRisers,
945
+ stairSolid,
690
946
  FURNITURE_HEIGHT_MM,
691
947
  DOOR_POSES,
692
948
  openLeaf,
package/dist/cli.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  DOOR_POSES,
4
4
  adaptPlan,
5
5
  buildMesh
6
- } from "./chunk-QUSG4UCO.js";
6
+ } from "./chunk-VS4OAVPD.js";
7
7
  import {
8
8
  SWIFTSHADER_ARGS,
9
9
  checkGlb,
@@ -13,18 +13,18 @@ import {
13
13
  renderReplay,
14
14
  replayHtml,
15
15
  writeGlb
16
- } from "./chunk-ZE4PL6KP.js";
16
+ } from "./chunk-RPGAMA3G.js";
17
17
  import {
18
18
  ARCHLANG_3D_VERSION,
19
19
  replayFacts
20
- } from "./chunk-PRZXP6FP.js";
21
- import "./chunk-WBA4LABI.js";
20
+ } from "./chunk-EG7UT2HG.js";
21
+ import "./chunk-KF5ME6KH.js";
22
22
  import {
23
23
  storeysOf,
24
24
  timeline,
25
25
  viewLabel,
26
26
  viewMesh
27
- } from "./chunk-VPYTRKMK.js";
27
+ } from "./chunk-EQBMPXB5.js";
28
28
 
29
29
  // src/cli/run.ts
30
30
  import { readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "node:fs";
@@ -270,7 +270,7 @@ function sceneFacts(scene, mesh) {
270
270
  window: ids("window"),
271
271
  furniture: ids("furniture"),
272
272
  column: ids("column"),
273
- stair: 0
273
+ stair: ids("stair")
274
274
  }
275
275
  };
276
276
  });
@@ -1,5 +1,5 @@
1
1
  import { World } from '@chanmeng666/archlang';
2
- import { y as ReplayView, R as ReplayFacts } from './strip-CN_dTKqy.js';
2
+ import { B as ReplayView, R as ReplayFacts } from './strip-Nt7eJ-4E.js';
3
3
 
4
4
  /**
5
5
  * The metrics strip's numbers (card G4), read from the core's public `describe()` and `lint()` for
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { ResolvedPlan, RWall, Point, JoinedCut, loopsToPolygons, World, Diagnostic } from '@chanmeng666/archlang';
2
2
  export { Point } from '@chanmeng666/archlang';
3
- import { a as Scene3D, F as Floor, P as Polygon, M as Mesh3D, b as Pt, c as Shell, d as Ring3, A as Assumption, e as MaterialSlot, f as Furniture } from './strip-CN_dTKqy.js';
4
- export { D as DoorKind, E as EXPLODE_GAP_MM, g as FINISH_PALETTE, h as FIXTURE_FAMILIES, i as FLOOR_FINISHES, j as FLOOR_FINISH_RULES, k as Fence, l as FloorFinish, K as KIND_PALETTE, m as KindMaterial, L as Level, n as MATERIAL_SLOTS, o as MeshNode, p as Meta, N as NodeKind, q as NodeState, O as Opening, r as Outdoor, t as PALETTE, u as PHASE, v as Provenance, w as ReplayEvent, R as ReplayFacts, x as ReplayState, y as ReplayView, z as Roof, B as STOP_LEAD, C as SlotMaterial, G as Source, H as Stage, I as Stair, S as StripItem, U as Um, W as WALL_CAP_SRGB, J as Wall, Q as authoringOrder, T as ease, V as explodeLifts, X as finishColour, Y as floorFinish, Z as keyFrames, _ as linearRgb, $ as slotColour, a0 as slotGroups, a1 as stateAt, a2 as storeysOf, s as stripAt, a3 as timeline, a4 as viewLabel, a5 as viewMesh } from './strip-CN_dTKqy.js';
5
- export { F as FactsOptions, r as replayFacts } from './facts-B47HOKOh.js';
6
- export { B as Box, E as ELEVATION_AZIMUTH, a as ELEVATION_RANGE, b as END_AZIMUTH, c as END_FOV, d as EndCamera, F as FILL, e as FrameCamera, O as Orbit, f as PRESET_NAMES, P as PresetName, S as START_FOV, V as Vec3, g as ViewScene, Z as ZOOM, h as boxOfNodes, i as cameraAtStop, j as cameraStops, k as corners, l as coverage, m as distanceLimits, n as drawingFrame, o as endElevation, p as fitEndCamera, q as frameCamera, r as pivotAbove, s as presetCamera, t as projectBox, u as takenLens, v as targetBounds } from './camera-CLNYQ1Xv.js';
3
+ import { a as Scene3D, F as Floor, P as Polygon, M as Mesh3D, b as Pt, c as Shell, d as Ring3, A as Assumption, e as StairFlight, f as Stair, g as MaterialSlot, h as Furniture } from './strip-Nt7eJ-4E.js';
4
+ export { D as DoorKind, E as EXPLODE_GAP_MM, i as FINISH_PALETTE, j as FIXTURE_FAMILIES, k as FLOOR_FINISHES, l as FLOOR_FINISH_RULES, m as Fence, n as FloorFinish, K as KIND_PALETTE, o as KindMaterial, L as Level, p as MATERIAL_SLOTS, q as MeshNode, r as Meta, N as NodeKind, t as NodeState, O as Opening, u as Outdoor, v as PALETTE, w as PHASE, x as Provenance, y as ReplayEvent, R as ReplayFacts, z as ReplayState, B as ReplayView, C as Roof, G as STAIR_MATERIAL, H as STOP_LEAD, I as Side, J as SlotMaterial, Q as Source, T as Stage, U as StairLanding, S as StripItem, V as Um, W as WALL_CAP_SRGB, X as Wall, Y as authoringOrder, Z as ease, _ as explodeLifts, $ as finishColour, a0 as floorFinish, a1 as keyFrames, a2 as linearRgb, a3 as slotColour, a4 as slotGroups, a5 as stateAt, a6 as storeysOf, s as stripAt, a7 as timeline, a8 as viewLabel, a9 as viewMesh } from './strip-Nt7eJ-4E.js';
5
+ export { F as FactsOptions, r as replayFacts } from './facts-BRIFxHL_.js';
6
+ export { B as Box, E as ELEVATION_AZIMUTH, a as ELEVATION_RANGE, b as END_AZIMUTH, c as END_FOV, d as EndCamera, F as FILL, e as FrameCamera, O as Orbit, f as PRESET_NAMES, P as PresetName, S as START_FOV, V as Vec3, g as ViewScene, Z as ZOOM, h as boxOfNodes, i as cameraAtStop, j as cameraStops, k as corners, l as coverage, m as distanceLimits, n as drawingFrame, o as endElevation, p as fitEndCamera, q as frameCamera, r as pivotAbove, s as presetCamera, t as projectBox, u as settledLift, v as stopCount, w as takenLens, x as targetBounds } from './camera-DVOiag0F.js';
7
7
 
8
8
  /** The package's own version, stamped into `meta.tool`. */
9
9
  declare const ARCHLANG_3D_VERSION: string;
@@ -146,10 +146,13 @@ interface AdaptOptions {
146
146
  }
147
147
  /**
148
148
  * The first core release that carries every export this package reads: the seam (`resolvePlan`,
149
- * ADR 0031) arrived in 1.44.0, `hatchKey`/`hatchOf` (card A0b) in 1.45.0. Kept equal to the
149
+ * ADR 0031) arrived in 1.44.0, `hatchKey`/`hatchOf` (card A0b) in 1.45.0, `treadCount` (the
150
+ * stairs, amendment 2026-11-06 to ADR 0031) in 1.57.0. An older core still builds everything but
151
+ * the stairs (`stair-no-flights`); only a core without `resolvePlan` or `hatchKey` is refused,
152
+ * `E3D_CORE_TOO_OLD`. Kept equal to the
150
153
  * `peerDependencies` floor (`test/package-meta.test.ts`).
151
154
  */
152
- declare const MIN_CORE = "1.45.0";
155
+ declare const MIN_CORE = "1.57.0";
153
156
  declare function adaptPlan(source: string, opts?: AdaptOptions): AdaptResult;
154
157
 
155
158
  /**
@@ -288,6 +291,42 @@ declare function rectsOf(r: readonly Pt[]): Rect[];
288
291
  */
289
292
  declare function slabRegion(footprint: readonly Ring3[], floors: readonly Floor[], ledger: Assumption[]): Polygon[];
290
293
 
294
+ /**
295
+ * A stair as stepped solids (card X3), from the Scene3D's flights and landings, which are the
296
+ * core's own (`scene3d/build.ts`): nothing here re-derives a stair from its bounding box.
297
+ *
298
+ * - Risers: one per tread the plan draws on a flight, plus one more at its head, because a flight's
299
+ * last riser lands on the landing or the floor above. So a stair of flights with `n₁ … n_F` treads
300
+ * climbs its rise in `R = Σ (nᵢ + 1)` equal risers, and riser `k` tops out at `z0 + round(rise·k/R)`
301
+ * (whole micrometres; the last is exactly `z0 + rise`, the floor above).
302
+ * - A flight: one closed prism whose side section is its steps, extruded across the flight band
303
+ * (the stair's `width`, centred across the flight, as the drawing centres it), each tread
304
+ * `run / treads` deep, on the drawing's tread lines. It is solid down to the stair's floor `z0`.
305
+ * - A landing: a closed box over its rectangle, from `z0` up to the riser its flight ends on.
306
+ *
307
+ * Every shell is closed and wound outward (`prism`), in integer micrometres and glTF axes.
308
+ */
309
+
310
+ /** How many risers a stair of these flights climbs: each flight's treads plus its head riser. */
311
+ declare function stairRisers(flights: readonly Pick<StairFlight, "treads">[]): number;
312
+ /** A stair's solids, how many risers it climbs, and the height each landing stands at. */
313
+ interface StairSolid {
314
+ shells: Shell[];
315
+ risers: number;
316
+ /** The top of each landing (µm), in climbing order. */
317
+ landingTops: number[];
318
+ /** The top of the highest tread (µm): one riser below `z0 + rise`. */
319
+ top: number;
320
+ }
321
+ /**
322
+ * The stepped solids of `stair` climbing `rise` µm from `z0`, or `null` when it carries no flights
323
+ * (a Scene3D the core gave no tread count) or `rise` is not positive. A shell that would be
324
+ * degenerate is left out and counted in `dropped`.
325
+ */
326
+ declare function stairSolid(stair: Stair, z0: number, rise: number): (StairSolid & {
327
+ dropped: number;
328
+ }) | null;
329
+
291
330
  /**
292
331
  * The T0 kit (visual-assets V2, V5, V6): the part type every generator returns and the few helpers
293
332
  * the generators share, kept apart from `t0.ts` so the batch modules (`t0-living.ts`,
@@ -457,4 +496,4 @@ declare function t0Shells(f: Furniture, floor: number): {
457
496
  holesDropped: number;
458
497
  } | null;
459
498
 
460
- export { ARCHLANG_3D_VERSION, type AdaptOptions, type AdaptResult, Assumption, type BuildOptions, type CutSector, DOOR_POSES, type DoorPose, FLOOR_LIFT_UM, FLOOR_OVERLAP_MIN_UM2, FURNITURE_HEIGHT_MM, Floor, type FloorOverlap, Furniture, MIN_CORE, MaterialSlot, Mesh3D, type MeshOptions, type MixedHeightJoint, type OwnedWall, type Ownership, type Part, type Piece, Polygon, Pt, type Refusal, type RefusalCode, type Ring, Ring3, Scene3D, type SectionShape, Shell, type Storey, T0_FAMILIES, T0_HANDED, T0_HEIGHT_MM, T0_HUNG_FROM_TOP, T0_MATERIALS, T0_MOUNT_MM, type ValidationIssue, type Warning3D, adaptPlan, assetFor, buildMesh, buildScene3D, clipToConvex, cutSector, floorLifts, floorOverlaps, handedAt, insideCut, mixedHeightJoints, openLeaf, overlapArea, partShell, piecesOf, piecesTouch, prism, rectsOf, sectionRing, sectorBand, slab2d, slabRegion, t0LocalParts, t0Shells, um, umPoint, validateScene3D, wallOwnership };
499
+ export { ARCHLANG_3D_VERSION, type AdaptOptions, type AdaptResult, Assumption, type BuildOptions, type CutSector, DOOR_POSES, type DoorPose, FLOOR_LIFT_UM, FLOOR_OVERLAP_MIN_UM2, FURNITURE_HEIGHT_MM, Floor, type FloorOverlap, Furniture, MIN_CORE, MaterialSlot, Mesh3D, type MeshOptions, type MixedHeightJoint, type OwnedWall, type Ownership, type Part, type Piece, Polygon, Pt, type Refusal, type RefusalCode, type Ring, Ring3, Scene3D, type SectionShape, Shell, Stair, StairFlight, type StairSolid, type Storey, T0_FAMILIES, T0_HANDED, T0_HEIGHT_MM, T0_HUNG_FROM_TOP, T0_MATERIALS, T0_MOUNT_MM, type ValidationIssue, type Warning3D, adaptPlan, assetFor, buildMesh, buildScene3D, clipToConvex, cutSector, floorLifts, floorOverlaps, handedAt, insideCut, mixedHeightJoints, openLeaf, overlapArea, partShell, piecesOf, piecesTouch, prism, rectsOf, sectionRing, sectorBand, slab2d, slabRegion, stairRisers, stairSolid, t0LocalParts, t0Shells, um, umPoint, validateScene3D, wallOwnership };
package/dist/index.js CHANGED
@@ -6,8 +6,10 @@ import {
6
6
  buildMesh,
7
7
  openLeaf,
8
8
  rectsOf,
9
- slabRegion
10
- } from "./chunk-QUSG4UCO.js";
9
+ slabRegion,
10
+ stairRisers,
11
+ stairSolid
12
+ } from "./chunk-VS4OAVPD.js";
11
13
  import {
12
14
  ARCHLANG_3D_VERSION,
13
15
  FLOOR_LIFT_UM,
@@ -42,7 +44,7 @@ import {
42
44
  umPoint,
43
45
  validateScene3D,
44
46
  wallOwnership
45
- } from "./chunk-PRZXP6FP.js";
47
+ } from "./chunk-EG7UT2HG.js";
46
48
  import {
47
49
  ELEVATION_AZIMUTH,
48
50
  ELEVATION_RANGE,
@@ -59,6 +61,7 @@ import {
59
61
  PALETTE,
60
62
  PHASE,
61
63
  PRESET_NAMES,
64
+ STAIR_MATERIAL,
62
65
  START_FOV,
63
66
  STOP_LEAD,
64
67
  WALL_CAP_SRGB,
@@ -83,9 +86,11 @@ import {
83
86
  pivotAbove,
84
87
  presetCamera,
85
88
  projectBox,
89
+ settledLift,
86
90
  slotColour,
87
91
  slotGroups,
88
92
  stateAt,
93
+ stopCount,
89
94
  storeysOf,
90
95
  stripAt,
91
96
  takenLens,
@@ -93,7 +98,7 @@ import {
93
98
  timeline,
94
99
  viewLabel,
95
100
  viewMesh
96
- } from "./chunk-VPYTRKMK.js";
101
+ } from "./chunk-EQBMPXB5.js";
97
102
  export {
98
103
  ARCHLANG_3D_VERSION,
99
104
  DOOR_POSES,
@@ -116,6 +121,7 @@ export {
116
121
  PALETTE,
117
122
  PHASE,
118
123
  PRESET_NAMES,
124
+ STAIR_MATERIAL,
119
125
  START_FOV,
120
126
  STOP_LEAD,
121
127
  T0_FAMILIES,
@@ -167,11 +173,15 @@ export {
167
173
  replayFacts,
168
174
  sectionRing,
169
175
  sectorBand,
176
+ settledLift,
170
177
  slab2d,
171
178
  slabRegion,
172
179
  slotColour,
173
180
  slotGroups,
181
+ stairRisers,
182
+ stairSolid,
174
183
  stateAt,
184
+ stopCount,
175
185
  storeysOf,
176
186
  stripAt,
177
187
  t0LocalParts,
package/dist/node.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { World } from '@chanmeng666/archlang';
2
- import { M as Mesh3D, w as ReplayEvent, o as MeshNode, a as Scene3D, c as Shell } from './strip-CN_dTKqy.js';
3
- export { R as ReplayFacts, S as StripItem, s as stripAt } from './strip-CN_dTKqy.js';
2
+ import { M as Mesh3D, y as ReplayEvent, q as MeshNode, a as Scene3D, c as Shell } from './strip-Nt7eJ-4E.js';
3
+ export { R as ReplayFacts, S as StripItem, s as stripAt } from './strip-Nt7eJ-4E.js';
4
4
  import { ReplayOptions } from './replay.js';
5
- export { PREVIEW_LABEL, replayPayload, viewBoxOf } from './replay.js';
6
- export { F as FactsOptions, r as replayFacts } from './facts-B47HOKOh.js';
5
+ export { PREVIEW_ABOUT_URL, PREVIEW_LABEL, PREVIEW_LEAD, PREVIEW_LIMITS, replayPayload, viewBoxOf } from './replay.js';
6
+ export { F as FactsOptions, r as replayFacts } from './facts-BRIFxHL_.js';
7
7
 
8
8
  /** The viewer and the parts of three.js it uses, as one minified browser script (read once). */
9
9
  declare function viewerScript(): Promise<string>;
@@ -48,6 +48,8 @@ interface VideoOptions {
48
48
  /** Where to write the MP4; omit to measure the key frames only. */
49
49
  mp4?: string;
50
50
  ffmpeg?: string;
51
+ /** libx264's constant rate factor for the MP4 (default 18; 0 is lossless: a master to re-encode). */
52
+ crf?: number;
51
53
  }
52
54
  /** Render key frames (and, given `mp4`, every frame) of a replay HTML in headless Chromium. */
53
55
  declare function renderReplay(o: VideoOptions): Promise<VideoReport>;
package/dist/node.js CHANGED
@@ -20,21 +20,27 @@ import {
20
20
  signedVolume,
21
21
  viewerScript,
22
22
  writeGlb
23
- } from "./chunk-ZE4PL6KP.js";
23
+ } from "./chunk-RPGAMA3G.js";
24
24
  import {
25
25
  replayFacts
26
- } from "./chunk-PRZXP6FP.js";
26
+ } from "./chunk-EG7UT2HG.js";
27
27
  import {
28
+ PREVIEW_ABOUT_URL,
28
29
  PREVIEW_LABEL,
30
+ PREVIEW_LEAD,
31
+ PREVIEW_LIMITS,
29
32
  replayPayload,
30
33
  viewBoxOf
31
- } from "./chunk-WBA4LABI.js";
34
+ } from "./chunk-KF5ME6KH.js";
32
35
  import {
33
36
  stripAt
34
- } from "./chunk-VPYTRKMK.js";
37
+ } from "./chunk-EQBMPXB5.js";
35
38
  export {
36
39
  GLB_GENERATOR,
40
+ PREVIEW_ABOUT_URL,
37
41
  PREVIEW_LABEL,
42
+ PREVIEW_LEAD,
43
+ PREVIEW_LIMITS,
38
44
  SWIFTSHADER_ARGS,
39
45
  bodyMaterialName,
40
46
  checkGlb,