@mark1russell7/room-view 0.2.4 → 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.
Files changed (43) hide show
  1. package/README.md +36 -34
  2. package/build/{anchors-Ba3OUmhF.js → check-DI_B57qy.js} +10 -233
  3. package/build/check-DI_B57qy.js.map +1 -0
  4. package/build/index.d.ts +4 -5
  5. package/build/index.d.ts.map +1 -1
  6. package/build/index.js +4 -5
  7. package/build/index.js.map +1 -1
  8. package/build/{layers-B5nL_lVW.js → layers-CDNFVXds.js} +161 -5
  9. package/build/layers-CDNFVXds.js.map +1 -0
  10. package/build/{layers-BO_MMtQJ.d.ts → layers-CYZwt1bH.d.ts} +34 -9
  11. package/build/layers-CYZwt1bH.d.ts.map +1 -0
  12. package/build/{level-CXCIX08K.js → level-BERjgyrT.js} +11 -37
  13. package/build/level-BERjgyrT.js.map +1 -0
  14. package/build/{level-Cjcf3u20.d.ts → level-m-mJ_3Ok.d.ts} +11 -19
  15. package/build/level-m-mJ_3Ok.d.ts.map +1 -0
  16. package/build/marks.d.ts +2 -2
  17. package/build/marks.js +1 -2
  18. package/build/marks.js.map +1 -1
  19. package/build/sample.d.ts +4 -4
  20. package/build/sample.d.ts.map +1 -1
  21. package/build/sample.js +21 -217
  22. package/build/sample.js.map +1 -1
  23. package/build/schema.d.ts +59 -9
  24. package/build/schema.d.ts.map +1 -1
  25. package/build/schema.js +250 -91
  26. package/build/schema.js.map +1 -1
  27. package/build/{solids-S_j17vFJ.d.ts → solids-OiTlb_Pm.d.ts} +9 -54
  28. package/build/solids-OiTlb_Pm.d.ts.map +1 -0
  29. package/build/three.d.ts +8 -16
  30. package/build/three.d.ts.map +1 -1
  31. package/build/three.js +12 -106
  32. package/build/three.js.map +1 -1
  33. package/package.json +1 -1
  34. package/build/anchors-Ba3OUmhF.js.map +0 -1
  35. package/build/layers-B5nL_lVW.js.map +0 -1
  36. package/build/layers-BO_MMtQJ.d.ts.map +0 -1
  37. package/build/level-CXCIX08K.js.map +0 -1
  38. package/build/level-Cjcf3u20.d.ts.map +0 -1
  39. package/build/loads-CtHa4EHo.js +0 -103
  40. package/build/loads-CtHa4EHo.js.map +0 -1
  41. package/build/loads-Diy6-Ekz.d.ts +0 -73
  42. package/build/loads-Diy6-Ekz.d.ts.map +0 -1
  43. package/build/solids-S_j17vFJ.d.ts.map +0 -1
@@ -1,9 +1,10 @@
1
- import { c as checkAnchor, r as sceneSpace } from "./anchors-Ba3OUmhF.js";
1
+ import { A as lengthsInRange, E as wallPoint, a as checkAnchor, g as objectTransforms, j as metersPer, w as wallFrames } from "./check-DI_B57qy.js";
2
+ import { length3, rotatePoint3, scalePoint3, transformPoint3 } from "@mark1russell7/layout-contract";
2
3
  // src/room.ts
3
4
  /** The name of the format of a room record. */
4
- const ROOM_SCHEMA = "room/1";
5
+ const ROOM_SCHEMA = "room/2";
5
6
  /** The name of the format of a scene record. */
6
- const SCENE_SCHEMA = "scene/1";
7
+ const SCENE_SCHEMA = "scene/2";
7
8
  /**
8
9
  * This function tells if a text is the name of a layer: a word, a slash and a version, for example `electrical/1`.
9
10
  * The word has lowercase letters, digits and hyphens. Thus a layer name has no colon, and `recordName` gives each record one name.
@@ -25,12 +26,167 @@ const OPENING_KINDS = [
25
26
  "window",
26
27
  "gap"
27
28
  ];
29
+ // src/anchors.ts
30
+ /** These are the surfaces that an anchor can be on. */
31
+ const ANCHOR_SURFACES = [
32
+ "wall",
33
+ "floor",
34
+ "ceiling",
35
+ "object"
36
+ ];
37
+ const UP = {
38
+ x: 0,
39
+ y: 0,
40
+ z: 1
41
+ };
42
+ const DOWN = {
43
+ x: 0,
44
+ y: 0,
45
+ z: -1
46
+ };
47
+ /** This function tells if each value of a point is a length in the range of the model. */
48
+ function inRange(point) {
49
+ return Number.isFinite(point.x) && Number.isFinite(point.y) && Number.isFinite(point.z) && lengthsInRange(point.x, point.y, point.z);
50
+ }
51
+ /** This function gives a point with no negative zero. JSON has no negative zero, so a frame goes through JSON with no change. */
52
+ function plainPoint(point) {
53
+ return {
54
+ x: point.x + 0,
55
+ y: point.y + 0,
56
+ z: point.z + 0
57
+ };
58
+ }
59
+ /** This function gives the space of a scene. The transforms of the objects are calculated one time, at the first use. */
60
+ function sceneSpace(scene) {
61
+ const scale = metersPer(scene.room.unit);
62
+ const walls = new Map(wallFrames(scene.room).map((frame) => [frame.id, frame]));
63
+ const objects = new Map((scene.objects ?? []).map((object) => [object.id, object]));
64
+ let transforms;
65
+ const transform = (id) => {
66
+ transforms ??= objectTransforms(scene);
67
+ return transforms.get(id);
68
+ };
69
+ const frame = (anchor) => {
70
+ let found;
71
+ if (anchor.on === "wall") {
72
+ const wall = walls.get(anchor.wall);
73
+ if (wall === void 0) return void 0;
74
+ const point = wallPoint(wall, anchor.offset * scale, anchor.face === "left" ? wall.leftOffset : wall.rightOffset);
75
+ const sign = anchor.face === "left" ? 1 : -1;
76
+ found = {
77
+ at: {
78
+ x: point.x,
79
+ y: point.y,
80
+ z: anchor.height * scale
81
+ },
82
+ out: {
83
+ x: wall.left.x * sign,
84
+ y: wall.left.y * sign,
85
+ z: 0
86
+ }
87
+ };
88
+ } else if (anchor.on === "floor") found = {
89
+ at: {
90
+ x: anchor.at[0] * scale,
91
+ y: anchor.at[1] * scale,
92
+ z: 0
93
+ },
94
+ out: UP
95
+ };
96
+ else if (anchor.on === "ceiling") found = {
97
+ at: {
98
+ x: anchor.at[0] * scale,
99
+ y: anchor.at[1] * scale,
100
+ z: scene.room.height * scale
101
+ },
102
+ out: DOWN
103
+ };
104
+ else {
105
+ const object = objects.get(anchor.object);
106
+ const place = transform(anchor.object);
107
+ if (object === void 0 || place === void 0) return void 0;
108
+ const [x, y, z] = anchor.at ?? [
109
+ 0,
110
+ 0,
111
+ object.size[2]
112
+ ];
113
+ const [ox, oy, oz] = anchor.out ?? [
114
+ 0,
115
+ 0,
116
+ 1
117
+ ];
118
+ const out = {
119
+ x: ox,
120
+ y: oy,
121
+ z: oz
122
+ };
123
+ const size = length3(out);
124
+ if (!(size > 0) || !Number.isFinite(size)) return void 0;
125
+ found = {
126
+ at: transformPoint3(place, {
127
+ x: x * scale,
128
+ y: y * scale,
129
+ z: z * scale
130
+ }),
131
+ out: rotatePoint3(place.rotation, scalePoint3(out, 1 / size))
132
+ };
133
+ }
134
+ const plain = {
135
+ at: plainPoint(found.at),
136
+ out: plainPoint(found.out)
137
+ };
138
+ return inRange(plain.at) && inRange(plain.out) ? plain : void 0;
139
+ };
140
+ return {
141
+ scene,
142
+ scale,
143
+ wall: (id) => walls.get(id),
144
+ object: (id) => objects.get(id),
145
+ transform,
146
+ frame
147
+ };
148
+ }
149
+ /**
150
+ * This function gives an anchor with each length times a factor. A direction stays, because it has no unit.
151
+ * `convertSurvey` uses it to change the unit of the anchors of a layer.
152
+ */
153
+ function scaleAnchor(anchor, factor) {
154
+ if (anchor.on === "wall") return {
155
+ ...anchor,
156
+ offset: anchor.offset * factor,
157
+ height: anchor.height * factor
158
+ };
159
+ if (anchor.on === "object") {
160
+ if (anchor.at === void 0) return anchor;
161
+ const [x, y, z] = anchor.at;
162
+ return {
163
+ ...anchor,
164
+ at: [
165
+ x * factor,
166
+ y * factor,
167
+ z * factor
168
+ ]
169
+ };
170
+ }
171
+ const [x, y] = anchor.at;
172
+ return {
173
+ ...anchor,
174
+ at: [x * factor, y * factor]
175
+ };
176
+ }
28
177
  // src/order.ts
