@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/strings/index.d.cts
CHANGED
|
@@ -1,731 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
import { CameraOutput, CameraOutputFormat, CameraFps, Quality, CameraResolution } from '@mountaya/elements/camera';
|
|
5
|
-
import { Zone } from '@mountaya/client';
|
|
6
|
-
import { ItineraryWithDetails } from '@mountaya/elements/data';
|
|
7
|
-
import { PartialDeep, BundleLanguageOverrides, MapLanguage, Translations } from '@mountaya/elements/i18n';
|
|
8
|
-
import 'zod';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* The sections the table reads, named so a caller can scope to exactly them.
|
|
12
|
-
*
|
|
13
|
-
* Narrow rather than the whole bundle, because the surfaces that raise these prompts resolve a
|
|
14
|
-
* SCOPED bundle (the confirmation gate reads `confirm`, the agent's own turn reads `prompt`), and
|
|
15
|
-
* neither of them holds the sections it never renders. Written as a `Pick` over the groups the
|
|
16
|
-
* entries below actually name, so an entry that names another group is a compile error here
|
|
17
|
-
* rather than a blank sentence in a dialog asking the user to approve an irreversible act.
|
|
18
|
-
*/
|
|
19
|
-
type ConfirmSentenceStrings = Pick<StudioStrings, "confirm" | "editing" | "editor" | "share">;
|
|
20
|
-
/** CONFIRM_COPY_LABELS is the set the table answers, for the gate that holds it to the registry. */
|
|
21
|
-
declare const CONFIRM_COPY_LABELS: readonly string[];
|
|
22
|
-
/**
|
|
23
|
-
* confirmSentence resolves one label a confirmation policy named, or `undefined` when the policy
|
|
24
|
-
* did not name that field, which is how a tool asks for the generic prompt, so the caller's
|
|
25
|
-
* fallback is the intended answer and not an error.
|
|
26
|
-
*
|
|
27
|
-
* An UNKNOWN label answers `undefined` too, and that is deliberate: a generic prompt is a worse
|
|
28
|
-
* dialog than a specific one but it is still a true one, where an echoed identifier is neither.
|
|
29
|
-
* `confirmCopy.test.ts` is what stops a label reaching here unknown in the first place.
|
|
30
|
-
*
|
|
31
|
-
* @param copy The studio's copy the sentence is read from.
|
|
32
|
-
* @param label The label the policy named, such as `share.rotateConfirm.title`.
|
|
33
|
-
* @param values The values the sentence interpolates.
|
|
34
|
-
* @default values {}
|
|
35
|
-
* @returns The sentence, or `undefined` for a label that is absent or unknown.
|
|
36
|
-
*/
|
|
37
|
-
declare const confirmSentence: (copy: ConfirmSentenceStrings, label: string | undefined, values?: ConfirmationValues) => string | undefined;
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* DraftEditorFlow names which flow's draft a draft surface edits: `import` or
|
|
41
|
-
* `suggest`. It is the ONE axis the two flows differ on: it selects the per-flow
|
|
42
|
-
* tool names the name/organization/privacy/collections fields and the commit
|
|
43
|
-
* button dispatch through, while every read goes through the neutral active-draft
|
|
44
|
-
* session selector. So a draft form renders identically for both flows and only
|
|
45
|
-
* the dispatch targets differ.
|
|
46
|
-
*/
|
|
47
|
-
type DraftEditorFlow = "import" | "suggest";
|
|
48
|
-
/**
|
|
49
|
-
* DraftEditorToolNames is the per-flow bundle of mutation tool names a draft
|
|
50
|
-
* surface dispatches: the name/organization/privacy/collections setters that
|
|
51
|
-
* write the draft session's commit-time fields, and the commit verb that persists
|
|
52
|
-
* the draft. It also carries the studio-namespace i18n key for the commit button's
|
|
53
|
-
* label so the per-flow copy stays centralized here rather than branching at the
|
|
54
|
-
* footer. Resolved from the flow once during render so a draft surface never
|
|
55
|
-
* branches on the flow past that one resolution. The values are tool-NAME string
|
|
56
|
-
* literals (and one i18n key) only, with no import of a tool contract, so this
|
|
57
|
-
* module stays a leaf the bus boundary still validates each name against when a
|
|
58
|
-
* field dispatches it.
|
|
59
|
-
*/
|
|
60
|
-
interface DraftEditorToolNames {
|
|
61
|
-
/**
|
|
62
|
-
* setActivity re-scopes the draft's routing profile. Only the import flow's
|
|
63
|
-
* chooser is live in staging (it re-previews from the retained source), but both
|
|
64
|
-
* namespaces carry the verb, so the bundle names it for either.
|
|
65
|
-
*/
|
|
66
|
-
setActivity: "studio.itinerary.import.setActivity" | "studio.itinerary.suggest.setActivity";
|
|
67
|
-
commit: "studio.itinerary.import.confirm" | "studio.itinerary.suggest.commit";
|
|
68
|
-
/**
|
|
69
|
-
* commitLabel names the Create button's wording on the copy bundle's itinerary
|
|
70
|
-
* form group: `createDraft` for the import flow and `createFromSuggestion` for the
|
|
71
|
-
* suggest flow, a key each, so a host words the two apart. A property name rather than
|
|
72
|
-
* a sentence, so the two flows stay one line apart here and the wording stays where
|
|
73
|
-
* every other word lives.
|
|
74
|
-
*/
|
|
75
|
-
commitLabel: Extract<keyof StudioStrings["itineraryForm"], "createDraft" | "createFromSuggestion">;
|
|
76
|
-
setCollections: "studio.itinerary.import.setCollections" | "studio.itinerary.suggest.setCollections";
|
|
77
|
-
setName: "studio.itinerary.import.setName" | "studio.itinerary.suggest.setName";
|
|
78
|
-
setOrganization: "studio.itinerary.import.setOrganization" | "studio.itinerary.suggest.setOrganization";
|
|
79
|
-
setPrivate: "studio.itinerary.import.setPrivate" | "studio.itinerary.suggest.setPrivate";
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* EMPTY_STRINGS is the one empty list a draft-session selector answers for the collections and
|
|
83
|
-
* the warnings of a session, or of a preview, that carries none.
|
|
84
|
-
*
|
|
85
|
-
* One reference for every reader: a fresh `[]` per call is a new value each time, which defeats a
|
|
86
|
-
* shallow equality and spins a store snapshot into a render loop. Frozen and typed `readonly`
|
|
87
|
-
* because it is shared: a write throws a `TypeError` and does not compile, where a push that
|
|
88
|
-
* landed would be read by every other selector as an entry nobody stated. A caller that needs a
|
|
89
|
-
* list it can write to copies it (`[...EMPTY_STRINGS]`).
|
|
90
|
-
*/
|
|
91
|
-
declare const EMPTY_STRINGS: readonly string[];
|
|
92
|
-
/**
|
|
93
|
-
* toolNamesFor resolves the per-flow tool names a draft surface dispatches. The
|
|
94
|
-
* two flows expose the same setter + commit verbs under their own namespaces, so
|
|
95
|
-
* a draft surface reads the active draft session generically and only the
|
|
96
|
-
* dispatch targets switch on the flow.
|
|
97
|
-
*
|
|
98
|
-
* @param flow The flow whose draft the surface edits.
|
|
99
|
-
* @returns The flow's setter and commit verbs, and its commit button's key.
|
|
100
|
-
*/
|
|
101
|
-
declare const toolNamesFor: (flow: DraftEditorFlow) => DraftEditorToolNames;
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* failureAlertFor turns a refused dispatch into the alert to raise for it, or `null` for the
|
|
105
|
-
* cases that are not failures at all.
|
|
106
|
-
*
|
|
107
|
-
* The answer is what `studio.alert.show` takes: an `info` or `error` level and a message of at
|
|
108
|
-
* most 280 characters ({@link MAP_ALERT_MESSAGE_MAX}). A rule rather than a binding's own logic,
|
|
109
|
-
* because every surface that reports a refused dispatch asks the same question; a binding decides
|
|
110
|
-
* only where the alert goes, and a surface reading this can see the whole decision at once.
|
|
111
|
-
*
|
|
112
|
-
* The line is clamped to that limit, because it ends with the SERVER's own sentence, which
|
|
113
|
-
* carries no client-side length bound: a long refusal would otherwise fail the alert tool's own
|
|
114
|
-
* boundary parse and show the reader nothing at all. Clamping keeps the worst case a truncated
|
|
115
|
-
* sentence rather than a silent one.
|
|
116
|
-
*
|
|
117
|
-
* `action` is the already-localized sentence for what the user just tried ("This segment could
|
|
118
|
-
* not be saved."), resolved by the caller rather than named as a key here. A key would have to
|
|
119
|
-
* be a key of SOMETHING (one i18n namespace, one string table), and the callers do not share
|
|
120
|
-
* one: a map surface reads the published `ElementsStrings`, the studio's own surfaces read its
|
|
121
|
-
* copy bundle. A resolved string is the one shape both can supply.
|
|
122
|
-
*
|
|
123
|
-
* The reason is resolved most specific first:
|
|
124
|
-
*
|
|
125
|
-
* 1. `result.detail`, the server's own already-localized sentence lifted off the REST envelope.
|
|
126
|
-
* It names the actual refusal ("The split point is too close to the start or the end of the
|
|
127
|
-
* segment"), which no per-code copy can reproduce, so it wins when present and not blank;
|
|
128
|
-
* 2. `failure[code]` for the classified failure code: the category, when the server gave no
|
|
129
|
-
* prose;
|
|
130
|
-
* 3. `failure.generic`, when the failure carries no code, or a code the copy holds no sentence
|
|
131
|
-
* for (a host's own tool may answer one).
|
|
132
|
-
*
|
|
133
|
-
* These outcomes are handled apart from that chain, because none of them is something that went
|
|
134
|
-
* wrong:
|
|
135
|
-
*
|
|
136
|
-
* - a successful result answers `null`, so a caller can hand this every result rather than
|
|
137
|
-
* branching first;
|
|
138
|
-
* - a withheld confirmation answers `null` too, for the reason {@link isConfirmationWithheld}
|
|
139
|
-
* gives;
|
|
140
|
-
* - `edit-in-progress` is the one-edit-at-a-time gate refusing a second session. It answers at
|
|
141
|
-
* `info` with the shared "finish or cancel your current edit first" copy, so the block reads as
|
|
142
|
-
* a rule of the editor rather than a fault, and it drops the action prefix: the rule is the
|
|
143
|
-
* whole message, and naming what it refused would read as a fault report for something the
|
|
144
|
-
* editor is simply not doing yet.
|
|
145
|
-
* - a refusal met while a create's request is out ({@link refusedForCreate}: the one-edit
|
|
146
|
-
* refusal of a create, or the `conflict` of a staged draft's held session) answers at `info`
|
|
147
|
-
* with `failure.createInProgress`, since nothing is for the reader to finish, cancel or reload.
|
|
148
|
-
* - a refusal that answers the write's `Idempotency-Key` ({@link keyedWriteOf}) answers at
|
|
149
|
-
* `info` with `failure.writeRunning` for a write still being made and `failure.writeMade` for
|
|
150
|
-
* one the API made: the write is being saved, or was, so nothing is to be asked for again.
|
|
151
|
-
*
|
|
152
|
-
* It classifies on the structured `code` rather than on the message text, which is what lets the
|
|
153
|
-
* reason chain and the carve-outs read the same vocabulary the bus stamps; the one `error` it
|
|
154
|
-
* reads is that of a refusal met while a create is out ({@link refusedForCreate}), and the tag
|
|
155
|
-
* the bus opens a keyed write's refusal with ({@link keyedWriteOf}). The copy for
|
|
156
|
-
* that vocabulary is keyed by the code itself, and a code it holds no sentence for reads as
|
|
157
|
-
* `failure.generic`.
|
|
158
|
-
*
|
|
159
|
-
* @example
|
|
160
|
-
* ```ts
|
|
161
|
-
* declare const itineraryId: string;
|
|
162
|
-
* declare const segmentId: string;
|
|
163
|
-
*
|
|
164
|
-
* const result = await bus.dispatch(ctx, "studio.itinerary.segment.remove", {
|
|
165
|
-
* itineraryId,
|
|
166
|
-
* segmentId,
|
|
167
|
-
* });
|
|
168
|
-
* const alert = failureAlertFor(
|
|
169
|
-
* result,
|
|
170
|
-
* "This segment could not be deleted.",
|
|
171
|
-
* studioStrings.en.failure,
|
|
172
|
-
* );
|
|
173
|
-
* if (alert !== null) {
|
|
174
|
-
* void bus.dispatch(ctx, "studio.alert.show", alert);
|
|
175
|
-
* }
|
|
176
|
-
* ```
|
|
177
|
-
*/
|
|
178
|
-
declare const failureAlertFor: (result: ToolResult, action: string, failure: StudioStrings["failure"]) => {
|
|
179
|
-
level: "error" | "info";
|
|
180
|
-
message: string;
|
|
181
|
-
} | null;
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* The alert/field split a studio form shows when an action did not take, resolved from the
|
|
185
|
-
* published copy.
|
|
186
|
-
*
|
|
187
|
-
* It sits beside the copy bundle it reads, and every import in this module resolves inside its
|
|
188
|
-
* own package. Nothing here renders. A refusal maps to a sentence and a field the same way for a
|
|
189
|
-
* React dialog, a Flutter form and a command-line tool, which is what makes this the studio's
|
|
190
|
-
* business rather than a binding's.
|
|
191
|
-
*/
|
|
192
|
-
/**
|
|
193
|
-
* FormErrorCopy is the `formError` section of the studio's published copy, and the whole of
|
|
194
|
-
* what these mappers read.
|
|
195
|
-
*
|
|
196
|
-
* Narrow rather than the whole bundle, and the copy rather than an i18next `t`: the section
|
|
197
|
-
* already has the shape the resolution needs (a message per code, plus a nested object per
|
|
198
|
-
* resource for the codes whose wording differs by entity), so a lookup reads a property
|
|
199
|
-
* instead of building a dotted key that nothing checks.
|
|
200
|
-
*/
|
|
201
|
-
type FormErrorCopy = StudioStrings["formError"];
|
|
202
|
-
/**
|
|
203
|
-
* FormErrorResource names the entity a form governs, which selects the
|
|
204
|
-
* resource-specific error copy when a code has a per-resource message (a name
|
|
205
|
-
* `conflict` reads differently for an itinerary than a collection). It is open to
|
|
206
|
-
* the families the studio forms and the dialogs cover; a resource with no
|
|
207
|
-
* specialized copy for a given code falls back to the generic per-code message.
|
|
208
|
-
*/
|
|
209
|
-
type FormErrorResource = "collection" | "itinerary" | "organization" | "zone";
|
|
210
|
-
/**
|
|
211
|
-
* FormErrorOptions carry the copy section the message resolves through and, where the form governs
|
|
212
|
-
* a resource's name, the resource it is specialized for. Kept a small config object (not React) so
|
|
213
|
-
* the mapper is a pure function a panel, a dialog, or a unit test can call the same way.
|
|
214
|
-
*/
|
|
215
|
-
interface FormErrorOptions {
|
|
216
|
-
/** The section the message is read from. */
|
|
217
|
-
copy: FormErrorCopy;
|
|
218
|
-
/**
|
|
219
|
-
* The resource whose own `conflict` sentence a conflict reads: that sentence speaks of the
|
|
220
|
-
* resource's name. Omitted for a refusal about no resource's name (a share link), which reads
|
|
221
|
-
* the shared `conflict` line.
|
|
222
|
-
*/
|
|
223
|
-
resource?: FormErrorResource | undefined;
|
|
224
|
-
}
|
|
225
|
-
/**
|
|
226
|
-
* mapToolError turns a failed `ToolResult` into the one sentence a form shows above its footer.
|
|
227
|
-
*
|
|
228
|
-
* It reads the failure's machine-readable `code` and its `detail`, most specific first:
|
|
229
|
-
*
|
|
230
|
-
* 1. for a refusal met while a create's request is out (the one-edit refusal of a create, or
|
|
231
|
-
* the `conflict` of a staged draft's held session), `formError.createInProgress`
|
|
232
|
-
* ({@link refusedForCreate});
|
|
233
|
-
* 2. for a refusal that answers the write's `Idempotency-Key` ({@link keyedWriteOf}),
|
|
234
|
-
* `formError.writeRunning` for a write still being made and `formError.writeMade` for one
|
|
235
|
-
* the API made, neither of which asks for the write again;
|
|
236
|
-
* 3. for a write made conditional on a version the resource has moved past ({@link
|
|
237
|
-
* versionMoved}), the shared `formError.conflict` line: the resource changed since the reader
|
|
238
|
-
* opened it, and no name of theirs is taken;
|
|
239
|
-
* 4. for any other `conflict`, the resource's own conflict copy, which names what the reader
|
|
240
|
-
* can correct (a taken name), whatever the server said of it; with no `resource`, the
|
|
241
|
-
* shared `formError.conflict` line;
|
|
242
|
-
* 5. the server's `detail`, its already-localized sentence for this refusal, which names the
|
|
243
|
-
* actual problem where a per-code line can only name the category;
|
|
244
|
-
* 6. the copy's sentence for the code, the same across every resource;
|
|
245
|
-
* 7. the last-resort line, `formError.generic`.
|
|
246
|
-
*
|
|
247
|
-
* {@link mapRestError} reads a thrown REST error by the same chain, the create hold aside (no
|
|
248
|
-
* request answers it), with the code the tool bus classifies that error by. So a refusal reads as
|
|
249
|
-
* one sentence whether a panel met it through a tool or a dialog through a request. A `detail`
|
|
250
|
-
* that is empty or blank is read as absent, there as here: a blank line is a form that refused and
|
|
251
|
-
* would not say why. The sentence is answered without the space around it.
|
|
252
|
-
*
|
|
253
|
-
* It never shows the result's own `error`, and reads it only to recognise a refusal met while a
|
|
254
|
-
* create is out ({@link refusedForCreate}) and the tags the bus opens a keyed write's refusal
|
|
255
|
-
* ({@link keyedWriteOf}) and a moved version's ({@link versionMoved}) with. That string is narration written for a model and an
|
|
256
|
-
* event log, in the one language this package has, so showing it to a reader is showing a French
|
|
257
|
-
* reader an English sentence in a voice written for something that is not a person.
|
|
258
|
-
*
|
|
259
|
-
* @param result The tool's result. A successful one answers the empty string, so a caller
|
|
260
|
-
* renders its alert only for a sentence that is not empty.
|
|
261
|
-
* @param options The `formError` copy, and the resource whose name the form governs where it
|
|
262
|
-
* governs one.
|
|
263
|
-
* @returns The sentence, or the empty string for a result that is no failure.
|
|
264
|
-
*/
|
|
265
|
-
declare const mapToolError: (result: ToolResult, options: FormErrorOptions) => string;
|
|
266
|
-
/**
|
|
267
|
-
* RestFormError splits a mapped REST failure into the two slots a dialog surfaces
|
|
268
|
-
* it through: a `fieldError` shown under the offending input (a conflict-like
|
|
269
|
-
* rejection the user can correct in place) or a `formError` shown in the inline
|
|
270
|
-
* alert above the footer (everything else). Exactly one is non-null on a failure,
|
|
271
|
-
* matching how the studio panels split a tool failure between a field and the
|
|
272
|
-
* alert. The two slots let a dialog drive the same field/alert split a ToolResult
|
|
273
|
-
* caller gets, so a REST-backed dialog and a tool-backed panel read identically.
|
|
274
|
-
*/
|
|
275
|
-
interface RestFormError {
|
|
276
|
-
fieldError: string | null;
|
|
277
|
-
formError: string | null;
|
|
278
|
-
}
|
|
279
|
-
/**
|
|
280
|
-
* mapRestError turns a thrown REST mutation error into the field/alert split a dialog surfaces,
|
|
281
|
-
* so a REST-backed dialog reads as a tool-backed panel does through {@link mapToolError}. The
|
|
282
|
-
* classification, most specific first:
|
|
283
|
-
*
|
|
284
|
-
* 1. a 409 that answers the request's `Idempotency-Key` rather than the write maps, in the
|
|
285
|
-
* alert, to `formError.writeRunning` (coded `IDEMPOTENCY_KEY_IN_USE`: the first request is
|
|
286
|
-
* still running) or `formError.writeMade` (coded `IDEMPOTENCY_ANSWER_UNAVAILABLE`: the write
|
|
287
|
-
* was made and its answer cannot be given again), read through the classification the tool
|
|
288
|
-
* bus gives the same throw ({@link keyedWriteOf}). Neither asks for the write again, which
|
|
289
|
-
* under a new key would make it twice, and neither names a field;
|
|
290
|
-
* 2. a conflict-like envelope (a 409, or an entry coded CONFLICT) maps, on the field, to the
|
|
291
|
-
* resource's conflict copy (a taken name), or to the shared `formError.conflict` line where
|
|
292
|
-
* the options name no resource;
|
|
293
|
-
* 3. any other envelope surfaces, in the alert, the message of its first entry that is an
|
|
294
|
-
* object, without the space around it, so the API's specific wording (an invalid field,
|
|
295
|
-
* a refused value) reads as the server wrote it. A message that is absent, no string, empty
|
|
296
|
-
* or blank is read as none: a blank alert is a form that refused and would not say why;
|
|
297
|
-
* 4. an envelope with no sentence to read answers the copy's sentence for the code the tool bus
|
|
298
|
-
* classifies the thrown error by (`codeForThrown`: a 403 is `forbidden`, a 404 `not-found`,
|
|
299
|
-
* a 429 `rate-limited`), which is the line {@link mapToolError} answers for the same
|
|
300
|
-
* refusal met through a tool;
|
|
301
|
-
* 5. anything else (a network or parse failure, a status the bus names no code for, a code the
|
|
302
|
-
* copy holds no sentence for) falls to the generic alert line.
|
|
303
|
-
*
|
|
304
|
-
* Pure: it takes the copy, and a resource where the form governs one, and reads no React state,
|
|
305
|
-
* so every REST dialog shares one mapping.
|
|
306
|
-
*/
|
|
307
|
-
declare const mapRestError: (error: unknown, options: FormErrorOptions) => RestFormError;
|
|
308
|
-
|
|
309
|
-
/**
|
|
310
|
-
* ManeuverCopy is the `maneuver` section this module reads: one entry per maneuver, plus a
|
|
311
|
-
* `Plain` twin for the case where the router named no road.
|
|
312
|
-
*
|
|
313
|
-
* The named entries take the road name, so they are FUNCTIONS rather than strings with a
|
|
314
|
-
* token in them, which is what lets a language put the name somewhere English does not.
|
|
315
|
-
*/
|
|
316
|
-
type ManeuverCopy = StudioStrings["maneuver"];
|
|
317
|
-
/**
|
|
318
|
-
* ManeuverGlyph is the vector shape a maneuver renders as on the directions sheet:
|
|
319
|
-
* a set of 24x24 stroke paths and an optional clockwise rotation (degrees) applied
|
|
320
|
-
* about the icon center. Most maneuvers are one upward arrow rotated to the turn
|
|
321
|
-
* direction; the destination gets its own flag.
|
|
322
|
-
*/
|
|
323
|
-
interface ManeuverGlyph {
|
|
324
|
-
paths: string[];
|
|
325
|
-
rotate?: number | undefined;
|
|
326
|
-
}
|
|
327
|
-
/**
|
|
328
|
-
* maneuverIcon maps each ManeuverType to its glyph. It is exhaustive over
|
|
329
|
-
* ManeuverType (`Record<ManeuverType, …>`), so a maneuver added to the enum fails
|
|
330
|
-
* the type here until it is given a glyph. The turn family reuses ARROW at a compass
|
|
331
|
-
* angle (clockwise from straight up); depart/continue, the roundabout entries, and
|
|
332
|
-
* unknown fall back to a forward arrow with the instruction text carrying the nuance;
|
|
333
|
-
* goal is the flag.
|
|
334
|
-
*/
|
|
335
|
-
declare const maneuverIcon: Record<ManeuverType, ManeuverGlyph>;
|
|
336
|
-
/**
|
|
337
|
-
* maneuverText resolves the localized instruction for a step from its maneuver
|
|
338
|
-
* type, way name, and (for a roundabout) the exit to take.
|
|
339
|
-
*
|
|
340
|
-
* Which sentence is said is the geo layer's rule, `stepInstruction` of
|
|
341
|
-
* `@mountaya/elements/navigation`, and this resolves the copy key it answers with the arguments
|
|
342
|
-
* it names. When the step names a way (not empty and not the "-" the router writes for an
|
|
343
|
-
* unnamed one) it reads the named sentence, `copy[type](name)` ("Turn left onto Main Street");
|
|
344
|
-
* otherwise the nameless variant ("Turn left"). A roundabout carrying an exit number surfaces it
|
|
345
|
-
* through the shared `roundaboutExit` pair ("At the roundabout, take exit 2 onto Main Street").
|
|
346
|
-
* The keys live under `maneuver.*`, one pair (`<TYPE>` / `<TYPE>Plain`) per ManeuverType, so
|
|
347
|
-
* every maneuver has both forms in every language.
|
|
348
|
-
*
|
|
349
|
-
* @param exitNumber The roundabout exit to take. 0, the default, names none.
|
|
350
|
-
*/
|
|
351
|
-
declare const maneuverText: (copy: ManeuverCopy, type: ManeuverType, name: string, exitNumber?: number) => string;
|
|
352
|
-
|
|
353
|
-
/**
|
|
354
|
-
* The Custom matrix's value sets (FORMAT_OPTIONS, RESOLUTION_OPTIONS, FPS_OPTIONS,
|
|
355
|
-
* QUALITY_OPTIONS, ASPECT_OPTIONS), hoisted so the static option lists are not rebuilt per
|
|
356
|
-
* render and shared between the Format step (which renders the matrix) and the Review step
|
|
357
|
-
* (which resolves a chosen value back to its label). Resolution and aspect are
|
|
358
|
-
* self-labelling literals (720p, 16:9) so they carry no locale key; format, fps, and quality
|
|
359
|
-
* carry a `labelKey` naming an entry of the published video.format.matrix namespace at
|
|
360
|
-
* render. Each value is exactly the cameraOutput field it sets, so a matrix change spreads
|
|
361
|
-
* straight over the output.
|
|
362
|
-
*
|
|
363
|
-
* Each list is held to the vocabulary `@mountaya/elements/camera` closes, both ways and by the
|
|
364
|
-
* compiler: {@link wholeVocabulary} refuses a list short of a member as the element type refuses
|
|
365
|
-
* a wrong one, and a labelled list takes its keys from a record with one entry per member. The
|
|
366
|
-
* tie is in the types, so this entry imports no value from the camera's.
|
|
367
|
-
*/
|
|
368
|
-
/**
|
|
369
|
-
* MatrixBank is the published format-matrix copy bank, and MatrixLabel a key of it. Typing
|
|
370
|
-
* the tables against MatrixLabel is what makes them checkable. A dotted path
|
|
371
|
-
* ("matrix.fps24") would index the nested copy object with nothing: a lookup that compiles
|
|
372
|
-
* and renders as `undefined`, with nothing anywhere failing.
|
|
373
|
-
*
|
|
374
|
-
* MatrixLabel is narrowed to the entries that ARE a string. The bank also holds templates
|
|
375
|
-
* (`bitrateValue(count)`), and a key union covering those widens every lookup to
|
|
376
|
-
* `string | ((count: number) => string)`, which a label prop rejects, so the whole table
|
|
377
|
-
* would have to be cast back to what it already was.
|
|
378
|
-
*/
|
|
379
|
-
type MatrixBank = StudioStrings["video"]["format"]["matrix"];
|
|
380
|
-
type MatrixLabel = {
|
|
381
|
-
[K in keyof MatrixBank]: MatrixBank[K] extends string ? K : never;
|
|
382
|
-
}[keyof MatrixBank];
|
|
383
|
-
/**
|
|
384
|
-
* FORMAT_OPTIONS is the Custom matrix's container set, each labelled under the studio
|
|
385
|
-
* video.format.matrix namespace at render.
|
|
386
|
-
*/
|
|
387
|
-
declare const FORMAT_OPTIONS: readonly {
|
|
388
|
-
labelKey: MatrixLabel;
|
|
389
|
-
value: CameraOutputFormat;
|
|
390
|
-
}[];
|
|
391
|
-
/**
|
|
392
|
-
* RESOLUTION_OPTIONS is the Custom matrix's resolution set, self-labelling literals the
|
|
393
|
-
* segmented control renders directly.
|
|
394
|
-
*/
|
|
395
|
-
declare const RESOLUTION_OPTIONS: readonly CameraResolution[];
|
|
396
|
-
/**
|
|
397
|
-
* FPS_OPTIONS is the Custom matrix's frame-rate set, each labelled under the studio
|
|
398
|
-
* video.format.matrix namespace at render.
|
|
399
|
-
*/
|
|
400
|
-
declare const FPS_OPTIONS: readonly {
|
|
401
|
-
labelKey: MatrixLabel;
|
|
402
|
-
value: CameraFps;
|
|
403
|
-
}[];
|
|
404
|
-
/**
|
|
405
|
-
* QUALITY_OPTIONS is the Custom matrix's quality set, each labelled under the studio
|
|
406
|
-
* video.format.matrix namespace at render.
|
|
407
|
-
*/
|
|
408
|
-
declare const QUALITY_OPTIONS: readonly {
|
|
409
|
-
labelKey: MatrixLabel;
|
|
410
|
-
value: Quality;
|
|
411
|
-
}[];
|
|
412
|
-
/**
|
|
413
|
-
* ASPECT_OPTIONS is the Custom matrix's aspect set, self-labelling literals the segmented
|
|
414
|
-
* control renders directly.
|
|
415
|
-
*/
|
|
416
|
-
declare const ASPECT_OPTIONS: readonly CameraOutput["aspect"][];
|
|
417
|
-
|
|
418
|
-
/**
|
|
419
|
-
* PublicationState is the one question every publication surface asks: what does the
|
|
420
|
-
* PUBLIC see right now? Never published, published and current, or published and
|
|
421
|
-
* behind the editor. "loading" is a state of its own so neither wizard flashes the
|
|
422
|
-
* never-published panel in the frame between opening and the detail landing, and
|
|
423
|
-
* "error" is its own so a detail that will NEVER land is not shown as one that has
|
|
424
|
-
* not landed YET: a spinner that cannot resolve is the worst of the four.
|
|
425
|
-
*/
|
|
426
|
-
type PublicationState = "dirty" | "error" | "loading" | "published" | "unpublished";
|
|
427
|
-
/**
|
|
428
|
-
* publicationStateOf folds the two publication fields an itinerary's detail or a zone
|
|
429
|
-
* already carries into the single state every publication surface branches on. A zone
|
|
430
|
-
* is published as an itinerary is, so the two read alike.
|
|
431
|
-
*
|
|
432
|
-
* It must be given the DRAFT. A publication snapshot reports itself as published and
|
|
433
|
-
* never as behind, so the draft is the only surface that can answer "has the editor
|
|
434
|
-
* moved past what is live?", which is also why the wizards keep reading the draft for
|
|
435
|
-
* this while their preview reads the publication.
|
|
436
|
-
*
|
|
437
|
-
* `failed` separates the two reasons the record can be missing. A caller reading it
|
|
438
|
-
* off a query passes that query's own error flag, so a refused or unreachable fetch
|
|
439
|
-
* resolves to "error" instead of parking on "loading" for as long as the surface
|
|
440
|
-
* stays open. It defaults to false for the callers that hold the record already (the
|
|
441
|
-
* store's active itinerary or zone), where absence can only ever mean "not yet".
|
|
442
|
-
*
|
|
443
|
-
* @param resource The DRAFT itinerary detail or zone, or undefined while it has not landed.
|
|
444
|
-
* @param failed Whether the read of the record was refused.
|
|
445
|
-
* @default failed false
|
|
446
|
-
* @returns The state every publication surface branches on.
|
|
447
|
-
*/
|
|
448
|
-
declare const publicationStateOf: (resource: ItineraryWithDetails | Zone | undefined, failed?: boolean) => PublicationState;
|
|
449
|
-
/**
|
|
450
|
-
* PublicationCopy is the slice of the copy bundle that names a publication state.
|
|
451
|
-
*/
|
|
452
|
-
type PublicationCopy = StudioStrings["publish"];
|
|
453
|
-
/**
|
|
454
|
-
* publicationLabel names a state in one word, read off the `publish` section of the copy.
|
|
455
|
-
*
|
|
456
|
-
* One word on purpose: it is read at a glance beside a coloured mark, and the sentence that
|
|
457
|
-
* explains the state belongs in the hint next to it. A longer label truncates, in French first,
|
|
458
|
-
* and the state is unreadable exactly when it matters.
|
|
459
|
-
*
|
|
460
|
-
* Every state has its own word. A detail that has not landed reads as loading and never as a
|
|
461
|
-
* draft, so a badge painted before the detail arrives does not tell the owner of a published
|
|
462
|
-
* itinerary that the public sees nothing.
|
|
463
|
-
*
|
|
464
|
-
* It lives here and not in a surface that paints it, so the editor's status line and the
|
|
465
|
-
* unpublished panel's badge call one state one thing. The copy is read by property, so a word
|
|
466
|
-
* that moves is a compile error here and not a blank badge.
|
|
467
|
-
*
|
|
468
|
-
* @param copy The `publish` section of the language the label reads in.
|
|
469
|
-
* @param state The publication state to name.
|
|
470
|
-
* @returns The state's word.
|
|
471
|
-
*/
|
|
472
|
-
declare const publicationLabel: (copy: PublicationCopy, state: PublicationState) => string;
|
|
473
|
-
/**
|
|
474
|
-
* publicationColor is the one place a publication state becomes a colour. Every
|
|
475
|
-
* surface that paints the state reads it here rather than deciding it again, so a badge in
|
|
476
|
-
* the editor and a notice on a wizard preview cannot drift into saying the same thing
|
|
477
|
-
* in two hues. Grey for never published (inert, nothing is live), orange for behind
|
|
478
|
-
* (the state that needs an act), teal for current (settled). "loading" borrows grey
|
|
479
|
-
* because it renders nothing until the detail lands; "error" is red, the one state
|
|
480
|
-
* that is a fault rather than a stage of the publication.
|
|
481
|
-
*/
|
|
482
|
-
declare const publicationColor: Record<PublicationState, string>;
|
|
483
|
-
|
|
484
|
-
/**
|
|
485
|
-
* SearchLabelCopy is the `search.labels` section this module reads: the word each wire value of
|
|
486
|
-
* a search result reads as, by the kind of value it is.
|
|
487
|
-
*/
|
|
488
|
-
type SearchLabelCopy = StudioStrings["search"]["labels"];
|
|
489
|
-
/**
|
|
490
|
-
* searchLabelWord answers the word a reader reads for one wire value of a search result, in the
|
|
491
|
-
* language `copy` is in, or `undefined` for a value the copy has no word for.
|
|
492
|
-
*
|
|
493
|
-
* It is the body of the `resolveLabel` a `SearchWording` of `@mountaya/elements/search` takes: a
|
|
494
|
-
* surface that mounts a search hands over `(label) => searchLabelWord(copy, label)` beside the
|
|
495
|
-
* viewer's units, and every row's category and way tags read in the language of the studio
|
|
496
|
-
* instead of as English titles of the wire values.
|
|
497
|
-
*
|
|
498
|
-
* A place's and a POI's category always have a word, since the copy holds every member of both
|
|
499
|
-
* vocabularies. A way's `highway`, `sac_scale` and `surface` tags are open, so a tag the copy
|
|
500
|
-
* does not hold answers `undefined` and the describer words the tag itself. The value is read as
|
|
501
|
-
* an own property of the copy, so a tag spelled like a member every object inherits
|
|
502
|
-
* (`constructor`) answers `undefined` too.
|
|
503
|
-
*
|
|
504
|
-
* The label is stated by the copy's own kinds, and every `SearchLabel` of
|
|
505
|
-
* `@mountaya/elements/search` is one. That type is not named here: the declarations of the
|
|
506
|
-
* search entry reach the map's shared types, and with them the DOM library, which a program
|
|
507
|
-
* that reads this entry for its words does not name.
|
|
508
|
-
*
|
|
509
|
-
* @param copy The `search.labels` section of the language the row reads in.
|
|
510
|
-
* @param label The wire value to word, with the kind of value it is.
|
|
511
|
-
* @returns The word, or `undefined` when the copy holds none for the value.
|
|
512
|
-
*
|
|
513
|
-
* @example
|
|
514
|
-
* ```ts
|
|
515
|
-
* import { frStudioStrings } from "@mountaya/studio/strings/fr";
|
|
516
|
-
*
|
|
517
|
-
* const labels = frStudioStrings.search.labels;
|
|
518
|
-
*
|
|
519
|
-
* searchLabelWord(labels, { kind: "poiCategory", value: "HUT" }); // "Refuge"
|
|
520
|
-
* searchLabelWord(labels, { kind: "highway", value: "corridor" }); // undefined
|
|
521
|
-
* ```
|
|
522
|
-
*/
|
|
523
|
-
declare const searchLabelWord: (copy: SearchLabelCopy, label: {
|
|
524
|
-
readonly kind: keyof SearchLabelCopy;
|
|
525
|
-
readonly value: string;
|
|
526
|
-
}) => string | undefined;
|
|
527
|
-
|
|
528
|
-
/**
|
|
529
|
-
* The words a chain verb's refusal is quoted with, filed beside the words rather than beside
|
|
530
|
-
* the chain.
|
|
531
|
-
*
|
|
532
|
-
* Every name here resolves a STATE into a copy key, which is what `@mountaya/studio/strings`
|
|
533
|
-
* is for, and it is also what keeps it off the root barrel. `keyof StudioStrings["segmentMenu"]`
|
|
534
|
-
* makes the whole bundle part of this module's declarations, so filing it on the root would
|
|
535
|
-
* have every consumer who imports a tool contract type-check all of it to reach a merge hint.
|
|
536
|
-
* `barrelParity.test.ts`'s declaration ceiling holds the root to that; the entry doc one
|
|
537
|
-
* directory up states the rule.
|
|
538
|
-
*/
|
|
539
|
-
/**
|
|
540
|
-
* SegmentMergeDisabledReason is what a ROW's menu explains: the refusals the chain model
|
|
541
|
-
* derives ({@link SegmentMergeRefusal}), plus the two ends of the chain, which no gutter can
|
|
542
|
-
* carry.
|
|
543
|
-
*
|
|
544
|
-
* The tail row has no successor to fold into and the head row has no predecessor, and neither
|
|
545
|
-
* has a gutter on that side to say so, so the row is the only surface that has to word them,
|
|
546
|
-
* which is why they widen the union here rather than in the rule that produces the others.
|
|
547
|
-
*/
|
|
548
|
-
type SegmentMergeDisabledReason = SegmentMergeRefusal | "head" | "tail";
|
|
549
|
-
/**
|
|
550
|
-
* mergeDisabledHintKey pairs each refusal with the KEY of the line that explains it, so the
|
|
551
|
-
* gutter's disabled pill and the row menu's disabled item quote the same sentence
|
|
552
|
-
* for the same condition rather than drifting into two vocabularies for one rule.
|
|
553
|
-
*/
|
|
554
|
-
declare const mergeDisabledHintKey: Record<SegmentMergeDisabledReason, keyof StudioStrings["segmentMenu"]>;
|
|
555
|
-
/**
|
|
556
|
-
* SegmentSplitDisabledReason names why a row's Split verb is inert for a reason of its
|
|
557
|
-
* OWN: an authoring edit already owns the map, so the split's point-pick gesture cannot
|
|
558
|
-
* arm over it.
|
|
559
|
-
*/
|
|
560
|
-
type SegmentSplitDisabledReason = "editing";
|
|
561
|
-
/**
|
|
562
|
-
* splitDisabledHintKey pairs each split refusal with the line that explains it, the
|
|
563
|
-
* twin of mergeDisabledHintKey. The "editing" line is the one the blocked add
|
|
564
|
-
* control and the blocked row click already raise, so all three name the open edit
|
|
565
|
-
* with one sentence.
|
|
566
|
-
*/
|
|
567
|
-
declare const splitDisabledHintKey: Record<SegmentSplitDisabledReason, keyof StudioStrings["segmentMenu"]>;
|
|
568
|
-
|
|
569
|
-
/**
|
|
570
|
-
* studioStrings is the studio's copy built in, keyed by language: English, the language every
|
|
571
|
-
* other one falls back to.
|
|
572
|
-
*
|
|
573
|
-
* The studio's half of the family's two bundles. `elementsStrings` of `@mountaya/elements/i18n`
|
|
574
|
-
* carries what the ELEMENTS say (a control's label, a table's header, the sentence a refused edit
|
|
575
|
-
* reports), and this carries what the STUDIO says: its dialogs, its wizards, its panels, its
|
|
576
|
-
* publish and share flows. They are two bundles rather than one because they are read by
|
|
577
|
-
* different things and overridden for different reasons, and one merged object would hand every
|
|
578
|
-
* control's `useMountayaStrings()` the whole of the studio's copy, which it has no surface for.
|
|
579
|
-
*
|
|
580
|
-
* Every other language Mountaya translates the studio into is an entry of its own a host imports
|
|
581
|
-
* and hands over among the {@link Translations} (`frStudioStrings` of
|
|
582
|
-
* `@mountaya/studio/strings/fr`), so a page that reads in English loads no other language's
|
|
583
|
-
* words. Everything else about the two bundles is deliberately identical: the same leaf shape,
|
|
584
|
-
* the same partial override, the same per-language form, the same merge.
|
|
585
|
-
*/
|
|
586
|
-
declare const studioStrings: Readonly<{
|
|
587
|
-
en: StudioStrings;
|
|
588
|
-
}>;
|
|
589
|
-
/**
|
|
590
|
-
* studioLanguageOptions is the option list a language picker of the studio offers: English, then
|
|
591
|
-
* every language a host handed over among `translations`, each labelled with its own endonym.
|
|
592
|
-
*
|
|
593
|
-
* Published as a list rather than left to each surface to build, because "which languages this
|
|
594
|
-
* studio is available in" is one answer and a surface that derives it separately is a surface
|
|
595
|
-
* that can offer a different set. It offers only languages whose words the page loaded, so a
|
|
596
|
-
* picker never switches the studio into a language it would read in English.
|
|
597
|
-
*
|
|
598
|
-
* @param translations The studio's words a host imported, keyed by language.
|
|
599
|
-
* @returns English first, then each language handed over, in the order `MAP_LANGUAGES` states.
|
|
600
|
-
*
|
|
601
|
-
* @example
|
|
602
|
-
* ```ts
|
|
603
|
-
* import { studioLanguageOptions } from "@mountaya/studio/strings";
|
|
604
|
-
* import { frStudioStrings } from "@mountaya/studio/strings/fr";
|
|
605
|
-
*
|
|
606
|
-
* const options = studioLanguageOptions({ fr: frStudioStrings });
|
|
607
|
-
* // options is [{ label: "English", value: "en" }, { label: "Français", value: "fr" }]
|
|
608
|
-
* ```
|
|
609
|
-
*/
|
|
610
|
-
declare const studioLanguageOptions: (translations?: Translations<StudioStrings>) => readonly {
|
|
611
|
-
label: string;
|
|
612
|
-
value: MapLanguage;
|
|
613
|
-
}[];
|
|
614
|
-
/**
|
|
615
|
-
* A partial override, at whatever depth it reaches.
|
|
616
|
-
*
|
|
617
|
-
* An alias for `PartialDeep` in `@mountaya/elements/i18n`, kept as a name because it is what a
|
|
618
|
-
* consumer reads in the override prop's type. One spelling of "an override at any depth" serves
|
|
619
|
-
* the studio's copy and the elements' alike, since there is one depth rule.
|
|
620
|
-
*/
|
|
621
|
-
type PartialCopy<T = StudioStrings> = PartialDeep<T>;
|
|
622
|
-
/**
|
|
623
|
-
* StudioStringsOverrides is a consumer's override of the studio's copy, in one of two shapes.
|
|
624
|
-
*
|
|
625
|
-
* A flat {@link PartialCopy} overrides whichever language is selected. A
|
|
626
|
-
* `BundleLanguageOverrides` names each language it overrides and leaves the rest alone, and its
|
|
627
|
-
* members state `undefined`, so a consumer under `exactOptionalPropertyTypes` forwards a
|
|
628
|
-
* translation it may not hold. They are the two shapes `ElementsStringsOverrides` offers, for
|
|
629
|
-
* the same reason: a consumer replacing one sentence in its own product's voice thinks in one
|
|
630
|
-
* language, and a consumer shipping a language Mountaya does not carry thinks in all of them.
|
|
631
|
-
*
|
|
632
|
-
* An override is one shape or the other, never both: {@link resolveStudioStrings} refuses an
|
|
633
|
-
* object that names a language and a section together.
|
|
634
|
-
*/
|
|
635
|
-
type StudioStringsOverrides = PartialCopy | BundleLanguageOverrides<StudioStrings>;
|
|
636
|
-
/**
|
|
637
|
-
* resolveStudioStrings selects a language's copy and folds a consumer's overrides onto it.
|
|
638
|
-
*
|
|
639
|
-
* It is `resolveBundle` of `@mountaya/elements/i18n` over {@link studioStrings} and the
|
|
640
|
-
* translations a host handed over, so the fallback, the two override shapes and the merge are
|
|
641
|
-
* the ones every bundle of the family resolves by. A language with no words reads in English: a
|
|
642
|
-
* studio in the wrong language is usable, and one that refuses to mount is not. French asked for
|
|
643
|
-
* and not handed over reads the same way, and says so once in development, naming the import.
|
|
644
|
-
*
|
|
645
|
-
* It returns the built-in or handed-over bundle itself when there is nothing to fold, which
|
|
646
|
-
* includes an override aimed at another language, so a provider that compares the result by
|
|
647
|
-
* reference re-renders nothing for a patch that changes nothing.
|
|
648
|
-
*
|
|
649
|
-
* @param language The language to resolve. Defaults to `"en"`.
|
|
650
|
-
* @param overrides The consumer's override, in either shape of {@link StudioStringsOverrides}.
|
|
651
|
-
* @param translations The studio's words a host imported, keyed by language.
|
|
652
|
-
* @returns The resolved copy: the bundle's own object when no override folds, a new object
|
|
653
|
-
* otherwise.
|
|
654
|
-
* @throws {MountayaElementsError} When `overrides` names a language and a section together, with
|
|
655
|
-
* both lists in the message.
|
|
656
|
-
*
|
|
657
|
-
* @example
|
|
658
|
-
* ```ts
|
|
659
|
-
* import { resolveStudioStrings } from "@mountaya/studio/strings";
|
|
660
|
-
* import { frStudioStrings } from "@mountaya/studio/strings/fr";
|
|
661
|
-
*
|
|
662
|
-
* const words = resolveStudioStrings("fr", { fr: { share: { copy: "Copier" } } }, {
|
|
663
|
-
* fr: frStudioStrings,
|
|
664
|
-
* });
|
|
665
|
-
* ```
|
|
666
|
-
*/
|
|
667
|
-
declare const resolveStudioStrings: (language?: MapLanguage, overrides?: StudioStringsOverrides, translations?: Translations<StudioStrings>) => StudioStrings;
|
|
668
|
-
|
|
669
|
-
/**
|
|
670
|
-
* UnitCopy is the `preferences.units` slice these builders read, and nothing else.
|
|
671
|
-
*
|
|
672
|
-
* Narrow rather than the whole bundle for the reason the bundle itself is split from the
|
|
673
|
-
* elements' strings: a builder that names the whole of the copy to reach a handful of keys is
|
|
674
|
-
* harder to read for nobody's benefit, and a reader of this signature learns exactly which copy
|
|
675
|
-
* moves it.
|
|
676
|
-
*/
|
|
677
|
-
type UnitCopy = StudioStrings["preferences"]["units"];
|
|
678
|
-
/**
|
|
679
|
-
* UnitOption is one selectable unit in a unit picker: the localized `name` shown
|
|
680
|
-
* below the card, the `symbol` shown as the card's media (°, %, km, …), and the
|
|
681
|
-
* domain `value` dispatched on selection. The value defaults to a plain string so
|
|
682
|
-
* a grid can hold mixed unit families through `UnitOption`, while each builder
|
|
683
|
-
* narrows it to its own unit union (UnitOption<UnitLength> and friends).
|
|
684
|
-
*/
|
|
685
|
-
interface UnitOption<V extends string = string> {
|
|
686
|
-
name: string;
|
|
687
|
-
symbol: string;
|
|
688
|
-
value: V;
|
|
689
|
-
}
|
|
690
|
-
/**
|
|
691
|
-
* lengthUnitOptions builds the metric/imperial length options from the shared
|
|
692
|
-
* preferences unit copy, the same `preferences.units.*` keys the preferences
|
|
693
|
-
* panel and the overlay step render. It is a pure function of the copy (not a
|
|
694
|
-
* hook), so the same array drives any unit grid and stays unit-testable without
|
|
695
|
-
* a React tree.
|
|
696
|
-
*/
|
|
697
|
-
declare const lengthUnitOptions: (units: UnitCopy) => readonly UnitOption<UnitLength>[];
|
|
698
|
-
/**
|
|
699
|
-
* paceUnitOptions builds the speed/pace options (the FORM a travel rate is stated in)
|
|
700
|
-
* from the shared preferences unit copy. Pure, like lengthUnitOptions.
|
|
701
|
-
*
|
|
702
|
-
* It is the one builder that takes a SECOND preference, and it has to: this choice does not
|
|
703
|
-
* pick a unit, it picks a form, and the unit that form resolves to is the product of this
|
|
704
|
-
* choice and `length`. So the card states what the reader will actually see (`km/h` and
|
|
705
|
-
* `min/km` for a metric reader, `mph` and `min/mi` for an imperial one) rather than listing
|
|
706
|
-
* both systems and leaving them to work out which half applies to them.
|
|
707
|
-
*
|
|
708
|
-
* Naming both (`km/h · mph`) would be wrong for a second reason beyond the noise: it reads as
|
|
709
|
-
* a second, contradicting way to ask for imperial, on a card that cannot change the system at
|
|
710
|
-
* all.
|
|
711
|
-
*
|
|
712
|
-
* @param units The `preferences.units` copy the cards are worded from.
|
|
713
|
-
* @param length The reader's length system, which picks the symbol each card states.
|
|
714
|
-
* @returns The per-time card, then the per-distance card.
|
|
715
|
-
*/
|
|
716
|
-
declare const paceUnitOptions: (units: UnitCopy, length: UnitLength) => readonly UnitOption<UnitPace>[];
|
|
717
|
-
/**
|
|
718
|
-
* slopeUnitOptions builds the degrees/percentage slope options from the shared
|
|
719
|
-
* preferences unit copy. Pure, like lengthUnitOptions.
|
|
720
|
-
*/
|
|
721
|
-
declare const slopeUnitOptions: (units: UnitCopy) => readonly UnitOption<UnitSlope>[];
|
|
722
|
-
/**
|
|
723
|
-
* temperatureUnitOptions builds the celsius/fahrenheit options from the shared
|
|
724
|
-
* preferences unit copy. Pure, like lengthUnitOptions. The preferences panel is the one
|
|
725
|
-
* picker of a temperature unit, and the builder sits beside its siblings so another
|
|
726
|
-
* temperature picker reuses the same copy.
|
|
727
|
-
*/
|
|
728
|
-
declare const temperatureUnitOptions: (units: UnitCopy) => readonly UnitOption<UnitTemperature>[];
|
|
729
|
-
|
|
730
|
-
export { ASPECT_OPTIONS, CONFIRM_COPY_LABELS, ConfirmationValues, EMPTY_STRINGS, FORMAT_OPTIONS, FPS_OPTIONS, ManeuverType, QUALITY_OPTIONS, RESOLUTION_OPTIONS, SegmentMergeRefusal, StudioStrings, ToolResult, UnitLength, UnitPace, UnitSlope, UnitTemperature, confirmSentence, failureAlertFor, lengthUnitOptions, maneuverIcon, maneuverText, mapRestError, mapToolError, mergeDisabledHintKey, paceUnitOptions, publicationColor, publicationLabel, publicationStateOf, resolveStudioStrings, searchLabelWord, slopeUnitOptions, splitDisabledHintKey, studioLanguageOptions, studioStrings, temperatureUnitOptions, toolNamesFor };
|
|
731
|
-
export type { DraftEditorFlow, DraftEditorToolNames, FormErrorCopy, FormErrorOptions, FormErrorResource, ManeuverCopy, ManeuverGlyph, PartialCopy, PublicationCopy, PublicationState, RestFormError, SearchLabelCopy, SegmentMergeDisabledReason, SegmentSplitDisabledReason, StudioStringsOverrides, UnitCopy, UnitOption };
|
|
1
|
+
import { A as maneuverIcon, B as DraftEditorToolNames, C as ASPECT_OPTIONS, Ct as UnitSlope, D as RESOLUTION_OPTIONS, E as QUALITY_OPTIONS, F as RestFormError, Ft as ConfirmationValues, H as toolNamesFor, I as mapRestError, L as mapToolError, M as FormErrorCopy, N as FormErrorOptions, O as ManeuverCopy, P as FormErrorResource, R as failureAlertFor, S as publicationStateOf, St as UnitPace, T as FPS_OPTIONS, U as CONFIRM_COPY_LABELS, V as EMPTY_STRINGS, W as confirmSentence, Xt as ToolResult, Y as SegmentMergeRefusal, _ as searchLabelWord, a as slopeUnitOptions, b as publicationColor, c as StudioStringsOverrides, d as studioStrings, f as SegmentMergeDisabledReason, g as SearchLabelCopy, gt as ManeuverType, h as splitDisabledHintKey, i as paceUnitOptions, j as maneuverText, k as ManeuverGlyph, l as resolveStudioStrings, m as mergeDisabledHintKey, n as UnitOption, o as temperatureUnitOptions, p as SegmentSplitDisabledReason, r as lengthUnitOptions, s as PartialCopy, t as UnitCopy, u as studioLanguageOptions, v as PublicationCopy, w as FORMAT_OPTIONS, wt as UnitTemperature, x as publicationLabel, xt as UnitLength, y as PublicationState, z as DraftEditorFlow } from "../chunk-CLGvBOVH.cjs";
|
|
2
|
+
import { t as StudioStrings } from "../chunk-IaIDQflj.cjs";
|
|
3
|
+
export { ASPECT_OPTIONS, CONFIRM_COPY_LABELS, type ConfirmationValues, type DraftEditorFlow, type DraftEditorToolNames, EMPTY_STRINGS, FORMAT_OPTIONS, FPS_OPTIONS, type FormErrorCopy, type FormErrorOptions, type FormErrorResource, type ManeuverCopy, type ManeuverGlyph, type ManeuverType, type PartialCopy, type PublicationCopy, type PublicationState, QUALITY_OPTIONS, RESOLUTION_OPTIONS, type RestFormError, type SearchLabelCopy, type SegmentMergeDisabledReason, type SegmentMergeRefusal, type SegmentSplitDisabledReason, type StudioStrings, type StudioStringsOverrides, type ToolResult, type UnitCopy, type UnitLength, type UnitOption, type UnitPace, type UnitSlope, type UnitTemperature, confirmSentence, failureAlertFor, lengthUnitOptions, maneuverIcon, maneuverText, mapRestError, mapToolError, mergeDisabledHintKey, paceUnitOptions, publicationColor, publicationLabel, publicationStateOf, resolveStudioStrings, searchLabelWord, slopeUnitOptions, splitDisabledHintKey, studioLanguageOptions, studioStrings, temperatureUnitOptions, toolNamesFor };
|