@mark1russell7/room-view 0.1.3 → 0.1.5

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.
Files changed (40) hide show
  1. package/README.md +15 -1
  2. package/build/anchors-BEnxNnSV.d.ts +75 -0
  3. package/build/anchors-BEnxNnSV.d.ts.map +1 -0
  4. package/build/frames-BYMK5ZId.d.ts +39 -0
  5. package/build/frames-BYMK5ZId.d.ts.map +1 -0
  6. package/build/index.d.ts +7 -211
  7. package/build/index.d.ts.map +1 -1
  8. package/build/index.js +6 -613
  9. package/build/index.js.map +1 -1
  10. package/build/joins-2p01wnr_.d.ts +39 -0
  11. package/build/joins-2p01wnr_.d.ts.map +1 -0
  12. package/build/layers-CKx0dcM0.d.ts +143 -0
  13. package/build/layers-CKx0dcM0.d.ts.map +1 -0
  14. package/build/layers-bgJ3OTId.js +630 -0
  15. package/build/layers-bgJ3OTId.js.map +1 -0
  16. package/build/{level-Cu8vgrwN.js → level-5Nb9rq5L.js} +3 -28
  17. package/build/level-5Nb9rq5L.js.map +1 -0
  18. package/build/{loads-C3Nrj3Gd.d.ts → loads-CriZuwcu.d.ts} +4 -73
  19. package/build/loads-CriZuwcu.d.ts.map +1 -0
  20. package/build/loads-CtHa4EHo.js +103 -0
  21. package/build/loads-CtHa4EHo.js.map +1 -0
  22. package/build/marks.d.ts +29 -0
  23. package/build/marks.d.ts.map +1 -0
  24. package/build/marks.js +34 -0
  25. package/build/marks.js.map +1 -0
  26. package/build/room-DrXMmX_h.js +29 -0
  27. package/build/room-DrXMmX_h.js.map +1 -0
  28. package/build/schema.d.ts +6 -0
  29. package/build/schema.d.ts.map +1 -1
  30. package/build/schema.js +37 -2
  31. package/build/schema.js.map +1 -1
  32. package/build/{loads-Br73kIsQ.js → solids-BKb-izIP.js} +2 -102
  33. package/build/solids-BKb-izIP.js.map +1 -0
  34. package/build/three.d.ts +1 -1
  35. package/build/three.js +2 -1
  36. package/build/three.js.map +1 -1
  37. package/package.json +7 -1
  38. package/build/level-Cu8vgrwN.js.map +0 -1
  39. package/build/loads-Br73kIsQ.js.map +0 -1
  40. package/build/loads-C3Nrj3Gd.d.ts.map +0 -1
package/README.md CHANGED
@@ -251,6 +251,19 @@ const findings = checkLayers(scene, addOns);
251
251
  - The findings are in the order of the layer keys, then of the record keys. Thus equal inputs give equal findings.
252
252
  - The add-ons do not know each other. Two add-ons can put records on one object.
253
253
 
254
+ An add-on can give marks: records that a viewer draws, in the format of `@mark1russell7/visuals/marks`. `layerMarks` of the entry `/marks` gives the marks of the layers of a scene:
255
+
256
+ ```ts
257
+ import { layerMarks } from "@mark1russell7/room-view/marks";
258
+
259
+ const marks = layerMarks(scene, addOns, addOnMarks);
260
+ ```
261
+
262
+ - Each value of `addOnMarks` is the `AddOnMarks` value of an add-on, from the entry `/marks` of its package. The add-on of the same name reads the layer.
263
+ - The marks are in the order of the layer names, then of the record names. Thus equal inputs give equal marks.
264
+ - A layer with a fault of its form gives no marks, and `checkLayers` tells the fault.
265
+ - A mark is plain data in meters, with the z axis up. It has no shape and no color.
266
+
254
267
  `ANCHOR_CODES` and `LAYER_CODES` have the codes of the core. The design of the add-ons is in `docs/ADD-ONS.md` of the repository.
255
268
 
256
269
  ## The loads of the circuits
@@ -303,8 +316,9 @@ The option `cut` gives a floor plan: the plan keeps only the solids that start b
303
316
  | Entry | What it has |
304
317
  | --- | --- |
305
318
  | `@mark1russell7/room-view` | The record types, the model, the plan, the checks, the loads, the survey and the level. It has no schema library. |
306
- | `@mark1russell7/room-view/schema` | `roomSchema`, `sceneSchema`, `surveySchema` and `levelSchema`: the zod schemas that examine the form of a JSON record. |
319
+ | `@mark1russell7/room-view/schema` | `roomSchema`, `sceneSchema`, `surveySchema`, `levelSchema` and `anchorSchema`: the zod schemas that examine the form of a JSON record. |
307
320
  | `@mark1russell7/room-view/sample` | `SAMPLE_ROOM`, `SAMPLE_SCENE`, `SAMPLE_SURVEY` and `SAMPLE_LEVEL`: a room with a rack and an apartment of four rooms, for demos and tests. |