29
178
  /** This function compares two texts by their code points, so the order does not change with the language of a computer. */
30
179
  function compareText(a, b) {
31
180
  return a < b ? -1 : a > b ? 1 : 0;
32
181
  }
33
182
  // src/layers.ts
183
+ /** These are the kinds of the files of the core: `room`, `scene`, `survey` and `level`. */
184
+ const FILE_KINDS = [
185
+ "room",
186
+ "scene",
187
+ "survey",
188
+ "level"
189
+ ];
34
190
  /**
35
191
  * This function gives the name in a level of a record of a room. The name is the `id` of the room, a slash and the `id` in the survey.
36
192
  * `expandLevel` gives each wall, each opening and each placed object such a name. The function `join` of an add-on gives it to the records of a room.
@@ -242,6 +398,6 @@ function joinLayers(own, rooms, addOns) {
242
398
  findings
243
399
  };
244
400
  }
245
- export { moveLayers as a, compareText as c, SCENE_SCHEMA as d, WALL_FACES as f, layerPart as i, OPENING_KINDS as l, isLayerName as m, checkLayers as n, readLayer as o, WALL_SIDES as p, joinLayers as r, roomName as s, LAYER_CODES as t, ROOM_SCHEMA as u };
401
+ export { WALL_SIDES as _, layerPart as a, roomName as c, scaleAnchor as d, sceneSpace as f, WALL_FACES as g, SCENE_SCHEMA as h, joinLayers as i, compareText as l, ROOM_SCHEMA as m, LAYER_CODES as n, moveLayers as o, OPENING_KINDS as p, checkLayers as r, readLayer as s, FILE_KINDS as t, ANCHOR_SURFACES as u, isLayerName as v };
246
402
 
247
- //# sourceMappingURL=layers-B5nL_lVW.js.map
403
+ //# sourceMappingURL=layers-CDNFVXds.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layers-CDNFVXds.js","names":[],"sources":["../src/room.ts","../src/anchors.ts","../src/order.ts","../src/layers.ts"],"sourcesContent":["import type { Ring } from \"@mark1russell7/layout-contract\";\nimport type { LengthUnit } from \"./units.ts\";\n\n/** A point of the plan: `[x, y]`. The plan is the view from above, and the z axis points up. */\nexport type PlanPoint = readonly [number, number];\n\n/** The name of the format of a room record. */\nexport const ROOM_SCHEMA = \"room/2\";\n\n/** The name of the format of a scene record. */\nexport const SCENE_SCHEMA = \"scene/2\";\n\n/**\n * This function tells if a text is the name of a layer: a word, a slash and a version, for example `electrical/1`.\n * The word has lowercase letters, digits and hyphens. Thus a layer name has no colon, and `recordName` gives each record one name.\n */\nexport function isLayerName(text: string): boolean {\n return /^[a-z][a-z0-9-]*\\/[0-9]+$/.test(text);\n}\n\n/** These are the sides of the line of a wall that can have the wall. */\nexport const WALL_SIDES: readonly [\"center\", \"left\", \"right\"] = [\"center\", \"left\", \"right\"];\n\n/**\n * The side of the line of a wall that has the wall, for a person who looks from `from` to `to`.\n * With `center`, the line is the middle of the wall. With `left` or `right`, the line is one face of the wall.\n */\nexport type WallSide = (typeof WALL_SIDES)[number];\n\n/** These are the faces of a wall, for a person who looks from `from` to `to`. */\nexport const WALL_FACES: readonly [\"left\", \"right\"] = [\"left\", \"right\"];\n\n/** A face of a wall. */\nexport type WallFace = (typeof WALL_FACES)[number];\n\n/**\n * A wall: a straight line in the plan, with a thickness and a height.\n * A tape measure gives the faces of a wall, so `side` lets the line be a face. Two walls with a common end make a corner.\n */\nexport interface Wall {\n readonly id: string;\n readonly from: PlanPoint;\n readonly to: PlanPoint;\n /** The thickness of the wall. The default is `wallThickness` of the room. */\n readonly thickness?: number | undefined;\n /** The height of the wall. The default is `height` of the room. */\n readonly height?: number | undefined;\n /** The side of the line that has the wall. The default is `center`. */\n readonly side?: WallSide | undefined;\n}\n\n/** These are the kinds of an opening. A window has glass. A door and a gap are empty. */\nexport const OPENING_KINDS: readonly [\"door\", \"window\", \"gap\"] = [\"door\", \"window\", \"gap\"];\n\n/** A kind of opening. */\nexport type OpeningKind = (typeof OPENING_KINDS)[number];\n\n/** An opening: a hole through a wall. */\nexport interface Opening {\n readonly id: string;\n /** The `id` of the wall. */\n readonly wall: string;\n readonly kind: OpeningKind;\n /** The distance along the line of the wall, from `from` to the near edge of the opening. */\n readonly offset: number;\n readonly width: number;\n /** The height of the bottom of the opening above the floor. The default is 0. */\n readonly sill?: number | undefined;\n readonly height: number;\n}\n\n/** A floor: one area of the plan, for example one room of an apartment. The ring is the line where the floor touches the walls. */\nexport interface Floor {\n readonly id: string;\n readonly name?: string | undefined;\n readonly ring: Ring;\n}\n\n/** A room: the walls, the openings and the floors of one room or one apartment. */\nexport interface Room {\n readonly schema: typeof ROOM_SCHEMA;\n readonly name?: string | undefined;\n /** The unit of each length of the record. */\n readonly unit: LengthUnit;\n /** The height of each wall that has no height of its own. */\n readonly height: number;\n /** The thickness of each wall that has no thickness of its own. */\n readonly wallThickness: number;\n readonly walls: readonly Wall[];\n readonly openings?: readonly Opening[] | undefined;\n readonly floors?: readonly Floor[] | undefined;\n}\n\n/**\n * A placed object: a box in the room, for example a desk, a rack or a computer.\n * With a `parent`, the position and the turn are relative to that object, whose origin is the center of its bottom.\n */\nexport interface PlacedObject {\n readonly id: string;\n /** The class of the object, for example `desk`, `rack` or `computer`. A viewer gives each class a color. */\n readonly kind: string;\n readonly name?: string | undefined;\n /** The size before the turn: along x, along y, and the height. */\n readonly size: readonly [number, number, number];\n /** The point of the plan below the center of the object. */\n readonly at: PlanPoint;\n /** The height of the bottom of the object above the floor, or above the bottom of its parent. The default is 0. */\n readonly lift?: number | undefined;\n /** The turn about the vertical axis in degrees, counter-clockwise from above. The default is 0. */\n readonly turn?: number | undefined;\n /** The `id` of the object that holds this object. */\n readonly parent?: string | undefined;\n}\n\n/** A scene: one room with its placed objects and the records of its add-ons. Two scenes of one room can be compared. */\nexport interface Scene {\n readonly schema: typeof SCENE_SCHEMA;\n readonly name?: string | undefined;\n readonly room: Room;\n readonly objects?: readonly PlacedObject[] | undefined;\n /**\n * The records of each add-on, by the name of its layer, for example `electrical/1`. `isLayerName` tells the form of a name.\n * The core keeps each layer and does not read it. `checkLayers` examines the layers with a list of add-ons.\n */\n readonly layers?: Readonly<Record<string, unknown>> | undefined;\n}\n","import { length3, rotatePoint3, scalePoint3, transformPoint3, type Point3, type Transform3 } from \"@mark1russell7/layout-contract\";\nimport { wallFrames, wallPoint, type WallFrame } from \"./frames.ts\";\nimport type { PlacedObject, PlanPoint, Scene, WallFace } from \"./room.ts\";\nimport { objectTransforms } from \"./solids.ts\";\nimport { lengthsInRange, metersPer } from \"./units.ts\";\n\n// The anchors of the core: the places where an add-on puts its records. The core gives each anchor its position.\n// An anchor names no topic. An outlet, a tap and a lamp are records of add-ons, and each one is on an anchor.\n\n/** These are the surfaces that an anchor can be on. */\nexport const ANCHOR_SURFACES: readonly [\"wall\", \"floor\", \"ceiling\", \"object\"] = [\"wall\", \"floor\", \"ceiling\", \"object\"];\n\n/** A surface of an anchor. */\nexport type AnchorSurface = (typeof ANCHOR_SURFACES)[number];\n\n/** An anchor on a face of a wall. The lengths are in the unit of the room. */\nexport interface WallAnchor {\n readonly on: \"wall\";\n /** The `id` of the wall. */\n readonly wall: string;\n readonly face: WallFace;\n /** The distance along the line of the wall, from `from` to the anchor. */\n readonly offset: number;\n /** The height of the anchor above the floor. */\n readonly height: number;\n}\n\n/** An anchor on the floor, at a point of the plan. */\nexport interface FloorAnchor {\n readonly on: \"floor\";\n readonly at: PlanPoint;\n /** The `id` of the floor that has the point. Without it, the point is on any floor of the room. */\n readonly floor?: string | undefined;\n}\n\n/** An anchor on the ceiling, above a point of the plan. The ceiling is at the height of the room. */\nexport interface CeilingAnchor {\n readonly on: \"ceiling\";\n readonly at: PlanPoint;\n /** The `id` of the floor below the point. Without it, the point is above any floor of the room. */\n readonly floor?: string | undefined;\n}\n\n/**\n * An anchor on a placed object. The point and the direction are in the frame of the object, before its turn.\n * The origin of that frame is the center of the bottom of the object.\n */\nexport interface ObjectAnchor {\n readonly on: \"object\";\n /** The `id` of the placed object. */\n readonly object: string;\n /** The point in the frame of the object. The default is the center of its top. */\n readonly at?: readonly [number, number, number] | undefined;\n /** The direction out of the surface, in the frame of the object. The default is up: `[0, 0, 1]`. */\n readonly out?: readonly [number, number, number] | undefined;\n}\n\n/** An anchor: a place in the space of the core, for a record of an add-on. */\nexport type Anchor = WallAnchor | FloorAnchor | CeilingAnchor | ObjectAnchor;\n\n/** The position of an anchor in the room, in meters. */\nexport interface AnchorFrame {\n /** The point of the anchor. */\n readonly at: Point3;\n /** The unit vector out of the surface, into the space of the room. */\n readonly out: Point3;\n}\n\n/**\n * The space of a scene, for the add-ons. It reads each wall, object and anchor of the scene.\n * Make it once with `sceneSpace`, and give it to each add-on.\n */\nexport interface SceneSpace {\n readonly scene: Scene;\n /** The length of the unit of the room, in meters. */\n readonly scale: number;\n /** This function gives the frame of a wall in meters, or `undefined` when the room does not have the wall. */\n readonly wall: (id: string) => WallFrame | undefined;\n /** This function gives a placed object of the scene, or `undefined` when the scene does not have it. */\n readonly object: (id: string) => PlacedObject | undefined;\n /** This function gives the transform of a placed object in meters, or `undefined` when the object has no place. */\n readonly transform: (id: string) => Transform3 | undefined;\n /** This function gives the position of an anchor, or `undefined` when the anchor has no position. `checkAnchor` tells the reason. */\n readonly frame: (anchor: Anchor) => AnchorFrame | undefined;\n}\n\nconst UP: Point3 = { x: 0, y: 0, z: 1 };\nconst DOWN: Point3 = { x: 0, y: 0, z: -1 };\n\n/** This function tells if each value of a point is a length in the range of the model. */\nfunction inRange(point: Point3): boolean {\n return Number.isFinite(point.x) && Number.isFinite(point.y) && Number.isFinite(point.z) && lengthsInRange(point.x, point.y, point.z);\n}\n\n/** This function gives a point with no negative zero. JSON has no negative zero, so a frame goes through JSON with no change. */\nfunction plainPoint(point: Point3): Point3 {\n return { x: point.x + 0, y: point.y + 0, z: point.z + 0 };\n}\n\n/** This function gives the space of a scene. The transforms of the objects are calculated one time, at the first use. */\nexport function sceneSpace(scene: Scene): SceneSpace {\n const scale = metersPer(scene.room.unit);\n const walls = new Map(wallFrames(scene.room).map((frame) => [frame.id, frame] as const));\n const objects = new Map((scene.objects ?? []).map((object) => [object.id, object] as const));\n let transforms: ReadonlyMap<string, Transform3> | undefined;\n const transform = (id: string): Transform3 | undefined => {\n transforms ??= objectTransforms(scene);\n return transforms.get(id);\n };\n const frame = (anchor: Anchor): AnchorFrame | undefined => {\n let found: AnchorFrame;\n if (anchor.on === \"wall\") {\n const wall = walls.get(anchor.wall);\n if (wall === undefined) return undefined;\n const point = wallPoint(wall, anchor.offset * scale, anchor.face === \"left\" ? wall.leftOffset : wall.rightOffset);\n const sign = anchor.face === \"left\" ? 1 : -1;\n found = { at: { x: point.x, y: point.y, z: anchor.height * scale }, out: { x: wall.left.x * sign, y: wall.left.y * sign, z: 0 } };\n } else if (anchor.on === \"floor\") {\n found = { at: { x: anchor.at[0] * scale, y: anchor.at[1] * scale, z: 0 }, out: UP };\n } else if (anchor.on === \"ceiling\") {\n found = { at: { x: anchor.at[0] * scale, y: anchor.at[1] * scale, z: scene.room.height * scale }, out: DOWN };\n } else {\n const object = objects.get(anchor.object);\n const place = transform(anchor.object);\n if (object === undefined || place === undefined) return undefined;\n const [x, y, z] = anchor.at ?? [0, 0, object.size[2]];\n const [ox, oy, oz] = anchor.out ?? [0, 0, 1];\n const out = { x: ox, y: oy, z: oz };\n const size = length3(out);\n if (!(size > 0) || !Number.isFinite(size)) return undefined;\n found = { at: transformPoint3(place, { x: x * scale, y: y * scale, z: z * scale }), out: rotatePoint3(place.rotation, scalePoint3(out, 1 / size)) };\n }\n const plain: AnchorFrame = { at: plainPoint(found.at), out: plainPoint(found.out) };\n return inRange(plain.at) && inRange(plain.out) ? plain : undefined;\n };\n return { scene, scale, wall: (id) => walls.get(id), object: (id) => objects.get(id), transform, frame };\n}\n\n/**\n * This function gives an anchor with each length times a factor. A direction stays, because it has no unit.\n * `convertSurvey` uses it to change the unit of the anchors of a layer.\n */\nexport function scaleAnchor(anchor: Anchor, factor: number): Anchor {\n if (anchor.on === \"wall\") return { ...anchor, offset: anchor.offset * factor, height: anchor.height * factor };\n if (anchor.on === \"object\") {\n if (anchor.at === undefined) return anchor;\n const [x, y, z] = anchor.at;\n return { ...anchor, at: [x * factor, y * factor, z * factor] };\n }\n const [x, y] = anchor.at;\n return { ...anchor, at: [x * factor, y * factor] };\n}\n","// The order of texts in the results of the core. The entries do not export this module.\n\n/** This function compares two texts by their code points, so the order does not change with the language of a computer. */\nexport function compareText(a: string, b: string): number {\n return a < b ? -1 : a > b ? 1 : 0;\n}\n","import { sceneSpace, type Anchor, type SceneSpace } from \"./anchors.ts\";\nimport { checkAnchor, type FindingLevel } from \"./check.ts\";\nimport { compareText } from \"./order.ts\";\nimport { isLayerName, type Scene } from \"./room.ts\";\n\n// The layers of a scene: the records of the add-ons. The core keeps each layer, and it does not read one.\n// An add-on reads its layer, gives the anchors of its records, and examines the meaning of its records.\n// The core examines the anchors. Thus each add-on composes on the core, and the add-ons do not know each other.\n\n/** The result of the read of a layer: the layer, or the faults of its form. */\nexport type LayerParse<Layer> = { readonly ok: true; readonly layer: Layer } | { readonly ok: false; readonly errors: readonly string[] };\n\n/** A fault that an add-on finds in its layer. */\nexport interface AddOnFault {\n readonly level: FindingLevel;\n /** The code of the fault. The add-on gives its own codes. */\n readonly code: string;\n /** The `id` of the record with the fault. For the layer, it is empty. */\n readonly at: string;\n /** The fault in plain words, with the values. */\n readonly message: string;\n /** The `id` of the second record of the fault. A fault of one record has none. */\n readonly other?: string | undefined;\n}\n\n/**\n * An add-on: one topic on the core, for example electrical, plumbing or light.\n * A host gives a list of add-ons to `checkLayers`. The core knows only this type.\n */\nexport interface AddOn<Layer> {\n /** The name of the format of the layer, for example `electrical/1`. It is the key of the layer in `Scene.layers`. */\n readonly schema: string;\n /** This function reads the JSON of a layer. */\n parse(value: unknown): LayerParse<Layer>;\n /**\n * This function gives the anchors of the records of a layer, by a key.\n * The key is the `id` of a record, or the `id` and a position for a record with many anchors.\n */\n anchors(layer: Layer): ReadonlyMap<string, Anchor>;\n /** 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. */\n withAnchors(layer: Layer, anchors: ReadonlyMap<string, Anchor>): Layer;\n /** This function gives the faults of the meaning of a layer. The core examines the anchors, so this function does not. */\n check(layer: Layer, space: SceneSpace): readonly AddOnFault[];\n /**\n * This function gives one layer from the parts of a level: the layer of the level record, then the layer of each room.\n *\n * - A record of a part gets the name `part.name(id)`. Each `id` of the layer that names such a record or a placed object gets it too.\n * - A record that all the rooms share keeps its `id`, for example a circuit of an apartment. The first record of an `id` stays.\n * - The core changes the anchors before this function, so the function does not change an anchor.\n *\n * `expandLevel` does not carry the layer of a room when its add-on has no such function.\n */\n join?(parts: readonly LayerPart<Layer>[]): Layer;\n /**\n * The read of the old records of the topic. A record of version 1 of the core kept some of them in fields of its own.\n * `readRecord` of the entry `/schema` uses it. An add-on with no such records has none.\n */\n readonly v1?: AddOnV1<Layer> | undefined;\n}\n\n/** These are the kinds of the files of the core: `room`, `scene`, `survey` and `level`. */\nexport const FILE_KINDS: readonly [\"room\", \"scene\", \"survey\", \"level\"] = [\"room\", \"scene\", \"survey\", \"level\"];\n\n/** A kind of a file of the core. */\nexport type FileKind = (typeof FILE_KINDS)[number];\n\n/** The old records of an add-on in the records of version 1 of the core: their fields, and the read of their layer. */\nexport interface AddOnV1<Layer> {\n /**\n * The names of the fields of each kind of record that keep the old records. Version 2 of the core does not have these fields.\n * The names of `object` are the fields of each placed object of a scene and of each object of a survey.\n */\n readonly fields: { readonly [Kind in FileKind | \"object\"]?: readonly string[] | undefined };\n /**\n * This function gives the layer of the old records of a record of version 1, or `undefined` for a record with none of them.\n * The record is the JSON of the file, or the JSON of the survey of a room of a level. The function examines the form of its own fields.\n * The schema of version 2 examines the other fields after the read. A layer of a survey has the anchors of a survey, as `Survey.layers` tells.\n * A room record has no layers, so the layer of a `room` is the layer of a scene of that room.\n */\n read(record: unknown, kind: FileKind): LayerParse<Layer> | undefined;\n}\n\n/** One part of the layers of a level, for the function `join` of an add-on. `layerPart` makes it. */\nexport interface LayerPart<Layer> {\n /** The `id` of the room of the layer. The layer of the level record has no room. */\n readonly room?: string | undefined;\n readonly layer: Layer;\n /**\n * This function gives the name in the level of a record of the part, from its `id` in the part.\n * A record of a room gets the name that `roomName` gives, and a record of the level record keeps its `id`.\n * The function also gives the name of a record of the core that the part names, for example a placed object.\n */\n readonly name: (id: string) => string;\n}\n\n/**\n * This function gives the name in a level of a record of a room. The name is the `id` of the room, a slash and the `id` in the survey.\n * `expandLevel` gives each wall, each opening and each placed object such a name. The function `join` of an add-on gives it to the records of a room.\n */\nexport function roomName(room: string, id: string): string {\n return `${room}/${id}`;\n}\n\n/**\n * This function makes one part of the layers of a level. With no room, the part is the layer of the level record.\n * Its function `name` has the rule of `roomName`, so an add-on does not write that rule again.\n */\nexport function layerPart<Layer>(layer: Layer, room?: string): LayerPart<Layer> {\n return room === undefined ? { layer, name: (id) => id } : { room, layer, name: (id) => roomName(room, id) };\n}\n\n/** These are the codes of the faults of a layer that the core finds. */\nexport const LAYER_CODES: readonly [\"layer-name\", \"layer-unknown\", \"layer-form\"] = [\"layer-name\", \"layer-unknown\", \"layer-form\"];\n\n/** A finding of a layer: a fault of its form, of an anchor or of the meaning of its records. */\nexport interface LayerFinding {\n readonly level: FindingLevel;\n /** A code of `LAYER_CODES` or `ANCHOR_CODES`, or a code of the add-on. */\n readonly code: string;\n /** The key of the layer in `Scene.layers`. */\n readonly layer: string;\n /** The key of the anchor, or the `id` of the record with the fault. For the layer, it is empty. */\n readonly at: string;\n /** The fault in plain words, with the values. */\n readonly message: string;\n /** The `id` of the second record of the fault. A fault of one record has none. */\n readonly other?: string | undefined;\n /** The `id` of the room of the layer. Only a finding of `expandLevel` about the layer of a room has it. */\n readonly room?: string | undefined;\n}\n\n/** This function gives the add-on of each schema name. The first add-on of a name is used. */\nfunction addOnsByName(addOns: readonly AddOn<unknown>[]): ReadonlyMap<string, AddOn<unknown>> {\n const byName = new Map<string, AddOn<unknown>>();\n for (const addOn of addOns) if (!byName.has(addOn.schema)) byName.set(addOn.schema, addOn);\n return byName;\n}\n\n/** 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. */\nexport function readLayer<Layer>(scene: Scene, addOn: AddOn<Layer>): LayerParse<Layer> | undefined {\n const layers = scene.layers ?? {};\n return Object.hasOwn(layers, addOn.schema) ? addOn.parse(layers[addOn.schema]) : undefined;\n}\n\n/**\n * This function gives the findings of the layers of a scene, with a list of add-ons.\n * 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.\n * The findings are in the order of the layer keys, then of the record keys. Thus equal inputs give equal findings.\n *\n * The name of the record of a finding is `recordName(finding.layer, finding.at)`, so a finding selects its mark.\n * `checkScene` examines the core, and this function examines the layers.\n */\nexport function checkLayers(scene: Scene, addOns: readonly AddOn<unknown>[]): readonly LayerFinding[] {\n const byName = addOnsByName(addOns);\n const layers = scene.layers ?? {};\n const findings: LayerFinding[] = [];\n let space: SceneSpace | undefined;\n for (const name of Object.keys(layers).sort(compareText)) {\n if (!isLayerName(name)) {\n findings.push({ level: \"error\", code: \"layer-name\", layer: name, at: \"\", message: `The layer \"${name}\" has a name that is not a word, a slash and a version, for example \"electrical/1\".` });\n continue;\n }\n const addOn = byName.get(name);\n if (addOn === undefined) {\n findings.push({ level: \"warning\", code: \"layer-unknown\", layer: name, at: \"\", message: `The scene has the layer \"${name}\", and no add-on of the check reads it. The scene keeps the layer.` });\n continue;\n }\n const read = addOn.parse(layers[name]);\n if (!read.ok) {\n for (const message of read.errors) findings.push({ level: \"error\", code: \"layer-form\", layer: name, at: \"\", message });\n continue;\n }\n space ??= sceneSpace(scene);\n const own: LayerFinding[] = [];\n for (const [key, anchor] of addOn.anchors(read.layer)) {\n for (const fault of checkAnchor(anchor, space, `The anchor \"${key}\" of the layer \"${name}\"`)) own.push({ ...fault, layer: name, at: key });\n }\n for (const fault of addOn.check(read.layer, space)) own.push({ ...fault, layer: name });\n // The sort is stable, so the faults of one record keep their order.\n own.sort((a, b) => compareText(a.at, b.at));\n findings.push(...own);\n }\n return findings;\n}\n\n/** The result of a change of layers: the layers that the function carried, and a finding for each layer that it did not carry. */\nexport interface LayersMove {\n /** The layers of the result, in the order of their names. */\n readonly layers: Readonly<Record<string, unknown>>;\n /** One finding or more for each layer that is not in the result. Each finding has the level `error`. */\n readonly findings: readonly LayerFinding[];\n}\n\n/** The read of one layer for a change: the add-on and the layer, or the findings that tell why the layer has no read. */\ntype LayerRead = { readonly addOn: AddOn<unknown>; readonly layer: unknown } | readonly LayerFinding[];\n\n/** This function reads one layer with the add-on of its name. `room` is the `id` of the room of the layer, in a level. */\nfunction readForChange(name: string, value: unknown, byName: ReadonlyMap<string, AddOn<unknown>>, room?: string): LayerRead {\n const where = room === undefined ? {} : { room };\n const of = room === undefined ? \"\" : ` of the room \"${room}\"`;\n const finding = (code: (typeof LAYER_CODES)[number], message: string): LayerFinding => ({ level: \"error\", code, layer: name, at: \"\", message, ...where });\n if (!isLayerName(name)) {\n return [finding(\"layer-name\", `The layer \"${name}\"${of} has a name that is not a word, a slash and a version, for example \"electrical/1\". The result does not have the layer.`)];\n }\n const addOn = byName.get(name);\n if (addOn === undefined) return [finding(\"layer-unknown\", `No add-on of the list reads the layer \"${name}\"${of}. The result does not have the layer.`)];\n const read = addOn.parse(value);\n if (!read.ok) return read.errors.map((message) => finding(\"layer-form\", message));\n return { addOn, layer: read.layer };\n}\n\n/**\n * This function gives layers with each anchor changed by `move`. The add-on of each layer comes from the list.\n * `expandSurvey` uses it to put the layers of a survey on the room record. A host uses it when it moves the records of a room.\n *\n * A layer that the function cannot read is not in the result, because its anchors are in the old space. A finding tells each such layer:\n *\n * - `layer-name`: the name is not a layer name.\n * - `layer-unknown`: no add-on of the list has the name.\n * - `layer-form`: the add-on found a fault in the form of the layer.\n *\n * `room` is the `id` of the room of the layers, in a level. Each finding gets it.\n */\nexport function moveLayers(\n layers: Readonly<Record<string, unknown>> | undefined,\n addOns: readonly AddOn<unknown>[],\n move: (anchor: Anchor) => Anchor,\n room?: string,\n): LayersMove {\n const byName = addOnsByName(addOns);\n const given = layers ?? {};\n const moved: [string, unknown][] = [];\n const findings: LayerFinding[] = [];\n for (const name of Object.keys(given).sort(compareText)) {\n const read = readForChange(name, given[name], byName, room);\n if (\"addOn\" in read) {\n const anchors = new Map<string, Anchor>();\n for (const [key, anchor] of read.addOn.anchors(read.layer)) anchors.set(key, move(anchor));\n moved.push([name, read.addOn.withAnchors(read.layer, anchors)]);\n } else findings.push(...read);\n }\n return { layers: Object.fromEntries(moved), findings };\n}\n\n/** The layers of one room of a level, for `joinLayers`. The anchors have the names of the level already. */\nexport interface RoomLayers {\n /** The `id` of the room. */\n readonly room: string;\n readonly layers: Readonly<Record<string, unknown>> | undefined;\n}\n\n/**\n * This function gives the layers of a level. Each name gets one layer, from the layer of the level record and the layers of the rooms.\n * The function `join` of the add-on of each name makes that layer. `expandLevel` uses this function.\n *\n * - A layer that only the level record has stays as it is, because its anchors are on the room record of the level already.\n * `checkLayers` examines it.\n * - The layer of a room needs an add-on of its name with the function `join`. Without it, a finding tells the layer of each room,\n * and the layer of the level record stays as it is. The codes are the codes of `moveLayers`.\n * An add-on with no function `join` gives the code `layer-unknown`.\n * - With such an add-on, a part with a fault in its form is not in the layer of the result. A finding tells the part.\n */\nexport function joinLayers(own: Readonly<Record<string, unknown>> | undefined, rooms: readonly RoomLayers[], addOns: readonly AddOn<unknown>[]): LayersMove {\n const byName = addOnsByName(addOns);\n const level = own ?? {};\n const names = new Set(Object.keys(level));\n for (const room of rooms) for (const name of Object.keys(room.layers ?? {})) names.add(name);\n const joined: [string, unknown][] = [];\n const findings: LayerFinding[] = [];\n for (const name of [...names].sort(compareText)) {\n const inLevel = Object.hasOwn(level, name);\n const inRooms = rooms.filter((room) => room.layers !== undefined && Object.hasOwn(room.layers, name));\n const addOn = isLayerName(name) ? byName.get(name) : undefined;\n const join = addOn?.join?.bind(addOn);\n if (join === undefined || inRooms.length === 0) {\n if (inLevel) joined.push([name, level[name]]);\n for (const { room, layers } of inRooms) {\n if (addOn === undefined) {\n const read = readForChange(name, layers?.[name], byName, room);\n if (!(\"addOn\" in read)) findings.push(...read);\n } else {\n const message = `The add-on of the layer \"${name}\" has no function \"join\", so the result does not have the layer of the room \"${room}\".`;\n findings.push({ level: \"error\", code: \"layer-unknown\", layer: name, at: \"\", message, room });\n }\n }\n continue;\n }\n const parts: LayerPart<unknown>[] = [];\n if (inLevel) {\n const read = readForChange(name, level[name], byName);\n if (\"addOn\" in read) parts.push(layerPart(read.layer));\n else findings.push(...read);\n }\n for (const { room, layers } of inRooms) {\n const read = readForChange(name, layers?.[name], byName, room);\n if (\"addOn\" in read) parts.push(layerPart(read.layer, room));\n else findings.push(...read);\n }\n if (parts.length > 0) joined.push([name, join(parts)]);\n }\n return { layers: Object.fromEntries(joined), findings };\n}\n"],"mappings":";;;;AAOA,MAAa,cAAc;;AAG3B,MAAa,eAA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AAK,CAAC;GAC5C,KAAK,MAAM,EAAE,MAAM,YAAY,SAC7B,IAAI,UAAU,KAAA,GAAW;IACvB,MAAM,OAAO,cAAc,MAAM,SAAS,OAAO,QAAQ,IAAI;IAC7D,IAAI,EAAE,WAAW,OAAO,SAAS,KAAK,GAAG,IAAI;GAC/C,OAAO;IACL,MAAM,UAAU,4BAA4B,KAAK,+EAA+E,KAAK;IACrI,SAAS,KAAK;KAAE,OAAO;KAAS,MAAM;KAAiB,OAAO;KAAM,IAAI;KAAI;KAAS;IAAK,CAAC;GAC7F;GAEF;EACF;EACA,MAAM,QAA8B,CAAC;EACrC,IAAI,SAAS;GACX,MAAM,OAAO,cAAc,MAAM,MAAM,OAAO,MAAM;GACpD,IAAI,WAAW,MAAM,MAAM,KAAK,UAAU,KAAK,KAAK,CAAC;QAChD,SAAS,KAAK,GAAG,IAAI;EAC5B;EACA,KAAK,MAAM,EAAE,MAAM,YAAY,SAAS;GACtC,MAAM,OAAO,cAAc,MAAM,SAAS,OAAO,QAAQ,IAAI;GAC7D,IAAI,WAAW,MAAM,MAAM,KAAK,UAAU,KAAK,OAAO,IAAI,CAAC;QACtD,SAAS,KAAK,GAAG,IAAI;EAC5B;EACA,IAAI,MAAM,SAAS,GAAG,OAAO,KAAK,CAAC,MAAM,KAAK,KAAK,CAAC,CAAC;CACvD;CACA,OAAO;EAAE,QAAQ,OAAO,YAAY,MAAM;EAAG;CAAS;AACxD"}
@@ -1,4 +1,4 @@
1
- import { B as Scene, C as WallFrame, F as PlacedObject, I as PlanPoint, R as Room, W as WallFace, c as SolidKind, y as JoinOptions } from "./solids-S_j17vFJ.js";
1
+ import { B as WallFace, I as Scene, M as PlanPoint, P as Room, S as WallFrame, j as PlacedObject, s as SolidKind, v as JoinOptions } from "./solids-OiTlb_Pm.js";
2
2
  import { Point3, Transform3 } from "@mark1russell7/layout-contract";
