@nubisco/bim 0.0.0-stage → 0.0.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/LICENSE +21 -0
- package/README.md +80 -2
- package/dist/cells-G6pIWvCF.d.ts +110 -0
- package/dist/cells.d.ts +2 -0
- package/dist/cells.js +25 -0
- package/dist/chunk-6Q4JIXFQ.js +54 -0
- package/dist/chunk-7YR7CGBI.js +1115 -0
- package/dist/chunk-EHYUT42U.js +126 -0
- package/dist/chunk-I47MDCHW.js +457 -0
- package/dist/chunk-L3Z5LJAA.js +58 -0
- package/dist/chunk-MLKGABMK.js +9 -0
- package/dist/chunk-OCAFB7M7.js +286 -0
- package/dist/chunk-SFKOZPPS.js +308 -0
- package/dist/chunk-TE5NK6DO.js +686 -0
- package/dist/chunk-TVNU2NAO.js +47 -0
- package/dist/convert.d.ts +39 -0
- package/dist/convert.js +17 -0
- package/dist/edges-CnXyFuCX.d.ts +67 -0
- package/dist/edges.d.ts +2 -0
- package/dist/edges.js +18 -0
- package/dist/history.d.ts +33 -0
- package/dist/history.js +7 -0
- package/dist/ifc-read.d.ts +61 -0
- package/dist/ifc-read.js +17 -0
- package/dist/ifc.d.ts +60 -0
- package/dist/ifc.js +20 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +81 -0
- package/dist/v1-CnwNIVI8.d.ts +260 -0
- package/dist/v1.d.ts +2 -0
- package/dist/v1.js +21 -0
- package/dist/v2.d.ts +198 -0
- package/dist/v2.js +27 -0
- package/dist/validate.d.ts +13 -0
- package/dist/validate.js +10 -0
- package/package.json +110 -4
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
import { LEAVES, FRAME_MATERIALS, Covering } from './v2.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Plan version 1, as saved up to OpenBridge 1.28: grid cells of 0.5 m, rooms
|
|
5
|
+
* as rectangles, walls implied by room edges. Kept so saved plans and older
|
|
6
|
+
* tabs can still be read, and because the current editor and views still
|
|
7
|
+
* draw from this shape (see convert.ts).
|
|
8
|
+
*
|
|
9
|
+
* Pure types and helpers: no Node, no DOM, so the UI imports this too.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
declare const HOUSE_V1 = 1;
|
|
13
|
+
/** Metres per grid cell. */
|
|
14
|
+
declare const HOUSE_GRID = 0.5;
|
|
15
|
+
/** `paved` is hard ground with no walls: a terrace, a path, the deck round a pool. */
|
|
16
|
+
type HouseRoomKind = 'room' | 'outdoor' | 'paved' | 'pool';
|
|
17
|
+
interface HouseRoom {
|
|
18
|
+
id: string;
|
|
19
|
+
name: string;
|
|
20
|
+
/** A `room` has walls. An outdoor zone and a pool are ground with no walls. */
|
|
21
|
+
kind: HouseRoomKind;
|
|
22
|
+
x: number;
|
|
23
|
+
y: number;
|
|
24
|
+
w: number;
|
|
25
|
+
h: number;
|
|
26
|
+
/**
|
|
27
|
+
* More rectangles joined to the main one, for a room that is not a
|
|
28
|
+
* rectangle: an L is one part, a U is two. Each shares an edge with the
|
|
29
|
+
* shape before it and none overlap, so the room is one connected piece
|
|
30
|
+
* with no wall inside it.
|
|
31
|
+
*/
|
|
32
|
+
parts?: HouseRect[];
|
|
33
|
+
/**
|
|
34
|
+
* The room's corners in order, for a room drawn corner by corner: any
|
|
35
|
+
* shape, slanted edges included. Then it is the shape, `x`, `y`, `w` and
|
|
36
|
+
* `h` are the box around it, and there are no parts.
|
|
37
|
+
*/
|
|
38
|
+
outline?: Array<[number, number]>;
|
|
39
|
+
}
|
|
40
|
+
interface HouseRect {
|
|
41
|
+
x: number;
|
|
42
|
+
y: number;
|
|
43
|
+
w: number;
|
|
44
|
+
h: number;
|
|
45
|
+
}
|
|
46
|
+
/** Every rectangle a room is made of, main one first. */
|
|
47
|
+
declare function roomRects(r: HouseRoom): HouseRect[];
|
|
48
|
+
declare const overlaps: (a: HouseRect, b: HouseRect) => boolean;
|
|
49
|
+
/** Two rectangles that do not overlap but share at least one cell of edge. */
|
|
50
|
+
declare const touches: (a: HouseRect, b: HouseRect) => boolean;
|
|
51
|
+
interface HouseOpening {
|
|
52
|
+
id: string;
|
|
53
|
+
/**
|
|
54
|
+
* `open` is a stretch with no wall at all: two rooms that run into each
|
|
55
|
+
* other, such as a kitchen open to the living room. `slider` is a sliding
|
|
56
|
+
* glass door: glass to door height, and a shutter can sit on it like on a
|
|
57
|
+
* window.
|
|
58
|
+
*/
|
|
59
|
+
type: 'door' | 'window' | 'open' | 'slider';
|
|
60
|
+
/**
|
|
61
|
+
* Start of the opening, on a wall line. Along the wall it may sit on a half
|
|
62
|
+
* cell (a quarter metre), so a door can be centred on a wall of any length.
|
|
63
|
+
*/
|
|
64
|
+
x: number;
|
|
65
|
+
y: number;
|
|
66
|
+
/** `h` runs along x, `v` along y. */
|
|
67
|
+
axis: 'h' | 'v';
|
|
68
|
+
/** Length in cells, in half cells. */
|
|
69
|
+
len: number;
|
|
70
|
+
/** A door's hinge: the end at the lower x or y (`start`), or the other one. Default `start`. */
|
|
71
|
+
hinge?: 'start' | 'end';
|
|
72
|
+
/**
|
|
73
|
+
* The side a door swings into, as seen on the plan: `up` or `down` for a
|
|
74
|
+
* door in a wall running along x, `left` or `right` along y. Default
|
|
75
|
+
* `down` or `right`.
|
|
76
|
+
*/
|
|
77
|
+
opens?: 'up' | 'down' | 'left' | 'right';
|
|
78
|
+
/** A door with a glass leaf, such as a French door. Glass can carry coverings. */
|
|
79
|
+
glass?: boolean;
|
|
80
|
+
/**
|
|
81
|
+
* What cells cannot say about a door or window, carried as plan version 2
|
|
82
|
+
* has it (lengths in millimetres), so the cell editor can set it. `kind`
|
|
83
|
+
* is the element it was written for: a door turned into a window starts
|
|
84
|
+
* from a window's defaults, keeping only its frame and coverings.
|
|
85
|
+
*/
|
|
86
|
+
spec?: OpeningSpec;
|
|
87
|
+
}
|
|
88
|
+
interface OpeningSpec {
|
|
89
|
+
kind: 'door' | 'window';
|
|
90
|
+
/** One of the door or window operations of version 2. */
|
|
91
|
+
operation?: string;
|
|
92
|
+
/** A door's leaf. Only refines `glass`: a door that is not glass is solid. */
|
|
93
|
+
leaf?: (typeof LEAVES)[number];
|
|
94
|
+
sill?: number;
|
|
95
|
+
head?: number;
|
|
96
|
+
frame?: {
|
|
97
|
+
material?: (typeof FRAME_MATERIALS)[number];
|
|
98
|
+
colour?: string;
|
|
99
|
+
};
|
|
100
|
+
/** Present, it is the whole list, so an empty list takes every covering off. */
|
|
101
|
+
coverings?: Covering[];
|
|
102
|
+
}
|
|
103
|
+
/** How a light hangs: from the ceiling, on a wall, or as a floor or table lamp. */
|
|
104
|
+
declare const LIGHT_MOUNTS: readonly ["ceiling", "wall", "floor", "table", "pool"];
|
|
105
|
+
/**
|
|
106
|
+
* What a device is drawn as. The bridge sees a smart plug or a relay, and the
|
|
107
|
+
* person knows it is the fridge, so they say so on the plan.
|
|
108
|
+
*/
|
|
109
|
+
declare const DEVICE_LOOKS: readonly ["outlet", "tv", "fridge", "washer", "dehumidifier", "vacuum", "mower", "tap"];
|
|
110
|
+
interface HousePlacement {
|
|
111
|
+
/** `device:<id>` for a native device, `accessory:<uuid>` for a HomeKit accessory. */
|
|
112
|
+
ref: string;
|
|
113
|
+
x: number;
|
|
114
|
+
y: number;
|
|
115
|
+
/** A shutter or blind belongs to a window, and is drawn on it. */
|
|
116
|
+
opening?: string;
|
|
117
|
+
/** The covering of that window it drives, when the editor chose one. */
|
|
118
|
+
covering?: string;
|
|
119
|
+
/** The glow colour of a light that cannot report one (a relay driving a lamp). */
|
|
120
|
+
color?: string;
|
|
121
|
+
/** Rooms a heating or cooling device's water circuit runs through, in order. */
|
|
122
|
+
circuitRooms?: string[];
|
|
123
|
+
/** A gate's width in cells. Drawn centred on (x, y). */
|
|
124
|
+
length?: number;
|
|
125
|
+
/** Which way a gate or a TV runs: `h` along x, `v` along y. */
|
|
126
|
+
axis?: 'h' | 'v';
|
|
127
|
+
/** Where a light is mounted. */
|
|
128
|
+
mount?: (typeof LIGHT_MOUNTS)[number];
|
|
129
|
+
/** What the device is drawn as, when its type alone does not say. */
|
|
130
|
+
look?: (typeof DEVICE_LOOKS)[number];
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* A radiator on a wall. It sits on a wall line like a door or window (whole
|
|
134
|
+
* cells across the wall, half cells along it), and hangs on one side of it,
|
|
135
|
+
* named the way a door's swing is. It is plumbing, not a device: a heating
|
|
136
|
+
* circuit serving its room runs through it.
|
|
137
|
+
*/
|
|
138
|
+
interface HouseRadiator {
|
|
139
|
+
id: string;
|
|
140
|
+
x: number;
|
|
141
|
+
y: number;
|
|
142
|
+
axis: 'h' | 'v';
|
|
143
|
+
/** Width in cells, in half cells. */
|
|
144
|
+
len: number;
|
|
145
|
+
/** The side of the wall it hangs on: `up` or `down` along x, `left` or `right` along y. */
|
|
146
|
+
side: 'up' | 'down' | 'left' | 'right';
|
|
147
|
+
}
|
|
148
|
+
/** What a piece of furniture is. Drawn as plain shapes, so the plan never imposes a style. */
|
|
149
|
+
declare const FURNITURE_KINDS: readonly ["table", "cabinet", "island", "bed", "sofa", "shelves", "rug", "bath", "shower", "toilet", "basin", "lounger", "parasol", "planter", "pergola"];
|
|
150
|
+
/**
|
|
151
|
+
* A piece of furniture: a rectangle on the floor, in half cells (a quarter
|
|
152
|
+
* metre), `w` along x and `d` along y. It is there to make the plan read as
|
|
153
|
+
* the home, and so a lamp put on a table stands on it.
|
|
154
|
+
*/
|
|
155
|
+
interface HouseFurniture {
|
|
156
|
+
id: string;
|
|
157
|
+
kind: (typeof FURNITURE_KINDS)[number];
|
|
158
|
+
x: number;
|
|
159
|
+
y: number;
|
|
160
|
+
w: number;
|
|
161
|
+
d: number;
|
|
162
|
+
/** Height in metres, when it is not the usual one for its kind. */
|
|
163
|
+
height?: number;
|
|
164
|
+
/**
|
|
165
|
+
* The side its back is on (a bed's head, a sofa's back), when the person
|
|
166
|
+
* set it. Unset, it is the side nearest a wall.
|
|
167
|
+
*/
|
|
168
|
+
back?: 'up' | 'down' | 'left' | 'right';
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* What the editor set on a wall: its thickness and height, in millimetres.
|
|
172
|
+
* The wall itself follows the room edges, so this is keyed by where it is:
|
|
173
|
+
* the wall on that line that overlaps it most takes it.
|
|
174
|
+
*/
|
|
175
|
+
interface HouseWallSpec {
|
|
176
|
+
axis: 'h' | 'v';
|
|
177
|
+
x: number;
|
|
178
|
+
y: number;
|
|
179
|
+
len: number;
|
|
180
|
+
thickness: number;
|
|
181
|
+
height: number;
|
|
182
|
+
/** For a slanted wall: it runs from (x, y) to here, and `axis` and `len` mean nothing. */
|
|
183
|
+
to?: [number, number];
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* A wall drawn with the Wall tool: one that does not follow a room edge (a
|
|
187
|
+
* garden wall, a partition), from `a` to `b` in cells, at any angle. One
|
|
188
|
+
* along x or y runs towards +x or +y, and can hold doors and windows.
|
|
189
|
+
*/
|
|
190
|
+
interface HouseDrawnWall {
|
|
191
|
+
id: string;
|
|
192
|
+
a: [number, number];
|
|
193
|
+
b: [number, number];
|
|
194
|
+
thickness: number;
|
|
195
|
+
height: number;
|
|
196
|
+
}
|
|
197
|
+
interface HouseFloor {
|
|
198
|
+
id: string;
|
|
199
|
+
name: string;
|
|
200
|
+
/** 0 is the ground floor. Negative is a basement. */
|
|
201
|
+
level: number;
|
|
202
|
+
rooms: HouseRoom[];
|
|
203
|
+
openings: HouseOpening[];
|
|
204
|
+
placements: HousePlacement[];
|
|
205
|
+
/** Absent on a plan saved before radiators existed. */
|
|
206
|
+
radiators?: HouseRadiator[];
|
|
207
|
+
/** Absent on a plan saved before furniture existed. */
|
|
208
|
+
furniture?: HouseFurniture[];
|
|
209
|
+
/** Thickness and height of walls, from version 2 or as the editor set them. */
|
|
210
|
+
walls?: HouseWallSpec[];
|
|
211
|
+
/** Walls drawn on their own, not following a room. */
|
|
212
|
+
drawnWalls?: HouseDrawnWall[];
|
|
213
|
+
/** Dimension lines left by the Ruler, from `a` to `b` in cells. */
|
|
214
|
+
dimensions?: HouseDimension[];
|
|
215
|
+
}
|
|
216
|
+
/** A measurement drawn on the plan with the Ruler. Not part of the building. */
|
|
217
|
+
interface HouseDimension {
|
|
218
|
+
id: string;
|
|
219
|
+
a: [number, number];
|
|
220
|
+
b: [number, number];
|
|
221
|
+
}
|
|
222
|
+
interface HousePlan {
|
|
223
|
+
version: typeof HOUSE_V1;
|
|
224
|
+
grid: number;
|
|
225
|
+
/** The plot, in cells. The ground floor's ground. */
|
|
226
|
+
plot: {
|
|
227
|
+
w: number;
|
|
228
|
+
h: number;
|
|
229
|
+
};
|
|
230
|
+
floors: HouseFloor[];
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
declare const v1_DEVICE_LOOKS: typeof DEVICE_LOOKS;
|
|
234
|
+
declare const v1_FURNITURE_KINDS: typeof FURNITURE_KINDS;
|
|
235
|
+
declare const v1_HOUSE_GRID: typeof HOUSE_GRID;
|
|
236
|
+
declare const v1_HOUSE_V1: typeof HOUSE_V1;
|
|
237
|
+
type v1_HouseDimension = HouseDimension;
|
|
238
|
+
type v1_HouseDrawnWall = HouseDrawnWall;
|
|
239
|
+
type v1_HouseFloor = HouseFloor;
|
|
240
|
+
type v1_HouseFurniture = HouseFurniture;
|
|
241
|
+
type v1_HouseOpening = HouseOpening;
|
|
242
|
+
type v1_HousePlacement = HousePlacement;
|
|
243
|
+
type v1_HousePlan = HousePlan;
|
|
244
|
+
type v1_HouseRadiator = HouseRadiator;
|
|
245
|
+
type v1_HouseRect = HouseRect;
|
|
246
|
+
type v1_HouseRoom = HouseRoom;
|
|
247
|
+
type v1_HouseRoomKind = HouseRoomKind;
|
|
248
|
+
type v1_HouseWallSpec = HouseWallSpec;
|
|
249
|
+
declare const v1_LIGHT_MOUNTS: typeof LIGHT_MOUNTS;
|
|
250
|
+
type v1_OpeningSpec = OpeningSpec;
|
|
251
|
+
declare const v1_overlaps: typeof overlaps;
|
|
252
|
+
declare const v1_roomRects: typeof roomRects;
|
|
253
|
+
declare const v1_touches: typeof touches;
|
|
254
|
+
declare namespace v1 {
|
|
255
|
+
export { v1_DEVICE_LOOKS as DEVICE_LOOKS, v1_FURNITURE_KINDS as FURNITURE_KINDS, v1_HOUSE_GRID as HOUSE_GRID, v1_HOUSE_V1 as HOUSE_V1, v1_LIGHT_MOUNTS as LIGHT_MOUNTS, v1_overlaps as overlaps, v1_roomRects as roomRects, v1_touches as touches };
|
|
256
|
+
export type { v1_HouseDimension as HouseDimension, v1_HouseDrawnWall as HouseDrawnWall, v1_HouseFloor as HouseFloor, v1_HouseFurniture as HouseFurniture, v1_HouseOpening as HouseOpening, v1_HousePlacement as HousePlacement, v1_HousePlan as HousePlan, v1_HouseRadiator as HouseRadiator, v1_HouseRect as HouseRect, v1_HouseRoom as HouseRoom, v1_HouseRoomKind as HouseRoomKind, v1_HouseWallSpec as HouseWallSpec, v1_OpeningSpec as OpeningSpec };
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
export { DEVICE_LOOKS as D, FURNITURE_KINDS as F, LIGHT_MOUNTS as L, HOUSE_GRID as b, HOUSE_V1 as c, overlaps as o, roomRects as r, touches as t, v1 as v };
|
|
260
|
+
export type { HousePlan as H, OpeningSpec as O, HouseFloor as a, HouseDimension as d, HouseDrawnWall as e, HouseFurniture as f, HouseOpening as g, HousePlacement as h, HouseRadiator as i, HouseRect as j, HouseRoom as k, HouseRoomKind as l, HouseWallSpec as m };
|
package/dist/v1.d.ts
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import './v2.js';
|
|
2
|
+
export { D as DEVICE_LOOKS, F as FURNITURE_KINDS, b as HOUSE_GRID, c as HOUSE_V1, d as HouseDimension, e as HouseDrawnWall, a as HouseFloor, f as HouseFurniture, g as HouseOpening, h as HousePlacement, H as HousePlan, i as HouseRadiator, j as HouseRect, k as HouseRoom, l as HouseRoomKind, m as HouseWallSpec, L as LIGHT_MOUNTS, O as OpeningSpec, o as overlaps, r as roomRects, t as touches } from './v1-CnwNIVI8.js';
|
package/dist/v1.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DEVICE_LOOKS,
|
|
3
|
+
FURNITURE_KINDS,
|
|
4
|
+
HOUSE_GRID,
|
|
5
|
+
HOUSE_V1,
|
|
6
|
+
LIGHT_MOUNTS,
|
|
7
|
+
overlaps,
|
|
8
|
+
roomRects,
|
|
9
|
+
touches
|
|
10
|
+
} from "./chunk-L3Z5LJAA.js";
|
|
11
|
+
import "./chunk-MLKGABMK.js";
|
|
12
|
+
export {
|
|
13
|
+
DEVICE_LOOKS,
|
|
14
|
+
FURNITURE_KINDS,
|
|
15
|
+
HOUSE_GRID,
|
|
16
|
+
HOUSE_V1,
|
|
17
|
+
LIGHT_MOUNTS,
|
|
18
|
+
overlaps,
|
|
19
|
+
roomRects,
|
|
20
|
+
touches
|
|
21
|
+
};
|
package/dist/v2.d.ts
ADDED
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plan version 2: the house as a building model. See docs/design/house-bim.md.
|
|
3
|
+
*
|
|
4
|
+
* Every length is a whole number of millimetres. x grows to the right and y
|
|
5
|
+
* grows down the plan, as drawn on screen, with (0, 0) at the plot's top left
|
|
6
|
+
* corner. Walls are elements of their own, rooms are polygons, and doors and
|
|
7
|
+
* windows are hosted by a wall.
|
|
8
|
+
*
|
|
9
|
+
* Pure types and helpers: no Node, no DOM, no OpenBridge devices beyond a
|
|
10
|
+
* device reference string, so this can move to a package Keystone shares.
|
|
11
|
+
*/
|
|
12
|
+
declare const PLAN_VERSION = 2;
|
|
13
|
+
/** A point on the plan, in millimetres. */
|
|
14
|
+
type Point = [number, number];
|
|
15
|
+
interface Plan {
|
|
16
|
+
version: typeof PLAN_VERSION;
|
|
17
|
+
unit: 'mm';
|
|
18
|
+
/** The plot, the ground floor's ground. */
|
|
19
|
+
site: {
|
|
20
|
+
w: number;
|
|
21
|
+
h: number;
|
|
22
|
+
};
|
|
23
|
+
/** The editor's snapping step. A setting of the editor, not a limit of the data. */
|
|
24
|
+
snap: number;
|
|
25
|
+
storeys: Storey[];
|
|
26
|
+
}
|
|
27
|
+
interface Storey {
|
|
28
|
+
id: string;
|
|
29
|
+
name: string;
|
|
30
|
+
/** 0 is the ground floor. Negative is a basement. */
|
|
31
|
+
level: number;
|
|
32
|
+
/** Height of its floor above the ground floor's floor. */
|
|
33
|
+
elevation: number;
|
|
34
|
+
/** Floor to floor height. */
|
|
35
|
+
height: number;
|
|
36
|
+
walls: Wall[];
|
|
37
|
+
spaces: Space[];
|
|
38
|
+
openings: Opening[];
|
|
39
|
+
radiators: Radiator[];
|
|
40
|
+
furniture: Furniture[];
|
|
41
|
+
placements: Placement[];
|
|
42
|
+
/** Dimension lines left on the plan by the editor's Ruler. Absent when there are none. */
|
|
43
|
+
dimensions?: Dimension[];
|
|
44
|
+
}
|
|
45
|
+
/** A measurement drawn on the plan, from `a` to `b`. Not part of the building. */
|
|
46
|
+
interface Dimension {
|
|
47
|
+
id: string;
|
|
48
|
+
a: Point;
|
|
49
|
+
b: Point;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* A wall: a straight centre line from `a` to `b`, with a thickness spread
|
|
53
|
+
* evenly either side of it. Its left side is the one on the left standing at
|
|
54
|
+
* `a` looking at `b`, on the plan as drawn.
|
|
55
|
+
*/
|
|
56
|
+
interface Wall {
|
|
57
|
+
id: string;
|
|
58
|
+
a: Point;
|
|
59
|
+
b: Point;
|
|
60
|
+
thickness: number;
|
|
61
|
+
height: number;
|
|
62
|
+
}
|
|
63
|
+
/** `paved` is hard ground with no walls: a terrace, a path, the deck round a pool. */
|
|
64
|
+
type SpaceKind = 'room' | 'outdoor' | 'paved' | 'pool';
|
|
65
|
+
/** A room or an outdoor zone: a simple polygon, its corners in order. */
|
|
66
|
+
interface Space {
|
|
67
|
+
id: string;
|
|
68
|
+
name: string;
|
|
69
|
+
kind: SpaceKind;
|
|
70
|
+
/** Clockwise on the plan as drawn (y down). */
|
|
71
|
+
outline: Point[];
|
|
72
|
+
/** Courtyards and the like: areas inside the outline that are not part of it. */
|
|
73
|
+
holes?: Point[][];
|
|
74
|
+
/**
|
|
75
|
+
* The rectangles the editor drew this shape as, main one first, while the
|
|
76
|
+
* editor still draws rooms as rectangles. A hint for that editor only: the
|
|
77
|
+
* outline is the shape, and a hint that no longer covers it is ignored.
|
|
78
|
+
*/
|
|
79
|
+
rects?: Array<{
|
|
80
|
+
x: number;
|
|
81
|
+
y: number;
|
|
82
|
+
w: number;
|
|
83
|
+
h: number;
|
|
84
|
+
}>;
|
|
85
|
+
}
|
|
86
|
+
declare const DOOR_OPERATIONS: readonly ["swing", "double-swing", "sliding", "lift-slide", "folding", "pocket"];
|
|
87
|
+
declare const WINDOW_OPERATIONS: readonly ["fixed", "casement", "tilt-turn", "sliding", "awning", "hung"];
|
|
88
|
+
type DoorOperation = (typeof DOOR_OPERATIONS)[number];
|
|
89
|
+
type WindowOperation = (typeof WINDOW_OPERATIONS)[number];
|
|
90
|
+
declare const LEAVES: readonly ["solid", "glazed", "part-glazed"];
|
|
91
|
+
declare const FRAME_MATERIALS: readonly ["aluminium", "pvc", "wood", "steel"];
|
|
92
|
+
declare const COVERING_KINDS: readonly ["shutter", "external-blind", "awning", "curtain", "blind"];
|
|
93
|
+
/** Something that covers glass. Motorised when a device placement is hosted by it. */
|
|
94
|
+
interface Covering {
|
|
95
|
+
id: string;
|
|
96
|
+
kind: (typeof COVERING_KINDS)[number];
|
|
97
|
+
side: 'inside' | 'outside';
|
|
98
|
+
}
|
|
99
|
+
interface OpeningBase {
|
|
100
|
+
id: string;
|
|
101
|
+
/** The wall it is in. */
|
|
102
|
+
wall: string;
|
|
103
|
+
/** Distance from the wall's `a` end to the opening's near end, along the wall. */
|
|
104
|
+
at: number;
|
|
105
|
+
width: number;
|
|
106
|
+
}
|
|
107
|
+
/** A stretch of wall that is not there: two rooms that run into each other. */
|
|
108
|
+
interface Gap extends OpeningBase {
|
|
109
|
+
kind: 'gap';
|
|
110
|
+
}
|
|
111
|
+
interface Glazed {
|
|
112
|
+
/** Height of the bottom of the opening above the storey's floor. */
|
|
113
|
+
sill: number;
|
|
114
|
+
/** Height of its top above the storey's floor. */
|
|
115
|
+
head: number;
|
|
116
|
+
frame?: {
|
|
117
|
+
material?: (typeof FRAME_MATERIALS)[number];
|
|
118
|
+
colour?: string;
|
|
119
|
+
};
|
|
120
|
+
/** Only on glass: a window, or a door with a glazed or part glazed leaf. */
|
|
121
|
+
coverings?: Covering[];
|
|
122
|
+
/** The end the leaf is hinged at, for kinds that swing: nearer the wall's `a` (`start`) or `b`. */
|
|
123
|
+
hinge?: 'start' | 'end';
|
|
124
|
+
/** The side of the wall it opens to, for kinds that swing, as for a wall's sides. */
|
|
125
|
+
opens?: 'left' | 'right';
|
|
126
|
+
}
|
|
127
|
+
interface Door extends OpeningBase, Glazed {
|
|
128
|
+
kind: 'door';
|
|
129
|
+
operation: DoorOperation;
|
|
130
|
+
leaf: (typeof LEAVES)[number];
|
|
131
|
+
}
|
|
132
|
+
interface Window extends OpeningBase, Glazed {
|
|
133
|
+
kind: 'window';
|
|
134
|
+
operation: WindowOperation;
|
|
135
|
+
}
|
|
136
|
+
type Opening = Gap | Door | Window;
|
|
137
|
+
/** Whether glass is part of an opening, so it can carry coverings. */
|
|
138
|
+
declare function isGlazed(o: Opening): o is Door | Window;
|
|
139
|
+
/**
|
|
140
|
+
* A radiator: a straight run from `a` to `b` along a wall face, hanging on
|
|
141
|
+
* one side of that line (as for a wall's sides).
|
|
142
|
+
*/
|
|
143
|
+
interface Radiator {
|
|
144
|
+
id: string;
|
|
145
|
+
a: Point;
|
|
146
|
+
b: Point;
|
|
147
|
+
side: 'left' | 'right';
|
|
148
|
+
}
|
|
149
|
+
declare const FURNITURE_KINDS: readonly ["table", "cabinet", "island", "bed", "sofa", "shelves", "rug", "bath", "shower", "toilet", "basin", "lounger", "parasol", "planter", "pergola"];
|
|
150
|
+
/** A piece of furniture: a rectangle on the floor, `w` along x and `d` along y. */
|
|
151
|
+
interface Furniture {
|
|
152
|
+
id: string;
|
|
153
|
+
kind: (typeof FURNITURE_KINDS)[number];
|
|
154
|
+
x: number;
|
|
155
|
+
y: number;
|
|
156
|
+
w: number;
|
|
157
|
+
d: number;
|
|
158
|
+
height?: number;
|
|
159
|
+
back?: 'up' | 'down' | 'left' | 'right';
|
|
160
|
+
}
|
|
161
|
+
declare const LIGHT_MOUNTS: readonly ["ceiling", "wall", "floor", "table", "pool"];
|
|
162
|
+
declare const DEVICE_LOOKS: readonly ["outlet", "tv", "fridge", "washer", "dehumidifier", "vacuum", "mower", "tap"];
|
|
163
|
+
/**
|
|
164
|
+
* Where a device is. `ref` is opaque here (OpenBridge uses `device:<id>` and
|
|
165
|
+
* `accessory:<uuid>`). A device that belongs to a building element (a shutter
|
|
166
|
+
* motor to a covering, a lock to a door) names it in `host`.
|
|
167
|
+
*/
|
|
168
|
+
interface Placement {
|
|
169
|
+
ref: string;
|
|
170
|
+
x: number;
|
|
171
|
+
y: number;
|
|
172
|
+
host?: {
|
|
173
|
+
opening: string;
|
|
174
|
+
covering?: string;
|
|
175
|
+
};
|
|
176
|
+
color?: string;
|
|
177
|
+
circuitRooms?: string[];
|
|
178
|
+
/** A gate's width, centred on (x, y). */
|
|
179
|
+
length?: number;
|
|
180
|
+
axis?: 'h' | 'v';
|
|
181
|
+
mount?: (typeof LIGHT_MOUNTS)[number];
|
|
182
|
+
look?: (typeof DEVICE_LOOKS)[number];
|
|
183
|
+
}
|
|
184
|
+
/** Defaults for what version 1 did not record. */
|
|
185
|
+
declare const DEFAULTS: {
|
|
186
|
+
readonly storeyHeight: 2800;
|
|
187
|
+
readonly wallHeight: 2500;
|
|
188
|
+
/** A wall with a room on one side only. */
|
|
189
|
+
readonly outerWall: 300;
|
|
190
|
+
/** A wall between two rooms. */
|
|
191
|
+
readonly innerWall: 100;
|
|
192
|
+
readonly doorHead: 2100;
|
|
193
|
+
readonly windowSill: 900;
|
|
194
|
+
readonly windowHead: 2100;
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
export { COVERING_KINDS, DEFAULTS, DEVICE_LOOKS, DOOR_OPERATIONS, FRAME_MATERIALS, FURNITURE_KINDS, LEAVES, LIGHT_MOUNTS, PLAN_VERSION, WINDOW_OPERATIONS, isGlazed };
|
|
198
|
+
export type { Covering, Dimension, Door, DoorOperation, Furniture, Gap, Opening, Placement, Plan, Point, Radiator, Space, SpaceKind, Storey, Wall, Window, WindowOperation };
|
package/dist/v2.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import {
|
|
2
|
+
COVERING_KINDS,
|
|
3
|
+
DEFAULTS,
|
|
4
|
+
DEVICE_LOOKS,
|
|
5
|
+
DOOR_OPERATIONS,
|
|
6
|
+
FRAME_MATERIALS,
|
|
7
|
+
FURNITURE_KINDS,
|
|
8
|
+
LEAVES,
|
|
9
|
+
LIGHT_MOUNTS,
|
|
10
|
+
PLAN_VERSION,
|
|
11
|
+
WINDOW_OPERATIONS,
|
|
12
|
+
isGlazed
|
|
13
|
+
} from "./chunk-6Q4JIXFQ.js";
|
|
14
|
+
import "./chunk-MLKGABMK.js";
|
|
15
|
+
export {
|
|
16
|
+
COVERING_KINDS,
|
|
17
|
+
DEFAULTS,
|
|
18
|
+
DEVICE_LOOKS,
|
|
19
|
+
DOOR_OPERATIONS,
|
|
20
|
+
FRAME_MATERIALS,
|
|
21
|
+
FURNITURE_KINDS,
|
|
22
|
+
LEAVES,
|
|
23
|
+
LIGHT_MOUNTS,
|
|
24
|
+
PLAN_VERSION,
|
|
25
|
+
WINDOW_OPERATIONS,
|
|
26
|
+
isGlazed
|
|
27
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Plan } from './v2.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Check a version 2 plan from the outside world and return a clean copy.
|
|
5
|
+
* Unknown fields are dropped, not refused, so an older client cannot fail on
|
|
6
|
+
* a field a newer one added, and nothing unexpected is stored.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
declare class PlanError extends Error {
|
|
10
|
+
}
|
|
11
|
+
declare function validatePlan(raw: unknown): Plan;
|
|
12
|
+
|
|
13
|
+
export { PlanError, validatePlan };
|
package/dist/validate.js
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,112 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nubisco/bim",
|
|
3
|
-
"version": "0.0.0
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"description": "A building as a model: storeys, walls, spaces, doors and windows in millimetres, with validation, plan geometry, and an IFC4 writer and reader. Pure TypeScript, for the browser and Node alike.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "José Silva <jose@nubisco.io>",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/nubisco/bim.git"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/nubisco/bim#readme",
|
|
12
|
+
"bugs": "https://github.com/nubisco/bim/issues",
|
|
13
|
+
"type": "module",
|
|
14
|
+
"sideEffects": false,
|
|
15
|
+
"exports": {
|
|
16
|
+
".": {
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
18
|
+
"import": "./dist/index.js"
|
|
19
|
+
},
|
|
20
|
+
"./*": {
|
|
21
|
+
"types": "./dist/*.d.ts",
|
|
22
|
+
"import": "./dist/*.js"
|
|
23
|
+
},
|
|
24
|
+
"./package.json": "./package.json"
|
|
25
|
+
},
|
|
26
|
+
"files": [
|
|
27
|
+
"dist",
|
|
28
|
+
"LICENSE",
|
|
29
|
+
"README.md"
|
|
30
|
+
],
|
|
31
|
+
"scripts": {
|
|
32
|
+
"build": "tsup",
|
|
33
|
+
"test": "vitest run",
|
|
34
|
+
"types:check": "tsc --noEmit",
|
|
35
|
+
"lint": "eslint .",
|
|
36
|
+
"format:check": "prettier --check .",
|
|
37
|
+
"format": "prettier --write .",
|
|
38
|
+
"quality:check": "pnpm run test && pnpm run types:check && pnpm run lint && pnpm run format:check && pnpm run build",
|
|
39
|
+
"prepare": "simple-git-hooks"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@eslint/js": "^9.0.0",
|
|
43
|
+
"@semantic-release/changelog": "^7.0.0",
|
|
44
|
+
"@semantic-release/git": "^11.0.1",
|
|
45
|
+
"@types/node": "^22.0.0",
|
|
46
|
+
"conventional-changelog-conventionalcommits": "^10.4.1",
|
|
47
|
+
"eslint": "^9.0.0",
|
|
48
|
+
"eslint-config-prettier": "^10.0.0",
|
|
49
|
+
"eslint-plugin-prettier": "^5.0.0",
|
|
50
|
+
"globals": "^15.0.0",
|
|
51
|
+
"prettier": "^3.3.0",
|
|
52
|
+
"semantic-release": "^25.0.3",
|
|
53
|
+
"simple-git-hooks": "^2.13.1",
|
|
54
|
+
"tsup": "^9.0.0",
|
|
55
|
+
"typescript": "^5.9.0",
|
|
56
|
+
"typescript-eslint": "^8.0.0",
|
|
57
|
+
"vitest": "^3.2.7"
|
|
58
|
+
},
|
|
59
|
+
"engines": {
|
|
60
|
+
"node": ">=22"
|
|
61
|
+
},
|
|
62
|
+
"publishConfig": {
|
|
63
|
+
"access": "public"
|
|
64
|
+
},
|
|
65
|
+
"keywords": [
|
|
66
|
+
"bim",
|
|
67
|
+
"ifc",
|
|
68
|
+
"ifc4",
|
|
69
|
+
"floor-plan",
|
|
70
|
+
"building",
|
|
71
|
+
"architecture",
|
|
72
|
+
"typescript",
|
|
73
|
+
"nubisco"
|
|
74
|
+
],
|
|
75
|
+
"simple-git-hooks": {
|
|
76
|
+
"pre-commit": "pnpm exec prettier --check . && pnpm run test",
|
|
77
|
+
"pre-push": "pnpm run quality:check"
|
|
78
|
+
},
|
|
79
|
+
"release": {
|
|
80
|
+
"branches": [
|
|
81
|
+
"master"
|
|
82
|
+
],
|
|
83
|
+
"plugins": [
|
|
84
|
+
[
|
|
85
|
+
"@semantic-release/commit-analyzer",
|
|
86
|
+
{
|
|
87
|
+
"preset": "conventionalcommits"
|
|
88
|
+
}
|
|
89
|
+
],
|
|
90
|
+
[
|
|
91
|
+
"@semantic-release/release-notes-generator",
|
|
92
|
+
{
|
|
93
|
+
"preset": "conventionalcommits"
|
|
94
|
+
}
|
|
95
|
+
],
|
|
96
|
+
"@semantic-release/changelog",
|
|
97
|
+
"@semantic-release/npm",
|
|
98
|
+
"@semantic-release/github",
|
|
99
|
+
[
|
|
100
|
+
"@semantic-release/git",
|
|
101
|
+
{
|
|
102
|
+
"assets": [
|
|
103
|
+
"package.json",
|
|
104
|
+
"CHANGELOG.md"
|
|
105
|
+
],
|
|
106
|
+
"message": "chore(release): ${nextRelease.version} [skip ci]"
|
|
107
|
+
}
|
|
108
|
+
]
|
|
109
|
+
]
|
|
110
|
+
},
|
|
111
|
+
"packageManager": "pnpm@10.33.0"
|
|
112
|
+
}
|