321
+ | `@mark1russell7/room-view/marks` | `layerMarks` and the type `AddOnMarks`: the marks of the layers of a scene, as plain data for a viewer. |
308
322
  | `@mark1russell7/room-view/three` | `createRoomViewer`, the themes and `solidGeometry`: the viewer in a page. It needs the package `three`. |
309
323
 
310
324
  The schemas examine the form of a record: the fields and their types. The checks examine its meaning. Use the two for a record from a file:
@@ -0,0 +1,75 @@
1
+ import { t as WallFrame } from "./frames-BYMK5ZId.js";
2
+ import { _ as WallFace, c as PlacedObject, l as PlanPoint, p as Scene } from "./room-NREa6vXr.js";
3
+ import { Point3, Transform3 } from "@mark1russell7/layout-contract";
4
+ /** These are the surfaces that an anchor can be on. */
5
+ declare const ANCHOR_SURFACES: readonly ["wall", "floor", "ceiling", "object"];
6
+ /** A surface of an anchor. */
7
+ type AnchorSurface = (typeof ANCHOR_SURFACES)[number];
8
+ /** An anchor on a face of a wall. The lengths are in the unit of the room. */
9
+ interface WallAnchor {
10
+ readonly on: "wall";
11
+ /** The `id` of the wall. */
12
+ readonly wall: string;
13
+ readonly face: WallFace;
14
+ /** The distance along the line of the wall, from `from` to the anchor. */
15
+ readonly offset: number;
16
+ /** The height of the anchor above the floor. */
17
+ readonly height: number;
18
+ }
19
+ /** An anchor on the floor, at a point of the plan. */
20
+ interface FloorAnchor {
21
+ readonly on: "floor";
22
+ readonly at: PlanPoint;
23
+ /** The `id` of the floor that has the point. Without it, the point is on any floor of the room. */
24
+ readonly floor?: string | undefined;
25
+ }
26
+ /** An anchor on the ceiling, above a point of the plan. The ceiling is at the height of the room. */
27
+ interface CeilingAnchor {
28
+ readonly on: "ceiling";
29
+ readonly at: PlanPoint;
30
+ /** The `id` of the floor below the point. Without it, the point is above any floor of the room. */
31
+ readonly floor?: string | undefined;
32
+ }
33
+ /**
34
+ * An anchor on a placed object. The point and the direction are in the frame of the object, before its turn.
35
+ * The origin of that frame is the center of the bottom of the object.
36
+ */
37
+ interface ObjectAnchor {
38
+ readonly on: "object";
39
+ /** The `id` of the placed object. */
40
+ readonly object: string;
41
+ /** The point in the frame of the object. The default is the center of its top. */
42
+ readonly at?: readonly [number, number, number] | undefined;
43
+ /** The direction out of the surface, in the frame of the object. The default is up: `[0, 0, 1]`. */
44
+ readonly out?: readonly [number, number, number] | undefined;
45
+ }
46
+ /** An anchor: a place in the space of the core, for a record of an add-on. */
47
+ type Anchor = WallAnchor | FloorAnchor | CeilingAnchor | ObjectAnchor;
48
+ /** The position of an anchor in the room, in meters. */
49
+ interface AnchorFrame {
50
+ /** The point of the anchor. */
51
+ readonly at: Point3;
52
+ /** The unit vector out of the surface, into the space of the room. */
53
+ readonly out: Point3;
54
+ }
55
+ /**
56
+ * The space of a scene, for the add-ons. It reads each wall, object and anchor of the scene.
57
+ * Make it once with `sceneSpace`, and give it to each add-on.
58
+ */
59
+ interface SceneSpace {
60
+ readonly scene: Scene;
61
+ /** The length of the unit of the room, in meters. */
62
+ readonly scale: number;
63
+ /** This function gives the frame of a wall in meters, or `undefined` when the room does not have the wall. */
64
+ readonly wall: (id: string) => WallFrame | undefined;
65
+ /** This function gives a placed object of the scene, or `undefined` when the scene does not have it. */
66
+ readonly object: (id: string) => PlacedObject | undefined;
67
+ /** This function gives the transform of a placed object in meters, or `undefined` when the object has no place. */
68
+ readonly transform: (id: string) => Transform3 | undefined;
69
+ /** This function gives the position of an anchor, or `undefined` when the anchor has no position. `checkAnchor` tells the reason. */
70
+ readonly frame: (anchor: Anchor) => AnchorFrame | undefined;
71
+ }
72
+ /** This function gives the space of a scene. The transforms of the objects are calculated one time, at the first use. */
73
+ declare function sceneSpace(scene: Scene): SceneSpace;
74
+ export { CeilingAnchor as a, SceneSpace as c, AnchorSurface as i, WallAnchor as l, Anchor as n, FloorAnchor as o, AnchorFrame as r, ObjectAnchor as s, ANCHOR_SURFACES as t, sceneSpace as u };
75
+ //# sourceMappingURL=anchors-BEnxNnSV.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"anchors-BEnxNnSV.d.ts","names":[],"sources":["../src/anchors.ts"],"mappings":";;;;cAUa;;KAGD,wBAAwB;;UAGnB;WACN;;WAEA;WACA,MAAM;;WAEN;;WAEA;;;UAIM;WACN;WACA,IAAI;;WAEJ;;;UAIM;WACN;WACA,IAAI;;WAEJ;;;;;;UAOM;WACN;;WAEA;;WAEA;;WAEA;;;KAIC,SAAS,aAAa,cAAc,gBAAgB;;UAG/C;;WAEN,IAAI;;WAEJ,KAAK;;;;;;UAOC;WACN,OAAO;;WAEP;;WAEA,OAAO,eAAe;;WAEtB,SAAS,eAAe;;WAExB,YAAY,eAAe;;WAE3B,QAAQ,QAAQ,WAAW;;;iBAiBtB,WAAW,OAAO,QAAQ"}
@@ -0,0 +1,39 @@
1
+ import { d as Room } from "./room-NREa6vXr.js";
2
+ import { Point, Transform3 } from "@mark1russell7/layout-contract";
3
+ /**
4
+ * The frame of a wall, in meters. A point of the wall has a distance along the line and a distance across it.
5
+ * The distance across is positive to the left, for a person who looks from the start to the end.
6
+ */
7
+ interface WallFrame {
8
+ /** The `id` of the wall. */
9
+ readonly id: string;
10
+ readonly start: Point;
11
+ readonly end: Point;
12
+ /** The unit vector from the start to the end. A wall with the length 0, or with a length that is not finite, has the vector (1, 0). */
13
+ readonly along: Point;
14
+ /** The unit vector to the left of `along`. */
15
+ readonly left: Point;
16
+ readonly length: number;
17
+ readonly thickness: number;
18
+ readonly height: number;
19
+ /** The distance across of the left face. It is 0 or more. */
20
+ readonly leftOffset: number;
21
+ /** The distance across of the right face. It is 0 or less. */
22
+ readonly rightOffset: number;
23
+ }
24
+ /** This function gives the frame of each wall of a room, in the sequence of the walls. */
25
+ declare function wallFrames(room: Room): readonly WallFrame[];
26
+ /**
27
+ * This function tells if a wall has an outline in the plan. Its ends and its thickness must be lengths in the range of the model,
28
+ * and its length and its thickness must be above 0. Only such a wall makes a corner, and the model makes only such a wall.
29
+ */
30
+ declare function wallHasOutline(frame: WallFrame): boolean;
31
+ /** This function gives the point of the plan at a distance along a wall and a distance across it, in meters. */
32
+ declare function wallPoint(frame: WallFrame, along: number, across: number): Point;
33
+ /**
34
+ * This function gives the transform from the frame of a wall to the room.
35
+ * In the frame of a wall, x is the distance along the wall and y is the distance across it. The height above the floor is z.
36
+ */
37
+ declare function wallTransform(frame: WallFrame): Transform3;
38
+ export { wallTransform as a, wallPoint as i, wallFrames as n, wallHasOutline as r, WallFrame as t };
39
+ //# sourceMappingURL=frames-BYMK5ZId.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"frames-BYMK5ZId.d.ts","names":[],"sources":["../src/frames.ts"],"mappings":";;;;;;UAQiB;;WAEN;WACA,OAAO;WACP,KAAK;;WAEL,OAAO;;WAEP,MAAM;WACN;WACA;WACA;;WAEA;;WAEA;;;iBA2BK,WAAW,MAAM,gBAAgB;;;;;iBASjC,eAAe,OAAO;;iBAKtB,UAAU,OAAO,WAAW,eAAe,iBAAiB;;;;;iBAW5D,cAAc,OAAO,YAAY"}
package/build/index.d.ts CHANGED
@@ -1,7 +1,11 @@
1
1
  import { C as lengthsInRange, S as LengthUnit, T as unitsPer, _ as WallFace, a as Opening, b as LARGEST_LENGTH, c as PlacedObject, d as Room, f as SCENE_SCHEMA, g as Wall, h as WALL_SIDES, i as OPENING_KINDS, l as PlanPoint, m as WALL_FACES, n as CircuitLoad, o as OpeningKind, p as Scene, r as Floor, s as Outlet, t as Circuit, u as ROOM_SCHEMA, v as WallSide, w as metersPer, x as LENGTH_UNITS, y as isLayerName } from "./room-NREa6vXr.js";