3
3
  /** These are the surfaces that an anchor can be on. */
4
4
  declare const ANCHOR_SURFACES: readonly ["wall", "floor", "ceiling", "object"];
@@ -80,7 +80,7 @@ declare const FINDING_LEVELS: readonly ["error", "warning"];
80
80
  /** A level of a finding. */
81
81
  type FindingLevel = (typeof FINDING_LEVELS)[number];
82
82
  /** These are the kinds of the records that a finding can name. */
83
- declare const RECORD_KINDS: readonly ["room", "wall", "opening", "floor", "outlet", "circuit", "object", "load"];
83
+ declare const RECORD_KINDS: readonly ["room", "wall", "opening", "floor", "object"];
84
84
  /** A kind of record. */
85
85
  type RecordKind = (typeof RECORD_KINDS)[number];
86
86
  /**
@@ -99,7 +99,7 @@ declare function parseRecordName(name: string): {
99
99
  readonly id: string;
100
100
  } | undefined;
101
101
  /** These are the codes of the findings. */
102
- 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"];
102
+ 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", "floor-ring", "object-parent", "object-cycle", "object-outside", "object-overlap", "object-in-wall"];
103
103
  /** A code of a finding. */
104
104
  type FindingCode = (typeof FINDING_CODES)[number];
105
105
  /** A finding: one fault of a room record or a scene record. */
