@kerros/viewer 0.0.0-stage → 0.1.0-rc.2

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 (264) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +31 -2
  3. package/dist/adapters/basemap.js +11 -0
  4. package/dist/adapters/basemap.js.map +1 -0
  5. package/dist/adapters/persistence.js +121 -0
  6. package/dist/adapters/persistence.js.map +1 -0
  7. package/dist/adapters/status.js +18 -0
  8. package/dist/adapters/status.js.map +1 -0
  9. package/dist/components/ElevatorPanel.js +120 -0
  10. package/dist/components/ElevatorPanel.js.map +1 -0
  11. package/dist/components/Icons.js +57 -0
  12. package/dist/components/Icons.js.map +1 -0
  13. package/dist/components/Inspector.js +1184 -0
  14. package/dist/components/Inspector.js.map +1 -0
  15. package/dist/components/NavigatePanel.js +301 -0
  16. package/dist/components/NavigatePanel.js.map +1 -0
  17. package/dist/components/NavigationGraph.js +234 -0
  18. package/dist/components/NavigationGraph.js.map +1 -0
  19. package/dist/components/StructureExplorer.js +510 -0
  20. package/dist/components/StructureExplorer.js.map +1 -0
  21. package/dist/components/StructureView.js +286 -0
  22. package/dist/components/StructureView.js.map +1 -0
  23. package/dist/components/controls.js +170 -0
  24. package/dist/components/controls.js.map +1 -0
  25. package/dist/components/graphLayout.js +27 -0
  26. package/dist/components/graphLayout.js.map +1 -0
  27. package/dist/host.js +169 -0
  28. package/dist/host.js.map +1 -0
  29. package/dist/i18n.js +88 -0
  30. package/dist/i18n.js.map +1 -0
  31. package/dist/index.js +171 -0
  32. package/dist/index.js.map +1 -0
  33. package/dist/map/CabinMaterials.js +81 -0
  34. package/dist/map/CabinMaterials.js.map +1 -0
  35. package/dist/map/CabinMirror.js +43 -0
  36. package/dist/map/CabinMirror.js.map +1 -0
  37. package/dist/map/Doors.js +80 -0
  38. package/dist/map/Doors.js.map +1 -0
  39. package/dist/map/ElevatorCabin.js +93 -0
  40. package/dist/map/ElevatorCabin.js.map +1 -0
  41. package/dist/map/FixtureLights.js +117 -0
  42. package/dist/map/FixtureLights.js.map +1 -0
  43. package/dist/map/MapCanvas.js +2161 -0
  44. package/dist/map/MapCanvas.js.map +1 -0
  45. package/dist/map/Passenger.js +69 -0
  46. package/dist/map/Passenger.js.map +1 -0
  47. package/dist/map/SceneLayer.js +1534 -0
  48. package/dist/map/SceneLayer.js.map +1 -0
  49. package/dist/map/UndergroundContext.js +153 -0
  50. package/dist/map/UndergroundContext.js.map +1 -0
  51. package/dist/map/ambience.js +194 -0
  52. package/dist/map/ambience.js.map +1 -0
  53. package/dist/map/architecture.js +305 -0
  54. package/dist/map/architecture.js.map +1 -0
  55. package/dist/map/bathMusic.js +92 -0
  56. package/dist/map/bathMusic.js.map +1 -0
  57. package/dist/map/cameraAim.js +33 -0
  58. package/dist/map/cameraAim.js.map +1 -0
  59. package/dist/map/elevators.js +56 -0
  60. package/dist/map/elevators.js.map +1 -0
  61. package/dist/map/excavation.js +52 -0
  62. package/dist/map/excavation.js.map +1 -0
  63. package/dist/map/exteriors.js +25 -0
  64. package/dist/map/exteriors.js.map +1 -0
  65. package/dist/map/features.js +218 -0
  66. package/dist/map/features.js.map +1 -0
  67. package/dist/map/fences.js +29 -0
  68. package/dist/map/fences.js.map +1 -0
  69. package/dist/map/journey.js +112 -0
  70. package/dist/map/journey.js.map +1 -0
  71. package/dist/map/levels.js +6 -0
  72. package/dist/map/levels.js.map +1 -0
  73. package/dist/map/lighting.js +142 -0
  74. package/dist/map/lighting.js.map +1 -0
  75. package/dist/map/loadBasemap.js +26 -0
  76. package/dist/map/loadBasemap.js.map +1 -0
  77. package/dist/map/materials.js +183 -0
  78. package/dist/map/materials.js.map +1 -0
  79. package/dist/map/poolLighting.js +39 -0
  80. package/dist/map/poolLighting.js.map +1 -0
  81. package/dist/map/projection.js +24 -0
  82. package/dist/map/projection.js.map +1 -0
  83. package/dist/map/rampGeometry.js +38 -0
  84. package/dist/map/rampGeometry.js.map +1 -0
  85. package/dist/map/route.js +107 -0
  86. package/dist/map/route.js.map +1 -0
  87. package/dist/map/stairSurfaces.js +115 -0
  88. package/dist/map/stairSurfaces.js.map +1 -0
  89. package/dist/map/surfaces.js +136 -0
  90. package/dist/map/surfaces.js.map +1 -0
  91. package/dist/map/textures.js +95 -0
  92. package/dist/map/textures.js.map +1 -0
  93. package/dist/map/underground.js +34 -0
  94. package/dist/map/underground.js.map +1 -0
  95. package/dist/map/walk.js +433 -0
  96. package/dist/map/walk.js.map +1 -0
  97. package/dist/map/walkContext.js +46 -0
  98. package/dist/map/walkContext.js.map +1 -0
  99. package/dist/map/walkDimensions.js +7 -0
  100. package/dist/map/walkDimensions.js.map +1 -0
  101. package/dist/map/walkJourney.js +85 -0
  102. package/dist/map/walkJourney.js.map +1 -0
  103. package/dist/map/walkSurfaces.js +106 -0
  104. package/dist/map/walkSurfaces.js.map +1 -0
  105. package/dist/map/wallJoins.js +70 -0
  106. package/dist/map/wallJoins.js.map +1 -0
  107. package/dist/map/water.js +274 -0
  108. package/dist/map/water.js.map +1 -0
  109. package/dist/model/authoring.js +80 -0
  110. package/dist/model/authoring.js.map +1 -0
  111. package/dist/model/boundaries.js +548 -0
  112. package/dist/model/boundaries.js.map +1 -0
  113. package/dist/model/coverage.js +30 -0
  114. package/dist/model/coverage.js.map +1 -0
  115. package/dist/model/document.js +52 -0
  116. package/dist/model/document.js.map +1 -0
  117. package/dist/model/doors.js +47 -0
  118. package/dist/model/doors.js.map +1 -0
  119. package/dist/model/factory.js +56 -0
  120. package/dist/model/factory.js.map +1 -0
  121. package/dist/model/geometry.js +394 -0
  122. package/dist/model/geometry.js.map +1 -0
  123. package/dist/model/inference.js +182 -0
  124. package/dist/model/inference.js.map +1 -0
  125. package/dist/model/materials.js +11 -0
  126. package/dist/model/materials.js.map +1 -0
  127. package/dist/model/mutations.js +157 -0
  128. package/dist/model/mutations.js.map +1 -0
  129. package/dist/model/navigation.js +275 -0
  130. package/dist/model/navigation.js.map +1 -0
  131. package/dist/model/ontology.js +109 -0
  132. package/dist/model/ontology.js.map +1 -0
  133. package/dist/model/passages.js +5 -0
  134. package/dist/model/passages.js.map +1 -0
  135. package/dist/model/portals.js +42 -0
  136. package/dist/model/portals.js.map +1 -0
  137. package/dist/model/precision.js +11 -0
  138. package/dist/model/precision.js.map +1 -0
  139. package/dist/model/project.js +17 -0
  140. package/dist/model/project.js.map +1 -0
  141. package/dist/model/ramps.js +10 -0
  142. package/dist/model/ramps.js.map +1 -0
  143. package/dist/model/roomNavigation.js +87 -0
  144. package/dist/model/roomNavigation.js.map +1 -0
  145. package/dist/model/routeClearance.js +72 -0
  146. package/dist/model/routeClearance.js.map +1 -0
  147. package/dist/model/spaces.js +104 -0
  148. package/dist/model/spaces.js.map +1 -0
  149. package/dist/model/stairGeometry.js +40 -0
  150. package/dist/model/stairGeometry.js.map +1 -0
  151. package/dist/model/stairTraversal.js +48 -0
  152. package/dist/model/stairTraversal.js.map +1 -0
  153. package/dist/model/topology.js +63 -0
  154. package/dist/model/topology.js.map +1 -0
  155. package/dist/model/types.js +35 -0
  156. package/dist/model/types.js.map +1 -0
  157. package/dist/model/validate.js +240 -0
  158. package/dist/model/validate.js.map +1 -0
  159. package/dist/model/vertical.js +129 -0
  160. package/dist/model/vertical.js.map +1 -0
  161. package/dist/model/walls.js +71 -0
  162. package/dist/model/walls.js.map +1 -0
  163. package/dist/styles.css +4931 -0
  164. package/dist/theme/index.js +34 -0
  165. package/dist/theme/index.js.map +1 -0
  166. package/dist/types/adapters/basemap.d.ts +2 -0
  167. package/dist/types/adapters/persistence.d.ts +29 -0
  168. package/dist/types/adapters/status.d.ts +4 -0
  169. package/dist/types/components/ElevatorPanel.d.ts +18 -0
  170. package/dist/types/components/Icons.d.ts +8 -0
  171. package/dist/types/components/Inspector.d.ts +38 -0
  172. package/dist/types/components/NavigatePanel.d.ts +27 -0
  173. package/dist/types/components/NavigationGraph.d.ts +10 -0
  174. package/dist/types/components/StructureExplorer.d.ts +8 -0
  175. package/dist/types/components/StructureView.d.ts +22 -0
  176. package/dist/types/components/controls.d.ts +52 -0
  177. package/dist/types/components/graphLayout.d.ts +9 -0
  178. package/dist/types/i18n.d.ts +85 -0
  179. package/dist/types/import/analysisPreview.d.ts +27 -0
  180. package/dist/types/import/brief.d.ts +22 -0
  181. package/dist/types/import/checkpoint.d.ts +49 -0
  182. package/dist/types/import/instructions.d.ts +7 -0
  183. package/dist/types/import/usage.d.ts +10 -0
  184. package/dist/types/map/CabinMaterials.d.ts +18 -0
  185. package/dist/types/map/CabinMirror.d.ts +13 -0
  186. package/dist/types/map/Doors.d.ts +11 -0
  187. package/dist/types/map/ElevatorCabin.d.ts +20 -0
  188. package/dist/types/map/FixtureLights.d.ts +35 -0
  189. package/dist/types/map/MapCanvas.d.ts +87 -0
  190. package/dist/types/map/Passenger.d.ts +18 -0
  191. package/dist/types/map/SceneLayer.d.ts +306 -0
  192. package/dist/types/map/UndergroundContext.d.ts +18 -0
  193. package/dist/types/map/ambience.d.ts +29 -0
  194. package/dist/types/map/architecture.d.ts +8 -0
  195. package/dist/types/map/bathMusic.d.ts +14 -0
  196. package/dist/types/map/cameraAim.d.ts +20 -0
  197. package/dist/types/map/elevators.d.ts +16 -0
  198. package/dist/types/map/excavation.d.ts +9 -0
  199. package/dist/types/map/exteriors.d.ts +3 -0
  200. package/dist/types/map/features.d.ts +33 -0
  201. package/dist/types/map/fences.d.ts +4 -0
  202. package/dist/types/map/journey.d.ts +36 -0
  203. package/dist/types/map/levels.d.ts +4 -0
  204. package/dist/types/map/lighting.d.ts +103 -0
  205. package/dist/types/map/loadBasemap.d.ts +4 -0
  206. package/dist/types/map/materials.d.ts +38 -0
  207. package/dist/types/map/poolLighting.d.ts +11 -0
  208. package/dist/types/map/projection.d.ts +9 -0
  209. package/dist/types/map/rampGeometry.d.ts +8 -0
  210. package/dist/types/map/route.d.ts +59 -0
  211. package/dist/types/map/stairSurfaces.d.ts +29 -0
  212. package/dist/types/map/surfaces.d.ts +36 -0
  213. package/dist/types/map/textures.d.ts +8 -0
  214. package/dist/types/map/underground.d.ts +30 -0
  215. package/dist/types/map/walk.d.ts +232 -0
  216. package/dist/types/map/walkContext.d.ts +11 -0
  217. package/dist/types/map/walkDimensions.d.ts +5 -0
  218. package/dist/types/map/walkJourney.d.ts +33 -0
  219. package/dist/types/map/walkSurfaces.d.ts +27 -0
  220. package/dist/types/map/wallJoins.d.ts +6 -0
  221. package/dist/types/map/water.d.ts +12 -0
  222. package/dist/types/model/authoring.d.ts +38 -0
  223. package/dist/types/model/boundaries.d.ts +41 -0
  224. package/dist/types/model/coverage.d.ts +8 -0
  225. package/dist/types/model/document.d.ts +9 -0
  226. package/dist/types/model/doors.d.ts +19 -0
  227. package/dist/types/model/factory.d.ts +5 -0
  228. package/dist/types/model/geometry.d.ts +99 -0
  229. package/dist/types/model/host.d.ts +154 -0
  230. package/dist/types/model/inference.d.ts +46 -0
  231. package/dist/types/model/live.d.ts +60 -0
  232. package/dist/types/model/materials.d.ts +28 -0
  233. package/dist/types/model/mutations.d.ts +178 -0
  234. package/dist/types/model/navigation.d.ts +70 -0
  235. package/dist/types/model/ontology.d.ts +43 -0
  236. package/dist/types/model/passages.d.ts +2 -0
  237. package/dist/types/model/portals.d.ts +9 -0
  238. package/dist/types/model/precision.d.ts +11 -0
  239. package/dist/types/model/project.d.ts +8 -0
  240. package/dist/types/model/ramps.d.ts +7 -0
  241. package/dist/types/model/roomNavigation.d.ts +15 -0
  242. package/dist/types/model/routeClearance.d.ts +11 -0
  243. package/dist/types/model/spaces.d.ts +46 -0
  244. package/dist/types/model/stairGeometry.d.ts +27 -0
  245. package/dist/types/model/stairTraversal.d.ts +8 -0
  246. package/dist/types/model/topology.d.ts +14 -0
  247. package/dist/types/model/types.d.ts +369 -0
  248. package/dist/types/model/validate.d.ts +38 -0
  249. package/dist/types/model/vertical.d.ts +145 -0
  250. package/dist/types/model/walls.d.ts +71 -0
  251. package/dist/types/schema/index.d.ts +25 -0
  252. package/dist/types/theme/index.d.ts +55 -0
  253. package/dist/types/viewer/FloorViewer.d.ts +76 -0
  254. package/dist/types/viewer/ViewerWorkspace.d.ts +2 -0
  255. package/dist/types/viewer/host.d.ts +11 -0
  256. package/dist/types/viewer/index.d.ts +2 -0
  257. package/dist/types/viewer/panels.d.ts +12 -0
  258. package/dist/viewer/FloorViewer.js +104 -0
  259. package/dist/viewer/FloorViewer.js.map +1 -0
  260. package/dist/viewer/ViewerWorkspace.js +370 -0
  261. package/dist/viewer/ViewerWorkspace.js.map +1 -0
  262. package/dist/viewer/panels.js +35 -0
  263. package/dist/viewer/panels.js.map +1 -0
  264. package/package.json +58 -4
