@chanmeng666/archlang-3d 0.0.0-stage → 0.1.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 +36 -0
- package/LICENSE +22 -0
- package/README.md +83 -2
- package/THIRD_PARTY_NOTICES +975 -0
- package/dist/browser.d.ts +29 -0
- package/dist/browser.js +249 -0
- package/dist/chunk-2WKSS3IA.js +495 -0
- package/dist/chunk-54YVSAVZ.js +54 -0
- package/dist/chunk-CTFMM64C.js +435 -0
- package/dist/chunk-IQJQDQSC.js +950 -0
- package/dist/chunk-NADV4D3M.js +857 -0
- package/dist/cli.js +686 -0
- package/dist/facts-DMBpeo-q.d.ts +29 -0
- package/dist/index.d.ts +475 -0
- package/dist/index.js +130 -0
- package/dist/node.d.ts +130 -0
- package/dist/node.js +60 -0
- package/dist/replay.d.ts +62 -0
- package/dist/scene3d.schema.json +578 -0
- package/dist/strip-BMxWrvYD.d.ts +433 -0
- package/dist/viewer.iife.js +4220 -0
- package/package.json +82 -4
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [Unreleased]
|
|
4
|
+
|
|
5
|
+
## [0.1.0] - 2026-10-31
|
|
6
|
+
|
|
7
|
+
The first version on npm, published by hand. Versions from 0.1.1 on go through the release workflow
|
|
8
|
+
with provenance.
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- `archlang3d view <plan> --replay -o plan.html`: one offline HTML file in which the plan draws itself
|
|
13
|
+
in its authoring order, the core's own drawing fades in, then the walls, openings and furniture
|
|
14
|
+
rise. three.js 0.186.1 is inside the file with its licence notice. A line of plain facts from the
|
|
15
|
+
core's `describe()` and `lint()` sits over the picture. `--video out.mp4` renders a 15 s 1080p30
|
|
16
|
+
video through Playwright's Chromium and `ffmpeg`. `--theme`, `--storey`, `--seconds`, `--fps` and
|
|
17
|
+
`--size` change what it shows.
|
|
18
|
+
- `archlang3d build <plan> -o plan.glb`: a GLB with a `level:L<n>` node per storey and one named node
|
|
19
|
+
per mesh part, facts in `extras.archlang`. It writes nothing when a check fails, and the same plan
|
|
20
|
+
and versions give the same bytes.
|
|
21
|
+
- `archlang3d check <plan|model.glb>`: the scene schema, closed shells, Khronos glTF-Validator (0
|
|
22
|
+
errors, 0 warnings) and the node names against the plan.
|
|
23
|
+
- `archlang3d manifest --json`, `schema scene3d` and `doctor`, with `--json` and exit codes 0, 1, 2
|
|
24
|
+
and 3.
|
|
25
|
+
- `--doors plan`: hinged and double doors stand at the swing the core draws. Doors are closed by
|
|
26
|
+
default.
|
|
27
|
+
- Plan features carried through: curved walls to a chord tolerance (`--curve-tol`), demolished walls
|
|
28
|
+
as translucent ghosts, furniture in twelve families with a grey box for the rest, and warnings for
|
|
29
|
+
overlapping rooms and for walls of mixed height at a joint.
|
|
30
|
+
- The library: `.` (`adaptPlan`, Scene3D, `buildMesh`, the replay's timeline; works in a browser),
|
|
31
|
+
`./browser` (`mountReplay`, `replayPayload`, with three.js) and `./node` (`makeNodeWorld`,
|
|
32
|
+
`replayHtml`, `renderReplay`, `writeGlb`, the checks). `writeGlb(mesh, { generator })` sets
|
|
33
|
+
`asset.generator`, which is `archlang-3d <version>` by default.
|
|
34
|
+
- A plan that cannot be read is refused by name: `E3D_PLAN_ERRORS`, `E3D_NO_WALLS`, `E3D_CORE_TOO_OLD`.
|
|
35
|
+
- Reads `@chanmeng666/archlang` `^1.45.0` as a peer dependency. `three` and `earcut` are pinned
|
|
36
|
+
exactly, and every runtime dependency is listed in `THIRD_PARTY_NOTICES`.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Chan Meng
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
package/README.md
CHANGED
|
@@ -1,3 +1,84 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @chanmeng666/archlang-3d
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
3D preview of an [ArchLang](https://archlang.uk) floor plan: a separate package that reads the same
|
|
4
|
+
`.arch` source and is checked against the plan. ArchLang itself draws plans; this package leaves
|
|
5
|
+
your source and the core's drawing as they are.
|
|
6
|
+
|
|
7
|
+
From a plan it writes a replay (one HTML file: the plan draws itself, then the walls rise) and a GLB
|
|
8
|
+
for any glTF viewer.
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```sh
|
|
13
|
+
npm install @chanmeng666/archlang-3d @chanmeng666/archlang
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Needs Node 20 or newer. The core, `@chanmeng666/archlang`, is a peer dependency at `^1.45.0`. To
|
|
17
|
+
follow along, take a plan from the examples the core ships:
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
cp node_modules/@chanmeng666/archlang/examples/laneway-house.arch plan.arch
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Replay
|
|
24
|
+
|
|
25
|
+
```sh
|
|
26
|
+
npx archlang3d view plan.arch --replay -o plan.html
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
`plan.html` opens offline. three.js 0.186.1 is inside the file with its licence notice, and nothing
|
|
30
|
+
is fetched from a network. `--theme dark` and `--storey <n>` change what it shows.
|
|
31
|
+
|
|
32
|
+
To render a video as well, add a browser and `ffmpeg` on your `PATH`:
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
npx playwright-core install chromium
|
|
36
|
+
npx archlang3d view plan.arch --replay -o plan.html --video plan.mp4
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Playwright keeps its browsers in a cache shared by every project on the machine, and this install
|
|
40
|
+
can remove browser versions it considers unused.
|
|
41
|
+
|
|
42
|
+
`npx archlang3d doctor` reports what is installed.
|
|
43
|
+
|
|
44
|
+
## GLB
|
|
45
|
+
|
|
46
|
+
```sh
|
|
47
|
+
npx archlang3d build plan.arch -o plan.glb --json
|
|
48
|
+
npx archlang3d check plan.glb --json
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
`build` runs its checks before it writes, and writes nothing when one fails. They hold the GLB to the
|
|
52
|
+
plan: its nodes are the ones built from the plan, each named for its element (`wall:<id>`, `door:<id>`,
|
|
53
|
+
under a `level:L<n>` node, with its facts in `extras.archlang`), the shells are closed, and Khronos
|
|
54
|
+
glTF-Validator reports 0 errors and 0 warnings. The same plan and versions give the same bytes.
|
|
55
|
+
|
|
56
|
+
What a plan does not state is assumed, and `--json` lists each value under `assumptions`. Doors are
|
|
57
|
+
closed unless you pass `--doors plan`. This is a preview of the plan, not a design or construction
|
|
58
|
+
document.
|
|
59
|
+
|
|
60
|
+
`npx archlang3d manifest --json` lists every command and flag, and `npx archlang3d schema scene3d`
|
|
61
|
+
prints the Scene3D JSON Schema. Exit codes: `0` ok, `1` IO or environment, `2` the plan is refused or
|
|
62
|
+
a check failed, `3` bad usage.
|
|
63
|
+
|
|
64
|
+
## Library
|
|
65
|
+
|
|
66
|
+
```js
|
|
67
|
+
import { readFileSync, writeFileSync } from "node:fs";
|
|
68
|
+
import { adaptPlan, buildMesh } from "@chanmeng666/archlang-3d";
|
|
69
|
+
import { makeNodeWorld, writeGlb } from "@chanmeng666/archlang-3d/node";
|
|
70
|
+
|
|
71
|
+
const result = adaptPlan(readFileSync("plan.arch", "utf8"), { world: makeNodeWorld(".") });
|
|
72
|
+
if (!result.ok) throw new Error(result.refusal.code); // E3D_PLAN_ERRORS, E3D_NO_WALLS, E3D_CORE_TOO_OLD
|
|
73
|
+
writeFileSync("plan.glb", await writeGlb(buildMesh(result.scene)));
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
| Entry | For | Holds |
|
|
77
|
+
|---|---|---|
|
|
78
|
+
| `@chanmeng666/archlang-3d` | Node and browsers | `adaptPlan`, Scene3D, `buildMesh`, the replay's timeline |
|
|
79
|
+
| `@chanmeng666/archlang-3d/browser` | browsers, with three.js | `mountReplay(canvas, payload)`, `replayPayload` |
|
|
80
|
+
| `@chanmeng666/archlang-3d/node` | Node | `makeNodeWorld`, `replayHtml`, `renderReplay`, `writeGlb`, the checks |
|
|
81
|
+
|
|
82
|
+
## Licence
|
|
83
|
+
|
|
84
|
+
MIT. Every runtime dependency is listed with its licence in `THIRD_PARTY_NOTICES`.
|