@@ -108,13 +108,13 @@ interface Finding {
108
108
  readonly code: FindingCode;
109
109
  /** The kind of the record with the fault. */
110
110
  readonly record: RecordKind;
111
- /** 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. */
111
+ /** The `id` of the record with the fault. For the room record, it is empty. */
112
112
  readonly at: string;
113
113
  /** The fault in plain words, with the values. */
114
114
  readonly message: string;
115
115
  /**
116
- * 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.
117
- * 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.
116
+ * The `id` of the second record of the fault. It is the other opening or the other object of an overlap.
117
+ * It is also the wall that an object overlaps, or the parent that an object names. A fault of one record has none.
118
118
  */
119
119
  readonly other?: string | undefined;
120
120
  }
@@ -130,7 +130,8 @@ interface CheckOptions {
130
130
  */
131
131
  declare function checkRoom(room: Room, options?: CheckOptions): readonly Finding[];
132
132
  /**
133
- * This function gives each fault of a scene record: the faults of its room, then the faults of its placed objects and its loads.
133
+ * This function gives each fault of a scene record: the faults of its room, then the faults of its placed objects.
134
+ * `checkLayers` examines the layers of the scene.
134
135
  * A scene with no finding of the level `error` gives a full model.
135
136
  */
136
137
  declare function checkScene(scene: Scene, options?: CheckOptions): readonly Finding[];
@@ -200,6 +201,30 @@ interface AddOn<Layer> {
200
201
  * `expandLevel` does not carry the layer of a room when its add-on has no such function.
201
202
  */
202
203
  join?(parts: readonly LayerPart<Layer>[]): Layer;
204
+ /**
205
+ * The read of the old records of the topic. A record of version 1 of the core kept some of them in fields of its own.
206
+ * `readRecord` of the entry `/schema` uses it. An add-on with no such records has none.
207
+ */
208
+ readonly v1?: AddOnV1<Layer> | undefined;
209
+ }
210
+ /** These are the kinds of the files of the core: `room`, `scene`, `survey` and `level`. */
211
+ declare const FILE_KINDS: readonly ["room", "scene", "survey", "level"];
212
+ /** A kind of a file of the core. */
213
+ type FileKind = (typeof FILE_KINDS)[number];
214
+ /** The old records of an add-on in the records of version 1 of the core: their fields, and the read of their layer. */
215
+ interface AddOnV1<Layer> {
216
+ /**
217
+ * The names of the fields of each kind of record that keep the old records. Version 2 of the core does not have these fields.
218
+ * The names of `object` are the fields of each placed object of a scene and of each object of a survey.
219
+ */
220
+ readonly fields: { readonly [Kind in FileKind | "object"]?: readonly string[] | undefined; };
221
+ /**
222
+ * This function gives the layer of the old records of a record of version 1, or `undefined` for a record with none of them.
223
+ * The record is the JSON of the file, or the JSON of the survey of a room of a level. The function examines the form of its own fields.
224
+ * The schema of version 2 examines the other fields after the read. A layer of a survey has the anchors of a survey, as `Survey.layers` tells.
225
+ * A room record has no layers, so the layer of a `room` is the layer of a scene of that room.
226
+ */
227
+ read(record: unknown, kind: FileKind): LayerParse<Layer> | undefined;
203
228
  }
204
229
  /** One part of the layers of a level, for the function `join` of an add-on. `layerPart` makes it. */
205
230
  interface LayerPart<Layer> {
@@ -290,5 +315,5 @@ interface RoomLayers {
290
315
  * - With such an add-on, a part with a fault in its form is not in the layer of the result. A finding tells the part.
291
316
  */
292
317
  declare function joinLayers(own: Readonly<Record<string, unknown>> | undefined, rooms: readonly RoomLayers[], addOns: readonly AddOn<unknown>[]): LayersMove;
293
- export { recordName as A, WallAnchor as B, FindingLevel as C, checkRoom as D, checkAnchor as E, AnchorSurface as F, sceneSpace as H, CeilingAnchor as I, FloorAnchor as L, ANCHOR_SURFACES as M, Anchor as N, checkScene as O, AnchorFrame as P, ObjectAnchor as R, FindingCode as S, RecordKind as T, scaleAnchor as V, AnchorFault as _, LayerParse as a, FINDING_LEVELS as b, RoomLayers as c, layerPart as d, moveLayers as f, AnchorCode as g, ANCHOR_CODES as h, LayerFinding as i, solidRecord as j, parseRecordName as k, checkLayers as l, roomName as m, AddOnFault as n, LayerPart as o, readLayer as p, LAYER_CODES as r, LayersMove as s, AddOn as t, joinLayers as u, CheckOptions as v, RECORD_KINDS as w, Finding as x, FINDING_CODES as y, SceneSpace as z };
294
- //# sourceMappingURL=layers-BO_MMtQJ.d.ts.map
318
+ export { checkRoom as A, FloorAnchor as B, FINDING_LEVELS as C, RECORD_KINDS as D, FindingLevel as E, ANCHOR_SURFACES as F, sceneSpace as G, SceneSpace as H, Anchor as I, AnchorFrame as L, parseRecordName as M, recordName as N, RecordKind as O, solidRecord as P, AnchorSurface as R, FINDING_CODES as S, FindingCode as T, WallAnchor as U, ObjectAnchor as V, scaleAnchor as W, roomName as _, FileKind as a, AnchorFault as b, LayerParse as c, RoomLayers as d, checkLayers as f, readLayer as g, moveLayers as h, FILE_KINDS as i, checkScene as j, checkAnchor as k, LayerPart as l, layerPart as m, AddOnFault as n, LAYER_CODES as o, joinLayers as p, AddOnV1 as r, LayerFinding as s, AddOn as t, LayersMove as u, ANCHOR_CODES as v, Finding as w, CheckOptions as x, AnchorCode as y, CeilingAnchor as z };
319
+ //# sourceMappingURL=layers-CYZwt1bH.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layers-CYZwt1bH.d.ts","names":[],"sources":["../src/anchors.ts","../src/check.ts","../src/layers.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;;;;;iBA0C1B,YAAY,QAAQ,QAAQ,iBAAiB;;cCrIhD;;KAGD,uBAAuB;;cAGtB;;KAGD,qBAAqB;;;;;iBAMjB,WAAW,cAAc;;;;;iBAQzB,YAAY,MAAM,WAAW;;iBAK7B,gBAAgB;WAA0B;WAAuB;;;cAMpE;;KAuCD,sBAAsB;;UAGjB;WACN,OAAO;WACP,MAAM;;WAEN,QAAQ;;WAER;;WAEA;;;;;WAKA;;;UAIM;;WAEN,QAAQ;;;;;;;iBA2CH,UAAU,MAAM,MAAM,UAAS,wBAA6B;;;;;;iBAwI5D,WAAW,OAAO,OAAO,UAAS,wBAA6B;;cA2ElE;;KAYD,qBAAqB;;UAGhB;WACN,OAAO;WACP,MAAM;;WAEN;;WAEA;;;;;;iBAOK,YAAY,QAAQ,QAAQ,OAAO,YAAY,yBAAuC;;KCxX1F,WAAW;WAAoB;WAAmB,OAAO;;WAAqB;WAAoB;;;UAG7F;WACN,OAAO;;WAEP;;WAEA;;WAEA;;WAEA;;;;;;UAOM,MAAM;;WAEZ;;EAET,MAAM,iBAAiB,WAAW;;;;;EAKlC,QAAQ,OAAO,QAAQ,oBAAoB;;EAE3C,YAAY,OAAO,OAAO,SAAS,oBAAoB,UAAU;;EAEjE,MAAM,OAAO,OAAO,OAAO,sBAAsB;;;;;;;;;;EAUjD,MAAM,gBAAgB,UAAU,WAAW;;;;;WAKlC,KAAK,QAAQ;;;cAIX;;KAGD,mBAAmB;;UAGd,QAAQ;;;;;WAKd,oBAAoB,QAAQ;;;;;;;EAOrC,KAAK,iBAAiB,MAAM,WAAW,WAAW;;;UAInC,UAAU;;WAEhB;WACA,OAAO;;;;;;WAMP,OAAO;;;;;;iBAOF,SAAS,cAAc;;;;;iBAQvB,UAAU,OAAO,OAAO,OAAO,gBAAgB,UAAU;;cAK5D;;UAGI;WACN,OAAO;;WAEP;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;;iBAWK,UAAU,OAAO,OAAO,OAAO,OAAO,MAAM,SAAS,WAAW;;;;;;;;;iBAahE,YAAY,OAAO,OAAO,iBAAiB,4BAA4B;;UAkCtE;;WAEN,QAAQ,SAAS;;WAEjB,mBAAmB;;;;;;;;;;;;;;iBAiCd,WACd,QAAQ,SAAS,sCACjB,iBAAiB,kBACjB,OAAO,QAAQ,WAAW,QAC1B,gBACC;;UAiBc;;WAEN;WACA,QAAQ,SAAS;;;;;;;;;;;;;iBAcZ,WAAW,KAAK,SAAS,sCAAsC,gBAAgB,cAAc,iBAAiB,mBAAmB"}
@@ -1,5 +1,5 @@
1
- import { F as metersPer, I as unitsPer, n as scaleAnchor } from "./anchors-Ba3OUmhF.js";
2
- import { a as moveLayers, d as SCENE_SCHEMA, r as joinLayers, s as roomName, u as ROOM_SCHEMA } from "./layers-B5nL_lVW.js";
1
+ import { c as roomName, d as scaleAnchor, h as SCENE_SCHEMA, i as joinLayers, m as ROOM_SCHEMA, o as moveLayers } from "./layers-CDNFVXds.js";
2
+ import { M as unitsPer, j as metersPer } from "./check-DI_B57qy.js";
3
3
  /** This function gives the unit vector of a direction in degrees. A direction along an axis gives an exact vector. */
4
4
  function directionOf(degrees) {
5
5
  const turn = (degrees % 360 + 360) % 360;
@@ -30,7 +30,7 @@ function squared(degrees) {
30
30
  }
31
31
  // src/survey.ts
32
32
  /** The name of the format of a survey record. */
33
- const SURVEY_SCHEMA = "survey/1";
33
+ const SURVEY_SCHEMA = "survey/2";
34
34
  /** These are the names of the turns at a square corner. */
35
35
  const SQUARE_TURNS = ["left", "right"];
36
36
  /** The `id` of the floor of the room record of a closed survey. */
@@ -124,11 +124,6 @@ function convertSurvey(survey, unit, addOns = []) {
124
124
  ...opening.sill === void 0 ? {} : { sill: to(opening.sill) },
125
125
  height: to(opening.height)
126
126
  })) },
127
- ...survey.outlets === void 0 ? {} : { outlets: survey.outlets.map((outlet) => ({
128
- ...outlet,
129
- offset: to(outlet.offset),
130
- height: to(outlet.height)
131
- })) },
132
127
  ...survey.objects === void 0 ? {} : { objects: survey.objects.map((object) => ({
133
128
  ...object,
134
129
  offset: to(object.offset),
@@ -155,7 +150,7 @@ function convertSurvey(survey, unit, addOns = []) {
155
150
  * This is the transit rule of land survey. A side along an axis stays along that axis, so a room with square corners keeps them.
156
151
  * Then the last wall ends exactly at the first corner, and the room gets a floor.
157
152
  *
158
- * An opening and an outlet keep their place on a side that changes its length: each `offset` and each `width` changes in the same proportion.
153
+ * An opening keeps its place on a side that changes its length: its `offset` and its `width` change in the same proportion.
159
154
  * Thus an opening that fits in its measured side fits in its wall, and two openings that do not overlap stay apart.
160
155
  *
161
156
  * An object keeps its size on a side that changes its length. It moves by a part of that change: its place in the free length of the side.
@@ -274,13 +269,7 @@ function expandSurvey(survey, options = {}) {
274
269
  id: SURVEY_FLOOR,
275
270
  ...survey.name === void 0 ? {} : { name: survey.name },
276
271
  ring: toLeft ? corners : [...corners].reverse()
277
- }] } : {},
278
- ...survey.outlets === void 0 ? {} : { outlets: survey.outlets.map((outlet) => ({
279
- ...outlet,
280
- offset: outlet.offset * (factorOf.get(outlet.wall) ?? 1),
281
- face
282
- })) },
283
- ...survey.circuits === void 0 ? {} : { circuits: survey.circuits }
272
+ }] } : {}
284
273
  };
