@graview/embed 0.1.15 → 0.1.17

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/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Mount a declared Graview app into any element — a paragraph of a docs page, a
4
4
  card on a dashboard, a preview in a builder — without the Shell, sized to the
5
- element, themed within it, and switchable between its faces.
5
+ element, themed within it, under one app bar.
6
6
 
7
7
  ```ts
8
8
  import { mount } from "@graview/embed";
@@ -10,22 +10,58 @@ import { mount } from "@graview/embed";
10
10
  const handle = mount(document.querySelector("#garden")!, {
11
11
  app, // defineApp(...)
12
12
  seed, // the graph to open with, or nothing
13
- face: "graview", // "scene" | "graview" | "pages" | "picture" — one named lens, no chrome: stop "#view=<place>"
13
+ face: "graview", // "scene" | "graview" | "pages" | "picture" — one named lens, no chrome: stop "#view=<place>"; leave it out and the app opens on its home view, else the scene
14
14
  stop: "#focus=plot-1", // the scene's view state, as its URL fragment
15
15
  principal: { kind: "human", id: "june", roles: ["coordinator"] },
16
- toggle: true, // the face switcher and Standing, above the picture
16
+ bar: true, // the app bar over every face (the default)
17
17
  });
18
18
 
19
- handle.setFace("pages"); // the routed face, at the element's width
19
+ handle.setPath("/plots"); // a place: the plots' list, at the element's width
20
+ handle.setPath("/places/overview"); // the scene, at its own address
20
21
  handle.setStop("#overview=1&expand=kind:plot");
21
22
  handle.unmount();
22
23
  ```
23
24
 
24
25
  `<Embed {...options} />` is the same thing as a React component.
25
26
 
27
+ ## The app bar
28
+
29
+ One bar stands over every face (FR-131). At the left, the app: its mark —
30
+ the brand's logo, when the document has one — and its name, said once, as
31
+ the page's heading (`heading`: `1` when the host's page is the app, `2`, the
32
+ default, inside an article, `false` when the host's own heading says it),
33
+ and the way home. Right after it, the switch between the app's two faces
34
+ (FR-137): "Scene" and "Pages", an icon and a word each (the icons alone on
35
+ a phone, the words their accessible names), two buttons whose
36
+ `aria-pressed` says which is drawn. Scene draws the scene under the bar;
37
+ Pages goes back to the page the reader was on. A declaration may call them
38
+ something else (`pages: { scene: "The farm", pages: "Lists" }`); the
39
+ scene's address is `/places/overview` whatever it is called. Then, on
40
+ Pages, the place you are on as one control — its name and a chevron — that
41
+ opens every place the app has (FR-138): the home first, then the Lists
42
+ (one per kind) and the Pictures (each named lens, and how the kinds
43
+ connect), each with its mark, a long name wrapped. Every place is two
44
+ presses away, Escape gives the keyboard back to the control, and the bar
45
+ is one row of 48 px however many places there are; on a phone the place
46
+ control is the page's first line, under the bar. At the right, three tools
47
+ of one size: Find (inline; ⌘K or Ctrl+K on a desk, a magnifier that opens
48
+ the box on a phone), the standing (a dot in the tone of the rules, a number
49
+ only when one is broken, opening what is broken; its name says "Everything
50
+ is in order" otherwise), and the person (an avatar whose menu holds who is
51
+ signed in, the seats, the host's own actions and, for whoever keeps the
52
+ app, the installation and the studio). `bar: false` draws none of it, for a
53
+ host whose own page already says all of that.
54
+
55
+ A HOME VIEW IS THE FRONT PAGE (FR-136). An app with a home view — the
56
+ declaration's `views.home`, or a worker view attached to `"home"` — opens
57
+ on Pages at its home, full width under the bar, on a desk as on a phone,
58
+ when the host names no face; under address routing it does so at the bare
59
+ address whatever face the host names. Nothing floats over the scene. A
60
+ declaration that names another first place (`pages.first`) opens there.
61
+
26
62
  ## What a page loads first
27
63
 