2
- import { A as solidVolume, B as wallTransform, C as SolidShape, D as roomSolids, E as objectTransforms, F as wallFootprints, I as WallFrame, L as wallFrames, M as JoinOptions, N as MITER_LIMIT, O as sceneSolids, P as WallFootprint, R as wallHasOutline, S as SolidOptions, T as boundsOfSolids, _ as PlacedBox, a as LoadLevel, b as Solid, c as SHAPE_OUTLINES, d as levelShape, f as outletLevels, g as OUTLET_PLATE, h as GLASS_THICKNESS, i as LevelShape, j as JOIN_TOLERANCE, k as solidCorners, l as ShapeOutline, m as FLOOR_DEPTH, n as LEVEL_SHAPES, o as LoadOptions, p as shapeRing, r as LOAD_LEVELS, s as NEAR_LIMIT, t as CircuitState, u as circuitStates, v as Prism, w as TO_Y_UP, x as SolidKind, y as SOLID_KINDS, z as wallPoint } from "./loads-C3Nrj3Gd.js";
2
+ import { a as wallTransform, i as wallPoint, n as wallFrames, r as wallHasOutline, t as WallFrame } from "./frames-BYMK5ZId.js";
3
+ import { a as wallFootprints, i as WallFootprint, n as JoinOptions, r as MITER_LIMIT, t as JOIN_TOLERANCE } from "./joins-2p01wnr_.js";
4
+ import { A as solidVolume, C as SolidShape, D as roomSolids, E as objectTransforms, O as sceneSolids, S as SolidOptions, T as boundsOfSolids, _ as PlacedBox, a as LoadLevel, b as Solid, c as SHAPE_OUTLINES, d as levelShape, f as outletLevels, g as OUTLET_PLATE, h as GLASS_THICKNESS, i as LevelShape, k as solidCorners, l as ShapeOutline, m as FLOOR_DEPTH, n as LEVEL_SHAPES, o as LoadOptions, p as shapeRing, r as LOAD_LEVELS, s as NEAR_LIMIT, t as CircuitState, u as circuitStates, v as Prism, w as TO_Y_UP, x as SolidKind, y as SOLID_KINDS } from "./loads-CriZuwcu.js";
5
+ import { C as recordName, S as parseRecordName, _ as RECORD_KINDS, a as LayerParse, b as checkRoom, c as ANCHOR_CODES, d as CheckOptions, f as FINDING_CODES, g as FindingLevel, h as FindingCode, i as LayerFinding, l as AnchorCode, m as Finding, n as AddOnFault, o as checkLayers, p as FINDING_LEVELS, r as LAYER_CODES, s as readLayer, t as AddOn, u as AnchorFault, v as RecordKind, x as checkScene, y as checkAnchor } from "./layers-CKx0dcM0.js";
6
+ import { a as CeilingAnchor, c as SceneSpace, i as AnchorSurface, l as WallAnchor, n as Anchor, o as FloorAnchor, r as AnchorFrame, s as ObjectAnchor, t as ANCHOR_SURFACES, u as sceneSpace } from "./anchors-BEnxNnSV.js";
3
7
  import { A as SurveyTurn, C as SurveyCheckResult, D as SurveyOutlet, E as SurveyOptions, M as expandSurvey, O as SurveyResult, S as SurveyCheck, T as SurveyObject, _ as expandLevel, a as ConnectionFault, b as SURVEY_SCHEMA, c as Level, d as LevelOptions, f as LevelResult, g as RoomPlace, h as ROOM_PLACES, i as ConnectionEnd, j as convertSurvey, k as SurveySide, l as LevelConnection, m as LevelRoomResult, n as CONNECTION_TURN_LIMIT, o as ConnectionUse, p as LevelRoom, r as CONNECTION_USES, s as LEVEL_SCHEMA, t as CONNECTION_FAULTS, u as LevelConnectionResult, v as CLOSURE_LIMIT, w as SurveyClosure, x as Survey, y as SQUARE_TURNS } from "./level-Bmz-H5iH.js";
