@chanmeng666/archlang-3d 0.7.0 → 0.8.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.
@@ -1,11 +1,13 @@
1
1
  import {
2
+ CONTACT_SHADOW,
2
3
  FLOOR_FINISHES,
4
+ contactBandMm,
3
5
  endElevation,
4
6
  explodeLifts,
5
7
  slotGroups,
6
8
  storeysOf,
7
9
  timeline
8
- } from "./chunk-TI4RYEOL.js";
10
+ } from "./chunk-LNIVDMPG.js";
9
11
 
10
12
  // src/replay/view-dom.ts
11
13
  var PRESET_LABELS = [
@@ -131,8 +133,11 @@ function viewToolbar(view, opts = {}) {
131
133
  // src/replay/payload.ts
132
134
  var PREVIEW_LEAD = "Same source, plan and 3D preview.";
133
135
  var PREVIEW_LABEL = "Same source, plan and 3D preview. The 3D preview is extruded from the same .arch file by the separate archlang-3d package, and checked against the plan: every 3D element comes from the plan's elements, and every solid is closed.";
134
- var PREVIEW_LIMITS = "3D preview: walls, openings, floors, stairs, furniture, outdoor surfaces and fences in flat colours; the ground is a backdrop the viewer draws, not part of the building and not in the file; no pitched roofs or balcony railings yet, and no sections, elevations or BIM.";
136
+ var PREVIEW_LIMITS = "3D preview: walls, openings, floors, stairs, furniture, outdoor surfaces and fences in plain colours; the ground and the soft contact shadows are the viewer's, not part of the building and not in the file; no pitched roofs or balcony railings yet, and no sections, elevations or BIM.";
135
137
  var PREVIEW_ABOUT_URL = "https://archlang.uk/3d";
138
+ function noticeLevelLabel(level) {
139
+ return `L${level} \xB7`;
140
+ }
136
141
  function viewBoxOf(svg) {
137
142
  const m = /viewBox="([-\d.\s]+)"/.exec(svg);
138
143
  const v = (m?.[1] ?? "").trim().split(/\s+/).map(Number);
@@ -141,6 +146,7 @@ function viewBoxOf(svg) {
141
146
  }
142
147
  function replayPayload(mesh, opts) {
143
148
  const lifts = explodeLifts(mesh);
149
+ const facts = castFacts(mesh);
144
150
  return {
145
151
  title: opts.title,
146
152
  theme: opts.theme ?? "light",
@@ -178,13 +184,68 @@ function replayPayload(mesh, opts) {
178
184
  indices,
179
185
  ...slotted ? { groups: runs } : {},
180
186
  ...n.kind === "floor" && finish ? { finish } : {},
181
- ...(n.kind === "outdoor" || n.kind === "fence") && colour ? { colour } : {}
187
+ ...(n.kind === "outdoor" || n.kind === "fence") && colour ? { colour } : {},
188
+ ...bandOf(n, positions, facts)
182
189
  };
183
190
  }),
184
191
  events: timeline(mesh),
185
192
  ...groundOf(mesh)
186
193
  };
187
194
  }
195
+ function bandOf(n, positions, facts) {
196
+ if (positions.length === 0) return {};
197
+ const side = () => {
198
+ let x0 = Infinity;
199
+ let x1 = -Infinity;
200
+ let z0 = Infinity;
201
+ let z1 = -Infinity;
202
+ for (let i = 0; i < positions.length; i += 3) {
203
+ const x = positions[i];
204
+ const z = positions[i + 2];
205
+ if (x < x0) x0 = x;
206
+ if (x > x1) x1 = x;
207
+ if (z < z0) z0 = z;
208
+ if (z > z1) z1 = z;
209
+ }
210
+ return Math.min(x1 - x0, z1 - z0) / 1e3;
211
+ };
212
+ if (n.kind === "wall" && n.part === void 0) {
213
+ const t = typeof n.extras.thickness_mm === "number" ? n.extras.thickness_mm : side();
214
+ return { band: contactBandMm(CONTACT_SHADOW.wall, t) };
215
+ }
216
+ if (n.kind === "column") return { band: contactBandMm(CONTACT_SHADOW.wall, side()) };
217
+ if (n.kind === "furniture") {
218
+ if (n.extras.hung === true) return {};
219
+ const band = contactBandMm(CONTACT_SHADOW.furniture, side());
220
+ let lo = Infinity;
221
+ let hi = -Infinity;
222
+ for (let i = 1; i < positions.length; i += 3) {
223
+ const y = positions[i];
224
+ if (y < lo) lo = y;
225
+ if (y > hi) hi = y;
226
+ }
227
+ return hi - lo < band * 1e3 ? { flat: true } : { band };
228
+ }
229
+ if (n.kind === "fence") {
230
+ const post = facts.fencePosts.get(String(n.extras.style)) ?? side();
231
+ return { band: contactBandMm(CONTACT_SHADOW.fence, post) };
232
+ }
233
+ if (n.kind === "stair" && n.part === "stringer")
234
+ return { band: contactBandMm(CONTACT_SHADOW.wall, CONTACT_SHADOW.stairThicknessMm) };
235
+ return {};
236
+ }
237
+ function castFacts(mesh) {
238
+ const facts = { fencePosts: /* @__PURE__ */ new Map() };
239
+ const inParens = (field) => /^[a-z_]+\((.+)\)$/.exec(field)?.[1];
240
+ for (const a of mesh.assumptions) {
241
+ if (a.rule === "fence-profile-default") {
242
+ const style = inParens(a.field);
243
+ const post = a.value?.post_mm;
244
+ if (style !== void 0 && typeof post === "number") facts.fencePosts.set(style, post);
245
+ }
246
+ }
247
+ return facts;
248
+ }
188
249
  function groundOf(mesh) {
189
250
  const row = mesh.assumptions.find((a) => a.rule === "ground-plane-viewer-only")?.value;
190
251
  const lowest = typeof row?.level === "number" ? row.level : storeysOf(mesh)[0];
@@ -205,6 +266,7 @@ export {
205
266
  PREVIEW_LABEL,
206
267
  PREVIEW_LIMITS,
207
268
  PREVIEW_ABOUT_URL,
269
+ noticeLevelLabel,
208
270
  viewBoxOf,
209
271
  replayPayload
210
272
  };
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  FLOOR_LIFT_UM,
3
3
  FLOOR_OVERLAP_MIN_UM2,
4
+ T0_DEFAULTS,
4
5
  T0_HEIGHT_MM,
5
6
  T0_HUNG_FROM_TOP,
6
7
  T0_MATERIALS,
@@ -23,8 +24,9 @@ import {
23
24
  t0Shells,
24
25
  wallOwnership,
25
26
  where
26
- } from "./chunk-GXWLZ2KC.js";
27
+ } from "./chunk-B4PZWWSP.js";
27
28
  import {
29
+ CONTACT_SHADOW,
28
30
  FENCE_PALETTE,
29
31
  GROUND_PLANE,
30
32
  GROUND_SPLITS,
@@ -33,12 +35,13 @@ import {
33
35
  STAIR_MATERIAL,
34
36
  STAIR_RAIL_MATERIAL,
35
37
  TRIM_MATERIAL,
36
- floorFinish
37
- } from "./chunk-TI4RYEOL.js";
38
+ floorFinish,
39
+ wordFinish
40
+ } from "./chunk-LNIVDMPG.js";
38
41
 
39
42
  // src/adapter/adapt.ts
40
43
  import * as core from "@chanmeng666/archlang";
41
- var MIN_CORE = "1.57.0";
44
+ var MIN_CORE = "1.61.0";
42
45
  var hasHanded = (storeys) => storeys.some((s) => s.ir.elements.some((e) => e.kind === "furniture" && isHandedAsset(assetFor(e.category))));
43
46
  function mirroredIds(source, world, n) {
44
47
  const unknown = Array.from({ length: n }, () => null);
@@ -842,8 +845,11 @@ function sectorSign(o, sector) {
842
845
  }
843
846
 
844
847
  // src/mesh/stair.ts
845
- function stairRisers(flights) {
846
- return flights.reduce((n, f) => n + f.treads + 1, 0);
848
+ function stairRisers(flights, landings = []) {
849
+ return flights.reduce((n, f) => n + f.treads + 1, 0) + landings.slice(0, Math.max(0, flights.length - 1)).reduce((n, l) => n + Math.max(0, (l.winders?.length ?? 1) - 1), 0);
850
+ }
851
+ function landingSteps(l) {
852
+ return l.winders?.length ? l.winders : [rect(l.at[0], l.at[1], l.at[0] + l.size.w, l.at[1] + l.size.h).outer];
847
853
  }
848
854
  function runCoordinate(f, d) {
849
855
  const [x, y] = f.at;
@@ -881,7 +887,7 @@ function sideways(section, c0, c1, runAlongY) {
881
887
  function stairSolid(stair, z0, rise) {
882
888
  const flights = stair.flights;
883
889
  if (!flights?.length || !(rise > 0)) return null;
884
- const R = stairRisers(flights);
890
+ const R = stairRisers(flights, stair.landings);
885
891
  const riserTop = (k) => z0 + Math.round(rise * k / R);
886
892
  const shells = [];
887
893
  const landingTops = [];
@@ -908,15 +914,14 @@ function stairSolid(stair, z0, rise) {
908
914
  climbed += n + 1;
909
915
  const landing = stair.landings?.[i];
910
916
  if (landing && i < flights.length - 1) {
911
- const top = riserTop(climbed);
912
- landingTops.push(top);
913
- const box = prism(
914
- rect(landing.at[0], landing.at[1], landing.at[0] + landing.size.w, landing.at[1] + landing.size.h),
915
- z0,
916
- top
917
- );
918
- if (box) shells.push(box);
919
- else dropped++;
917
+ landingTops.push(riserTop(climbed));
918
+ const steps = landingSteps(landing);
919
+ steps.forEach((ring, k) => {
920
+ const box = prism({ outer: ring }, z0, riserTop(climbed + k));
921
+ if (box) shells.push(box);
922
+ else dropped++;
923
+ });
924
+ climbed += steps.length - 1;
920
925
  }
921
926
  });
922
927
  return { shells, risers: R, landingTops, top: riserTop(R - 1), dropped };
@@ -961,7 +966,7 @@ function stairDetail(stair, z0, rise, solidAt) {
961
966
  if (!flights?.length || !(rise > 0)) return null;
962
967
  const MM4 = 1e3;
963
968
  const D = STAIR_DETAIL;
964
- const R = stairRisers(flights);
969
+ const R = stairRisers(flights, stair.landings);
965
970
  const riserTop = (k) => z0 + Math.round(rise * k / R);
966
971
  const r = rise / R / MM4;
967
972
  const W = stair.width / MM4;
@@ -1104,12 +1109,20 @@ function stairDetail(stair, z0, rise, solidAt) {
1104
1109
  const top = riserTop(climbed);
1105
1110
  base = top;
1106
1111
  const box = [landing.at[0], landing.at[1], landing.at[0] + landing.size.w, landing.at[1] + landing.size.h];
1107
- keep(out.treads, solid(box, z0, top));
1108
- landings.push({ box, top, going: Math.round(g * MM4), k: i + 1 });
1112
+ if (landing.winders?.length) {
1113
+ const steps = landing.winders.map((ring, j) => ({ ring, top: riserTop(climbed + j) }));
1114
+ for (const st of steps) keep(out.treads, prism({ outer: st.ring }, z0, st.top));
1115
+ climbed += steps.length - 1;
1116
+ base = riserTop(climbed);
1117
+ landings.push({ box, top, going: Math.round(g * MM4), k: i + 1, steps });
1118
+ } else {
1119
+ keep(out.treads, solid(box, z0, top));
1120
+ landings.push({ box, top, going: Math.round(g * MM4), k: i + 1 });
1121
+ }
1109
1122
  }
1110
1123
  });
1111
1124
  const taken = [...newels];
1112
- for (const { box, top, going, k } of landings) {
1125
+ for (const { box, top, going, k, steps } of landings) {
1113
1126
  const [x0, y0, x1, y1] = box;
1114
1127
  const p = D.probe * MM4;
1115
1128
  const edges = [
@@ -1118,8 +1131,18 @@ function stairDetail(stair, z0, rise, solidAt) {
1118
1131
  { side: "bottom", horizontal: true, at: y1, out: 1 },
1119
1132
  { side: "left", horizontal: false, at: x0, out: -1 }
1120
1133
  ];
1121
- const railTop = top + D.landingRailHeight * MM4;
1122
1134
  for (const { side, horizontal, at: at2, out: dir } of edges) {
1135
+ const piecesAlong = (q0, q1) => {
1136
+ if (!steps) return [[q0, q1, top]];
1137
+ const pieces = [];
1138
+ for (const st of steps) {
1139
+ const on = st.ring.filter((p2) => Math.abs((horizontal ? p2[1] : p2[0]) - at2) <= 1).map((p2) => horizontal ? p2[0] : p2[1]);
1140
+ if (on.length < 2) continue;
1141
+ const [p0, p1] = [Math.max(q0, Math.min(...on)), Math.min(q1, Math.max(...on))];
1142
+ if (p1 > p0) pieces.push([p0, p1, st.top]);
1143
+ }
1144
+ return pieces.sort((a, b) => a[0] - b[0]);
1145
+ };
1123
1146
  const [a0, a1] = horizontal ? [x0, x1] : [y0, y1];
1124
1147
  const [s0, s1] = dir > 0 ? [at2, at2 + p] : [at2 - p, at2];
1125
1148
  const flightRuns = flightBoxes.filter(
@@ -1140,20 +1163,22 @@ function stairDetail(stair, z0, rise, solidAt) {
1140
1163
  const across = side === "top" ? [y0, y0 + railW] : side === "bottom" ? [y1 - railW, y1] : side === "left" ? [x0, x0 + railW] : [x1 - railW, x1];
1141
1164
  for (const [r0, r1] of open) {
1142
1165
  const held = taken.filter((b) => horizontal ? b[1] < across[1] && b[3] > across[0] : b[0] < across[1] && b[2] > across[0]).map((b) => horizontal ? [b[0], b[2]] : [b[1], b[3]]);
1143
- for (const [q0, q1] of freeRuns(r0, r1, held, np)) {
1144
- const b = horizontal ? [q0, across[0], q1, across[1]] : [across[0], q0, across[1], q1];
1145
- keep(out.rails, solid(b, railTop - railW, railTop));
1146
- taken.push(b);
1147
- railed = true;
1148
- const len = q1 - q0;
1149
- const count = Math.max(1, Math.min(64, Math.floor(len / going)));
1150
- const mid = Math.round((across[0] + across[1] - bb) / 2);
1151
- for (let j = 0; j < count; j++) {
1152
- const c = Math.round(q0 + len * (2 * j + 1) / (2 * count) - bb / 2);
1153
- const bal = horizontal ? [c, mid, c + bb, mid + bb] : [mid, c, mid + bb, c + bb];
1154
- keep(out.rails, solid(bal, top, railTop - railW + MM4));
1166
+ for (const [f0, f1] of freeRuns(r0, r1, held, np))
1167
+ for (const [q0, q1, under] of piecesAlong(f0, f1)) {
1168
+ const railTop = under + D.landingRailHeight * MM4;
1169
+ const b = horizontal ? [q0, across[0], q1, across[1]] : [across[0], q0, across[1], q1];
1170
+ keep(out.rails, solid(b, railTop - railW, railTop));
1171
+ taken.push(b);
1172
+ railed = true;
1173
+ const len = q1 - q0;
1174
+ const count = Math.max(1, Math.min(64, Math.floor(len / going)));
1175
+ const mid = Math.round((across[0] + across[1] - bb) / 2);
1176
+ for (let j = 0; j < count; j++) {
1177
+ const c = Math.round(q0 + len * (2 * j + 1) / (2 * count) - bb / 2);
1178
+ const bal = horizontal ? [c, mid, c + bb, mid + bb] : [mid, c, mid + bb, c + bb];
1179
+ keep(out.rails, solid(bal, under, railTop - railW + MM4));
1180
+ }
1155
1181
  }
1156
- }
1157
1182
  }
1158
1183
  if (open.length > 0 && !railed) out.sides[sideAt].against = "newel";
1159
1184
  }
@@ -1272,6 +1297,12 @@ function fencePieces(f, profile, height) {
1272
1297
 
1273
1298
  // src/mesh/build.ts
1274
1299
  var MM3 = 1e3;
1300
+ var shadowRule = (r, size) => ({
1301
+ of: r.of,
1302
+ size,
1303
+ min: r.minMm,
1304
+ max: r.maxMm
1305
+ });
1275
1306
  var SLAB_MM = 200;
1276
1307
  var FLOOR_FINISH_MM = 5;
1277
1308
  var ROOF_MM = 150;
@@ -1472,15 +1503,17 @@ function levelNodes(lv, ledger, defaulted, isTop, doors, below, above) {
1472
1503
  lv.floors.forEach((f, i) => {
1473
1504
  const pieces = f.polygon.holes?.length ? [f.polygon] : lessVoids(f.polygon.outer, lv.voids, `floor:${f.id}`, ledger);
1474
1505
  const z0 = e + (f.lift ?? 0);
1475
- const finish = floorFinish(f.uses);
1476
- ledger.push({
1477
- kind: "floor",
1478
- id: f.id,
1479
- field: "finish",
1480
- value: finish,
1481
- provenance: "default",
1482
- rule: "floor-finish-default"
1483
- });
1506
+ const authored = wordFinish(f.pattern);
1507
+ const finish = authored ?? floorFinish(f.uses);
1508
+ if (authored === void 0)
1509
+ ledger.push({
1510
+ kind: "floor",
1511
+ id: f.id,
1512
+ field: "finish",
1513
+ value: finish,
1514
+ provenance: "default",
1515
+ rule: "floor-finish-default"
1516
+ });
1484
1517
  node(
1485
1518
  "floor",
1486
1519
  f.id,
@@ -1585,6 +1618,27 @@ function levelNodes(lv, ledger, defaulted, isTop, doors, below, above) {
1585
1618
  provenance: "derived",
1586
1619
  rule: "stair-risers-from-treads"
1587
1620
  });
1621
+ (s.landings ?? []).forEach((l, k) => {
1622
+ if (l.winders?.length)
1623
+ ledger.push(
1624
+ {
1625
+ kind: "stair",
1626
+ id: s.id,
1627
+ field: `winders(landing ${k + 1})`,
1628
+ value: l.winders.length,
1629
+ provenance: "derived",
1630
+ rule: "stair-winders-from-drawing"
1631
+ },
1632
+ {
1633
+ kind: "stair",
1634
+ id: s.id,
1635
+ field: `risers_form(landing ${k + 1})`,
1636
+ value: "solid",
1637
+ provenance: "default",
1638
+ rule: "stair-winders-solid"
1639
+ }
1640
+ );
1641
+ });
1588
1642
  const d = solid.dims;
1589
1643
  ledger.push(
1590
1644
  {
@@ -1892,6 +1946,15 @@ function levelNodes(lv, ledger, defaulted, isTop, doors, below, above) {
1892
1946
  rule: "furniture-mount-default"
1893
1947
  });
1894
1948
  }
1949
+ for (const d of family ? T0_DEFAULTS[family] ?? [] : []) {
1950
+ ledger.push({
1951
+ kind: "furniture",
1952
+ field: `${d.field}(${f.category})`,
1953
+ value: d.value,
1954
+ provenance: "default",
1955
+ rule: d.rule
1956
+ });
1957
+ }
1895
1958
  const slots = family ? T0_MATERIALS[family] : void 0;
1896
1959
  if (slots?.length) {
1897
1960
  ledger.push({
@@ -1955,7 +2018,11 @@ function levelNodes(lv, ledger, defaulted, isTop, doors, below, above) {
1955
2018
  yaw_deg: f.yawDeg,
1956
2019
  asset,
1957
2020
  ...f.room ? { room: f.room } : {},
1958
- ...parts && f.mirror ? { mirror: true } : {}
2021
+ ...parts && f.mirror ? { mirror: true } : {},
2022
+ // Hung on the wall, not standing (`isHung`): a fact of the piece as built, so a reader (the
2023
+ // replay's contact shadows, card RM8.8) needs neither the T0 tables nor the ledger, whose
2024
+ // per-piece rows name no storey. Absent on a standing piece.
2025
+ ...parts && family && isHung(family) ? { hung: true } : {}
1959
2026
  });
1960
2027
  });
1961
2028
  const roofZ = [e + tallest, e + tallest + ROOF_MM * MM3];
@@ -2146,6 +2213,23 @@ function buildMesh(scene, opts = {}) {
2146
2213
  },
2147
2214
  provenance: "default",
2148
2215
  rule: "ground-plane-viewer-only"
2216
+ },
2217
+ // Card RM8.8: the soft contact shadows the viewer draws are in no node and not in the GLB, so,
2218
+ // as the ground plane, they are said here, in every Mesh3D: each band's width rule and alphas.
2219
+ {
2220
+ kind: "shadow",
2221
+ field: "contact",
2222
+ value: {
2223
+ drawn: "viewer only",
2224
+ wall_band_mm: shadowRule(CONTACT_SHADOW.wall, "thickness"),
2225
+ furniture_band_mm: shadowRule(CONTACT_SHADOW.furniture, "smaller footprint side"),
2226
+ fence_band_mm: shadowRule(CONTACT_SHADOW.fence, "post"),
2227
+ stair_thickness_mm: CONTACT_SHADOW.stairThicknessMm,
2228
+ alpha: { ...CONTACT_SHADOW.alpha },
2229
+ alpha_dark: { ...CONTACT_SHADOW.alphaDark }
2230
+ },
2231
+ provenance: "default",
2232
+ rule: "contact-shadows-viewer-only"
2149
2233
  }
2150
2234
  ];
2151
2235
  const defaulted = /* @__PURE__ */ new Set();
package/dist/cli.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  DOOR_POSES,
4
4
  adaptPlan,
5
5
  buildMesh
6
- } from "./chunk-QN4LQTVG.js";
6
+ } from "./chunk-WARUDAOQ.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-FVD3DZU2.js";
16
+ } from "./chunk-MCASL4MM.js";
17
17
  import {
18
18
  ARCHLANG_3D_VERSION,
19
19
  replayFacts
20
- } from "./chunk-GXWLZ2KC.js";
21
- import "./chunk-FHBR2U5Z.js";
20
+ } from "./chunk-B4PZWWSP.js";
21
+ import "./chunk-VMVKI2WQ.js";
22
22
  import {
23
23
  storeysOf,
24
24
  timeline,
25
25
  viewLabel,
26
26
  viewMesh
27
- } from "./chunk-TI4RYEOL.js";
27
+ } from "./chunk-LNIVDMPG.js";
28
28
 
29
29
  // src/cli/run.ts
30
30
  import { readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "node:fs";
@@ -599,6 +599,11 @@ ${VIEW_USAGE}
599
599
  const f = replayFacts(source, { world, storeys, view: view2 });
600
600
  return f ? { facts: f } : {};
601
601
  };
602
+ const noticesOf = (view2) => r.warnings.filter((w) => view2 === "all" || w.level === storeys[view2 - 1]).map((w) => ({
603
+ code: w.code,
604
+ message: w.message,
605
+ ...view2 === "all" && storeys.length > 1 ? { level: w.level } : {}
606
+ }));
602
607
  const htmlOf = (view2) => replayHtml(viewMesh(mesh, view2), {
603
608
  title: r.scene.meta.name,
604
609
  svg: svgOf(view2),
@@ -606,7 +611,8 @@ ${VIEW_USAGE}
606
611
  height: args.height,
607
612
  seconds: args.seconds,
608
613
  theme: args.theme,
609
- ...facts(view2)
614
+ ...facts(view2),
615
+ notices: noticesOf(view2)
610
616
  });
611
617
  const html = await htmlOf(args.storey);
612
618
  try {
@@ -1,5 +1,5 @@
1
1
  import { World } from '@chanmeng666/archlang';
2
- import { U as ReplayView, R as ReplayFacts } from './strip-Sdsm54Qw.js';
2
+ import { a5 as ReplayView, d as ReplayFacts } from './payload-DwiB2P7x.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,33 +1,10 @@
1
1
  import * as _chanmeng666_archlang from '@chanmeng666/archlang';
2
- import { ResolvedPlan, RWall, Point, JoinedCut, loopsToPolygons, World, Diagnostic } from '@chanmeng666/archlang';
2
+ import { RWall, Point, JoinedCut, loopsToPolygons, ResolvedPlan, World, Diagnostic } from '@chanmeng666/archlang';
3
3
  export { Point } from '@chanmeng666/archlang';
4
- 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, O as Opening, L as Level, e as Side, f as Stair, g as StairFlight, h as MaterialSlot, i as Furniture, j as Fence, G as GroundTint } from './strip-Sdsm54Qw.js';
5
- export { D as DoorKind, E as EXPLODE_GAP_MM, k as FENCE_PALETTE, l as FINISH_PALETTE, m as FIXTURE_FAMILIES, n as FLOOR_FINISHES, o as FLOOR_FINISH_RULES, p as FloorFinish, q as GROUND_PLANE, r as GROUND_ROUGHNESS, t as GROUND_SPLITS, u as GROUND_TINT, v as GROUND_WASH, K as KIND_PALETTE, w as KindMaterial, x as MATERIAL_SLOTS, y as MeshNode, z as Meta, N as NodeKind, B as NodeState, C as Outdoor, H as PALETTE, I as PHASE, J as Provenance, Q as ReplayEvent, R as ReplayFacts, T as ReplayState, U as ReplayView, V as Roof, W as SITE_PALETTE, X as STAIR_MATERIAL, Y as STAIR_RAIL_MATERIAL, Z as STOP_LEAD, _ as SlotMaterial, $ as Source, a0 as Stage, a1 as StairLanding, S as StripItem, a2 as TRIM_MATERIAL, a3 as Um, a4 as WALL_CAP_SRGB, a5 as Wall, a6 as authoringOrder, a7 as ease, a8 as explodeLifts, a9 as finishColour, aa as floorFinish, ab as keyFrames, ac as linearRgb, ad as siteColour, ae as slotColour, af as slotGroups, ag as stateAt, ah as storeysOf, s as stripAt, ai as timeline, aj as viewLabel, ak as viewMesh } from './strip-Sdsm54Qw.js';
6
- export { F as FactsOptions, r as replayFacts } from './facts-3wb9egIT.js';
7
- 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-CGIIudHj.js';
8
-
9
- /** The package's own version, stamped into `meta.tool`. */
10
- declare const ARCHLANG_3D_VERSION: string;
11
- /** A resolved storey: its number, name and IR. */
12
- interface Storey {
13
- level: number;
14
- name?: string;
15
- ir: ResolvedPlan;
16
- }
17
- interface BuildOptions {
18
- /** The core version the plan was resolved with, stamped into `meta.tool.archlang`. */
19
- coreVersion: string;
20
- /** Largest sagitta (mm) of an arc's chords; default {@link DEFAULT_CURVE_TOL_MM}. */
21
- curveTolMm?: number;
22
- /**
23
- * Per storey (in `storeys` order), the ids of the furniture the plan reflects, or `null` where
24
- * that is unknown; read only for a handed asset (`T0_HANDED`). Omitted: unknown everywhere, so a
25
- * handed piece stands as a grey box. `adaptPlan` fills it from the core's Plan JSON.
26
- */
27
- mirrored?: ReadonlyArray<ReadonlySet<string> | null>;
28
- }
29
- /** Resolved storeys (lowest first) → a Scene3D v0. */
30
- declare function buildScene3D(storeys: readonly Storey[], opts: BuildOptions): Scene3D;
4
+ import { g as Scene3D, F as Floor, h as Polygon, M as Mesh3D, i as Pt, j as Shell, k as Ring3, A as Assumption, O as Opening, L as Level, l as Side, m as Stair, o as StairFlight, p as StairLanding, q as MaterialSlot, t as Furniture, u as Fence, G as GroundTint, e as ReplayNode } from './payload-DwiB2P7x.js';
5
+ export { C as CONTACT_SHADOW, D as DoorKind, E as EXPLODE_GAP_MM, w as FENCE_PALETTE, x as FINISH_PALETTE, y as FIXTURE_FAMILIES, z as FLOOR_FINISHES, B as FLOOR_FINISH_RULES, H as FLOOR_WORD_FINISH, I as FloorFinish, J as GROUND_PLANE, K as GROUND_ROUGHNESS, N as GROUND_SPLITS, Q as GROUND_TINT, T as GROUND_WASH, U as KIND_PALETTE, V as KindMaterial, W as MATERIAL_SLOTS, X as MeshNode, Y as Meta, Z as NodeKind, _ as NodeState, $ as Outdoor, a0 as PALETTE, a1 as PHASE, a2 as Provenance, a3 as ReplayEvent, d as ReplayFacts, a4 as ReplayState, a5 as ReplayView, a6 as Roof, a7 as SITE_PALETTE, a8 as STAIR_MATERIAL, a9 as STAIR_RAIL_MATERIAL, aa as STOP_LEAD, ab as SlotMaterial, ac as Source, ad as Stage, S as StripItem, ae as TRIM_MATERIAL, af as Um, ag as WALL_CAP_SRGB, ah as Wall, ai as authoringOrder, aj as contactBandMm, ak as ease, al as explodeLifts, am as finishColour, an as floorFinish, ao as keyFrames, ap as linearRgb, aq as siteColour, ar as slotColour, as as slotGroups, at as stateAt, au as storeysOf, s as stripAt, av as timeline, aw as viewLabel, ax as viewMesh, ay as wordFinish } from './payload-DwiB2P7x.js';
6
+ export { F as FactsOptions, r as replayFacts } from './facts-CsO0xtFw.js';
7
+ 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-BAsRq_eC.js';
31
8
 
32
9
  /** A ring of plan points (mm), as `loopsToPolygons` returns it: closed, no repeated vertex. */
33
10
  type Ring = Point[];
@@ -95,6 +72,29 @@ interface MixedHeightJoint {
95
72
  */
96
73
  declare function mixedHeightJoints(own: Ownership): MixedHeightJoint[];
97
74
 
75
+ /** The package's own version, stamped into `meta.tool`. */
76
+ declare const ARCHLANG_3D_VERSION: string;
77
+ /** A resolved storey: its number, name and IR. */
78
+ interface Storey {
79
+ level: number;
80
+ name?: string;
81
+ ir: ResolvedPlan;
82
+ }
83
+ interface BuildOptions {
84
+ /** The core version the plan was resolved with, stamped into `meta.tool.archlang`. */
85
+ coreVersion: string;
86
+ /** Largest sagitta (mm) of an arc's chords; default {@link DEFAULT_CURVE_TOL_MM}. */
87
+ curveTolMm?: number;
88
+ /**
89
+ * Per storey (in `storeys` order), the ids of the furniture the plan reflects, or `null` where
90
+ * that is unknown; read only for a handed asset (`T0_HANDED`). Omitted: unknown everywhere, so a
91
+ * handed piece stands as a grey box. `adaptPlan` fills it from the core's Plan JSON.
92
+ */
93
+ mirrored?: ReadonlyArray<ReadonlySet<string> | null>;
94
+ }
95
+ /** Resolved storeys (lowest first) → a Scene3D v0. */
96
+ declare function buildScene3D(storeys: readonly Storey[], opts: BuildOptions): Scene3D;
97
+
98
98
  /** More than this much overlap (µm², i.e. 1 cm²) is reported and lifted (plan §4.2). */
99
99
  declare const FLOOR_OVERLAP_MIN_UM2 = 100000000;
100
100
  /** The lift per step (µm): 0.5 mm. */
@@ -148,12 +148,13 @@ interface AdaptOptions {
148
148
  /**
149
149
  * The first core release that carries every export this package reads: the seam (`resolvePlan`,
150
150
  * ADR 0031) arrived in 1.44.0, `hatchKey`/`hatchOf` (card A0b) in 1.45.0, `treadCount` (the
151
- * stairs, amendment 2026-11-06 to ADR 0031) in 1.57.0. An older core still builds everything but
152
- * the stairs (`stair-no-flights`); only a core without `resolvePlan` or `hatchKey` is refused,
153
- * `E3D_CORE_TOO_OLD`. Kept equal to the
151
+ * stairs, amendment 2026-11-06 to ADR 0031) in 1.57.0, `winderTreads` (a `winders` landing's
152
+ * treads, amendment 2026-11-14) in 1.61.0. An older core still builds everything but the stairs
153
+ * (`stair-no-flights`) and a `winders` landing's treads (`stair-winders-not-read`); only a core
154
+ * without `resolvePlan` or `hatchKey` is refused, `E3D_CORE_TOO_OLD`. Kept equal to the
154
155
  * `peerDependencies` floor (`test/package-meta.test.ts`).
155
156
  */
156
- declare const MIN_CORE = "1.57.0";
157
+ declare const MIN_CORE = "1.61.0";
157
158
  declare function adaptPlan(source: string, opts?: AdaptOptions): AdaptResult;
158
159
 
159
160
  /**
@@ -427,12 +428,20 @@ declare function storeyTrim(level: Level, inputs: readonly TrimInput[], e: numbe
427
428
  * (the stair's `width`, centred across the flight, as the drawing centres it), each tread
428
429
  * `run / treads` deep, on the drawing's tread lines. It is solid down to the stair's floor `z0`.
429
430
  * - A landing: a closed box over its rectangle, from `z0` up to the riser its flight ends on.
431
+ * - A `winders <n>` landing (card RM1.2g): its `n` tapered treads (`StairLanding.winders`, cut by
432
+ * the lines the core draws across it), each a closed prism from `z0`, the first at the riser its
433
+ * flight ends on and each next one riser higher. So it climbs `n - 1` risers more than a level
434
+ * landing, one per line the plan draws across it, the risers `W_STAIR_RISER_TOO_HIGH` counts.
430
435
  *
431
436
  * Every shell is closed and wound outward (`prism`), in integer micrometres and glTF axes.
432
437
  */
433
438
 
434
- /** How many risers a stair of these flights climbs: each flight's treads plus its head riser. */
435
- declare function stairRisers(flights: readonly Pick<StairFlight, "treads">[]): number;
439
+ /**
440
+ * How many risers a stair of these flights climbs: each flight's treads plus its head riser, and
441
+ * on each `winders <n>` landing between two of them (card RM1.2g) `n - 1` more, one per line the
442
+ * plan draws across it.
443
+ */
444
+ declare function stairRisers(flights: readonly Pick<StairFlight, "treads">[], landings?: readonly Pick<StairLanding, "winders">[]): number;
436
445
  /** A stair's solids, how many risers it climbs, and the height each landing stands at. */
437
446
  interface StairSolid {
438
447
  shells: Shell[];
@@ -797,4 +806,64 @@ declare function fencePieces(f: Pick<Fence, "points" | "closed" | "style">, prof
797
806
  z: readonly [number, number];
798
807
  }>;
799
808
 
800
- export { ARCHLANG_3D_VERSION, type AdaptOptions, type AdaptResult, Assumption, type BuildOptions, CORE_POSTS_PER_RUN, CORE_POST_PITCH_MM, type CutSector, DOOR_POSES, type DoorPose, FENCE_HEIGHT_MM, FENCE_PROFILES, FLAT_MM, FLOOR_LIFT_UM, FLOOR_OVERLAP_MIN_UM2, FURNITURE_HEIGHT_MM, Fence, type FenceProfile, Floor, type FloorOverlap, Furniture, GroundTint, Level, MAX_FENCE_REPEAT, MIN_CORE, MaterialSlot, Mesh3D, type MeshOptions, type MixedHeightJoint, OPENING_DETAIL, OUTDOOR_MM, type ObstacleClass, Opening, type OwnedWall, type Ownership, type Part, type Piece, Polygon, type Prism, Pt, type Refusal, type RefusalCode, type Ring, Ring3, STAIR_DETAIL, Scene3D, type SectionShape, Shell, Side, Stair, type StairDetail, StairFlight, type StairSide, type StairSolid, type Storey, T0_FAMILIES, T0_HANDED, T0_HEIGHT_MM, T0_HUNG_FROM_TOP, T0_MATERIALS, T0_MOUNT_MM, type TrimInput, type TrimPart, type TrimResult, type ValidationIssue, type Warning3D, adaptPlan, assetFor, buildMesh, buildScene3D, clipToConvex, corePostCount, cutSector, fenceColour, fencePieces, fencePosts, fenceRuns, floorLifts, floorOverlaps, groundColour, handedAt, insideCut, insideOf, mixedHeightJoints, openLeaf, outdoorColour, overlapArea, partShell, piecesOf, piecesTouch, prism, rectsOf, sectionRing, sectorBand, slab2d, slabRegion, stairDetail, stairRisers, stairSolid, storeyTrim, t0LocalParts, t0Shells, um, umPoint, validateScene3D, wallOwnership };
809
+ /** The three buffers of a storey (see the header). */
810
+ type ShadowClass = "foot" | "corner" | "halo";
811
+ interface ShadowLayer {
812
+ /** The storey's level (its nodes' key prefix `L<level>/`). */
813
+ level: number;
814
+ cls: ShadowClass;
815
+ /** Flat `[x, y, z, …]` in µm, the nodes' axes (X plan x, Y up, Z plan y). */
816
+ positions: number[];
817
+ /** Per vertex: 1 on a band's inner edge, 0 on its outer edge (times its class's alpha when drawn). */
818
+ weight: number[];
819
+ /** Per vertex: its caster (`ContactShadows.casters`), whose rise fades it in. */
820
+ caster: number[];
821
+ indices: number[];
822
+ }
823
+ interface ContactShadows {
824
+ layers: ShadowLayer[];
825
+ /** Each caster: the node keys whose rise fades its bands in (the last of them up decides). */
826
+ casters: string[][];
827
+ /** What was built and how much was looked up, for the structural bounds (`test/shadows.test.ts`). */
828
+ counts: {
829
+ /** Outline stretches of the walls and columns that carry a band. */
830
+ edges: number;
831
+ /** Outside and inside corners sharper than 30° (a fan; two vertical bands). */
832
+ convex: number;
833
+ concave: number;
834
+ /** Joints flatter than 30° (a curved wall's chords): mitred, no corner. */
835
+ flatJoints: number;
836
+ /** Stretches left unbanded because the point just outside lies in another caster. */
837
+ dropped: number;
838
+ furniture: number;
839
+ /** Fence rail sides that carry a band. */
840
+ fenceSides: number;
841
+ /** Outline edges of the stairs' stringers that carry a band. */
842
+ stairEdges: number;
843
+ triangles: number;
844
+ /** Plan points looked up, and faces tested against them. */
845
+ probes: number;
846
+ tests: number;
847
+ };
848
+ }
849
+ /**
850
+ * The fade of a caster's bands at replay time `u` (design §1.1): 0 until the last quarter of its
851
+ * rise, then up to 1 by `ease` at its end; a caster that never rises (none here) shows from its time.
852
+ * A pure function of `u`, so a frame at `t` is the same however it was reached.
853
+ */
854
+ declare function contactFade(ev: {
855
+ riseFrom: number;
856
+ riseTo: number;
857
+ hidden?: boolean;
858
+ } | undefined, u: number): number;
859
+ /**
860
+ * The contact shadows of a replay's nodes (`ReplayPayload.nodes`). `ground` (its ground plane)
861
+ * receives under the lowest storey; `lines` (the walls' outline per node, `wallOutline`) narrows the
862
+ * inside-corner bands at a jamb, and without it they keep their full width. Pure: the same nodes give
863
+ * the same bands, byte for byte.
864
+ */
865
+ declare function contactShadows(nodes: readonly ReplayNode[], ground?: {
866
+ y: number;
867
+ }, lines?: ReadonlyArray<readonly number[] | undefined>): ContactShadows;
868
+
869
+ export { ARCHLANG_3D_VERSION, type AdaptOptions, type AdaptResult, Assumption, type BuildOptions, CORE_POSTS_PER_RUN, CORE_POST_PITCH_MM, type ContactShadows, type CutSector, DOOR_POSES, type DoorPose, FENCE_HEIGHT_MM, FENCE_PROFILES, FLAT_MM, FLOOR_LIFT_UM, FLOOR_OVERLAP_MIN_UM2, FURNITURE_HEIGHT_MM, Fence, type FenceProfile, Floor, type FloorOverlap, Furniture, GroundTint, Level, MAX_FENCE_REPEAT, MIN_CORE, MaterialSlot, Mesh3D, type MeshOptions, type MixedHeightJoint, OPENING_DETAIL, OUTDOOR_MM, type ObstacleClass, Opening, type OwnedWall, type Ownership, type Part, type Piece, Polygon, type Prism, Pt, type Refusal, type RefusalCode, type Ring, Ring3, STAIR_DETAIL, Scene3D, type SectionShape, type ShadowClass, type ShadowLayer, Shell, Side, Stair, type StairDetail, StairFlight, StairLanding, type StairSide, type StairSolid, type Storey, T0_FAMILIES, T0_HANDED, T0_HEIGHT_MM, T0_HUNG_FROM_TOP, T0_MATERIALS, T0_MOUNT_MM, type TrimInput, type TrimPart, type TrimResult, type ValidationIssue, type Warning3D, adaptPlan, assetFor, buildMesh, buildScene3D, clipToConvex, contactFade, contactShadows, corePostCount, cutSector, fenceColour, fencePieces, fencePosts, fenceRuns, floorLifts, floorOverlaps, groundColour, handedAt, insideCut, insideOf, mixedHeightJoints, openLeaf, outdoorColour, overlapArea, partShell, piecesOf, piecesTouch, prism, rectsOf, sectionRing, sectorBand, slab2d, slabRegion, stairDetail, stairRisers, stairSolid, storeyTrim, t0LocalParts, t0Shells, um, umPoint, validateScene3D, wallOwnership };