@chanmeng666/archlang-3d 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +92 -0
- package/README.md +14 -3
- package/dist/browser.d.ts +38 -6
- package/dist/browser.js +82 -21
- package/dist/{camera-CLNYQ1Xv.d.ts → camera-DVOiag0F.d.ts} +21 -5
- package/dist/{chunk-WBA4LABI.js → chunk-4SQ5YKKX.js} +70 -10
- package/dist/{chunk-VPYTRKMK.js → chunk-EQBMPXB5.js} +24 -4
- package/dist/{chunk-QUSG4UCO.js → chunk-L2CX7KWM.js} +278 -22
- package/dist/{chunk-ZE4PL6KP.js → chunk-OWZWBKMI.js} +107 -38
- package/dist/{chunk-PRZXP6FP.js → chunk-WCWLYIVD.js} +45 -4
- package/dist/cli.js +6 -6
- package/dist/{facts-B47HOKOh.d.ts → facts-BRIFxHL_.d.ts} +1 -1
- package/dist/index.d.ts +46 -7
- package/dist/index.js +14 -4
- package/dist/node.d.ts +17 -7
- package/dist/node.js +10 -4
- package/dist/replay.d.ts +31 -8
- package/dist/scene3d.schema.json +63 -0
- package/dist/{strip-CN_dTKqy.d.ts → strip-Nt7eJ-4E.d.ts} +59 -5
- package/dist/viewer.iife.js +170 -170
- package/package.json +5 -4
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ARCHLANG_3D_VERSION,
|
|
3
3
|
validateScene3D
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-WCWLYIVD.js";
|
|
5
5
|
import {
|
|
6
6
|
PREVIEW_LABEL,
|
|
7
|
+
PREVIEW_LIMITS,
|
|
7
8
|
VIEW_CONTROLS_LABEL,
|
|
8
9
|
replayPayload
|
|
9
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-4SQ5YKKX.js";
|
|
10
11
|
import {
|
|
11
12
|
FINISH_PALETTE,
|
|
12
13
|
FLOOR_FINISHES,
|
|
@@ -15,18 +16,98 @@ import {
|
|
|
15
16
|
keyFrames,
|
|
16
17
|
linearRgb,
|
|
17
18
|
slotGroups
|
|
18
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-EQBMPXB5.js";
|
|
19
20
|
|
|
20
|
-
// src/
|
|
21
|
-
import { readFileSync
|
|
22
|
-
import { resolve } from "node:path";
|
|
21
|
+
// src/world.ts
|
|
22
|
+
import { readFileSync, realpathSync, statSync } from "node:fs";
|
|
23
|
+
import { dirname, isAbsolute, relative, resolve } from "node:path";
|
|
24
|
+
import { utf8ByteLength } from "@chanmeng666/archlang";
|
|
25
|
+
var MODULE_CAP_BYTES = 1024 * 1024;
|
|
26
|
+
function isWithin(root, child) {
|
|
27
|
+
const rel = relative(root, child);
|
|
28
|
+
if (rel === "") return true;
|
|
29
|
+
return rel !== ".." && !rel.startsWith("../") && !rel.startsWith("..\\") && !isAbsolute(rel);
|
|
30
|
+
}
|
|
31
|
+
var realOrNull = (p) => {
|
|
32
|
+
try {
|
|
33
|
+
return realpathSync(p);
|
|
34
|
+
} catch {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
function nearestRealAncestor(p) {
|
|
39
|
+
for (let at = dirname(p); ; at = dirname(at)) {
|
|
40
|
+
const real = realOrNull(at);
|
|
41
|
+
if (real !== null) return real;
|
|
42
|
+
if (dirname(at) === at) return null;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
function makeNodeWorld(baseDir, root = process.cwd()) {
|
|
46
|
+
const roots = [resolve(root), resolve(baseDir)].flatMap((r) => {
|
|
47
|
+
const real = realOrNull(r);
|
|
48
|
+
return real === null ? [] : [{ lexical: r, real }];
|
|
49
|
+
});
|
|
50
|
+
const refusals = /* @__PURE__ */ new Map();
|
|
51
|
+
const outside = (path) => ({
|
|
52
|
+
code: "E_IMPORT_OUTSIDE_ROOT",
|
|
53
|
+
message: `Imported module "${path}" is outside the import root (the working directory) and the plan's own directory; run archlang3d from a directory that contains it`
|
|
54
|
+
});
|
|
55
|
+
const notArch = (path) => ({
|
|
56
|
+
code: "E_IMPORT_NOT_ARCH",
|
|
57
|
+
message: `Imported module "${path}" is not an .arch file`
|
|
58
|
+
});
|
|
59
|
+
const inRoot = (abs) => roots.some((r) => isWithin(r.lexical, abs) || isWithin(r.real, abs));
|
|
60
|
+
const inRealRoot = (real) => roots.some((r) => isWithin(r.real, real));
|
|
61
|
+
const isArch = (p) => /\.arch$/i.test(p);
|
|
62
|
+
const attempt = (path) => {
|
|
63
|
+
if (path.includes("\0")) return null;
|
|
64
|
+
const abs = resolve(baseDir, path);
|
|
65
|
+
if (!inRoot(abs)) return outside(path);
|
|
66
|
+
if (!isArch(abs)) return notArch(path);
|
|
67
|
+
const real = realOrNull(abs);
|
|
68
|
+
if (real === null) {
|
|
69
|
+
const ancestor = nearestRealAncestor(abs);
|
|
70
|
+
return ancestor !== null && inRealRoot(ancestor) ? null : outside(path);
|
|
71
|
+
}
|
|
72
|
+
if (!inRealRoot(real)) return outside(path);
|
|
73
|
+
if (!isArch(real)) return notArch(path);
|
|
74
|
+
const st = statSync(real);
|
|
75
|
+
if (!st.isFile()) return null;
|
|
76
|
+
const tooLarge = () => ({
|
|
77
|
+
code: "E_IMPORT_TOO_LARGE",
|
|
78
|
+
message: `Imported module "${path}" is larger than ${String(MODULE_CAP_BYTES)} bytes`
|
|
79
|
+
});
|
|
80
|
+
if (st.size > MODULE_CAP_BYTES) return tooLarge();
|
|
81
|
+
const text = readFileSync(real, "utf8");
|
|
82
|
+
return utf8ByteLength(text) > MODULE_CAP_BYTES ? tooLarge() : text;
|
|
83
|
+
};
|
|
84
|
+
const world = {
|
|
85
|
+
read(path) {
|
|
86
|
+
let r;
|
|
87
|
+
try {
|
|
88
|
+
r = attempt(path);
|
|
89
|
+
} catch {
|
|
90
|
+
r = null;
|
|
91
|
+
}
|
|
92
|
+
if (typeof r === "string") {
|
|
93
|
+
refusals.delete(path);
|
|
94
|
+
return r;
|
|
95
|
+
}
|
|
96
|
+
if (r) refusals.set(path, r);
|
|
97
|
+
else refusals.delete(path);
|
|
98
|
+
return null;
|
|
99
|
+
},
|
|
100
|
+
refusal: (path) => refusals.get(path)
|
|
101
|
+
};
|
|
102
|
+
return world;
|
|
103
|
+
}
|
|
23
104
|
|
|
24
105
|
// src/replay/html.ts
|
|
25
|
-
import { existsSync, readFileSync } from "node:fs";
|
|
106
|
+
import { existsSync, readFileSync as readFileSync2 } from "node:fs";
|
|
26
107
|
import { createRequire } from "node:module";
|
|
27
|
-
import { dirname, join } from "node:path";
|
|
108
|
+
import { dirname as dirname2, join } from "node:path";
|
|
28
109
|
import { fileURLToPath } from "node:url";
|
|
29
|
-
var HERE =
|
|
110
|
+
var HERE = dirname2(fileURLToPath(import.meta.url));
|
|
30
111
|
var require2 = createRequire(import.meta.url);
|
|
31
112
|
var bundled;
|
|
32
113
|
async function loadViewer() {
|
|
@@ -34,7 +115,7 @@ async function loadViewer() {
|
|
|
34
115
|
const { bundleViewer } = await null;
|
|
35
116
|
return bundleViewer(join(HERE, "viewer.ts"));
|
|
36
117
|
}
|
|
37
|
-
return
|
|
118
|
+
return readFileSync2(join(HERE, "viewer.iife.js"), "utf8");
|
|
38
119
|
}
|
|
39
120
|
function viewerScript() {
|
|
40
121
|
bundled ??= loadViewer().catch((e) => {
|
|
@@ -44,15 +125,15 @@ function viewerScript() {
|
|
|
44
125
|
return bundled;
|
|
45
126
|
}
|
|
46
127
|
function threeLicence() {
|
|
47
|
-
let dir =
|
|
128
|
+
let dir = dirname2(require2.resolve("three"));
|
|
48
129
|
while (!existsSync(join(dir, "package.json")) || !existsSync(join(dir, "LICENSE"))) {
|
|
49
|
-
const up =
|
|
130
|
+
const up = dirname2(dir);
|
|
50
131
|
if (up === dir) throw new Error("three.js's LICENSE was not found beside its package.json");
|
|
51
132
|
dir = up;
|
|
52
133
|
}
|
|
53
|
-
const version = JSON.parse(
|
|
134
|
+
const version = JSON.parse(readFileSync2(join(dir, "package.json"), "utf8")).version;
|
|
54
135
|
return `three.js ${version}
|
|
55
|
-
${
|
|
136
|
+
${readFileSync2(join(dir, "LICENSE"), "utf8")}`;
|
|
56
137
|
}
|
|
57
138
|
var escapeHtml = (s) => s.replace(/[&<>"]/g, (c) => ({ "&": "&", "<": "<", ">": ">", '"': """ })[c]);
|
|
58
139
|
async function replayHtml(mesh, opts) {
|
|
@@ -97,6 +178,7 @@ canvas:focus-visible{outline:2px solid ${fg};outline-offset:2px}
|
|
|
97
178
|
<input id="archlang-replay-t" type="range" min="0" max="1" step="0.001" value="0" aria-label="Replay position">
|
|
98
179
|
<div id="archlang-replay-views"></div>
|
|
99
180
|
<p>${escapeHtml(PREVIEW_LABEL)}</p>
|
|
181
|
+
<p>${escapeHtml(PREVIEW_LIMITS)}</p>
|
|
100
182
|
</main>
|
|
101
183
|
<script type="application/json" id="archlang-replay-payload">${json}</script>
|
|
102
184
|
<script>${script}</script>
|
|
@@ -121,20 +203,20 @@ var SWIFTSHADER_ARGS = [
|
|
|
121
203
|
];
|
|
122
204
|
|
|
123
205
|
// src/replay/video.ts
|
|
206
|
+
function seekOnly(html) {
|
|
207
|
+
return html.replace(
|
|
208
|
+
'<script type="application/json"',
|
|
209
|
+
// No scrollbar may shift the canvas between frames.
|
|
210
|
+
'<style>html,body{overflow:hidden}</style><script>window.__replayAutoplay=false</script>\n<script type="application/json"'
|
|
211
|
+
);
|
|
212
|
+
}
|
|
124
213
|
async function renderReplay(o) {
|
|
125
214
|
const fps = o.fps ?? 30;
|
|
126
215
|
const seconds = o.seconds ?? 15;
|
|
127
216
|
const frames = Math.round(fps * seconds);
|
|
128
217
|
const dir = mkdtempSync(join2(tmpdir(), "archlang3d-replay-"));
|
|
129
218
|
const file = join2(dir, "replay.html");
|
|
130
|
-
writeFileSync(
|
|
131
|
-
file,
|
|
132
|
-
o.html.replace(
|
|
133
|
-
'<script type="application/json"',
|
|
134
|
-
// No scrollbar may shift the canvas between frames.
|
|
135
|
-
'<style>html,body{overflow:hidden}</style><script>window.__replayAutoplay=false</script>\n<script type="application/json"'
|
|
136
|
-
)
|
|
137
|
-
);
|
|
219
|
+
writeFileSync(file, seekOnly(o.html));
|
|
138
220
|
const { chromium } = await import("playwright-core");
|
|
139
221
|
const browser = await chromium.launch({ args: SWIFTSHADER_ARGS });
|
|
140
222
|
try {
|
|
@@ -183,7 +265,7 @@ async function renderReplay(o) {
|
|
|
183
265
|
"-pix_fmt",
|
|
184
266
|
"yuv420p",
|
|
185
267
|
"-crf",
|
|
186
|
-
|
|
268
|
+
String(o.crf ?? 18),
|
|
187
269
|
"-movflags",
|
|
188
270
|
"+faststart",
|
|
189
271
|
o.mp4
|
|
@@ -485,20 +567,8 @@ async function checkGlb(glb, mesh) {
|
|
|
485
567
|
return out;
|
|
486
568
|
}
|
|
487
569
|
|
|
488
|
-
// src/node.ts
|
|
489
|
-
function makeNodeWorld(baseDir) {
|
|
490
|
-
return {
|
|
491
|
-
read: (p) => {
|
|
492
|
-
try {
|
|
493
|
-
return readFileSync2(resolve(baseDir, p), "utf8");
|
|
494
|
-
} catch {
|
|
495
|
-
return null;
|
|
496
|
-
}
|
|
497
|
-
}
|
|
498
|
-
};
|
|
499
|
-
}
|
|
500
|
-
|
|
501
570
|
export {
|
|
571
|
+
makeNodeWorld,
|
|
502
572
|
viewerScript,
|
|
503
573
|
replayHtml,
|
|
504
574
|
SWIFTSHADER_ARGS,
|
|
@@ -518,6 +588,5 @@ export {
|
|
|
518
588
|
checkNaming,
|
|
519
589
|
glbJson,
|
|
520
590
|
checkValidator,
|
|
521
|
-
checkGlb
|
|
522
|
-
makeNodeWorld
|
|
591
|
+
checkGlb
|
|
523
592
|
};
|
|
@@ -3571,12 +3571,14 @@ function floorLifts(floors, overlaps) {
|
|
|
3571
3571
|
}
|
|
3572
3572
|
|
|
3573
3573
|
// package.json
|
|
3574
|
-
var version = "0.
|
|
3574
|
+
var version = "0.5.0";
|
|
3575
3575
|
|
|
3576
3576
|
// src/scene3d/build.ts
|
|
3577
|
+
import * as core2 from "@chanmeng666/archlang";
|
|
3577
3578
|
import {
|
|
3578
3579
|
doorLeaves,
|
|
3579
|
-
doorSwing
|
|
3580
|
+
doorSwing,
|
|
3581
|
+
entryEdges
|
|
3580
3582
|
} from "@chanmeng666/archlang";
|
|
3581
3583
|
|
|
3582
3584
|
// src/curves.ts
|
|
@@ -3673,12 +3675,32 @@ var fenceOf = (f) => ({
|
|
|
3673
3675
|
points: f.points.map(umPoint),
|
|
3674
3676
|
closed: f.closed
|
|
3675
3677
|
});
|
|
3678
|
+
var OPPOSITE = { top: "bottom", bottom: "top", left: "right", right: "left" };
|
|
3679
|
+
function stairPieces(s) {
|
|
3680
|
+
const treadCount3 = core2.treadCount;
|
|
3681
|
+
if (typeof treadCount3 !== "function") return void 0;
|
|
3682
|
+
const flight = (at, size, tail2) => ({
|
|
3683
|
+
at: umPoint(at),
|
|
3684
|
+
size: { w: um2(size.w), h: um2(size.h) },
|
|
3685
|
+
foot: s.dir === "up" ? tail2 : OPPOSITE[tail2],
|
|
3686
|
+
treads: treadCount3(tail2 === "top" || tail2 === "bottom" ? size.h : size.w)
|
|
3687
|
+
});
|
|
3688
|
+
if (s.flights && s.landings) {
|
|
3689
|
+
return {
|
|
3690
|
+
flights: s.flights.map((f) => flight(f.at, f.size, f.tail)),
|
|
3691
|
+
landings: s.landings.map((l) => ({ at: umPoint(l.at), size: { w: um2(l.size.w), h: um2(l.size.h) } }))
|
|
3692
|
+
};
|
|
3693
|
+
}
|
|
3694
|
+
const tail = entryEdges(s)[0];
|
|
3695
|
+
return tail ? { flights: [flight(s.at, s.size, tail)], landings: [] } : void 0;
|
|
3696
|
+
}
|
|
3676
3697
|
var stairOf = (s) => ({
|
|
3677
3698
|
id: s.id,
|
|
3678
3699
|
source: source(s),
|
|
3679
3700
|
box: box(s),
|
|
3680
3701
|
dir: s.dir,
|
|
3681
|
-
width: um2(s.width)
|
|
3702
|
+
width: um2(s.width),
|
|
3703
|
+
...stairPieces(s)
|
|
3682
3704
|
});
|
|
3683
3705
|
function wallsAndOpenings(ir, byId, tol) {
|
|
3684
3706
|
const own = wallOwnership(ir.walls, (loops) => tessellateLoops(loops, tol));
|
|
@@ -3940,6 +3962,9 @@ var object = (required, optional = {}) => (v, p, out) => {
|
|
|
3940
3962
|
if (!(k in required) && !(k in optional)) fail(out, `${p}/${k}`, "is not a Scene3D field");
|
|
3941
3963
|
}
|
|
3942
3964
|
};
|
|
3965
|
+
var treadCount2 = (v, p, out) => {
|
|
3966
|
+
if (!Number.isInteger(v) || v < 1) fail(out, p, "must be an integer of at least 1");
|
|
3967
|
+
};
|
|
3943
3968
|
var pt = array(integer, 2, 2);
|
|
3944
3969
|
var ring2 = array(pt, 3);
|
|
3945
3970
|
var polygon2 = object({ outer: ring2 }, { holes: array(ring2) });
|
|
@@ -3991,7 +4016,23 @@ var LEVEL_COLLECTIONS = {
|
|
|
3991
4016
|
{ room: string, mirror: oneOf(true) }
|
|
3992
4017
|
)
|
|
3993
4018
|
),
|
|
3994
|
-
stairs: array(
|
|
4019
|
+
stairs: array(
|
|
4020
|
+
object(
|
|
4021
|
+
{ id, source: source2, box: box2, dir: oneOf("up", "down"), width: integer },
|
|
4022
|
+
{
|
|
4023
|
+
flights: array(
|
|
4024
|
+
object({
|
|
4025
|
+
at: pt,
|
|
4026
|
+
size: sized("w", "h"),
|
|
4027
|
+
foot: oneOf("top", "bottom", "left", "right"),
|
|
4028
|
+
treads: treadCount2
|
|
4029
|
+
}),
|
|
4030
|
+
1
|
|
4031
|
+
),
|
|
4032
|
+
landings: array(object({ at: pt, size: sized("w", "h") }))
|
|
4033
|
+
}
|
|
4034
|
+
)
|
|
4035
|
+
),
|
|
3995
4036
|
voids: array(box2),
|
|
3996
4037
|
columns: array(box2),
|
|
3997
4038
|
outdoor: array(object({ id, source: source2, surface: string, polygon: polygon2 }, { rail: array(string) })),
|
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-L2CX7KWM.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-OWZWBKMI.js";
|
|
17
17
|
import {
|
|
18
18
|
ARCHLANG_3D_VERSION,
|
|
19
19
|
replayFacts
|
|
20
|
-
} from "./chunk-
|
|
21
|
-
import "./chunk-
|
|
20
|
+
} from "./chunk-WCWLYIVD.js";
|
|
21
|
+
import "./chunk-4SQ5YKKX.js";
|
|
22
22
|
import {
|
|
23
23
|
storeysOf,
|
|
24
24
|
timeline,
|
|
25
25
|
viewLabel,
|
|
26
26
|
viewMesh
|
|
27
|
-
} from "./chunk-
|
|
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:
|
|
273
|
+
stair: ids("stair")
|
|
274
274
|
}
|
|
275
275
|
};
|
|
276
276
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { World } from '@chanmeng666/archlang';
|
|
2
|
-
import {
|
|
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
|
|
4
|
-
export { D as DoorKind, E as EXPLODE_GAP_MM,
|
|
5
|
-
export { F as FactsOptions, r as replayFacts } from './facts-
|
|
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
|
|
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
|
|
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.
|
|
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
|
-
|
|
9
|
+
slabRegion,
|
|
10
|
+
stairRisers,
|
|
11
|
+
stairSolid
|
|
12
|
+
} from "./chunk-L2CX7KWM.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-
|
|
47
|
+
} from "./chunk-WCWLYIVD.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-
|
|
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,20 @@
|
|
|
1
1
|
import { World } from '@chanmeng666/archlang';
|
|
2
|
-
import { M as Mesh3D,
|
|
3
|
-
export { R as ReplayFacts, S as StripItem, s as stripAt } from './strip-
|
|
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-
|
|
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
|
+
|
|
8
|
+
/**
|
|
9
|
+
* A World that reads an `import`ed module relative to `baseDir` (the plan's own directory). It is
|
|
10
|
+
* ROOTED: a module is read only when its real path (symbolic links and junctions followed) lies
|
|
11
|
+
* under `root` (default: the working directory) or under `baseDir`, ends in `.arch`, and is at most
|
|
12
|
+
* {@link MODULE_CAP_BYTES}. A refused module reads as `null` and `refusal` names the code
|
|
13
|
+
* (`E_IMPORT_OUTSIDE_ROOT`, `E_IMPORT_NOT_ARCH`, `E_IMPORT_TOO_LARGE`), which the core reports at
|
|
14
|
+
* the `import`; a module missing inside the roots is the core's `E_IMPORT_NOT_FOUND`. A path whose
|
|
15
|
+
* written form leaves the roots is refused before the file system is touched.
|
|
16
|
+
*/
|
|
17
|
+
declare function makeNodeWorld(baseDir: string, root?: string): World;
|
|
7
18
|
|
|
8
19
|
/** The viewer and the parts of three.js it uses, as one minified browser script (read once). */
|
|
9
20
|
declare function viewerScript(): Promise<string>;
|
|
@@ -48,6 +59,8 @@ interface VideoOptions {
|
|
|
48
59
|
/** Where to write the MP4; omit to measure the key frames only. */
|
|
49
60
|
mp4?: string;
|
|
50
61
|
ffmpeg?: string;
|
|
62
|
+
/** libx264's constant rate factor for the MP4 (default 18; 0 is lossless: a master to re-encode). */
|
|
63
|
+
crf?: number;
|
|
51
64
|
}
|
|
52
65
|
/** Render key frames (and, given `mp4`, every frame) of a replay HTML in headless Chromium. */
|
|
53
66
|
declare function renderReplay(o: VideoOptions): Promise<VideoReport>;
|
|
@@ -130,7 +143,4 @@ declare function checkValidator(glb: Uint8Array): Promise<CheckResult>;
|
|
|
130
143
|
/** Every check a GLB alone allows (`archlang3d check model.glb`); given its Mesh3D, the node sets are compared. */
|
|
131
144
|
declare function checkGlb(glb: Uint8Array, mesh?: Mesh3D): Promise<CheckResult[]>;
|
|
132
145
|
|
|
133
|
-
/** A World that reads an `import`ed module relative to `baseDir`; a missing file reads as `null`. */
|
|
134
|
-
declare function makeNodeWorld(baseDir: string): World;
|
|
135
|
-
|
|
136
146
|
export { type CheckId, type CheckResult, GLB_GENERATOR, type GlbNode, type KeyFrame, ReplayOptions, SWIFTSHADER_ARGS, type VideoOptions, type VideoReport, bodyMaterialName, checkGlb, checkNaming, checkScene, checkShells, checkValidator, glbJson, glbLeaks, glbNodeName, levelNodeName, makeNodeWorld, nodeExtras, openEdges, readGlbNodes, renderReplay, replayHtml, signedVolume, viewerScript, writeGlb };
|
package/dist/node.js
CHANGED
|
@@ -20,21 +20,27 @@ import {
|
|
|
20
20
|
signedVolume,
|
|
21
21
|
viewerScript,
|
|
22
22
|
writeGlb
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-OWZWBKMI.js";
|
|
24
24
|
import {
|
|
25
25
|
replayFacts
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-WCWLYIVD.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-
|
|
34
|
+
} from "./chunk-4SQ5YKKX.js";
|
|
32
35
|
import {
|
|
33
36
|
stripAt
|
|
34
|
-
} from "./chunk-
|
|
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,
|
package/dist/replay.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { g as MaterialSlot, n as FloorFinish, R as ReplayFacts, y as ReplayEvent, M as Mesh3D } from './strip-Nt7eJ-4E.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* The replay's data (card A3), browser-safe: `replayPayload(mesh, opts)` is what a replay carries
|
|
@@ -10,7 +10,10 @@ interface ReplayNode {
|
|
|
10
10
|
key: string;
|
|
11
11
|
kind: string;
|
|
12
12
|
part?: string;
|
|
13
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* The combined view's exploded storeys: how far (mm) the node is lifted while the storeys rise;
|
|
15
|
+
* absent = 0. It settles to 0 by the end (`settledLift`).
|
|
16
|
+
*/
|
|
14
17
|
lift?: number;
|
|
15
18
|
/** Flat `[x, y, z, …]` in micrometres, exporters' axes (X plan x, Y up, Z plan y). */
|
|
16
19
|
positions: number[];
|
|
@@ -43,9 +46,28 @@ interface ReplayPayload {
|
|
|
43
46
|
nodes: ReplayNode[];
|
|
44
47
|
events: ReplayEvent[];
|
|
45
48
|
}
|
|
46
|
-
/**
|
|
47
|
-
|
|
48
|
-
|
|
49
|
+
/**
|
|
50
|
+
* The line every surface that shows the preview carries (public-surfaces PS-D12, owner ruling
|
|
51
|
+
* PS-D11, `docs/plans/public-surfaces/3d.md` §2; it replaced decision D5's label). `PREVIEW_LEAD`
|
|
52
|
+
* is its first sentence, which a host may set in bold. The plan's full line adds "You can also
|
|
53
|
+
* download it as a validated GLB." where a surface offers the download.
|
|
54
|
+
*
|
|
55
|
+
* What "checked against the plan" means, as the line says it: every 3D element comes from the
|
|
56
|
+
* plan's elements (each Scene3D record carries the `source` naming its plan element, required by
|
|
57
|
+
* the schema, V-SCH-01 in `check/verify.ts`; the slab and a default roof come from the storey's
|
|
58
|
+
* rooms and walls; V-GLTF-02 holds the GLB's nodes to the Mesh3D's, each named `<kind>:<id>`), and
|
|
59
|
+
* every solid is closed (V-GEO-02, `openEdges` in `check/verify.ts`: every shell closed,
|
|
60
|
+
* consistently wound, of positive volume). `build` writes nothing when a check fails.
|
|
61
|
+
*/
|
|
62
|
+
declare const PREVIEW_LEAD = "Same source, plan and 3D preview.";
|
|
63
|
+
declare const 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.";
|
|
64
|
+
/**
|
|
65
|
+
* The limits line, always near a 3D view (PS-D12). It states what the package builds today
|
|
66
|
+
* (`3d.md` §3): change it when the package changes.
|
|
67
|
+
*/
|
|
68
|
+
declare const PREVIEW_LIMITS = "3D preview: walls, openings, floors, stairs and furniture in flat colours; no pitched roofs yet, and no sections, elevations or BIM.";
|
|
69
|
+
/** The page that says what the 3D preview shows and does not (the docs site's `/3d`). */
|
|
70
|
+
declare const PREVIEW_ABOUT_URL = "https://archlang.uk/3d";
|
|
49
71
|
interface ReplayOptions {
|
|
50
72
|
title: string;
|
|
51
73
|
/**
|
|
@@ -65,9 +87,10 @@ interface ReplayOptions {
|
|
|
65
87
|
declare function viewBoxOf(svg: string): [number, number, number, number];
|
|
66
88
|
/**
|
|
67
89
|
* The data a replay HTML carries for `mesh`: pass `viewMesh(mesh, view)` for one view. A mesh of
|
|
68
|
-
* more than one storey is the combined view: its storeys are exploded (`explodeLifts`)
|
|
69
|
-
*
|
|
90
|
+
* more than one storey is the combined view: its storeys are exploded (`explodeLifts`) while they
|
|
91
|
+
* rise and come down to their real heights by the end (`stateAt`'s `settle`), and the end camera
|
|
92
|
+
* looks down at 45° (`endElevation`).
|
|
70
93
|
*/
|
|
71
94
|
declare function replayPayload(mesh: Mesh3D, opts: ReplayOptions): ReplayPayload;
|
|
72
95
|
|
|
73
|
-
export { PREVIEW_LABEL, type ReplayNode, type ReplayOptions, type ReplayPayload, replayPayload, viewBoxOf };
|
|
96
|
+
export { PREVIEW_ABOUT_URL, PREVIEW_LABEL, PREVIEW_LEAD, PREVIEW_LIMITS, type ReplayNode, type ReplayOptions, type ReplayPayload, replayPayload, viewBoxOf };
|