@mark1russell7/room-view 0.0.0-stage → 0.1.1

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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sample.js","names":[],"sources":["../src/sample.ts"],"sourcesContent":["import type { Level } from \"./level.ts\";\nimport type { Room, Scene } from \"./room.ts\";\nimport type { Survey } from \"./survey.ts\";\n\n/**\n * A sample room in meters. It is not a real room.\n *\n * The outline is an L shape. Each outer wall has its line on the inner face: `side` is `right` on a counter-clockwise outline.\n * A short wall makes a nook at the top. The floor goes around that wall.\n */\nexport const SAMPLE_ROOM: Room = {\n schema: \"room/1\",\n name: \"Sample room\",\n unit: \"m\",\n height: 2.5,\n wallThickness: 0.15,\n walls: [\n { id: \"south\", from: [0, 0], to: [6, 0], side: \"right\" },\n { id: \"east\", from: [6, 0], to: [6, 3], side: \"right\" },\n { id: \"inset-north\", from: [6, 3], to: [4, 3], side: \"right\" },\n { id: \"inset-east\", from: [4, 3], to: [4, 5], side: \"right\" },\n { id: \"north\", from: [4, 5], to: [0, 5], side: \"right\" },\n { id: \"west\", from: [0, 5], to: [0, 0], side: \"right\" },\n { id: \"nook\", from: [2.5, 5], to: [2.5, 3.6], thickness: 0.1 },\n ],\n openings: [\n { id: \"door\", wall: \"south\", kind: \"door\", offset: 0.6, width: 0.9, height: 2.05 },\n { id: \"window-east\", wall: \"east\", kind: \"window\", offset: 0.8, width: 1.4, sill: 0.9, height: 1.2 },\n { id: \"window-west\", wall: \"west\", kind: \"window\", offset: 1.5, width: 1.6, sill: 0.9, height: 1.2 },\n ],\n floors: [\n {\n id: \"floor\",\n name: \"Room\",\n ring: [\n [0, 0],\n [6, 0],\n [6, 3],\n [4, 3],\n [4, 5],\n [2.55, 5],\n [2.55, 3.6],\n [2.45, 3.6],\n [2.45, 5],\n [0, 5],\n ],\n },\n ],\n outlets: [\n { id: \"south-1\", wall: \"south\", face: \"left\", offset: 2.4, height: 0.3, circuit: \"a\" },\n { id: \"south-2\", wall: \"south\", face: \"left\", offset: 4.6, height: 0.3, circuit: \"a\" },\n { id: \"east-1\", wall: \"east\", face: \"left\", offset: 0.4, height: 0.3, circuit: \"a\" },\n { id: \"west-1\", wall: \"west\", face: \"left\", offset: 4.2, height: 0.3, circuit: \"a\" },\n { id: \"north-1\", wall: \"north\", face: \"left\", offset: 2.8, height: 0.3, circuit: \"a\" },\n { id: \"nook-1\", wall: \"north\", face: \"left\", offset: 0.7, height: 0.3, circuit: \"b\" },\n { id: \"nook-2\", wall: \"inset-east\", face: \"left\", offset: 1.2, height: 0.3, circuit: \"b\" },\n ],\n circuits: [\n { id: \"a\", name: \"Circuit A\", limit: 1440 },\n { id: \"b\", name: \"Circuit B\", limit: 1440 },\n ],\n};\n\n/** A sample scene of the sample room: a desk, a sofa, and a rack of four computers in the nook. Circuit B is near its limit. */\nexport const SAMPLE_SCENE: Scene = {\n schema: \"scene/1\",\n name: \"Sample scene\",\n room: SAMPLE_ROOM,\n objects: [\n { id: \"desk\", kind: \"desk\", name: \"Desk\", size: [1.6, 0.75, 0.74], at: [1.2, 4.55] },\n { id: \"display\", kind: \"display\", name: \"Display\", size: [0.6, 0.2, 0.4], at: [0, 0.2], lift: 0.74, parent: \"desk\" },\n { id: \"tower\", kind: \"computer\", name: \"Tower\", size: [0.22, 0.45, 0.45], at: [2.2, 4.6], outlet: \"north-1\" },\n { id: \"sofa\", kind: \"sofa\", name: \"Sofa\", size: [2, 0.9, 0.8], at: [4.4, 0.6] },\n { id: \"rack\", kind: \"rack\", name: \"Rack\", size: [0.6, 0.8, 1.2], at: [3.3, 4.5] },\n { id: \"node-1\", kind: \"computer\", name: \"Node 1\", size: [0.48, 0.6, 0.18], at: [0, 0], lift: 0.08, parent: \"rack\", outlet: \"nook-1\" },\n { id: \"node-2\", kind: \"computer\", name: \"Node 2\", size: [0.48, 0.6, 0.18], at: [0, 0], lift: 0.34, parent: \"rack\", outlet: \"nook-1\" },\n { id: \"node-3\", kind: \"computer\", name: \"Node 3\", size: [0.48, 0.6, 0.18], at: [0, 0], lift: 0.6, parent: \"rack\", outlet: \"nook-2\" },\n { id: \"node-4\", kind: \"computer\", name: \"Node 4\", size: [0.48, 0.6, 0.18], at: [0, 0], lift: 0.86, parent: \"rack\", outlet: \"nook-2\" },\n ],\n loads: [\n { circuit: \"a\", watts: 420 },\n { circuit: \"b\", watts: 1260 },\n ],\n};\n\n/**\n * The survey of the sample room: its six outer walls as a walk along their inner faces. The diagonal of the large part is a check.\n * It does not have the short wall of the nook, because that wall is not a side of the walk.\n * Its objects are the objects of the sample scene, each with its measurements from a wall, from the desk or from the rack.\n */\nexport const SAMPLE_SURVEY: Survey = {\n schema: \"survey/1\",\n name: \"Sample room\",\n unit: \"m\",\n height: 2.5,\n wallThickness: 0.15,\n sides: [\n { id: \"south\", length: 6, turn: \"left\" },\n { id: \"east\", length: 3, turn: \"left\" },\n { id: \"inset-north\", length: 2, turn: \"right\" },\n { id: \"inset-east\", length: 2, turn: \"left\" },\n { id: \"north\", length: 4, turn: \"left\" },\n { id: \"west\", length: 5, turn: \"left\" },\n ],\n checks: [{ id: \"diagonal\", from: \"south\", to: \"inset-east\", length: 5 }],\n openings: [\n { id: \"door\", wall: \"south\", kind: \"door\", offset: 0.6, width: 0.9, height: 2.05 },\n { id: \"window-east\", wall: \"east\", kind: \"window\", offset: 0.8, width: 1.4, sill: 0.9, height: 1.2 },\n { id: \"window-west\", wall: \"west\", kind: \"window\", offset: 1.5, width: 1.6, sill: 0.9, height: 1.2 },\n ],\n outlets: [\n { id: \"south-1\", wall: \"south\", offset: 2.4, height: 0.3, circuit: \"a\" },\n { id: \"south-2\", wall: \"south\", offset: 4.6, height: 0.3, circuit: \"a\" },\n { id: \"east-1\", wall: \"east\", offset: 0.4, height: 0.3, circuit: \"a\" },\n { id: \"west-1\", wall: \"west\", offset: 4.2, height: 0.3, circuit: \"a\" },\n { id: \"north-1\", wall: \"north\", offset: 2.8, height: 0.3, circuit: \"a\" },\n { id: \"nook-1\", wall: \"north\", offset: 0.7, height: 0.3, circuit: \"b\" },\n { id: \"nook-2\", wall: \"inset-east\", offset: 1.2, height: 0.3, circuit: \"b\" },\n ],\n circuits: [\n { id: \"a\", name: \"Circuit A\", limit: 1440 },\n { id: \"b\", name: \"Circuit B\", limit: 1440 },\n ],\n objects: [\n { id: \"desk\", kind: \"desk\", name: \"Desk\", wall: \"north\", offset: 2, width: 1.6, depth: 0.75, height: 0.74, gap: 0.075 },\n { id: \"display\", kind: \"display\", name: \"Display\", on: \"desk\", offset: 0.5, width: 0.6, depth: 0.2, height: 0.4, gap: 0.075 },\n { id: \"tower\", kind: \"computer\", name: \"Tower\", wall: \"north\", offset: 1.69, width: 0.22, depth: 0.45, height: 0.45, gap: 0.175, outlet: \"north-1\" },\n { id: \"sofa\", kind: \"sofa\", name: \"Sofa\", wall: \"south\", offset: 3.4, width: 2, depth: 0.9, height: 0.8, gap: 0.15 },\n { id: \"rack\", kind: \"rack\", name: \"Rack\", wall: \"north\", offset: 0.4, width: 0.6, depth: 0.8, height: 1.2, gap: 0.1 },\n { id: \"node-1\", kind: \"computer\", name: \"Node 1\", on: \"rack\", offset: 0.06, width: 0.48, depth: 0.6, height: 0.18, gap: 0.1, lift: 0.08, outlet: \"nook-1\" },\n { id: \"node-2\", kind: \"computer\", name: \"Node 2\", on: \"rack\", offset: 0.06, width: 0.48, depth: 0.6, height: 0.18, gap: 0.1, lift: 0.34, outlet: \"nook-1\" },\n { id: \"node-3\", kind: \"computer\", name: \"Node 3\", on: \"rack\", offset: 0.06, width: 0.48, depth: 0.6, height: 0.18, gap: 0.1, lift: 0.6, outlet: \"nook-2\" },\n { id: \"node-4\", kind: \"computer\", name: \"Node 4\", on: \"rack\", offset: 0.06, width: 0.48, depth: 0.6, height: 0.18, gap: 0.1, lift: 0.86, outlet: \"nook-2\" },\n ],\n};\n\n/**\n * A sample apartment in meters. It is not a real apartment.\n *\n * The living room is the sample room. A hall is below it in the plan, with a bathroom on its right. A bedroom is below the hall and the bathroom.\n * Each survey starts at its own corner, and the three doors give the places of the rooms.\n * The walk of the bathroom starts along its west wall, so the bathroom turns. A wall between two rooms has a thickness of 0.1 m.\n *\n * Each room has objects: the hall has a shelf, the bathroom has a vanity, and the bedroom has a bed and a wardrobe.\n */\nexport const SAMPLE_LEVEL: Level = {\n schema: \"level/1\",\n name: \"Sample apartment\",\n unit: \"m\",\n rooms: [\n { id: \"living\", survey: { ...SAMPLE_SURVEY, name: \"Living room\" } },\n {\n id: \"hall\",\n survey: {\n schema: \"survey/1\",\n name: \"Hall\",\n unit: \"m\",\n height: 2.5,\n wallThickness: 0.15,\n sides: [\n { id: \"south\", length: 4, turn: \"left\" },\n { id: \"east\", length: 1.2, turn: \"left\" },\n { id: \"north\", length: 4, turn: \"left\" },\n { id: \"west\", length: 1.2, turn: \"left\" },\n ],\n openings: [\n { id: \"bedroom\", wall: \"south\", kind: \"door\", offset: 0.4, width: 0.8, height: 2.05 },\n { id: \"bathroom\", wall: \"east\", kind: \"door\", offset: 0.2, width: 0.75, height: 2.05 },\n { id: \"living\", wall: \"north\", kind: \"door\", offset: 2.5, width: 0.9, height: 2.05 },\n { id: \"entry\", wall: \"west\", kind: \"door\", offset: 0.15, width: 0.9, height: 2.05 },\n ],\n outlets: [{ id: \"south-1\", wall: \"south\", offset: 2.6, height: 0.3, circuit: \"c\" }],\n objects: [{ id: \"shelf\", kind: \"shelf\", name: \"Shoe shelf\", wall: \"south\", offset: 1.6, width: 1.2, depth: 0.3, height: 0.9 }],\n },\n },\n {\n id: \"bathroom\",\n survey: {\n schema: \"survey/1\",\n name: \"Bathroom\",\n unit: \"m\",\n height: 2.5,\n wallThickness: 0.15,\n sides: [\n { id: \"west\", length: 2.5, turn: \"left\" },\n { id: \"south\", length: 1.9, turn: \"left\" },\n { id: \"east\", length: 2.5, turn: \"left\" },\n { id: \"north\", length: 1.9, turn: \"left\" },\n ],\n openings: [\n { id: \"door\", wall: \"west\", kind: \"door\", offset: 0.25, width: 0.75, height: 2.05 },\n { id: \"window\", wall: \"east\", kind: \"window\", offset: 0.9, width: 0.7, sill: 1.3, height: 0.8 },\n ],\n outlets: [{ id: \"east-1\", wall: \"east\", offset: 2.1, height: 1.1, circuit: \"c\" }],\n objects: [{ id: \"vanity\", kind: \"cabinet\", name: \"Vanity\", wall: \"east\", offset: 1.7, width: 0.7, depth: 0.45, height: 0.85 }],\n },\n },\n {\n id: \"bedroom\",\n survey: {\n schema: \"survey/1\",\n name: \"Bedroom\",\n unit: \"m\",\n height: 2.5,\n wallThickness: 0.15,\n sides: [\n { id: \"south\", length: 6, turn: \"left\" },\n { id: \"east\", length: 2.3, turn: \"left\" },\n { id: \"inset-north\", length: 2, turn: \"right\" },\n { id: \"inset-east\", length: 1.3, turn: \"left\" },\n { id: \"north\", length: 4, turn: \"left\" },\n { id: \"west\", length: 3.6, turn: \"left\" },\n ],\n openings: [\n { id: \"door\", wall: \"north\", kind: \"door\", offset: 2.8, width: 0.8, height: 2.05 },\n { id: \"window\", wall: \"south\", kind: \"window\", offset: 2.2, width: 1.6, sill: 0.9, height: 1.2 },\n ],\n outlets: [\n { id: \"south-1\", wall: \"south\", offset: 1, height: 0.3, circuit: \"c\" },\n { id: \"south-2\", wall: \"south\", offset: 5, height: 0.3, circuit: \"c\" },\n { id: \"west-1\", wall: \"west\", offset: 1.8, height: 0.3, circuit: \"c\" },\n ],\n objects: [\n { id: \"bed\", kind: \"bed\", name: \"Bed\", wall: \"west\", offset: 1, width: 1.6, depth: 2, height: 0.5 },\n { id: \"wardrobe\", kind: \"cabinet\", name: \"Wardrobe\", wall: \"east\", offset: 0.3, width: 1.8, depth: 0.6, height: 2 },\n ],\n },\n },\n ],\n connections: [\n { id: \"living-hall\", from: { room: \"living\", opening: \"door\" }, to: { room: \"hall\", opening: \"living\" }, thickness: 0.1 },\n { id: \"hall-bathroom\", from: { room: \"hall\", opening: \"bathroom\" }, to: { room: \"bathroom\", opening: \"door\" }, thickness: 0.1 },\n {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z } from "zod";
4
+ /**
5
+ * The schema of a room record. It examines the form of the record: the fields, their types and the finite numbers.
6
+ * It refuses a field that the format does not have. `checkRoom` examines the meaning of a record with a correct form.
7
+ */
8
+ export declare const roomSchema: z.ZodType<Room>;
9
+ /**
10
+ * The schema of a scene record. It examines the form of the record, and it refuses a field that the format does not have.
11
+ * `checkScene` examines the meaning of a record with a correct form.
12
+ */
13
+ export declare const sceneSchema: z.ZodType<Scene>;
14
+ /**
15
+ * The schema of a survey record. It examines the form of the record, and it refuses a field that the format does not have.
16
+ * `expandSurvey` makes the room record of a survey with a correct form, and `checkRoom` examines that room record.
17
+ */
18
+ export declare const surveySchema: z.ZodType<Survey>;
19
+ /**
20
+ * The schema of a level record. It examines the form of the record and of each survey, and it refuses a field that the format does not have.
21
+ * `expandLevel` makes the room record of a level with a correct form, and `checkRoom` examines that room record.
22
+ */
23
+ export declare const levelSchema: z.ZodType<Level>;
24
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","names":[],"sources":["../src/schema.ts"],"mappings":";;;;;;;qBAqDa,YAAY,EAAE,QAAQ;;;;;qBAkCtB,aAAa,EAAE,QAAQ;;;;;qBAkDvB,cAAc,EAAE,QAAQ;;;;;qBAyBxB,aAAa,EAAE,QAAQ"}
@@ -0,0 +1,167 @@
1
+ import { c as SQUARE_TURNS, f as OPENING_KINDS, g as WALL_SIDES, h as WALL_FACES, i as LEVEL_SCHEMA, l as SURVEY_SCHEMA, m as SCENE_SCHEMA, p as ROOM_SCHEMA } from "./level-xTO7P1Fn.js";
2
+ import { n as LENGTH_UNITS } from "./units-BZmvVyu4.js";
3
+ import { z } from "zod";
4
+ // src/schema.ts
5
+ const id = z.string().min(1);
6
+ const planPoint = z.tuple([z.number(), z.number()]).readonly();
7
+ const wall = z.strictObject({
8
+ id,
9
+ from: planPoint,
10
+ to: planPoint,
11
+ thickness: z.number().optional(),
12
+ height: z.number().optional(),
13
+ side: z.enum(WALL_SIDES).optional()
14
+ });
15
+ const opening = z.strictObject({
16
+ id,
17
+ wall: id,
18
+ kind: z.enum(OPENING_KINDS),
19
+ offset: z.number(),
20
+ width: z.number(),
21
+ sill: z.number().optional(),
22
+ height: z.number()
23
+ });
24
+ const floor = z.strictObject({
25
+ id,
26
+ name: z.string().optional(),
27
+ ring: z.array(planPoint).readonly()
28
+ });
29
+ const outlet = z.strictObject({
30
+ id,
31
+ wall: id,
32
+ face: z.enum(WALL_FACES),
33
+ offset: z.number(),
34
+ height: z.number(),
35
+ circuit: id.optional()
36
+ });
37
+ const circuit = z.strictObject({
38
+ id,
39
+ name: z.string().optional(),
40
+ limit: z.number()
41
+ });
42
+ /**
43
+ * The schema of a room record. It examines the form of the record: the fields, their types and the finite numbers.
44
+ * It refuses a field that the format does not have. `checkRoom` examines the meaning of a record with a correct form.
45
+ */
46
+ const roomSchema = z.strictObject({
47
+ schema: z.literal(ROOM_SCHEMA),
48
+ name: z.string().optional(),
49
+ unit: z.enum(LENGTH_UNITS),
50
+ height: z.number(),
51
+ wallThickness: z.number(),
52
+ walls: z.array(wall).readonly(),
53
+ openings: z.array(opening).readonly().optional(),
54
+ floors: z.array(floor).readonly().optional(),
55
+ outlets: z.array(outlet).readonly().optional(),
56
+ circuits: z.array(circuit).readonly().optional()
57
+ });
58
+ const placedObject = z.strictObject({
59
+ id,
60
+ kind: z.string().min(1),
61
+ name: z.string().optional(),
62
+ size: z.tuple([
63
+ z.number(),
64
+ z.number(),
65
+ z.number()
66
+ ]).readonly(),
67
+ at: planPoint,
68
+ lift: z.number().optional(),
69
+ turn: z.number().optional(),
70
+ parent: id.optional(),
71
+ outlet: id.optional()
72
+ });
73
+ const circuitLoad = z.strictObject({
74
+ circuit: id,
75
+ watts: z.number()
76
+ });
77
+ /**
78
+ * The schema of a scene record. It examines the form of the record, and it refuses a field that the format does not have.
79
+ * `checkScene` examines the meaning of a record with a correct form.
80
+ */
81
+ const sceneSchema = z.strictObject({
82
+ schema: z.literal(SCENE_SCHEMA),
83
+ name: z.string().optional(),
84
+ room: roomSchema,
85
+ objects: z.array(placedObject).readonly().optional(),
86
+ loads: z.array(circuitLoad).readonly().optional()
87
+ });
88
+ const surveySide = z.strictObject({
89
+ id,
90
+ length: z.number(),
91
+ turn: z.union([z.enum(SQUARE_TURNS), z.number()]),
92
+ thickness: z.number().optional(),
93
+ height: z.number().optional()
94
+ });
95
+ const surveyCheck = z.strictObject({
96
+ id,
97
+ from: id,
98
+ to: id,
99
+ length: z.number()
100
+ });
101
+ const surveyOutlet = z.strictObject({
102
+ id,
103
+ wall: id,
104
+ offset: z.number(),
105
+ height: z.number(),
106
+ circuit: id.optional()
107
+ });
108
+ const surveyObject = z.strictObject({
109
+ id,
110
+ kind: z.string().min(1),
111
+ name: z.string().optional(),
112
+ wall: id.optional(),
113
+ on: id.optional(),
114
+ offset: z.number(),
115
+ width: z.number(),
116
+ depth: z.number(),
117
+ height: z.number(),
118
+ gap: z.number().optional(),
119
+ lift: z.number().optional(),
120
+ outlet: id.optional()
121
+ });
122
+ /**
123
+ * The schema of a survey record. It examines the form of the record, and it refuses a field that the format does not have.
124
+ * `expandSurvey` makes the room record of a survey with a correct form, and `checkRoom` examines that room record.
125
+ */
126
+ const surveySchema = z.strictObject({
127
+ schema: z.literal(SURVEY_SCHEMA),
128
+ name: z.string().optional(),
129
+ unit: z.enum(LENGTH_UNITS),
130
+ height: z.number(),
131
+ wallThickness: z.number(),
132
+ sides: z.array(surveySide).readonly(),
133
+ start: planPoint.optional(),
134
+ heading: z.number().optional(),
135
+ checks: z.array(surveyCheck).readonly().optional(),
136
+ openings: z.array(opening).readonly().optional(),
137
+ outlets: z.array(surveyOutlet).readonly().optional(),
138
+ circuits: z.array(circuit).readonly().optional(),
139
+ objects: z.array(surveyObject).readonly().optional()
140
+ });
141
+ const connectionEnd = z.strictObject({
142
+ room: id,
143
+ opening: id
144
+ });
145
+ /**
146
+ * The schema of a level record. It examines the form of the record and of each survey, and it refuses a field that the format does not have.
147
+ * `expandLevel` makes the room record of a level with a correct form, and `checkRoom` examines that room record.
148
+ */
149
+ const levelSchema = z.strictObject({
150
+ schema: z.literal(LEVEL_SCHEMA),
151
+ name: z.string().optional(),
152
+ unit: z.enum(LENGTH_UNITS),
153
+ rooms: z.array(z.strictObject({
154
+ id,
155
+ survey: surveySchema
156
+ })).readonly(),
157
+ connections: z.array(z.strictObject({
158
+ id,
159
+ from: connectionEnd,
160
+ to: connectionEnd,
161
+ thickness: z.number().optional()
162
+ })).readonly().optional(),
163
+ circuits: z.array(circuit).readonly().optional()
164
+ });
165
+ export { levelSchema, roomSchema, sceneSchema, surveySchema };
166
+
167
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","names":[],"sources":["../src/schema.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { LEVEL_SCHEMA, type Level } from \"./level.ts\";\nimport { OPENING_KINDS, ROOM_SCHEMA, SCENE_SCHEMA, WALL_FACES, WALL_SIDES, type Room, type Scene } from \"./room.ts\";\nimport { SQUARE_TURNS, SURVEY_SCHEMA, type Survey } from \"./survey.ts\";\nimport { LENGTH_UNITS } from \"./units.ts\";\n\nconst id = z.string().min(1);\nconst planPoint = z.tuple([z.number(), z.number()]).readonly();\n\nconst wall = z.strictObject({\n id,\n from: planPoint,\n to: planPoint,\n thickness: z.number().optional(),\n height: z.number().optional(),\n side: z.enum(WALL_SIDES).optional(),\n});\n\nconst opening = z.strictObject({\n id,\n wall: id,\n kind: z.enum(OPENING_KINDS),\n offset: z.number(),\n width: z.number(),\n sill: z.number().optional(),\n height: z.number(),\n});\n\nconst floor = z.strictObject({\n id,\n name: z.string().optional(),\n ring: z.array(planPoint).readonly(),\n});\n\nconst outlet = z.strictObject({\n id,\n wall: id,\n face: z.enum(WALL_FACES),\n offset: z.number(),\n height: z.number(),\n circuit: id.optional(),\n});\n\nconst circuit = z.strictObject({\n id,\n name: z.string().optional(),\n limit: z.number(),\n});\n\n/**\n * The schema of a room record. It examines the form of the record: the fields, their types and the finite numbers.\n * It refuses a field that the format does not have. `checkRoom` examines the meaning of a record with a correct form.\n */\nexport const roomSchema: z.ZodType<Room> = z.strictObject({\n schema: z.literal(ROOM_SCHEMA),\n name: z.string().optional(),\n unit: z.enum(LENGTH_UNITS),\n height: z.number(),\n wallThickness: z.number(),\n walls: z.array(wall).readonly(),\n openings: z.array(opening).readonly().optional(),\n floors: z.array(floor).readonly().optional(),\n outlets: z.array(outlet).readonly().optional(),\n circuits: z.array(circuit).readonly().optional(),\n});\n\nconst placedObject = z.strictObject({\n id,\n kind: z.string().min(1),\n name: z.string().optional(),\n size: z.tuple([z.number(), z.number(), z.number()]).readonly(),\n at: planPoint,\n lift: z.number().optional(),\n turn: z.number().optional(),\n parent: id.optional(),\n outlet: id.optional(),\n});\n\nconst circuitLoad = z.strictObject({\n circuit: id,\n watts: z.number(),\n});\n\n/**\n * The schema of a scene record. It examines the form of the record, and it refuses a field that the format does not have.\n * `checkScene` examines the meaning of a record with a correct form.\n */\nexport const sceneSchema: z.ZodType<Scene> = z.strictObject({\n schema: z.literal(SCENE_SCHEMA),\n name: z.string().optional(),\n room: roomSchema,\n objects: z.array(placedObject).readonly().optional(),\n loads: z.array(circuitLoad).readonly().optional(),\n});\n\nconst surveySide = z.strictObject({\n id,\n length: z.number(),\n turn: z.union([z.enum(SQUARE_TURNS), z.number()]),\n thickness: z.number().optional(),\n height: z.number().optional(),\n});\n\nconst surveyCheck = z.strictObject({\n id,\n from: id,\n to: id,\n length: z.number(),\n});\n\nconst surveyOutlet = z.strictObject({\n id,\n wall: id,\n offset: z.number(),\n height: z.number(),\n circuit: id.optional(),\n});\n\nconst surveyObject = z.strictObject({\n id,\n kind: z.string().min(1),\n name: z.string().optional(),\n wall: id.optional(),\n on: id.optional(),\n offset: z.number(),\n width: z.number(),\n depth: z.number(),\n height: z.number(),\n gap: z.number().optional(),\n lift: z.number().optional(),\n outlet: id.optional(),\n});\n\n/**\n * The schema of a survey record. It examines the form of the record, and it refuses a field that the format does not have.\n * `expandSurvey` makes the room record of a survey with a correct form, and `checkRoom` examines that room record.\n */\nexport const surveySchema: z.ZodType<Survey> = z.strictObject({\n schema: z.literal(SURVEY_SCHEMA),\n name: z.string().optional(),\n unit: z.enum(LENGTH_UNITS),\n height: z.number(),\n wallThickness: z.number(),\n sides: z.array(surveySide).readonly(),\n start: planPoint.optional(),\n heading: z.number().optional(),\n checks: z.array(surveyCheck).readonly().optional(),\n openings: z.array(opening).readonly().optional(),\n outlets: z.array(surveyOutlet).readonly().optional(),\n circuits: z.array(circuit).readonly().optional(),\n objects: z.array(surveyObject).readonly().optional(),\n});\n\nconst connectionEnd = z.strictObject({\n room: id,\n opening: id,\n});\n\n/**\n * The schema of a level record. It examines the form of the record and of each survey, and it refuses a field that the format does not have.\n * `expandLevel` makes the room record of a level with a correct form, and `checkRoom` examines that room record.\n */\nexport const levelSchema: z.ZodType<Level> = z.strictObject({\n schema: z.literal(LEVEL_SCHEMA),\n name: z.string().optional(),\n unit: z.enum(LENGTH_UNITS),\n rooms: z.array(z.strictObject({ id, survey: surveySchema })).readonly(),\n connections: z\n .array(z.strictObject({ id, from: connectionEnd, to: connectionEnd, thickness: z.number().optional() }))\n .readonly()\n .optional(),\n circuits: z.array(circuit).readonly().optional(),\n});\n"],"mappings":";;;;AAMA,MAAM,KAAK,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;AAC3B,MAAM,YAAY,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS;AAE7D,MAAM,OAAO,EAAE,aAAa;CAC1B;CACA,MAAM;CACN,IAAI;CACJ,WAAW,EAAE,OAAO,CAAC,CAAC,SAAS;CAC/B,QAAQ,EAAE,OAAO,CAAC,CAAC,SAAS;CAC5B,MAAM,EAAE,KAAK,UAAU,CAAC,CAAC,SAAS;AACpC,CAAC;AAED,MAAM,UAAU,EAAE,aAAa;CAC7B;CACA,MAAM;CACN,MAAM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M;EAAe,IAAI;EAAe,WAAW,EAAE,OAAO,CAAC,CAAC,SAAS;CAAE,CAAC,CAAC,CAAC,CACvG,SAAS,CAAC,CACV,SAAS;CACZ,UAAU,EAAE,MAAM,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS;AACjD,CAAC"}
@@ -0,0 +1,117 @@
1
+ import { S as SolidOptions, a as LoadLevel, b as Solid, o as LoadOptions, x as SolidKind } from "./loads-H-VFEx6b.js";
2
+ import { p as Scene$1 } from "./room-BUlXejkm.js";
3
+ import { Point3, Rotation3 } from "@mark1russell7/layout-contract";
4
+ import { BufferGeometry } from "three";
5
+ /**
6
+ * The three.js geometry of a solid, and its place in the room.
7
+ * The origin of the geometry is the center of the solid. Thus three.js puts clear solids in the correct sequence.
8
+ */
9
+ interface SolidPlacement {
10
+ /** The geometry, in meters, around its own origin. The caller disposes it. */
11
+ readonly geometry: BufferGeometry;
12
+ /** The position of the origin of the geometry in the room, where the z axis points up. */
13
+ readonly position: Point3;
14
+ /** The rotation of the geometry in the room. */
15
+ readonly rotation: Rotation3;
16
+ }
17
+ /**
18
+ * This function gives the three.js geometry of a solid, with its place in the room.
19
+ *
20
+ * A mesh with this geometry, this position and this rotation is in the space of the room: the z axis points up.
21
+ * Put the mesh in a group with the rotation of `TO_Y_UP`. Then three.js shows it with the y axis up.
22
+ */
23
+ export declare function solidGeometry(solid: Solid): SolidPlacement;
24
+ /**
25
+ * The colors of a viewer. Each color is a CSS hex color, for example `#22364a`.
26
+ * The viewer has no background: the page shows behind the model.
27
+ */
28
+ interface ViewerTheme {
29
+ /** The color of the edges of each solid. */
30
+ readonly edge: string;
31
+ /** The color that marks the solids under the pointer and the selected solids. */
32
+ readonly accent: string;
33
+ readonly floor: string;
34
+ readonly wall: string;
35
+ readonly glass: string;
36
+ /** The part of the glass that is not clear, from 0 to 1. */
37
+ readonly glassOpacity: number;
38
+ /** The color of an outlet with no circuit. */
39
+ readonly outlet: string;
40
+ /** The color of the outlets of a circuit at each level of its load. */
41
+ readonly levels: Readonly<Record<LoadLevel, string>>;
42
+ /** The color of the line around the marker of an outlet. It is the color of the page, so a marker is clear on each solid. */
43
+ readonly halo: string;
44
+ /** The color of a placed object whose kind has no color in `objects`. */
45
+ readonly object: string;
46
+ /** The color of the placed objects of each kind. The key is the field `kind` of a placed object. */
47
+ readonly objects: Readonly<Record<string, string>>;
48
+ /** The color of the light from above. */
49
+ readonly sky: string;
50
+ /** The color of the light from below. */
51
+ readonly ground: string;
52
+ }
53
+ /** The colors of a model of white card with ink edges, for a light page. */
54
+ export declare const LIGHT_THEME: ViewerTheme;
55
+ /** The colors of a blueprint, for a dark page. */
56
+ export declare const DARK_THEME: ViewerTheme;
57
+ /** A record of a scene that the viewer shows: a floor, a wall, a window, an outlet or a placed object. */
58
+ interface ViewerRecord {
59
+ /** The kind of the solids of the record. A window has the kind `glass`. */
60
+ readonly kind: SolidKind;
61
+ /** The `id` of the record in the scene. */
62
+ readonly source: string;
63
+ }
64
+ /** The solid under the pointer, with its record. */
65
+ interface ViewerPick extends ViewerRecord {
66
+ /** The `id` of the solid. A wall with openings has more than one solid. */
67
+ readonly solid: string;
68
+ }
69
+ /** The name of a view: `home` looks into the room from a corner above it, and `top` shows the plan. */
70
+ type ViewName = "home" | "top";
71
+ /** The options of a viewer. */
72
+ interface RoomViewerOptions {
73
+ readonly scene: Scene$1;
74
+ /** The colors. The default is `LIGHT_THEME`. */
75
+ readonly theme?: ViewerTheme | undefined;
76
+ /** The options of the model. */
77
+ readonly solids?: SolidOptions | undefined;
78
+ /** The options of the levels of the circuits. */
79
+ readonly loads?: LoadOptions | undefined;
80
+ /** The name of the picture for a screen reader. */
81
+ readonly label?: string | undefined;
82
+ /** The viewer starts this function when the pointer goes to a different record, or to no record. */
83
+ readonly onHover?: ((pick: ViewerPick | undefined) => void) | undefined;
84
+ /** The viewer starts this function when a person selects a record with the pointer, or selects no record. */
85
+ readonly onSelect?: ((pick: ViewerPick | undefined) => void) | undefined;
86
+ }
87
+ /** A viewer of one scene in a page. */
88
+ interface RoomViewer {
89
+ /** The canvas of the viewer. It is in the container. */
90
+ readonly canvas: HTMLCanvasElement;
91
+ /** This function shows a different scene. The view stays if a person moved it. */
92
+ setScene(scene: Scene$1): void;
93
+ /** This function changes the colors. */
94
+ setTheme(theme: ViewerTheme): void;
95
+ /** This function moves the camera to a view that shows all of the model. */
96
+ setView(view: ViewName): void;
97
+ /** This function marks records, as the pointer does. An empty list removes the marks. */
98
+ highlight(records: readonly ViewerRecord[]): void;
99
+ /** This function selects one record, or no record. It does not start `onSelect`. */
100
+ select(record: ViewerRecord | undefined): void;
101
+ /** This function removes the canvas and releases the memory of the graphics card. */
102
+ dispose(): void;
103
+ }
104
+ /**
105
+ * This function makes a viewer of a scene in a container of a page. The viewer fills the container, so give the container a size.
106
+ *
107
+ * A person turns the model with a drag, and moves nearer with the wheel after a click in the picture.
108
+ * The walls between the camera and the room become almost clear. A click selects the record of a solid.
109
+ * Each outlet has a marker with the color and the shape of the level of its circuit. A marker keeps its size in the picture.
110
+ * A marked outlet or object shows a line from the outlet to each object that takes its power from it.
111
+ * With the keyboard, the arrow keys turn the model, `+` and `-` change the distance, `Home` shows the first view and `T` shows the plan.
112
+ *
113
+ * The function gives `undefined` when the browser has no WebGL 2. It does not throw, and it writes no error to the console.
114
+ */
115
+ export declare function createRoomViewer(container: HTMLElement, options: RoomViewerOptions): RoomViewer | undefined;
116
+ export type { RoomViewer, RoomViewerOptions, SolidPlacement, ViewName, ViewerPick, ViewerRecord, ViewerTheme };
117
+ //# sourceMappingURL=three.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"three.d.ts","names":["Scene"],"sources":["../src/viewer/geometry.ts","../src/viewer/theme.ts","../src/viewer/viewer.ts"],"mappings":";;;;;;;;UAQiB;;WAEN,UAAU;;WAEV,UAAU;;WAEV,UAAU;;;;;;;;wBAYL,cAAc,OAAO,QAAQ;;;;;UCpB5B;;WAEN;;WAEA;WACA;WACA;WACA;;WAEA;;WAEA;;WAEA,QAAQ,SAAS,OAAO;;WAExB;;WAEA;;WAEA,SAAS,SAAS;;WAElB;;WAEA;;;qBAIE,aAAa;;qBAiBb,YAAY;;UCtCR;;WAEN,MAAM;;WAEN;;;UAIM,mBAAmB;;WAEzB;;;KAIC;;UAGK;WACN,OAAOA;;WAEP,QAAQ;;WAER,SAAS;;WAET,QAAQ;;WAER;;WAEA,YAAY,MAAM;;WAElB,aAAa,MAAM;;;UAIb;;WAEN,QAAQ;;EAEjB,SAAS,OAAOA;;EAEhB,SAAS,OAAO;;EAEhB,QAAQ,MAAM;;EAEd,UAAU,kBAAkB;;EAE5B,OAAO,QAAQ;;EAEf;;;;;;;;;;;;;wBA2Dc,iBAAiB,WAAW,aAAa,SAAS,oBAAoB"}