285
274
  const sideOf = /* @__PURE__ */ new Map();
286
275
  sides.forEach((side, index) => {
@@ -318,7 +307,6 @@ function expandSurvey(survey, options = {}) {
318
307
  object.height
319
308
  ]
320
309
  };
321
- const power = object.outlet === void 0 ? {} : { outlet: object.outlet };
322
310
  if (object.on !== void 0) {
323
311
  const holder = listed.get(object.on);
324
312
  if (holder === void 0 || placeOf(holder) === void 0) return void 0;
@@ -327,8 +315,7 @@ function expandSurvey(survey, options = {}) {
327
315
  ...record,
328
316
  at: [toLeft ? x : 0 - x, out + object.depth / 2 - holder.depth / 2],
329
317
  lift: object.lift ?? holder.height,
330
- parent: holder.id,
331
- ...power
318
+ parent: holder.id
332
319
  };
333
320
  }
334
321
  const index = object.wall === void 0 ? void 0 : sideOf.get(object.wall);
@@ -349,8 +336,7 @@ function expandSurvey(survey, options = {}) {
349
336
  ...record,
350
337
  at: [from[0] + along[0] * a + inward[0] * b, from[1] + along[1] * a + inward[1] * b],
351
338
  ...object.lift === void 0 ? {} : { lift: object.lift },
352
- ...turn === 0 ? {} : { turn },
353
- ...power
339
+ ...turn === 0 ? {} : { turn }
354
340
  };
355
341
  };
