@mountaya/studio 0.1.0 → 0.2.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 (260) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/dist/agent/index.cjs +2561 -2815
  3. package/dist/agent/index.cjs.map +1 -1
  4. package/dist/agent/index.d.cts +766 -786
  5. package/dist/agent/index.d.ts +766 -786
  6. package/dist/agent/index.js +2553 -2790
  7. package/dist/agent/index.js.map +1 -1
  8. package/dist/chunk-3Oi_Zrtm.js +9 -0
  9. package/dist/chunk-3Oi_Zrtm.js.map +1 -0
  10. package/dist/chunk-B18OPIu_.js +6 -0
  11. package/dist/chunk-B18OPIu_.js.map +1 -0
  12. package/dist/chunk-B5Uz3Qct.cjs +15 -0
  13. package/dist/chunk-B5Uz3Qct.cjs.map +1 -0
  14. package/dist/chunk-BBEJwkd3.d.cts +839 -0
  15. package/dist/chunk-BIEc_SkR.cjs +29 -0
  16. package/dist/chunk-BIEc_SkR.cjs.map +1 -0
  17. package/dist/chunk-BKMFOe-N.js +171 -0
  18. package/dist/chunk-BKMFOe-N.js.map +1 -0
  19. package/dist/chunk-BP4uy7E1.d.ts +11583 -0
  20. package/dist/chunk-BSHTsFiB.js +1403 -0
  21. package/dist/chunk-BSHTsFiB.js.map +1 -0
  22. package/dist/chunk-BTUUABGI.js +17 -0
  23. package/dist/chunk-BTUUABGI.js.map +1 -0
  24. package/dist/chunk-BaPiaz5X.cjs +115 -0
  25. package/dist/chunk-BaPiaz5X.cjs.map +1 -0
  26. package/dist/chunk-BeCVpkYr.cjs +542 -0
  27. package/dist/chunk-BeCVpkYr.cjs.map +1 -0
  28. package/dist/chunk-BgngsvK8.cjs +6202 -0
  29. package/dist/chunk-BgngsvK8.cjs.map +1 -0
  30. package/dist/chunk-BhInd7CJ.d.cts +253 -0
  31. package/dist/chunk-Bn6ZbxkS.cjs +27 -0
  32. package/dist/chunk-By9ZnkVI.js +60 -0
  33. package/dist/chunk-By9ZnkVI.js.map +1 -0
  34. package/dist/chunk-BzqPhxsz.cjs +367 -0
  35. package/dist/chunk-BzqPhxsz.cjs.map +1 -0
  36. package/dist/chunk-C2mMX81q.d.ts +443 -0
  37. package/dist/chunk-C2rr9Q0V.cjs +1402 -0
  38. package/dist/chunk-C2rr9Q0V.cjs.map +1 -0
  39. package/dist/{directorThreads-CqmvsV8b.d.cts → chunk-CDJCbwIQ.d.cts} +20 -22
  40. package/dist/chunk-CLGvBOVH.d.cts +1654 -0
  41. package/dist/chunk-COdw1dc6.d.ts +525 -0
  42. package/dist/chunk-CQCJnT2i.d.ts +511 -0
  43. package/dist/chunk-CSyHY67q.cjs +353 -0
  44. package/dist/chunk-CSyHY67q.cjs.map +1 -0
  45. package/dist/chunk-CiK1Iqrv.js +950 -0
  46. package/dist/chunk-CiK1Iqrv.js.map +1 -0
  47. package/dist/chunk-CmJBgSwZ.cjs +24 -0
  48. package/dist/chunk-CmJBgSwZ.cjs.map +1 -0
  49. package/dist/chunk-CnrsRK2u.cjs +83 -0
  50. package/dist/chunk-CnrsRK2u.cjs.map +1 -0
  51. package/dist/chunk-Co782_9r.js +326 -0
  52. package/dist/chunk-Co782_9r.js.map +1 -0
  53. package/dist/chunk-Csr3KDpZ.cjs +32 -0
  54. package/dist/chunk-Csr3KDpZ.cjs.map +1 -0
  55. package/dist/chunk-CwkmccXv.js +89 -0
  56. package/dist/chunk-CwkmccXv.js.map +1 -0
  57. package/dist/chunk-D0Q4iL9B.cjs +255 -0
  58. package/dist/chunk-D0Q4iL9B.cjs.map +1 -0
  59. package/dist/chunk-DFwiSzUS.cjs +72 -0
  60. package/dist/chunk-DFwiSzUS.cjs.map +1 -0
  61. package/dist/chunk-DIFayl2P.d.cts +443 -0
  62. package/dist/chunk-DIGF58ux.d.cts +525 -0
  63. package/dist/chunk-DKuuuld5.js +101 -0
  64. package/dist/chunk-DKuuuld5.js.map +1 -0
  65. package/dist/chunk-DMePkFEo.js +5054 -0
  66. package/dist/chunk-DMePkFEo.js.map +1 -0
  67. package/dist/chunk-DO5SIBgu.js +305 -0
  68. package/dist/chunk-DO5SIBgu.js.map +1 -0
  69. package/dist/chunk-DOQ_7eE5.d.ts +6662 -0
  70. package/dist/{tabs-B2nRO4p_.d.ts → chunk-DThaaNeb.d.cts} +2 -2
  71. package/dist/{tabs-B2nRO4p_.d.cts → chunk-DThaaNeb.d.ts} +2 -2
  72. package/dist/{directorThreads-CqmvsV8b.d.ts → chunk-DUQzjUJy.d.ts} +20 -22
  73. package/dist/chunk-DX37IPhV.cjs +1903 -0
  74. package/dist/chunk-DX37IPhV.cjs.map +1 -0
  75. package/dist/chunk-Damps5Tk.cjs +155 -0
  76. package/dist/chunk-Damps5Tk.cjs.map +1 -0
  77. package/dist/chunk-DbK5PhpJ.d.ts +1654 -0
  78. package/dist/chunk-De0vAASv.d.ts +253 -0
  79. package/dist/chunk-DhSZ7YZt.d.cts +6662 -0
  80. package/dist/chunk-DjEvqvPA.cjs +43 -0
  81. package/dist/chunk-DjEvqvPA.cjs.map +1 -0
  82. package/dist/{saveFile-j-1kkApx.d.cts → chunk-DkwDzwvu.d.cts} +7 -9
  83. package/dist/{saveFile-j-1kkApx.d.ts → chunk-DkwDzwvu.d.ts} +7 -9
  84. package/dist/chunk-Dmszv9If.js +71 -0
  85. package/dist/chunk-Dmszv9If.js.map +1 -0
  86. package/dist/chunk-Dp_ftNWY.d.cts +511 -0
  87. package/dist/chunk-DsHQySz0.js +31 -0
  88. package/dist/chunk-DsHQySz0.js.map +1 -0
  89. package/dist/chunk-DwoUyHHh.js +281 -0
  90. package/dist/chunk-DwoUyHHh.js.map +1 -0
  91. package/dist/chunk-IaIDQflj.d.cts +2315 -0
  92. package/dist/chunk-IaIDQflj.d.ts +2315 -0
  93. package/dist/chunk-cVXLsZfL.d.ts +839 -0
  94. package/dist/chunk-mIaCX9EJ.d.cts +11583 -0
  95. package/dist/chunk-nJQxbOwQ.cjs +8962 -0
  96. package/dist/chunk-nJQxbOwQ.cjs.map +1 -0
  97. package/dist/chunk-o9jaxhCO.js +8852 -0
  98. package/dist/chunk-o9jaxhCO.js.map +1 -0
  99. package/dist/chunk-p-Tt_Lwz.js +14 -0
  100. package/dist/chunk-p-Tt_Lwz.js.map +1 -0
  101. package/dist/engines/index.cjs +2046 -3401
  102. package/dist/engines/index.cjs.map +1 -1
  103. package/dist/engines/index.d.cts +1510 -1550
  104. package/dist/engines/index.d.ts +1510 -1550
  105. package/dist/engines/index.js +2039 -3380
  106. package/dist/engines/index.js.map +1 -1
  107. package/dist/handlers/index.cjs +47 -93
  108. package/dist/handlers/index.cjs.map +1 -1
  109. package/dist/handlers/index.d.cts +61 -103
  110. package/dist/handlers/index.d.ts +61 -103
  111. package/dist/handlers/index.js +27 -36
  112. package/dist/handlers/index.js.map +1 -1
  113. package/dist/index.cjs +3347 -4398
  114. package/dist/index.cjs.map +1 -1
  115. package/dist/index.d.cts +8 -7297
  116. package/dist/index.d.ts +8 -7297
  117. package/dist/index.js +2997 -3187
  118. package/dist/index.js.map +1 -1
  119. package/dist/plugins/index.cjs +482 -949
  120. package/dist/plugins/index.cjs.map +1 -1
  121. package/dist/plugins/index.d.cts +44 -61
  122. package/dist/plugins/index.d.ts +44 -61
  123. package/dist/plugins/index.js +471 -915
  124. package/dist/plugins/index.js.map +1 -1
  125. package/dist/seams/index.cjs +77 -140
  126. package/dist/seams/index.cjs.map +1 -1
  127. package/dist/seams/index.d.cts +125 -158
  128. package/dist/seams/index.d.ts +125 -158
  129. package/dist/seams/index.js +41 -71
  130. package/dist/seams/index.js.map +1 -1
  131. package/dist/strings/fr/index.cjs +2130 -2116
  132. package/dist/strings/fr/index.cjs.map +1 -1
  133. package/dist/strings/fr/index.d.cts +3 -5
  134. package/dist/strings/fr/index.d.ts +3 -5
  135. package/dist/strings/fr/index.js +2125 -2114
  136. package/dist/strings/fr/index.js.map +1 -1
  137. package/dist/strings/index.cjs +2331 -2625
  138. package/dist/strings/index.cjs.map +1 -1
  139. package/dist/strings/index.d.cts +3 -731
  140. package/dist/strings/index.d.ts +3 -731
  141. package/dist/strings/index.js +2324 -2615
  142. package/dist/strings/index.js.map +1 -1
  143. package/dist/testing/index.cjs +214 -276
  144. package/dist/testing/index.cjs.map +1 -1
  145. package/dist/testing/index.d.cts +61 -121
  146. package/dist/testing/index.d.ts +61 -121
  147. package/dist/testing/index.js +208 -273
  148. package/dist/testing/index.js.map +1 -1
  149. package/dist/time/index.cjs +23 -23
  150. package/dist/time/index.cjs.map +1 -1
  151. package/dist/time/index.d.cts +5 -7
  152. package/dist/time/index.d.ts +5 -7
  153. package/dist/time/index.js +18 -21
  154. package/dist/time/index.js.map +1 -1
  155. package/package.json +14 -15
  156. package/src/agent/rules/stateDelta.ts +1 -0
  157. package/src/agent/stores/agentThreads.ts +1 -4
  158. package/src/bus/rules/bus.ts +1 -2
  159. package/src/bus/rules/defineRegistry.ts +3 -5
  160. package/src/bus/rules/types.ts +6 -7
  161. package/src/chrome/stores/uiStore.ts +4 -2
  162. package/src/embed/rules/fieldDependencies.ts +2 -0
  163. package/src/embed/rules/safetyRules.ts +2 -0
  164. package/src/embed/rules/tableCode.ts +4 -3
  165. package/src/index.ts +6 -27
  166. package/src/itinerary/rules/import.ts +6 -8
  167. package/src/plugins/contracts/plugin.ts +4 -2
  168. package/src/seams/rules/formatters.ts +5 -3
  169. package/src/testing/index.ts +1 -5
  170. package/src/viewer/rules/platformViewer.ts +1 -0
  171. package/dist/bus-BwiNiXdH.d.ts +0 -514
  172. package/dist/bus-DzmhPwdK.d.cts +0 -514
  173. package/dist/chainModel-B23pEP_1.d.cts +0 -127
  174. package/dist/chainModel-B23pEP_1.d.ts +0 -127
  175. package/dist/chunk-2HFY7ETU.js +0 -5721
  176. package/dist/chunk-2HFY7ETU.js.map +0 -1
  177. package/dist/chunk-355TOXSB.js +0 -72
  178. package/dist/chunk-355TOXSB.js.map +0 -1
  179. package/dist/chunk-4ZCUZVSV.js +0 -10275
  180. package/dist/chunk-4ZCUZVSV.js.map +0 -1
  181. package/dist/chunk-6HEKY3NF.js +0 -95
  182. package/dist/chunk-6HEKY3NF.js.map +0 -1
  183. package/dist/chunk-7GFLGGBX.cjs +0 -8
  184. package/dist/chunk-7GFLGGBX.cjs.map +0 -1
  185. package/dist/chunk-7NBRCENN.cjs +0 -19
  186. package/dist/chunk-7NBRCENN.cjs.map +0 -1
  187. package/dist/chunk-AF5GCXE3.js +0 -8
  188. package/dist/chunk-AF5GCXE3.js.map +0 -1
  189. package/dist/chunk-CJDIFRGZ.cjs +0 -2005
  190. package/dist/chunk-CJDIFRGZ.cjs.map +0 -1
  191. package/dist/chunk-CNPZY7N3.js +0 -349
  192. package/dist/chunk-CNPZY7N3.js.map +0 -1
  193. package/dist/chunk-DZJHTWSF.cjs +0 -45
  194. package/dist/chunk-DZJHTWSF.cjs.map +0 -1
  195. package/dist/chunk-EABIHHWA.js +0 -42
  196. package/dist/chunk-EABIHHWA.js.map +0 -1
  197. package/dist/chunk-EKZWV6RS.cjs +0 -415
  198. package/dist/chunk-EKZWV6RS.cjs.map +0 -1
  199. package/dist/chunk-EOKRXXAC.cjs +0 -24
  200. package/dist/chunk-EOKRXXAC.cjs.map +0 -1
  201. package/dist/chunk-F73W2ZTJ.js +0 -1126
  202. package/dist/chunk-F73W2ZTJ.js.map +0 -1
  203. package/dist/chunk-H4DVOZ5O.js +0 -1897
  204. package/dist/chunk-H4DVOZ5O.js.map +0 -1
  205. package/dist/chunk-HI52PBFT.cjs +0 -10314
  206. package/dist/chunk-HI52PBFT.cjs.map +0 -1
  207. package/dist/chunk-IDBXFBLG.cjs +0 -1225
  208. package/dist/chunk-IDBXFBLG.cjs.map +0 -1
  209. package/dist/chunk-LBWTJZUJ.js +0 -297
  210. package/dist/chunk-LBWTJZUJ.js.map +0 -1
  211. package/dist/chunk-NCLA6DKD.cjs +0 -310
  212. package/dist/chunk-NCLA6DKD.cjs.map +0 -1
  213. package/dist/chunk-O4MC5DPD.js +0 -19
  214. package/dist/chunk-O4MC5DPD.js.map +0 -1
  215. package/dist/chunk-OP37FKW6.cjs +0 -98
  216. package/dist/chunk-OP37FKW6.cjs.map +0 -1
  217. package/dist/chunk-OQSYFH3Z.cjs +0 -5945
  218. package/dist/chunk-OQSYFH3Z.cjs.map +0 -1
  219. package/dist/chunk-PACIO4NS.cjs +0 -26
  220. package/dist/chunk-PACIO4NS.cjs.map +0 -1
  221. package/dist/chunk-PSZ2R3TC.cjs +0 -75
  222. package/dist/chunk-PSZ2R3TC.cjs.map +0 -1
  223. package/dist/chunk-QFO5CZG2.cjs +0 -136
  224. package/dist/chunk-QFO5CZG2.cjs.map +0 -1
  225. package/dist/chunk-QL63MUEW.cjs +0 -140
  226. package/dist/chunk-QL63MUEW.cjs.map +0 -1
  227. package/dist/chunk-RFUPPVZO.js +0 -17
  228. package/dist/chunk-RFUPPVZO.js.map +0 -1
  229. package/dist/chunk-RPG2LWMP.js +0 -23
  230. package/dist/chunk-RPG2LWMP.js.map +0 -1
  231. package/dist/chunk-TIBXK6B7.cjs +0 -12
  232. package/dist/chunk-TIBXK6B7.cjs.map +0 -1
  233. package/dist/chunk-UU65VNEV.js +0 -381
  234. package/dist/chunk-UU65VNEV.js.map +0 -1
  235. package/dist/chunk-VGX6TR2I.js +0 -209
  236. package/dist/chunk-VGX6TR2I.js.map +0 -1
  237. package/dist/chunk-WUTDDBVP.js +0 -130
  238. package/dist/chunk-WUTDDBVP.js.map +0 -1
  239. package/dist/chunk-WVQQLKCI.cjs +0 -224
  240. package/dist/chunk-WVQQLKCI.cjs.map +0 -1
  241. package/dist/chunk-WZYXG3SE.js +0 -111
  242. package/dist/chunk-WZYXG3SE.js.map +0 -1
  243. package/dist/chunk-XDI2X3KE.js +0 -6
  244. package/dist/chunk-XDI2X3KE.js.map +0 -1
  245. package/dist/chunk-XKHLRIC7.cjs +0 -381
  246. package/dist/chunk-XKHLRIC7.cjs.map +0 -1
  247. package/dist/context-DNtd2WUv.d.cts +0 -11666
  248. package/dist/context-DgB72Bur.d.ts +0 -11666
  249. package/dist/en-Bu4Ti9Ev.d.cts +0 -2315
  250. package/dist/en-Bu4Ti9Ev.d.ts +0 -2315
  251. package/dist/shareLink-B6hlt942.d.ts +0 -144
  252. package/dist/shareLink-C7rIMb7x.d.ts +0 -527
  253. package/dist/shareLink-CnTxxXjp.d.cts +0 -144
  254. package/dist/shareLink-DyZVYH2V.d.cts +0 -527
  255. package/dist/studioPlugin-C3C7VjMy.d.ts +0 -847
  256. package/dist/studioPlugin-Cf3OBNUv.d.cts +0 -847
  257. package/dist/types-BzJRV6UI.d.cts +0 -845
  258. package/dist/types-BzJRV6UI.d.ts +0 -845
  259. package/dist/zoneForm-CdYNtnnA.d.cts +0 -320
  260. package/dist/zoneForm-mG85yt5e.d.ts +0 -320
@@ -1,201 +1,193 @@
1
- import { ItineraryWithDetails, ItinerarySegment, SegmentEditMode } from '@mountaya/elements/data';
2
- import { BoundingBox, MapClient, FitBoundsPadding } from '@mountaya/elements/map-client';
3
- import { EmbedProfileSections, ElevationPoint } from '@mountaya/elements/profile';
4
- import { EmbedCanvasSize, EmbedZoomRange, ZoneFormFields } from '../index.cjs';
5
- import { Clock } from '@mountaya/elements/seams';
6
- import { ReadyMessage, ItinerarySurface, UiStoreApi, StudioToolInputs, StudioToolOutputs, ZoneCreateMethod } from '../index.cjs';
7
- import { RestSchema, ItineraryPaceSegment, Mountaya } from '@mountaya/client';
8
- import { ToolBusDispatch, ToolBusContext, CategoryActivities, ToolResultOf, ToolFailure } from '../index.cjs';
9
- import { StudioStrings } from '../strings/index.cjs';
10
- export { S as ShareLinkActionOutcome, a as ShareLinkConfig, b as ShareLinkDispatch, c as ShareLinkEngine, d as ShareLinkEngineOptions, e as ShareLinkFailure, f as ShareLinkRead, g as ShareLinkReadResult, h as ShareLinkSnapshot } from '../shareLink-DyZVYH2V.cjs';
11
- import { MapLanguage } from '@mountaya/elements/i18n';
12
- import { StudioIds } from '../seams/index.cjs';
13
- import 'zod';
14
- import '@mountaya/elements/camera';
15
- import 'geojson';
16
- import 'zustand/vanilla';
17
- import '@mountaya/elements/errors';
18
- import '../shareLink-CnTxxXjp.cjs';
19
-
1
+ import { r as ZoneFormFields, x as EmbedZoomRange, y as EmbedCanvasSize } from "../chunk-DIFayl2P.cjs";
2
+ import { $r as ReadyMessage, G as UiStoreApi, P as ItinerarySurface, dt as ZoneCreateMethod, io as StudioToolInputs, j as Clock, oo as StudioToolOutputs } from "../chunk-mIaCX9EJ.cjs";
3
+ import { Ht as ToolBusContext, Jt as ToolFailure, Ut as ToolBusDispatch, Zt as ToolResultOf, nt as CategoryActivities$1 } from "../chunk-CLGvBOVH.cjs";
4
+ import { t as StudioStrings } from "../chunk-IaIDQflj.cjs";
5
+ import { a as ShareLinkEngineOptions, c as ShareLinkReadResult, i as ShareLinkEngine, l as ShareLinkSnapshot, n as ShareLinkConfig, o as ShareLinkFailure, r as ShareLinkDispatch, s as ShareLinkRead, t as ShareLinkActionOutcome } from "../chunk-DIGF58ux.cjs";
6
+ import { a as StudioIds } from "../chunk-DkwDzwvu.cjs";
7
+ import { ItineraryPaceSegment, Mountaya, RestSchema } from "@mountaya/client";
8
+ import { BoundingBox, FitBoundsPadding, MapClient } from "@mountaya/elements/map-client";
9
+ import { ItinerarySegment as ItinerarySegment$1, ItineraryWithDetails as ItineraryWithDetails$1, SegmentEditMode } from "@mountaya/elements/data";
10
+ import { MapLanguage } from "@mountaya/elements/i18n";
11
+ import { ElevationPoint, EmbedProfileSections } from "@mountaya/elements/profile";
20
12
  /**
21
13
  * EmbedFramingCollection is a collection an embed frames: its id, and the extent of the
22
14
  * itineraries its tiles draw, as the collection's specification states it (`bbox`).
23
15
  */
24
16
  interface EmbedFramingCollection {
25
- /**
26
- * The extent, `[west, south, east, north]`: the box the collection's specification answers for
27
- * the credential and the surface its tiles are asked with.
28
- */
29
- readonly bounds: BoundingBox;
30
- /** The collection's id, which tells one collection's framing from the next one's. */
31
- readonly id: string;
17
+ /**
18
+ * The extent, `[west, south, east, north]`: the box the collection's specification answers for
19
+ * the credential and the surface its tiles are asked with.
20
+ */
21
+ readonly bounds: BoundingBox;
22
+ /** The collection's id, which tells one collection's framing from the next one's. */
23
+ readonly id: string;
32
24
  }
33
25
  /**
34
26
  * EmbedFramingConfig is what an embed's initial framing runs against, all of it replaceable
35
27
  * mid-life through {@link EmbedFramingEngine.configure}.
36
28
  */