package/dist/host.js ADDED
@@ -0,0 +1,169 @@
1
+ import { neutralBasemap as r } from "./adapters/basemap.js";
2
+ import { statusLabel as a, statusTone as n, unknownStatus as s } from "./adapters/status.js";
3
+ import { IndexedAssetRepository as p, IndexedProjectRepository as d, LocalProjectRepository as c } from "./adapters/persistence.js";
4
+ import { KerrosThemeProvider as f, useDarkMode as m, useKerrosTheme as g, useStrings as u } from "./theme/index.js";
5
+ import { enclosedRegion as E, enclosedRegions as v, inSpace as x, refitEnclosedRooms as P, spaceAt as y, spacePoint as S, spaces as h } from "./model/spaces.js";
6
+ import { addPortalGroup as T, addZone as A, captive as N, entryInto as b, nestZone as I, perimeter as B, pruneOntology as _, removePortalGroup as j, removeZone as L, setPortalGroupMembers as M, setZoneMembers as D, zoneSpaces as V } from "./model/ontology.js";
7
+ import { divideSpaces as G, inferOpenBoundaries as C, inferPortals as w, mergeSpaces as K, refreshPortals as Z, spacesDividedBy as z, spacesRejoinedBy as H } from "./model/inference.js";
8
+ import { derivedGraph as k } from "./model/topology.js";
9
+ import { effectivePortals as W, sharedBoundaryPortals as X } from "./model/portals.js";
10
+ import { OBJECT_KINDS as Q, isArea as Y, isDevice as $, isOpening as ee, isSpace as oe, uid as re } from "./model/types.js";
11
+ import { createObject as ae, emptyProject as ne } from "./model/factory.js";
12
+ import { addBoundaryHole as ie, addVirtualBoundary as pe, bindSpaceToRegion as de, boundaryEdges as ce, boundaryRegionAt as le, boundaryRegions as fe, boundaryRings as me, connectSpace as ge, derivedSpaceRings as ue, disconnectSpace as Re, drawVirtualBoundary as Ee, followsBoundaries as ve, normalizeBoundaries as xe, refreshBoundarySpaces as Pe } from "./model/boundaries.js";
13
+ import { DEFAULT_FOV as Se, DEFAULT_RANGE as he, coverageOf as Oe } from "./model/coverage.js";
14
+ import { copyProject as Ae, openingFloorId as Ne } from "./model/project.js";
15
+ import { MIN_SEGMENT as Ie, OPENING_MIN_SEGMENT as Be, addBarrier as _e, barrierEnds as je, centroid as Le, closeRing as Me, distance as De, duplicateFloor as Ve, footprint as Fe, geoOrigin as Ge, moveOrigin as Ce, objectArea as we, objectPosition as Ke, objectRotation as Ze, openRing as ze, pointInRing as He, rectangle as Ue, removeFloor as ke, ringArea as Je, rotate as We, segmentProjection as Xe, segmentsCross as qe, slopeElevation as Qe, toLngLat as Ye, toLocal as $e } from "./model/geometry.js";
16
+ import { blobDataUrl as oo, exportProject as ro, importProject as to, parseExport as ao } from "./model/document.js";
17
+ import { COORD_LIMIT as so, freezeProject as io, transact as po, validateNavigation as co, validateProject as lo, validateRelationships as fo, validateRings as mo } from "./model/validate.js";
18
+ import { applyMutation as uo, applyMutations as Ro } from "./model/mutations.js";
19
+ import { DOOR_COST as vo, ELEVATOR_BASE as xo, ELEVATOR_PER_METRE as Po, HERE as yo, NAV_WELD as So, STAIR_CLIMB_FACTOR as ho, addNavEdge as Oo, addNavNode as To, chainVertical as Ao, edgeCost as No, edgeLength as bo, findRoute as Io, floorPhrase as Bo, navEdges as _o, navNodes as jo, navPath as Lo, routeAnchors as Mo, routeSteps as Do } from "./model/navigation.js";
20
+ import { EXTERIOR_PRESETS as Fo } from "./model/materials.js";
21
+ import { PITCH as Co, flights as wo, flightsAt as Ko, isVertical as Zo, passesThrough as zo, pitchOf as Ho, primaryShafts as Uo, reaches as ko, runFor as Jo, servedFloors as Wo, shaftKey as Xo, shaftVoids as qo, span as Qo } from "./model/vertical.js";
22
+ import { buildRoomNavigation as $o } from "./model/roomNavigation.js";
23
+ import { StructureView as or } from "./components/StructureView.js";
24
+ import { NavigationGraph as tr, NavigationPanel as ar, ReadOnlyInspector as nr } from "./viewer/panels.js";
25
+ export {
26
+ so as COORD_LIMIT,
27
+ Se as DEFAULT_FOV,
28
+ he as DEFAULT_RANGE,
29
+ vo as DOOR_COST,
30
+ xo as ELEVATOR_BASE,
31
+ Po as ELEVATOR_PER_METRE,
32
+ Fo as EXTERIOR_PRESETS,
33
+ yo as HERE,
34
+ p as IndexedAssetRepository,
35
+ d as IndexedProjectRepository,
36
+ f as KerrosThemeProvider,
37
+ c as LocalProjectRepository,
38
+ Ie as MIN_SEGMENT,
39
+ So as NAV_WELD,
40
+ tr as NavigationGraph,
41
+ ar as NavigationPanel,
42
+ Q as OBJECT_KINDS,
43
+ Be as OPENING_MIN_SEGMENT,
44
+ Co as PITCH,
45
+ nr as ReadOnlyInspector,
46
+ ho as STAIR_CLIMB_FACTOR,
47
+ or as StructureView,
48
+ _e as addBarrier,
49
+ ie as addBoundaryHole,
50
+ Oo as addNavEdge,
51
+ To as addNavNode,
52
+ T as addPortalGroup,
53
+ pe as addVirtualBoundary,
54
+ A as addZone,
55
+ uo as applyMutation,
56
+ Ro as applyMutations,
57
+ je as barrierEnds,
58
+ de as bindSpaceToRegion,
59
+ oo as blobDataUrl,
60
+ ce as boundaryEdges,
61
+ le as boundaryRegionAt,
62
+ fe as boundaryRegions,
63
+ me as boundaryRings,
64
+ $o as buildRoomNavigation,
65
+ N as captive,
66
+ Le as centroid,
67
+ Ao as chainVertical,
68
+ Me as closeRing,
69
+ ge as connectSpace,
70
+ Ae as copyProject,
71
+ Oe as coverageOf,
72
+ ae as createObject,
73
+ k as derivedGraph,
74
+ ue as derivedSpaceRings,
75
+ Re as disconnectSpace,
76
+ De as distance,
77
+ G as divideSpaces,
78
+ Ee as drawVirtualBoundary,
79
+ Ve as duplicateFloor,
80
+ No as edgeCost,
81
+ bo as edgeLength,
82
+ W as effectivePortals,
83
+ ne as emptyProject,
84
+ E as enclosedRegion,
85
+ v as enclosedRegions,
86
+ b as entryInto,
87
+ ro as exportProject,
88
+ Io as findRoute,
89
+ wo as flights,
90
+ Ko as flightsAt,
91
+ Bo as floorPhrase,
92
+ ve as followsBoundaries,
93
+ Fe as footprint,
94
+ io as freezeProject,
95
+ Ge as geoOrigin,
96
+ to as importProject,
97
+ x as inSpace,
98
+ C as inferOpenBoundaries,
99
+ w as inferPortals,
100
+ Y as isArea,
101
+ $ as isDevice,
102
+ ee as isOpening,
103
+ oe as isSpace,
104
+ Zo as isVertical,
105
+ K as mergeSpaces,
106
+ Ce as moveOrigin,
107
+ _o as navEdges,
108
+ jo as navNodes,
109
+ Lo as navPath,
110
+ I as nestZone,
111
+ r as neutralBasemap,
112
+ xe as normalizeBoundaries,
113
+ we as objectArea,
114
+ Ke as objectPosition,
115
+ Ze as objectRotation,
116
+ ze as openRing,
117
+ Ne as openingFloorId,
118
+ ao as parseExport,
119
+ zo as passesThrough,
120
+ B as perimeter,
121
+ Ho as pitchOf,
122
+ He as pointInRing,
123
+ Uo as primaryShafts,
124
+ _ as pruneOntology,
125
+ ko as reaches,
126
+ Ue as rectangle,
127
+ P as refitEnclosedRooms,
128
+ Pe as refreshBoundarySpaces,
129
+ Z as refreshPortals,
130
+ ke as removeFloor,
131
+ j as removePortalGroup,
132
+ L as removeZone,
133
+ Je as ringArea,
134
+ We as rotate,
135
+ Mo as routeAnchors,
136
+ Do as routeSteps,
137
+ Jo as runFor,
138
+ Xe as segmentProjection,
139
+ qe as segmentsCross,
140
+ Wo as servedFloors,
141
+ M as setPortalGroupMembers,
142
+ D as setZoneMembers,
143
+ Xo as shaftKey,
144
+ qo as shaftVoids,
145
+ X as sharedBoundaryPortals,
146
+ Qe as slopeElevation,
147
+ y as spaceAt,
148
+ S as spacePoint,
149
+ h as spaces,
150
+ z as spacesDividedBy,
151
+ H as spacesRejoinedBy,
152
+ Qo as span,
153
+ a as statusLabel,
154
+ n as statusTone,
155
+ Ye as toLngLat,
156
+ $e as toLocal,
157
+ po as transact,
158
+ re as uid,
159
+ s as unknownStatus,
160
+ m as useDarkMode,
161
+ g as useKerrosTheme,
162
+ u as useStrings,
163
+ co as validateNavigation,
164
+ lo as validateProject,
165
+ fo as validateRelationships,
166
+ mo as validateRings,
167
+ V as zoneSpaces
168
+ };
169
+ //# sourceMappingURL=host.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;"}
package/dist/i18n.js ADDED
@@ -0,0 +1,88 @@
1
+ const e = {
2
+ app: "Spaces",
3
+ brand: "kerros",
4
+ viewer: "Plan viewer",
5
+ editor: "Plan editor",
6
+ monitor: "Live view",
7
+ overview: "Overview",
8
+ floors: "Floors & levels",
9
+ drawings: "Reference drawings",
10
+ objects: "Objects",
11
+ import: "Import",
12
+ export: "Export project",
13
+ saved: "All changes saved",
14
+ saving: "Saving changes…",
15
+ saveError: "Not saved · export a backup",
16
+ outdoors: "Outdoor site",
17
+ tools: {
18
+ select: "Select",
19
+ pan: "Pan",
20
+ wall: "Wall",
21
+ boundary: "Virtual boundary",
22
+ partition: "Partition",
23
+ fence: "Fence",
24
+ zone: "Zone polygon",
25
+ room: "Room polygon",
26
+ rectangle: "Rectangle",
27
+ hole: "Cut a hole",
28
+ door: "Door",
29
+ window: "Window",
30
+ gate: "Gate",
31
+ turnstile: "Turnstile",
32
+ reader: "RFID reader",
33
+ camera: "Camera",
34
+ elevator: "Elevator",
35
+ stairs: "Stairs",
36
+ office: "Site office",
37
+ container: "Container",
38
+ storage: "Storage area",
39
+ poi: "POI marker",
40
+ measure: "Measure",
41
+ adopt: "Adopt basemap building",
42
+ split: "Split room",
43
+ enclose: "Space from walls",
44
+ route: "Route path",
45
+ sensor: "Sensor",
46
+ light: "Ceiling light",
47
+ alarm: "Alarm point",
48
+ equipment: "Equipment",
49
+ evacuation: "Evacuation zone"
50
+ },
51
+ navigate: {
52
+ title: "Navigate",
53
+ from: "From",
54
+ to: "To",
55
+ choose: "Choose a place…",
56
+ swap: "Swap start and destination",
57
+ clear: "Clear route",
58
+ play: "Play route",
59
+ pause: "Pause",
60
+ prev: "Previous step",
61
+ next: "Next step",
62
+ walking: "walking",
63
+ floors: "floors",
64
+ steps: "steps",
65
+ noGraph: "No routes drawn yet",
66
+ noGraphHintEdit: "Use the Route path tool in the editor: click to chain walking nodes, click a lift or stairs to link floors, click doors and POIs to bind destinations.",
67
+ noGraphHintView: "This project has no authored route network yet.",
68
+ unreachable: "No route found",
69
+ unreachableHint: "These places are not connected by the drawn route network.",
70
+ pick: "Choose a start and a destination to see directions.",
71
+ here: "Where you are",
72
+ hereHint: "Where the walk left you",
73
+ levels: "Browse by level",
74
+ allLevels: "All levels",
75
+ places: "places",
76
+ more: "Scroll for more…"
77
+ },
78
+ map: {
79
+ basemapUnavailable: "Basemap unavailable. Your plan is still available; choose Plan background.",
80
+ basemapUnavailablePlan: "Basemap unavailable. The floor model remains available on the plan background.",
81
+ adoptMiss: "No basemap building here — click a building footprint on the map.",
82
+ adoptFail: "Could not trace that footprint — try zooming in first."
83
+ }
84
+ };
85
+ export {
86
+ e as en
87
+ };
88
+ //# sourceMappingURL=i18n.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"i18n.js","sources":["../../../src/i18n.ts"],"sourcesContent":["// The library's user-facing English strings. A host translates/overrides any subset via\n// KerrosThemeProvider's `strings` (deep-merged over these); components read them through useStrings().\nexport const en = {\n app: 'Spaces',\n brand: 'kerros',\n viewer: 'Plan viewer',\n editor: 'Plan editor',\n monitor: 'Live view',\n overview: 'Overview',\n floors: 'Floors & levels',\n drawings: 'Reference drawings',\n objects: 'Objects',\n import: 'Import',\n export: 'Export project',\n saved: 'All changes saved',\n saving: 'Saving changes…',\n saveError: 'Not saved · export a backup',\n outdoors: 'Outdoor site',\n tools: {\n select: 'Select',\n pan: 'Pan',\n wall: 'Wall',\n boundary: 'Virtual boundary',\n partition: 'Partition',\n fence: 'Fence',\n zone: 'Zone polygon',\n room: 'Room polygon',\n rectangle: 'Rectangle',\n hole: 'Cut a hole',\n door: 'Door',\n window: 'Window',\n gate: 'Gate',\n turnstile: 'Turnstile',\n reader: 'RFID reader',\n camera: 'Camera',\n elevator: 'Elevator',\n stairs: 'Stairs',\n office: 'Site office',\n container: 'Container',\n storage: 'Storage area',\n poi: 'POI marker',\n measure: 'Measure',\n adopt: 'Adopt basemap building',\n split: 'Split room',\n enclose: 'Space from walls',\n route: 'Route path',\n sensor: 'Sensor',\n light: 'Ceiling light',\n alarm: 'Alarm point',\n equipment: 'Equipment',\n evacuation: 'Evacuation zone',\n },\n navigate: {\n title: 'Navigate',\n from: 'From',\n to: 'To',\n choose: 'Choose a place…',\n swap: 'Swap start and destination',\n clear: 'Clear route',\n play: 'Play route',\n pause: 'Pause',\n prev: 'Previous step',\n next: 'Next step',\n walking: 'walking',\n floors: 'floors',\n steps: 'steps',\n noGraph: 'No routes drawn yet',\n noGraphHintEdit:\n 'Use the Route path tool in the editor: click to chain walking nodes, click a lift or stairs to link floors, click doors and POIs to bind destinations.',\n noGraphHintView: 'This project has no authored route network yet.',\n unreachable: 'No route found',\n unreachableHint: 'These places are not connected by the drawn route network.',\n pick: 'Choose a start and a destination to see directions.',\n here: 'Where you are',\n hereHint: 'Where the walk left you',\n levels: 'Browse by level',\n allLevels: 'All levels',\n places: 'places',\n more: 'Scroll for more…',\n },\n map: {\n basemapUnavailable: 'Basemap unavailable. Your plan is still available; choose Plan background.',\n basemapUnavailablePlan: 'Basemap unavailable. The floor model remains available on the plan background.',\n adoptMiss: 'No basemap building here — click a building footprint on the map.',\n adoptFail: 'Could not trace that footprint — try zooming in first.',\n },\n};\nexport type En = typeof en;\n"],"names":["en"],"mappings":"AAEO,MAAMA,IAAK;AAAA,EAChB,KAAK;AAAA,EACL,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,QAAQ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;AAAA,EAER,KAAK;AAAA,IACH,oBAAoB;AAAA,IACpB,wBAAwB;AAAA,IACxB,WAAW;AAAA,IACX,WAAW;AAAA,EAAA;AAEf;"}
package/dist/index.js ADDED
@@ -0,0 +1,171 @@
1
+ import { FloorViewer as r } from "./viewer/FloorViewer.js";
2
+ import { neutralBasemap as a } from "./adapters/basemap.js";
3
+ import { statusLabel as s, statusTone as i, unknownStatus as p } from "./adapters/status.js";
4
+ import { IndexedAssetRepository as c, IndexedProjectRepository as l, LocalProjectRepository as f } from "./adapters/persistence.js";
5
+ import { KerrosThemeProvider as g, useDarkMode as u, useKerrosTheme as R, useStrings as E } from "./theme/index.js";
6
+ import { enclosedRegion as v, enclosedRegions as P, inSpace as y, refitEnclosedRooms as S, spaceAt as h, spacePoint as O, spaces as T } from "./model/spaces.js";
7
+ import { addPortalGroup as N, addZone as b, captive as I, entryInto as B, nestZone as _, perimeter as j, pruneOntology as L, removePortalGroup as M, removeZone as V, setPortalGroupMembers as D, setZoneMembers as F, zoneSpaces as G } from "./model/ontology.js";
8
+ import { divideSpaces as w, inferOpenBoundaries as K, inferPortals as Z, mergeSpaces as z, refreshPortals as H, spacesDividedBy as U, spacesRejoinedBy as k } from "./model/inference.js";
9
+ import { derivedGraph as W } from "./model/topology.js";
10
+ import { effectivePortals as q, sharedBoundaryPortals as Q } from "./model/portals.js";
11
+ import { OBJECT_KINDS as $, isArea as ee, isDevice as oe, isOpening as re, isSpace as te, uid as ae } from "./model/types.js";
12
+ import { createObject as se, emptyProject as ie } from "./model/factory.js";
13
+ import { addBoundaryHole as de, addVirtualBoundary as ce, bindSpaceToRegion as le, boundaryEdges as fe, boundaryRegionAt as me, boundaryRegions as ge, boundaryRings as ue, connectSpace as Re, derivedSpaceRings as Ee, disconnectSpace as xe, drawVirtualBoundary as ve, followsBoundaries as Pe, normalizeBoundaries as ye, refreshBoundarySpaces as Se } from "./model/boundaries.js";
14
+ import { DEFAULT_FOV as Oe, DEFAULT_RANGE as Te, coverageOf as Ae } from "./model/coverage.js";
15
+ import { copyProject as be, openingFloorId as Ie } from "./model/project.js";
16
+ import { MIN_SEGMENT as _e, OPENING_MIN_SEGMENT as je, addBarrier as Le, barrierEnds as Me, centroid as Ve, closeRing as De, distance as Fe, duplicateFloor as Ge, footprint as Ce, geoOrigin as we, moveOrigin as Ke, objectArea as Ze, objectPosition as ze, objectRotation as He, openRing as Ue, pointInRing as ke, rectangle as Je, removeFloor as We, ringArea as Xe, rotate as qe, segmentProjection as Qe, segmentsCross as Ye, slopeElevation as $e, toLngLat as eo, toLocal as oo } from "./model/geometry.js";
17
+ import { blobDataUrl as to, exportProject as ao, importProject as no, parseExport as so } from "./model/document.js";
18
+ import { COORD_LIMIT as po, freezeProject as co, transact as lo, validateNavigation as fo, validateProject as mo, validateRelationships as go, validateRings as uo } from "./model/validate.js";
19
+ import { applyMutation as Eo, applyMutations as xo } from "./model/mutations.js";
20
+ import { DOOR_COST as Po, ELEVATOR_BASE as yo, ELEVATOR_PER_METRE as So, HERE as ho, NAV_WELD as Oo, STAIR_CLIMB_FACTOR as To, addNavEdge as Ao, addNavNode as No, chainVertical as bo, edgeCost as Io, edgeLength as Bo, findRoute as _o, floorPhrase as jo, navEdges as Lo, navNodes as Mo, navPath as Vo, routeAnchors as Do, routeSteps as Fo } from "./model/navigation.js";
21
+ import { EXTERIOR_PRESETS as Co } from "./model/materials.js";
22
+ import { PITCH as Ko, flights as Zo, flightsAt as zo, isVertical as Ho, passesThrough as Uo, pitchOf as ko, primaryShafts as Jo, reaches as Wo, runFor as Xo, servedFloors as qo, shaftKey as Qo, shaftVoids as Yo, span as $o } from "./model/vertical.js";
23
+ import { buildRoomNavigation as or } from "./model/roomNavigation.js";
24
+ import { StructureView as tr } from "./components/StructureView.js";
25
+ import { NavigationGraph as nr, NavigationPanel as sr, ReadOnlyInspector as ir } from "./viewer/panels.js";
26
+ export {
27
+ po as COORD_LIMIT,
28
+ Oe as DEFAULT_FOV,
29
+ Te as DEFAULT_RANGE,
30
+ Po as DOOR_COST,
31
+ yo as ELEVATOR_BASE,
32
+ So as ELEVATOR_PER_METRE,
33
+ Co as EXTERIOR_PRESETS,
34
+ r as FloorViewer,
35
+ ho as HERE,
36
+ c as IndexedAssetRepository,
37
+ l as IndexedProjectRepository,
38
+ g as KerrosThemeProvider,
39
+ f as LocalProjectRepository,
40
+ _e as MIN_SEGMENT,
41
+ Oo as NAV_WELD,
42
+ nr as NavigationGraph,
43
+ sr as NavigationPanel,
44
+ $ as OBJECT_KINDS,
45
+ je as OPENING_MIN_SEGMENT,
46
+ Ko as PITCH,
47
+ ir as ReadOnlyInspector,
48
+ To as STAIR_CLIMB_FACTOR,
49
+ tr as StructureView,
50
+ Le as addBarrier,
51
+ de as addBoundaryHole,
52
+ Ao as addNavEdge,
53
+ No as addNavNode,
54
+ N as addPortalGroup,
55
+ ce as addVirtualBoundary,
56
+ b as addZone,
57
+ Eo as applyMutation,
58
+ xo as applyMutations,
59
+ Me as barrierEnds,
60
+ le as bindSpaceToRegion,
61
+ to as blobDataUrl,
62
+ fe as boundaryEdges,
63
+ me as boundaryRegionAt,
64
+ ge as boundaryRegions,
65
+ ue as boundaryRings,
66
+ or as buildRoomNavigation,
67
+ I as captive,
68
+ Ve as centroid,
69
+ bo as chainVertical,
70
+ De as closeRing,
71
+ Re as connectSpace,
72
+ be as copyProject,
73
+ Ae as coverageOf,
74
+ se as createObject,
75
+ W as derivedGraph,
76
+ Ee as derivedSpaceRings,
77
+ xe as disconnectSpace,
78
+ Fe as distance,
79
+ w as divideSpaces,
80
+ ve as drawVirtualBoundary,
81
+ Ge as duplicateFloor,
82
+ Io as edgeCost,
83
+ Bo as edgeLength,
84
+ q as effectivePortals,
85
+ ie as emptyProject,
86
+ v as enclosedRegion,
87
+ P as enclosedRegions,
88
+ B as entryInto,
89
+ ao as exportProject,
90
+ _o as findRoute,
91
+ Zo as flights,
92
+ zo as flightsAt,
93
+ jo as floorPhrase,
94
+ Pe as followsBoundaries,
95
+ Ce as footprint,
96
+ co as freezeProject,
97
+ we as geoOrigin,
98
+ no as importProject,
99
+ y as inSpace,
100
+ K as inferOpenBoundaries,
101
+ Z as inferPortals,
102
+ ee as isArea,
103
+ oe as isDevice,
104
+ re as isOpening,
105
+ te as isSpace,
106
+ Ho as isVertical,
107
+ z as mergeSpaces,
108
+ Ke as moveOrigin,
109
+ Lo as navEdges,
110
+ Mo as navNodes,
111
+ Vo as navPath,
112
+ _ as nestZone,
113
+ a as neutralBasemap,
114
+ ye as normalizeBoundaries,
115
+ Ze as objectArea,
116
+ ze as objectPosition,
117
+ He as objectRotation,
118
+ Ue as openRing,
119
+ Ie as openingFloorId,
120
+ so as parseExport,
121
+ Uo as passesThrough,
122
+ j as perimeter,
123
+ ko as pitchOf,
124
+ ke as pointInRing,
125
+ Jo as primaryShafts,
126
+ L as pruneOntology,
127
+ Wo as reaches,
128
+ Je as rectangle,
129
+ S as refitEnclosedRooms,
130
+ Se as refreshBoundarySpaces,
131
+ H as refreshPortals,
132
+ We as removeFloor,
133
+ M as removePortalGroup,
134
+ V as removeZone,
135
+ Xe as ringArea,
136
+ qe as rotate,
137
+ Do as routeAnchors,
138
+ Fo as routeSteps,
139
+ Xo as runFor,
140
+ Qe as segmentProjection,
141
+ Ye as segmentsCross,
142
+ qo as servedFloors,
143
+ D as setPortalGroupMembers,
144
+ F as setZoneMembers,
145
+ Qo as shaftKey,
146
+ Yo as shaftVoids,
147
+ Q as sharedBoundaryPortals,
148
+ $e as slopeElevation,
149
+ h as spaceAt,
150
+ O as spacePoint,
151
+ T as spaces,
152
+ U as spacesDividedBy,
153
+ k as spacesRejoinedBy,
154
+ $o as span,
155
+ s as statusLabel,
156
+ i as statusTone,
157
+ eo as toLngLat,
158
+ oo as toLocal,
159
+ lo as transact,
160
+ ae as uid,
161
+ p as unknownStatus,
162
+ u as useDarkMode,
163
+ R as useKerrosTheme,
164
+ E as useStrings,
165
+ fo as validateNavigation,
166
+ mo as validateProject,
167
+ go as validateRelationships,
168
+ uo as validateRings,
169
+ G as zoneSpaces
170
+ };
171
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,81 @@
1
+ var S = Object.defineProperty;
2
+ var y = (r, e, s) => e in r ? S(r, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : r[e] = s;
3
+ var a = (r, e, s) => y(r, typeof e != "symbol" ? e + "" : e, s);
4
+ import * as t from "three";
5
+ class C {
6
+ constructor(e) {
7
+ a(this, "steel");
8
+ a(this, "trim");
9
+ a(this, "wall");
10
+ a(this, "floor");
11
+ a(this, "dark");
12
+ a(this, "lamp", new t.MeshBasicMaterial({ color: "#fff0d5", toneMapped: !1 }));
13
+ a(this, "display", new t.MeshBasicMaterial({ color: "#f5c985", toneMapped: !1 }));
14
+ a(this, "environment");
15
+ a(this, "target");
16
+ a(this, "textures", []);
17
+ a(this, "owned", []);
18
+ const s = document.createElement("canvas");
19
+ s.width = 512, s.height = 256;
20
+ const o = s.getContext("2d"), l = o.createLinearGradient(0, 0, 0, 256);
21
+ l.addColorStop(0, "#faf1dd"), l.addColorStop(0.24, "#d6cec2"), l.addColorStop(0.55, "#aaa49d"), l.addColorStop(1, "#55585a"), o.fillStyle = l, o.fillRect(0, 0, 512, 256);
22
+ for (const n of [35, 150, 305, 440])
23
+ o.fillStyle = "#fffaf0", o.fillRect(n, 12, 28, 65), o.fillStyle = "#ddd5c6", o.fillRect(n + 10, 90, 5, 80);
24
+ const c = new t.CanvasTexture(s);
25
+ c.mapping = t.EquirectangularReflectionMapping, c.colorSpace = t.SRGBColorSpace;
26
+ const M = new t.PMREMGenerator(e);
27
+ this.target = M.fromEquirectangular(c), this.environment = this.target.texture, c.dispose(), M.dispose(), e.resetState();
28
+ const d = document.createElement("canvas");
29
+ d.width = 256, d.height = 512;
30
+ const m = d.getContext("2d"), u = m.createImageData(256, 512);
31
+ let p = 821;
32
+ const g = () => (p = Math.imul(p, 1664525) + 1013904223 | 0, (p >>> 0) / 4294967295), v = Array.from({ length: 256 }, () => g());
33
+ for (let n = 0; n < 512; n++)
34
+ for (let h = 0; h < 256; h++) {
35
+ const f = 190 + v[h] * 35 + g() * 6, w = (n * 256 + h) * 4;
36
+ u.data.set([f, f, f, 255], w);
37
+ }
38
+ m.putImageData(u, 0, 0);
39
+ const i = new t.CanvasTexture(d);
40
+ i.wrapS = i.wrapT = t.RepeatWrapping, i.repeat.set(2, 1), i.colorSpace = t.SRGBColorSpace, this.textures.push(i), this.steel = new t.MeshPhysicalMaterial({
41
+ color: "#c2c7cc",
42
+ map: i,
43
+ roughness: 0.3,
44
+ metalness: 0.92,
45
+ anisotropy: 0.65,
46
+ anisotropyRotation: Math.PI / 2,
47
+ envMap: this.environment,
48
+ envMapIntensity: 1.35
49
+ }), this.steel.userData.cabinSteel = !0, this.trim = new t.MeshStandardMaterial({
50
+ color: "#cbd0d3",
51
+ metalness: 0.95,
52
+ roughness: 0.18,
53
+ envMap: this.environment,
54
+ envMapIntensity: 1.4
55
+ }), this.wall = new t.MeshStandardMaterial({
56
+ color: "#b4a89a",
57
+ metalness: 0.05,
58
+ roughness: 0.65,
59
+ envMap: this.environment,
60
+ envMapIntensity: 1
61
+ }), this.floor = new t.MeshStandardMaterial({
62
+ color: "#6f7370",
63
+ roughness: 0.83,
64
+ envMap: this.environment,
65
+ envMapIntensity: 1.3
66
+ }), this.dark = new t.MeshStandardMaterial({
67
+ color: "#17232c",
68
+ roughness: 0.6,
69
+ envMap: this.environment,
70
+ envMapIntensity: 0.8
71
+ }), this.owned = [this.steel, this.trim, this.wall, this.floor, this.dark, this.lamp, this.display];
72
+ for (const n of this.owned) n.userData.shared = !0;
73
+ }
74
+ dispose() {
75
+ this.owned.forEach((e) => e.dispose()), this.textures.forEach((e) => e.dispose()), this.target.dispose();
76
+ }
77
+ }
78
+ export {
79
+ C as CabinMaterials
80
+ };
81
+ //# sourceMappingURL=CabinMaterials.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CabinMaterials.js","sources":["../../../../src/map/CabinMaterials.ts"],"sourcesContent":["import * as THREE from 'three';\n\n/** Private cabin finishes: their lighting environment is the ceiling diffuser, even in a dark\n * basement. Metals reflect this environment; the cabin walls do not glow like the old grey box. */\nexport class CabinMaterials {\n readonly steel: THREE.MeshPhysicalMaterial;\n readonly trim: THREE.MeshStandardMaterial;\n readonly wall: THREE.MeshStandardMaterial;\n readonly floor: THREE.MeshStandardMaterial;\n readonly dark: THREE.MeshStandardMaterial;\n readonly lamp = new THREE.MeshBasicMaterial({ color: '#fff0d5', toneMapped: false });\n readonly display = new THREE.MeshBasicMaterial({ color: '#f5c985', toneMapped: false });\n readonly environment: THREE.Texture;\n private target: THREE.WebGLRenderTarget;\n private textures: THREE.Texture[] = [];\n private owned: THREE.Material[] = [];\n constructor(renderer: THREE.WebGLRenderer) {\n const canvas = document.createElement('canvas');\n canvas.width = 512;\n canvas.height = 256;\n const ctx = canvas.getContext('2d')!;\n const gradient = ctx.createLinearGradient(0, 0, 0, 256);\n gradient.addColorStop(0, '#faf1dd');\n gradient.addColorStop(0.24, '#d6cec2');\n gradient.addColorStop(0.55, '#aaa49d');\n gradient.addColorStop(1, '#55585a');\n ctx.fillStyle = gradient;\n ctx.fillRect(0, 0, 512, 256);\n for (const x of [35, 150, 305, 440]) {\n ctx.fillStyle = '#fffaf0';\n ctx.fillRect(x, 12, 28, 65);\n ctx.fillStyle = '#ddd5c6';\n ctx.fillRect(x + 10, 90, 5, 80);\n }\n const environment = new THREE.CanvasTexture(canvas);\n environment.mapping = THREE.EquirectangularReflectionMapping;\n environment.colorSpace = THREE.SRGBColorSpace;\n const generator = new THREE.PMREMGenerator(renderer);\n this.target = generator.fromEquirectangular(environment);\n this.environment = this.target.texture;\n environment.dispose();\n generator.dispose();\n renderer.resetState();\n const grain = document.createElement('canvas');\n grain.width = 256;\n grain.height = 512;\n const g = grain.getContext('2d')!,\n pixels = g.createImageData(256, 512);\n let seed = 821;\n const random = () => {\n seed = (Math.imul(seed, 1664525) + 1013904223) | 0;\n return (seed >>> 0) / 0xffffffff;\n };\n const stripes = Array.from({ length: 256 }, () => random());\n for (let y = 0; y < 512; y++)\n for (let x = 0; x < 256; x++) {\n const value = 190 + stripes[x] * 35 + random() * 6;\n const i = (y * 256 + x) * 4;\n pixels.data.set([value, value, value, 255], i);\n }\n g.putImageData(pixels, 0, 0);\n const brushed = new THREE.CanvasTexture(grain);\n brushed.wrapS = brushed.wrapT = THREE.RepeatWrapping;\n brushed.repeat.set(2, 1);\n brushed.colorSpace = THREE.SRGBColorSpace;\n this.textures.push(brushed);\n this.steel = new THREE.MeshPhysicalMaterial({\n color: '#c2c7cc',\n map: brushed,\n roughness: 0.3,\n metalness: 0.92,\n anisotropy: 0.65,\n anisotropyRotation: Math.PI / 2,\n envMap: this.environment,\n envMapIntensity: 1.35,\n });\n this.steel.userData.cabinSteel = true;\n this.trim = new THREE.MeshStandardMaterial({\n color: '#cbd0d3',\n metalness: 0.95,\n roughness: 0.18,\n envMap: this.environment,\n envMapIntensity: 1.4,\n });\n this.wall = new THREE.MeshStandardMaterial({\n color: '#b4a89a',\n metalness: 0.05,\n roughness: 0.65,\n envMap: this.environment,\n envMapIntensity: 1.0,\n });\n this.floor = new THREE.MeshStandardMaterial({\n color: '#6f7370',\n roughness: 0.83,\n envMap: this.environment,\n envMapIntensity: 1.3,\n });\n this.dark = new THREE.MeshStandardMaterial({\n color: '#17232c',\n roughness: 0.6,\n envMap: this.environment,\n envMapIntensity: 0.8,\n });\n this.owned = [this.steel, this.trim, this.wall, this.floor, this.dark, this.lamp, this.display];\n for (const m of this.owned) m.userData.shared = true;\n }\n dispose() {\n this.owned.forEach(m => m.dispose());\n this.textures.forEach(t => t.dispose());\n this.target.dispose();\n }\n}\n"],"names":["CabinMaterials","renderer","__publicField","THREE","canvas","ctx","gradient","x","environment","generator","grain","g","pixels","seed","random","stripes","y","value","i","brushed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AAAA,MACX,QAAQ,KAAK;AAAA,MACb,iBAAiB;AAAA,IAAA,CAClB,GACD,KAAK,OAAO,IAAIA,EAAM,qBAAqB;AAAA,MACzC,OAAO;AAAA,MACP,WAAW;AAAA,MACX,WAAW;AAAA,MACX,QAAQ,KAAK;AAAA,MACb,iBAAiB;AAAA,IAAA,CAClB,GACD,KAAK,QAAQ,IAAIA,EAAM,qBAAqB;AAAA,MAC1C,OAAO;AAAA,MACP,WAAW;AAAA,MACX,QAAQ,KAAK;AAAA,MACb,iBAAiB;AAAA,IAAA,CAClB,GACD,KAAK,OAAO,IAAIA,EAAM,qBAAqB;AAAA,MACzC,OAAO;AAAA,MACP,WAAW;AAAA,MACX,QAAQ,KAAK;AAAA,MACb,iBAAiB;AAAA,IAAA,CAClB,GACD,KAAK,QAAQ,CAAC,KAAK,OAAO,KAAK,MAAM,KAAK,MAAM,KAAK,OAAO,KAAK,MAAM,KAAK,MAAM,KAAK,OAAO;AAC9F,eAAWiB,KAAK,KAAK,MAAO,CAAAA,EAAE,SAAS,SAAS;AAAA,EAClD;AAAA,EACA,UAAU;AACR,SAAK,MAAM,QAAQ,CAAAA,MAAKA,EAAE,SAAS,GACnC,KAAK,SAAS,QAAQ,CAAAC,MAAKA,EAAE,SAAS,GACtC,KAAK,OAAO,QAAA;AAAA,EACd;AACF;"}
@@ -0,0 +1,43 @@
1
+ var y = Object.defineProperty;
2
+ var f = (i, e, r) => e in i ? y(i, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : i[e] = r;
3
+ var l = (i, e, r) => f(i, typeof e != "symbol" ? e + "" : e, r);
4
+ import * as t from "three";
5
+ import { Reflector as h } from "three/addons/objects/Reflector.js";
6
+ const w = 29;
7
+ function d(i, e) {
8
+ const r = i.projectionMatrixInverse.clone().premultiply(i.matrixWorld), a = new t.Vector3(0, 0, 0).applyMatrix4(r), s = new t.Vector3(0, 0.5, 0).applyMatrix4(r);
9
+ e.position.copy(i.position), e.up.copy(s).sub(a).normalize(), e.lookAt(a), e.updateMatrixWorld(!0), e.projectionMatrix.copy(i.projectionMatrix).multiply(i.matrixWorldInverse).multiply(e.matrixWorld);
10
+ const o = -1 / e.projectionMatrix.elements[11];
11
+ e.projectionMatrix.multiplyScalar(o), e.projectionMatrixInverse.copy(e.projectionMatrix).invert(), e.layers.mask = i.layers.mask, e.layers.enable(w), e.far = 1e4;
12
+ }
13
+ class j extends h {
14
+ constructor(r, a) {
15
+ super(new t.PlaneGeometry(r, a), {
16
+ textureWidth: 768,
17
+ textureHeight: 768,
18
+ multisample: 0,
19
+ color: "#c7d1d4",
20
+ clipBias: 2e-3
21
+ });
22
+ l(this, "view", new t.PerspectiveCamera());
23
+ l(this, "frames", 0);
24
+ this.name = "Cabin mirror", this.userData.cabinMirror = !0;
25
+ const s = this.onBeforeRender;
26
+ this.onBeforeRender = (o, c, n, p, m, x) => {
27
+ if (n.userData.cabinReflection || new t.Vector3().setFromMatrixPosition(this.matrixWorld).distanceToSquared(n.position) > 100) return;
28
+ d(n, this.view), this.camera.userData.cabinReflection = !0, this.camera.layers.mask = this.view.layers.mask;
29
+ const u = o.getViewport(new t.Vector4());
30
+ try {
31
+ s.call(this, o, c, this.view, p, m, x), this.userData.reflectionFrames = ++this.frames;
32
+ } finally {
33
+ o.setViewport(u);
34
+ }
35
+ };
36
+ }
37
+ }
38
+ export {
39
+ j as CabinMirror,
40
+ w as REFLECTION_BODY,
41
+ d as mirrorViewCamera
42
+ };
43
+ //# sourceMappingURL=CabinMirror.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CabinMirror.js","sources":["../../../../src/map/CabinMirror.ts"],"sourcesContent":["import * as THREE from 'three';\nimport { Reflector } from 'three/addons/objects/Reflector.js';\n\n/** The head is visible in the mirror, but never surrounds the first-person camera. */\nexport const REFLECTION_BODY = 29;\n\n/** MapLibre's camera encodes rotation in its projection matrix. Give the mirror a conventional\n * view frame while preserving the exact world-to-clip mapping, including the chosen POV lens. */\nexport function mirrorViewCamera(source: THREE.Camera, target: THREE.PerspectiveCamera) {\n const inverse = source.projectionMatrixInverse.clone().premultiply(source.matrixWorld);\n const ahead = new THREE.Vector3(0, 0, 0).applyMatrix4(inverse);\n const above = new THREE.Vector3(0, 0.5, 0).applyMatrix4(inverse);\n target.position.copy(source.position);\n target.up.copy(above).sub(ahead).normalize();\n target.lookAt(ahead);\n target.updateMatrixWorld(true);\n target.projectionMatrix\n .copy(source.projectionMatrix)\n .multiply(source.matrixWorldInverse)\n .multiply(target.matrixWorld);\n // The map's homogeneous matrix carries its metre-to-Mercator scale. Reflector's oblique\n // near-plane formula requires the conventional perspective row with P[3,2] = -1.\n const scale = -1 / target.projectionMatrix.elements[11];\n target.projectionMatrix.multiplyScalar(scale);\n target.projectionMatrixInverse.copy(target.projectionMatrix).invert();\n target.layers.mask = source.layers.mask;\n target.layers.enable(REFLECTION_BODY);\n target.far = 10000;\n}\n\n/** One live planar reflection, rendered only near a visible cabin. No recursive mirror passes. */\nexport class CabinMirror extends Reflector {\n private view = new THREE.PerspectiveCamera();\n private frames = 0;\n constructor(width: number, height: number) {\n super(new THREE.PlaneGeometry(width, height), {\n textureWidth: 768,\n textureHeight: 768,\n multisample: 0,\n color: '#c7d1d4',\n clipBias: 0.002,\n });\n this.name = 'Cabin mirror';\n this.userData.cabinMirror = true;\n const reflect = this.onBeforeRender;\n this.onBeforeRender = (renderer, scene, camera, geometry, material, group) => {\n if (camera.userData.cabinReflection) return;\n const at = new THREE.Vector3().setFromMatrixPosition(this.matrixWorld);\n if (at.distanceToSquared(camera.position) > 100) return;\n mirrorViewCamera(camera, this.view);\n this.camera.userData.cabinReflection = true;\n this.camera.layers.mask = this.view.layers.mask;\n const viewport = renderer.getViewport(new THREE.Vector4());\n try {\n reflect.call(this, renderer, scene, this.view, geometry, material, group);\n this.userData.reflectionFrames = ++this.frames;\n } finally {\n renderer.setViewport(viewport);\n }\n };\n }\n}\n"],"names":["REFLECTION_BODY","mirrorViewCamera","source","target","inverse","ahead","THREE","above","scale","CabinMirror","Reflector","width","height","__publicField","reflect","renderer","scene","camera","geometry","material","group","viewport"],"mappings":";;;;;AAIO,MAAMA,IAAkB;AAIxB,SAASC,EAAiBC,GAAsBC,GAAiC;AACtF,QAAMC,IAAUF,EAAO,wBAAwB,QAAQ,YAAYA,EAAO,WAAW,GAC/EG,IAAQ,IAAIC,EAAM,QAAQ,GAAG,GAAG,CAAC,EAAE,aAAaF,CAAO,GACvDG,IAAQ,IAAID,EAAM,QAAQ,GAAG,KAAK,CAAC,EAAE,aAAaF,CAAO;AAC/D,EAAAD,EAAO,SAAS,KAAKD,EAAO,QAAQ,GACpCC,EAAO,GAAG,KAAKI,CAAK,EAAE,IAAIF,CAAK,EAAE,UAAA,GACjCF,EAAO,OAAOE,CAAK,GACnBF,EAAO,kBAAkB,EAAI,GAC7BA,EAAO,iBACJ,KAAKD,EAAO,gBAAgB,EAC5B,SAASA,EAAO,kBAAkB,EAClC,SAASC,EAAO,WAAW;AAG9B,QAAMK,IAAQ,KAAKL,EAAO,iBAAiB,SAAS,EAAE;AACtD,EAAAA,EAAO,iBAAiB,eAAeK,CAAK,GAC5CL,EAAO,wBAAwB,KAAKA,EAAO,gBAAgB,EAAE,OAAA,GAC7DA,EAAO,OAAO,OAAOD,EAAO,OAAO,MACnCC,EAAO,OAAO,OAAOH,CAAe,GACpCG,EAAO,MAAM;AACf;AAGO,MAAMM,UAAoBC,EAAU;AAAA,EAGzC,YAAYC,GAAeC,GAAgB;AACzC,UAAM,IAAIN,EAAM,cAAcK,GAAOC,CAAM,GAAG;AAAA,MAC5C,cAAc;AAAA,MACd,eAAe;AAAA,MACf,aAAa;AAAA,MACb,OAAO;AAAA,MACP,UAAU;AAAA,IAAA,CACX;AATK,IAAAC,EAAA,cAAO,IAAIP,EAAM,kBAAA;AACjB,IAAAO,EAAA,gBAAS;AASf,SAAK,OAAO,gBACZ,KAAK,SAAS,cAAc;AAC5B,UAAMC,IAAU,KAAK;AACrB,SAAK,iBAAiB,CAACC,GAAUC,GA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