28
- The frame — the element's region, its theme, the strip, the provider — is
64
+ The frame — the element's region, its theme, the app bar, the provider — is
29
65
  on the page when `mount` returns. Each face is a chunk of its own, fetched
30
66
  the first time it is drawn: a page that opens on the pages never loads the
31
67
  scene, one that opens on the scene never loads the router, and the
@@ -49,12 +85,16 @@ const handle = mount(root, { app, face }); // drawn in this commit
49
85
  ```
50
86
 
51
87
  What this asks of the framework, and what it adds: the theme scopes to the
52
- element (`themeBaseCss(scheme, brand, { scope })`, and the scene's own rules,
53
- `sceneCss`, drawn by the scene face beside it) rather than the document, every
88
+ element (`themeBaseCss(scheme, brand, { scope })`, and the blocks a view is
89
+ drawn with, `viewsCss`, and the scene's own rules, `sceneCss`, drawn by the
90
+ face that needs them beside it) rather than the document, every
54
91
  rule of it held inside that element, so nothing of the host's is restyled; the
55
92
  panes size against the picture's own box (`cqh`) rather than the viewport;
56
93
  the routed face runs on a memory router, so the host page's address is never
57
- touched (unless the host's page is the app: see below); the brand's fonts are fetched by the embed rather than assumed. The
94
+ touched (unless the host's page is the app: see below); the brand's fonts are fetched by the embed rather than assumed. The page's icon is
95
+ the host's: only a host whose page is the app passes `favicon: true` to wear
96
+ the brand's (FR-124), and an app that prefers dark is drawn dark until the host
97
+ stamps a scheme of its own. The
58
98
  store is in memory and starts from the seed on every mount, unless the host
59
99
  hands it one.
60
100
 
@@ -80,14 +120,15 @@ Shell spells it:
80
120
  | Address | Drawn |
81
121
  |---|---|
82
122
  | `/apps/a1/places/the-board`, `/apps/a1/tasks/t1` | the routed face, at that page |
83
- | `/apps/a1#overview=1`, `/apps/a1#focus=t1` | the scene, at that stop (the Graview at altitude) |
84
- | `/apps/a1` | the routed face's home, or on arrival the host's `face` |
123
+ | `/apps/a1/places/overview#focus=t1`, `/apps/a1/places/overview#overview=1` | the scene, at that stop (the Graview at altitude) |
124
+ | `/apps/a1#focus=t1` | the scene too — a link written before the scene had an address — tidied on arrival to the scene's address |
125
+ | `/apps/a1` | the routed face's home; on arrival, the home when the app has a home view, else the host's `face` (the Graview or the scene land on the scene's address) |
85
126
 
86
127
  Each page the routed face opens is pushed, and Back returns. The scene
87
128
  keeps its stop in the fragment the way the Shell does: a step is pushed,
88
- moving the furniture replaces. The face toggle pushes the address of the
89
- face it goes to, so Back undoes it, and the page you left is where the
90
- toggle returns you. A reload stays where it was. `faceAtAddress(options)`
129
+ moving the furniture replaces. The switch and the place list push the
130
+ address of where they go, the scene's included, so Back undoes it. A reload stays where it
131
+ was. `faceAtAddress(options)`
91
132
  is the face an address opens on, for a host that renders `<Embed>` itself.
92
133
  `placesOf(app)` gives each place's `address` within the app, and
93
134
  `addressOf(place, { basePath })` from `@graview/core` gives it under the
@@ -96,9 +137,11 @@ base, spelled as the face's own links are (`pathWithin` reads one back).
96
137
  `routing: "memory"`, the default, is for somebody else's page: it never
97
138
  writes `history` and leaves `location` as it was. A host that keeps its
98
139
  own history stays on memory routing: `onNavigate(path, how)` is told each
99
- page the routed face opens (the path within the app, and `"push"`,
100
- `"replace"` or `"pop"`), and `handle.setPath(path)` sends it back to one
101
- when the host's own Back arrives.
140
+ place the reader goes to (the path within the app — `/places/overview` for
141
+ the scene — and `"push"`, `"replace"` or `"pop"`), and `handle.setPath(path)`
142
+ sends the reader back to one when the host's own Back arrives: the
143
+ scene's path draws the scene, any other the page. `where().path` is the
144
+ place's path the same way.
102
145
 
103
146
  ## When the declaration changes
104
147
 
@@ -122,6 +165,14 @@ the scheme, the brand and the notices stay; the faces are drawn again, so
122
165
  an open menu, a scroll position and a half-typed field do not. `drawn()`
123
166
  resolves once the new app is on the page.
124
167
 
168
+ A renamed app says its new name at once (FR-128). A `label` that was the
169
+ app's own name — as a host that mounts with `label: app.name` gives it —
170
+ follows the new app: the embed's accessible name and each landmark inside
171
+ say the new name, and the bar's name — its heading — is the new app's. A label the host chose ("Chapter 13") stays;
172
+ `setApp(app, store, { label })` gives another, and `handle.setLabel(label)`
173
+ renames the embed in place. `handle.setHostActions(actions)` changes the
174
+ host's own actions in the profile menu the same way.
175
+
125
176
  A host that must remount reads the place first and hands it back:
126
177
 
127
178
  ```ts
@@ -148,7 +199,7 @@ the embed reads the rung it means rather than guessing a number.
148
199
  ## The host's own actions
149
200
 
150
201
  A host's links about the app and the person — "Change the app", "Your
151
- apps", "Report this app" — go in the strip's profile menu, under who is
202
+ apps", "Report this app" — go in the person's menu on the app bar, under who is
152
203
  signed in, rather than in a menu of the host's own laid over the scene:
153
204
 
154
205
  ```ts
@@ -231,7 +282,7 @@ mount(root, {
231
282
  });
232
283
  ```
233
284
 
234
- A view, a page, the strip or the studio that throws is contained where it
285
+ A view, a page, the bar or the studio that throws is contained where it
235
286
  threw: it says it could not draw and offers to try again, and the rest of
236
287
  the embed keeps working. The host is told the error's class (a TypeError,
237
288
  a `GraphError`) and the framework module that caught it, never the message,
@@ -240,7 +291,7 @@ how many milliseconds it took.
240
291
 
241
292
  ## What the host can keep
242
293
 
243
- The Studio is on the strip for the seat that keeps the app, and writes
294
+ The Studio is in the person's menu on the scene for the seat that keeps the app, and writes
244
295
  through a dev server's door or hands over files. A host whose readers
245
296
  cannot save a declaration leaves it off, or keeps what it applies:
246
297
 
package/dist/address.d.ts CHANGED
@@ -4,30 +4,38 @@ import type { EmbedFace, FrameOptions } from "./frame.js";
4
4
  /**
5
5
  * THE FACE AN EMBED OPENS ON (FR-106): under memory routing, the host's
6
6
  * (`face`, else the one its `stop` implies); under address routing, the one
7
- * the address names — a page past the home is the routed face, a fragment
8
- * at the home is the scene's stop — and the host's when it names none.
7
+ * the address names — the overview's place is the scene (FR-132), any other
8
+ * page the routed face, a fragment at the home the scene's stop — and the
9
+ * host's when it names none.
9
10
  * `mount` asks this itself; a host that renders `<Embed>` passes it as `face`.
10
11
  */
11
12
  export declare function faceAtAddress(options: Pick<FrameOptions, "routing" | "basePath"> & {
12
13
  readonly face?: EmbedFace;
13
14
  readonly stop?: string;
14
15
  }): EmbedFace;
15
- /** The stop the address holds for the scene on arrival, if it holds one. */
16
+ /**
17
+ * WHETHER THE ADDRESS IS THE BARE HOME, NAMING NO FACE (FR-136): under
18
+ * address routing, the app's own address on arrival with no fragment and
19
+ * no entry the router wrote. An app with a home view opens on it there,
20
+ * whatever face the host would otherwise draw.
21
+ */
22
+ export declare function atTheBareHome(options: Pick<FrameOptions, "routing" | "basePath">): boolean;
23
+ /** The stop the address holds for the scene on arrival, if it holds one: on the overview's address, or the home's. */
16
24
  export declare function stopAtAddress(basePath: string | undefined): string | undefined;
17
25
  /**
18
26
  * Keeps the face in step with the address: Back and Forward move between
19
- * the routed face and the scene, and the face toggle pushes the address of
20
- * the face it goes to. Inside the provider; the scene's own fragment sync
27
+ * the routed face and the overview, and the bar pushes the address of the
28
+ * place it goes to. Inside the provider; the scene's own fragment sync
21
29
  * (`UrlSync`) is drawn by the scene face, so it is fetched with the scene.
22
30
  */
23
31
  export declare function AddressBar({ basePath, pagesWere, shown, onFace, toggle, kinds, places, }: {
24
32
  readonly basePath: string | undefined;
25
- /** The page the routed face had before a new declaration (FR-116), for the toggle to go back to. */
33
+ /** The page the routed face had before a new declaration (FR-116), to go back to. */
26
34
  readonly pagesWere?: string | undefined;
27
35
  readonly shown: EmbedFace;
28
36
  readonly onFace: ((face: EmbedFace) => void) | undefined;
29
- /** Where the strip's toggle is handed this bar's way of changing face. */
30
- readonly toggle: MutableRefObject<((face: EmbedFace) => void) | undefined>;
37
+ /** Where the app bar is handed this one's way of changing face: to a page's path, or to the overview at a stop. */
38
+ readonly toggle: MutableRefObject<((face: EmbedFace, path?: string, stop?: string) => void) | undefined>;
31
39
  readonly kinds: readonly string[];
32
40
  readonly places: readonly Place[];
33
41
  }): null;
@@ -1 +1 @@
1
- {"version":3,"file":"address.d.ts","sourceRoot":"","sources":["../src/address.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAyB,KAAK,KAAK,EAAE,MAAM,eAAe,CAAC;AAIlE,OAAO,EAAqB,KAAK,gBAAgB,EAAE,MAAM,OAAO,CAAC;AACjE,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AA+B1D;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,IAAI,CAAC,YAAY,EAAE,SAAS,GAAG,UAAU,CAAC,GAAG;IAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAIpJ;AAED,4EAA4E;AAC5E,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAG9E;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,EAC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HAAsH;AACtH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAI9E;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,EACzB,QAAQ,EACR,SAAS,EACT,KAAK,EACL,MAAM,EACN,MAAM,EACN,KAAK,EACL,MAAM,GACP,EAAE;IACD,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IACtC,qFAAqF;IACrF,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACxC,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IACzD,mHAAmH;IACnH,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC,CAAC;IACzG,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,QAAQ,CAAC,MAAM,EAAE,SAAS,KAAK,EAAE,CAAC;CACnC,QA4CA"}
package/dist/address.js CHANGED
@@ -1,4 +1,4 @@
1
- import { addressOf, pathWithin } from "@graview/core";
1
+ import { addressOf, OVERVIEW_PATH, pathWithin } from "@graview/core";
2
2
  import { aggregateId, fromUrl, toUrl, withFocus, withOverview } from "@graview/layout/view";
3
3
  import { descentTarget } from "@graview/primitives/frame";
4
4
  import { useNavigation } from "@graview/react/provider";
@@ -10,14 +10,19 @@ import { useEffect, useRef } from "react";
10
10
  * where on it, the way the whole-page Shell spells it:
11
11
  *
12
12
  * <base>/places/the-board, <base>/tasks/t1 a page: the routed face, on its router
13
- * <base>#overview=1, <base>#focus=t1 a stop: the scene (the Graview at altitude),
14
- * its view state in the fragment
13
+ * <base>/places/overview#focus=t1 the overview (FR-132): the scene, its
14
+ * view state in the fragment — at altitude
15
+ * (`#overview=1`), the Graview
16
+ * <base>#focus=t1 a stop written before the scene was a
17
+ * place: the scene still, tidied to the
18
+ * overview's address on arrival
15
19
  * <base> the routed face's home — or, on arrival
16
- * with no entry the router wrote, the host's face
20
+ * with no entry the router wrote, the home
21
+ * when the app has a home view (FR-136),
22
+ * else the host's face
17
23
  *
18
- * The scene always writes a fragment, even an empty `#`, so an address
19
- * without one past arrival is a page. The face toggle is a step like any
20
- * other: it pushes the address of the face it goes to, and Back undoes it.
24
+ * Moving between the overview and a page is a step like any other: the bar
25
+ * pushes the address of the place it goes to, and Back undoes it.
21
26
  */
22
27
  /** The router's own mark on an entry it wrote: `{ idx }` (react-router), kept across a reload. */
23
28
  const routerWrote = (state) => typeof state === "object" && state !== null && "idx" in state;
@@ -26,6 +31,8 @@ function faceNamed(basePath) {
26
31
  const path = pathWithin(window.location.pathname, basePath);
27
32
  if (path === null)
28
33
  return null;
34
+ if (path === OVERVIEW_PATH)
35
+ return fromUrl(window.location.hash).overview ? "graview" : "scene";
29
36
  if (path !== "/")
30
37
  return "pages";
31
38
  if (window.location.href.includes("#"))
@@ -35,8 +42,9 @@ function faceNamed(basePath) {
35
42
  /**
36
43
  * THE FACE AN EMBED OPENS ON (FR-106): under memory routing, the host's
37
44
  * (`face`, else the one its `stop` implies); under address routing, the one
38
- * the address names — a page past the home is the routed face, a fragment
39
- * at the home is the scene's stop — and the host's when it names none.
45
+ * the address names — the overview's place is the scene (FR-132), any other
46
+ * page the routed face, a fragment at the home the scene's stop — and the
47
+ * host's when it names none.
40
48
  * `mount` asks this itself; a host that renders `<Embed>` passes it as `face`.
41
49
  */
42
50
  export function faceAtAddress(options) {
@@ -45,38 +53,51 @@ export function faceAtAddress(options) {
45
53
  return asked;
46
54
  return faceNamed(options.basePath) ?? asked;
47
55
  }
48
- /** The stop the address holds for the scene on arrival, if it holds one. */
56
+ /**
57
+ * WHETHER THE ADDRESS IS THE BARE HOME, NAMING NO FACE (FR-136): under
58
+ * address routing, the app's own address on arrival with no fragment and
59
+ * no entry the router wrote. An app with a home view opens on it there,
60
+ * whatever face the host would otherwise draw.
61
+ */
62
+ export function atTheBareHome(options) {
63
+ if (options.routing !== "address" || typeof window === "undefined")
64
+ return false;
65
+ return pathWithin(window.location.pathname, options.basePath) === "/" && faceNamed(options.basePath) === null;
66
+ }
67
+ /** The stop the address holds for the scene on arrival, if it holds one: on the overview's address, or the home's. */
49
68
  export function stopAtAddress(basePath) {
50
69
  if (typeof window === "undefined")
51
70
  return undefined;
52
- return pathWithin(window.location.pathname, basePath) === "/" && window.location.href.includes("#") ? window.location.hash || "#" : undefined;
71
+ const path = pathWithin(window.location.pathname, basePath);
72
+ return (path === "/" || path === OVERVIEW_PATH) && window.location.href.includes("#") ? window.location.hash || "#" : undefined;
53
73
  }
54
74
  /**
55
75
  * Keeps the face in step with the address: Back and Forward move between
56
- * the routed face and the scene, and the face toggle pushes the address of
57
- * the face it goes to. Inside the provider; the scene's own fragment sync
76
+ * the routed face and the overview, and the bar pushes the address of the
77
+ * place it goes to. Inside the provider; the scene's own fragment sync
58
78
  * (`UrlSync`) is drawn by the scene face, so it is fetched with the scene.
59
79
  */
60
80
  export function AddressBar({ basePath, pagesWere, shown, onFace, toggle, kinds, places, }) {
61
81
  const { view, go } = useNavigation();
62
82
  const latest = useRef({ shown, view, onFace });
63
83
  latest.current = { shown, view, onFace };
64
- // The page the routed face was on when the scene was asked for, to go back to by the toggle.
84
+ // The page the routed face was on when the overview was asked for, to go back to.
65
85
  const pagesAt = useRef(pagesWere ?? "/");
66
86
  const leaving = () => {
67
87
  pagesAt.current = `${pathWithin(window.location.pathname, basePath) ?? "/"}${window.location.search}`;
68
88
  };
69
- toggle.current = (next) => {
89
+ toggle.current = (next, path, asked) => {
70
90
  const { shown: from, view: here, onFace: tell } = latest.current;
71
91
  if (next === "pages" && from !== "pages") {
72
- window.history.pushState(null, "", addressOf(pagesAt.current, { basePath }));
92
+ window.history.pushState(null, "", addressOf(path ?? pagesAt.current, { basePath }));
73
93
  }
74
94
  else if (next !== "pages" && from === "pages") {
75
95
  leaving();
76
96
  // The view the scene will draw, decided here so the fragment pushed is the one it lands on.
77
- const stop = next === "graview" ? withOverview(here, true) : here.overview ? withFocus(withOverview(here, false), descentTarget(here, kinds)) : here;
97
+ const given = asked === undefined ? here : placed(fromUrl(asked), places);
98
+ const stop = next === "graview" ? withOverview(given, true) : given.overview ? withFocus(withOverview(given, false), descentTarget(given, kinds)) : given;
78
99
  go(stop);
79
- window.history.pushState(null, "", `${addressOf("/", { basePath })}${toUrl(stop)}`);
100
+ window.history.pushState(null, "", `${addressOf(OVERVIEW_PATH, { basePath })}${toUrl(stop)}`);
80
101
  }
81
102
  tell?.(next);
82
103
  };
@@ -95,10 +116,7 @@ export function AddressBar({ basePath, pagesWere, shown, onFace, toggle, kinds,
95
116
  // Between the scene and the Graview the fragment sync follows by itself; from the pages, the scene comes back where the fragment says.
96
117
  if (from !== "pages")
97
118
  return;
98
- const parsed = fromUrl(window.location.hash);
99
- const name = parsed.within?.["view"];
100
- const place = name !== undefined && !parsed.focusId ? places.find((candidate) => candidate.as === name) : undefined;
101
- go(place ? { ...parsed, focusId: aggregateId(place.kind) } : parsed);
119
+ go(placed(fromUrl(window.location.hash), places));
102
120
  tell?.(named);
103
121
  };
104
122
  window.addEventListener("popstate", onPop);
@@ -106,4 +124,10 @@ export function AddressBar({ basePath, pagesWere, shown, onFace, toggle, kinds,
106
124
  }, [basePath, go, places]);
107
125
  return null;
108
126
  }
127
+ /** A stop that names a place by its name alone (`#view=the-board`) goes to the group it is a picture of. */
128
+ function placed(parsed, places) {
129
+ const name = parsed.within?.["view"];
130
+ const place = name !== undefined && !parsed.focusId ? places.find((candidate) => candidate.as === name) : undefined;
131
+ return place ? { ...parsed, focusId: aggregateId(place.kind) } : parsed;
132
+ }
109
133
  //# sourceMappingURL=address.js.map
@@ -1 +1 @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AAO;oBAAE,IAAI,EAAE,CAAC,OAAO,CAAC,CAAC;gBACtC,OAAO;YACT,CAAC;YACD,uIAAuI;YACvI,IAAI,IAAI,KAAK,OAAO;gBAAE,OAAO;YAC7B,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;YAClD,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC;QAChB,CAAC,CAAC;QACF,MAAM,CAAC,gBAAgB,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;QAC3C,OAAO,GAAG,EAAE,CAAC,MAAM,CAAC,mBAAmB,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;IAC7D,CAAC,EAAE,CAAC,QAAQ,EAAE,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC;IAC3B,OAAO,IAAI,CAAC;AACd,CAAC;AAED,4GAA4G;AAC5G,SAAS,MAAM,CAAC,MAAkC,EAAE,MAAwB;IAC1E,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC;IACrC,MAAM,KAAK,GAAG,IAAI,KAAK,SAAS,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,EAAE,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACpH,OAAO,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC;AAC1E,CAAC"}
package/dist/embed.d.ts CHANGED
@@ -27,26 +27,32 @@ export declare function preload(...faces: readonly EmbedFace[]): Promise<void>;
27
27
  */
28
28
  export { AUTO_SCENE_HEIGHT };
29
29
  export interface EmbedOptions<S extends AnySchema = AnySchema> extends FrameOptions<S> {
30
- /** Which face to open on. Omitted, the stop decides: altitude opens the Graview, anything else the scene. */
30
+ /**
31
+ * Which face to open on. Omitted, the stop decides: at altitude the
32
+ * Graview, anything else the scene — the app's overview, one of its
33
+ * places (FR-132).
34
+ */
31
35
  readonly face?: EmbedFace;
32
36
  /** The scene's view state, as the fragment the app itself would put in its address bar. */
33
37
  readonly stop?: string;
34
38
  /**
35
- * THE WORKBENCH'S HEADING (FR-25): the level the embed's name is said at,
36
- * for a reader moving by headings — `1` when the host's page is the app,
37
- * `2` (the default) inside somebody else's article, `false` when the
38
- * host's own heading already names it. The pages face brings its own.
39
+ * THE APP'S NAME AS A HEADING (FR-25, FR-131): the level the app bar says
40
+ * the name at, for a reader moving by headings — `1` when the host's page
41
+ * is the app, `2` (the default) inside somebody else's article, `false`
42
+ * when the host's own heading already names it. Each page's own title is
43
+ * said under it, at the level below the app's.
39
44
  */
40
45
  readonly heading?: 1 | 2 | 3 | 4 | 5 | 6 | false;
41
46
  /**
42
- * Below this width the scene and the Graview give way to the pages face,
43
- * and come back above it. A phone's chat is no place for a map. Off by default.
47
+ * Below this width the scene and the Graview give way to the routed face,
48
+ * and come back above it — unless the reader asks for the overview on the
49
+ * bar, which is then drawn whatever the width. Off by default.
44
50
  */
45
51
  readonly pagesBelow?: number;
46
52
  /**
47
- * WHAT BECOMES OF THE STUDIO (FR-19). Offered by default, for the seat
48
- * that keeps the app, writing through a dev server's door or handing
49
- * over files. `false` leaves it off the strip: a hosted reader cannot
53
+ * WHAT BECOMES OF THE STUDIO (FR-19). Offered by default, in the
54
+ * person's menu for the seat that keeps the app, writing through a dev
55
+ * server's door or handing over files. `false` leaves it out: a hosted reader cannot
50
56
  * save a declaration, so is not offered one to change. `{ onApply }`
51
57
  * keeps it and hands the host what the checker passed, writing nothing
52
58
  * itself: the host makes it a proposal, a version, a review.
@@ -85,7 +91,7 @@ export interface EmbedStudio {
85
91
  readonly onApply: StudioOnApply;
86
92
  /**
87
93
  * What the studio's picture is to the host's page (FR-58). Inside an
88
- * embed it is a labelled region by default, never a second `<main>`;
94
+ * embed it is a labeled region by default, never a second `<main>`;
89
95
  * "main" is for a host whose page has none of its own and whose whole
90
96
  * body is the studio.
91
97
  */
@@ -110,19 +116,30 @@ export interface EmbedStudio {
110
116
  readonly place?: typeof StudioPlaceType;
111
117
  }
112
118
  export interface EmbedProps<S extends AnySchema = AnySchema> extends EmbedOptions<S> {
113
- /** Called when the strip's switcher is pressed; the host decides the face. */
119
+ /** Called when the bar's switch moves between the scene and the pages (FR-137); the host decides the face. */
114
120
  readonly onFace?: (face: EmbedFace) => void;
115
- /** Called when a seat on the strip is pressed; the host decides who sits. */
121
+ /** Told, once, the face the embed opened on when the host named none (FR-136): the home's, or the scene. */
122
+ readonly onOpening?: (face: EmbedFace) => void;
123
+ /** Called when a seat is taken in the person's menu; the host decides who sits. */
116
124
  readonly onSeat?: (principal: Principal) => void;
117
125
  }
118
- /** The face a stop implies: a stop at altitude opens the Graview. */
126
+ /** The face a stop implies: a stop at altitude opens the Graview, anything else the scene (FR-132). */
119
127
  export declare function faceOf(stop: string | undefined): EmbedFace;
128
+ /**
129
+ * WHETHER AN APP OPENS ON ITS HOME (FR-136): it has a home view — the
130
+ * declaration's home blocks, or a worker view attached to "home" — and its
131
+ * declaration names no other first place (`pages.first`).
132
+ */
133
+ export declare function opensOnTheHome(app: Pick<GraviewApp<AnySchema>, "pages">, views: {
134
+ homeView?(): unknown;
135
+ }): boolean;
120
136
  export declare function Embed<S extends AnySchema>(props: EmbedProps<S>): import("react").JSX.Element;
121
137
  export interface EmbedHandle {
122
138
  /**
123
- * WHERE THE READER IS (FR-116): the face, the page on Pages (or the one it
124
- * last had) and the scene's stop — for a host that must remount to hand
125
- * back as `mount(…, { at })`.
139
+ * WHERE THE READER IS (FR-116): the face, the path of the place they are
140
+ * on — the overview's (`/places/overview`) on the scene (FR-132) — and the
141
+ * scene's stop, for a host that must remount to hand back as
142
+ * `mount(…, { at })`.
126
143
  */
127
144
  where(): EmbedWhere;
128
145
  /**
@@ -132,13 +149,25 @@ export interface EmbedHandle {
132
149
  * falls back to its nearest parent. The seat, the seats, the people, the
133
150
  * scheme, the brand asked for and the notices stay; what is drawn is drawn
134
151
  * again, so an open menu, a scroll and a half-typed field do not.
152
+ *
153
+ * THE NEW APP'S NAME (FR-128): a `label` that was the app's own name
154
+ * follows the app, so a renamed app says its new name — the embed's
155
+ * accessible name, its heading, each landmark inside — without a reload;
156
+ * a label the host chose stays. `{ label }` says which.
135
157
  */
136
- setApp(app: GraviewApp<AnySchema>, store: Store<AnySchema> | EmbedRemote<AnySchema>): void;
158
+ setApp(app: GraviewApp<AnySchema>, store: Store<AnySchema> | EmbedRemote<AnySchema>, options?: {
159
+ readonly label?: string;
160
+ }): void;
161
+ /** What the embed is called (FR-128): its accessible name, its heading, and the name each landmark inside is said after. */
162
+ setLabel(label: string): void;
163
+ /** The host's own actions in the profile menu (FR-72), now. */
164
+ setHostActions(actions: EmbedOptions["hostActions"]): void;
137
165
  setFace(face: EmbedFace): void;
138
166
  setStop(stop: string): void;
139
167
  /**
140
- * Sends the routed face to a path within the app's own routes (FR-106): a
141
- * host that keeps its own history hands back the path its Back arrived at.
168
+ * Goes to a path within the app's own routes (FR-106): a host that keeps
169
+ * its own history hands back the path its Back arrived at. The overview's
170
+ * path (`/places/overview`) is the scene (FR-132); any other is a page.
142
171
  */
143
172
  setPath(path: string): void;
144
173
  setScheme(scheme: Scheme): void;
@@ -1 +1 @@
1
- {"version":3,"file":"embed.d.ts","sourceRoot":"","sources":["../src/embed.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,SAAS,EAAE,KAAK,KAAK,EAAE,KAAK,UAAU,EAAE,KAAK,MAAM,EAAc,KAAK,SAAS,EAAE,KAAK,KAAK,EAAE,MAAM,eAAe,CAAC;AAG7I,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,WAAW,IAAI,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACpG,OAAO,KAAK,EA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