@graview/pages 0.1.28 → 0.1.30
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 +8 -0
- package/dist/context-menu.d.ts +10 -0
- package/dist/context-menu.d.ts.map +1 -0
- package/dist/context-menu.js +287 -0
- package/dist/context-menu.js.map +1 -0
- package/dist/facts.d.ts.map +1 -1
- package/dist/facts.js +2 -1
- package/dist/facts.js.map +1 -1
- package/dist/form.d.ts.map +1 -1
- package/dist/form.js +57 -14
- package/dist/form.js.map +1 -1
- package/dist/page-context.d.ts +34 -3
- package/dist/page-context.d.ts.map +1 -1
- package/dist/page-context.js +8 -6
- package/dist/page-context.js.map +1 -1
- package/dist/page-home.d.ts.map +1 -1
- package/dist/page-home.js +5 -6
- package/dist/page-home.js.map +1 -1
- package/dist/page-list.d.ts.map +1 -1
- package/dist/page-list.js +195 -50
- package/dist/page-list.js.map +1 -1
- package/dist/page-map.js +1 -1
- package/dist/page-map.js.map +1 -1
- package/dist/page-places.d.ts.map +1 -1
- package/dist/page-places.js +85 -33
- package/dist/page-places.js.map +1 -1
- package/dist/page-problems.d.ts.map +1 -1
- package/dist/page-problems.js +18 -6
- package/dist/page-problems.js.map +1 -1
- package/dist/page-provisional.d.ts +14 -0
- package/dist/page-provisional.d.ts.map +1 -0
- package/dist/page-provisional.js +38 -0
- package/dist/page-provisional.js.map +1 -0
- package/dist/page-record.d.ts.map +1 -1
- package/dist/page-record.js +97 -24
- package/dist/page-record.js.map +1 -1
- package/dist/page-search.d.ts.map +1 -1
- package/dist/page-search.js +10 -5
- package/dist/page-search.js.map +1 -1
- package/dist/page-shell.d.ts.map +1 -1
- package/dist/page-shell.js +11 -6
- package/dist/page-shell.js.map +1 -1
- package/dist/page-typography.d.ts +3 -0
- package/dist/page-typography.d.ts.map +1 -1
- package/dist/page-typography.js +75 -29
- package/dist/page-typography.js.map +1 -1
- package/dist/pages-activity.d.ts.map +1 -1
- package/dist/pages-activity.js +9 -5
- package/dist/pages-activity.js.map +1 -1
- package/dist/router.d.ts +12 -3
- package/dist/router.d.ts.map +1 -1
- package/dist/router.js +117 -25
- package/dist/router.js.map +1 -1
- package/dist/section.d.ts +18 -0
- package/dist/section.d.ts.map +1 -0
- package/dist/section.js +63 -0
- package/dist/section.js.map +1 -0
- package/dist/static.d.ts +122 -0
- package/dist/static.d.ts.map +1 -0
- package/dist/static.js +473 -0
- package/dist/static.js.map +1 -0
- package/package.json +10 -6
package/dist/page-typography.js
CHANGED
|
@@ -1,19 +1,27 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { pluralLabel } from "@graview/core";
|
|
2
|
+
import { LOCAL_LAYERS, pluralLabel } from "@graview/core";
|
|
3
3
|
import { KindFigure } from "@graview/primitives/pages";
|
|
4
|
-
import { humanizeField,
|
|
4
|
+
import { humanizeField, nameOfAuthor, orderKinds, } from "@graview/core";
|
|
5
|
+
import { excerptOf, readableFields } from "@graview/core/words";
|
|
5
6
|
/*
|
|
6
|
-
* A
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
7
|
+
* A READING COLUMN, ONE SCALE.
|
|
8
|
+
*
|
|
9
|
+
* The scene's chrome is set at 14px because it is chrome; a page is read.
|
|
10
|
+
* Its sizes are the theme's four steps of one scale — a minor third from
|
|
11
|
+
* the reader's own rem (`--graview-text-small`, `-body`, `-heading`,
|
|
12
|
+
* `-title`) — so a reader's larger text moves them all together, an app's
|
|
13
|
+
* own stylesheet can set a step, and no page invents a size between two of
|
|
14
|
+
* them. Headings take the brand's display face and weight from the theme's
|
|
15
|
+
* own heading rule (never a `font` shorthand here, which would beat it).
|
|
10
16
|
*/
|
|
17
|
+
export const SMALL = "var(--graview-text-small)";
|
|
18
|
+
export const BODY = "var(--graview-text-body)";
|
|
11
19
|
export const DISPLAY = "var(--graview-font-display, var(--graview-font-body, system-ui))";
|
|
12
20
|
export const column = {
|
|
13
21
|
maxWidth: 760,
|
|
14
22
|
margin: "0 auto",
|
|
15
|
-
// The end clears the seat's field
|
|
16
|
-
padding: "40px 20px max(96px, var(--graview-foot-room, 0px))",
|
|
23
|
+
// The end clears what stands over the foot: the seat's field says its measured height (`--graview-foot-room`), a phone its home bar.
|
|
24
|
+
padding: "40px 20px max(96px, calc(var(--graview-foot-room, 0px) + env(safe-area-inset-bottom, 0px)))",
|
|
17
25
|
display: "grid",
|
|
18
26
|
/*
|
|
19
27
|
* A TRACK THAT MAY BE NARROWER THAN WHAT IS IN IT.
|
|
@@ -41,42 +49,45 @@ export const WIDE = 1160;
|
|
|
41
49
|
export const wide = { ...column, maxWidth: WIDE };
|
|
42
50
|
export const h1 = {
|
|
43
51
|
margin: 0,
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
lineHeight: 1.12,
|
|
47
|
-
fontWeight: 600,
|
|
52
|
+
fontSize: "var(--graview-text-title)",
|
|
53
|
+
lineHeight: 1.2,
|
|
48
54
|
letterSpacing: "-0.012em",
|
|
49
55
|
overflowWrap: "anywhere",
|
|
56
|
+
textWrap: "balance",
|
|
50
57
|
};
|
|
51
58
|
export const h2 = {
|
|
52
59
|
margin: 0,
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
fontWeight: 600,
|
|
57
|
-
letterSpacing: "-0.006em",
|
|
60
|
+
fontSize: "var(--graview-text-heading)",
|
|
61
|
+
lineHeight: 1.3,
|
|
62
|
+
textWrap: "balance",
|
|
58
63
|
};
|
|
59
64
|
export const eyebrow = {
|
|
60
65
|
margin: 0,
|
|
61
|
-
fontSize:
|
|
62
|
-
letterSpacing: "0.
|
|
66
|
+
fontSize: SMALL,
|
|
67
|
+
letterSpacing: "0.08em",
|
|
63
68
|
textTransform: "uppercase",
|
|
64
69
|
color: "var(--graview-ink-muted)",
|
|
65
70
|
};
|
|
71
|
+
// The sentence under a title: secondary, at the reading size, in the muted ink.
|
|
66
72
|
export const lede = {
|
|
67
73
|
margin: 0,
|
|
68
|
-
fontSize:
|
|
69
|
-
lineHeight: 1.5,
|
|
74
|
+
fontSize: BODY,
|
|
70
75
|
color: "var(--graview-ink-muted)",
|
|
71
|
-
maxWidth: "
|
|
76
|
+
maxWidth: "60ch",
|
|
72
77
|
};
|
|
73
|
-
export const quiet = { color: "var(--graview-ink-muted)", fontSize:
|
|
78
|
+
export const quiet = { color: "var(--graview-ink-muted)", fontSize: SMALL };
|
|
74
79
|
export const rule = { borderTop: "1px solid var(--graview-edge)", paddingTop: 24 };
|
|
75
|
-
|
|
80
|
+
/*
|
|
81
|
+
* A link is a target, tall enough for a fingertip without leaving the line:
|
|
82
|
+
* in the accent `graview check` holds to 4.5:1 on the ground ("a link on a
|
|
83
|
+
* page"), the same visited or not, its underline a hairline a little below
|
|
84
|
+
* the words in its own color at half strength.
|
|
85
|
+
*/
|
|
76
86
|
export const link = {
|
|
77
|
-
color: "
|
|
78
|
-
textDecorationColor: "
|
|
79
|
-
|
|
87
|
+
color: "var(--graview-accent)",
|
|
88
|
+
textDecorationColor: "color-mix(in srgb, currentColor 50%, transparent)",
|
|
89
|
+
textDecorationThickness: 1,
|
|
90
|
+
textUnderlineOffset: "0.2em",
|
|
80
91
|
display: "inline-flex",
|
|
81
92
|
alignItems: "center",
|
|
82
93
|
minHeight: 24,
|
|
@@ -97,9 +108,43 @@ export const plain = {
|
|
|
97
108
|
alignItems: "center",
|
|
98
109
|
minHeight: 24,
|
|
99
110
|
};
|
|
111
|
+
/*
|
|
112
|
+
* A LIST'S ROWS, ONE ANATOMY (a kind's list and the search's hits).
|
|
113
|
+
*
|
|
114
|
+
* A row is its record's name and its glance. The name is the row: reading
|
|
115
|
+
* size, medium weight, two lines at most (the rest on its page, and in its
|
|
116
|
+
* title when it is long), the link stretched over the whole row. The glance
|
|
117
|
+
* is secondary — small, muted, two lines at most — and on a desk stands in a column of its
|
|
118
|
+
* own beside the names, one column for the whole list (a subgrid), so the
|
|
119
|
+
* dates down a list start at one x; where the list is narrower than 36rem
|
|
120
|
+
* it stands under the name. A row is one line or two, never more, so a
|
|
121
|
+
* list keeps two heights. A group's heading is small and semibold, its
|
|
122
|
+
* count beside it, over the rows' own hairline; over the framework's own
|
|
123
|
+
* rows it stays at the top of the scroll on a desk while they pass under
|
|
124
|
+
* it, on the ground the face stands on (a design's rows keep their own).
|
|
125
|
+
*/
|
|
126
|
+
export const ROWS_CSS = `.graview-list{container-type:inline-size}
|
|
127
|
+
.graview-rows{display:grid;grid-template-columns:minmax(0,1fr);column-gap:1.5rem;margin:0;padding:0;list-style:none;border-top:1px solid var(--graview-edge)}
|
|
128
|
+
.graview-row{grid-column:1/-1;display:grid;grid-template-columns:subgrid;align-items:baseline;align-content:center;position:relative;box-sizing:border-box;min-height:2.75rem;padding:.5rem 0;border-bottom:1px solid var(--graview-edge);overflow-wrap:anywhere}
|
|
129
|
+
.graview-row-title{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;min-height:24px;color:inherit;text-decoration:none;font-size:var(--graview-text-body);font-weight:500;line-height:1.3;text-wrap:pretty;hyphens:manual}
|
|
130
|
+
.graview-row-title::after{content:"";position:absolute;inset:0}
|
|
131
|
+
.graview-row-title:focus-visible{outline:0}
|
|
132
|
+
.graview-row-title:focus-visible::after{outline:2px solid var(--graview-accent);outline-offset:-2px;border-radius:var(--graview-radius-sm)}
|
|
133
|
+
.graview-row:hover .graview-row-title{text-decoration:underline 1px color-mix(in srgb,currentColor 50%,transparent);text-underline-offset:.2em}
|
|
134
|
+
.graview-row:active .graview-row-title{color:var(--graview-accent)}
|
|
135
|
+
.graview-row :is(a,button):not(.graview-row-title){position:relative}
|
|
136
|
+
.graview-row-glance,.graview-row>[data-testid=search-why]{font-size:var(--graview-text-small);line-height:1.5;color:var(--graview-ink-muted)}
|
|
137
|
+
.graview-row>[data-testid=search-why]{grid-column:1/-1}
|
|
138
|
+
.graview-row-glance{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden}
|
|
139
|
+
.graview-group-head{display:flex;gap:.5em;align-items:baseline;margin:0;padding:.375rem 0;font-family:var(--graview-font-body);font-size:var(--graview-text-small);font-weight:var(--graview-weight-label);line-height:1.3;letter-spacing:.02em;scroll-margin-top:4rem}
|
|
140
|
+
.graview-group-head>span{color:var(--graview-ink-muted);font-weight:var(--graview-weight-body)}
|
|
141
|
+
.graview-group-toggle{display:inline-flex;gap:.5em;align-items:center;min-height:2.75rem;margin:-.375rem 0;padding:0 .5rem 0 0;border:0;background:none;color:inherit;font:inherit;letter-spacing:inherit;text-align:start;cursor:pointer;border-radius:var(--graview-radius-sm)}
|
|
142
|
+
.graview-group-toggle:focus-visible{outline:2px solid var(--graview-accent);outline-offset:2px}
|
|
143
|
+
.graview-group-toggle>span{color:var(--graview-ink-muted);font-weight:var(--graview-weight-body)}
|
|
144
|
+
@container (min-width:36rem){.graview-rows{grid-template-columns:minmax(0,1fr) fit-content(40%)}.graview-group-head:has(+.graview-rows){position:sticky;top:0;z-index:${LOCAL_LAYERS.raised};background:var(--graview-ground)}}`;
|
|
100
145
|
export const button = {
|
|
101
146
|
font: "inherit",
|
|
102
|
-
fontSize:
|
|
147
|
+
fontSize: SMALL,
|
|
103
148
|
padding: "8px 14px",
|
|
104
149
|
borderRadius: "var(--graview-radius-sm, 8px)",
|
|
105
150
|
border: "1px solid var(--graview-edge-bright)",
|
|
@@ -150,7 +195,8 @@ export function glance(node, definition, said) {
|
|
|
150
195
|
// A bare number says nothing on its own — "12 · 8" is not a sentence —
|
|
151
196
|
// so each fact is read the way it stands alone, the same words a card uses.
|
|
152
197
|
return readableFields(node, definition, { limit: 3, said: [said], glance: true })
|
|
153
|
-
|
|
198
|
+
// A record's prose is said by its start on a glance — its first paragraph or a line's worth, Markdown's syntax taken out (FR-180) — and whole on its page.
|
|
199
|
+
.map((field) => (field.long ? excerptOf(field.stored, { markdown: field.markdown, most: 100 }) : field.alone))
|
|
154
200
|
.join(" · ");
|
|
155
201
|
}
|
|
156
202
|
/** The plural, as declared. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page-typography.js","sourceRoot":"","sources":["../src/page-typography.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"page-typography.js","sourceRoot":"","sources":["../src/page-typography.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EACL,aAAa,EAOb,YAAY,EACZ,UAAU,GAEX,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAGhE;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,2BAA2B,CAAC;AACjD,MAAM,CAAC,MAAM,IAAI,GAAG,0BAA0B,CAAC;AAC/C,MAAM,CAAC,MAAM,OAAO,GAAG,kEAAkE,CAAC;AAC1F,MAAM,CAAC,MAAM,MAAM,GAAwB;IACzC,QAAQ,EAAE,GAAG;IACb,MAAM,EAAE,QAAQ;IAChB,qIAAqI;IACrI,OAAO,EAAE,6FAA6F;IACtG,OAAO,EAAE,MAAM;IACf;;;;;;;;;;;OAWG;IACH,mBAAmB,EAAE,gBAAgB;IACrC,GAAG,EAAE,EAAE;CACR,CAAC;AACF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,IAAI,CAAC;AACzB,MAAM,CAAC,MAAM,IAAI,GAAwB,EAAE,GAAG,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AACvE,MAAM,CAAC,MAAM,EAAE,GAAwB;IACrC,MAAM,EAAE,CAAC;IACT,QAAQ,EAAE,2BAA2B;IACrC,UAAU,EAAE,GAAG;IACf,aAAa,EAAE,UAAU;IACzB,YAAY,EAAE,UAAU;IACxB,QAAQ,EAAE,SAAS;CACpB,CAAC;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AC,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,IAAY,EAAU,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pages-activity.d.ts","sourceRoot":"","sources":["../src/pages-activity.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"pages-activity.d.ts","sourceRoot":"","sources":["../src/pages-activity.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAS,MAAM,eAAe,CAAC;AAKtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,SAAS,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,EAAE;IAAE,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;IAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,WAAW,CAAA;CAAE,sCAoBpI"}
|
package/dist/pages-activity.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { BarActivity } from "@graview/primitives/pages";
|
|
3
|
-
import { useGraviewIfAny } from "@graview/react/provider";
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { BarActivity, BarSuggested } from "@graview/primitives/pages";
|
|
3
|
+
import { useGraviewIfAny, usePlayback } from "@graview/react/provider";
|
|
4
4
|
import { Suspense } from "react";
|
|
5
5
|
import { createPortal } from "react-dom";
|
|
6
6
|
import { useStoreTick } from "./page-context.js";
|
|
@@ -17,9 +17,13 @@ import { useStoreTick } from "./page-context.js";
|
|
|
17
17
|
export function PagesActivity({ context, own }) {
|
|
18
18
|
useStoreTick(context.store);
|
|
19
19
|
const here = useGraviewIfAny();
|
|
20
|
-
|
|
20
|
+
// What has happened is now's, whichever moment the face draws (Roadmap f-playback).
|
|
21
|
+
const live = (usePlayback()?.live ?? context.store);
|
|
22
|
+
useStoreTick(live);
|
|
23
|
+
if (!here || live.batches().length === 0)
|
|
21
24
|
return null;
|
|
22
|
-
|
|
25
|
+
// What tidying suggests waits beside it, quietly, only while something does.
|
|
26
|
+
const drawn = (_jsxs(_Fragment, { children: [_jsx(Suspense, { fallback: null, children: _jsx(BarSuggested, {}) }), _jsx(Suspense, { fallback: null, children: _jsx(BarActivity, {}) })] }));
|
|
23
27
|
// Drawn in the derived shell's own row, in the bar's class for the face's own tool, so a phone's bar draws it as a mark.
|
|
24
28
|
return own ? createPortal(drawn, own) : _jsx("div", { className: "graview-bar-own", children: drawn });
|
|
25
29
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pages-activity.js","sourceRoot":"","sources":["../src/pages-activity.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"pages-activity.js","sourceRoot":"","sources":["../src/pages-activity.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD;;;;;;;;;GASG;AACH,MAAM,UAAU,aAAa,CAAsB,EAAE,OAAO,EAAE,GAAG,EAAoE;IACnI,YAAY,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAC5B,MAAM,IAAI,GAAG,eAAe,EAAE,CAAC;IAC/B,oFAAoF;IACpF,MAAM,IAAI,GAAG,CAAC,WAAW,EAAE,EAAE,IAAI,IAAI,OAAO,CAAC,KAAK,CAAgC,CAAC;IACnF,YAAY,CAAC,IAAwB,CAAC,CAAC;IACvC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACtD,6EAA6E;IAC7E,MAAM,KAAK,GAAG,CACZ,8BACE,KAAC,QAAQ,IAAC,QAAQ,EAAE,IAAI,YACtB,KAAC,YAAY,KAAG,GACP,EACX,KAAC,QAAQ,IAAC,QAAQ,EAAE,IAAI,YACtB,KAAC,WAAW,KAAG,GACN,IACV,CACJ,CAAC;IACF,yHAAyH;IACzH,OAAO,GAAG,CAAC,CAAC,CAAC,YAAY,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,cAAK,SAAS,EAAC,iBAAiB,YAAE,KAAK,GAAO,CAAC;AACzF,CAAC"}
|
package/dist/router.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type AnySchema } from "@graview/core";
|
|
2
2
|
import { type ComponentType } from "react";
|
|
3
3
|
import { type PageContext } from "./pages.js";
|
|
4
4
|
import { createPageRegistry, type PageRegistry } from "./registry.js";
|
|
5
|
+
import { type FirstLook } from "@graview/primitives/pages";
|
|
5
6
|
/**
|
|
6
7
|
* The routed face, assembled: `/` home, `/:plural` a list per kind,
|
|
7
8
|
* `/:plural/:id` a record per node, `/problems` the standing. Routes derive
|
|
@@ -27,7 +28,8 @@ export interface PagesAppProps<S extends AnySchema> {
|
|
|
27
28
|
readonly initialPath?: string;
|
|
28
29
|
/**
|
|
29
30
|
* TOLD WHERE THE FACE WENT (FR-106): the path, basename-relative with its
|
|
30
|
-
* search
|
|
31
|
+
* search and the section it went to (`#shipping-soon`), each time it
|
|
32
|
+
* changes after arrival — and how, `"push"`,
|
|
31
33
|
* `"replace"` or `"pop"` — so a host that keeps its own history can.
|
|
32
34
|
*/
|
|
33
35
|
readonly onNavigate?: (path: string, how: NavigationHow) => void;
|
|
@@ -43,6 +45,13 @@ export interface PagesAppProps<S extends AnySchema> {
|
|
|
43
45
|
* somewhere, for its tabs.
|
|
44
46
|
*/
|
|
45
47
|
readonly steering?: PagesSteering;
|
|
48
|
+
/**
|
|
49
|
+
* A FIRST LOOK, ONCE, when this face owns the page: hints beside the
|
|
50
|
+
* app's own controls on its bar — as the whole-page Shell's `firstLook`,
|
|
51
|
+
* remembered for the same app, so a person who saw it on the scene is not
|
|
52
|
+
* shown it again here. Off unless given.
|
|
53
|
+
*/
|
|
54
|
+
readonly firstLook?: FirstLook;
|
|
46
55
|
}
|
|
47
56
|
/** What a bar drawn outside the router holds of it: where the face is, and the way to move it. */
|
|
48
57
|
export interface PagesSteering {
|
|
@@ -66,6 +75,6 @@ export declare function PagesRoutes<S extends AnySchema>({ context, registry, }:
|
|
|
66
75
|
readonly context: PageContext<S>;
|
|
67
76
|
readonly registry?: PageRegistry<S, PageComponent<S>>;
|
|
68
77
|
}): import("react").JSX.Element;
|
|
69
|
-
export declare function PagesApp<S extends AnySchema>({ context:
|
|
78
|
+
export declare function PagesApp<S extends AnySchema>({ context: handed, registry, basename, initialPath, onNavigate, path, steering, firstLook, }: PagesAppProps<S>): import("react").JSX.Element;
|
|
70
79
|
export { createPageRegistry };
|
|
71
80
|
//# sourceMappingURL=router.d.ts.map
|
package/dist/router.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../src/router.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../src/router.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA6B,KAAK,SAAS,EAAc,MAAM,eAAe,CAAC;AAMtF,OAAO,EAAyE,KAAK,aAAa,EAAkB,MAAM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AE,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,GAAG,SAAS,CAAA;KAAE,CAAC;CACpD;AAgFD,0FAA0F;AAC1F,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,SAAS,GAAG,KAAK,CAAC;AAgOvD,wBAAgB,WAAW,CAAC,CAAC,SAAS,SAAS,EAAE,EAC/C,OAAO,EACP,QAAQ,GACT,EAAE;IACD,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;IACjC,QAAQ,CAAC,QAAQ,CAAC,EAAE,YAAY,CAAC,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;CACvD,+BAwGA;AAKD,wBAAgB,QAAQ,CAAC,CAAC,SAAS,SAAS,EAAE,EAC5C,OAAO,EAAE,MAAM,EACf,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,UAAU,EACV,IAAI,EACJ,QAAQ,EACR,SAAS,GACV,EAAE,aAAa,CAAC,CAAC,CAAC,+BAiHlB;AAED,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
|
package/dist/router.js
CHANGED
|
@@ -1,21 +1,42 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { numberAsRead, pluralLabel } from "@graview/core";
|
|
3
|
+
import { BrowserRouter, Link, MemoryRouter, Navigate, Route, Routes } from "react-router-dom";
|
|
4
|
+
import { openingOf, OVERVIEW_PATH, OVERVIEW_SLUG, sayIn } from "@graview/core";
|
|
5
|
+
import { narrowedPath } from "@graview/core/navigate";
|
|
6
|
+
import { revealSection } from "./section.js";
|
|
4
7
|
import { pluralSlug } from "./registry.js";
|
|
5
8
|
import { lazy, Suspense, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
6
9
|
import { aggregateId } from "@graview/layout/view";
|
|
7
|
-
import { GoToContext, GraviewProvider, HostFilesContext, useGraviewIfAny, useTheKeyboardLandsSomewhere, useTheWatchKnowsWhatIsUnseen } from "@graview/react/provider";
|
|
10
|
+
import { GoToContext, GraviewProvider, hasLanded, HostFilesContext, markLanded, PlaybackContext, useGraviewIfAny, useOwnPlayback, useTheKeyboardLandsSomewhere, useTheWatchKnowsWhatIsUnseen } from "@graview/react/provider";
|
|
8
11
|
import { PageAsk } from "./ask.js";
|
|
9
12
|
/* A view the seat drew, as a page: fetched when one is first shown here. */
|
|
10
13
|
const DraftPage = lazy(() => import("./page-draft.js").then((module) => ({ default: module.DraftPage })));
|
|
11
14
|
import { FaceControlsRoot } from "./face-controls.js";
|
|
15
|
+
import { PagesContextMenu } from "./context-menu.js";
|
|
12
16
|
import { DefaultHomePage, DefaultListPage, DefaultMapPage, DefaultPlacePage, DefaultPlacesPage, DefaultProblemsPage, DefaultRecordPage, DefaultSearchPage, DefaultShell } from "./pages.js";
|
|
13
17
|
import { pathOfPlace, placesOf } from "./page-places.js";
|
|
14
18
|
import { createPageRegistry, kindOfSlug } from "./registry.js";
|
|
15
19
|
import { useLocation, useNavigate, useNavigationType, useParams } from "react-router-dom";
|
|
16
|
-
import { appKeyOf, BarFindContext, HeadingsUnder, registerReaderLenses, SpecLinks } from "@graview/primitives/pages";
|
|
20
|
+
import { appKeyOf, BarFindContext, FirstLookDoor, HeadingsUnder, PastBar, registerReaderLenses, SpecLinks } from "@graview/primitives/pages";
|
|
21
|
+
/** Who reads the face when the host names nobody. */
|
|
22
|
+
const ANYONE = { kind: "human" };
|
|
17
23
|
import { OwnBarFind } from "./page-shell.js";
|
|
18
24
|
import { recordPath } from "./registry.js";
|
|
25
|
+
/**
|
|
26
|
+
* A LIST CUT SHORT SAYS WHERE THE REST IS. A list of cards is never a box
|
|
27
|
+
* to scroll inside: it shows its `limit`, and "See all 96 features" goes to
|
|
28
|
+
* the kind's list — said so when it listed every record of the kind, else
|
|
29
|
+
* how many more there are and the way to the kind's list.
|
|
30
|
+
*/
|
|
31
|
+
function SeeAll({ list, store }) {
|
|
32
|
+
const kinds = new Set(list.members.map((node) => node.kind));
|
|
33
|
+
const more = list.total - list.members.length;
|
|
34
|
+
const kind = kinds.size === 1 ? [...kinds][0] : undefined;
|
|
35
|
+
if (!kind)
|
|
36
|
+
return _jsx("p", { className: "graview-spec-text graview-spec-more", children: `and ${more} more` });
|
|
37
|
+
const plural = pluralLabel(store.schema, kind).toLowerCase();
|
|
38
|
+
return (_jsx("p", { className: "graview-spec-text graview-spec-more", children: _jsx(Link, { to: `/${pluralSlug(store.schema, kind)}`, className: "graview-spec-link graview-spec-see-all", "data-testid": "see-all", children: list.total === store.graph.nodesOfKind(kind).length ? `See all ${numberAsRead(list.total)} ${plural}` : `${numberAsRead(more)} more · all ${plural}` }) }));
|
|
39
|
+
}
|
|
19
40
|
/**
|
|
20
41
|
* WHERE A LISTED RECORD LEADS ON THIS FACE (FR-81, FR-82): a list block in a
|
|
21
42
|
* home, a lens, a card or a row draws each record as a link, and here a
|
|
@@ -27,7 +48,8 @@ function RecordLinks({ context, children }) {
|
|
|
27
48
|
const value = useMemo(() => ({
|
|
28
49
|
href: (node) => recordPath(schema, node.kind, node.id),
|
|
29
50
|
go: (node) => navigate(recordPath(schema, node.kind, node.id)),
|
|
30
|
-
|
|
51
|
+
more: (list) => _jsx(SeeAll, { list: list, store: context.store }),
|
|
52
|
+
}), [schema, navigate, context.store]);
|
|
31
53
|
// A view's own headlines are said under the page's title, which is said under the app's name (FR-131).
|
|
32
54
|
return (_jsx(SpecLinks.Provider, { value: value, children: _jsx(HeadingsUnder.Provider, { value: (context.titleLevel ?? (context.framed && !context.barAbove ? 1 : 2)) - 1, children: children }) }));
|
|
33
55
|
}
|
|
@@ -119,7 +141,9 @@ function Reported({ onNavigate, path }) {
|
|
|
119
141
|
const location = useLocation();
|
|
120
142
|
const type = useNavigationType();
|
|
121
143
|
const navigate = useNavigate();
|
|
122
|
-
|
|
144
|
+
// A section the face went to (`#shipping-soon`) is part of where it is, so a host that keeps the address can share it.
|
|
145
|
+
const section = location.hash && !location.hash.includes("=") ? location.hash : "";
|
|
146
|
+
const here = `${location.pathname}${location.search}${section}`;
|
|
123
147
|
const told = useRef(onNavigate);
|
|
124
148
|
told.current = onNavigate;
|
|
125
149
|
// The address the face arrived at is no navigation, so it is not reported.
|
|
@@ -179,7 +203,15 @@ function KindSwitch({ context, registry, page, }) {
|
|
|
179
203
|
function FaceRoot({ context, registry, children, }) {
|
|
180
204
|
const root = useRef(null);
|
|
181
205
|
useTheKeyboardLandsSomewhere(root);
|
|
182
|
-
return (_jsx("div", { ref: root, "data-graview-face": "pages", style: { display: "contents" }, children: _jsx(FaceControlsRoot, { context: context, registry: registry, root: root, children: children }) }));
|
|
206
|
+
return (_jsx("div", { ref: root, "data-graview-face": "pages", style: { display: "contents" }, children: _jsx(FaceControlsRoot, { context: context, registry: registry, root: root, children: _jsx(PagesContextMenu, { context: context, root: root, children: children }) }) }));
|
|
207
|
+
}
|
|
208
|
+
/** Whether the keyboard is in somewhere a person types: a text field, a choice, a box that edits. */
|
|
209
|
+
function typingIn(active) {
|
|
210
|
+
if (!(active instanceof HTMLElement))
|
|
211
|
+
return false;
|
|
212
|
+
if (active.isContentEditable || active.tagName === "TEXTAREA" || active.tagName === "SELECT")
|
|
213
|
+
return true;
|
|
214
|
+
return active.tagName === "INPUT" && !["button", "submit", "reset", "checkbox", "radio", "image", "file", "color", "range"].includes(active.type);
|
|
183
215
|
}
|
|
184
216
|
function ScrollReset() {
|
|
185
217
|
const { pathname } = useLocation();
|
|
@@ -215,8 +247,14 @@ function ScrollReset() {
|
|
|
215
247
|
if (!moved.current && pathname === arrivedAt.current)
|
|
216
248
|
return;
|
|
217
249
|
moved.current = true;
|
|
250
|
+
/*
|
|
251
|
+
* AND FROM A LINK THAT STAYS. A place followed from the bar left the
|
|
252
|
+
* keyboard on the bar's link, which is still there: the page under it
|
|
253
|
+
* changed and a screen reader said nothing at all. Only a person
|
|
254
|
+
* typing — the Find box, the seat, a field — keeps the keyboard where it is.
|
|
255
|
+
*/
|
|
218
256
|
const active = document.activeElement;
|
|
219
|
-
if (active
|
|
257
|
+
if (typingIn(active))
|
|
220
258
|
return;
|
|
221
259
|
const main = mark.current?.closest("main") ?? document.querySelector("main");
|
|
222
260
|
const heading = mark.current?.closest("[data-graview-face]")?.querySelector("[data-graview-page-title]") ?? main?.querySelector("h1, h2") ?? null;
|
|
@@ -232,36 +270,66 @@ function ScrollReset() {
|
|
|
232
270
|
}
|
|
233
271
|
/**
|
|
234
272
|
* GOING SOMEWHERE, ON THIS FACE: a record is its page, a place is its
|
|
235
|
-
* address under `/places
|
|
236
|
-
* (FR-93) — reaches through `useGoTo`.
|
|
273
|
+
* address under `/places/`, a kind's list is `/<plural>`. What a view that
|
|
274
|
+
* is not React — a worker view (FR-93) — reaches through `useGoTo`. A list
|
|
275
|
+
* or a place narrowed carries `?filter=` — the word its arranging line
|
|
276
|
+
* writes — and a section `#<section>`, so the address can be shared.
|
|
237
277
|
*/
|
|
238
278
|
function GoesByAddress({ context, children }) {
|
|
239
279
|
const navigate = useNavigate();
|
|
240
280
|
const goTo = useMemo(() => ({
|
|
241
|
-
record: (id) => {
|
|
281
|
+
record: (id, also) => {
|
|
242
282
|
const node = context.store.graph.getNode(id);
|
|
243
283
|
if (node)
|
|
244
|
-
navigate(recordPath(context.store.schema, node.kind, id));
|
|
284
|
+
navigate(narrowedPath(recordPath(context.store.schema, node.kind, id), { section: also?.section }));
|
|
245
285
|
},
|
|
246
|
-
place: (as) => {
|
|
286
|
+
place: (as, also) => {
|
|
247
287
|
const place = context.views?.places().find((candidate) => candidate.as === as);
|
|
248
288
|
if (place)
|
|
249
|
-
navigate(pathOfPlace(context, place));
|
|
289
|
+
navigate(narrowedPath(pathOfPlace(context, place), also));
|
|
290
|
+
},
|
|
291
|
+
list: (kind, also) => {
|
|
292
|
+
if (context.store.schema.tryDefinition(kind))
|
|
293
|
+
navigate(narrowedPath(`/${pluralSlug(context.store.schema, kind)}`, also));
|
|
250
294
|
},
|
|
251
295
|
}), [context, navigate]);
|
|
252
296
|
return _jsx(GoToContext.Provider, { value: goTo, children: children });
|
|
253
297
|
}
|
|
298
|
+
/**
|
|
299
|
+
* A SECTION OF THE PAGE, FROM THE ADDRESS: `#shipping-soon` scrolls to the
|
|
300
|
+
* heading that says it (or the element with that id) once it is drawn, and
|
|
301
|
+
* gives it the keyboard — on arrival from a shared link as after a view's
|
|
302
|
+
* `navigate`. A scene's fragment (`#view=…`) is no section.
|
|
303
|
+
*/
|
|
304
|
+
function SectionOnArrival() {
|
|
305
|
+
const { pathname, search, hash } = useLocation();
|
|
306
|
+
useEffect(() => {
|
|
307
|
+
const section = decodeURIComponent(hash.replace(/^#/, ""));
|
|
308
|
+
if (!section || section.includes("="))
|
|
309
|
+
return;
|
|
310
|
+
return revealSection(section);
|
|
311
|
+
}, [pathname, search, hash]);
|
|
312
|
+
return null;
|
|
313
|
+
}
|
|
254
314
|
/**
|
|
255
315
|
* WHERE THE APP OPENS (FR-80). A reader who arrives at the home of an app
|
|
256
316
|
* whose declaration names `pages.first` is taken there instead — a place
|
|
257
317
|
* to its page, a kind to its list — once: the arrival is replaced, so Back
|
|
258
318
|
* leaves the app rather than bouncing, and the masthead and every link to
|
|
259
|
-
* the home still go home.
|
|
319
|
+
* the home still go home. Once a visit has landed — on this face, or on the
|
|
320
|
+
* scene it opened on (`hasLanded`) — the home is the home: a press on Home
|
|
321
|
+
* from the scene draws the pages at their first entry, and that is no
|
|
322
|
+
* arrival.
|
|
260
323
|
*/
|
|
261
324
|
function Opening({ context, Home }) {
|
|
262
325
|
const location = useLocation();
|
|
326
|
+
const views = context.views;
|
|
263
327
|
// The address the reader arrived at is the router's first entry, which no navigation made.
|
|
264
|
-
const arriving = location.key === "default";
|
|
328
|
+
const arriving = location.key === "default" && !(views && hasLanded(views));
|
|
329
|
+
useEffect(() => {
|
|
330
|
+
if (views)
|
|
331
|
+
markLanded(views);
|
|
332
|
+
}, [views]);
|
|
265
333
|
const opening = arriving ? openingOf(context.views?.arrangement?.()?.first, context.store.schema, context.views?.places() ?? []) : undefined;
|
|
266
334
|
const to = opening?.to === "place" ? pathOfPlace(context, opening.place) : opening?.to === "kind" ? `/${pluralSlug(context.store.schema, opening.kind)}` : undefined;
|
|
267
335
|
return to ? _jsx(Navigate, { to: to, replace: true }) : _jsx(Home, { context: context });
|
|
@@ -299,16 +367,28 @@ export function PagesRoutes({ context, registry, }) {
|
|
|
299
367
|
const told = useMemo(() => ({ onFind: setBarFind, find: !(registry?.without().has("find") ?? false), places: !(registry?.without().has("places") ?? false) }), [registry]);
|
|
300
368
|
const routes = (
|
|
301
369
|
// The routed face holds the keyboard the way the scene does, and offers Find and the way back, whichever shell an app draws.
|
|
302
|
-
_jsx(FaceRoot, { context: context, registry: registry, children: _jsx(GoesByAddress, { context: context, children: frame(
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
370
|
+
_jsx(FaceRoot, { context: context, registry: registry, children: _jsx(GoesByAddress, { context: context, children: frame(_jsxs(_Fragment, { children: [_jsx(PastBar, { face: "pages" }), _jsxs(RecordLinks, { context: inside, children: [_jsx(ScrollReset, {}), _jsx(SectionOnArrival, {}), _jsxs(Routes, { children: [(registry?.routes() ?? []).map(({ path, component }) => {
|
|
371
|
+
const Page = component;
|
|
372
|
+
return _jsx(Route, { path: path, element: _jsx(Page, { context: inside }) }, path);
|
|
373
|
+
}), _jsx(Route, { path: "/", element: _jsx(Opening, { context: inside, Home: Home }) }), _jsx(Route, { path: "/problems", element: _jsx(Problems, { context: inside }) }), _jsx(Route, { path: "/~draft", element: _jsx(Suspense, { fallback: null, children: _jsx(DraftPage, { context: inside }) }) }), _jsx(Route, { path: "/search", element: _jsx(DefaultSearchPage, { context: inside }) }), _jsx(Route, { path: "/map", element: _jsx(DefaultMapPage, { context: inside }) }), _jsx(Route, { path: "/places", element: _jsx(DefaultPlacesPage, { context: inside }) }), placesOf(inside).some((place) => place.as === OVERVIEW_SLUG) ? null : _jsx(Route, { path: OVERVIEW_PATH, element: _jsx(Navigate, { to: "/", replace: true }) }), _jsx(Route, { path: "/places/:as", element: _jsx(DefaultPlacePage, { context: inside }) }), _jsx(Route, { path: "/:slug", element: _jsx(KindSwitch, { context: inside, registry: registry, page: "list" }) }), _jsx(Route, { path: "/:slug/:id", element: _jsx(KindSwitch, { context: inside, registry: registry, page: "record" }) })] })] })] })) }) }));
|
|
306
374
|
// Only a design under the bar hands the bar its Find: the derived shell draws its own in the bar, and so says it before any script runs.
|
|
307
375
|
if (context.embedded || !own || ownsTheWindow)
|
|
308
376
|
return routes;
|
|
309
377
|
return (_jsx(OwnBarFind.Provider, { value: told, children: _jsx(BarFindContext.Provider, { value: barFind, children: routes }) }));
|
|
310
378
|
}
|
|
311
|
-
|
|
379
|
+
/** Where a first look finds the controls of a face that owns the page. */
|
|
380
|
+
const thePage = () => (typeof document === "undefined" ? null : document.body);
|
|
381
|
+
export function PagesApp({ context: handed, registry, basename, initialPath, onNavigate, path, steering, firstLook, }) {
|
|
382
|
+
/*
|
|
383
|
+
* THE SEAT THE READER TOOK, where the app offers seats and no provider
|
|
384
|
+
* above holds them. The face names the person by their seat (the tenth
|
|
385
|
+
* walk found "user-lena" on the person's button: the seats never reached
|
|
386
|
+
* the provider), and once they reach it the person's menu offers "Sit as
|
|
387
|
+
* somebody else" — so the face sits there too, until the app hands it
|
|
388
|
+
* another principal.
|
|
389
|
+
*/
|
|
390
|
+
const [taken, setTaken] = useState(undefined);
|
|
391
|
+
const given = taken !== undefined && taken.from === handed.principal ? { ...handed, principal: taken.seat } : handed;
|
|
312
392
|
/*
|
|
313
393
|
* WHAT THE SEAT MAY SEE. Every page reads `context.store`; under a policy
|
|
314
394
|
* that says who sees what (`sees`), that store holds only what this seat
|
|
@@ -323,10 +403,21 @@ export function PagesApp({ context: given, registry, basename, initialPath, onNa
|
|
|
323
403
|
* says nothing of its own, or one tab would say two places by turns.
|
|
324
404
|
*/
|
|
325
405
|
const outer = useGraviewIfAny();
|
|
326
|
-
|
|
406
|
+
// Days, times and numbers in the reader's locale, else the app's (FR-178), whether or not a provider is drawn under the pages.
|
|
407
|
+
sayIn({ reader: given.locale ?? outer?.locale, app: given.brand?.locale ?? given.app?.brand?.locale });
|
|
408
|
+
/*
|
|
409
|
+
* THE MOMENT DRAWN (Roadmap f-playback): now, or the app as it stood at
|
|
410
|
+
* a moment somebody asked to see — the provider's this face is drawn
|
|
411
|
+
* inside when that one holds this store, else the face's own. Every page
|
|
412
|
+
* reads the one store, so the place a person is on is drawn as it was.
|
|
413
|
+
*/
|
|
414
|
+
const seat = given.principal ?? ANYONE;
|
|
415
|
+
const playback = useOwnPlayback(given.store, seat, given.history);
|
|
416
|
+
const shown = playback.past && playback.live === given.store ? playback.past.store : given.store;
|
|
417
|
+
const viewed = shown.seenBy(seat);
|
|
327
418
|
const context = viewed === given.store ? given : { ...given, store: viewed };
|
|
328
419
|
useTheWatchKnowsWhatIsUnseen(given.store, given.principal);
|
|
329
|
-
const routed = (_jsxs(_Fragment, { children: [onNavigate || path !== undefined ? _jsx(Reported, { onNavigate: onNavigate, path: path }) : null, steering ? _jsx(Steered, { steering: steering }) : null, context.presence || outer ? _jsx(SaysWhere, { context: context, to: outer }) : null, _jsx(PagesRoutes, { context: context, ...(registry ? { registry } : {}) })] }));
|
|
420
|
+
const routed = (_jsxs(_Fragment, { children: [onNavigate || path !== undefined ? _jsx(Reported, { onNavigate: onNavigate, path: path }) : null, steering ? _jsx(Steered, { steering: steering }) : null, context.presence || outer ? _jsx(SaysWhere, { context: context, to: outer }) : null, _jsx(PagesRoutes, { context: context, ...(registry ? { registry } : {}) }), firstLook ? _jsx(FirstLookDoor, { firstLook: firstLook, root: thePage, app: appKeyOf(given.brand, given.store.schema) }) : null] }));
|
|
330
421
|
/*
|
|
331
422
|
* A PROVIDER UNDER THE PAGES when the app handed over its views, so a lens
|
|
332
423
|
* drawn on a page finds the store, the seat and the registry its hooks ask
|
|
@@ -339,8 +430,9 @@ export function PagesApp({ context: given, registry, basename, initialPath, onNa
|
|
|
339
430
|
* with a design of its own still has the assistant — the same panel, on
|
|
340
431
|
* every route, however the pages around it are drawn.
|
|
341
432
|
*/
|
|
342
|
-
const inner = context.views ? (_jsxs(GraviewProvider, { store: context.store, views: context.views, ...(context.principal ? { principal: context.principal } : {}), ...(context.brand ? { brand: context.brand } : {}), ...(context.settings ? { settings: context.settings } : {}), ...(context.presence && !outer ? { presence: context.presence } : {}), ...(context.people ? { people: context.people } : {}), ...(context.onKeepLens ? { onKeepLens: context.onKeepLens } : {}), ...(context.ai ? { ai: context.ai } : {}), ...(context.app ? { app: context.app } : {}), children: [routed, _jsx(PageAsk, { context: context })] })) : (routed);
|
|
343
|
-
const
|
|
433
|
+
const inner = context.views ? (_jsxs(GraviewProvider, { store: context.store, views: context.views, ...(context.principal ? { principal: context.principal } : {}), ...(context.brand ? { brand: context.brand } : {}), ...(context.locale ? { locale: context.locale } : {}), ...(context.settings ? { settings: context.settings } : {}), ...(context.presence && !outer ? { presence: context.presence } : {}), ...(context.people ? { people: context.people } : {}), ...(context.seats ? { seats: context.seats } : {}) /* So the person's button names the seat, not its principal id. */, onSeat: (seat) => (outer ? outer.takeSeat(seat) : setTaken({ from: handed.principal, seat })), ...(context.onKeepLens ? { onKeepLens: context.onKeepLens } : {}), ...(context.ai ? { ai: context.ai } : {}), resolveApp: context.resolveApp ?? outer?.resolveApp /* The host's way to name another app (FR-171): the face's own, else the provider's it is drawn inside. */, linkedRecords: context.linkedRecords ?? outer?.linkedRecords /* And to read its records, as this viewer (FR-171). */, ...(context.app ? { app: context.app } : {}), ...(context.menuSections ? { menuSections: context.menuSections } : {}), children: [routed, _jsx(PageAsk, { context: context })] })) : (routed);
|
|
434
|
+
const timed = _jsx(PlaybackContext.Provider, { value: playback, children: inner });
|
|
435
|
+
const filed = context.files ? _jsx(HostFilesContext.Provider, { value: context.files, children: timed }) : timed;
|
|
344
436
|
if (initialPath !== undefined) {
|
|
345
437
|
/*
|
|
346
438
|
* THE TEST ROUTER CARRIES THE BASENAME TOO, OR THE TESTS ARE A LIE.
|