37
29
  interface EmbedFramingConfig {
38
- /**
39
- * The size of the map's canvas, or null while it is unmeasured: the size a fit frames. It
40
- * sizes the pan lock from the view the embed opens on (see `embedConstraintsFor`). A change
41
- * while a fit is on its way frames again with it, except a change to a canvas that measures
42
- * nothing (null, or no area): there is nothing to frame on one, so the fit on its way stands,
43
- * and a canvas that comes back at the size it had asks nothing new. Another input that changes
44
- * while the canvas measures nothing is a question of its own: under no size at all it is
45
- * framed as it stands, and under a canvas with no area no fit starts for it, so the canvas that
46
- * comes back is the one framed. The fit on its way then settles nothing if it lands first: it
47
- * framed the inputs as they were. A change that can start no fit (after the settle, under a
48
- * publisher's own view, or while the next itinerary loads) moves no camera: the pan lock alone
49
- * is widened for a canvas that outgrew it, and it is never tightened for one that shrank.
50
- *
51
- * An embed that opens on a canvas with no area, a frame the page has laid out and not shown,
52
- * starts no fit and settles nothing: a renderer gives such a container a canvas of its own
53
- * default size, and a fit would frame that. The organization's zoom range applies at once, and
54
- * the itinerary is framed in the first canvas with an area. Null is another statement: a host
55
- * that measures no canvas at all is framed at once, as it stands.
56
- *
57
- * WHEN a host hands a size over decides what the renderer makes of it, and the two uses want
58
- * opposite orders. A fit frames the canvas the renderer holds, so a size that frames again is
59
- * handed over once the renderer has resized: earlier, the fit frames the canvas as it was. The
60
- * renderer enforces the lock as IT resizes, so a size that widens a lock is handed over before
61
- * the renderer has resized: later, the lock is widened under a camera the renderer has
62
- * already zoomed in. One size cannot arrive at both moments. A host that learns a size ahead
63
- * of the renderer states it as {@link EmbedFramingConfig.lockCanvasSize}, and states it here
64
- * once the renderer has resized to it.
65
- */
66
- readonly canvasSize: EmbedCanvasSize | null;
67
- /**
68
- * The map client the embed frames and locks, or null while there is no map, in which case
69
- * nothing is framed.
70
- *
71
- * Required even so, because an engine without a client is silent: a key the caller has to write
72
- * makes forgetting it a compile error rather than an embed that never frames. Compared by
73
- * identity: a replaced client is framed and locked afresh.
74
- */
75
- readonly client: MapClient | null;
76
- /**
77
- * The collection the embed frames while no itinerary is active or expected, or null when there
78
- * is none to frame: no collection is configured, its specification has not answered, or it
79
- * answered no extent (a `bbox` that is null or absent, since its tiles draw no itinerary). An
80
- * itinerary wins over it: while one is active or expected, the collection is not framed.
81
- *
82
- * It is framed as an itinerary is, through `fitCollection`, with the same padding and the same
83
- * zoom ceiling, and once: a collection that stays the one stated is not framed again after its
84
- * view settled, whatever extent a later answer states. A content switch to another collection,
85
- * or back to the same one after an itinerary, is framed in its turn. Compared by value: the id
86
- * and the four edges.
87
- *
88
- * Read only with `fitCollection` stated: a configuration that states none frames no collection.
89
- *
90
- * @default No collection: the embed frames an itinerary, or the base map alone.
91
- */
92
- readonly collection?: EmbedFramingCollection | null | undefined;
93
- /**
94
- * The id of the itinerary the embed is configured with, or null for an embed of the base map
95
- * alone. A change of it while no itinerary is active is a content switch owed one settle,
96
- * whatever `expectsItinerary` says: the base map's, on its next paint, when no itinerary is
97
- * expected, and otherwise the settle the expectation ends on, the itinerary's framing or the
98
- * base map's. So a host that already holds the failure of the itinerary it switches to, and
99
- * never expects one, still hears how the switch ended. A change made while the base map's
100
- * settle is on its way shares that settle. While an itinerary is active the switch is read off
101
- * `itinerary`, and a change here settles nothing by itself.
102
- *
103
- * The id's change and `expectsItinerary` each signal a switch, and they are one settle only
104
- * when one configure brings both. An expectation that rises in a later configure, once the
105
- * base map has started to settle for the id's change, is a wait of its own and is owed its own
106
- * settle: a host whose data layer shows the failure it holds and then fetches again hears a
107
- * report for each, the first of them possibly while the itinerary is expected. Such a host
108
- * raises `expectsItinerary` in the configure that brings the id.
109
- *
110
- * @default No id is stated: a content switch is read off `itinerary` and `expectsItinerary`
111
- * alone, so one that changes neither settles nothing.
112
- */
113
- readonly configuredItineraryId?: string | null | undefined;
114
- /**
115
- * Whether a collection will frame this embed: one is configured and its specification has not
116
- * answered yet. While it holds and nothing is framed, the settle waits for the collection as it
117
- * waits for an expected itinerary (see `expectsItinerary`), except on the cold load of a map a
118
- * publisher's own view frames. An expectation that ends with no collection to frame (the read
119
- * failed, or it answered no extent) settles the base map again, so a host hears how it ended.
120
- *
121
- * Read only with `fitCollection` stated.
122
- *
123
- * @default false
124
- */
125
- readonly expectsCollection?: boolean | undefined;
126
- /**
127
- * Whether an itinerary will frame this embed: one is configured and its detail has not failed to
128
- * load. While it holds and no itinerary is active, the settle waits for one, except on the cold
129
- * load of a map a publisher's own view frames; otherwise the view settles on the map's next
130
- * paint. An expectation that ends with no itinerary (its detail failed to load) settles the base
131
- * map again, so a host hears how the switch ended.
132
- *
133
- * A flag the host states rather than one read off the active itinerary, so the moment between
134
- * the itinerary's detail arriving and the store activating it never settles an off-route view.
135
- */
136
- readonly expectsItinerary: boolean;
137
- /**
138
- * Frames the whole active itinerary with `padding`, at once rather than animated, so the first
139
- * painted frame is already the route. It goes through the bus in a studio
140
- * (`studio.map.fitBoundsToSegment` with a null segment), the one camera mutation surface, and
141
- * resolves once the camera has moved. Read when a framing starts.
142
- */
143
- readonly fit: (padding: FitBoundsPadding) => Promise<void>;
144
- /**
145
- * Frames `bounds`, the collection's extent, with `padding` and no closer than `maxZoom`, at once
146
- * rather than animated: the collection's twin of `fit`, under the zoom ceiling an itinerary's
147
- * fit holds. It goes through the bus in a studio (`studio.map.fitBounds` with `animate: false`),
148
- * and resolves once the camera has moved. Read when a framing of the collection starts.
149
- *
150
- * @default No collection is framed: `collection` and `expectsCollection` are read as absent.
151
- */
152
- readonly fitCollection?: ((bounds: BoundingBox, padding: FitBoundsPadding, maxZoom: number) => Promise<void>) | undefined;
153
- /** The itinerary the store has active, or null while none is. */
154
- readonly itinerary: ItineraryWithDetails | null;
155
- /**
156
- * The size the page has laid the canvas out at, or null while it is unmeasured, for a host
157
- * that learns it before the renderer has resized to it. The pan lock is widened from it and no
158
- * fit ever frames it: the lock covers the wider and the taller of this size and `canvasSize`,
159
- * so the renderer resizes inside a lock already sized for the canvas it grows to.
160
- *
161
- * While it measures a canvas `canvasSize` does not state, a resize is under way: the renderer
162
- * has yet to resize, and `canvasSize` has yet to follow. A fit asked for then would frame the
163
- * canvas as it was, so none starts, and one already on its way settles nothing when it
164
- * paints. The framing runs once the two sizes agree, on the canvas the renderer holds by then,
165
- * so the view settles on the fit of the last canvas. A host that states this size therefore
166
- * states the same one as `canvasSize` once the renderer has resized, or a fitted itinerary
167
- * never settles: the organization's zoom range and the lock of the last framing are all that
168
- * stand on the map meanwhile. Under a publisher's own view no fit reads the canvas, and nothing
169
- * waits.
170
- *
171
- * @default The size `canvasSize` states: the pan lock is widened when `canvasSize` changes,
172
- * and no resize is ever under way.
173
- */
174
- readonly lockCanvasSize?: EmbedCanvasSize | null | undefined;
175
- /**
176
- * The docked elevation profile's measured height, in CSS pixels, or null before it is measured
177
- * or when no profile is docked. It sizes the fit's bottom inset (`embedFitPadding`), and a change
178
- * before the framing has settled frames again with it.
179
- */
180
- readonly measuredPanelHeight: number | null;
181
- /**
182
- * Receives each settle of the initial view, framed on the `[west, south, east, north]` extent
183
- * of the itinerary or the collection that frames it, or null when neither does. An embed lifts
184
- * its loading cover and posts its ready event from it (see `EmbedReadyEngine`). Read when a
185
- * framing settles. One that throws stops nothing: the settle stands, and its fault reaches the
186
- * program as an uncaught error on a microtask.
187
- */
188
- readonly onFramed?: ((bounds: BoundingBox | null) => void) | undefined;
189
- /** The profile sections the embed docks, which size the fit's bottom inset. */
190
- readonly sections: EmbedProfileSections;
191
- /**
192
- * The organization's zoom range. One that changes, or first arrives, is applied at once,
193
- * whatever stands on the map: with the next framing, or over the framing that stands, at the
194
- * floor that framing lowered and with no fit. One that leaves is released the same way: a
195
- * configuration that states no range over a map this engine wrote one to hands the map a null
196
- * for each end, which gives it back its own window.
197
- */
198
- readonly zoomRange: EmbedZoomRange;
30
+ /**
31
+ * The size of the map's canvas, or null while it is unmeasured: the size a fit frames. It
32
+ * sizes the pan lock from the view the embed opens on (see `embedConstraintsFor`). A change
33
+ * while a fit is on its way frames again with it, except a change to a canvas that measures
34
+ * nothing (null, or no area): there is nothing to frame on one, so the fit on its way stands,
35
+ * and a canvas that comes back at the size it had asks nothing new. Another input that changes
36
+ * while the canvas measures nothing is a question of its own: under no size at all it is
37
+ * framed as it stands, and under a canvas with no area no fit starts for it, so the canvas that
38
+ * comes back is the one framed. The fit on its way then settles nothing if it lands first: it
39
+ * framed the inputs as they were. A change that can start no fit (after the settle, under a
40
+ * publisher's own view, or while the next itinerary loads) moves no camera: the pan lock alone
41
+ * is widened for a canvas that outgrew it, and it is never tightened for one that shrank.
42
+ *
43
+ * An embed that opens on a canvas with no area, a frame the page has laid out and not shown,
44
+ * starts no fit and settles nothing: a renderer gives such a container a canvas of its own
45
+ * default size, and a fit would frame that. The organization's zoom range applies at once, and
46
+ * the itinerary is framed in the first canvas with an area. Null is another statement: a host
47
+ * that measures no canvas at all is framed at once, as it stands.
48
+ *
49
+ * WHEN a host hands a size over decides what the renderer makes of it, and the two uses want
50
+ * opposite orders. A fit frames the canvas the renderer holds, so a size that frames again is
51
+ * handed over once the renderer has resized: earlier, the fit frames the canvas as it was. The
52
+ * renderer enforces the lock as IT resizes, so a size that widens a lock is handed over before
53
+ * the renderer has resized: later, the lock is widened under a camera the renderer has
54
+ * already zoomed in. One size cannot arrive at both moments. A host that learns a size ahead
55
+ * of the renderer states it as {@link EmbedFramingConfig.lockCanvasSize}, and states it here
56
+ * once the renderer has resized to it.
57
+ */
58
+ readonly canvasSize: EmbedCanvasSize | null;
59
+ /**
60
+ * The map client the embed frames and locks, or null while there is no map, in which case
61
+ * nothing is framed.
62
+ *
63
+ * Required even so, because an engine without a client is silent: a key the caller has to write
64
+ * makes forgetting it a compile error rather than an embed that never frames. Compared by
65
+ * identity: a replaced client is framed and locked afresh.
66
+ */
67
+ readonly client: MapClient | null;
68
+ /**
69
+ * The collection the embed frames while no itinerary is active or expected, or null when there
70
+ * is none to frame: no collection is configured, its specification has not answered, or it
71
+ * answered no extent (a `bbox` that is null or absent, since its tiles draw no itinerary). An
72
+ * itinerary wins over it: while one is active or expected, the collection is not framed.
73
+ *
74
+ * It is framed as an itinerary is, through `fitCollection`, with the same padding and the same
75
+ * zoom ceiling, and once: a collection that stays the one stated is not framed again after its
76
+ * view settled, whatever extent a later answer states. A content switch to another collection,
77
+ * or back to the same one after an itinerary, is framed in its turn. Compared by value: the id
78
+ * and the four edges.
79
+ *
80
+ * Read only with `fitCollection` stated: a configuration that states none frames no collection.
81
+ *
82
+ * @default No collection: the embed frames an itinerary, or the base map alone.
83
+ */
84
+ readonly collection?: EmbedFramingCollection | null | undefined;
85
+ /**
86
+ * The id of the itinerary the embed is configured with, or null for an embed of the base map
87
+ * alone. A change of it while no itinerary is active is a content switch owed one settle,
88
+ * whatever `expectsItinerary` says: the base map's, on its next paint, when no itinerary is
89
+ * expected, and otherwise the settle the expectation ends on, the itinerary's framing or the
90
+ * base map's. So a host that already holds the failure of the itinerary it switches to, and
91
+ * never expects one, still hears how the switch ended. A change made while the base map's
92
+ * settle is on its way shares that settle. While an itinerary is active the switch is read off
93
+ * `itinerary`, and a change here settles nothing by itself.
94
+ *
95
+ * The id's change and `expectsItinerary` each signal a switch, and they are one settle only
96
+ * when one configure brings both. An expectation that rises in a later configure, once the
97
+ * base map has started to settle for the id's change, is a wait of its own and is owed its own
98
+ * settle: a host whose data layer shows the failure it holds and then fetches again hears a
99
+ * report for each, the first of them possibly while the itinerary is expected. Such a host
100
+ * raises `expectsItinerary` in the configure that brings the id.
101
+ *
102
+ * @default No id is stated: a content switch is read off `itinerary` and `expectsItinerary`
103
+ * alone, so one that changes neither settles nothing.
104
+ */
105
+ readonly configuredItineraryId?: string | null | undefined;
106
+ /**
107
+ * Whether a collection will frame this embed: one is configured and its specification has not
108
+ * answered yet. While it holds and nothing is framed, the settle waits for the collection as it
109
+ * waits for an expected itinerary (see `expectsItinerary`), except on the cold load of a map a
110
+ * publisher's own view frames. An expectation that ends with no collection to frame (the read
111
+ * failed, or it answered no extent) settles the base map again, so a host hears how it ended.
112
+ *
113
+ * Read only with `fitCollection` stated.
114
+ *
115
+ * @default false
116
+ */
117
+ readonly expectsCollection?: boolean | undefined;
118
+ /**
119
+ * Whether an itinerary will frame this embed: one is configured and its detail has not failed to
120
+ * load. While it holds and no itinerary is active, the settle waits for one, except on the cold
121
+ * load of a map a publisher's own view frames; otherwise the view settles on the map's next
122
+ * paint. An expectation that ends with no itinerary (its detail failed to load) settles the base
123
+ * map again, so a host hears how the switch ended.
124
+ *
125
+ * A flag the host states rather than one read off the active itinerary, so the moment between
126
+ * the itinerary's detail arriving and the store activating it never settles an off-route view.
127
+ */
128
+ readonly expectsItinerary: boolean;
129
+ /**
130
+ * Frames the whole active itinerary with `padding`, at once rather than animated, so the first
131
+ * painted frame is already the route. It goes through the bus in a studio
132
+ * (`studio.map.fitBoundsToSegment` with a null segment), the one camera mutation surface, and
133
+ * resolves once the camera has moved. Read when a framing starts.
134
+ */
135
+ readonly fit: (padding: FitBoundsPadding) => Promise<void>;
136
+ /**
137
+ * Frames `bounds`, the collection's extent, with `padding` and no closer than `maxZoom`, at once
138
+ * rather than animated: the collection's twin of `fit`, under the zoom ceiling an itinerary's
139
+ * fit holds. It goes through the bus in a studio (`studio.map.fitBounds` with `animate: false`),
140
+ * and resolves once the camera has moved. Read when a framing of the collection starts.
141
+ *
142
+ * @default No collection is framed: `collection` and `expectsCollection` are read as absent.
143
+ */
144
+ readonly fitCollection?: ((bounds: BoundingBox, padding: FitBoundsPadding, maxZoom: number) => Promise<void>) | undefined;
145
+ /** The itinerary the store has active, or null while none is. */
146
+ readonly itinerary: ItineraryWithDetails$1 | null;
147
+ /**
148
+ * The size the page has laid the canvas out at, or null while it is unmeasured, for a host
149
+ * that learns it before the renderer has resized to it. The pan lock is widened from it and no
150
+ * fit ever frames it: the lock covers the wider and the taller of this size and `canvasSize`,
151
+ * so the renderer resizes inside a lock already sized for the canvas it grows to.
152
+ *
153
+ * While it measures a canvas `canvasSize` does not state, a resize is under way: the renderer
154
+ * has yet to resize, and `canvasSize` has yet to follow. A fit asked for then would frame the
155
+ * canvas as it was, so none starts, and one already on its way settles nothing when it
156
+ * paints. The framing runs once the two sizes agree, on the canvas the renderer holds by then,
157
+ * so the view settles on the fit of the last canvas. A host that states this size therefore
158
+ * states the same one as `canvasSize` once the renderer has resized, or a fitted itinerary
159
+ * never settles: the organization's zoom range and the lock of the last framing are all that
160
+ * stand on the map meanwhile. Under a publisher's own view no fit reads the canvas, and nothing
161
+ * waits.
162
+ *
163
+ * @default The size `canvasSize` states: the pan lock is widened when `canvasSize` changes,
164
+ * and no resize is ever under way.
165
+ */
166
+ readonly lockCanvasSize?: EmbedCanvasSize | null | undefined;
167
+ /**
168
+ * The docked elevation profile's measured height, in CSS pixels, or null before it is measured
169
+ * or when no profile is docked. It sizes the fit's bottom inset (`embedFitPadding`), and a change
170
+ * before the framing has settled frames again with it.
171
+ */
172
+ readonly measuredPanelHeight: number | null;
173
+ /**
174
+ * Receives each settle of the initial view, framed on the `[west, south, east, north]` extent
175
+ * of the itinerary or the collection that frames it, or null when neither does. An embed lifts
176
+ * its loading cover and posts its ready event from it (see `EmbedReadyEngine`). Read when a
177
+ * framing settles. One that throws stops nothing: the settle stands, and its fault reaches the
178
+ * program as an uncaught error on a microtask.
179
+ */
180
+ readonly onFramed?: ((bounds: BoundingBox | null) => void) | undefined;
181
+ /** The profile sections the embed docks, which size the fit's bottom inset. */
182
+ readonly sections: EmbedProfileSections;
183
+ /**
184
+ * The organization's zoom range. One that changes, or first arrives, is applied at once,
185
+ * whatever stands on the map: with the next framing, or over the framing that stands, at the
186
+ * floor that framing lowered and with no fit. One that leaves is released the same way: a
187
+ * configuration that states no range over a map this engine wrote one to hands the map a null
188
+ * for each end, which gives it back its own window.
189
+ */
190
+ readonly zoomRange: EmbedZoomRange;
199
191
  }
200
192
  /**
201
193
  * EmbedFramingSnapshot is what an {@link EmbedFramingEngine} answers: whether the initial view of
@@ -207,20 +199,20 @@ interface EmbedFramingConfig {
207
199
  * framing settles. Both ids are null for the base map alone.
208
200
  */
209
201
  interface EmbedFramingSnapshot {
210
- /**
211
- * The extent the view was framed on, the itinerary's or the collection's, or null while
212
- * unframed or with none to frame.
213
- */
214
- readonly bounds: BoundingBox | null;
215
- /** The collection the answer is for: the one framed while no itinerary is, or null. */
216
- readonly collectionId: string | null;
217
- /**
218
- * Whether the initial view has painted: after the framing fit or, with no fit to wait for, on
219
- * the map's next paint.
220
- */
221
- readonly framed: boolean;
222
- /** The itinerary the answer is for: the active one, or null while none is. */
223
- readonly itineraryId: string | null;
202
+ /**
203
+ * The extent the view was framed on, the itinerary's or the collection's, or null while
204
+ * unframed or with none to frame.
205
+ */
206
+ readonly bounds: BoundingBox | null;
207
+ /** The collection the answer is for: the one framed while no itinerary is, or null. */
208
+ readonly collectionId: string | null;
209
+ /**
210
+ * Whether the initial view has painted: after the framing fit or, with no fit to wait for, on
211
+ * the map's next paint.
212
+ */
213
+ readonly framed: boolean;
214
+ /** The itinerary the answer is for: the active one, or null while none is. */
215
+ readonly itineraryId: string | null;
224
216
  }
225
217
  /**
226
218
  * EmbedFramingEngine is the machine behind an embed's initial framing: it frames the active
@@ -372,300 +364,299 @@ interface EmbedFramingSnapshot {
372
364
  * const release = framing.subscribe(() => undefined);
373
365
  * ```
374
366
  */