4
- import { Point3, Ring, Transform3 } from "@mark1russell7/layout-contract";
8
+ import { Ring } from "@mark1russell7/layout-contract";
5
9
  /** The outline of one solid in the plan of a room: the solid as a camera above the room sees it. */
6
10
  export interface PlanShape {
7
11
  /** The `id` of the solid. */
@@ -35,213 +39,5 @@ export interface PlanOptions extends SolidOptions {
35
39
  * Thus a drawing in this sequence shows the room as a camera above it sees the room.
36
40
  */
37
41
  export declare function planShapes(scene: Scene, options?: PlanOptions): readonly PlanShape[];
38
- /** These are the surfaces that an anchor can be on. */
39
- export declare const ANCHOR_SURFACES: readonly ["wall", "floor", "ceiling", "object"];
40
- /** A surface of an anchor. */
41
- export type AnchorSurface = (typeof ANCHOR_SURFACES)[number];
42
- /** An anchor on a face of a wall. The lengths are in the unit of the room. */
43
- export interface WallAnchor {
44
- readonly on: "wall";
45
- /** The `id` of the wall. */
46
- readonly wall: string;
47
- readonly face: WallFace;
48
- /** The distance along the line of the wall, from `from` to the anchor. */
49
- readonly offset: number;
50
- /** The height of the anchor above the floor. */
51
- readonly height: number;
52
- }
53
- /** An anchor on the floor, at a point of the plan. */
54
- export interface FloorAnchor {
55
- readonly on: "floor";
56
- readonly at: PlanPoint;
57
- /** The `id` of the floor that has the point. Without it, the point is on any floor of the room. */
58
- readonly floor?: string | undefined;
59
- }
60
- /** An anchor on the ceiling, above a point of the plan. The ceiling is at the height of the room. */
61
- export interface CeilingAnchor {
62
- readonly on: "ceiling";
63
- readonly at: PlanPoint;
64
- /** The `id` of the floor below the point. Without it, the point is above any floor of the room. */
65
- readonly floor?: string | undefined;
66
- }
67
- /**
68
- * An anchor on a placed object. The point and the direction are in the frame of the object, before its turn.
69
- * The origin of that frame is the center of the bottom of the object.
70
- */
71
- export interface ObjectAnchor {
72
- readonly on: "object";
73
- /** The `id` of the placed object. */
74
- readonly object: string;
75
- /** The point in the frame of the object. The default is the center of its top. */
76
- readonly at?: readonly [number, number, number] | undefined;
77
- /** The direction out of the surface, in the frame of the object. The default is up: `[0, 0, 1]`. */
78
- readonly out?: readonly [number, number, number] | undefined;
79
- }
80
- /** An anchor: a place in the space of the core, for a record of an add-on. */
81
- export type Anchor = WallAnchor | FloorAnchor | CeilingAnchor | ObjectAnchor;
82
- /** The position of an anchor in the room, in meters. */
83
- export interface AnchorFrame {
84
- /** The point of the anchor. */
85
- readonly at: Point3;
86
- /** The unit vector out of the surface, into the space of the room. */
87
- readonly out: Point3;
88
- }
89
- /**
90
- * The space of a scene, for the add-ons. It reads each wall, object and anchor of the scene.
91
- * Make it once with `sceneSpace`, and give it to each add-on.
92
- */
93
- export interface SceneSpace {
94
- readonly scene: Scene;
95
- /** The length of the unit of the room, in meters. */
96
- readonly scale: number;
97
- /** This function gives the frame of a wall in meters, or `undefined` when the room does not have the wall. */
98
- readonly wall: (id: string) => WallFrame | undefined;
99
- /** This function gives a placed object of the scene, or `undefined` when the scene does not have it. */
100
- readonly object: (id: string) => PlacedObject | undefined;
101
- /** This function gives the transform of a placed object in meters, or `undefined` when the object has no place. */
102
- readonly transform: (id: string) => Transform3 | undefined;
103
- /** This function gives the position of an anchor, or `undefined` when the anchor has no position. `checkAnchor` tells the reason. */
104
- readonly frame: (anchor: Anchor) => AnchorFrame | undefined;
105
- }
106
- /** This function gives the space of a scene. The transforms of the objects are calculated one time, at the first use. */
107
- export declare function sceneSpace(scene: Scene): SceneSpace;
108
- /** These are the levels of a finding. An error is a fault that the model cannot show. A warning is a fault that the model can show. */
109
- export declare const FINDING_LEVELS: readonly ["error", "warning"];
110
- /** A level of a finding. */
111
- export type FindingLevel = (typeof FINDING_LEVELS)[number];
112
- /** These are the kinds of the records that a finding can name. */
113
- export declare const RECORD_KINDS: readonly ["room", "wall", "opening", "floor", "outlet", "circuit", "object", "load"];
114
- /** A kind of record. */
115
- export type RecordKind = (typeof RECORD_KINDS)[number];
116
- /**
117
- * This function gives the name of a record: its kind, a colon and its `id`, for example `object:desk`.
118
- * The kind of a record of a layer is the name of the layer, for example `electrical/1`. A finding, a mark and the selection use this name.
119
- */
120
- export declare function recordName(kind: string, id: string): string;
121
- /** This function gives the kind and the `id` of a record name, or `undefined` for a text with no kind. A kind has no colon, so the first colon ends it. */
122
- export declare function parseRecordName(name: string): {
123
- readonly kind: string;
124
- readonly id: string;
125
- } | undefined;
126
- /** These are the codes of the findings. */
127
- export declare const FINDING_CODES: readonly ["number-not-finite", "number-too-large", "id-duplicate", "size-not-positive", "wall-length", "wall-short", "wall-overlap", "opening-wall", "opening-range", "opening-height", "opening-overlap", "outlet-wall", "outlet-circuit", "outlet-range", "outlet-in-opening", "floor-ring", "circuit-limit", "object-parent", "object-cycle", "object-outlet", "object-outside", "object-overlap", "object-in-wall", "load-circuit", "load-watts"];
128
- /** A code of a finding. */
129
- export type FindingCode = (typeof FINDING_CODES)[number];
130
- /** A finding: one fault of a room record or a scene record. */
131
- export interface Finding {
132
- readonly level: FindingLevel;
133
- readonly code: FindingCode;
134
- /** The kind of the record with the fault. */
135
- readonly record: RecordKind;
136
- /** The `id` of the record with the fault. For a load, it is the `id` of the circuit. For the room record, it is empty. */
137
- readonly at: string;
138
- /** The fault in plain words, with the values. */
139
- readonly message: string;
140
- /**
141
- * The `id` of the second record of the fault. It is the other opening or the other object of an overlap, or the opening that an outlet is in.
142
- * It is also the wall that an object overlaps, or the parent or the outlet that an object names. A fault of one record has none.
143
- */
144
- readonly other?: string | undefined;
145
- }
146
- /** The options of the checks. Give the options that the model gets. */
147
- export interface CheckOptions {
148
- /** The options of the corners of the walls. */
149
- readonly joins?: JoinOptions | undefined;
150
- }
151
- /**
152
- * This function gives each fault of a room record. A room with no finding of the level `error` gives a full model.
153
- *
154
- * The function examines the meaning of the record: for example, an opening must be in its wall. The schema examines the form of the record.
155
- */
156
- export declare function checkRoom(room: Room, options?: CheckOptions): readonly Finding[];
157
- /**
158
- * This function gives each fault of a scene record: the faults of its room, then the faults of its placed objects and its loads.
159
- * A scene with no finding of the level `error` gives a full model.
160
- */
161
- export declare function checkScene(scene: Scene, options?: CheckOptions): readonly Finding[];
162
- /** These are the codes of the faults of an anchor. */
163
- export declare const ANCHOR_CODES: readonly ["anchor-not-finite", "anchor-wall", "anchor-object", "anchor-floor", "anchor-range", "anchor-direction", "anchor-in-opening", "anchor-outside"];
164
- /** A code of a fault of an anchor. */
165
- export type AnchorCode = (typeof ANCHOR_CODES)[number];
166
- /** A fault of an anchor. `checkLayers` gives it the layer and the key of the anchor. */
167
- export interface AnchorFault {
168
- readonly level: FindingLevel;
169
- readonly code: AnchorCode;
170
- /** The fault in plain words, with the values. */
171
- readonly message: string;
172
- /** The `id` of the second record of the fault: the opening that the anchor is in. A different fault has none. */
173
- readonly other?: string | undefined;
174
- }
175
- /**
176
- * This function gives the faults of an anchor in the space of a scene. `name` starts each message.
177
- * An error tells that the anchor has no position. A warning tells a fault that the model can show.
178
- */
179
- export declare function checkAnchor(anchor: Anchor, space: SceneSpace, name?: string): readonly AnchorFault[];
180
- /** The result of the read of a layer: the layer, or the faults of its form. */
181
- export type LayerParse<Layer> = {
182
- readonly ok: true;
183
- readonly layer: Layer;
184
- } | {
185
- readonly ok: false;
186
- readonly errors: readonly string[];
187
- };
188
- /** A fault that an add-on finds in its layer. */
189
- export interface AddOnFault {
190
- readonly level: FindingLevel;
191
- /** The code of the fault. The add-on gives its own codes. */
192
- readonly code: string;
193
- /** The `id` of the record with the fault. For the layer, it is empty. */
194
- readonly at: string;
195
- /** The fault in plain words, with the values. */
196
- readonly message: string;
197
- /** The `id` of the second record of the fault. A fault of one record has none. */
198
- readonly other?: string | undefined;
199
- }
200
- /**
201
- * An add-on: one topic on the core, for example electrical, plumbing or light.
202
- * A host gives a list of add-ons to `checkLayers`. The core knows only this type.
203
- */
204
- export interface AddOn<Layer> {
205
- /** The name of the format of the layer, for example `electrical/1`. It is the key of the layer in `Scene.layers`. */
206
- readonly schema: string;
207
- /** This function reads the JSON of a layer. */
208
- parse(value: unknown): LayerParse<Layer>;
209
- /**
210
- * This function gives the anchors of the records of a layer, by a key.
211
- * The key is the `id` of a record, or the `id` and a position for a record with many anchors.
212
- */
213
- anchors(layer: Layer): ReadonlyMap<string, Anchor>;
214
- /** This function gives the layer with new anchors, by the keys of `anchors`. The core uses it when it moves the records of a room. */
215
- withAnchors(layer: Layer, anchors: ReadonlyMap<string, Anchor>): Layer;
216
- /** This function gives the faults of the meaning of a layer. The core examines the anchors, so this function does not. */
217
- check(layer: Layer, space: SceneSpace): readonly AddOnFault[];
218
- }
219
- /** These are the codes of the faults of a layer that the core finds. */
220
- export declare const LAYER_CODES: readonly ["layer-name", "layer-unknown", "layer-form"];
221
- /** A finding of a layer: a fault of its form, of an anchor or of the meaning of its records. */
222
- export interface LayerFinding {
223
- readonly level: FindingLevel;
224
- /** A code of `LAYER_CODES` or `ANCHOR_CODES`, or a code of the add-on. */
225
- readonly code: string;
226
- /** The key of the layer in `Scene.layers`. */
227
- readonly layer: string;
228
- /** The key of the anchor, or the `id` of the record with the fault. For the layer, it is empty. */
229
- readonly at: string;
230
- /** The fault in plain words, with the values. */
231
- readonly message: string;
232
- /** The `id` of the second record of the fault. A fault of one record has none. */
233
- readonly other?: string | undefined;
234
- }
235
- /** This function reads the layer of an add-on in a scene. It gives `undefined` when the scene has no layer of the add-on. */
236
- export declare function readLayer<Layer>(scene: Scene, addOn: AddOn<Layer>): LayerParse<Layer> | undefined;
237
- /**
238
- * This function gives the findings of the layers of a scene, with a list of add-ons.
239
- * Each layer gets the faults of its form, of each anchor and of the meaning of its records. A layer of no add-on of the list gets a warning.
240
- * The findings are in the order of the layer keys, then of the record keys. Thus equal inputs give equal findings.
241
- *
242
- * The name of the record of a finding is `recordName(finding.layer, finding.at)`, so a finding selects its mark.
243
- * `checkScene` examines the core, and this function examines the layers.
244
- */
245
- export declare function checkLayers(scene: Scene, addOns: readonly AddOn<unknown>[]): readonly LayerFinding[];
246
- export { CLOSURE_LIMIT, CONNECTION_FAULTS, CONNECTION_TURN_LIMIT, CONNECTION_USES, Circuit, CircuitLoad, CircuitState, ConnectionEnd, ConnectionFault, ConnectionUse, FLOOR_DEPTH, Floor, GLASS_THICKNESS, JOIN_TOLERANCE, JoinOptions, LARGEST_LENGTH, LENGTH_UNITS, LEVEL_SCHEMA, LEVEL_SHAPES, LOAD_LEVELS, LengthUnit, Level, LevelConnection, LevelConnectionResult, LevelOptions, LevelResult, LevelRoom, LevelRoomResult, LevelShape, LoadLevel, LoadOptions, MITER_LIMIT, NEAR_LIMIT, OPENING_KINDS, OUTLET_PLATE, Opening, OpeningKind, Outlet, PlacedBox, PlacedObject, PlanPoint, Prism, ROOM_PLACES, ROOM_SCHEMA, Room, RoomPlace, SCENE_SCHEMA, SHAPE_OUTLINES, SOLID_KINDS, SQUARE_TURNS, SURVEY_SCHEMA, Scene, ShapeOutline, Solid, SolidKind, SolidOptions, SolidShape, Survey, SurveyCheck, SurveyCheckResult, SurveyClosure, SurveyObject, SurveyOptions, SurveyOutlet, SurveyResult, SurveySide, SurveyTurn, TO_Y_UP, WALL_FACES, WALL_SIDES, Wall, WallFace, WallFootprint, WallFrame, WallSide, boundsOfSolids, circuitStates, convertSurvey, expandLevel, expandSurvey, isLayerName, lengthsInRange, levelShape, metersPer, objectTransforms, outletLevels, roomSolids, sceneSolids, shapeRing, solidCorners, solidVolume, unitsPer, wallFootprints, wallFrames, wallHasOutline, wallPoint, wallTransform };
42
+ export { ANCHOR_CODES, ANCHOR_SURFACES, AddOn, AddOnFault, Anchor, AnchorCode, AnchorFault, AnchorFrame, AnchorSurface, CLOSURE_LIMIT, CONNECTION_FAULTS, CONNECTION_TURN_LIMIT, CONNECTION_USES, CeilingAnchor, CheckOptions, Circuit, CircuitLoad, CircuitState, ConnectionEnd, ConnectionFault, ConnectionUse, FINDING_CODES, FINDING_LEVELS, FLOOR_DEPTH, Finding, FindingCode, FindingLevel, Floor, FloorAnchor, GLASS_THICKNESS, JOIN_TOLERANCE, JoinOptions, LARGEST_LENGTH, LAYER_CODES, LENGTH_UNITS, LEVEL_SCHEMA, LEVEL_SHAPES, LOAD_LEVELS, LayerFinding, LayerParse, LengthUnit, Level, LevelConnection, LevelConnectionResult, LevelOptions, LevelResult, LevelRoom, LevelRoomResult, LevelShape, LoadLevel, LoadOptions, MITER_LIMIT, NEAR_LIMIT, OPENING_KINDS, OUTLET_PLATE, ObjectAnchor, Opening, OpeningKind, Outlet, PlacedBox, PlacedObject, PlanPoint, Prism, RECORD_KINDS, ROOM_PLACES, ROOM_SCHEMA, RecordKind, Room, RoomPlace, SCENE_SCHEMA, SHAPE_OUTLINES, SOLID_KINDS, SQUARE_TURNS, SURVEY_SCHEMA, Scene, SceneSpace, ShapeOutline, Solid, SolidKind, SolidOptions, SolidShape, Survey, SurveyCheck, SurveyCheckResult, SurveyClosure, SurveyObject, SurveyOptions, SurveyOutlet, SurveyResult, SurveySide, SurveyTurn, TO_Y_UP, WALL_FACES, WALL_SIDES, Wall, WallAnchor, WallFace, WallFootprint, WallFrame, WallSide, boundsOfSolids, checkAnchor, checkLayers, checkRoom, checkScene, circuitStates, convertSurvey, expandLevel, expandSurvey, isLayerName, lengthsInRange, levelShape, metersPer, objectTransforms, outletLevels, parseRecordName, readLayer, recordName, roomSolids, sceneSolids, sceneSpace, shapeRing, solidCorners, solidVolume, unitsPer, wallFootprints, wallFrames, wallHasOutline, wallPoint, wallTransform };
247
43
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/plan.ts","../src/anchors.ts","../src/check.ts","../src/layers.ts"],"mappings":";;;;;iBAKiB;;WAEN;WACA,MAAM;;WAEN;;WAEA,MAAM;;WAEN;;WAEA;;;;;;wBAOK,UAAU,OAAO,QAAQ;;iBAgBxB,oBAAoB;;;;;WAK1B;;;;;;;wBAQK,WAAW,OAAO,OAAO,UAAS,uBAA4B;;qBC1CjE;;YAGD,wBAAwB;;iBAGnB;WACN;;WAEA;WACA,MAAM;;WAEN;;WAEA;;;iBAIM;WACN;WACA,IAAI;;WAEJ;;;iBAIM;WACN;WACA,IAAI;;WAEJ;;;;;;iBAOM;WACN;;WAEA;;WAEA;;WAEA;;;YAIC,SAAS,aAAa,cAAc,gBAAgB;;iBAG/C;;WAEN,IAAI;;WAEJ,KAAK;;;;;;iBAOC;WACN,OAAO;;WAEP;;WAEA,OAAO,eAAe;;WAEtB,SAAS,eAAe;;WAExB,YAAY,eAAe;;WAE3B,QAAQ,QAAQ,WAAW;;;wBAYtB,WAAW,OAAO,QAAQ;;qBCtF7B;;YAGD,uBAAuB;;qBAGtB;;YAYD,qBAAqB;;;;;wBAMjB,WAAW,cAAc;;wBAKzB,gBAAgB;WAA0B;WAAuB;;;qBAMpE;;YAuDD,sBAAsB;;iBAGjB;WACN,OAAO;WACP,MAAM;;WAEN,QAAQ;;WAER;;WAEA;;;;;WAKA;;;iBAIM;;WAEN,QAAQ;;;;;;;wBA2CH,UAAU,MAAM,MAAM,UAAS,wBAA6B;;;;;wBAwK5D,WAAW,OAAO,OAAO,UAAS,wBAA6B;;qBAkFlE;;YAYD,qBAAqB;;iBAGhB;WACN,OAAO;WACP,MAAM;;WAEN;;WAEA;;;;;;wBAOK,YAAY,QAAQ,QAAQ,OAAO,YAAY,yBAAuC;;YCjb1F,WAAW;WAAoB;WAAmB,OAAO;;WAAqB;WAAoB;;;iBAG7F;WACN,OAAO;;WAEP;;WAEA;;WAEA;;WAEA;;;;;;iBAOM,MAAM;;WAEZ;;EAET,MAAM,iBAAiB,WAAW;;;;;EAKlC,QAAQ,OAAO,QAAQ,oBAAoB;;EAE3C,YAAY,OAAO,OAAO,SAAS,oBAAoB,UAAU;;EAEjE,MAAM,OAAO,OAAO,OAAO,sBAAsB;;;qBAItC;;iBAGI;WACN,OAAO;;WAEP;;WAEA;;WAEA;;WAEA;;WAEA;;;wBAgBK,UAAU,OAAO,OAAO,OAAO,OAAO,MAAM,SAAS,WAAW;;;;;;;;;wBAahE,YAAY,OAAO,OAAO,iBAAiB,4BAA4B"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/plan.ts"],"mappings":";;;;;;;;;iBAKiB;;WAEN;WACA,MAAM;;WAEN;;WAEA,MAAM;;WAEN;;WAEA;;;;;;wBAOK,UAAU,OAAO,QAAQ;;iBAgBxB,oBAAoB;;;;;WAK1B;;;;;;;wBAQK,WAAW,OAAO,OAAO,UAAS,uBAA4B"}