@chanmeng666/archlang-3d 0.2.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chanmeng666/archlang-3d",
3
- "version": "0.2.0",
3
+ "version": "0.4.0",
4
4
  "description": "3D preview of an ArchLang floor plan: a separate package that reads the same .arch source and is checked against the plan.",
5
5
  "keywords": [
6
6
  "archlang",
@@ -62,10 +62,11 @@
62
62
  "archlang3d": "tsx src/cli/main.ts",
63
63
  "notices": "tsx scripts/licence-gate.ts --write",
64
64
  "prove:pack": "tsx scripts/prove-pack.ts",
65
+ "gen:3d-assets": "tsx scripts/gen-3d-assets.ts",
65
66
  "prepack": "npm run build"
66
67
  },
67
68
  "peerDependencies": {
68
- "@chanmeng666/archlang": "^1.45.0"
69
+ "@chanmeng666/archlang": "^1.57.0"
69
70
  },
70
71
  "dependencies": {
71
72
  "@gltf-transform/core": "4.5.1",
@@ -1,66 +0,0 @@
1
- import {
2
- FLOOR_FINISHES,
3
- endElevation,
4
- explodeLifts,
5
- slotGroups,
6
- storeysOf,
7
- timeline
8
- } from "./chunk-EYEEIS4R.js";
9
-
10
- // src/replay/payload.ts
11
- var PREVIEW_LABEL = "Preview \u2014 from the separate archlang-3d package. ArchLang itself draws plans.";
12
- function viewBoxOf(svg) {
13
- const m = /viewBox="([-\d.\s]+)"/.exec(svg);
14
- const v = (m?.[1] ?? "").trim().split(/\s+/).map(Number);
15
- if (v.length !== 4 || v.some((x) => !Number.isFinite(x))) throw new Error("the drawing has no numeric viewBox");
16
- return v;
17
- }
18
- function replayPayload(mesh, opts) {
19
- const lifts = explodeLifts(mesh);
20
- return {
21
- title: opts.title,
22
- theme: opts.theme ?? "light",
23
- width: opts.width ?? 1920,
24
- height: opts.height ?? 1080,
25
- seconds: opts.seconds ?? 15,
26
- svg: opts.svg,
27
- viewBox: viewBoxOf(opts.svg),
28
- elevation: endElevation(storeysOf(mesh).length),
29
- ...opts.facts ? { facts: opts.facts } : {},
30
- nodes: mesh.nodes.filter((n) => !n.hidden).map((n) => {
31
- const positions = [];
32
- const indices = [];
33
- const slotted = n.shells.some((s) => s.slot !== void 0);
34
- const groups = slotted ? slotGroups(n.shells) : [{ slot: "body", shells: n.shells }];
35
- const runs = [];
36
- for (const g of groups) {
37
- const start = indices.length;
38
- for (const s of g.shells) {
39
- const base = positions.length / 3;
40
- positions.push(...s.positions);
41
- for (const i of s.indices) indices.push(base + i);
42
- }
43
- runs.push({ slot: g.slot, count: indices.length - start });
44
- }
45
- const lift = lifts.get(n.level) ?? 0;
46
- const finish = FLOOR_FINISHES.find((f) => f === n.extras.finish);
47
- return {
48
- key: n.key,
49
- kind: n.kind,
50
- ...n.part ? { part: n.part } : {},
51
- ...lift !== 0 ? { lift } : {},
52
- positions,
53
- indices,
54
- ...slotted ? { groups: runs } : {},
55
- ...n.kind === "floor" && finish ? { finish } : {}
56
- };
57
- }),
58
- events: timeline(mesh)
59
- };
60
- }
61
-
62
- export {
63
- PREVIEW_LABEL,
64
- viewBoxOf,
65
- replayPayload
66
- };