@mdbase-dev/ui 0.1.0-beta.159 → 0.1.0-beta.161
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 +3 -2
- package/css/collections.css +19 -1
- package/css/controls.css +3 -7
- package/css/motion.css +8 -0
- package/dist/AppSwitcher.js +0 -9
- package/dist/CommandPalette.js +2 -2
- package/dist/Dialog.js +16 -1
- package/dist/Menu.js +10 -0
- package/dist/apps.d.ts +2 -2
- package/dist/apps.js +5 -5
- package/dist/brand.js +1 -1
- package/dist/collections/CollectionGate.js +73 -7
- package/dist/collections/CollectionSwitcher.js +3 -3
- package/dist/collections/SetupReview.d.ts +2 -1
- package/dist/collections/SetupReview.js +11 -3
- package/dist/collections/UnsyncedWork.d.ts +26 -0
- package/dist/collections/UnsyncedWork.js +160 -0
- package/dist/collections/copy.d.ts +20 -0
- package/dist/collections/copy.js +210 -0
- package/dist/collections/model.d.ts +9 -0
- package/dist/collections/model.js +13 -1
- package/dist/collections/unsynced.d.ts +56 -0
- package/dist/collections/unsynced.js +18 -0
- package/dist/collections/use-collection-ui.d.ts +26 -1
- package/dist/collections/use-collection-ui.js +113 -4
- package/dist/collections.d.ts +3 -1
- package/dist/collections.js +1 -0
- package/dist/locales/de/messages.json +1 -1
- package/dist/locales/en/messages.json +1 -1
- package/dist/locales/es/messages.json +1 -1
- package/dist/locales/fr/messages.json +1 -1
- package/dist/locales/it/messages.json +1 -1
- package/dist/locales/ja/messages.json +1 -1
- package/dist/locales/ko/messages.json +1 -1
- package/dist/locales/pt/messages.json +1 -1
- package/dist/locales/ru/messages.json +1 -1
- package/dist/locales/zh/messages.json +1 -1
- package/dist/overlay.js +9 -5
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -35,8 +35,9 @@ applyThemePreference(loadThemePreference());
|
|
|
35
35
|
total is known, and `holdMdbaseMarkBusy(loop)` (or `useMdbaseMarkBusy`) while
|
|
36
36
|
it is not.
|
|
37
37
|
- `apps` lists the mdbase apps and builds links that open the current
|
|
38
|
-
collection in another app.
|
|
39
|
-
`withAppUrls
|
|
38
|
+
collection in another app. Every deployment passes its own URLs to
|
|
39
|
+
`withAppUrls` (or `AppSwitcher`'s `urls` prop). Apps without a configured URL
|
|
40
|
+
are omitted; shared metadata never falls back to production origins.
|
|
40
41
|
|
|
41
42
|
## Icon-button tooltips
|
|
42
43
|
|
package/css/collections.css
CHANGED
|
@@ -307,6 +307,24 @@
|
|
|
307
307
|
gap: 8px;
|
|
308
308
|
}
|
|
309
309
|
|
|
310
|
+
/* Work before connecting: where it is kept, and the way to connect it. One
|
|
311
|
+
quiet line above the app, never a modal or a nag. */
|
|
312
|
+
.mdbase-collections-unsynced {
|
|
313
|
+
display: flex;
|
|
314
|
+
flex-wrap: wrap;
|
|
315
|
+
align-items: center;
|
|
316
|
+
justify-content: space-between;
|
|
317
|
+
gap: 4px 12px;
|
|
318
|
+
padding: 6px 14px;
|
|
319
|
+
border-bottom: 1px solid var(--_border);
|
|
320
|
+
background: var(--_surface);
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
.mdbase-collections-unsynced-status {
|
|
324
|
+
margin: 0;
|
|
325
|
+
color: var(--_text-soft);
|
|
326
|
+
}
|
|
327
|
+
|
|
310
328
|
/* Collections are a list, not buttons among actions. */
|
|
311
329
|
.mdbase-collections-section {
|
|
312
330
|
display: grid;
|
|
@@ -615,7 +633,7 @@
|
|
|
615
633
|
gap: 4px;
|
|
616
634
|
}
|
|
617
635
|
|
|
618
|
-
.mdbase-collections-setup-section h3 {
|
|
636
|
+
.mdbase-collections-setup-section :is(h2, h3) {
|
|
619
637
|
margin: 0;
|
|
620
638
|
color: var(--_text-soft);
|
|
621
639
|
font-size: var(--_font-size-caption);
|
package/css/controls.css
CHANGED
|
@@ -322,16 +322,12 @@ textarea.mdbase-field {
|
|
|
322
322
|
cursor: pointer;
|
|
323
323
|
}
|
|
324
324
|
|
|
325
|
+
/* Pointer and keyboard share one highlight; hovering moves focus, so only one row is ever marked. */
|
|
325
326
|
.mdbase-menu-item:hover:not(:disabled, [aria-disabled="true"]),
|
|
326
327
|
.mdbase-menu .mdbase-menu-item:focus-visible {
|
|
328
|
+
outline: 0;
|
|
327
329
|
color: var(--color-text);
|
|
328
|
-
background: var(--color-
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
/* One focus mark inside the row, instead of an outline around it. */
|
|
332
|
-
.mdbase-menu .mdbase-menu-item:focus-visible {
|
|
333
|
-
outline: var(--focus-ring);
|
|
334
|
-
outline-offset: -1px;
|
|
330
|
+
background: var(--color-accent-soft);
|
|
335
331
|
}
|
|
336
332
|
|
|
337
333
|
.mdbase-menu-item:disabled {
|
package/css/motion.css
CHANGED
|
@@ -21,6 +21,14 @@
|
|
|
21
21
|
transition: opacity var(--motion-enter) var(--ease-out), transform var(--motion-enter) var(--ease-out);
|
|
22
22
|
}
|
|
23
23
|
.mdbase-overlay::backdrop { opacity: 1; transition: opacity var(--motion-enter) var(--ease-out); }
|
|
24
|
+
.mdbase-dialog.mdbase-overlay {
|
|
25
|
+
transition-property: opacity, transform, display, overlay;
|
|
26
|
+
transition-behavior: normal, normal, allow-discrete, allow-discrete;
|
|
27
|
+
}
|
|
28
|
+
.mdbase-dialog.mdbase-overlay::backdrop {
|
|
29
|
+
transition-property: opacity, display, overlay;
|
|
30
|
+
transition-behavior: normal, allow-discrete, allow-discrete;
|
|
31
|
+
}
|
|
24
32
|
.mdbase-overlay[data-open="false"]::backdrop { opacity: 0; transition-duration: var(--motion-exit); transition-timing-function: var(--ease-exit); }
|
|
25
33
|
.mdbase-overlay[data-open="false"] {
|
|
26
34
|
opacity: 0;
|
package/dist/AppSwitcher.js
CHANGED
|
@@ -32,15 +32,6 @@ export function AppSwitcher({
|
|
|
32
32
|
ref: triggerRef,
|
|
33
33
|
type: "button",
|
|
34
34
|
className: "mdbase-app-switcher",
|
|
35
|
-
"aria-label": _i18n._(
|
|
36
|
-
/** i18n */
|
|
37
|
-
{
|
|
38
|
-
id: "54P3Y1",
|
|
39
|
-
message: "mdbase {current}: open this collection in another app",
|
|
40
|
-
values: {
|
|
41
|
-
current: current
|
|
42
|
-
}
|
|
43
|
-
}),
|
|
44
35
|
"aria-haspopup": "menu",
|
|
45
36
|
"aria-expanded": open,
|
|
46
37
|
"aria-controls": open ? menuId : undefined,
|
package/dist/CommandPalette.js
CHANGED
|
@@ -4,7 +4,7 @@ import { useLocaleRevision } from "./i18n.js";
|
|
|
4
4
|
import { Dialog } from "./Dialog.js";
|
|
5
5
|
import { shortcutLabel } from "./shortcuts.js";
|
|
6
6
|
export { isApplePlatform, shortcutLabel } from "./shortcuts.js";
|
|
7
|
-
import { Fragment,
|
|
7
|
+
import { Fragment, useLayoutEffect, useId, useMemo, useRef, useState } from "react";
|
|
8
8
|
const browseLimit = 6;
|
|
9
9
|
const searchLimit = 40;
|
|
10
10
|
function contextualCommands(commands) {
|
|
@@ -117,7 +117,7 @@ function OpenCommandPalette({
|
|
|
117
117
|
block: "nearest"
|
|
118
118
|
});
|
|
119
119
|
}, [active, matches]);
|
|
120
|
-
|
|
120
|
+
useLayoutEffect(() => {
|
|
121
121
|
if (open) {
|
|
122
122
|
setQuery(initialQuery);
|
|
123
123
|
setActive(0);
|
package/dist/Dialog.js
CHANGED
|
@@ -66,6 +66,15 @@ export function Dialog({
|
|
|
66
66
|
preventScroll: true
|
|
67
67
|
});
|
|
68
68
|
}, [closeDisabled, open, ref]);
|
|
69
|
+
useLayoutEffect(() => {
|
|
70
|
+
const dialog = ref.current;
|
|
71
|
+
if (open || !dialog) return;
|
|
72
|
+
const ownedFocus = dialog.contains(document.activeElement) || document.activeElement === document.body;
|
|
73
|
+
if (dialog.open) dialog.close();
|
|
74
|
+
if (ownedFocus) (returnFocusRef?.current ?? invoker.current)?.focus({
|
|
75
|
+
preventScroll: true
|
|
76
|
+
});
|
|
77
|
+
}, [open, ref, returnFocusRef]);
|
|
69
78
|
useEffect(() => {
|
|
70
79
|
const dialog = ref.current;
|
|
71
80
|
return () => {
|
|
@@ -81,13 +90,16 @@ export function Dialog({
|
|
|
81
90
|
ref: ref,
|
|
82
91
|
className: ["mdbase-dialog mdbase-overlay", className].filter(Boolean).join(" "),
|
|
83
92
|
"data-open": open,
|
|
93
|
+
inert: !open,
|
|
94
|
+
"aria-hidden": !open || undefined,
|
|
84
95
|
role: role,
|
|
85
96
|
"aria-modal": "true",
|
|
86
97
|
"aria-labelledby": titleId,
|
|
87
98
|
"aria-describedby": descriptionId,
|
|
88
99
|
tabIndex: -1,
|
|
89
100
|
onKeyDown: event => {
|
|
90
|
-
|
|
101
|
+
// An exiting dialog no longer owns the keyboard, so app shortcuts still work.
|
|
102
|
+
if (open) event.stopPropagation();
|
|
91
103
|
if (event.key === "Escape") {
|
|
92
104
|
event.preventDefault();
|
|
93
105
|
if (!closeDisabled) onClose();
|
|
@@ -106,6 +118,9 @@ export function Dialog({
|
|
|
106
118
|
event.preventDefault();
|
|
107
119
|
if (!closeDisabled) onClose();
|
|
108
120
|
},
|
|
121
|
+
onMouseDown: event => {
|
|
122
|
+
if (event.target === event.currentTarget) event.preventDefault();
|
|
123
|
+
},
|
|
109
124
|
onClick: event => {
|
|
110
125
|
if (!closeDisabled && event.target === event.currentTarget) onClose();
|
|
111
126
|
},
|
package/dist/Menu.js
CHANGED
|
@@ -31,9 +31,19 @@ export function Menu({
|
|
|
31
31
|
"aria-label": label,
|
|
32
32
|
tabIndex: -1,
|
|
33
33
|
onKeyDown: event => moveMenuFocus(event, ref.current),
|
|
34
|
+
onPointerMove: focusMenuItemUnderPointer,
|
|
34
35
|
children: children
|
|
35
36
|
}) : null;
|
|
36
37
|
}
|
|
38
|
+
/** Hovering a row takes focus from the keyboard-marked one, unless a field in the menu is being typed in. */
|
|
39
|
+
function focusMenuItemUnderPointer(event) {
|
|
40
|
+
const menu = event.currentTarget;
|
|
41
|
+
if (event.pointerType !== "mouse" || document.activeElement instanceof HTMLInputElement && menu.contains(document.activeElement)) return;
|
|
42
|
+
const item = event.target.closest('[role^="menuitem"]:not(:disabled):not([aria-disabled="true"])');
|
|
43
|
+
if (item && menu.contains(item) && item !== document.activeElement) item.focus({
|
|
44
|
+
preventScroll: true
|
|
45
|
+
});
|
|
46
|
+
}
|
|
37
47
|
export function useMenuTrigger() {
|
|
38
48
|
const id = useId();
|
|
39
49
|
const [open, setOpen] = useState(false);
|
package/dist/apps.d.ts
CHANGED
|
@@ -8,13 +8,13 @@ export interface MdbaseApp {
|
|
|
8
8
|
readonly id: MdbaseAppId;
|
|
9
9
|
readonly name: string;
|
|
10
10
|
readonly description: string;
|
|
11
|
-
/**
|
|
11
|
+
/** Deployment URL supplied by the consumer with `withAppUrls`. */
|
|
12
12
|
readonly url: string;
|
|
13
13
|
}
|
|
14
14
|
export declare const mdbaseApps: readonly MdbaseApp[];
|
|
15
15
|
/**
|
|
16
16
|
* Replaces app URLs for a lab or local build, for example from
|
|
17
|
-
* `import.meta.env.VITE_MDBASE_WRITER_URL`.
|
|
17
|
+
* `import.meta.env.VITE_MDBASE_WRITER_URL`. Apps without a URL are omitted.
|
|
18
18
|
*/
|
|
19
19
|
export declare function withAppUrls(urls: Partial<Record<MdbaseAppId, string | undefined>>, apps?: readonly MdbaseApp[]): readonly MdbaseApp[];
|
|
20
20
|
/** A link that opens the current page's collection in another app. */
|
package/dist/apps.js
CHANGED
|
@@ -11,7 +11,7 @@ export const mdbaseApps = [{
|
|
|
11
11
|
message: "Browse and edit records"
|
|
12
12
|
});
|
|
13
13
|
},
|
|
14
|
-
url: "
|
|
14
|
+
url: ""
|
|
15
15
|
}, {
|
|
16
16
|
id: "reader",
|
|
17
17
|
name: "Reader",
|
|
@@ -23,7 +23,7 @@ export const mdbaseApps = [{
|
|
|
23
23
|
message: "Read and annotate sources"
|
|
24
24
|
});
|
|
25
25
|
},
|
|
26
|
-
url: "
|
|
26
|
+
url: ""
|
|
27
27
|
}, {
|
|
28
28
|
id: "writer",
|
|
29
29
|
name: "Writer",
|
|
@@ -35,11 +35,11 @@ export const mdbaseApps = [{
|
|
|
35
35
|
message: "Write manuscripts that cite your sources"
|
|
36
36
|
});
|
|
37
37
|
},
|
|
38
|
-
url: "
|
|
38
|
+
url: ""
|
|
39
39
|
}];
|
|
40
40
|
/**
|
|
41
41
|
* Replaces app URLs for a lab or local build, for example from
|
|
42
|
-
* `import.meta.env.VITE_MDBASE_WRITER_URL`.
|
|
42
|
+
* `import.meta.env.VITE_MDBASE_WRITER_URL`. Apps without a URL are omitted.
|
|
43
43
|
*/
|
|
44
44
|
export function withAppUrls(urls, apps = mdbaseApps) {
|
|
45
45
|
return apps.map(app => {
|
|
@@ -48,7 +48,7 @@ export function withAppUrls(urls, apps = mdbaseApps) {
|
|
|
48
48
|
...app,
|
|
49
49
|
url
|
|
50
50
|
} : app;
|
|
51
|
-
});
|
|
51
|
+
}).filter(app => app.url);
|
|
52
52
|
}
|
|
53
53
|
/**
|
|
54
54
|
* Parameters every mdbase app reads the same way: `collection` is the Connect SDK's
|
package/dist/brand.js
CHANGED
|
@@ -8,6 +8,8 @@ import { RowDialogs, SignOutDialog } from "./dialogs.js";
|
|
|
8
8
|
import { problemControl, actionNotice } from "./model.js";
|
|
9
9
|
import { ActionButton, CollectionMark, GateFooter, ItemCopy, ItemMore, NoticeBlock, RowCopy, RowMore } from "./parts.js";
|
|
10
10
|
import { SetupReview } from "./SetupReview.js";
|
|
11
|
+
import { BringInBanner, UnsyncedLine } from "./UnsyncedWork.js";
|
|
12
|
+
import { unsyncedApi } from "./unsynced.js";
|
|
11
13
|
import { useAutoStart, useCollectionUi } from "./use-collection-ui.js";
|
|
12
14
|
/**
|
|
13
15
|
* Everything before a collection is open: sign-in, choosing, approval, setup
|
|
@@ -44,6 +46,8 @@ export function CollectionGate({
|
|
|
44
46
|
ui: ui,
|
|
45
47
|
variant: "banner"
|
|
46
48
|
})
|
|
49
|
+
}), _jsx(BringInBanner, {
|
|
50
|
+
ui: ui
|
|
47
51
|
}), _jsx(CollectionMdbaseContext, {
|
|
48
52
|
value: options.mdbase,
|
|
49
53
|
children: children(ui.view.phase.connection)
|
|
@@ -52,6 +56,17 @@ export function CollectionGate({
|
|
|
52
56
|
})]
|
|
53
57
|
});
|
|
54
58
|
}
|
|
59
|
+
// Work before connecting: the app as usual, saved only on this device.
|
|
60
|
+
if (ui.view.kind === "unsynced") {
|
|
61
|
+
return _jsxs(_Fragment, {
|
|
62
|
+
children: [_jsx(UnsyncedLine, {
|
|
63
|
+
ui: ui
|
|
64
|
+
}), _jsx(CollectionMdbaseContext, {
|
|
65
|
+
value: options.mdbase,
|
|
66
|
+
children: children(ui.view.phase.connection)
|
|
67
|
+
})]
|
|
68
|
+
});
|
|
69
|
+
}
|
|
55
70
|
return _jsx(GateScreen, {
|
|
56
71
|
ui: ui,
|
|
57
72
|
layout: layout,
|
|
@@ -70,6 +85,12 @@ export function CollectionPanel({
|
|
|
70
85
|
const ui = useCollectionUi(options);
|
|
71
86
|
useAutoStart(options.mdbase, autoStart);
|
|
72
87
|
const [dialog, setDialog] = useState(null);
|
|
88
|
+
if (ui.view.kind === "unsynced") return _jsx("div", {
|
|
89
|
+
className: "mdbase-collections mdbase-collections-panel",
|
|
90
|
+
children: _jsx(UnsyncedPanel, {
|
|
91
|
+
ui: ui
|
|
92
|
+
})
|
|
93
|
+
});
|
|
73
94
|
if (ui.view.kind !== "ready") return _jsx(GateScreen, {
|
|
74
95
|
ui: ui,
|
|
75
96
|
layout: "panel",
|
|
@@ -81,6 +102,9 @@ export function CollectionPanel({
|
|
|
81
102
|
notice: ui.view.notice,
|
|
82
103
|
ui: ui,
|
|
83
104
|
variant: "inline"
|
|
105
|
+
}), _jsx(BringInBanner, {
|
|
106
|
+
ui: ui,
|
|
107
|
+
variant: "inline"
|
|
84
108
|
}), _jsx(SwitcherContent, {
|
|
85
109
|
ui: ui,
|
|
86
110
|
onDone: () => {},
|
|
@@ -156,10 +180,13 @@ function GateScreen({
|
|
|
156
180
|
});
|
|
157
181
|
}, [view.kind]);
|
|
158
182
|
const Heading = layout === "page" ? "h1" : "h2";
|
|
183
|
+
const Container = layout === "page" ? "main" : "div";
|
|
159
184
|
const opening = view.kind === "starting" || view.kind === "opening";
|
|
160
185
|
const announce = view.kind === "authorizing" ? view.heading : "";
|
|
161
|
-
return _jsxs(
|
|
162
|
-
ref:
|
|
186
|
+
return _jsxs(Container, {
|
|
187
|
+
ref: element => {
|
|
188
|
+
root.current = element;
|
|
189
|
+
},
|
|
163
190
|
className: "mdbase-collections mdbase-collections-gate",
|
|
164
191
|
"data-layout": layout,
|
|
165
192
|
"data-phase": view.kind,
|
|
@@ -182,17 +209,18 @@ function GateScreen({
|
|
|
182
209
|
children: headingText
|
|
183
210
|
}), opening ? _jsx(OpeningScreen, {
|
|
184
211
|
app: options.app,
|
|
185
|
-
layout:
|
|
212
|
+
layout: "panel",
|
|
186
213
|
title: headingText,
|
|
187
214
|
detail: lead ?? undefined
|
|
188
|
-
}) : lead && _jsx("p", {
|
|
215
|
+
}) : lead && view.kind !== "needs_setup" && _jsx("p", {
|
|
189
216
|
className: "mdbase-collections-lead",
|
|
190
217
|
children: lead
|
|
191
218
|
}), _jsx(GateBody, {
|
|
192
219
|
ui: ui,
|
|
220
|
+
layout: layout,
|
|
193
221
|
extraActions: view.kind === "signed_out" ? extra : undefined,
|
|
194
222
|
onDialog: setDialog
|
|
195
|
-
}), ui.error && _jsx(NoticeBlock, {
|
|
223
|
+
}), ui.error && !(view.kind === "choosing" && ui.error.key === "account_collection_quota_exceeded") && _jsx(NoticeBlock, {
|
|
196
224
|
notice: ui.error,
|
|
197
225
|
ui: ui,
|
|
198
226
|
variant: "inline"
|
|
@@ -230,6 +258,7 @@ function showsChooseAnother(view) {
|
|
|
230
258
|
}
|
|
231
259
|
function GateBody({
|
|
232
260
|
ui,
|
|
261
|
+
layout,
|
|
233
262
|
extraActions,
|
|
234
263
|
onDialog
|
|
235
264
|
}) {
|
|
@@ -258,6 +287,11 @@ function GateBody({
|
|
|
258
287
|
progress: busy === "sign_out" ? copy.signingOut : busy === "sign_in" ? copy.addingCollection : null,
|
|
259
288
|
onClick: actions.signIn,
|
|
260
289
|
children: copy.signIn
|
|
290
|
+
}), ui.options.unsynced && unsyncedApi(ui.options.mdbase) && _jsx(ActionButton, {
|
|
291
|
+
tone: "secondary",
|
|
292
|
+
inert: inert,
|
|
293
|
+
onClick: actions.continueWithoutConnecting,
|
|
294
|
+
children: copy.continueWithoutConnecting
|
|
261
295
|
}), extraActions]
|
|
262
296
|
}), _jsx(AppSections, {
|
|
263
297
|
ui: ui,
|
|
@@ -291,7 +325,11 @@ function GateBody({
|
|
|
291
325
|
onDialog: onDialog
|
|
292
326
|
}), _jsx("div", {
|
|
293
327
|
className: "mdbase-collections-actions",
|
|
294
|
-
children: _jsx(
|
|
328
|
+
children: ui.error?.key === "account_collection_quota_exceeded" ? _jsx(NoticeBlock, {
|
|
329
|
+
notice: ui.error,
|
|
330
|
+
ui: ui,
|
|
331
|
+
variant: "inline"
|
|
332
|
+
}) : _jsx(ActionButton, {
|
|
295
333
|
tone: view.collections.length > 0 ? "secondary" : "primary",
|
|
296
334
|
inert: inert,
|
|
297
335
|
progress: busy === "add" ? copy.addingCollection : null,
|
|
@@ -313,7 +351,8 @@ function GateBody({
|
|
|
313
351
|
});
|
|
314
352
|
case "needs_setup":
|
|
315
353
|
return _jsx(SetupReview, {
|
|
316
|
-
ui: ui
|
|
354
|
+
ui: ui,
|
|
355
|
+
layout: layout
|
|
317
356
|
}, view.collectionId);
|
|
318
357
|
case "problem":
|
|
319
358
|
return _jsx(NoticeBlock, {
|
|
@@ -336,9 +375,36 @@ function GateBody({
|
|
|
336
375
|
})]
|
|
337
376
|
});
|
|
338
377
|
case "ready":
|
|
378
|
+
case "unsynced":
|
|
339
379
|
return null;
|
|
340
380
|
}
|
|
341
381
|
}
|
|
382
|
+
/** In a settings panel: where the work is kept, and the way to connect it. */
|
|
383
|
+
function UnsyncedPanel({
|
|
384
|
+
ui
|
|
385
|
+
}) {
|
|
386
|
+
const options = ui.options.unsynced;
|
|
387
|
+
const saved = typeof options === "object" && options.storage === "device" ? ui.copy.unsyncedSavedDevice : ui.copy.unsyncedSavedBrowser;
|
|
388
|
+
return _jsxs(_Fragment, {
|
|
389
|
+
children: [_jsx("p", {
|
|
390
|
+
className: "mdbase-collections-lead",
|
|
391
|
+
children: saved
|
|
392
|
+
}), _jsx("div", {
|
|
393
|
+
className: "mdbase-collections-actions",
|
|
394
|
+
children: _jsx(ActionButton, {
|
|
395
|
+
tone: "primary",
|
|
396
|
+
inert: ui.busy !== null,
|
|
397
|
+
progress: ui.busy === "sign_in" || ui.busy === "add" ? ui.copy.addingCollection : null,
|
|
398
|
+
onClick: ui.actions.connect,
|
|
399
|
+
children: ui.copy.unsyncedConnect
|
|
400
|
+
})
|
|
401
|
+
}), ui.error && _jsx(NoticeBlock, {
|
|
402
|
+
notice: ui.error,
|
|
403
|
+
ui: ui,
|
|
404
|
+
variant: "inline"
|
|
405
|
+
})]
|
|
406
|
+
});
|
|
407
|
+
}
|
|
342
408
|
/** The approved collections as a labelled list: one row per collection, never mixed with actions. */
|
|
343
409
|
function CollectionList({
|
|
344
410
|
ui,
|
|
@@ -73,9 +73,9 @@ export function CollectionSwitcher({
|
|
|
73
73
|
"aria-haspopup": "dialog",
|
|
74
74
|
"aria-expanded": open,
|
|
75
75
|
"aria-controls": open ? panelId : undefined,
|
|
76
|
-
"aria-label": currentName ? say("switchCollection", {
|
|
76
|
+
"aria-label": variant === "icon" ? currentName ? say("switchCollection", {
|
|
77
77
|
collection: currentName
|
|
78
|
-
}) : copy.switchCollectionNone,
|
|
78
|
+
}) : copy.switchCollectionNone : undefined,
|
|
79
79
|
title: name,
|
|
80
80
|
onClick: () => setOpen(!open),
|
|
81
81
|
children: [busy === "select" || busy === "add" || view.kind === "opening" ? _jsx("span", {
|
|
@@ -88,7 +88,7 @@ export function CollectionSwitcher({
|
|
|
88
88
|
}) : variant === "icon" ? _jsx(CollectionsGlyph, {}) : null, variant !== "icon" && _jsx("span", {
|
|
89
89
|
className: "mdbase-collections-trigger-name",
|
|
90
90
|
children: name
|
|
91
|
-
}), variant === "full" && current && _jsx("span", {
|
|
91
|
+
}), variant === "full" && current && " ", variant === "full" && current && _jsx("span", {
|
|
92
92
|
className: "mdbase-collections-trigger-role",
|
|
93
93
|
children: current.roleLabel
|
|
94
94
|
}), _jsx("svg", {
|
|
@@ -4,6 +4,7 @@ import type { CollectionUi } from "./use-collection-ui.js";
|
|
|
4
4
|
* Reviewable setup: `setup.plan()` (read-only, so it starts at once), then
|
|
5
5
|
* `setup.apply(plan)` only from the person's click. Never configures silently.
|
|
6
6
|
*/
|
|
7
|
-
export declare function SetupReview({ ui }: {
|
|
7
|
+
export declare function SetupReview({ ui, layout }: {
|
|
8
8
|
readonly ui: CollectionUi;
|
|
9
|
+
readonly layout?: "page" | "panel";
|
|
9
10
|
}): JSX.Element;
|
|
@@ -10,7 +10,8 @@ const TRANSIENT_REPLANS = 15;
|
|
|
10
10
|
* `setup.apply(plan)` only from the person's click. Never configures silently.
|
|
11
11
|
*/
|
|
12
12
|
export function SetupReview({
|
|
13
|
-
ui
|
|
13
|
+
ui,
|
|
14
|
+
layout = "panel"
|
|
14
15
|
}) {
|
|
15
16
|
const {
|
|
16
17
|
mdbase
|
|
@@ -110,6 +111,12 @@ export function SetupReview({
|
|
|
110
111
|
...current,
|
|
111
112
|
notice
|
|
112
113
|
} : current);
|
|
114
|
+
// A dispatched apply consumes its plan: clicking again with it can only be
|
|
115
|
+
// refused. Plan again quietly, keeping this review and notice on screen.
|
|
116
|
+
setRequest(current => ({
|
|
117
|
+
...current,
|
|
118
|
+
quiet: true
|
|
119
|
+
}));
|
|
113
120
|
});
|
|
114
121
|
};
|
|
115
122
|
if (state.status === "planning") {
|
|
@@ -153,6 +160,7 @@ export function SetupReview({
|
|
|
153
160
|
const nothing = plan.status === "current" || plan.changes.length === 0 && plan.conflicts.length === 0;
|
|
154
161
|
const adoptable = Object.keys(plan.adoptable).length > 0;
|
|
155
162
|
const applicable = !refusal && plan.canApply;
|
|
163
|
+
const Heading = layout === "page" ? "h2" : "h3";
|
|
156
164
|
// NoticeBlock shows a refusal's own control, except `set_up` (this is setup).
|
|
157
165
|
const refusalActs = !!refusalNotice?.control && refusalNotice.control.kind !== "set_up";
|
|
158
166
|
// Never leave the review without a way forward.
|
|
@@ -171,7 +179,7 @@ export function SetupReview({
|
|
|
171
179
|
children: nothing ? ui.copy.setupNothing : plan.summary
|
|
172
180
|
}), plan.changes.length > 0 && _jsxs("section", {
|
|
173
181
|
className: "mdbase-collections-setup-section",
|
|
174
|
-
children: [_jsx(
|
|
182
|
+
children: [_jsx(Heading, {
|
|
175
183
|
children: ui.copy.setupChanges
|
|
176
184
|
}), _jsx("ul", {
|
|
177
185
|
className: "mdbase-collections-setup-list",
|
|
@@ -181,7 +189,7 @@ export function SetupReview({
|
|
|
181
189
|
})]
|
|
182
190
|
}), plan.conflicts.length > 0 && _jsxs("section", {
|
|
183
191
|
className: "mdbase-collections-setup-section",
|
|
184
|
-
children: [_jsx(
|
|
192
|
+
children: [_jsx(Heading, {
|
|
185
193
|
children: ui.copy.setupConflicts
|
|
186
194
|
}), _jsx("ul", {
|
|
187
195
|
className: "mdbase-collections-setup-list",
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type JSX } from "react";
|
|
2
|
+
import type { Mdbase } from "@mdbase-dev/sdk";
|
|
3
|
+
import type { CollectionUi } from "./use-collection-ui.js";
|
|
4
|
+
/**
|
|
5
|
+
* The one quiet, persistent line while the app works in its unsynced
|
|
6
|
+
* collection and something has been saved there: where it is kept, and the
|
|
7
|
+
* way to connect it.
|
|
8
|
+
*/
|
|
9
|
+
export declare function UnsyncedLine({ ui }: {
|
|
10
|
+
readonly ui: CollectionUi;
|
|
11
|
+
}): JSX.Element | null;
|
|
12
|
+
/**
|
|
13
|
+
* With a collection open and work saved before connecting: offer to bring it
|
|
14
|
+
* in (asking first when names or types change), or to discard it. Afterwards,
|
|
15
|
+
* how it went.
|
|
16
|
+
*/
|
|
17
|
+
export declare function BringInBanner({ ui, variant }: {
|
|
18
|
+
readonly ui: CollectionUi;
|
|
19
|
+
readonly variant?: "banner" | "inline";
|
|
20
|
+
}): JSX.Element | null;
|
|
21
|
+
/**
|
|
22
|
+
* The save label for the app's own save notice while it works in its unsynced
|
|
23
|
+
* collection ("Saved only in this browser" instead of "Saved"), or null
|
|
24
|
+
* otherwise. Inside the gate it finds the entry by itself.
|
|
25
|
+
*/
|
|
26
|
+
export declare function useUnsyncedSavedLabel(supplied?: Mdbase, storage?: "browser" | "device"): string | null;
|