@chanmeng666/archlang-3d 0.1.2 → 0.3.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 +75 -0
- package/dist/browser.d.ts +90 -5
- package/dist/browser.js +348 -69
- package/dist/camera-CLNYQ1Xv.d.ts +211 -0
- package/dist/chunk-PRZXP6FP.js +4129 -0
- package/dist/{chunk-DLZMYNAR.js → chunk-QUSG4UCO.js} +104 -267
- package/dist/{chunk-CTFMM64C.js → chunk-VPYTRKMK.js} +169 -2
- package/dist/chunk-WBA4LABI.js +137 -0
- package/dist/{chunk-KIRWFAD6.js → chunk-ZE4PL6KP.js} +61 -33
- package/dist/cli.js +5 -5
- package/dist/{facts-fLIb8sZ2.d.ts → facts-B47HOKOh.d.ts} +1 -1
- package/dist/index.d.ts +153 -168
- package/dist/index.js +69 -11
- package/dist/node.d.ts +10 -4
- package/dist/node.js +6 -4
- package/dist/replay.d.ts +12 -1
- package/dist/scene3d.schema.json +4 -0
- package/dist/{strip-DElA8ZbJ.d.ts → strip-CN_dTKqy.d.ts} +102 -1
- package/dist/viewer.iife.js +178 -178
- package/package.json +1 -1
- package/dist/chunk-54YVSAVZ.js +0 -54
- package/dist/chunk-PJMKP2ML.js +0 -950
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,81 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [0.3.0] - 2026-11-05
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- The replay's view turns freely: drag to rotate, scroll or pinch to zoom, right-drag or two fingers
|
|
10
|
+
to pan, and on the focused view the arrow keys rotate and + / − zoom (three.js's own
|
|
11
|
+
`OrbitControls`, inlined from the pinned three.js; no damping under reduced motion). The camera
|
|
12
|
+
stays above the ground and zooms within limits taken from the building's fitted framing. The first
|
|
13
|
+
movement takes the view and pauses the playback; a plain click on the view does nothing. A view
|
|
14
|
+
taken from the replay keeps that frame's aim and framing but switches to the end view's lens, so a
|
|
15
|
+
take in the top-down phase turns a top view in perspective, not the near-flat opening lens; the
|
|
16
|
+
plan drawing that fades over the opening frames is not laid over a taken view. The canvas is an
|
|
17
|
+
interactive element (`role="application"`) whose label says how to move it.
|
|
18
|
+
- Preset views: Iso (the replay's end view, exactly), Top, the four elevations from the plan's edges
|
|
19
|
+
(N, E, S, W) and Reset, and, for a plan of several storeys, buttons that hide the storeys above a
|
|
20
|
+
chosen one. A preset holds the view as a drag does (it pauses the playback), and its button shows
|
|
21
|
+
as pressed while it holds. The single-file replay HTML carries them; for a page of your own,
|
|
22
|
+
`mountReplay(canvas, payload, strip, { interactive: true })` returns `view` and `viewToolbar(view)`
|
|
23
|
+
builds the buttons (`./browser`). The presets are plain maths in `.`: `presetCamera`,
|
|
24
|
+
`distanceLimits`, `targetBounds`, `pivotAbove`, `takenLens`, `ELEVATION_RANGE`, `ZOOM`.
|
|
25
|
+
- Nothing changes for a replay nobody touches: `__seek(t)` still draws the replay's own frame at `t`,
|
|
26
|
+
and the exported frames and the video are the same.
|
|
27
|
+
|
|
28
|
+
## [0.2.0] - 2026-11-04
|
|
29
|
+
|
|
30
|
+
### Changed
|
|
31
|
+
|
|
32
|
+
- The twelve T0 furniture pieces are drawn in materials instead of one colour per kind: oak, linen,
|
|
33
|
+
wool, upholstery, ceramic, stone, brushed steel, glass and more, from one palette that the GLB and
|
|
34
|
+
the replay both read. Each piece is still one node under its key (`furniture:<id>`); in the GLB it
|
|
35
|
+
holds one primitive per material, named `fixture:<slot>`. The ledger records each family's
|
|
36
|
+
materials (`furniture-material-default`).
|
|
37
|
+
- The pieces are more detailed: a bed with legs, a mattress, a duvet with its sheet turned down,
|
|
38
|
+
pillows and a throw; a sofa with rolled arms and separate seat and back cushions; kitchen units with
|
|
39
|
+
fronts, pulls and a stone worktop, a steel sink with its tap, an oven door and a hob with burner
|
|
40
|
+
rings; a shower with a glass screen and a head; a WC and a basin with rounded ceramics. A kitchen
|
|
41
|
+
sink, basin and shower are now ledgered taller (1160, 990 and 2000 mm: tap and screen), a rug lower
|
|
42
|
+
(12 mm).
|
|
43
|
+
- A part can have rounded corners (`radius`), lie on its side (`axis`) or follow a polygon
|
|
44
|
+
(`profile`). New exports: `t0Shells`, `t0LocalParts`, `partShell`, `sectionRing`, `T0_MATERIALS` and
|
|
45
|
+
the palette (`PALETTE`, `MATERIAL_SLOTS`, `slotColour`, `slotGroups`, `linearRgb`).
|
|
46
|
+
- A small or thin piece keeps every part inside its footprint and its ledgered height; a detail with
|
|
47
|
+
no room is left out, and a hole a part is built without is ledgered (`hole-degenerate`).
|
|
48
|
+
- The replay is lit as a model in soft daylight: a sky-and-ground light, one fixed key light and a
|
|
49
|
+
soft fill (no shadow maps; still a pure function of `t`), so a wall's two visible faces read apart.
|
|
50
|
+
Walls are a warm white with their cut tops drawn darker, doors oak, window frames slim and dark,
|
|
51
|
+
glass pale and translucent; outlines are steady instead of stippled.
|
|
52
|
+
- Each floor is laid in a finish from its room's `uses`: timber for living, dining, bedroom, office,
|
|
53
|
+
hall and circulation; pale tile for a bath, WC or utility room (whatever else it is) and for a
|
|
54
|
+
kitchen or entry on its own; a neutral finish otherwise. Colour only. The floor node carries it
|
|
55
|
+
(`extras.finish`), the ledger records it per floor (`floor-finish-default`), and the GLB writes it
|
|
56
|
+
as `floor:timber`, `floor:tile` or `floor:neutral`.
|
|
57
|
+
- The GLB's building materials now come from the same palette as the replay (`KIND_PALETTE`,
|
|
58
|
+
`FINISH_PALETTE`), and a window's frame and glass are written apart (`window:frame`, and
|
|
59
|
+
`window:glass`, translucent) instead of one `window` material. New exports: `KIND_PALETTE`,
|
|
60
|
+
`FINISH_PALETTE`, `FLOOR_FINISHES`, `FLOOR_FINISH_RULES`, `floorFinish`, `finishColour`,
|
|
61
|
+
`WALL_CAP_SRGB`, and `bodyMaterialName` from `./node`.
|
|
62
|
+
- Every catalogued furniture word is built as a T0 piece; none is a grey box any more. Only a word
|
|
63
|
+
outside the core's catalogue still stands as one. New pieces include planting (trees, a conifer,
|
|
64
|
+
shrubs, a hedge, a palm, flower and raised beds), garden and play furniture, vehicles (a car, a
|
|
65
|
+
bicycle, a motorcycle), the small site objects, and office, care and gym pieces. A towel rail
|
|
66
|
+
hangs with its underside at 200 mm and a whiteboard at 900 mm (`furniture-mount-default`).
|
|
67
|
+
- `T0_HANDED` now also holds `reception_desk`, `bicycle` and `motorcycle`. A bicycle or a
|
|
68
|
+
motorcycle is handed only laid along its width, as the core draws it; the new export
|
|
69
|
+
`handedAt(family, W, D)` says whether a piece is handed at its size. A piece that is symmetric at
|
|
70
|
+
its size is never greyed when the plan's reflection is unknown.
|
|
71
|
+
- A standing piece taller than its storey's walls (a tree in a garden) is built at its default
|
|
72
|
+
height and ledgered (`furniture-above-walls`), never clipped.
|
|
73
|
+
|
|
74
|
+
### Removed
|
|
75
|
+
|
|
76
|
+
- **Breaking:** `t0Parts` and its `PlacedPart` type are gone. Use `t0Shells(furniture, floor)`, which
|
|
77
|
+
returns the placed shells (with their material slots) and the count of holes left out, or
|
|
78
|
+
`t0LocalParts(family, W, D)` for the parts in the piece's own frame.
|
|
79
|
+
|
|
5
80
|
## [0.1.2] - 2026-11-02
|
|
6
81
|
|
|
7
82
|
### Fixed
|
package/dist/browser.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { P as PresetName, V as Vec3 } from './camera-CLNYQ1Xv.js';
|
|
1
2
|
import { ReplayPayload } from './replay.js';
|
|
2
3
|
export { PREVIEW_LABEL, ReplayNode, ReplayOptions, replayPayload, viewBoxOf } from './replay.js';
|
|
3
|
-
import { S as StripItem } from './strip-
|
|
4
|
-
export { R as ReplayFacts, s as stripAt } from './strip-
|
|
4
|
+
import { S as StripItem } from './strip-CN_dTKqy.js';
|
|
5
|
+
export { R as ReplayFacts, s as stripAt } from './strip-CN_dTKqy.js';
|
|
5
6
|
|
|
6
7
|
interface ReplayHandle {
|
|
7
8
|
/** Render the frame at replay time `t` (clamped to [0, 1]) into the canvas, synchronously. */
|
|
@@ -12,18 +13,102 @@ interface ReplayHandle {
|
|
|
12
13
|
ready: Promise<void>;
|
|
13
14
|
/** Release the WebGL context and the GPU buffers. The handle draws nothing afterwards. */
|
|
14
15
|
dispose: () => void;
|
|
16
|
+
/** The camera the user moves (card CR4); present when mounted with `interactive: true`. */
|
|
17
|
+
view?: ViewControl;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** Who holds the camera: the replay, a preset, or the user's own orbit. */
|
|
21
|
+
type CameraHolder = "replay" | PresetName | "free";
|
|
22
|
+
/** A view to carry over to a new mount of an edited plan (`ViewControl.state`, `restore`). */
|
|
23
|
+
type ViewState = {
|
|
24
|
+
camera: "replay" | PresetName;
|
|
25
|
+
storeys: Shown;
|
|
26
|
+
} | {
|
|
27
|
+
camera: "free";
|
|
28
|
+
position: Vec3;
|
|
29
|
+
target: Vec3;
|
|
30
|
+
fov: number;
|
|
31
|
+
storeys: Shown;
|
|
32
|
+
};
|
|
33
|
+
/** The storeys shown: 1…n, or every one (so an edit that adds a storey shows it too). */
|
|
34
|
+
type Shown = number | "all";
|
|
35
|
+
/**
|
|
36
|
+
* The free camera (card CR4, decision CR-D2), browser side. `seek(t)` still draws the replay's own
|
|
37
|
+
* frame at `t` and hands a taken camera back to the replay; `at(t)` draws `t` from whatever camera
|
|
38
|
+
* holds the view. The storeys shown persist across both. Nothing here reaches the default path: a
|
|
39
|
+
* handle nobody touches draws exactly the frames it drew before.
|
|
40
|
+
*/
|
|
41
|
+
interface ViewControl {
|
|
42
|
+
/** Draw replay time `t` (clamped) from the current camera, without handing it back. */
|
|
43
|
+
at: (t: number) => void;
|
|
44
|
+
/** Draw the current `t` from a preset camera (`presetCamera`); `iso` is the end camera exactly. */
|
|
45
|
+
preset: (name: PresetName) => void;
|
|
46
|
+
/** The replay's own camera and every storey: at t = 1 the end frame, byte for byte. */
|
|
47
|
+
reset: () => void;
|
|
48
|
+
/** How many storeys the replay has (1: nothing to hide). */
|
|
49
|
+
readonly storeys: number;
|
|
50
|
+
/** Show storeys 1…`upTo` (1-based, clamped) and hide those above; the camera stays. */
|
|
51
|
+
showStoreys: (upTo: number) => void;
|
|
52
|
+
/** How many storeys are shown, from the lowest. */
|
|
53
|
+
readonly shown: number;
|
|
54
|
+
readonly camera: CameraHolder;
|
|
55
|
+
state: () => ViewState;
|
|
56
|
+
/**
|
|
57
|
+
* Take over a state from an earlier mount (an edit rebuilt the replay); draws nothing. A held view
|
|
58
|
+
* (a preset, the user's orbit) is taken as a preset is: `onTake`.
|
|
59
|
+
*/
|
|
60
|
+
restore: (s: ViewState) => void;
|
|
61
|
+
/** Hear when `camera` or `shown` changes (a drag, a preset, a seek, a restore); returns the unsubscribe. */
|
|
62
|
+
onChange: (fn: () => void) => () => void;
|
|
63
|
+
}
|
|
64
|
+
interface MountOptions {
|
|
65
|
+
/**
|
|
66
|
+
* Drag to turn, wheel or pinch to zoom, right-drag or two fingers to pan, arrow keys and + / −
|
|
67
|
+
* on the focused canvas (three.js's `OrbitControls`). Off by default.
|
|
68
|
+
*/
|
|
69
|
+
interactive?: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* The user took the view (the first movement of a drag, the wheel or a key, a preset, a restored
|
|
72
|
+
* held view): a host that is playing pauses, or its next `seek` hands the camera back.
|
|
73
|
+
*/
|
|
74
|
+
onTake?: () => void;
|
|
15
75
|
}
|
|
16
76
|
/**
|
|
17
77
|
* Mount the replay `p` on `out`: sizes the canvas to `p.width`×`p.height` and draws nothing yet.
|
|
18
78
|
* `strip`, an element the host lays over the canvas, receives the metrics strip (card G4) as DOM
|
|
19
79
|
* text at every `seek`; it is never drawn into the canvas, so `frameHash` is the same with and
|
|
20
|
-
* without it.
|
|
80
|
+
* without it. `opts.interactive` adds the free camera (`handle.view`, card CR4); until someone
|
|
81
|
+
* drags, scrolls, presses a key or calls `view`, every frame is the one it is without it.
|
|
82
|
+
*/
|
|
83
|
+
declare function mountReplay(out: HTMLCanvasElement, p: ReplayPayload, strip?: HTMLElement, opts?: MountOptions): ReplayHandle;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* The free camera's buttons (card CR4), browser-only DOM shared by both hosts of the replay: the
|
|
87
|
+
* single-file replay HTML (`viewer.ts`) and the playground's 3D preview tab. The presets and Reset
|
|
88
|
+
* (`ViewControl`), the storeys shown, and a line saying how to move the view. Nothing here draws into
|
|
89
|
+
* the canvas.
|
|
90
|
+
*/
|
|
91
|
+
|
|
92
|
+
/** Each preset's button text and its accessible name. */
|
|
93
|
+
declare const PRESET_LABELS: ReadonlyArray<readonly [PresetName, string, string]>;
|
|
94
|
+
declare const VIEW_HINT = "Drag to turn, right-drag to pan, scroll to zoom; on the focused view, arrow keys turn and + / \u2212 zoom.";
|
|
95
|
+
/**
|
|
96
|
+
* What an interactive replay canvas says it is, after its title (it is `role="application"`: it
|
|
97
|
+
* takes keys, so it is not an image).
|
|
21
98
|
*/
|
|
22
|
-
declare
|
|
99
|
+
declare const VIEW_CONTROLS_LABEL = "an interactive 3D view: drag or use the arrow keys to turn it, scroll or + and \u2212 to zoom";
|
|
100
|
+
interface ToolbarOptions {
|
|
101
|
+
/** A class for every button (the host's own button style). */
|
|
102
|
+
buttonClass?: string;
|
|
103
|
+
/** An id for the hint line, so the canvas can point at it (`aria-describedby`). */
|
|
104
|
+
hintId?: string;
|
|
105
|
+
}
|
|
106
|
+
/** The toolbar for `view`: preset buttons, Reset, the storeys (more than one), the hint. */
|
|
107
|
+
declare function viewToolbar(view: ViewControl, opts?: ToolbarOptions): HTMLElement;
|
|
23
108
|
|
|
24
109
|
/** The strip's DOM half, apart from `strip.ts` so that the types of `.` and `./node` need no DOM lib. */
|
|
25
110
|
|
|
26
111
|
/** Paint `items` into `el` (one span each); touches the DOM only when the text changed. */
|
|
27
112
|
declare function paintStrip(el: HTMLElement, items: readonly StripItem[]): void;
|
|
28
113
|
|
|
29
|
-
export { type ReplayHandle, ReplayPayload, StripItem, mountReplay, paintStrip };
|
|
114
|
+
export { type CameraHolder, type MountOptions, PRESET_LABELS, PresetName, type ReplayHandle, ReplayPayload, StripItem, type ToolbarOptions, VIEW_CONTROLS_LABEL, VIEW_HINT, type ViewControl, type ViewState, mountReplay, paintStrip, viewToolbar };
|