375
- declare class EmbedFramingEngine {
376
- private config;
377
- private snapshot;
378
- private readonly listeners;
379
- /** The client the framing below was made on; a replaced one starts from nothing. */
380
- private framingClient;
381
- /** The question the last framing step answered, or null when the next step must run in full. */
382
- private asked;
383
- /** The fit waiting for its paint, or null. */
384
- private pendingFit;
385
- /** The settle with no fit waiting for its paint, or null. */
386
- private pendingReveal;
387
- /**
388
- * Whether a settle has been reported on {@link framingClient}. Until one has, a publisher's own
389
- * view settles without waiting for its itinerary, which is what lifts a cold load's cover.
390
- */
391
- private reported;
392
- /**
393
- * The constraints the last itinerary or collection framed on {@link framingClient} left
394
- * standing, or null.
395
- */
396
- private standing;
397
- /**
398
- * Every constraint written to {@link framingClient}, each member as it was written last. A
399
- * member never written is absent, so the first write of anything is news.
400
- */
401
- private applied;
402
- /**
403
- * Whether a pan lock stands on {@link framingClient}. The next constraints that decide no lock
404
- * (the base map alone, an itinerary with no extent) release it.
405
- */
406
- private locked;
407
- /**
408
- * Whether a content switch made with nothing framed is still unanswered: an itinerary or a
409
- * collection is, or was, expected, or the configured id changed, and since then nothing was
410
- * framed and the base map alone was not set to settle again. A switch that ends with nothing to
411
- * frame settles the base map again. Answered when that settle starts, not when it paints, so an
412
- * expectation that rises after it is a wait of its own, owed its own settle.
413
- */
414
- private awaited;
415
- /** The configured itinerary's id as last stated, or undefined when it was left out. */
416
- private configuredId;
417
- /** Whether nobody is watching. A parked engine frames nothing and reports nothing. */
418
- private parked;
419
- private disposed;
420
- /**
421
- * Constructing one holds the configuration and does nothing else: no client is read, framed or
422
- * constrained. A React binding constructs during a render React is free to throw away, and a
423
- * constructor with a side effect would leave the discarded copy framing.
424
- */
425
- constructor(config: EmbedFramingConfig);
426
- /** getSnapshot returns the current answer, by reference and stable between changes. */
427
- getSnapshot(): EmbedFramingSnapshot;
428
- /**
429
- * subscribe registers a listener for every change of the snapshot, and returns its own
430
- * unsubscribe, which is idempotent.
431
- *
432
- * The first listener resumes the engine and the last one leaving parks it, which is the whole
433
- * lifecycle a component can express correctly: React tears an effect down and sets it up again
434
- * with the same object under StrictMode, so a latch here would leave a live surface bound to a
435
- * dead engine.
436
- */
437
- subscribe(listener: () => void): () => void;
438
- /**
439
- * configure replaces the configuration, and frames again only when what a framing is decided
440
- * from changed.
441
- *
442
- * A binding calls it after every render, so it compares the inputs a framing reads (the client
443
- * and the itinerary by identity, the rest by value) and does nothing more when they are
444
- * unchanged: `fit`, `fitCollection` and `onFramed` are read when they are used, so a fresh
445
- * closure per render costs nothing. Parked or not, the snapshot answers for the new content,
446
- * and for a replaced client, before this returns: unframed, under the active id, until its
447
- * framing settles. Only the framing waits for a subscriber.
448
- */
449
- configure(config: EmbedFramingConfig): void;
450
- /**
451
- * dispose parks the engine and drops every listener, for good: a settle still on its way reports
452
- * nothing.
453
- *
454
- * Idempotent, and every call after it is a no-op rather than an error: an owner torn down
455
- * mid-load should not have to guard the calls it already queued.
456
- */
457
- dispose(): void;
458
- /**
459
- * step brings the framing in line with the configuration. It runs in full only when the question
460
- * changed since the last step, when the active itinerary did, or when work the last one started
461
- * was dropped while parked.
462
- */
463
- private step;
464
- /**
465
- * whileFitting answers `question` as the fit on its way was asked it, when the canvas has since
466
- * gone to nothing: neither size the configuration states measures anything (see
467
- * `measuredCanvas`). A canvas with no area has nothing to frame, so it asks nothing new, the fit
468
- * on its way stands, and a canvas that comes back at the size that fit was asked for is the
469
- * question already answered. With no fit on its way, or while either size still measures
470
- * something, the question is the configuration's own.
471
- *
472
- * It is read to compare and never to record: another input that changes while the canvas
473
- * measures nothing is a question of its own, recorded with the sizes the configuration states.
474
- * It starts no fit while the page has laid the canvas out at no area (see {@link unlaid}), so
475
- * the canvas that comes back is the one framed for it.
476
- */
477
- private whileFitting;
478
- /**
479
- * restart forgets every framing made on the previous client, so a replaced client (or the map
480
- * arriving) frames and locks from nothing. A settle still on its way for the previous client is
481
- * dropped.
482
- */
483
- private restart;
484
- /** frame runs one framing step for `question` on `client`. */
485
- private frame;
486
- /**
487
- * resizing reports whether the page has laid the canvas out at a size the renderer has yet to
488
- * resize to: `lockCanvasSize` measures a canvas `canvasSize` does not state. Never with no
489
- * `lockCanvasSize`, and never while it measures nothing.
490
- */
491
- private resizing;
492
- /**
493
- * unlaid reports whether the page has laid the canvas out at no area: no size the
494
- * configuration states measures anything, and one of them, `canvasSize` or `lockCanvasSize`,
495
- * states a layout with no area (see {@link laidOutAtNoArea}). An embed mounted in a frame
496
- * nobody is shown yet reads so. Never for a host that states no size at all, or one that is
497
- * not a number: neither is a layout, and the embed is framed as it stands.
498
- *
499
- * A renderer gives a container with no area a canvas of its own default size, so a fit asked
500
- * for now would frame a canvas nobody sees, and its settle would report a view the reader is
501
- * never shown.
502
- */
503
- private unlaid;
504
- /**
505
- * awaitResize runs the framing step for an itinerary a fit frames while there is no canvas to
506
- * frame yet: the page has laid it out at no area (see {@link unlaid}), or the renderer has yet
507
- * to resize to it (see {@link resizing}). It starts no fit, since one asked for now would
508
- * frame the canvas as it was, and it leaves a fit already on its way in flight. The step that
509
- * finds a canvas with an area, at a size the two agree on, frames in full, and the fit it
510
- * starts replaces that one.
511
- *
512
- * What stands on the client meanwhile is what {@link awaitContent} leaves there. The pan lock
513
- * of the last framing, this itinerary's or the outgoing one's, is widened for the size ahead
514
- * (see {@link lockAgain}), so the renderer resizes inside it. On a client nothing was framed
515
- * on, the organization's zoom range applies at once: it reads no canvas, so it has nothing to
516
- * wait for, and a host whose two sizes never agree is not left with a map no range holds.
517
- */
518
- private awaitResize;
519
- /**
520
- * awaitContent runs the framing step for an itinerary or a collection that is expected and not
521
- * framed yet: the itinerary's detail is loading, a content switch cleared the outgoing one
522
- * first, or the collection's specification has not answered.
523
- *
524
- * The constraints of the last itinerary or collection framed on this client stay until the next
525
- * framing replaces them, the zoom floor that framing lowered included; the pan lock among them
526
- * still follows a canvas that outgrows it (see {@link lockAgain}). On a client nothing was
527
- * framed on, the organization's zoom range applies at once.
528
- */
529
- private awaitContent;
530
- /**
531
- * showBaseMap runs the framing step for the base map alone: no itinerary or collection is
532
- * framed and none is expected. The organization's zoom range applies as it is, the pan lock an
533
- * itinerary or a collection left standing is released (see {@link constrain}), and the view
534
- * settles on the map's next render.
535
- */
536
- private showBaseMap;
537
- /** zoomRangeAlone decides the constraints with no itinerary to lock to: the zoom range alone. */
538
- private zoomRangeAlone;
539
- /**
540
- * rangeAgain applies the configuration's zoom range over the framing of `content` when it is not
541
- * the range that framing was decided from: the same route, camera, canvas and padding, under
542
- * the range as it is stated now. The zoom range alone, so the pan lock stays as it is and no
543
- * camera is moved by a fit.
544
- *
545
- * The floor is the one a framing under this range would have set, lowered to the zoom the fit
546
- * landed on, so a range that arrives late leaves the embed where it would have opened. A range
547
- * that does not state both ends decides no clamp, so the one on the map is released
548
- * (see {@link rangeRelease}).
549
- */
550
- private rangeAgain;
551
- /**
552
- * rangeRelease is the constraints that release the zoom range this engine wrote to the client:
553
- * a null for each end, which hands the map back its own window. Nothing while no range of the
554
- * engine's stands there, so a map no range was written to is told nothing.
555
- */
556
- private rangeRelease;
557
- /**
558
- * lockAgain widens the pan lock of the framing of `content` when the canvas has outgrown the one
559
- * it was sized for: the same route, camera and padding, on a canvas as wide as the widest and as
560
- * tall as the tallest it has been handed since the framing, as `canvasSize` or as
561
- * `lockCanvasSize`. The lock alone, so the zoom range stays as the framing set it, and no
562
- * camera is moved.
563
- *
564
- * The lock only grows. The renderer keeps its canvas inside the lock at the size the canvas has
565
- * when the lock is applied, and a new size is handed over before the renderer resizes: a lock
566
- * sized for a smaller canvas would be narrower than the one the renderer still holds. A canvas
567
- * that reads unmeasured changes nothing either.
568
- */
569
- private lockAgain;
570
- /**
571
- * constrain applies one framing step's constraints, in one call, and only when they decide
572
- * something.
573
- *
574
- * Constraints that decide no pan lock release the one standing, with a null `maxBounds`: there
575
- * is no route left to hold the camera to, whether the embed is the base map alone or its next
576
- * itinerary has no extent. Constraints that decide no zoom range release the one standing the
577
- * same way (see {@link rangeRelease}): the configuration states none any more.
578
- */
579
- private constrain;
580
- /**
581
- * apply writes `constraints` to the client, unless they decide nothing or every member they
582
- * state already stands there as stated. A resize under the zoom range alone, and a framing
583
- * asked again for the inputs it had, decide what the map already holds, and writing it again
584
- * would have the renderer enforce an unchanged range and lock once more.
585
- *
586
- * The set is written whole when any member is news, so a caller's one call stays one call.
587
- */
588
- private apply;
589
- /**
590
- * revealWithoutFit settles the view on the map's next render, for a view no fit will move: an
591
- * embed of the base map alone, an itinerary that failed to load, or a publisher's own view.
592
- *
593
- * Once for what it answers, `content`: a view already settled for it, or settling, is left
594
- * alone. A settle on its way for anything else is replaced, since both would wait on the same
595
- * render and only the active one is worth reporting.
596
- */
597
- private revealWithoutFit;
598
- /**
599
- * settledFor reports whether the initial view of `content` has settled on the current client.
600
- * The snapshot is the one record of it: it answers for the active content and reads unframed
601
- * from a content switch, or a replaced client, until that settle.
602
- */
603
- private settledFor;
604
- /**
605
- * settle reports one settle: through the snapshot, then to `onFramed`. A settle on its way for
606
- * anything but the active content is dropped before it lands (see {@link frame}), so the
607
- * snapshot is written only for the content it answers for, and never goes back to a content
608
- * the reader has left.
609
- */
610
- private settle;
611
- /** publish shows `snapshot` and tells every listener. */
612
- private publish;
367
+ export declare class EmbedFramingEngine {
368
+ private config;
369
+ private snapshot;
370
+ private readonly listeners;
371
+ /** The client the framing below was made on; a replaced one starts from nothing. */
372
+ private framingClient;
373
+ /** The question the last framing step answered, or null when the next step must run in full. */
374
+ private asked;
375
+ /** The fit waiting for its paint, or null. */
376
+ private pendingFit;
377
+ /** The settle with no fit waiting for its paint, or null. */
378
+ private pendingReveal;
379
+ /**
380
+ * Whether a settle has been reported on {@link framingClient}. Until one has, a publisher's own
381
+ * view settles without waiting for its itinerary, which is what lifts a cold load's cover.
382
+ */
383
+ private reported;
384
+ /**
385
+ * The constraints the last itinerary or collection framed on {@link framingClient} left
386
+ * standing, or null.
387
+ */
388
+ private standing;
389
+ /**
390
+ * Every constraint written to {@link framingClient}, each member as it was written last. A
391
+ * member never written is absent, so the first write of anything is news.
392
+ */
393
+ private applied;
394
+ /**
395
+ * Whether a pan lock stands on {@link framingClient}. The next constraints that decide no lock
396
+ * (the base map alone, an itinerary with no extent) release it.
397
+ */
398
+ private locked;
399
+ /**
400
+ * Whether a content switch made with nothing framed is still unanswered: an itinerary or a
401
+ * collection is, or was, expected, or the configured id changed, and since then nothing was
402
+ * framed and the base map alone was not set to settle again. A switch that ends with nothing to
403
+ * frame settles the base map again. Answered when that settle starts, not when it paints, so an
404
+ * expectation that rises after it is a wait of its own, owed its own settle.
405
+ */
406
+ private awaited;
407
+ /** The configured itinerary's id as last stated, or undefined when it was left out. */
408
+ private configuredId;
409
+ /** Whether nobody is watching. A parked engine frames nothing and reports nothing. */
410
+ private parked;
411
+ private disposed;
412
+ /**
413
+ * Constructing one holds the configuration and does nothing else: no client is read, framed or
414
+ * constrained. A React binding constructs during a render React is free to throw away, and a
415
+ * constructor with a side effect would leave the discarded copy framing.
416
+ */
417
+ constructor(config: EmbedFramingConfig);
418
+ /** getSnapshot returns the current answer, by reference and stable between changes. */
419
+ getSnapshot(): EmbedFramingSnapshot;
420
+ /**
421
+ * subscribe registers a listener for every change of the snapshot, and returns its own
422
+ * unsubscribe, which is idempotent.
423
+ *
424
+ * The first listener resumes the engine and the last one leaving parks it, which is the whole
425
+ * lifecycle a component can express correctly: React tears an effect down and sets it up again
426
+ * with the same object under StrictMode, so a latch here would leave a live surface bound to a
427
+ * dead engine.
428
+ */
429
+ subscribe(listener: () => void): () => void;
430
+ /**
431
+ * configure replaces the configuration, and frames again only when what a framing is decided
432
+ * from changed.
433
+ *
434
+ * A binding calls it after every render, so it compares the inputs a framing reads (the client
435
+ * and the itinerary by identity, the rest by value) and does nothing more when they are
436
+ * unchanged: `fit`, `fitCollection` and `onFramed` are read when they are used, so a fresh
437
+ * closure per render costs nothing. Parked or not, the snapshot answers for the new content,
438
+ * and for a replaced client, before this returns: unframed, under the active id, until its
439
+ * framing settles. Only the framing waits for a subscriber.
440
+ */
441
+ configure(config: EmbedFramingConfig): void;
442
+ /**
443
+ * dispose parks the engine and drops every listener, for good: a settle still on its way reports
444
+ * nothing.
445
+ *
446
+ * Idempotent, and every call after it is a no-op rather than an error: an owner torn down
447
+ * mid-load should not have to guard the calls it already queued.
448
+ */
449
+ dispose(): void;
450
+ /**
451
+ * step brings the framing in line with the configuration. It runs in full only when the question
452
+ * changed since the last step, when the active itinerary did, or when work the last one started
453
+ * was dropped while parked.
454
+ */
455
+ private step;
456
+ /**
457
+ * whileFitting answers `question` as the fit on its way was asked it, when the canvas has since
458
+ * gone to nothing: neither size the configuration states measures anything (see
459
+ * `measuredCanvas`). A canvas with no area has nothing to frame, so it asks nothing new, the fit
460
+ * on its way stands, and a canvas that comes back at the size that fit was asked for is the
461
+ * question already answered. With no fit on its way, or while either size still measures
462
+ * something, the question is the configuration's own.
463
+ *
464
+ * It is read to compare and never to record: another input that changes while the canvas
465
+ * measures nothing is a question of its own, recorded with the sizes the configuration states.
466
+ * It starts no fit while the page has laid the canvas out at no area (see {@link unlaid}), so
467
+ * the canvas that comes back is the one framed for it.
468
+ */
469
+ private whileFitting;
470
+ /**
471
+ * restart forgets every framing made on the previous client, so a replaced client (or the map
472
+ * arriving) frames and locks from nothing. A settle still on its way for the previous client is
473
+ * dropped.
474
+ */
475
+ private restart;
476
+ /** frame runs one framing step for `question` on `client`. */
477
+ private frame;
478
+ /**
479
+ * resizing reports whether the page has laid the canvas out at a size the renderer has yet to
480
+ * resize to: `lockCanvasSize` measures a canvas `canvasSize` does not state. Never with no
481
+ * `lockCanvasSize`, and never while it measures nothing.
482
+ */
483
+ private resizing;
484
+ /**
485
+ * unlaid reports whether the page has laid the canvas out at no area: no size the
486
+ * configuration states measures anything, and one of them, `canvasSize` or `lockCanvasSize`,
487
+ * states a layout with no area (see {@link laidOutAtNoArea}). An embed mounted in a frame
488
+ * nobody is shown yet reads so. Never for a host that states no size at all, or one that is
489
+ * not a number: neither is a layout, and the embed is framed as it stands.
490
+ *
491
+ * A renderer gives a container with no area a canvas of its own default size, so a fit asked
492
+ * for now would frame a canvas nobody sees, and its settle would report a view the reader is
493
+ * never shown.
494
+ */
495
+ private unlaid;
496
+ /**
497
+ * awaitResize runs the framing step for an itinerary a fit frames while there is no canvas to
498
+ * frame yet: the page has laid it out at no area (see {@link unlaid}), or the renderer has yet
499
+ * to resize to it (see {@link resizing}). It starts no fit, since one asked for now would
500
+ * frame the canvas as it was, and it leaves a fit already on its way in flight. The step that
501
+ * finds a canvas with an area, at a size the two agree on, frames in full, and the fit it
502
+ * starts replaces that one.
503
+ *
504
+ * What stands on the client meanwhile is what {@link awaitContent} leaves there. The pan lock
505
+ * of the last framing, this itinerary's or the outgoing one's, is widened for the size ahead
506
+ * (see {@link lockAgain}), so the renderer resizes inside it. On a client nothing was framed
507
+ * on, the organization's zoom range applies at once: it reads no canvas, so it has nothing to
508
+ * wait for, and a host whose two sizes never agree is not left with a map no range holds.
509
+ */
510
+ private awaitResize;
511
+ /**
512
+ * awaitContent runs the framing step for an itinerary or a collection that is expected and not
513
+ * framed yet: the itinerary's detail is loading, a content switch cleared the outgoing one
514
+ * first, or the collection's specification has not answered.
515
+ *
516
+ * The constraints of the last itinerary or collection framed on this client stay until the next
517
+ * framing replaces them, the zoom floor that framing lowered included; the pan lock among them
518
+ * still follows a canvas that outgrows it (see {@link lockAgain}). On a client nothing was
519
+ * framed on, the organization's zoom range applies at once.
520
+ */
521
+ private awaitContent;
522
+ /**
523
+ * showBaseMap runs the framing step for the base map alone: no itinerary or collection is
524
+ * framed and none is expected. The organization's zoom range applies as it is, the pan lock an
525
+ * itinerary or a collection left standing is released (see {@link constrain}), and the view
526
+ * settles on the map's next render.
527
+ */
528
+ private showBaseMap;
529
+ /** zoomRangeAlone decides the constraints with no itinerary to lock to: the zoom range alone. */
530
+ private zoomRangeAlone;
531
+ /**
532
+ * rangeAgain applies the configuration's zoom range over the framing of `content` when it is not
533
+ * the range that framing was decided from: the same route, camera, canvas and padding, under
534
+ * the range as it is stated now. The zoom range alone, so the pan lock stays as it is and no
535
+ * camera is moved by a fit.
536
+ *
537
+ * The floor is the one a framing under this range would have set, lowered to the zoom the fit
538
+ * landed on, so a range that arrives late leaves the embed where it would have opened. A range
539
+ * that does not state both ends decides no clamp, so the one on the map is released
540
+ * (see {@link rangeRelease}).
541
+ */
542
+ private rangeAgain;
543
+ /**
544
+ * rangeRelease is the constraints that release the zoom range this engine wrote to the client:
545
+ * a null for each end, which hands the map back its own window. Nothing while no range of the
546
+ * engine's stands there, so a map no range was written to is told nothing.
547
+ */
548
+ private rangeRelease;
549
+ /**
550
+ * lockAgain widens the pan lock of the framing of `content` when the canvas has outgrown the one
551
+ * it was sized for: the same route, camera and padding, on a canvas as wide as the widest and as
552
+ * tall as the tallest it has been handed since the framing, as `canvasSize` or as
553
+ * `lockCanvasSize`. The lock alone, so the zoom range stays as the framing set it, and no
554
+ * camera is moved.
555
+ *
556
+ * The lock only grows. The renderer keeps its canvas inside the lock at the size the canvas has
557
+ * when the lock is applied, and a new size is handed over before the renderer resizes: a lock
558
+ * sized for a smaller canvas would be narrower than the one the renderer still holds. A canvas
559
+ * that reads unmeasured changes nothing either.
560
+ */
561
+ private lockAgain;
562
+ /**
563
+ * constrain applies one framing step's constraints, in one call, and only when they decide
564
+ * something.
565
+ *
566
+ * Constraints that decide no pan lock release the one standing, with a null `maxBounds`: there
567
+ * is no route left to hold the camera to, whether the embed is the base map alone or its next
568
+ * itinerary has no extent. Constraints that decide no zoom range release the one standing the
569
+ * same way (see {@link rangeRelease}): the configuration states none any more.
570
+ */
571
+ private constrain;
572
+ /**
573
+ * apply writes `constraints` to the client, unless they decide nothing or every member they
574
+ * state already stands there as stated. A resize under the zoom range alone, and a framing
575
+ * asked again for the inputs it had, decide what the map already holds, and writing it again
576
+ * would have the renderer enforce an unchanged range and lock once more.
577
+ *
578
+ * The set is written whole when any member is news, so a caller's one call stays one call.
579
+ */
580
+ private apply;
581
+ /**
582
+ * revealWithoutFit settles the view on the map's next render, for a view no fit will move: an
583
+ * embed of the base map alone, an itinerary that failed to load, or a publisher's own view.
584
+ *
585
+ * Once for what it answers, `content`: a view already settled for it, or settling, is left
586
+ * alone. A settle on its way for anything else is replaced, since both would wait on the same
587
+ * render and only the active one is worth reporting.
588
+ */
589
+ private revealWithoutFit;
590
+ /**
591
+ * settledFor reports whether the initial view of `content` has settled on the current client.
592
+ * The snapshot is the one record of it: it answers for the active content and reads unframed
593
+ * from a content switch, or a replaced client, until that settle.
594
+ */
595
+ private settledFor;
596
+ /**
597
+ * settle reports one settle: through the snapshot, then to `onFramed`. A settle on its way for
598
+ * anything but the active content is dropped before it lands (see {@link frame}), so the
599
+ * snapshot is written only for the content it answers for, and never goes back to a content
600
+ * the reader has left.
601
+ */
602
+ private settle;
603
+ /** publish shows `snapshot` and tells every listener. */
604
+ private publish;
613
605
  }
614
-
615
606
  /**
616
607
  * EmbedReadyConfig is what an embed's ready events are assembled from, all of it replaceable
617
608
  * mid-life through {@link EmbedReadyEngine.configure} and read when an event is posted.
618
609
  */
619
610
  interface EmbedReadyConfig {
620
- /** The itinerary the store has active, or null while none is, reported as the settled content. */
621
- readonly activeItineraryId: string | null;
622
- /** The store's terrain slug, empty until the display seed has landed. */
623
- readonly activeTerrain: string;
624
- /** The embed config's terrain slug, reported while the store's terrain is still empty. */
625
- readonly configTerrain: string;
626
- /** The itinerary the embed config asks for, or null for an embed of the base map alone. */
627
- readonly configuredItineraryId: string | null;
628
- /**
629
- * Whether the configured itinerary's detail failed to load, which a settle reports as
630
- * `"not_found"`: the host asked for content that never resolved.
631
- */
632
- readonly itineraryFailed: boolean;
633
- /**
634
- * Receives each ready event, everything but the `type` the host bridge stamps on: an embed in an
635
- * iframe posts it to the parent page. Omitted where nobody listens (a share page), and the cover
636
- * still lifts. One that throws stops nothing: the cover has lifted by then, and its fault
637
- * reaches the program as an uncaught error on a microtask.
638
- */
639
- readonly onReady?: ((payload: Omit<ReadyMessage, "type">) => void) | undefined;
611
+ /** The itinerary the store has active, or null while none is, reported as the settled content. */
612
+ readonly activeItineraryId: string | null;
613
+ /** The store's terrain slug, empty until the display seed has landed. */
614
+ readonly activeTerrain: string;
615
+ /** The embed config's terrain slug, reported while the store's terrain is still empty. */
616
+ readonly configTerrain: string;
617
+ /** The itinerary the embed config asks for, or null for an embed of the base map alone. */
618
+ readonly configuredItineraryId: string | null;
619
+ /**
620
+ * Whether the configured itinerary's detail failed to load, which a settle reports as
621
+ * `"not_found"`: the host asked for content that never resolved.
622
+ */
623
+ readonly itineraryFailed: boolean;
624
+ /**
625
+ * Receives each ready event, everything but the `type` the host bridge stamps on: an embed in an
626
+ * iframe posts it to the parent page. Omitted where nobody listens (a share page), and the cover
627
+ * still lifts. One that throws stops nothing: the cover has lifted by then, and its fault
628
+ * reaches the program as an uncaught error on a microtask.
629
+ */
630
+ readonly onReady?: ((payload: Omit<ReadyMessage, "type">) => void) | undefined;
640
631
  }
641
632
  /**
642
633
  * EmbedReadyEngineOptions is the {@link EmbedReadyConfig} an engine starts with, plus the settings
643
634
  * fixed for its life.
644
635
  */
645
636
  interface EmbedReadyEngineOptions extends EmbedReadyConfig {
646
- /**
647
- * Where the deadline's time comes from. The deadline is a duration the product chose rather than
648
- * a rate, so it waits on the studio's `Clock` seam, and a host that renders an embed frame by
649
- * frame, or tests one, moves it by hand.
650
- */
651
- readonly clock: Clock;
652
- /**
653
- * How long the cover waits for the initial view to settle before it lifts anyway, in
654
- * milliseconds, counted from the first subscriber. When it passes with no settle, the host is
655
- * told `"timeout"`. A whole or fractional number from 0 to 2,147,483,647, the longest delay a
656
- * timer honours.
657
- *
658
- * @default 8000
659
- */
660
- readonly timeoutMs?: number | undefined;
637
+ /**
638
+ * Where the deadline's time comes from. The deadline is a duration the product chose rather than
639
+ * a rate, so it waits on the studio's `Clock` seam, and a host that renders an embed frame by
640
+ * frame, or tests one, moves it by hand.
641
+ */
642
+ readonly clock: Clock;
643
+ /**
644
+ * How long the cover waits for the initial view to settle before it lifts anyway, in
645
+ * milliseconds, counted from the first subscriber. When it passes with no settle, the host is
646
+ * told `"timeout"`. A whole or fractional number from 0 to 2,147,483,647, the longest delay a
647
+ * timer honours.
648
+ *
649
+ * @default 8000
650
+ */
651
+ readonly timeoutMs?: number | undefined;
661
652
  }
662
653
  /** EmbedReadySnapshot is what an {@link EmbedReadyEngine} answers: whether the cover still shows. */
663
654
  interface EmbedReadySnapshot {
664
- /**
665
- * Whether the loading cover is up: true from the start until the first settle or the deadline,
666
- * and false for good after either.
667
- */
668
- readonly covered: boolean;
655
+ /**
656
+ * Whether the loading cover is up: true from the start until the first settle or the deadline,
657
+ * and false for good after either.
658
+ */
659
+ readonly covered: boolean;
669
660
  }
670
661
  /**
671
662
  * EmbedReadyEngine is the machine behind an embed's cold-load cover and its ready handshake with
@@ -729,140 +720,115 @@ interface EmbedReadySnapshot {
729
720
  * release();
730
721
  * ```
731
722
  */
732
- declare class EmbedReadyEngine {
733
- private config;
734
- private readonly clock;
735
- private readonly timeoutMs;
736
- private snapshot;
737
- private readonly listeners;
738
- /** The deadline waiting on the clock, or null while none is. */
739
- private deadline;
740
- /** Whether nobody is watching. A parked engine arms nothing and posts nothing. */
741
- private parked;
742
- private disposed;
743
- /**
744
- * Constructing one holds the options and does nothing else: no deadline is armed and nothing is
745
- * posted. A React binding constructs during a render React is free to throw away, and a
746
- * constructor with a side effect would leave the discarded copy waiting.
747
- *
748
- * @throws {MountayaElementsError} When `timeoutMs` is not a finite number from 0 to
749
- * 2,147,483,647.
750
- */
751
- constructor(options: EmbedReadyEngineOptions);
752
- /** getSnapshot returns the current answer, by reference and stable between changes. */
753
- getSnapshot(): EmbedReadySnapshot;
754
- /**
755
- * subscribe registers a listener for every change of the snapshot, and returns its own
756
- * unsubscribe, which is idempotent.
757
- *
758
- * The first listener resumes the engine and the last one leaving parks it, which is the whole
759
- * lifecycle a component can express correctly: React tears an effect down and sets it up again
760
- * with the same object under StrictMode, so a latch here would leave a live surface bound to a
761
- * dead engine. A binding hands its framework a STABLE `subscribe`; a fresh closure per render
762
- * parks and resumes on every render.
763
- */
764
- subscribe(listener: () => void): () => void;
765
- /**
766
- * configure replaces the configuration the next ready event is assembled from. It moves nothing:
767
- * the deadline stays where it is and a posted event stays posted, so a binding calls it after
768
- * every render at the cost of an assignment.
769
- */
770
- configure(config: EmbedReadyConfig): void;
771
- /**
772
- * settle reports that the initial view has painted, framed on `bounds` (`[west, south, east,
773
- * north]`, the itinerary's or the collection's, or null when neither frames it): the cover lifts
774
- * and a ready event is posted.
775
- * Called on the cold load and again after every content switch, and each call posts. A call
776
- * while parked, or after {@link EmbedReadyEngine.dispose}, does nothing.
777
- */
778
- settle(bounds: BoundingBox | null): void;
779
- /**
780
- * dispose drops the deadline and every listener, for good.
781
- *
782
- * Idempotent, and every call after it is a no-op rather than an error: an owner torn down
783
- * mid-load should not have to guard the calls it already queued.
784
- */
785
- dispose(): void;
786
- /** arm waits out the deadline while the cover is up. */
787
- private arm;
788
- /** disarm drops the deadline, if one is armed. */
789
- private disarm;
790
- /**
791
- * expire lifts the cover at the deadline and says `"timeout"`. It runs only for the deadline the
792
- * engine still holds, so the engine is watched and nothing has settled: a settle, a park and a
793
- * dispose each drop the deadline, and a lifted cover arms no other.
794
- */
795
- private expire;
796
- /** post hands one ready event to the host, assembled from the configuration as it stands. */
797
- private post;
798
- /** reveal lifts the cover, and tells every listener when that is news. */
799
- private reveal;
723
+ export declare class EmbedReadyEngine {
724
+ private config;
725
+ private readonly clock;
726
+ private readonly timeoutMs;
727
+ private snapshot;
728
+ private readonly listeners;
729
+ /** The deadline waiting on the clock, or null while none is. */
730
+ private deadline;
731
+ /** Whether nobody is watching. A parked engine arms nothing and posts nothing. */
732
+ private parked;
733
+ private disposed;
734
+ /**
735
+ * Constructing one holds the options and does nothing else: no deadline is armed and nothing is
736
+ * posted. A React binding constructs during a render React is free to throw away, and a
737
+ * constructor with a side effect would leave the discarded copy waiting.
738
+ *
739
+ * @throws {MountayaElementsError} When `timeoutMs` is not a finite number from 0 to
740
+ * 2,147,483,647.
741
+ */
742
+ constructor(options: EmbedReadyEngineOptions);
743
+ /** getSnapshot returns the current answer, by reference and stable between changes. */
744
+ getSnapshot(): EmbedReadySnapshot;
745
+ /**
746
+ * subscribe registers a listener for every change of the snapshot, and returns its own
747
+ * unsubscribe, which is idempotent.
748
+ *
749
+ * The first listener resumes the engine and the last one leaving parks it, which is the whole
750
+ * lifecycle a component can express correctly: React tears an effect down and sets it up again
751
+ * with the same object under StrictMode, so a latch here would leave a live surface bound to a
752
+ * dead engine. A binding hands its framework a STABLE `subscribe`; a fresh closure per render
753
+ * parks and resumes on every render.
754
+ */
755
+ subscribe(listener: () => void): () => void;
756
+ /**
757
+ * configure replaces the configuration the next ready event is assembled from. It moves nothing:
758
+ * the deadline stays where it is and a posted event stays posted, so a binding calls it after
759
+ * every render at the cost of an assignment.
760
+ */
761
+ configure(config: EmbedReadyConfig): void;
762
+ /**
763
+ * settle reports that the initial view has painted, framed on `bounds` (`[west, south, east,
764
+ * north]`, the itinerary's or the collection's, or null when neither frames it): the cover lifts
765
+ * and a ready event is posted.
766
+ * Called on the cold load and again after every content switch, and each call posts. A call
767
+ * while parked, or after {@link EmbedReadyEngine.dispose}, does nothing.
768
+ */
769
+ settle(bounds: BoundingBox | null): void;
770
+ /**
771
+ * dispose drops the deadline and every listener, for good.
772
+ *
773
+ * Idempotent, and every call after it is a no-op rather than an error: an owner torn down
774
+ * mid-load should not have to guard the calls it already queued.
775
+ */
776
+ dispose(): void;
777
+ /** arm waits out the deadline while the cover is up. */
778
+ private arm;
779
+ /** disarm drops the deadline, if one is armed. */
780
+ private disarm;
781
+ /**
782
+ * expire lifts the cover at the deadline and says `"timeout"`. It runs only for the deadline the
783
+ * engine still holds, so the engine is watched and nothing has settled: a settle, a park and a
784
+ * dispose each drop the deadline, and a lifted cover arms no other.
785
+ */
786
+ private expire;
787
+ /** post hands one ready event to the host, assembled from the configuration as it stands. */
788
+ private post;
789
+ /** reveal lifts the cover, and tells every listener when that is news. */
790
+ private reveal;
800
791
  }
801
-
802
- /**
803
- * The hosted embed's session token, asked of the page that frames it.
804
- *
805
- * An organization that sets `require_session_token` has every read of its hosted embed carry a
806
- * session token, the map's tiles included, and a token lives minutes. The embed cannot mint
807
- * one: minting takes the organization's secret key, which only the integrator's server holds. So
808
- * the embed asks the page that frames it, and that page asks the server: the snippet's script
809
- * answers each request from the integrator's own endpoint.
810
- *
811
- * {@link askFramingPageForSession} is one such ask, shaped as the `mint` a `SessionTokenEngine`
812
- * of `@mountaya/client` takes, so the engine schedules the next one a minute before the answer's
813
- * `expires_at` and retries a page that did not answer:
814
- *
815
- * ```ts
816
- * import { SessionTokenEngine } from "@mountaya/client";
817
- * import { askFramingPageForSession } from "@mountaya/studio/engines";
818
- * import { systemClock } from "@mountaya/studio/seams";
819
- *
820
- * const session = new SessionTokenEngine({
821
- * mint: () => askFramingPageForSession({ clock: systemClock(), embed: window }),
822
- * });
823
- * ```
824
- */
825
-
826
792
  /** FRAMING_PAGE_SESSION_TIMEOUT_MS is how long an ask waits for the framing page by default. */
827
- declare const FRAMING_PAGE_SESSION_TIMEOUT_MS = 10000;
793
+ export declare const FRAMING_PAGE_SESSION_TIMEOUT_MS = 10000;
828
794
  /**
829
795
  * FramingPageMessage is the part of a window `message` event an ask reads: the payload, and the
830
796
  * window that posted it.
831
797
  */
832
798
  interface FramingPageMessage {
833
- readonly data: unknown;
834
- readonly source: unknown;
799
+ readonly data: unknown;
800
+ readonly source: unknown;
835
801
  }
836
802
  /**
837
803
  * FramingPageWindow is the part of the embed's own window an ask uses: its parent, the page that
838
804
  * frames it, and the `message` listener the answer arrives through. A browser `Window` is one.
839
805
  */
840
806
  interface FramingPageWindow {
841
- readonly addEventListener: (type: "message", listener: (event: FramingPageMessage) => void) => void;
842
- readonly parent: {
843
- readonly postMessage: (message: unknown, targetOrigin: string) => void;
844
- };
845
- readonly removeEventListener: (type: "message", listener: (event: FramingPageMessage) => void) => void;
807
+ readonly addEventListener: (type: "message", listener: (event: FramingPageMessage) => void) => void;
808
+ readonly parent: {
809
+ readonly postMessage: (message: unknown, targetOrigin: string) => void;
810
+ };
811
+ readonly removeEventListener: (type: "message", listener: (event: FramingPageMessage) => void) => void;
846
812
  }
847
813
  /** AskFramingPageForSessionOptions is what {@link askFramingPageForSession} takes. */
848
814
  interface AskFramingPageForSessionOptions {
849
- /**
850
- * Where the wait's time comes from: `systemClock()` of `@mountaya/studio/seams` in a page, which
851
- * the host chooses as it chooses every seam.
852
- */
853
- readonly clock: Clock;
854
- /**
855
- * How long to wait for the framing page's answer, in milliseconds, before the ask rejects. A
856
- * whole or fractional number from 1 to 2,147,483,647, the longest delay a timer honours.
857
- *
858
- * @default 10000
859
- */
860
- readonly timeoutMs?: number | undefined;
861
- /**
862
- * The embed's own window, whose parent is the page that frames it. Handed in rather than read
863
- * off the global, so a host decides which window asks, and a suite hands it a stand-in.
864
- */
865
- readonly embed: FramingPageWindow;
815
+ /**
816
+ * Where the wait's time comes from: `systemClock()` of `@mountaya/studio/seams` in a page, which
817
+ * the host chooses as it chooses every seam.
818
+ */
819
+ readonly clock: Clock;
820
+ /**
821
+ * How long to wait for the framing page's answer, in milliseconds, before the ask rejects. A
822
+ * whole or fractional number from 1 to 2,147,483,647, the longest delay a timer honours.
823
+ *
824
+ * @default 10000
825
+ */
826
+ readonly timeoutMs?: number | undefined;
827
+ /**
828
+ * The embed's own window, whose parent is the page that frames it. Handed in rather than read
829
+ * off the global, so a host decides which window asks, and a suite hands it a stand-in.
830
+ */
831
+ readonly embed: FramingPageWindow;
866
832
  }
867
833
  /**
868
834
  * askFramingPageForSession asks the page that frames the embed for a session token, and resolves
@@ -880,8 +846,7 @@ interface AskFramingPageForSessionOptions {
880
846
  * framing page has not answered within `timeoutMs`; the listener is removed either way, so an
881
847
  * unanswered ask holds nothing.
882
848
  */
883
- declare const askFramingPageForSession: (options: AskFramingPageForSessionOptions) => Promise<RestSchema.Session>;
884
-
849
+ export declare const askFramingPageForSession: (options: AskFramingPageForSessionOptions) => Promise<RestSchema.Session>;
885
850
  /**
886
851
  * ItineraryPaceResult is one itinerary re-timed at one pace: the total in
887
852
  * seconds, and every segment that made it up, indexed by the segment's own id.
@@ -892,73 +857,72 @@ declare const askFramingPageForSession: (options: AskFramingPageForSessionOption
892
857
  * would invite it right back.
893
858
  */
894
859
  interface ItineraryPaceResult {
895
- bySegmentId: ReadonlyMap<string, ItineraryPaceSegment>;
896
- durationSeconds: number;
860
+ bySegmentId: ReadonlyMap<string, ItineraryPaceSegment>;
861
+ durationSeconds: number;
897
862
  }
898
-
899
863
  /**
900
864
  * ItineraryPaceConfig is what one re-time is asked with, all of it replaceable mid-life through
901
865
  * {@link ItineraryPaceEngine.configure}.
902
866
  */
903
867
  interface ItineraryPaceConfig {
904
- /**
905
- * The client the re-time is asked through, or undefined while the host has none, in which case
906
- * the engine asks nothing and answers null.
907
- *
908
- * Required even so, because an engine without a client is silent: a key the caller has to
909
- * write makes forgetting it a compile error rather than a pace readout that never moves.
910
- *
911
- * Compared by identity. The client carries the credential, and with no `surface` named the
912
- * credential decides which copy is re-timed, so a replaced client drops every answer the
913
- * previous one gave and asks again: hand over the same object for as long as the credential
914
- * stands.
915
- */
916
- readonly client: Mountaya | undefined;
917
- /** The itinerary to re-time, or null while there is none. */
918
- readonly itineraryId: string | null;
919
- /**
920
- * The reader's own pace on level ground, in km/h, or null while no rate is set.
921
- *
922
- * km/h whatever the surface displays: it is the wire unit, so a surface showing mph, min/km or
923
- * min/mi converts before it gets here.
924
- */
925
- readonly speedKmh: number | null;
926
- /**
927
- * Which copy of the itinerary to re-time. Omitted, the credential decides, which is the draft
928
- * for a member; `"published"` re-times the last publication whoever asks.
929
- */
930
- readonly surface?: ItinerarySurface | undefined;
931
- /**
932
- * Which state of the itinerary the re-time is asked about: any value that differs whenever the
933
- * itinerary changed under the id it keeps, such as its last-update instant or a counter the
934
- * host steps on each edit.
935
- *
936
- * Two revisions are one when they are of one type and write the same text, which is what `===`
937
- * answers for every value but `NaN`: the number 1 and the string "1" are two revisions, and a
938
- * `NaN`, which `Date.parse` answers for an instant it cannot read, is one revision however
939
- * often it is handed.
940
- *
941
- * An answer is kept for one revision of its itinerary. A configuration that names another
942
- * revision drops the answers the engine kept for that itinerary, aborts its re-time in flight,
943
- * shows null and asks again, since a draft edited under the same id is another route at the
944
- * same rate. Omitted, the itinerary is taken as unchanged for as long as the client stands,
945
- * which holds for a publication and not for a draft a member is editing.
946
- */
947
- readonly revision?: string | number | undefined;
868
+ /**
869
+ * The client the re-time is asked through, or undefined while the host has none, in which case
870
+ * the engine asks nothing and answers null.
871
+ *
872
+ * Required even so, because an engine without a client is silent: a key the caller has to
873
+ * write makes forgetting it a compile error rather than a pace readout that never moves.
874
+ *
875
+ * Compared by identity. The client carries the credential, and with no `surface` named the
876
+ * credential decides which copy is re-timed, so a replaced client drops every answer the
877
+ * previous one gave and asks again: hand over the same object for as long as the credential
878
+ * stands.
879
+ */
880
+ readonly client: Mountaya | undefined;
881
+ /** The itinerary to re-time, or null while there is none. */
882
+ readonly itineraryId: string | null;
883
+ /**
884
+ * The reader's own pace on level ground, in km/h, or null while no rate is set.
885
+ *
886
+ * km/h whatever the surface displays: it is the wire unit, so a surface showing mph, min/km or
887
+ * min/mi converts before it gets here.
888
+ */
889
+ readonly speedKmh: number | null;
890
+ /**
891
+ * Which copy of the itinerary to re-time. Omitted, the credential decides, which is the draft
892
+ * for a member; `"published"` re-times the last publication whoever asks.
893
+ */
894
+ readonly surface?: ItinerarySurface | undefined;
895
+ /**
896
+ * Which state of the itinerary the re-time is asked about: any value that differs whenever the
897
+ * itinerary changed under the id it keeps, such as its last-update instant or a counter the
898
+ * host steps on each edit.
899
+ *
900
+ * Two revisions are one when they are of one type and write the same text, which is what `===`
901
+ * answers for every value but `NaN`: the number 1 and the string "1" are two revisions, and a
902
+ * `NaN`, which `Date.parse` answers for an instant it cannot read, is one revision however
903
+ * often it is handed.
904
+ *
905
+ * An answer is kept for one revision of its itinerary. A configuration that names another
906
+ * revision drops the answers the engine kept for that itinerary, aborts its re-time in flight,
907
+ * shows null and asks again, since a draft edited under the same id is another route at the
908
+ * same rate. Omitted, the itinerary is taken as unchanged for as long as the client stands,
909
+ * which holds for a publication and not for a draft a member is editing.
910
+ */
911
+ readonly revision?: string | number | undefined;
948
912
  }
949
913
  /**
950
914
  * ItineraryPaceEngineOptions is the {@link ItineraryPaceConfig} an engine starts with, plus the
951
915
  * one setting that is fixed for its life.
952
916
  */
953
917
  interface ItineraryPaceEngineOptions extends ItineraryPaceConfig {
954
- /**
955
- * How long a rate holds still before its re-time is asked for, in milliseconds. Zero asks at
956
- * once. A whole or fractional number from 0 to 2,147,483,647, the longest delay a timer
957
- * honours.
958
- *
959
- * @default 250
960
- */
961
- readonly debounceMs?: number | undefined;
918
+ /**
919
+ * How long a rate holds still before its re-time is asked for, in milliseconds. Zero asks at
920
+ * once. A whole or fractional number from 0 to 2,147,483,647, the longest delay a timer
921
+ * honours.
922
+ *
923
+ * @default 250
924
+ */
925
+ readonly debounceMs?: number | undefined;
962
926
  }
963
927
  /**
964
928
  * ItineraryPaceEngine resolves the reader's OWN pace into the re-timed figures a profile
@@ -1022,137 +986,136 @@ interface ItineraryPaceEngineOptions extends ItineraryPaceConfig {
1022
986
  * release();
1023
987
  * ```
1024
988
  */
1025
- declare class ItineraryPaceEngine {
1026
- private config;
1027
- private readonly debounceMs;
1028
- private snapshot;
1029
- /** The question the snapshot answers, or null while it is null. */
1030
- private shown;
1031
- private readonly listeners;
1032
- /**
1033
- * The answers the current client has given and the engine keeps, by their {@link paceKey}, in
1034
- * the order they were last read: the first is the least recently read.
1035
- */
1036
- private readonly answers;
1037
- /** The re-time on its way, or null. */
1038
- private inFlight;
1039
- private timer;
1040
- /** Whether nobody is watching. A parked engine asks for nothing. */
1041
- private parked;
1042
- private disposed;
1043
- /**
1044
- * Constructing one holds the options and does nothing else: no timer and no request. A React
1045
- * binding constructs during a render React is free to throw away, and a constructor with a
1046
- * side effect would leave the discarded copy asking.
1047
- *
1048
- * @throws {MountayaElementsError} When `debounceMs` is not a finite number from 0 to
1049
- * 2,147,483,647.
1050
- */
1051
- constructor(options: ItineraryPaceEngineOptions);
1052
- /** getSnapshot returns the current answer, by reference and stable between changes. */
1053
- getSnapshot(): ItineraryPaceResult | null;
1054
- /**
1055
- * subscribe registers a listener for every change of the snapshot, and returns its own
1056
- * unsubscribe.
1057
- *
1058
- * The first listener resumes the engine and the last one leaving parks it, which is the whole
1059
- * lifecycle a component can express correctly: React tears an effect down and sets it up again
1060
- * with the same object under StrictMode, so a latch here would leave a live surface bound to a
1061
- * dead engine. A binding hands its framework a STABLE `subscribe`; a fresh closure per render
1062
- * parks and resumes on every render.
1063
- *
1064
- * After {@link ItineraryPaceEngine.dispose} the listener is not held and is never told, and
1065
- * the function returned does nothing.
1066
- */
1067
- subscribe(listener: () => void): () => void;
1068
- /**
1069
- * configure replaces the configuration, and asks again only when the question changed.
1070
- *
1071
- * A binding calls it on every render, so it compares the question the configuration asks (the
1072
- * itinerary, its revision, the rate, the surface, and whether there is a client at all) and
1073
- * does nothing when that is unchanged and the client is the same object. A client replaced by
1074
- * another is a new question even when the rest is not: the credential it carries decides which
1075
- * copy a re-time without a surface answers for, so the answers the previous client gave are
1076
- * dropped, its request in flight is aborted, and the question is asked again through the new
1077
- * client. Another {@link ItineraryPaceConfig.revision} of the same itinerary is a new question
1078
- * too: the answers kept for that itinerary are dropped, its re-time in flight is aborted, and
1079
- * the snapshot is null until the answer lands.
1080
- *
1081
- * Parked or not, the snapshot is settled for the new configuration before this returns: the
1082
- * answer kept for it, the previous one across a rate step, or null. Only the request waits for a
1083
- * subscriber.
1084
- *
1085
- * After {@link ItineraryPaceEngine.dispose} it does nothing: the configuration is not taken and
1086
- * the snapshot stays the one the engine showed.
1087
- */
1088
- configure(config: ItineraryPaceConfig): void;
1089
- /**
1090
- * dispose drops the pending debounce and every listener and aborts the re-time in flight, for
1091
- * good.
1092
- *
1093
- * It changes nothing a reader holds: {@link ItineraryPaceEngine.getSnapshot} goes on returning
1094
- * the snapshot the engine showed when it was disposed, the answer included, and no listener is
1095
- * told. Idempotent, and every call after it is a no-op rather than an error: an owner torn
1096
- * down mid-step should not have to guard the calls it already queued.
1097
- */
1098
- dispose(): void;
1099
- /** request resolves the current configuration into the re-time it asks for, or null. */
1100
- private request;
1101
- /** readKept answers the answer kept for `key`, which becomes the most recently read. */
1102
- private readKept;
1103
- /**
1104
- * keep holds an answer as the most recently read, and drops the least recently read beyond
1105
- * {@link PACE_ANSWER_CAPACITY}.
1106
- */
1107
- private keep;
1108
- /**
1109
- * forgetOtherRevisions drops every answer kept for the itinerary `request` names under another
1110
- * revision than the one it names, two revisions being one as {@link revisionKey} writes them.
1111
- * Another itinerary's answers stay.
1112
- */
1113
- private forgetOtherRevisions;
1114
- /**
1115
- * schedule answers the current configuration: at once when it can, after the debounce
1116
- * otherwise. The re-time in flight for any other question is aborted first, and the previous
1117
- * answer stays on screen only across a rate step (see {@link isRateStep}). A parked engine
1118
- * answers as far as it can without asking, and its first subscriber asks the rest.
1119
- */
1120
- private schedule;
1121
- /**
1122
- * ask resolves one request, unless the same question is already on its way, in which case the
1123
- * answer that lands serves it.
1124
- */
1125
- private ask;
1126
- /**
1127
- * settle retires a re-time that has landed, and reports whether its answer still counts: false
1128
- * for one aborted before it landed, whatever its transport delivered.
1129
- */
1130
- private settle;
1131
- /**
1132
- * abandon aborts the re-time in flight unless it asks `keep`, the key the configuration asks
1133
- * for now; null keeps none.
1134
- */
1135
- private abandon;
1136
- /** isLive reports whether an answer for `key` is still the one the snapshot should show. */
1137
- private isLive;
1138
- private cancelPending;
1139
- /** commit shows `snapshot`, the answer to `answers`, and tells every listener when it changed. */
1140
- private commit;
989
+ export declare class ItineraryPaceEngine {
990
+ private config;
991
+ private readonly debounceMs;
992
+ private snapshot;
993
+ /** The question the snapshot answers, or null while it is null. */
994
+ private shown;
995
+ private readonly listeners;
996
+ /**
997
+ * The answers the current client has given and the engine keeps, by their {@link paceKey}, in
998
+ * the order they were last read: the first is the least recently read.
999
+ */
1000
+ private readonly answers;
1001
+ /** The re-time on its way, or null. */
1002
+ private inFlight;
1003
+ private timer;
1004
+ /** Whether nobody is watching. A parked engine asks for nothing. */
1005
+ private parked;
1006
+ private disposed;
1007
+ /**
1008
+ * Constructing one holds the options and does nothing else: no timer and no request. A React
1009
+ * binding constructs during a render React is free to throw away, and a constructor with a
1010
+ * side effect would leave the discarded copy asking.
1011
+ *
1012
+ * @throws {MountayaElementsError} When `debounceMs` is not a finite number from 0 to
1013
+ * 2,147,483,647.
1014
+ */
1015
+ constructor(options: ItineraryPaceEngineOptions);
1016
+ /** getSnapshot returns the current answer, by reference and stable between changes. */
1017
+ getSnapshot(): ItineraryPaceResult | null;
1018
+ /**
1019
+ * subscribe registers a listener for every change of the snapshot, and returns its own
1020
+ * unsubscribe.
1021
+ *
1022
+ * The first listener resumes the engine and the last one leaving parks it, which is the whole
1023
+ * lifecycle a component can express correctly: React tears an effect down and sets it up again
1024
+ * with the same object under StrictMode, so a latch here would leave a live surface bound to a
1025
+ * dead engine. A binding hands its framework a STABLE `subscribe`; a fresh closure per render
1026
+ * parks and resumes on every render.
1027
+ *
1028
+ * After {@link ItineraryPaceEngine.dispose} the listener is not held and is never told, and
1029
+ * the function returned does nothing.
1030
+ */
1031
+ subscribe(listener: () => void): () => void;
1032
+ /**
1033
+ * configure replaces the configuration, and asks again only when the question changed.
1034
+ *
1035
+ * A binding calls it on every render, so it compares the question the configuration asks (the
1036
+ * itinerary, its revision, the rate, the surface, and whether there is a client at all) and
1037
+ * does nothing when that is unchanged and the client is the same object. A client replaced by
1038
+ * another is a new question even when the rest is not: the credential it carries decides which
1039
+ * copy a re-time without a surface answers for, so the answers the previous client gave are
1040
+ * dropped, its request in flight is aborted, and the question is asked again through the new
1041
+ * client. Another {@link ItineraryPaceConfig.revision} of the same itinerary is a new question
1042
+ * too: the answers kept for that itinerary are dropped, its re-time in flight is aborted, and
1043
+ * the snapshot is null until the answer lands.
1044
+ *
1045
+ * Parked or not, the snapshot is settled for the new configuration before this returns: the
1046
+ * answer kept for it, the previous one across a rate step, or null. Only the request waits for a
1047
+ * subscriber.
1048
+ *
1049
+ * After {@link ItineraryPaceEngine.dispose} it does nothing: the configuration is not taken and
1050
+ * the snapshot stays the one the engine showed.
1051
+ */
1052
+ configure(config: ItineraryPaceConfig): void;
1053
+ /**
1054
+ * dispose drops the pending debounce and every listener and aborts the re-time in flight, for
1055
+ * good.
1056
+ *
1057
+ * It changes nothing a reader holds: {@link ItineraryPaceEngine.getSnapshot} goes on returning
1058
+ * the snapshot the engine showed when it was disposed, the answer included, and no listener is
1059
+ * told. Idempotent, and every call after it is a no-op rather than an error: an owner torn
1060
+ * down mid-step should not have to guard the calls it already queued.
1061
+ */
1062
+ dispose(): void;
1063
+ /** request resolves the current configuration into the re-time it asks for, or null. */
1064
+ private request;
1065
+ /** readKept answers the answer kept for `key`, which becomes the most recently read. */
1066
+ private readKept;
1067
+ /**
1068
+ * keep holds an answer as the most recently read, and drops the least recently read beyond
1069
+ * {@link PACE_ANSWER_CAPACITY}.
1070
+ */
1071
+ private keep;
1072
+ /**
1073
+ * forgetOtherRevisions drops every answer kept for the itinerary `request` names under another
1074
+ * revision than the one it names, two revisions being one as {@link revisionKey} writes them.
1075
+ * Another itinerary's answers stay.
1076
+ */
1077
+ private forgetOtherRevisions;
1078
+ /**
1079
+ * schedule answers the current configuration: at once when it can, after the debounce
1080
+ * otherwise. The re-time in flight for any other question is aborted first, and the previous
1081
+ * answer stays on screen only across a rate step (see {@link isRateStep}). A parked engine
1082
+ * answers as far as it can without asking, and its first subscriber asks the rest.
1083
+ */
1084
+ private schedule;
1085
+ /**
1086
+ * ask resolves one request, unless the same question is already on its way, in which case the
1087
+ * answer that lands serves it.
1088
+ */
1089
+ private ask;
1090
+ /**
1091
+ * settle retires a re-time that has landed, and reports whether its answer still counts: false
1092
+ * for one aborted before it landed, whatever its transport delivered.
1093
+ */
1094
+ private settle;
1095
+ /**
1096
+ * abandon aborts the re-time in flight unless it asks `keep`, the key the configuration asks
1097
+ * for now; null keeps none.
1098
+ */
1099
+ private abandon;
1100
+ /** isLive reports whether an answer for `key` is still the one the snapshot should show. */
1101
+ private isLive;
1102
+ private cancelPending;
1103
+ /** commit shows `snapshot`, the answer to `answers`, and tells every listener when it changed. */
1104
+ private commit;
1141
1105
  }
1142
-
1143
1106
  /**
1144
1107
  * ProfileMarkerEngineOptions is the one setting of a {@link ProfileMarkerEngine}, fixed for its
1145
1108
  * life.
1146
1109
  */
1147
1110
  interface ProfileMarkerEngineOptions {
1148
- /**
1149
- * The least time between two placements of the marker while the pointer stays on the chart,
1150
- * in milliseconds. Zero places it at every hover. A whole or fractional number from 0 to
1151
- * 2,147,483,647, the longest delay a timer honours.
1152
- *
1153
- * @default 60
1154
- */
1155
- readonly throttleMs?: number | undefined;
1111
+ /**
1112
+ * The least time between two placements of the marker while the pointer stays on the chart,
1113
+ * in milliseconds. Zero places it at every hover. A whole or fractional number from 0 to
1114
+ * 2,147,483,647, the longest delay a timer honours.
1115
+ *
1116
+ * @default 60
1117
+ */
1118
+ readonly throttleMs?: number | undefined;
1156
1119
  }
1157
1120
  /**
1158
1121
  * ProfileMarkerEngine decides where the map marker that follows the pointer along an elevation
@@ -1196,61 +1159,60 @@ interface ProfileMarkerEngineOptions {
1196
1159
  * release();
1197
1160
  * ```
1198
1161
  */
1199
- declare class ProfileMarkerEngine {
1200
- private readonly throttleMs;
1201
- private readonly listeners;
1202
- /** The sample the marker rests on, or null while it is cleared. */
1203
- private resting;
1204
- /** The hover waiting for the open window to end, or null while none waits. */
1205
- private held;
1206
- /** The window that is open, or null between two bursts. */
1207
- private timer;
1208
- private disposed;
1209
- /**
1210
- * The constructor reads its option and does nothing else: no timer starts until a hover is
1211
- * made under a listener.
1212
- *
1213
- * @throws {MountayaElementsError} When `throttleMs` is not a finite number from 0 to
1214
- * 2,147,483,647.
1215
- */
1216
- constructor(options?: ProfileMarkerEngineOptions);
1217
- /** getSnapshot answers the sample the marker rests on, or null while it is cleared. */
1218
- getSnapshot: () => ElevationPoint | null;
1219
- /**
1220
- * subscribe holds a listener until the release it returns is called, and tells it each time
1221
- * the marker moves or is cleared.
1222
- *
1223
- * The last listener to leave ends the open window and drops the held hover unwritten. After
1224
- * {@link ProfileMarkerEngine.dispose} the listener is not held and is never told, and the
1225
- * release does nothing.
1226
- */
1227
- subscribe: (listener: () => void) => (() => void);
1228
- /**
1229
- * hover takes one hover of the chart: the sample under the pointer, or null as the pointer
1230
- * leaves.
1231
- *
1232
- * A sample moves the marker at once when no window is open, and waits for the open window to
1233
- * end otherwise. Null clears the marker at once, whatever is held. After
1234
- * {@link ProfileMarkerEngine.dispose} it does nothing.
1235
- */
1236
- hover(point: ElevationPoint | null): void;
1237
- /**
1238
- * dispose ends the open window, drops the held hover and every listener, for good. The
1239
- * snapshot keeps the sample the marker rested on, no listener is told, and every later call
1240
- * does nothing. Calling it twice is safe.
1241
- */
1242
- dispose(): void;
1243
- /** rest moves the marker to `point` and tells the listeners, unless it rests there already. */
1244
- private rest;
1245
- /**
1246
- * openWindow starts the window a write opens, unless one is open already. With nobody
1247
- * listening, or with a throttle of zero, there is no rate to keep and no window.
1248
- */
1249
- private openWindow;
1250
- /** endWindow closes the open window, if any, and drops the hover it held. */
1251
- private endWindow;
1162
+ export declare class ProfileMarkerEngine {
1163
+ private readonly throttleMs;
1164
+ private readonly listeners;
1165
+ /** The sample the marker rests on, or null while it is cleared. */
1166
+ private resting;
1167
+ /** The hover waiting for the open window to end, or null while none waits. */
1168
+ private held;
1169
+ /** The window that is open, or null between two bursts. */
1170
+ private timer;
1171
+ private disposed;
1172
+ /**
1173
+ * The constructor reads its option and does nothing else: no timer starts until a hover is
1174
+ * made under a listener.
1175
+ *
1176
+ * @throws {MountayaElementsError} When `throttleMs` is not a finite number from 0 to
1177
+ * 2,147,483,647.
1178
+ */
1179
+ constructor(options?: ProfileMarkerEngineOptions);
1180
+ /** getSnapshot answers the sample the marker rests on, or null while it is cleared. */
1181
+ getSnapshot: () => ElevationPoint | null;
1182
+ /**
1183
+ * subscribe holds a listener until the release it returns is called, and tells it each time
1184
+ * the marker moves or is cleared.
1185
+ *
1186
+ * The last listener to leave ends the open window and drops the held hover unwritten. After
1187
+ * {@link ProfileMarkerEngine.dispose} the listener is not held and is never told, and the
1188
+ * release does nothing.
1189
+ */
1190
+ subscribe: (listener: () => void) => (() => void);
1191
+ /**
1192
+ * hover takes one hover of the chart: the sample under the pointer, or null as the pointer
1193
+ * leaves.
1194
+ *
1195
+ * A sample moves the marker at once when no window is open, and waits for the open window to
1196
+ * end otherwise. Null clears the marker at once, whatever is held. After
1197
+ * {@link ProfileMarkerEngine.dispose} it does nothing.
1198
+ */
1199
+ hover(point: ElevationPoint | null): void;
1200
+ /**
1201
+ * dispose ends the open window, drops the held hover and every listener, for good. The
1202
+ * snapshot keeps the sample the marker rested on, no listener is told, and every later call
1203
+ * does nothing. Calling it twice is safe.
1204
+ */
1205
+ dispose(): void;
1206
+ /** rest moves the marker to `point` and tells the listeners, unless it rests there already. */
1207
+ private rest;
1208
+ /**
1209
+ * openWindow starts the window a write opens, unless one is open already. With nobody
1210
+ * listening, or with a throttle of zero, there is no rate to keep and no window.
1211
+ */
1212
+ private openWindow;
1213
+ /** endWindow closes the open window, if any, and drops the hover it held. */
1214
+ private endWindow;
1252
1215
  }
1253
-
1254
1216
  /**
1255
1217
  * SegmentDraftContext is the part of a tool context a {@link SegmentDraftEngine} reads: the UI
1256
1218
  * store the segment edit session lives in, the client a routed edit resolves through, and the
@@ -1260,86 +1222,86 @@ declare class ProfileMarkerEngine {
1260
1222
  * already dispatches with.
1261
1223
  */
1262
1224
  interface SegmentDraftContext extends ToolBusContext {
1263
- /**
1264
- * Where the client a directions edit routes through and a freehand edit analyses through comes
1265
- * from. Absent, the editor is armed with neither resolver.
1266
- */
1267
- readonly api?: {
1268
- readonly client: Mountaya;
1269
- } | undefined;
1270
- /** The store holding the segment edit session the engine arms for and records into. */
1271
- readonly ui: UiStoreApi;
1225
+ /**
1226
+ * Where the client a directions edit routes through and a freehand edit analyses through comes
1227
+ * from. Absent, the editor is armed with neither resolver.
1228
+ */
1229
+ readonly api?: {
1230
+ readonly client: Mountaya;
1231
+ } | undefined;
1232
+ /** The store holding the segment edit session the engine arms for and records into. */
1233
+ readonly ui: UiStoreApi;
1272
1234
  }
1273
1235
  /**
1274
1236
  * SegmentDraftConfig is what a segment edit's drafts run against, all of it replaceable mid-life
1275
1237
  * through {@link SegmentDraftEngine.configure}.
1276
1238
  */
1277
1239
  interface SegmentDraftConfig {
1278
- /**
1279
- * The bus the via ceiling's warning is raised through, as `studio.alert.show`, and a session
1280
- * whose begin the map client refused is ended through, as `studio.itinerary.segment.editCancel`,
1281
- * then told of through, as `studio.alert.show` again.
1282
- *
1283
- * A bus that rejects a dispatch is held, so the engine leaves no rejection unhandled: a
1284
- * rejected cancel closes the refused session directly, and a rejected alert is dropped, since
1285
- * nothing follows one.
1286
- */
1287
- readonly bus: ToolBusDispatch<SegmentDraftContext, StudioToolInputs, StudioToolOutputs>;
1288
- /**
1289
- * The map client the edit is armed on and its drafts are read from, or null while there is no
1290
- * map, in which case nothing is armed.
1291
- *
1292
- * Required even so, because an engine without a client is silent: a key the caller has to write
1293
- * makes forgetting it a compile error rather than an edit that never arms.
1294
- *
1295
- * Compared by identity. A replaced client is armed afresh and read from then on, and the
1296
- * previous client's editor is left to the tool path, which owns every disposal.
1297
- */
1298
- readonly client: MapClient | null;
1299
- /**
1300
- * The live collaboration session the edit's live segment is handed to as the person drags, so
1301
- * a peer previews it. Null or omitted on an itinerary nobody else is editing. The session paces
1302
- * what it sends at its own rate, so every write the engine makes is handed over.
1303
- */
1304
- readonly collab?: {
1305
- /**
1306
- * Sends the draft a peer should preview for one entity: the edit's live segment. A
1307
- * session that relays any value, as `CollabEngine.sendDraft` does, fits.
1308
- */
1309
- readonly sendDraft: (entity: {
1310
- readonly id: string;
1311
- readonly kind: "segment";
1312
- }, draft: ItinerarySegment) => void;
1313
- } | null | undefined;
1314
- /**
1315
- * The tool context the edit runs in. Compared by identity: another context arms the open
1316
- * session again, since its client and its store may differ.
1317
- */
1318
- readonly context: SegmentDraftContext;
1319
- /**
1320
- * The words the via ceiling's warning and the route-hazard prompt are written in, and the
1321
- * sentence a refused begin is told in (`editing.segmentEditBeginFailed`).
1322
- */
1323
- readonly strings: Pick<StudioStrings, "editing">;
1240
+ /**
1241
+ * The bus the via ceiling's warning is raised through, as `studio.alert.show`, and a session
1242
+ * whose begin the map client refused is ended through, as `studio.itinerary.segment.editCancel`,
1243
+ * then told of through, as `studio.alert.show` again.
1244
+ *
1245
+ * A bus that rejects a dispatch is held, so the engine leaves no rejection unhandled: a
1246
+ * rejected cancel closes the refused session directly, and a rejected alert is dropped, since
1247
+ * nothing follows one.
1248
+ */
1249
+ readonly bus: ToolBusDispatch<SegmentDraftContext, StudioToolInputs, StudioToolOutputs>;
1250
+ /**
1251
+ * The map client the edit is armed on and its drafts are read from, or null while there is no
1252
+ * map, in which case nothing is armed.
1253
+ *
1254
+ * Required even so, because an engine without a client is silent: a key the caller has to write
1255
+ * makes forgetting it a compile error rather than an edit that never arms.
1256
+ *
1257
+ * Compared by identity. A replaced client is armed afresh and read from then on, and the
1258
+ * previous client's editor is left to the tool path, which owns every disposal.
1259
+ */
1260
+ readonly client: MapClient | null;
1261
+ /**
1262
+ * The live collaboration session the edit's live segment is handed to as the person drags, so
1263
+ * a peer previews it. Null or omitted on an itinerary nobody else is editing. The session paces
1264
+ * what it sends at its own rate, so every write the engine makes is handed over.
1265
+ */
1266
+ readonly collab?: {
1267
+ /**
1268
+ * Sends the draft a peer should preview for one entity: the edit's live segment. A
1269
+ * session that relays any value, as `CollabEngine.sendDraft` does, fits.
1270
+ */
1271
+ readonly sendDraft: (entity: {
1272
+ readonly id: string;
1273
+ readonly kind: "segment";
1274
+ }, draft: ItinerarySegment$1) => void;
1275
+ } | null | undefined;
1276
+ /**
1277
+ * The tool context the edit runs in. Compared by identity: another context arms the open
1278
+ * session again, since its client and its store may differ.
1279
+ */
1280
+ readonly context: SegmentDraftContext;
1281
+ /**
1282
+ * The words the via ceiling's warning and the route-hazard prompt are written in, and the
1283
+ * sentence a refused begin is told in (`editing.segmentEditBeginFailed`).
1284
+ */
1285
+ readonly strings: Pick<StudioStrings, "editing">;
1324
1286
  }
1325
1287
  /**
1326
1288
  * SegmentDraftEngineOptions is the {@link SegmentDraftConfig} an engine starts with, plus the one
1327
1289
  * setting that is fixed for its life.
1328
1290
  */
1329
1291
  interface SegmentDraftEngineOptions extends SegmentDraftConfig {
1330
- /**
1331
- * The window a burst of routed drafts is paced to before the live segment is written, in
1332
- * milliseconds. The first route of a burst is written at once and the last one on the window's
1333
- * trailing edge, so the profile never ends a step behind the geometry. Zero writes every route
1334
- * as it arrives. A whole or fractional number from 0 to 2,147,483,647, the longest delay a timer
1335
- * honours.
1336
- *
1337
- * The default is the rate a collaboration session sends the same live segment at, so a peer's
1338
- * preview advances as smoothly as the local profile.
1339
- *
1340
- * @default 60
1341
- */
1342
- readonly throttleMs?: number | undefined;
1292
+ /**
1293
+ * The window a burst of routed drafts is paced to before the live segment is written, in
1294
+ * milliseconds. The first route of a burst is written at once and the last one on the window's
1295
+ * trailing edge, so the profile never ends a step behind the geometry. Zero writes every route
1296
+ * as it arrives. A whole or fractional number from 0 to 2,147,483,647, the longest delay a timer
1297
+ * honours.
1298
+ *
1299
+ * The default is the rate a collaboration session sends the same live segment at, so a peer's
1300
+ * preview advances as smoothly as the local profile.
1301
+ *
1302
+ * @default 60
1303
+ */
1304
+ readonly throttleMs?: number | undefined;
1343
1305
  }
1344
1306
  /**
1345
1307
  * SegmentDraftEngineSnapshot is what a {@link SegmentDraftEngine} answers: whether a segment edit
@@ -1349,17 +1311,17 @@ interface SegmentDraftEngineOptions extends SegmentDraftConfig {
1349
1311
  * and never takes one edit's count for the next one's.
1350
1312
  */
1351
1313
  interface SegmentDraftEngineSnapshot {
1352
- /** Whether an edit is armed on the configured map client and its drafts are being read. */
1353
- readonly armed: boolean;
1354
- /** How the armed edit is authored, or null while nothing is armed. */
1355
- readonly mode: SegmentEditMode | null;
1356
- /** The segment the armed edit stands for, or null while nothing is armed. */
1357
- readonly segmentId: string | null;
1358
- /**
1359
- * The handles the armed edit's latest draft holds: the vias of a directions edit, the vertices
1360
- * of a freehand one. Zero until the first draft, and while nothing is armed.
1361
- */
1362
- readonly viaCount: number;
1314
+ /** Whether an edit is armed on the configured map client and its drafts are being read. */
1315
+ readonly armed: boolean;
1316
+ /** How the armed edit is authored, or null while nothing is armed. */
1317
+ readonly mode: SegmentEditMode | null;
1318
+ /** The segment the armed edit stands for, or null while nothing is armed. */
1319
+ readonly segmentId: string | null;
1320
+ /**
1321
+ * The handles the armed edit's latest draft holds: the vias of a directions edit, the vertices
1322
+ * of a freehand one. Zero until the first draft, and while nothing is armed.
1323
+ */
1324
+ readonly viaCount: number;
1363
1325
  }
1364
1326
  /**
1365
1327
  * SegmentDraftEngine is the machine behind a segment edit's drafts: it arms the map's segment
@@ -1440,173 +1402,172 @@ interface SegmentDraftEngineSnapshot {
1440
1402
  * release();
1441
1403
  * ```
1442
1404
  */
1443
- declare class SegmentDraftEngine {
1444
- private config;
1445
- private readonly throttleMs;
1446
- private snapshot;
1447
- private readonly subscriptions;
1448
- /** The store the session is watched in, and the subscription watching it, while running. */
1449
- private watching;
1450
- /** What the open edit was armed with, or null while nothing is armed. */
1451
- private arming;
1452
- /**
1453
- * What the map client refused to arm, or null. Held until the session it was for closes or one
1454
- * of its inputs changes, so a session on its way out is not handed to the map again. A park
1455
- * keeps it: the session it names is still on its way out when the next subscriber arrives.
1456
- */
1457
- private refused;
1458
- /** The subscription to the armed map's drafts, or null while nothing is armed. */
1459
- private listening;
1460
- /** The handles the armed edit's latest draft holds. */
1461
- private viaCount;
1462
- /** Whether a reconcile is running, so one a store write starts inside it runs after it. */
1463
- private reconciling;
1464
- /** Whether the store changed during the running reconcile, which then runs again. */
1465
- private stale;
1466
- /** Whether nobody is watching. A parked engine arms nothing and reads no draft. */
1467
- private parked;
1468
- private disposed;
1469
- /**
1470
- * One dialog per hazard question, however many routing round trips ask it. Held for the
1471
- * engine's life rather than per arming: a gate built beside the routing function would forget
1472
- * the dialog already on screen, which is the state it exists to track.
1473
- */
1474
- private readonly hazardGate;
1475
- /**
1476
- * The session's record of accepted hazards, read and written through the store the engine is
1477
- * configured with when the routing function asks. The store outlives every routing function
1478
- * the editor is armed with, which is the point: an answer outlives a re-arm.
1479
- */
1480
- private readonly hazardMemo;
1481
- /**
1482
- * Constructing one holds the options and does nothing else: nothing is armed, no store is read
1483
- * and nothing is written. A React binding constructs during a render React is free to throw
1484
- * away, and a constructor with a side effect would leave the discarded copy acting.
1485
- *
1486
- * @throws {MountayaElementsError} When `throttleMs` is not a finite number from 0 to
1487
- * 2,147,483,647.
1488
- */
1489
- constructor(options: SegmentDraftEngineOptions);
1490
- /** getSnapshot returns the current answer, by reference and stable between changes. */
1491
- getSnapshot(): SegmentDraftEngineSnapshot;
1492
- /**
1493
- * subscribe registers a listener for every change of the snapshot, and returns its own
1494
- * unsubscribe, which is idempotent.
1495
- *
1496
- * The first listener starts the engine and the last one leaving parks it, which is the whole
1497
- * lifecycle a component can express correctly: React tears an effect down and sets it up again
1498
- * with the same object under StrictMode, so a latch here would leave a live surface bound to a
1499
- * dead engine. Each call is its own subscription, so two owners subscribing one shared function
1500
- * each hold the engine until they release it.
1501
- */
1502
- subscribe(listener: () => void): () => void;
1503
- /**
1504
- * configure replaces the configuration, and arms again only when an arming input changed.
1505
- *
1506
- * A binding calls it on every render, so a configuration carrying the same client and the same
1507
- * context does nothing beyond the assignment: the bus, the collaboration session and the words
1508
- * are read when they are used. A parked engine keeps the configuration for its next subscriber.
1509
- */
1510
- configure(config: SegmentDraftConfig): void;
1511
- /**
1512
- * dispose parks the engine and drops every listener, for good.
1513
- *
1514
- * Idempotent, and every call after it is a no-op rather than an error: an owner torn down
1515
- * mid-edit should not have to guard the calls it already queued. A disposed engine writes no
1516
- * store either: the cancel it dispatched for a refused begin runs on the bus, and a session that
1517
- * cancel leaves open is not closed by the engine.
1518
- *
1519
- * The snapshot of a disposed engine reads `armed: false`. The engine holds a session and no
1520
- * answer to a question, so there is nothing a reader could keep showing: the session is over
1521
- * for this engine, and the snapshot says so.
1522
- */
1523
- dispose(): void;
1524
- /**
1525
- * reconcile brings the arming and the draft subscription in line with the store and the
1526
- * configuration, then publishes the snapshot. A store write it makes, or one a listener makes
1527
- * while it runs, runs it again once it finishes rather than inside it.
1528
- */
1529
- private reconcile;
1530
- /** step is one pass of {@link SegmentDraftEngine.reconcile}. */
1531
- private step;
1532
- /**
1533
- * endRefused ends the session whose begin the map client refused, and hands the refusal to the
1534
- * program.
1535
- *
1536
- * The session is ended by `studio.itinerary.segment.editCancel` through `bus`, the tool path
1537
- * that owns every disposal: it gives back the lock the begin took and ends whatever edit the map
1538
- * still holds. Where that tool does not answer `ok` (it is refused, it rejects, or the bus
1539
- * states no result at all), the store's session is closed directly, so no session stays open
1540
- * over a map that is editing nothing. A parked engine still closes it, since its surface may
1541
- * mount again. A disposed one writes nothing, as {@link SegmentDraftEngine.dispose} promises:
1542
- * the session is left to the engine that takes its place, which meets the same refusal.
1543
- *
1544
- * The refused session is the one closed directly, and no other: it is told by `mark`, its
1545
- * {@link segmentEditSessionMark}, so a session begun since on the same segment stays open.
1546
- *
1547
- * The refusal names the option the map lacked. It is a defect of the program that armed the
1548
- * session and not of the store write that woke the engine, so it leaves through
1549
- * {@link surfaceFault}.
1550
- *
1551
- * The reader is told as well, since an uncaught error says nothing on screen and the session
1552
- * closes under them: an `error` alert in the bundle's `editing.segmentEditBeginFailed`, read
1553
- * when the refusal is told so a locale change is heard. It is raised after the cancel is asked
1554
- * for, so a bus that answers one verb at a time ends the session first.
1555
- */
1556
- private endRefused;
1557
- /**
1558
- * raiseAlert raises one alert through the bus, and holds a bus that rejects it.
1559
- *
1560
- * Nothing follows an alert: the map has already declined what the alert reports, and a refused
1561
- * begin has reached the program through {@link surfaceFault} and is closed by its cancel. So a
1562
- * rejection is dropped, where one left unhandled would end a Node process with an error that is
1563
- * none of the package's.
1564
- */
1565
- private raiseAlert;
1566
- /** watch follows the store the session lives in, leaving the previous one if it changed. */
1567
- private watch;
1568
- private unwatch;
1569
- /** listen starts reading the armed map's drafts for the edit `key` names. */
1570
- private listen;
1571
- /**
1572
- * unlisten stops reading the map's drafts, drops the pending route, and clears the live segment,
1573
- * so a surface opened again over the session reads a clean slot until the next route lands.
1574
- */
1575
- private unlisten;
1576
- /** receive handles one draft the armed map reported, as the class docblock sets out. */
1577
- private receive;
1578
- /**
1579
- * project writes one route onto the live segment the profile reads, and hands the same segment
1580
- * to the collaboration session.
1581
- */
1582
- private project;
1583
- /**
1584
- * fallBack writes what the live segment is once a settled draft resolves no route: nothing for
1585
- * a persisted segment, which the profile then shows as saved, and the draft's synthetic
1586
- * segment for one drawn from scratch, which has no saved version to show and would otherwise
1587
- * lose its row until a route lands.
1588
- */
1589
- private fallBack;
1590
- /** refuseViaCap warns that a click was declined at the router's via ceiling. */
1591
- private refuseViaCap;
1592
- /**
1593
- * askAboutHazards puts a routed line's new hazards to the context's confirm gate, in the words
1594
- * the engine was last handed, and adopts the line when the context has no gate.
1595
- */
1596
- private askAboutHazards;
1597
- /**
1598
- * park stops watching and reading, and drops what the running engine armed.
1599
- *
1600
- * A refused arming is kept. Its session stays open until the cancel the engine asked for lands,
1601
- * and a surface mounted again meanwhile would otherwise hand it to the map a second time and ask
1602
- * for a second cancel, which closes whichever session is open when it runs. A session begun
1603
- * since holds a seed array of its own, so it never reads as the refused one.
1604
- */
1605
- private park;
1606
- /** publish settles the snapshot and tells every listener when it changed. */
1607
- private publish;
1405
+ export declare class SegmentDraftEngine {
1406
+ private config;
1407
+ private readonly throttleMs;
1408
+ private snapshot;
1409
+ private readonly subscriptions;
1410
+ /** The store the session is watched in, and the subscription watching it, while running. */
1411
+ private watching;
1412
+ /** What the open edit was armed with, or null while nothing is armed. */
1413
+ private arming;
1414
+ /**
1415
+ * What the map client refused to arm, or null. Held until the session it was for closes or one
1416
+ * of its inputs changes, so a session on its way out is not handed to the map again. A park
1417
+ * keeps it: the session it names is still on its way out when the next subscriber arrives.
1418
+ */
1419
+ private refused;
1420
+ /** The subscription to the armed map's drafts, or null while nothing is armed. */
1421
+ private listening;
1422
+ /** The handles the armed edit's latest draft holds. */
1423
+ private viaCount;
1424
+ /** Whether a reconcile is running, so one a store write starts inside it runs after it. */
1425
+ private reconciling;
1426
+ /** Whether the store changed during the running reconcile, which then runs again. */
1427
+ private stale;
1428
+ /** Whether nobody is watching. A parked engine arms nothing and reads no draft. */
1429
+ private parked;
1430
+ private disposed;
1431
+ /**
1432
+ * One dialog per hazard question, however many routing round trips ask it. Held for the
1433
+ * engine's life rather than per arming: a gate built beside the routing function would forget
1434
+ * the dialog already on screen, which is the state it exists to track.
1435
+ */
1436
+ private readonly hazardGate;
1437
+ /**
1438
+ * The session's record of accepted hazards, read and written through the store the engine is
1439
+ * configured with when the routing function asks. The store outlives every routing function
1440
+ * the editor is armed with, which is the point: an answer outlives a re-arm.
1441
+ */
1442
+ private readonly hazardMemo;
1443
+ /**
1444
+ * Constructing one holds the options and does nothing else: nothing is armed, no store is read
1445
+ * and nothing is written. A React binding constructs during a render React is free to throw
1446
+ * away, and a constructor with a side effect would leave the discarded copy acting.
1447
+ *
1448
+ * @throws {MountayaElementsError} When `throttleMs` is not a finite number from 0 to
1449
+ * 2,147,483,647.
1450
+ */
1451
+ constructor(options: SegmentDraftEngineOptions);
1452
+ /** getSnapshot returns the current answer, by reference and stable between changes. */
1453
+ getSnapshot(): SegmentDraftEngineSnapshot;
1454
+ /**
1455
+ * subscribe registers a listener for every change of the snapshot, and returns its own
1456
+ * unsubscribe, which is idempotent.
1457
+ *
1458
+ * The first listener starts the engine and the last one leaving parks it, which is the whole
1459
+ * lifecycle a component can express correctly: React tears an effect down and sets it up again
1460
+ * with the same object under StrictMode, so a latch here would leave a live surface bound to a
1461
+ * dead engine. Each call is its own subscription, so two owners subscribing one shared function
1462
+ * each hold the engine until they release it.
1463
+ */
1464
+ subscribe(listener: () => void): () => void;
1465
+ /**
1466
+ * configure replaces the configuration, and arms again only when an arming input changed.
1467
+ *
1468
+ * A binding calls it on every render, so a configuration carrying the same client and the same
1469
+ * context does nothing beyond the assignment: the bus, the collaboration session and the words
1470
+ * are read when they are used. A parked engine keeps the configuration for its next subscriber.
1471
+ */
1472
+ configure(config: SegmentDraftConfig): void;
1473
+ /**
1474
+ * dispose parks the engine and drops every listener, for good.
1475
+ *
1476
+ * Idempotent, and every call after it is a no-op rather than an error: an owner torn down
1477
+ * mid-edit should not have to guard the calls it already queued. A disposed engine writes no
1478
+ * store either: the cancel it dispatched for a refused begin runs on the bus, and a session that
1479
+ * cancel leaves open is not closed by the engine.
1480
+ *
1481
+ * The snapshot of a disposed engine reads `armed: false`. The engine holds a session and no
1482
+ * answer to a question, so there is nothing a reader could keep showing: the session is over
1483
+ * for this engine, and the snapshot says so.
1484
+ */
1485
+ dispose(): void;
1486
+ /**
1487
+ * reconcile brings the arming and the draft subscription in line with the store and the
1488
+ * configuration, then publishes the snapshot. A store write it makes, or one a listener makes
1489
+ * while it runs, runs it again once it finishes rather than inside it.
1490
+ */
1491
+ private reconcile;
1492
+ /** step is one pass of {@link SegmentDraftEngine.reconcile}. */
1493
+ private step;
1494
+ /**
1495
+ * endRefused ends the session whose begin the map client refused, and hands the refusal to the
1496
+ * program.
1497
+ *
1498
+ * The session is ended by `studio.itinerary.segment.editCancel` through `bus`, the tool path
1499
+ * that owns every disposal: it gives back the lock the begin took and ends whatever edit the map
1500
+ * still holds. Where that tool does not answer `ok` (it is refused, it rejects, or the bus
1501
+ * states no result at all), the store's session is closed directly, so no session stays open
1502
+ * over a map that is editing nothing. A parked engine still closes it, since its surface may
1503
+ * mount again. A disposed one writes nothing, as {@link SegmentDraftEngine.dispose} promises:
1504
+ * the session is left to the engine that takes its place, which meets the same refusal.
1505
+ *
1506
+ * The refused session is the one closed directly, and no other: it is told by `mark`, its
1507
+ * {@link segmentEditSessionMark}, so a session begun since on the same segment stays open.
1508
+ *
1509
+ * The refusal names the option the map lacked. It is a defect of the program that armed the
1510
+ * session and not of the store write that woke the engine, so it leaves through
1511
+ * {@link surfaceFault}.
1512
+ *
1513
+ * The reader is told as well, since an uncaught error says nothing on screen and the session
1514
+ * closes under them: an `error` alert in the bundle's `editing.segmentEditBeginFailed`, read
1515
+ * when the refusal is told so a locale change is heard. It is raised after the cancel is asked
1516
+ * for, so a bus that answers one verb at a time ends the session first.
1517
+ */
1518
+ private endRefused;
1519
+ /**
1520
+ * raiseAlert raises one alert through the bus, and holds a bus that rejects it.
1521
+ *
1522
+ * Nothing follows an alert: the map has already declined what the alert reports, and a refused
1523
+ * begin has reached the program through {@link surfaceFault} and is closed by its cancel. So a
1524
+ * rejection is dropped, where one left unhandled would end a Node process with an error that is
1525
+ * none of the package's.
1526
+ */
1527
+ private raiseAlert;
1528
+ /** watch follows the store the session lives in, leaving the previous one if it changed. */
1529
+ private watch;
1530
+ private unwatch;
1531
+ /** listen starts reading the armed map's drafts for the edit `key` names. */
1532
+ private listen;
1533
+ /**
1534
+ * unlisten stops reading the map's drafts, drops the pending route, and clears the live segment,
1535
+ * so a surface opened again over the session reads a clean slot until the next route lands.
1536
+ */
1537
+ private unlisten;
1538
+ /** receive handles one draft the armed map reported, as the class docblock sets out. */
1539
+ private receive;
1540
+ /**
1541
+ * project writes one route onto the live segment the profile reads, and hands the same segment
1542
+ * to the collaboration session.
1543
+ */
1544
+ private project;
1545
+ /**
1546
+ * fallBack writes what the live segment is once a settled draft resolves no route: nothing for
1547
+ * a persisted segment, which the profile then shows as saved, and the draft's synthetic
1548
+ * segment for one drawn from scratch, which has no saved version to show and would otherwise
1549
+ * lose its row until a route lands.
1550
+ */
1551
+ private fallBack;
1552
+ /** refuseViaCap warns that a click was declined at the router's via ceiling. */
1553
+ private refuseViaCap;
1554
+ /**
1555
+ * askAboutHazards puts a routed line's new hazards to the context's confirm gate, in the words
1556
+ * the engine was last handed, and adopts the line when the context has no gate.
1557
+ */
1558
+ private askAboutHazards;
1559
+ /**
1560
+ * park stops watching and reading, and drops what the running engine armed.
1561
+ *
1562
+ * A refused arming is kept. Its session stays open until the cancel the engine asked for lands,
1563
+ * and a surface mounted again meanwhile would otherwise hand it to the map a second time and ask
1564
+ * for a second cancel, which closes whichever session is open when it runs. A session begun
1565
+ * since holds a seed array of its own, so it never reads as the refused one.
1566
+ */
1567
+ private park;
1568
+ /** publish settles the snapshot and tells every listener when it changed. */
1569
+ private publish;
1608
1570
  }
1609
-
1610
1571
  /** The tools a zone form runs, by name. */
1611
1572
  type ZoneFormTool = "studio.alert.show" | "studio.zone.beginOriginPick" | "studio.zone.create" | "studio.zone.editBegin" | "studio.zone.editCommit" | "studio.zone.reachabilityPreview" | "studio.zone.setCreateMethod" | "studio.zone.setLevel" | "studio.zone.update";
1612
1573
  /**
@@ -1628,58 +1589,58 @@ type ZoneFormDispatch = <TName extends ZoneFormTool>(name: TName, input: StudioT
1628
1589
  * {@link ZoneFormEngine.configure}.
1629
1590
  */
1630
1591
  interface ZoneFormConfig {
1631
- /**
1632
- * The activity catalog. A reachability zone's activity is chosen from it, seeded from its first
1633
- * routable entry, and named from it. Empty while the host has not resolved one, in which case
1634
- * no activity is seeded.
1635
- *
1636
- * Compared by identity: a replaced catalog resolves a bound computed zone's stored activity
1637
- * again, and leaves an activity and a budget its reader moved.
1638
- */
1639
- readonly activities: readonly CategoryActivities[];
1640
- /**
1641
- * The organization a create is filed under when it inherits none from an open itinerary, or
1642
- * null to leave it personal until the reader picks one.
1643
- */
1644
- readonly defaultOrganizationId: string | null;
1645
- /** Runs the form's tools. Read when a tool is run, so the one configured last is the one used. */
1646
- readonly dispatch: ZoneFormDispatch;
1647
- /**
1648
- * The collections the open itinerary belongs to, by id, which a create begun inside that
1649
- * itinerary is filed into. Read only while such a create is open; empty otherwise, and while
1650
- * the host is still reading them.
1651
- */
1652
- readonly inheritedCollectionIds: readonly string[];
1653
- /** The reader's language, which a derived name's activity is named and lower-cased in. */
1654
- readonly language: MapLanguage;
1655
- /** The words a derived name and the collection warning are written in. */
1656
- readonly strings: Pick<StudioStrings, "zoneForm">;
1657
- /** The reader's user id, or null for a reader with none. A zone's creator may edit it. */
1658
- readonly userId: string | null;
1659
- /** The organizations the reader may write to. A member of a zone's organization may edit it. */
1660
- readonly writableOrganizationIds: ReadonlySet<string>;
1592
+ /**
1593
+ * The activity catalog. A reachability zone's activity is chosen from it, seeded from its first
1594
+ * routable entry, and named from it. Empty while the host has not resolved one, in which case
1595
+ * no activity is seeded.
1596
+ *
1597
+ * Compared by identity: a replaced catalog resolves a bound computed zone's stored activity
1598
+ * again, and leaves an activity and a budget its reader moved.
1599
+ */
1600
+ readonly activities: readonly CategoryActivities$1[];
1601
+ /**
1602
+ * The organization a create is filed under when it inherits none from an open itinerary, or
1603
+ * null to leave it personal until the reader picks one.
1604
+ */
1605
+ readonly defaultOrganizationId: string | null;
1606
+ /** Runs the form's tools. Read when a tool is run, so the one configured last is the one used. */
1607
+ readonly dispatch: ZoneFormDispatch;
1608
+ /**
1609
+ * The collections the open itinerary belongs to, by id, which a create begun inside that
1610
+ * itinerary is filed into. Read only while such a create is open; empty otherwise, and while
1611
+ * the host is still reading them.
1612
+ */
1613
+ readonly inheritedCollectionIds: readonly string[];
1614
+ /** The reader's language, which a derived name's activity is named and lower-cased in. */
1615
+ readonly language: MapLanguage;
1616
+ /** The words a derived name and the collection warning are written in. */
1617
+ readonly strings: Pick<StudioStrings, "zoneForm">;
1618
+ /** The reader's user id, or null for a reader with none. A zone's creator may edit it. */
1619
+ readonly userId: string | null;
1620
+ /** The organizations the reader may write to. A member of a zone's organization may edit it. */
1621
+ readonly writableOrganizationIds: ReadonlySet<string>;
1661
1622
  }
1662
1623
  /**
1663
1624
  * ZoneFormEngineOptions is the {@link ZoneFormConfig} an engine starts with, plus the settings
1664
1625
  * that are fixed for its life.
1665
1626
  */
1666
1627
  interface ZoneFormEngineOptions extends ZoneFormConfig {
1667
- /**
1668
- * How long a reachability zone's parameters hold still before their preview is asked for, in
1669
- * milliseconds. Zero asks at once. A whole or fractional number from 0 to 2,147,483,647, the
1670
- * longest delay a timer honours.
1671
- *
1672
- * @default 600
1673
- */
1674
- readonly debounceMs?: number | undefined;
1675
- /** Where the id of a zone about to be drawn comes from. */
1676
- readonly ids: StudioIds;
1677
- /**
1678
- * The store the form's zone lives in: the bound zone, the draw session, and the create's method
1679
- * and origin. Fixed for the engine's life, because the fields are seeded from it: another store
1680
- * is another form, and takes another engine.
1681
- */
1682
- readonly ui: UiStoreApi;
1628
+ /**
1629
+ * How long a reachability zone's parameters hold still before their preview is asked for, in
1630
+ * milliseconds. Zero asks at once. A whole or fractional number from 0 to 2,147,483,647, the
1631
+ * longest delay a timer honours.
1632
+ *
1633
+ * @default 600
1634
+ */
1635
+ readonly debounceMs?: number | undefined;
1636
+ /** Where the id of a zone about to be drawn comes from. */
1637
+ readonly ids: StudioIds;
1638
+ /**
1639
+ * The store the form's zone lives in: the bound zone, the draw session, and the create's method
1640
+ * and origin. Fixed for the engine's life, because the fields are seeded from it: another store
1641
+ * is another form, and takes another engine.
1642
+ */
1643
+ readonly ui: UiStoreApi;
1683
1644
  }
1684
1645
  /**
1685
1646
  * ZoneFormSnapshot is what a {@link ZoneFormEngine} answers: the form's fields, and what the form
@@ -1692,99 +1653,99 @@ interface ZoneFormEngineOptions extends ZoneFormConfig {
1692
1653
  * which a surface already holds, and a peer's lock or the co-pilot's turn are a surface's to read.
1693
1654
  */
1694
1655
  interface ZoneFormSnapshot {
1695
- /** Whether a draw or a reshape is armed on the map. */
1696
- readonly armed: boolean;
1697
- /** Whether the description is one the tools accept. */
1698
- readonly descriptionValid: boolean;
1699
- /**
1700
- * Why the latest {@link ZoneFormEngine.beginDraw} was refused, or null. A draw is refused when
1701
- * another edit is armed, when a collaborator holds the zone, or when the reader may not edit.
1702
- * It answers for the create the snapshot describes: it is cleared by the next `beginDraw`, once
1703
- * a draw or a reshape is armed, whoever arms it, and on every change that clears `saveFailure`
1704
- * for another form (another zone bound, the zone unbinding, another create, a create's other
1705
- * method, a create inheriting from elsewhere). A refusal that lands after one of those is
1706
- * dropped. Word it for a reader with `mapToolError`.
1707
- */
1708
- readonly drawFailure: ToolFailure | null;
1709
- /** The form's fields. Stable by reference until one of them changes. */
1710
- readonly fields: ZoneFormFields;
1711
- /**
1712
- * Whether the create takes its organization, activity and collections from the itinerary it was
1713
- * begun inside. The three follow that itinerary while it does, and an `edit` of one does not
1714
- * hold, so a surface names them and offers no picker for them.
1715
- */
1716
- readonly inherits: boolean;
1717
- /**
1718
- * How the zone is authored: a create reads the method it was opened with, and a saved zone is
1719
- * a reachability zone when it carries a query.
1720
- */
1721
- readonly method: ZoneCreateMethod;
1722
- /** Whether the name is one the tools accept. */
1723
- readonly nameValid: boolean;
1724
- /**
1725
- * Why the latest {@link ZoneFormEngine.beginOriginPick} was refused, or null. A pick is refused
1726
- * while an edit is armed, and when the reader may not edit. It answers for the form the snapshot
1727
- * describes: it is cleared by the next `beginOriginPick`, once an origin is placed or moved,
1728
- * whoever places it, and on every change that clears `saveFailure` for another form. A refusal
1729
- * that lands after one of those, or after a later pick was asked, is dropped. Word it for a
1730
- * reader with `mapToolError`.
1731
- */
1732
- readonly pickFailure: ToolFailure | null;
1733
- /**
1734
- * Why the latest reachability preview failed, or null. It answers for the zone the snapshot
1735
- * names and the query the fields state: it stands until a later preview answers, and it is
1736
- * dropped when the form's subject changes (another zone is bound or the zone unbinds, a create
1737
- * switches method, a create starts or stops inheriting from an itinerary or inherits from
1738
- * another one, or the create surface is entered again) and when the fields state no query at
1739
- * all (a drawn zone, no origin, no activity). A failure that lands after a change of subject
1740
- * is dropped too, whatever query the form then states. A reachability create is not ready to
1741
- * save while it stands. Word it for a reader with its `detail`, or with `mapToolError`.
1742
- */
1743
- readonly previewFailure: ToolFailure | null;
1744
- /**
1745
- * Why the latest save was refused, or null. It answers for the zone the snapshot names: it is
1746
- * cleared by the next save, by an edit of the name, the description or the window, and when
1747
- * the form's subject changes: another zone is bound or the zone unbinds, a create switches
1748
- * method, whoever switches it, a create starts or stops inheriting from an itinerary or
1749
- * inherits from another one, or the create surface is entered again. A refusal that lands
1750
- * after a change of subject is dropped. Word it for a reader with `mapToolError`.
1751
- *
1752
- * A refusal of the query a reachability form states is no failed save: it is `sourceFailure`.
1753
- */
1754
- readonly saveFailure: ToolFailure | null;
1755
- /**
1756
- * Whether there is anything to persist at all: a reachability create, an armed draw or reshape,
1757
- * or a saved zone whose metadata or parameters moved. A surface shows no Save without it.
1758
- */
1759
- readonly saveOffered: boolean;
1760
- /**
1761
- * Whether {@link ZoneFormEngine.save} is worth calling now: no save is in flight, the name, the
1762
- * description and the window are valid, and something is unsaved. A reachability create is
1763
- * ready once its query resolves and its preview has not failed.
1764
- */
1765
- readonly saveReady: boolean;
1766
- /**
1767
- * Whether a save of the form the snapshot describes is in flight. A save sent for another zone,
1768
- * or for a create the form has left, is not this form's: it reads false here and holds back no
1769
- * save of this one.
1770
- */
1771
- readonly saving: boolean;
1772
- /**
1773
- * Why the latest save's reachability query was refused, or null: the API computed an area
1774
- * from the query and cannot store it as a zone, or refuses the query itself. A surface shows
1775
- * it where the query's fields are, since changing one of them is what answers it. Word it for
1776
- * a reader with `mapToolError`, which reads the API's own sentence.
1777
- *
1778
- * It answers for the query that was sent: it is read only while the fields state that query,
1779
- * so it leaves when the origin, the activity, the measure, the budget or the pace moves. The
1780
- * next save clears it, and so does every change of subject that clears `saveFailure`. A form
1781
- * that states no query, a drawn zone's, keeps such a refusal as its `saveFailure`.
1782
- */
1783
- readonly sourceFailure: ToolFailure | null;
1784
- /** Whether the availability window is one the tools accept: no start after its end. */
1785
- readonly windowValid: boolean;
1786
- /** The saved zone the fields answer for, or null while the form creates one. */
1787
- readonly zoneId: string | null;
1656
+ /** Whether a draw or a reshape is armed on the map. */
1657
+ readonly armed: boolean;
1658
+ /** Whether the description is one the tools accept. */
1659
+ readonly descriptionValid: boolean;
1660
+ /**
1661
+ * Why the latest {@link ZoneFormEngine.beginDraw} was refused, or null. A draw is refused when
1662
+ * another edit is armed, when a collaborator holds the zone, or when the reader may not edit.
1663
+ * It answers for the create the snapshot describes: it is cleared by the next `beginDraw`, once
1664
+ * a draw or a reshape is armed, whoever arms it, and on every change that clears `saveFailure`
1665
+ * for another form (another zone bound, the zone unbinding, another create, a create's other
1666
+ * method, a create inheriting from elsewhere). A refusal that lands after one of those is
1667
+ * dropped. Word it for a reader with `mapToolError`.
1668
+ */
1669
+ readonly drawFailure: ToolFailure | null;
1670
+ /** The form's fields. Stable by reference until one of them changes. */
1671
+ readonly fields: ZoneFormFields;
1672
+ /**
1673
+ * Whether the create takes its organization, activity and collections from the itinerary it was
1674
+ * begun inside. The three follow that itinerary while it does, and an `edit` of one does not
1675
+ * hold, so a surface names them and offers no picker for them.
1676
+ */
1677
+ readonly inherits: boolean;
1678
+ /**
1679
+ * How the zone is authored: a create reads the method it was opened with, and a saved zone is
1680
+ * a reachability zone when it carries a query.
1681
+ */
1682
+ readonly method: ZoneCreateMethod;
1683
+ /** Whether the name is one the tools accept. */
1684
+ readonly nameValid: boolean;
1685
+ /**
1686
+ * Why the latest {@link ZoneFormEngine.beginOriginPick} was refused, or null. A pick is refused
1687
+ * while an edit is armed, and when the reader may not edit. It answers for the form the snapshot
1688
+ * describes: it is cleared by the next `beginOriginPick`, once an origin is placed or moved,
1689
+ * whoever places it, and on every change that clears `saveFailure` for another form. A refusal
1690
+ * that lands after one of those, or after a later pick was asked, is dropped. Word it for a
1691
+ * reader with `mapToolError`.
1692
+ */
1693
+ readonly pickFailure: ToolFailure | null;
1694
+ /**
1695
+ * Why the latest reachability preview failed, or null. It answers for the zone the snapshot
1696
+ * names and the query the fields state: it stands until a later preview answers, and it is
1697
+ * dropped when the form's subject changes (another zone is bound or the zone unbinds, a create
1698
+ * switches method, a create starts or stops inheriting from an itinerary or inherits from
1699
+ * another one, or the create surface is entered again) and when the fields state no query at
1700
+ * all (a drawn zone, no origin, no activity). A failure that lands after a change of subject
1701
+ * is dropped too, whatever query the form then states. A reachability create is not ready to
1702
+ * save while it stands. Word it for a reader with its `detail`, or with `mapToolError`.
1703
+ */
1704
+ readonly previewFailure: ToolFailure | null;
1705
+ /**
1706
+ * Why the latest save was refused, or null. It answers for the zone the snapshot names: it is
1707
+ * cleared by the next save, by an edit of the name, the description or the window, and when
1708
+ * the form's subject changes: another zone is bound or the zone unbinds, a create switches
1709
+ * method, whoever switches it, a create starts or stops inheriting from an itinerary or
1710
+ * inherits from another one, or the create surface is entered again. A refusal that lands
1711
+ * after a change of subject is dropped. Word it for a reader with `mapToolError`.
1712
+ *
1713
+ * A refusal of the query a reachability form states is no failed save: it is `sourceFailure`.
1714
+ */
1715
+ readonly saveFailure: ToolFailure | null;
1716
+ /**
1717
+ * Whether there is anything to persist at all: a reachability create, an armed draw or reshape,
1718
+ * or a saved zone whose metadata or parameters moved. A surface shows no Save without it.
1719
+ */
1720
+ readonly saveOffered: boolean;
1721
+ /**
1722
+ * Whether {@link ZoneFormEngine.save} is worth calling now: no save is in flight, the name, the
1723
+ * description and the window are valid, and something is unsaved. A reachability create is
1724
+ * ready once its query resolves and its preview has not failed.
1725
+ */
1726
+ readonly saveReady: boolean;
1727
+ /**
1728
+ * Whether a save of the form the snapshot describes is in flight. A save sent for another zone,
1729
+ * or for a create the form has left, is not this form's: it reads false here and holds back no
1730
+ * save of this one.
1731
+ */
1732
+ readonly saving: boolean;
1733
+ /**
1734
+ * Why the latest save's reachability query was refused, or null: the API computed an area
1735
+ * from the query and cannot store it as a zone, or refuses the query itself. A surface shows
1736
+ * it where the query's fields are, since changing one of them is what answers it. Word it for
1737
+ * a reader with `mapToolError`, which reads the API's own sentence.
1738
+ *
1739
+ * It answers for the query that was sent: it is read only while the fields state that query,
1740
+ * so it leaves when the origin, the activity, the measure, the budget or the pace moves. The
1741
+ * next save clears it, and so does every change of subject that clears `saveFailure`. A form
1742
+ * that states no query, a drawn zone's, keeps such a refusal as its `saveFailure`.
1743
+ */
1744
+ readonly sourceFailure: ToolFailure | null;
1745
+ /** Whether the availability window is one the tools accept: no start after its end. */
1746
+ readonly windowValid: boolean;
1747
+ /** The saved zone the fields answer for, or null while the form creates one. */
1748
+ readonly zoneId: string | null;
1788
1749
  }
1789
1750
  /**
1790
1751
  * ZoneFormEngine is the machine behind a zone form: it holds the form's fields, seeds them from
@@ -1881,336 +1842,335 @@ interface ZoneFormSnapshot {
1881
1842
  * release();
1882
1843
  * ```
1883
1844
  */
1884
- declare class ZoneFormEngine {
1885
- private config;
1886
- private readonly debounceMs;
1887
- private readonly ids;
1888
- private readonly ui;
1889
- private readonly draft;
1890
- /** Whether the name is the reader's own, which stops it following anything. */
1891
- private nameTouched;
1892
- /** Whether the organization is the reader's own choice, null included, which no default fills. */
1893
- private organizationChosen;
1894
- /** The subjects a save is in flight for. A subject saves once at a time, and each on its own. */
1895
- private readonly saving;
1896
- /** Whether a draw has been asked for and not answered yet. */
1897
- private drawing;
1898
- private drawFailure;
1899
- private pickFailure;
1900
- /** Counts the origin picks asked for: the refusal of an earlier one is dropped. */
1901
- private pickSerial;
1902
- /** The origin the last seed read, which a pick that lands moves; undefined until the first. */
1903
- private origin;
1904
- private saveFailure;
1905
- /**
1906
- * The latest save's refusal of its reachability query, with the query it was sent with, as
1907
- * {@link queryKeyOf} writes it; null when the latest save met none.
1908
- */
1909
- private sourceRefusal;
1910
- private previewFailure;
1911
- /** Whether the store's `zoneFormUnsaved` holds this engine's true, written by it. */
1912
- private unsavedWritten;
1913
- /**
1914
- * Whether the reader changed anything since the subject opened: typed a field, switched the
1915
- * method or picked an origin. A computed create opens saveable on what it was opened with, and
1916
- * leaving it untouched loses nothing the reader did, so it is unsaved only once this holds.
1917
- */
1918
- private touched;
1919
- /** The zone the metadata was seeded from; undefined until the first seed. */
1920
- private bound;
1921
- /**
1922
- * What the failures and a save in flight answer for: the bound zone, or a create, by its
1923
- * serial, the method it is authored by and the itinerary it inherits from. Null until the
1924
- * first seed.
1925
- */
1926
- private subject;
1927
- /**
1928
- * Counts the subjects a save or a draw can answer for: a refusal sent under an earlier one is
1929
- * dropped.
1930
- */
1931
- private subjectEpoch;
1932
- /**
1933
- * The create the fields were last seeded for: its serial and the id of the itinerary it
1934
- * inherits from, and undefined while a zone is bound and before the first seed.
1935
- */
1936
- private create;
1937
- /** The serial of the create the fields were last seeded for, while the last seed was a create. */
1938
- private createSerial;
1939
- /** The zone and the catalog the reachability parameters were last seeded from. */
1940
- private sourceSeed;
1941
- /** The store state and the configuration the snapshot was last settled against. */
1942
- private settled;
1943
- /**
1944
- * The name and the description last judged, with the verdicts, so a pass that moved neither
1945
- * parses nothing.
1946
- */
1947
- private judged;
1948
- private snapshot;
1949
- private readonly subscriptions;
1950
- /** Ends the watch on the store, while running. */
1951
- private unwatch;
1952
- /** The key of the preview asked for or waited on; undefined when none has been considered. */
1953
- private previewKey;
1954
- /** The preview the pending debounce asks for. */
1955
- private previewInput;
1956
- /**
1957
- * Counts the questions a preview can answer, and the subjects it can answer for: an answer
1958
- * from an earlier one is ignored.
1959
- */
1960
- private previewEpoch;
1961
- private timer;
1962
- /** Whether a reconcile is running, so one started inside it runs after it. */
1963
- private reconciling;
1964
- /** Whether something changed during the running reconcile, which then runs again. */
1965
- private stale;
1966
- /**
1967
- * Whether nobody is watching. A parked engine watches no store, asks for no preview and answers
1968
- * no command.
1969
- */
1970
- private parked;
1971
- private disposed;
1972
- /**
1973
- * Constructing one holds the options and does nothing else: no store is read, no timer armed
1974
- * and no tool run. A React binding constructs during a render React is free to throw away, and
1975
- * a constructor with a side effect would leave the discarded copy acting.
1976
- *
1977
- * @throws {MountayaElementsError} When `debounceMs` is not a finite number from 0 to
1978
- * 2,147,483,647.
1979
- */
1980
- constructor(options: ZoneFormEngineOptions);
1981
- /**
1982
- * getSnapshot returns the current answer, by reference and stable between changes.
1983
- *
1984
- * A parked engine settles it on the read: it reads the store and seeds the fields for the zone
1985
- * bound now, without watching the store, arming a timer or running a tool. So a surface's first
1986
- * render, and a server's only one, show the bound zone.
1987
- */
1988
- getSnapshot(): ZoneFormSnapshot;
1989
- /**
1990
- * subscribe registers a listener for every change of the snapshot, and returns its own
1991
- * unsubscribe, which is idempotent.
1992
- *
1993
- * The first listener starts the engine and the last one leaving parks it, which is the whole
1994
- * lifecycle a component can express correctly: React tears an effect down and sets it up again
1995
- * with the same object under StrictMode, so a latch here would leave a live surface bound to a
1996
- * dead engine. Each call is its own subscription, so two owners subscribing one shared function
1997
- * each hold the engine until they release it.
1998
- */
1999
- subscribe(listener: () => void): () => void;
2000
- /**
2001
- * configure replaces the configuration, and settles the form again only when a member changed.
2002
- *
2003
- * A binding calls it on every render, so it compares every member by identity and does nothing
2004
- * when all are the ones it holds. A changed one seeds what waited on it: a catalog that
2005
- * arrives seeds the activity, collections that arrive are followed, and a name still following
2006
- * its parameters is written again in the new language. A parked engine keeps the configuration
2007
- * for its next read.
2008
- */
2009
- configure(config: ZoneFormConfig): void;
2010
- /**
2011
- * dispose parks the engine and drops every listener, for good.
2012
- *
2013
- * Idempotent, and every call after it is a no-op rather than an error: an owner torn down
2014
- * mid-save should not have to guard the calls it already queued. A save in flight still reaches
2015
- * the tool it was sent to; its answer changes nothing here.
2016
- */
2017
- dispose(): void;
2018
- /**
2019
- * edit writes the given fields, and applies the rule each one carries:
2020
- *
2021
- * - `name` makes the name the reader's own, so it stops following the parameters. On a create
2022
- * whose draft a proposal named it also clears that name from the draft, so the one typed is
2023
- * shown.
2024
- * - `name`, `description`, `startAt` and `endAt` clear the previous save's failure.
2025
- * - `windowOpen: false` clears both bounds, so a hidden window never persists a constraint its
2026
- * reader cannot see.
2027
- * - `rangeType` resets `range` to that measure's default and never reinterprets the number,
2028
- * and a switch to `"distance"` drops the pace, which a distance does not depend on.
2029
- * - `speedKmh` holds beside a time budget only: on a distance budget it is dropped, so a later
2030
- * switch to `"time"` starts from the activity's own pace.
2031
- * - `organizationId` makes the organization the reader's own choice, `null` included: a create
2032
- * then stays personal beside a `defaultOrganizationId`. On a create whose draft a proposal
2033
- * filed, or whose draw was armed under another, it is also written on the draft, so the one
2034
- * picked is shown and saved.
2035
- * - `level`, while a draw is armed, also runs `studio.zone.setLevel`, which recolours the draft.
2036
- * A refusal leaves the draft as it was, and the form goes back to the severity it held. On a
2037
- * create it is also written on the store (`zoneCreatePickedLevel`), which the step of a
2038
- * proposal that joins the create records, so an undo of the proposal shows it again.
2039
- *
2040
- * `rangeType` and `windowOpen` are applied before the fields they reset, so an edit naming both
2041
- * keeps the value it names. `mode` is the shape a draw is armed with; once armed, and for a
2042
- * saved zone, the snapshot shows the session's or the zone's own. While the snapshot's
2043
- * `inherits` is true, `organizationId`, `activityId` and `collectionIds` follow the itinerary
2044
- * and an edit of one does not hold.
2045
- *
2046
- * A call while parked, or after {@link ZoneFormEngine.dispose}, does nothing.
2047
- */
2048
- edit(fields: Partial<ZoneFormFields>): void;
2049
- /**
2050
- * ask runs one tool and answers its result, or null where the host's bus rejected the call.
2051
- *
2052
- * A tool bus's dispatch never rejects, and a host's own may. A call it rejects made no answer:
2053
- * the rejection is held here, so none is left unhandled by a call the form does not await, and
2054
- * the caller goes on as it does for a tool that did nothing. A save is awaited by its caller
2055
- * and is not asked through here: its rejection is the caller's to read.
2056
- */
2057
- private ask;
2058
- /**
2059
- * recolour sets the armed draft's severity, through `studio.zone.setLevel`. A refusal leaves
2060
- * the draft painted as it was, and so does a call the bus rejects, so the form goes back to the
2061
- * severity it held and a create's pick to the one the store held, unless its reader has chosen
2062
- * another since or the form answers for another subject by then.
2063
- */
2064
- private recolour;
2065
- /**
2066
- * setMethod switches how a create is authored, through `studio.zone.setCreateMethod`, and
2067
- * clears the preview's and the save's failures, which described the method left behind. The
2068
- * same two are cleared when another caller of that tool switches it. A switch the tool refuses
2069
- * left no method behind: the two failures stand again, for as long as the form answers for the
2070
- * same create. A call while parked, or after {@link ZoneFormEngine.dispose}, does nothing.
2071
- */
2072
- setMethod(method: ZoneCreateMethod): void;
2073
- /** switchMethod asks for the switch, and puts back what it cleared when the tool refuses. */
2074
- private switchMethod;
2075
- /**
2076
- * beginOriginPick arms the map for the click that places a reachability zone's origin, through
2077
- * `studio.zone.beginOriginPick`.
2078
- *
2079
- * A refusal is kept as the snapshot's `pickFailure`, for as long as the form answers for the
2080
- * create or the zone the pick was asked for and no later pick was asked.
2081
- *
2082
- * A call while parked, or after {@link ZoneFormEngine.dispose}, does nothing.
2083
- */
2084
- beginOriginPick(): void;
2085
- /** pick asks for the origin pick, and keeps a refusal while it is the latest and its form's. */
2086
- private pick;
2087
- /**
2088
- * beginDraw arms the map to draw a new zone, through `studio.zone.editBegin`, in the form's
2089
- * shape and severity and under its organization. The zone's id is minted by the `ids` seam: a
2090
- * zone cannot persist empty, so the draw session needs a handle before there is a zone to name.
2091
- *
2092
- * A refusal is kept as the snapshot's `drawFailure`, for as long as the form answers for the
2093
- * create the draw was asked for.
2094
- *
2095
- * It does nothing while a zone is bound, while a draw or a reshape is armed, while an earlier
2096
- * call is still unanswered, while no shape is chosen, while parked, or after
2097
- * {@link ZoneFormEngine.dispose}.
2098
- */
2099
- beginDraw(): void;
2100
- /** draw asks for the draw session, and keeps a refusal while its create is the form's. */
2101
- private draw;
2102
- /**
2103
- * save persists the form through the one tool call {@link zoneSaveRequest} routes it to, and
2104
- * resolves once the tool has answered. It resolves at once, having sent nothing, when a save
2105
- * of the same zone or the same create is already in flight, when the form has nothing to
2106
- * send, while parked, and after {@link ZoneFormEngine.dispose}. A save in flight for another
2107
- * zone holds back no save of this one.
2108
- *
2109
- * A refusal is kept as the snapshot's `saveFailure` and the fields stay as typed, so a retry is
2110
- * one more call. A refusal that lands once the form answers for another zone, or once a create
2111
- * has switched method or changed the itinerary it inherits from, is dropped: it describes a
2112
- * form nobody is looking at. One that lands once the form has come back to the zone or the
2113
- * create it was sent for is kept, since the snapshot read `saving` for it all along. A refusal
2114
- * of the reachability query the fields stated as the save left is kept as the snapshot's
2115
- * `sourceFailure` instead, for the surface to show at the query's fields. A create
2116
- * that lost some of its collections raises a warning through `studio.alert.show`: the zone
2117
- * exists, and the reader should know where it was not filed.
2118
- *
2119
- * It never rejects while `dispatch` does not.
2120
- */
2121
- save(): Promise<void>;
2122
- /** run dispatches a save request, each arm with its own tool's input. */
2123
- private run;
2124
- /** saveRequest routes the form as it stands to the tool call that persists it, or to null. */
2125
- private saveRequest;
2126
- /** statedSource is the reachability query the fields state as the store stands, or null. */
2127
- private statedSource;
2128
- /**
2129
- * publishUnsaved writes whether the form holds something unsaved on the store's
2130
- * `zoneFormUnsaved`, where `studio.zone.publish` and the publication band read it, when that
2131
- * answer moved. A parked engine writes nothing: its reads run inside a render, and a form
2132
- * nobody watches holds nothing for anyone to lose.
2133
- *
2134
- * The store hears of the write at once, and so does this engine's own watch, which finds no slot
2135
- * it reads moved and runs no pass.
2136
- */
2137
- private publishUnsaved;
2138
- /**
2139
- * park stops watching the store, drops the pending preview and forgets the one in flight. The
2140
- * unsaved answer it wrote is taken back: a form that unmounts holds nothing any more.
2141
- */
2142
- private park;
2143
- /** settle brings a parked engine's snapshot in line with the store and the configuration. */
2144
- private settle;
2145
- /**
2146
- * watch answers one notification of the store: it runs a pass when a slot the form reads
2147
- * moved, and nothing otherwise, so a hover or a selection costs the form one comparison.
2148
- */
2149
- private watch;
2150
- /**
2151
- * reconcile seeds the fields from the store and the configuration, publishes the snapshot and
2152
- * follows the preview it is worth. A change made while it runs, by a listener or by a tool a
2153
- * preview runs at once, runs it again once it finishes rather than inside it.
2154
- */
2155
- private reconcile;
2156
- /** seed brings the fields in line with the bound zone, the create's context and the catalog. */
2157
- private seed;
2158
- /**
2159
- * seedParameters brings the reachability parameters in line with the query `zone` is stored
2160
- * with and with the catalog, and drops an activity the catalog lists no more.
2161
- */
2162
- private seedParameters;
2163
- /**
2164
- * seedMetadata seeds what a zone says from `zone`, and from a create's defaults for none: the
2165
- * name, the description, the window and the severity.
2166
- */
2167
- private seedMetadata;
2168
- /**
2169
- * follow brings the fields in line with the bound zone written again: `previous` is what it
2170
- * said and `next` what it says now.
2171
- *
2172
- * A field the reader has not moved off what the zone said takes what it says now, and so does
2173
- * one that already says it, which is how the reader's own save lands in its stored spelling.
2174
- * Any other is what the reader typed and has not saved, and stays. The window is one answer,
2175
- * its bounds and whether it is open, taken whole from the reader once they moved any of it,
2176
- * so no bound a collaborator chose is ever paired with one the reader did.
2177
- *
2178
- * The severity of a reshape armed on the zone is shown over the form's own, so it follows by
2179
- * the same rule: while `session` still paints the severity the zone said, it is set to the one
2180
- * the zone says now, through `studio.zone.setLevel`. One the reader moved is theirs and stays.
2181
- * Left as it was, the form would read unsaved after a collaborator's change of severity, and
2182
- * its save would write the old one back.
2183
- */
2184
- private follow;
2185
- /**
2186
- * resetCreate returns the fields a create seeds for itself to a create's defaults: where it is
2187
- * filed, the shape it is drawn in and the parameters it is computed from. What the zone says
2188
- * is seeded from the zone, bound or not.
2189
- */
2190
- private resetCreate;
2191
- /** activityName is the chosen activity's name in the reader's language, or null. */
2192
- private activityName;
2193
- /** sourceFor is the reachability query the fields state under `facts`, or null. */
2194
- private sourceFor;
2195
- /** view reads the form as it stands under `facts`. */
2196
- private view;
2197
- /**
2198
- * judge holds a name and a description to the bounds the tools hold them to. It parses only a
2199
- * text it has not just judged, so a pass that moved neither, a drag's every frame among them,
2200
- * parses nothing.
2201
- */
2202
- private judge;
2203
- /** commit publishes `next` when it differs from the snapshot, and tells every listener. */
2204
- private commit;
2205
- /**
2206
- * followPreview asks for the preview `view` is worth, after the debounce, unless that very
2207
- * preview is already asked for or waited on. A parked engine asks for none.
2208
- */
2209
- private followPreview;
2210
- /** askPreview runs the preview waited on, and keeps its answer while its question stands. */
2211
- private askPreview;
2212
- private cancelPending;
1845
+ export declare class ZoneFormEngine {
1846
+ private config;
1847
+ private readonly debounceMs;
1848
+ private readonly ids;
1849
+ private readonly ui;
1850
+ private readonly draft;
1851
+ /** Whether the name is the reader's own, which stops it following anything. */
1852
+ private nameTouched;
1853
+ /** Whether the organization is the reader's own choice, null included, which no default fills. */
1854
+ private organizationChosen;
1855
+ /** The subjects a save is in flight for. A subject saves once at a time, and each on its own. */
1856
+ private readonly saving;
1857
+ /** Whether a draw has been asked for and not answered yet. */
1858
+ private drawing;
1859
+ private drawFailure;
1860
+ private pickFailure;
1861
+ /** Counts the origin picks asked for: the refusal of an earlier one is dropped. */
1862
+ private pickSerial;
1863
+ /** The origin the last seed read, which a pick that lands moves; undefined until the first. */
1864
+ private origin;
1865
+ private saveFailure;
1866
+ /**
1867
+ * The latest save's refusal of its reachability query, with the query it was sent with, as
1868
+ * {@link queryKeyOf} writes it; null when the latest save met none.
1869
+ */
1870
+ private sourceRefusal;
1871
+ private previewFailure;
1872
+ /** Whether the store's `zoneFormUnsaved` holds this engine's true, written by it. */
1873
+ private unsavedWritten;
1874
+ /**
1875
+ * Whether the reader changed anything since the subject opened: typed a field, switched the
1876
+ * method or picked an origin. A computed create opens saveable on what it was opened with, and
1877
+ * leaving it untouched loses nothing the reader did, so it is unsaved only once this holds.
1878
+ */
1879
+ private touched;
1880
+ /** The zone the metadata was seeded from; undefined until the first seed. */
1881
+ private bound;
1882
+ /**
1883
+ * What the failures and a save in flight answer for: the bound zone, or a create, by its
1884
+ * serial, the method it is authored by and the itinerary it inherits from. Null until the
1885
+ * first seed.
1886
+ */
1887
+ private subject;
1888
+ /**
1889
+ * Counts the subjects a save or a draw can answer for: a refusal sent under an earlier one is
1890
+ * dropped.
1891
+ */
1892
+ private subjectEpoch;
1893
+ /**
1894
+ * The create the fields were last seeded for: its serial and the id of the itinerary it
1895
+ * inherits from, and undefined while a zone is bound and before the first seed.
1896
+ */
1897
+ private create;
1898
+ /** The serial of the create the fields were last seeded for, while the last seed was a create. */
1899
+ private createSerial;
1900
+ /** The zone and the catalog the reachability parameters were last seeded from. */
1901
+ private sourceSeed;
1902
+ /** The store state and the configuration the snapshot was last settled against. */
1903
+ private settled;
1904
+ /**
1905
+ * The name and the description last judged, with the verdicts, so a pass that moved neither
1906
+ * parses nothing.
1907
+ */
1908
+ private judged;
1909
+ private snapshot;
1910
+ private readonly subscriptions;
1911
+ /** Ends the watch on the store, while running. */
1912
+ private unwatch;
1913
+ /** The key of the preview asked for or waited on; undefined when none has been considered. */
1914
+ private previewKey;
1915
+ /** The preview the pending debounce asks for. */
1916
+ private previewInput;
1917
+ /**
1918
+ * Counts the questions a preview can answer, and the subjects it can answer for: an answer
1919
+ * from an earlier one is ignored.
1920
+ */
1921
+ private previewEpoch;
1922
+ private timer;
1923
+ /** Whether a reconcile is running, so one started inside it runs after it. */
1924
+ private reconciling;
1925
+ /** Whether something changed during the running reconcile, which then runs again. */
1926
+ private stale;
1927
+ /**
1928
+ * Whether nobody is watching. A parked engine watches no store, asks for no preview and answers
1929
+ * no command.
1930
+ */
1931
+ private parked;
1932
+ private disposed;
1933
+ /**
1934
+ * Constructing one holds the options and does nothing else: no store is read, no timer armed
1935
+ * and no tool run. A React binding constructs during a render React is free to throw away, and
1936
+ * a constructor with a side effect would leave the discarded copy acting.
1937
+ *
1938
+ * @throws {MountayaElementsError} When `debounceMs` is not a finite number from 0 to
1939
+ * 2,147,483,647.
1940
+ */
1941
+ constructor(options: ZoneFormEngineOptions);
1942
+ /**
1943
+ * getSnapshot returns the current answer, by reference and stable between changes.
1944
+ *
1945
+ * A parked engine settles it on the read: it reads the store and seeds the fields for the zone
1946
+ * bound now, without watching the store, arming a timer or running a tool. So a surface's first
1947
+ * render, and a server's only one, show the bound zone.
1948
+ */
1949
+ getSnapshot(): ZoneFormSnapshot;
1950
+ /**
1951
+ * subscribe registers a listener for every change of the snapshot, and returns its own
1952
+ * unsubscribe, which is idempotent.
1953
+ *
1954
+ * The first listener starts the engine and the last one leaving parks it, which is the whole
1955
+ * lifecycle a component can express correctly: React tears an effect down and sets it up again
1956
+ * with the same object under StrictMode, so a latch here would leave a live surface bound to a
1957
+ * dead engine. Each call is its own subscription, so two owners subscribing one shared function
1958
+ * each hold the engine until they release it.
1959
+ */
1960
+ subscribe(listener: () => void): () => void;
1961
+ /**
1962
+ * configure replaces the configuration, and settles the form again only when a member changed.
1963
+ *
1964
+ * A binding calls it on every render, so it compares every member by identity and does nothing
1965
+ * when all are the ones it holds. A changed one seeds what waited on it: a catalog that
1966
+ * arrives seeds the activity, collections that arrive are followed, and a name still following
1967
+ * its parameters is written again in the new language. A parked engine keeps the configuration
1968
+ * for its next read.
1969
+ */
1970
+ configure(config: ZoneFormConfig): void;
1971
+ /**
1972
+ * dispose parks the engine and drops every listener, for good.
1973
+ *
1974
+ * Idempotent, and every call after it is a no-op rather than an error: an owner torn down
1975
+ * mid-save should not have to guard the calls it already queued. A save in flight still reaches
1976
+ * the tool it was sent to; its answer changes nothing here.
1977
+ */
1978
+ dispose(): void;
1979
+ /**
1980
+ * edit writes the given fields, and applies the rule each one carries:
1981
+ *
1982
+ * - `name` makes the name the reader's own, so it stops following the parameters. On a create
1983
+ * whose draft a proposal named it also clears that name from the draft, so the one typed is
1984
+ * shown.
1985
+ * - `name`, `description`, `startAt` and `endAt` clear the previous save's failure.
1986
+ * - `windowOpen: false` clears both bounds, so a hidden window never persists a constraint its
1987
+ * reader cannot see.
1988
+ * - `rangeType` resets `range` to that measure's default and never reinterprets the number,
1989
+ * and a switch to `"distance"` drops the pace, which a distance does not depend on.
1990
+ * - `speedKmh` holds beside a time budget only: on a distance budget it is dropped, so a later
1991
+ * switch to `"time"` starts from the activity's own pace.
1992
+ * - `organizationId` makes the organization the reader's own choice, `null` included: a create
1993
+ * then stays personal beside a `defaultOrganizationId`. On a create whose draft a proposal
1994
+ * filed, or whose draw was armed under another, it is also written on the draft, so the one
1995
+ * picked is shown and saved.
1996
+ * - `level`, while a draw is armed, also runs `studio.zone.setLevel`, which recolours the draft.
1997
+ * A refusal leaves the draft as it was, and the form goes back to the severity it held. On a
1998
+ * create it is also written on the store (`zoneCreatePickedLevel`), which the step of a
1999
+ * proposal that joins the create records, so an undo of the proposal shows it again.
2000
+ *
2001
+ * `rangeType` and `windowOpen` are applied before the fields they reset, so an edit naming both
2002
+ * keeps the value it names. `mode` is the shape a draw is armed with; once armed, and for a
2003
+ * saved zone, the snapshot shows the session's or the zone's own. While the snapshot's
2004
+ * `inherits` is true, `organizationId`, `activityId` and `collectionIds` follow the itinerary
2005
+ * and an edit of one does not hold.
2006
+ *
2007
+ * A call while parked, or after {@link ZoneFormEngine.dispose}, does nothing.
2008
+ */
2009
+ edit(fields: Partial<ZoneFormFields>): void;
2010
+ /**
2011
+ * ask runs one tool and answers its result, or null where the host's bus rejected the call.
2012
+ *
2013
+ * A tool bus's dispatch never rejects, and a host's own may. A call it rejects made no answer:
2014
+ * the rejection is held here, so none is left unhandled by a call the form does not await, and
2015
+ * the caller goes on as it does for a tool that did nothing. A save is awaited by its caller
2016
+ * and is not asked through here: its rejection is the caller's to read.
2017
+ */
2018
+ private ask;
2019
+ /**
2020
+ * recolour sets the armed draft's severity, through `studio.zone.setLevel`. A refusal leaves
2021
+ * the draft painted as it was, and so does a call the bus rejects, so the form goes back to the
2022
+ * severity it held and a create's pick to the one the store held, unless its reader has chosen
2023
+ * another since or the form answers for another subject by then.
2024
+ */
2025
+ private recolour;
2026
+ /**
2027
+ * setMethod switches how a create is authored, through `studio.zone.setCreateMethod`, and
2028
+ * clears the preview's and the save's failures, which described the method left behind. The
2029
+ * same two are cleared when another caller of that tool switches it. A switch the tool refuses
2030
+ * left no method behind: the two failures stand again, for as long as the form answers for the
2031
+ * same create. A call while parked, or after {@link ZoneFormEngine.dispose}, does nothing.
2032
+ */
2033
+ setMethod(method: ZoneCreateMethod): void;
2034
+ /** switchMethod asks for the switch, and puts back what it cleared when the tool refuses. */
2035
+ private switchMethod;
2036
+ /**
2037
+ * beginOriginPick arms the map for the click that places a reachability zone's origin, through
2038
+ * `studio.zone.beginOriginPick`.
2039
+ *
2040
+ * A refusal is kept as the snapshot's `pickFailure`, for as long as the form answers for the
2041
+ * create or the zone the pick was asked for and no later pick was asked.
2042
+ *
2043
+ * A call while parked, or after {@link ZoneFormEngine.dispose}, does nothing.
2044
+ */
2045
+ beginOriginPick(): void;
2046
+ /** pick asks for the origin pick, and keeps a refusal while it is the latest and its form's. */
2047
+ private pick;
2048
+ /**
2049
+ * beginDraw arms the map to draw a new zone, through `studio.zone.editBegin`, in the form's
2050
+ * shape and severity and under its organization. The zone's id is minted by the `ids` seam: a
2051
+ * zone cannot persist empty, so the draw session needs a handle before there is a zone to name.
2052
+ *
2053
+ * A refusal is kept as the snapshot's `drawFailure`, for as long as the form answers for the
2054
+ * create the draw was asked for.
2055
+ *
2056
+ * It does nothing while a zone is bound, while a draw or a reshape is armed, while an earlier
2057
+ * call is still unanswered, while no shape is chosen, while parked, or after
2058
+ * {@link ZoneFormEngine.dispose}.
2059
+ */
2060
+ beginDraw(): void;
2061
+ /** draw asks for the draw session, and keeps a refusal while its create is the form's. */
2062
+ private draw;
2063
+ /**
2064
+ * save persists the form through the one tool call {@link zoneSaveRequest} routes it to, and
2065
+ * resolves once the tool has answered. It resolves at once, having sent nothing, when a save
2066
+ * of the same zone or the same create is already in flight, when the form has nothing to
2067
+ * send, while parked, and after {@link ZoneFormEngine.dispose}. A save in flight for another
2068
+ * zone holds back no save of this one.
2069
+ *
2070
+ * A refusal is kept as the snapshot's `saveFailure` and the fields stay as typed, so a retry is
2071
+ * one more call. A refusal that lands once the form answers for another zone, or once a create
2072
+ * has switched method or changed the itinerary it inherits from, is dropped: it describes a
2073
+ * form nobody is looking at. One that lands once the form has come back to the zone or the
2074
+ * create it was sent for is kept, since the snapshot read `saving` for it all along. A refusal
2075
+ * of the reachability query the fields stated as the save left is kept as the snapshot's
2076
+ * `sourceFailure` instead, for the surface to show at the query's fields. A create
2077
+ * that lost some of its collections raises a warning through `studio.alert.show`: the zone
2078
+ * exists, and the reader should know where it was not filed.
2079
+ *
2080
+ * It never rejects while `dispatch` does not.
2081
+ */
2082
+ save(): Promise<void>;
2083
+ /** run dispatches a save request, each arm with its own tool's input. */
2084
+ private run;
2085
+ /** saveRequest routes the form as it stands to the tool call that persists it, or to null. */
2086
+ private saveRequest;
2087
+ /** statedSource is the reachability query the fields state as the store stands, or null. */
2088
+ private statedSource;
2089
+ /**
2090
+ * publishUnsaved writes whether the form holds something unsaved on the store's
2091
+ * `zoneFormUnsaved`, where `studio.zone.publish` and the publication band read it, when that
2092
+ * answer moved. A parked engine writes nothing: its reads run inside a render, and a form
2093
+ * nobody watches holds nothing for anyone to lose.
2094
+ *
2095
+ * The store hears of the write at once, and so does this engine's own watch, which finds no slot
2096
+ * it reads moved and runs no pass.
2097
+ */
2098
+ private publishUnsaved;
2099
+ /**
2100
+ * park stops watching the store, drops the pending preview and forgets the one in flight. The
2101
+ * unsaved answer it wrote is taken back: a form that unmounts holds nothing any more.
2102
+ */
2103
+ private park;
2104
+ /** settle brings a parked engine's snapshot in line with the store and the configuration. */
2105
+ private settle;
2106
+ /**
2107
+ * watch answers one notification of the store: it runs a pass when a slot the form reads
2108
+ * moved, and nothing otherwise, so a hover or a selection costs the form one comparison.
2109
+ */
2110
+ private watch;
2111
+ /**
2112
+ * reconcile seeds the fields from the store and the configuration, publishes the snapshot and
2113
+ * follows the preview it is worth. A change made while it runs, by a listener or by a tool a
2114
+ * preview runs at once, runs it again once it finishes rather than inside it.
2115
+ */
2116
+ private reconcile;
2117
+ /** seed brings the fields in line with the bound zone, the create's context and the catalog. */
2118
+ private seed;
2119
+ /**
2120
+ * seedParameters brings the reachability parameters in line with the query `zone` is stored
2121
+ * with and with the catalog, and drops an activity the catalog lists no more.
2122
+ */
2123
+ private seedParameters;
2124
+ /**
2125
+ * seedMetadata seeds what a zone says from `zone`, and from a create's defaults for none: the
2126
+ * name, the description, the window and the severity.
2127
+ */
2128
+ private seedMetadata;
2129
+ /**
2130
+ * follow brings the fields in line with the bound zone written again: `previous` is what it
2131
+ * said and `next` what it says now.
2132
+ *
2133
+ * A field the reader has not moved off what the zone said takes what it says now, and so does
2134
+ * one that already says it, which is how the reader's own save lands in its stored spelling.
2135
+ * Any other is what the reader typed and has not saved, and stays. The window is one answer,
2136
+ * its bounds and whether it is open, taken whole from the reader once they moved any of it,
2137
+ * so no bound a collaborator chose is ever paired with one the reader did.
2138
+ *
2139
+ * The severity of a reshape armed on the zone is shown over the form's own, so it follows by
2140
+ * the same rule: while `session` still paints the severity the zone said, it is set to the one
2141
+ * the zone says now, through `studio.zone.setLevel`. One the reader moved is theirs and stays.
2142
+ * Left as it was, the form would read unsaved after a collaborator's change of severity, and
2143
+ * its save would write the old one back.
2144
+ */
2145
+ private follow;
2146
+ /**
2147
+ * resetCreate returns the fields a create seeds for itself to a create's defaults: where it is
2148
+ * filed, the shape it is drawn in and the parameters it is computed from. What the zone says
2149
+ * is seeded from the zone, bound or not.
2150
+ */
2151
+ private resetCreate;
2152
+ /** activityName is the chosen activity's name in the reader's language, or null. */
2153
+ private activityName;
2154
+ /** sourceFor is the reachability query the fields state under `facts`, or null. */
2155
+ private sourceFor;
2156
+ /** view reads the form as it stands under `facts`. */
2157
+ private view;
2158
+ /**
2159
+ * judge holds a name and a description to the bounds the tools hold them to. It parses only a
2160
+ * text it has not just judged, so a pass that moved neither, a drag's every frame among them,
2161
+ * parses nothing.
2162
+ */
2163
+ private judge;
2164
+ /** commit publishes `next` when it differs from the snapshot, and tells every listener. */
2165
+ private commit;
2166
+ /**
2167
+ * followPreview asks for the preview `view` is worth, after the debounce, unless that very
2168
+ * preview is already asked for or waited on. A parked engine asks for none.
2169
+ */
2170
+ private followPreview;
2171
+ /** askPreview runs the preview waited on, and keeps its answer while its question stands. */
2172
+ private askPreview;
2173
+ private cancelPending;
2213
2174
  }
2214
-
2215
- export { EmbedFramingEngine, EmbedReadyEngine, FRAMING_PAGE_SESSION_TIMEOUT_MS, ItineraryPaceEngine, ProfileMarkerEngine, SegmentDraftEngine, ZoneFormEngine, askFramingPageForSession };
2216
- export type { AskFramingPageForSessionOptions, EmbedFramingCollection, EmbedFramingConfig, EmbedFramingSnapshot, EmbedReadyConfig, EmbedReadyEngineOptions, EmbedReadySnapshot, FramingPageMessage, FramingPageWindow, ItineraryPaceConfig, ItineraryPaceEngineOptions, ItineraryPaceResult, ProfileMarkerEngineOptions, SegmentDraftConfig, SegmentDraftContext, SegmentDraftEngineOptions, SegmentDraftEngineSnapshot, ZoneFormConfig, ZoneFormDispatch, ZoneFormEngineOptions, ZoneFormSnapshot };
2175
+ export { type AskFramingPageForSessionOptions, type EmbedFramingCollection, type EmbedFramingConfig, type EmbedFramingSnapshot, type EmbedReadyConfig, type EmbedReadyEngineOptions, type EmbedReadySnapshot, type FramingPageMessage, type FramingPageWindow, type ItineraryPaceConfig, type ItineraryPaceEngineOptions, type ItineraryPaceResult, type ProfileMarkerEngineOptions, type SegmentDraftConfig, type SegmentDraftContext, type SegmentDraftEngineOptions, type SegmentDraftEngineSnapshot, type ShareLinkActionOutcome, type ShareLinkConfig, type ShareLinkDispatch, ShareLinkEngine, type ShareLinkEngineOptions, type ShareLinkFailure, type ShareLinkRead, type ShareLinkReadResult, type ShareLinkSnapshot, type ZoneFormConfig, type ZoneFormDispatch, type ZoneFormEngineOptions, type ZoneFormSnapshot };
2176
+ //# sourceMappingURL=index.d.cts.map