356
342
  const objects = (survey.objects ?? []).flatMap((object) => {
@@ -383,7 +369,7 @@ function expandSurvey(survey, options = {}) {
383
369
  }
384
370
  // src/level.ts
385
371
  /** The name of the format of a level record. */
386
- const LEVEL_SCHEMA = "level/1";
372
+ const LEVEL_SCHEMA = "level/2";
387
373
  /**
388
374
  * These are the sources of the place of a room.
389
375
  *
@@ -760,10 +746,7 @@ function expandLevel(level, options = {}) {
760
746
  const walls = [];
761
747
  const openings = [];
762
748
  const floors = [];
763
- const outlets = [];
764
749
  const objects = [];
765
- const circuits = /* @__PURE__ */ new Map();
766
- for (const circuit of level.circuits ?? []) if (!circuits.has(circuit.id)) circuits.set(circuit.id, circuit);
767
750
  rooms.forEach(({ id, survey, result }, room) => {
768
751
  const record = result.room;
769
752
  record.walls.forEach((wall, index) => {
@@ -788,17 +771,10 @@ function expandLevel(level, options = {}) {
788
771
  ...survey.name === void 0 ? {} : { name: survey.name },
789
772
  ring: floor.ring
790
773
  });
791
- for (const outlet of record.outlets ?? []) outlets.push({
792
- ...outlet,
793
- id: `${id}/${outlet.id}`,
794
- wall: `${id}/${outlet.wall}`
795
- });
796
- for (const circuit of record.circuits ?? []) if (!circuits.has(circuit.id)) circuits.set(circuit.id, circuit);
797
774
  for (const object of result.objects) objects.push({
798
775
  ...object,
799
776
  id: `${id}/${object.id}`,
800
- ...object.parent === void 0 ? {} : { parent: `${id}/${object.parent}` },
801
- ...object.outlet === void 0 ? {} : { outlet: `${id}/${object.outlet}` }
777
+ ...object.parent === void 0 ? {} : { parent: `${id}/${object.parent}` }
802
778
  });
803
779
  });
804
780
  const room = {
@@ -809,9 +785,7 @@ function expandLevel(level, options = {}) {
809
785
  wallThickness,
810
786
  walls,
811
787
  ...openings.length === 0 ? {} : { openings },
812
- ...floors.length === 0 ? {} : { floors },
813
- ...outlets.length === 0 ? {} : { outlets },
814
- ...circuits.size === 0 ? {} : { circuits: [...circuits.values()] }
788
+ ...floors.length === 0 ? {} : { floors }
815
789
  };
816
790
  const addOns = options.addOns ?? [];
817
791
  const parts = [];
@@ -839,4 +813,4 @@ function expandLevel(level, options = {}) {
839
813
  }
840
814
  export { ROOM_PLACES as a, SQUARE_TURNS as c, convertSurvey as d, expandSurvey as f, LEVEL_SCHEMA as i, SURVEY_FLOOR as l, surveyAnchor as m, CONNECTION_TURN_LIMIT as n, expandLevel as o, resultScene as p, CONNECTION_USES as r, CLOSURE_LIMIT as s, CONNECTION_FAULTS as t, SURVEY_SCHEMA as u };
841
815
 
842
- //# sourceMappingURL=level-CXCIX08K.js.map
816
+ //# sourceMappingURL=level-BERjgyrT.js.map