@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.
- package/CHANGELOG.md +30 -0
- package/dist/agent/index.cjs +2561 -2815
- package/dist/agent/index.cjs.map +1 -1
- package/dist/agent/index.d.cts +766 -786
- package/dist/agent/index.d.ts +766 -786
- package/dist/agent/index.js +2553 -2790
- package/dist/agent/index.js.map +1 -1
- package/dist/chunk-3Oi_Zrtm.js +9 -0
- package/dist/chunk-3Oi_Zrtm.js.map +1 -0
- package/dist/chunk-B18OPIu_.js +6 -0
- package/dist/chunk-B18OPIu_.js.map +1 -0
- package/dist/chunk-B5Uz3Qct.cjs +15 -0
- package/dist/chunk-B5Uz3Qct.cjs.map +1 -0
- package/dist/chunk-BBEJwkd3.d.cts +839 -0
- package/dist/chunk-BIEc_SkR.cjs +29 -0
- package/dist/chunk-BIEc_SkR.cjs.map +1 -0
- package/dist/chunk-BKMFOe-N.js +171 -0
- package/dist/chunk-BKMFOe-N.js.map +1 -0
- package/dist/chunk-BP4uy7E1.d.ts +11583 -0
- package/dist/chunk-BSHTsFiB.js +1403 -0
- package/dist/chunk-BSHTsFiB.js.map +1 -0
- package/dist/chunk-BTUUABGI.js +17 -0
- package/dist/chunk-BTUUABGI.js.map +1 -0
- package/dist/chunk-BaPiaz5X.cjs +115 -0
- package/dist/chunk-BaPiaz5X.cjs.map +1 -0
- package/dist/chunk-BeCVpkYr.cjs +542 -0
- package/dist/chunk-BeCVpkYr.cjs.map +1 -0
- package/dist/chunk-BgngsvK8.cjs +6202 -0
- package/dist/chunk-BgngsvK8.cjs.map +1 -0
- package/dist/chunk-BhInd7CJ.d.cts +253 -0
- package/dist/chunk-Bn6ZbxkS.cjs +27 -0
- package/dist/chunk-By9ZnkVI.js +60 -0
- package/dist/chunk-By9ZnkVI.js.map +1 -0
- package/dist/chunk-BzqPhxsz.cjs +367 -0
- package/dist/chunk-BzqPhxsz.cjs.map +1 -0
- package/dist/chunk-C2mMX81q.d.ts +443 -0
- package/dist/chunk-C2rr9Q0V.cjs +1402 -0
- package/dist/chunk-C2rr9Q0V.cjs.map +1 -0
- package/dist/{directorThreads-CqmvsV8b.d.cts → chunk-CDJCbwIQ.d.cts} +20 -22
- package/dist/chunk-CLGvBOVH.d.cts +1654 -0
- package/dist/chunk-COdw1dc6.d.ts +525 -0
- package/dist/chunk-CQCJnT2i.d.ts +511 -0
- package/dist/chunk-CSyHY67q.cjs +353 -0
- package/dist/chunk-CSyHY67q.cjs.map +1 -0
- package/dist/chunk-CiK1Iqrv.js +950 -0
- package/dist/chunk-CiK1Iqrv.js.map +1 -0
- package/dist/chunk-CmJBgSwZ.cjs +24 -0
- package/dist/chunk-CmJBgSwZ.cjs.map +1 -0
- package/dist/chunk-CnrsRK2u.cjs +83 -0
- package/dist/chunk-CnrsRK2u.cjs.map +1 -0
- package/dist/chunk-Co782_9r.js +326 -0
- package/dist/chunk-Co782_9r.js.map +1 -0
- package/dist/chunk-Csr3KDpZ.cjs +32 -0
- package/dist/chunk-Csr3KDpZ.cjs.map +1 -0
- package/dist/chunk-CwkmccXv.js +89 -0
- package/dist/chunk-CwkmccXv.js.map +1 -0
- package/dist/chunk-D0Q4iL9B.cjs +255 -0
- package/dist/chunk-D0Q4iL9B.cjs.map +1 -0
- package/dist/chunk-DFwiSzUS.cjs +72 -0
- package/dist/chunk-DFwiSzUS.cjs.map +1 -0
- package/dist/chunk-DIFayl2P.d.cts +443 -0
- package/dist/chunk-DIGF58ux.d.cts +525 -0
- package/dist/chunk-DKuuuld5.js +101 -0
- package/dist/chunk-DKuuuld5.js.map +1 -0
- package/dist/chunk-DMePkFEo.js +5054 -0
- package/dist/chunk-DMePkFEo.js.map +1 -0
- package/dist/chunk-DO5SIBgu.js +305 -0
- package/dist/chunk-DO5SIBgu.js.map +1 -0
- package/dist/chunk-DOQ_7eE5.d.ts +6662 -0
- package/dist/{tabs-B2nRO4p_.d.ts → chunk-DThaaNeb.d.cts} +2 -2
- package/dist/{tabs-B2nRO4p_.d.cts → chunk-DThaaNeb.d.ts} +2 -2
- package/dist/{directorThreads-CqmvsV8b.d.ts → chunk-DUQzjUJy.d.ts} +20 -22
- package/dist/chunk-DX37IPhV.cjs +1903 -0
- package/dist/chunk-DX37IPhV.cjs.map +1 -0
- package/dist/chunk-Damps5Tk.cjs +155 -0
- package/dist/chunk-Damps5Tk.cjs.map +1 -0
- package/dist/chunk-DbK5PhpJ.d.ts +1654 -0
- package/dist/chunk-De0vAASv.d.ts +253 -0
- package/dist/chunk-DhSZ7YZt.d.cts +6662 -0
- package/dist/chunk-DjEvqvPA.cjs +43 -0
- package/dist/chunk-DjEvqvPA.cjs.map +1 -0
- package/dist/{saveFile-j-1kkApx.d.cts → chunk-DkwDzwvu.d.cts} +7 -9
- package/dist/{saveFile-j-1kkApx.d.ts → chunk-DkwDzwvu.d.ts} +7 -9
- package/dist/chunk-Dmszv9If.js +71 -0
- package/dist/chunk-Dmszv9If.js.map +1 -0
- package/dist/chunk-Dp_ftNWY.d.cts +511 -0
- package/dist/chunk-DsHQySz0.js +31 -0
- package/dist/chunk-DsHQySz0.js.map +1 -0
- package/dist/chunk-DwoUyHHh.js +281 -0
- package/dist/chunk-DwoUyHHh.js.map +1 -0
- package/dist/chunk-IaIDQflj.d.cts +2315 -0
- package/dist/chunk-IaIDQflj.d.ts +2315 -0
- package/dist/chunk-cVXLsZfL.d.ts +839 -0
- package/dist/chunk-mIaCX9EJ.d.cts +11583 -0
- package/dist/chunk-nJQxbOwQ.cjs +8962 -0
- package/dist/chunk-nJQxbOwQ.cjs.map +1 -0
- package/dist/chunk-o9jaxhCO.js +8852 -0
- package/dist/chunk-o9jaxhCO.js.map +1 -0
- package/dist/chunk-p-Tt_Lwz.js +14 -0
- package/dist/chunk-p-Tt_Lwz.js.map +1 -0
- package/dist/engines/index.cjs +2046 -3401
- package/dist/engines/index.cjs.map +1 -1
- package/dist/engines/index.d.cts +1510 -1550
- package/dist/engines/index.d.ts +1510 -1550
- package/dist/engines/index.js +2039 -3380
- package/dist/engines/index.js.map +1 -1
- package/dist/handlers/index.cjs +47 -93
- package/dist/handlers/index.cjs.map +1 -1
- package/dist/handlers/index.d.cts +61 -103
- package/dist/handlers/index.d.ts +61 -103
- package/dist/handlers/index.js +27 -36
- package/dist/handlers/index.js.map +1 -1
- package/dist/index.cjs +3347 -4398
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -7297
- package/dist/index.d.ts +8 -7297
- package/dist/index.js +2997 -3187
- package/dist/index.js.map +1 -1
- package/dist/plugins/index.cjs +482 -949
- package/dist/plugins/index.cjs.map +1 -1
- package/dist/plugins/index.d.cts +44 -61
- package/dist/plugins/index.d.ts +44 -61
- package/dist/plugins/index.js +471 -915
- package/dist/plugins/index.js.map +1 -1
- package/dist/seams/index.cjs +77 -140
- package/dist/seams/index.cjs.map +1 -1
- package/dist/seams/index.d.cts +125 -158
- package/dist/seams/index.d.ts +125 -158
- package/dist/seams/index.js +41 -71
- package/dist/seams/index.js.map +1 -1
- package/dist/strings/fr/index.cjs +2130 -2116
- package/dist/strings/fr/index.cjs.map +1 -1
- package/dist/strings/fr/index.d.cts +3 -5
- package/dist/strings/fr/index.d.ts +3 -5
- package/dist/strings/fr/index.js +2125 -2114
- package/dist/strings/fr/index.js.map +1 -1
- package/dist/strings/index.cjs +2331 -2625
- package/dist/strings/index.cjs.map +1 -1
- package/dist/strings/index.d.cts +3 -731
- package/dist/strings/index.d.ts +3 -731
- package/dist/strings/index.js +2324 -2615
- package/dist/strings/index.js.map +1 -1
- package/dist/testing/index.cjs +214 -276
- package/dist/testing/index.cjs.map +1 -1
- package/dist/testing/index.d.cts +61 -121
- package/dist/testing/index.d.ts +61 -121
- package/dist/testing/index.js +208 -273
- package/dist/testing/index.js.map +1 -1
- package/dist/time/index.cjs +23 -23
- package/dist/time/index.cjs.map +1 -1
- package/dist/time/index.d.cts +5 -7
- package/dist/time/index.d.ts +5 -7
- package/dist/time/index.js +18 -21
- package/dist/time/index.js.map +1 -1
- package/package.json +14 -15
- package/src/agent/rules/stateDelta.ts +1 -0
- package/src/agent/stores/agentThreads.ts +1 -4
- package/src/bus/rules/bus.ts +1 -2
- package/src/bus/rules/defineRegistry.ts +3 -5
- package/src/bus/rules/types.ts +6 -7
- package/src/chrome/stores/uiStore.ts +4 -2
- package/src/embed/rules/fieldDependencies.ts +2 -0
- package/src/embed/rules/safetyRules.ts +2 -0
- package/src/embed/rules/tableCode.ts +4 -3
- package/src/index.ts +6 -27
- package/src/itinerary/rules/import.ts +6 -8
- package/src/plugins/contracts/plugin.ts +4 -2
- package/src/seams/rules/formatters.ts +5 -3
- package/src/testing/index.ts +1 -5
- package/src/viewer/rules/platformViewer.ts +1 -0
- package/dist/bus-BwiNiXdH.d.ts +0 -514
- package/dist/bus-DzmhPwdK.d.cts +0 -514
- package/dist/chainModel-B23pEP_1.d.cts +0 -127
- package/dist/chainModel-B23pEP_1.d.ts +0 -127
- package/dist/chunk-2HFY7ETU.js +0 -5721
- package/dist/chunk-2HFY7ETU.js.map +0 -1
- package/dist/chunk-355TOXSB.js +0 -72
- package/dist/chunk-355TOXSB.js.map +0 -1
- package/dist/chunk-4ZCUZVSV.js +0 -10275
- package/dist/chunk-4ZCUZVSV.js.map +0 -1
- package/dist/chunk-6HEKY3NF.js +0 -95
- package/dist/chunk-6HEKY3NF.js.map +0 -1
- package/dist/chunk-7GFLGGBX.cjs +0 -8
- package/dist/chunk-7GFLGGBX.cjs.map +0 -1
- package/dist/chunk-7NBRCENN.cjs +0 -19
- package/dist/chunk-7NBRCENN.cjs.map +0 -1
- package/dist/chunk-AF5GCXE3.js +0 -8
- package/dist/chunk-AF5GCXE3.js.map +0 -1
- package/dist/chunk-CJDIFRGZ.cjs +0 -2005
- package/dist/chunk-CJDIFRGZ.cjs.map +0 -1
- package/dist/chunk-CNPZY7N3.js +0 -349
- package/dist/chunk-CNPZY7N3.js.map +0 -1
- package/dist/chunk-DZJHTWSF.cjs +0 -45
- package/dist/chunk-DZJHTWSF.cjs.map +0 -1
- package/dist/chunk-EABIHHWA.js +0 -42
- package/dist/chunk-EABIHHWA.js.map +0 -1
- package/dist/chunk-EKZWV6RS.cjs +0 -415
- package/dist/chunk-EKZWV6RS.cjs.map +0 -1
- package/dist/chunk-EOKRXXAC.cjs +0 -24
- package/dist/chunk-EOKRXXAC.cjs.map +0 -1
- package/dist/chunk-F73W2ZTJ.js +0 -1126
- package/dist/chunk-F73W2ZTJ.js.map +0 -1
- package/dist/chunk-H4DVOZ5O.js +0 -1897
- package/dist/chunk-H4DVOZ5O.js.map +0 -1
- package/dist/chunk-HI52PBFT.cjs +0 -10314
- package/dist/chunk-HI52PBFT.cjs.map +0 -1
- package/dist/chunk-IDBXFBLG.cjs +0 -1225
- package/dist/chunk-IDBXFBLG.cjs.map +0 -1
- package/dist/chunk-LBWTJZUJ.js +0 -297
- package/dist/chunk-LBWTJZUJ.js.map +0 -1
- package/dist/chunk-NCLA6DKD.cjs +0 -310
- package/dist/chunk-NCLA6DKD.cjs.map +0 -1
- package/dist/chunk-O4MC5DPD.js +0 -19
- package/dist/chunk-O4MC5DPD.js.map +0 -1
- package/dist/chunk-OP37FKW6.cjs +0 -98
- package/dist/chunk-OP37FKW6.cjs.map +0 -1
- package/dist/chunk-OQSYFH3Z.cjs +0 -5945
- package/dist/chunk-OQSYFH3Z.cjs.map +0 -1
- package/dist/chunk-PACIO4NS.cjs +0 -26
- package/dist/chunk-PACIO4NS.cjs.map +0 -1
- package/dist/chunk-PSZ2R3TC.cjs +0 -75
- package/dist/chunk-PSZ2R3TC.cjs.map +0 -1
- package/dist/chunk-QFO5CZG2.cjs +0 -136
- package/dist/chunk-QFO5CZG2.cjs.map +0 -1
- package/dist/chunk-QL63MUEW.cjs +0 -140
- package/dist/chunk-QL63MUEW.cjs.map +0 -1
- package/dist/chunk-RFUPPVZO.js +0 -17
- package/dist/chunk-RFUPPVZO.js.map +0 -1
- package/dist/chunk-RPG2LWMP.js +0 -23
- package/dist/chunk-RPG2LWMP.js.map +0 -1
- package/dist/chunk-TIBXK6B7.cjs +0 -12
- package/dist/chunk-TIBXK6B7.cjs.map +0 -1
- package/dist/chunk-UU65VNEV.js +0 -381
- package/dist/chunk-UU65VNEV.js.map +0 -1
- package/dist/chunk-VGX6TR2I.js +0 -209
- package/dist/chunk-VGX6TR2I.js.map +0 -1
- package/dist/chunk-WUTDDBVP.js +0 -130
- package/dist/chunk-WUTDDBVP.js.map +0 -1
- package/dist/chunk-WVQQLKCI.cjs +0 -224
- package/dist/chunk-WVQQLKCI.cjs.map +0 -1
- package/dist/chunk-WZYXG3SE.js +0 -111
- package/dist/chunk-WZYXG3SE.js.map +0 -1
- package/dist/chunk-XDI2X3KE.js +0 -6
- package/dist/chunk-XDI2X3KE.js.map +0 -1
- package/dist/chunk-XKHLRIC7.cjs +0 -381
- package/dist/chunk-XKHLRIC7.cjs.map +0 -1
- package/dist/context-DNtd2WUv.d.cts +0 -11666
- package/dist/context-DgB72Bur.d.ts +0 -11666
- package/dist/en-Bu4Ti9Ev.d.cts +0 -2315
- package/dist/en-Bu4Ti9Ev.d.ts +0 -2315
- package/dist/shareLink-B6hlt942.d.ts +0 -144
- package/dist/shareLink-C7rIMb7x.d.ts +0 -527
- package/dist/shareLink-CnTxxXjp.d.cts +0 -144
- package/dist/shareLink-DyZVYH2V.d.cts +0 -527
- package/dist/studioPlugin-C3C7VjMy.d.ts +0 -847
- package/dist/studioPlugin-Cf3OBNUv.d.cts +0 -847
- package/dist/types-BzJRV6UI.d.cts +0 -845
- package/dist/types-BzJRV6UI.d.ts +0 -845
- package/dist/zoneForm-CdYNtnnA.d.cts +0 -320
- package/dist/zoneForm-mG85yt5e.d.ts +0 -320
package/dist/engines/index.d.cts
CHANGED
|
@@ -1,201 +1,193 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
import {
|
|
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
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
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
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
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
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
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
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
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
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
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
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
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
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
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
|
-
|
|
834
|
-
|
|
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
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
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
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
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
|
-
|
|
896
|
-
|
|
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
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
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
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
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
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
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
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
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
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
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
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
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
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
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
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
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
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
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
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
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
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
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
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
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
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
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
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
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
|
-
|
|
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
|