@chanmeng666/archlang-3d 0.7.0 → 0.8.1
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/CHANGELOG.md +91 -0
- package/README.md +4 -4
- package/dist/browser.d.ts +3 -5
- package/dist/browser.js +87 -472
- package/dist/{camera-CGIIudHj.d.ts → camera-BAsRq_eC.d.ts} +1 -1
- package/dist/{chunk-GXWLZ2KC.js → chunk-33J3YGNF.js} +392 -29
- package/dist/{chunk-QN4LQTVG.js → chunk-CYSES7C3.js} +128 -44
- package/dist/chunk-JQTG6BDR.js +1127 -0
- package/dist/{chunk-TI4RYEOL.js → chunk-LNIVDMPG.js} +75 -5
- package/dist/{chunk-FHBR2U5Z.js → chunk-VMVKI2WQ.js} +65 -3
- package/dist/{chunk-FVD3DZU2.js → chunk-WOEJKIXN.js} +15 -6
- package/dist/cli.js +12 -6
- package/dist/{facts-3wb9egIT.d.ts → facts-CsO0xtFw.d.ts} +1 -1
- package/dist/index.d.ts +104 -35
- package/dist/index.js +19 -5
- package/dist/node.d.ts +23 -7
- package/dist/node.js +4 -4
- package/dist/{strip-Sdsm54Qw.d.ts → payload-DwiB2P7x.d.ts} +232 -12
- package/dist/replay.d.ts +1 -115
- package/dist/scene3d.schema.json +12 -0
- package/dist/viewer.iife.js +180 -180
- package/package.json +3 -3
|
@@ -85,12 +85,38 @@ var TRIM_MATERIAL = {
|
|
|
85
85
|
"window:board": { material: "window:board", srgb: KIND_PALETTE["window:board"].srgb }
|
|
86
86
|
};
|
|
87
87
|
var WALL_CAP_SRGB = "#8f877d";
|
|
88
|
-
var FLOOR_FINISHES = [
|
|
88
|
+
var FLOOR_FINISHES = [
|
|
89
|
+
"timber",
|
|
90
|
+
"tile",
|
|
91
|
+
"neutral",
|
|
92
|
+
"carpeting",
|
|
93
|
+
"stone",
|
|
94
|
+
"deck",
|
|
95
|
+
"paving",
|
|
96
|
+
"concrete"
|
|
97
|
+
];
|
|
89
98
|
var FINISH_PALETTE = {
|
|
90
99
|
timber: m("#cdb596", 0.6),
|
|
91
100
|
tile: m("#e3e1db", 0.35),
|
|
92
|
-
neutral: m("#e8e2d7", 0.9)
|
|
101
|
+
neutral: m("#e8e2d7", 0.9),
|
|
102
|
+
carpeting: PALETTE.wool,
|
|
103
|
+
stone: PALETTE.stone,
|
|
104
|
+
deck: PALETTE.wood,
|
|
105
|
+
paving: m("#ab9f87", 0.85),
|
|
106
|
+
concrete: m("#c9c5be", 0.6)
|
|
107
|
+
};
|
|
108
|
+
var FLOOR_WORD_FINISH = {
|
|
109
|
+
tile: "tile",
|
|
110
|
+
paving: "paving",
|
|
111
|
+
deck: "deck",
|
|
112
|
+
concrete: "concrete",
|
|
113
|
+
timber: "timber",
|
|
114
|
+
carpeting: "carpeting",
|
|
115
|
+
stone: "stone"
|
|
93
116
|
};
|
|
117
|
+
function wordFinish(word) {
|
|
118
|
+
return word !== void 0 && Object.hasOwn(FLOOR_WORD_FINISH, word) ? FLOOR_WORD_FINISH[word] : void 0;
|
|
119
|
+
}
|
|
94
120
|
var FLOOR_FINISH_RULES = [
|
|
95
121
|
["tile", ["bath", "wc", "utility"]],
|
|
96
122
|
["timber", ["living", "dining", "bedroom", "office", "hall", "circulation"]],
|
|
@@ -109,18 +135,23 @@ var GROUND_TINT = {
|
|
|
109
135
|
water: "water",
|
|
110
136
|
driveway: "paving",
|
|
111
137
|
patio: "paving",
|
|
112
|
-
balcony: "paving"
|
|
138
|
+
balcony: "paving",
|
|
139
|
+
sand: "paving",
|
|
140
|
+
soil: "paving"
|
|
113
141
|
};
|
|
114
142
|
var GROUND_WASH = 6;
|
|
115
143
|
var SITE_PALETTE = {
|
|
116
144
|
gravel: m("#cbc3b4", 0.95),
|
|
117
|
-
tarmac: m("#8c8984", 0.85)
|
|
145
|
+
tarmac: m("#8c8984", 0.85),
|
|
146
|
+
sand: m("#dcc9a3", 0.95)
|
|
118
147
|
};
|
|
119
148
|
var GROUND_SPLITS = {
|
|
120
149
|
planting: PALETTE.foliage,
|
|
121
150
|
deck: PALETTE.wood,
|
|
122
151
|
gravel: SITE_PALETTE.gravel,
|
|
123
|
-
driveway: SITE_PALETTE.tarmac
|
|
152
|
+
driveway: SITE_PALETTE.tarmac,
|
|
153
|
+
sand: SITE_PALETTE.sand,
|
|
154
|
+
soil: PALETTE.soil
|
|
124
155
|
};
|
|
125
156
|
var GROUND_ROUGHNESS = { lawn: 0.95, paving: 0.85, water: 0.1 };
|
|
126
157
|
var FENCE_PALETTE = {
|
|
@@ -129,6 +160,18 @@ var FENCE_PALETTE = {
|
|
|
129
160
|
post: PALETTE.wood_dark
|
|
130
161
|
};
|
|
131
162
|
var GROUND_PLANE = { light: "#e2ddd3", dark: "#16293d", marginMm: 6e3 };
|
|
163
|
+
var CONTACT_SHADOW = {
|
|
164
|
+
wall: { of: 0.75, minMm: 80, maxMm: 200 },
|
|
165
|
+
furniture: { of: 0.12, minMm: 30, maxMm: 120 },
|
|
166
|
+
fence: { of: 1.5, minMm: 40, maxMm: 120 },
|
|
167
|
+
stairThicknessMm: 100,
|
|
168
|
+
alpha: { floor: 0.2, corner: 0.12, furniture: 0.18 },
|
|
169
|
+
alphaDark: { floor: 0.3, corner: 0.18, furniture: 0.27 },
|
|
170
|
+
liftMm: 1
|
|
171
|
+
};
|
|
172
|
+
function contactBandMm(rule, size) {
|
|
173
|
+
return Math.min(rule.maxMm, Math.max(rule.minMm, Math.round(rule.of * size)));
|
|
174
|
+
}
|
|
132
175
|
function siteColour(own, theme, toward) {
|
|
133
176
|
if (theme === "light") return own;
|
|
134
177
|
const mix = (i) => {
|
|
@@ -630,7 +673,30 @@ function targetBounds(box) {
|
|
|
630
673
|
};
|
|
631
674
|
}
|
|
632
675
|
|
|
676
|
+
// src/mesh/c16.ts
|
|
677
|
+
var C16 = [
|
|
678
|
+
1,
|
|
679
|
+
0.9238795325112867,
|
|
680
|
+
Math.SQRT1_2,
|
|
681
|
+
0.3826834323650898,
|
|
682
|
+
0,
|
|
683
|
+
-0.3826834323650898,
|
|
684
|
+
-Math.SQRT1_2,
|
|
685
|
+
-0.9238795325112867,
|
|
686
|
+
-1,
|
|
687
|
+
-0.9238795325112867,
|
|
688
|
+
-Math.SQRT1_2,
|
|
689
|
+
-0.3826834323650898,
|
|
690
|
+
0,
|
|
691
|
+
0.3826834323650898,
|
|
692
|
+
Math.SQRT1_2,
|
|
693
|
+
0.9238795325112867
|
|
694
|
+
];
|
|
695
|
+
var S16 = C16.map((_, k) => C16[(k + 12) % 16]);
|
|
696
|
+
|
|
633
697
|
export {
|
|
698
|
+
C16,
|
|
699
|
+
S16,
|
|
634
700
|
MATERIAL_SLOTS,
|
|
635
701
|
PALETTE,
|
|
636
702
|
STAIR_MATERIAL,
|
|
@@ -640,6 +706,8 @@ export {
|
|
|
640
706
|
WALL_CAP_SRGB,
|
|
641
707
|
FLOOR_FINISHES,
|
|
642
708
|
FINISH_PALETTE,
|
|
709
|
+
FLOOR_WORD_FINISH,
|
|
710
|
+
wordFinish,
|
|
643
711
|
FLOOR_FINISH_RULES,
|
|
644
712
|
floorFinish,
|
|
645
713
|
GROUND_TINT,
|
|
@@ -649,6 +717,8 @@ export {
|
|
|
649
717
|
GROUND_ROUGHNESS,
|
|
650
718
|
FENCE_PALETTE,
|
|
651
719
|
GROUND_PLANE,
|
|
720
|
+
CONTACT_SHADOW,
|
|
721
|
+
contactBandMm,
|
|
652
722
|
siteColour,
|
|
653
723
|
linearRgb,
|
|
654
724
|
slotColour,
|
|
@@ -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-
|
|
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
|
|
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,13 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ARCHLANG_3D_VERSION,
|
|
3
3
|
validateScene3D
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-33J3YGNF.js";
|
|
5
5
|
import {
|
|
6
6
|
PREVIEW_LABEL,
|
|
7
7
|
PREVIEW_LIMITS,
|
|
8
8
|
VIEW_CONTROLS_LABEL,
|
|
9
|
+
noticeLevelLabel,
|
|
9
10
|
replayPayload
|
|
10
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-VMVKI2WQ.js";
|
|
11
12
|
import {
|
|
12
13
|
FENCE_PALETTE,
|
|
13
14
|
FINISH_PALETTE,
|
|
@@ -20,7 +21,7 @@ import {
|
|
|
20
21
|
keyFrames,
|
|
21
22
|
linearRgb,
|
|
22
23
|
slotGroups
|
|
23
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-LNIVDMPG.js";
|
|
24
25
|
|
|
25
26
|
// src/world.ts
|
|
26
27
|
import { readFileSync, realpathSync, statSync } from "node:fs";
|
|
@@ -141,7 +142,9 @@ ${readFileSync2(join(dir, "LICENSE"), "utf8")}`;
|
|
|
141
142
|
}
|
|
142
143
|
var escapeHtml = (s) => s.replace(/[&<>"]/g, (c) => ({ "&": "&", "<": "<", ">": ">", '"': """ })[c]);
|
|
143
144
|
async function replayHtml(mesh, opts) {
|
|
144
|
-
const
|
|
145
|
+
const { notices: given, ...payloadOpts } = opts;
|
|
146
|
+
const notices = given ?? [];
|
|
147
|
+
const payload = replayPayload(mesh, payloadOpts);
|
|
145
148
|
const json = JSON.stringify(payload).replace(/</g, "\\u003c");
|
|
146
149
|
const script = (await viewerScript()).replace(/<\/script/gi, "<\\/script");
|
|
147
150
|
const bg = payload.theme === "dark" ? "#0f2235" : "#f7f5f0";
|
|
@@ -170,7 +173,10 @@ canvas:focus-visible{outline:2px solid ${fg};outline-offset:2px}
|
|
|
170
173
|
.archlang-views button{font:inherit;font-size:13px;padding:2px 10px;border:1px solid ${fg};border-radius:4px;background:transparent;color:${fg};cursor:pointer}
|
|
171
174
|
.archlang-views button[aria-pressed=true]{background:${fg};color:${bg}}
|
|
172
175
|
.archlang-views-storeys{display:inline-flex;align-items:center;gap:4px;margin-left:8px}
|
|
173
|
-
.archlang-views-hint{flex-basis:100%;text-align:center;font-size:12px;opacity:.8}
|
|
176
|
+
.archlang-views-hint{flex-basis:100%;text-align:center;font-size:12px;opacity:.8}${notices.length > 0 ? `
|
|
177
|
+
.archlang-notices{display:grid;gap:4px;width:min(720px,90vw)}
|
|
178
|
+
.archlang-notices p{opacity:1;padding:6px 10px;border-left:3px solid #b45309;background:rgba(180,83,9,.08)}
|
|
179
|
+
.archlang-notices code{font-size:11.5px;margin-right:6px}` : ""}
|
|
174
180
|
</style>
|
|
175
181
|
</head>
|
|
176
182
|
<body>
|
|
@@ -180,7 +186,10 @@ canvas:focus-visible{outline:2px solid ${fg};outline-offset:2px}
|
|
|
180
186
|
<div id="archlang-replay-strip" role="group" aria-label="Plan facts" hidden></div>` : ""}
|
|
181
187
|
</div>
|
|
182
188
|
<input id="archlang-replay-t" type="range" min="0" max="1" step="0.001" value="0" aria-label="Replay position">
|
|
183
|
-
<div id="archlang-replay-views"></div>
|
|
189
|
+
<div id="archlang-replay-views"></div>${notices.length > 0 ? `
|
|
190
|
+
<div class="archlang-notices" role="note">
|
|
191
|
+
${notices.map((n) => `<p>${n.level === void 0 ? "" : `${noticeLevelLabel(n.level)} `}<code>${escapeHtml(n.code)}</code> ${escapeHtml(n.message)}</p>`).join("\n")}
|
|
192
|
+
</div>` : ""}
|
|
184
193
|
<p>${escapeHtml(PREVIEW_LABEL)}</p>
|
|
185
194
|
<p>${escapeHtml(PREVIEW_LIMITS)}</p>
|
|
186
195
|
</main>
|
package/dist/cli.js
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
DOOR_POSES,
|
|
4
4
|
adaptPlan,
|
|
5
5
|
buildMesh
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-CYSES7C3.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-
|
|
16
|
+
} from "./chunk-WOEJKIXN.js";
|
|
17
17
|
import {
|
|
18
18
|
ARCHLANG_3D_VERSION,
|
|
19
19
|
replayFacts
|
|
20
|
-
} from "./chunk-
|
|
21
|
-
import "./chunk-
|
|
20
|
+
} from "./chunk-33J3YGNF.js";
|
|
21
|
+
import "./chunk-VMVKI2WQ.js";
|
|
22
22
|
import {
|
|
23
23
|
storeysOf,
|
|
24
24
|
timeline,
|
|
25
25
|
viewLabel,
|
|
26
26
|
viewMesh
|
|
27
|
-
} from "./chunk-
|
|
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 {
|
|
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 {
|
|
2
|
+
import { RWall, Point, JoinedCut, loopsToPolygons, ResolvedPlan, World, Diagnostic } from '@chanmeng666/archlang';
|
|
3
3
|
export { Point } from '@chanmeng666/archlang';
|
|
4
|
-
import {
|
|
5
|
-
export { D as DoorKind, E as EXPLODE_GAP_MM,
|
|
6
|
-
export { F as FactsOptions, r as replayFacts } from './facts-
|
|
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-
|
|
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
|
|
152
|
-
*
|
|
153
|
-
* `
|
|
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.
|
|
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
|
-
/**
|
|
435
|
-
|
|
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
|
-
|
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import {
|
|
2
|
+
contactFade,
|
|
3
|
+
contactShadows
|
|
4
|
+
} from "./chunk-JQTG6BDR.js";
|
|
1
5
|
import {
|
|
2
6
|
CORE_POSTS_PER_RUN,
|
|
3
7
|
CORE_POST_PITCH_MM,
|
|
@@ -28,7 +32,7 @@ import {
|
|
|
28
32
|
stairRisers,
|
|
29
33
|
stairSolid,
|
|
30
34
|
storeyTrim
|
|
31
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-CYSES7C3.js";
|
|
32
36
|
import {
|
|
33
37
|
ARCHLANG_3D_VERSION,
|
|
34
38
|
FLOOR_LIFT_UM,
|
|
@@ -63,8 +67,9 @@ import {
|
|
|
63
67
|
umPoint,
|
|
64
68
|
validateScene3D,
|
|
65
69
|
wallOwnership
|
|
66
|
-
} from "./chunk-
|
|
70
|
+
} from "./chunk-33J3YGNF.js";
|
|
67
71
|
import {
|
|
72
|
+
CONTACT_SHADOW,
|
|
68
73
|
ELEVATION_AZIMUTH,
|
|
69
74
|
ELEVATION_RANGE,
|
|
70
75
|
END_AZIMUTH,
|
|
@@ -76,6 +81,7 @@ import {
|
|
|
76
81
|
FIXTURE_FAMILIES,
|
|
77
82
|
FLOOR_FINISHES,
|
|
78
83
|
FLOOR_FINISH_RULES,
|
|
84
|
+
FLOOR_WORD_FINISH,
|
|
79
85
|
GROUND_PLANE,
|
|
80
86
|
GROUND_ROUGHNESS,
|
|
81
87
|
GROUND_SPLITS,
|
|
@@ -98,6 +104,7 @@ import {
|
|
|
98
104
|
boxOfNodes,
|
|
99
105
|
cameraAtStop,
|
|
100
106
|
cameraStops,
|
|
107
|
+
contactBandMm,
|
|
101
108
|
corners,
|
|
102
109
|
coverage,
|
|
103
110
|
distanceLimits,
|
|
@@ -126,10 +133,12 @@ import {
|
|
|
126
133
|
targetBounds,
|
|
127
134
|
timeline,
|
|
128
135
|
viewLabel,
|
|
129
|
-
viewMesh
|
|
130
|
-
|
|
136
|
+
viewMesh,
|
|
137
|
+
wordFinish
|
|
138
|
+
} from "./chunk-LNIVDMPG.js";
|
|
131
139
|
export {
|
|
132
140
|
ARCHLANG_3D_VERSION,
|
|
141
|
+
CONTACT_SHADOW,
|
|
133
142
|
CORE_POSTS_PER_RUN,
|
|
134
143
|
CORE_POST_PITCH_MM,
|
|
135
144
|
DOOR_POSES,
|
|
@@ -149,6 +158,7 @@ export {
|
|
|
149
158
|
FLOOR_FINISH_RULES,
|
|
150
159
|
FLOOR_LIFT_UM,
|
|
151
160
|
FLOOR_OVERLAP_MIN_UM2,
|
|
161
|
+
FLOOR_WORD_FINISH,
|
|
152
162
|
FURNITURE_HEIGHT_MM,
|
|
153
163
|
GROUND_PLANE,
|
|
154
164
|
GROUND_ROUGHNESS,
|
|
@@ -188,6 +198,9 @@ export {
|
|
|
188
198
|
cameraAtStop,
|
|
189
199
|
cameraStops,
|
|
190
200
|
clipToConvex,
|
|
201
|
+
contactBandMm,
|
|
202
|
+
contactFade,
|
|
203
|
+
contactShadows,
|
|
191
204
|
corePostCount,
|
|
192
205
|
corners,
|
|
193
206
|
coverage,
|
|
@@ -252,5 +265,6 @@ export {
|
|
|
252
265
|
validateScene3D,
|
|
253
266
|
viewLabel,
|
|
254
267
|
viewMesh,
|
|
255
|
-
wallOwnership
|
|
268
|
+
wallOwnership,
|
|
269
|
+
wordFinish
|
|
256
270
|
};
|