@mdbase-dev/ui 0.1.0-beta.163 → 0.1.0-beta.165

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
@@ -96,6 +96,47 @@ and `showAll` values as stable IDs. Group order, browsing limits and search matc
96
96
  still use those IDs; translated headings do not change matching or merge groups.
97
97
  Re-render with the current locale's callback to update the presentation.
98
98
 
99
+ ## Live preview
100
+
101
+ `livePreview()` from `@mdbase-dev/ui/live-preview` renders Markdown in a
102
+ CodeMirror 6 editor while keeping the document plain text. Import
103
+ `@mdbase-dev/ui/live-preview.css` beside it. Parse with GitHub-flavoured
104
+ Markdown (`markdownLanguage`) so tables, strikethrough and tasks render.
105
+
106
+ ```ts
107
+ import { markdown, markdownLanguage } from "@codemirror/lang-markdown";
108
+ import { indentListItem, livePreview, outdentListItem } from "@mdbase-dev/ui/live-preview";
109
+
110
+ const extensions = [
111
+ markdown({ base: markdownLanguage }),
112
+ livePreview({ linkMissing: (state, link) => !resolves(link) }),
113
+ keymap.of([{ key: "Tab", run: indentListItem }, { key: "Shift-Tab", run: outdentListItem }])
114
+ ];
115
+ ```
116
+
117
+ - Source shows only where a focused selection touches it, so an unfocused note
118
+ always reads as rendered text. While the mouse button is down the reveal
119
+ holds still, so a click never turns into a drag across moving text.
120
+ - Revealed heading and quote marks sit in the margin and list prefixes keep
121
+ their width, so revealing source never moves the text being edited.
122
+ - Home stops at an item's or heading's text before the line start. Task
123
+ checkboxes toggle with a click or Space.
124
+ - The app owns link resolution: `linkMissing` marks links that point nowhere,
125
+ and `refresh` rebuilds when app state behind it changes. Rendered links carry
126
+ `data-link-*` attributes for the app's own click handling.
127
+ - Tables are edited in place as a grid over their Markdown source. Tab,
128
+ Shift-Tab and Enter move between cells and grow the table, a typed `|` is
129
+ escaped, and edits across cells keep every row's columns. Dragging a grip
130
+ moves its row or column; clicking it, or the context menu (Shift-F10),
131
+ inserts, moves, aligns, sorts and deletes rows and columns; the menu uses
132
+ the shared `mdbase-menu` styles. A selection running from one cell into
133
+ another selects the block of cells between them: Delete empties it, and copy
134
+ writes Markdown (`text/plain`) and an HTML table (`text/html`). Pasted
135
+ spreadsheet, Markdown and HTML grids fill cells. Tables need
136
+ `@codemirror/view` 6.42.1 or later.
137
+ - `isRevealed(state, from, to)` and `livePreviewReveal` let an app's own
138
+ decorations (embeds, for example) follow the same reveal.
139
+
99
140
  ## Collections
100
141
 
101
142
  Import `@mdbase-dev/ui/collections` and `@mdbase-dev/ui/collections.css`.
@@ -0,0 +1,387 @@
1
+ /*
2
+ * Live preview for mdbase Markdown editors (`@mdbase-dev/ui/live-preview`).
3
+ * Scope it under the editor's own class if an app mixes source and preview editors.
4
+ */
5
+
6
+ .cm-lp-mark {
7
+ color: var(--color-text-faint);
8
+ }
9
+
10
+ /* Rendered text takes its colour from here, not from the syntax highlighting inside. */
11
+ .cm-line .cm-lp-mark *,
12
+ .cm-line .cm-lp-link *,
13
+ .cm-line .cm-lp-escaped * {
14
+ color: inherit;
15
+ }
16
+
17
+ .cm-lp-strong {
18
+ font-weight: var(--font-weight-bold, 700);
19
+ }
20
+
21
+ .cm-lp-em {
22
+ font-style: italic;
23
+ }
24
+
25
+ .cm-lp-strike {
26
+ text-decoration: line-through;
27
+ text-decoration-color: var(--color-text-muted);
28
+ }
29
+
30
+ .cm-lp-code {
31
+ padding: 0.1em 0.28em;
32
+ border-radius: var(--radius-sm);
33
+ background: var(--color-surface-subtle);
34
+ font-family: var(--mono);
35
+ font-size: 0.88em;
36
+ }
37
+
38
+ .cm-lp-link {
39
+ color: var(--syntax-link, var(--color-accent));
40
+ text-decoration: underline;
41
+ text-decoration-color: color-mix(in srgb, currentColor 40%, transparent);
42
+ text-underline-offset: 0.18em;
43
+ cursor: pointer;
44
+ }
45
+
46
+ .cm-lp-link:hover {
47
+ text-decoration-color: currentColor;
48
+ }
49
+
50
+ .cm-lp-link-missing {
51
+ color: var(--color-text-muted);
52
+ text-decoration-style: dashed;
53
+ }
54
+
55
+ /* Headings. Their revealed marks sit in the margin, so the text never moves. */
56
+ .cm-lp-heading {
57
+ position: relative;
58
+ color: var(--syntax-heading, var(--color-text));
59
+ font-weight: var(--font-weight-bold, 700);
60
+ line-height: 1.3;
61
+ }
62
+
63
+ .cm-lp-h1 { font-size: 1.6em; padding-top: 0.5em !important; padding-bottom: 0.1em !important; }
64
+ .cm-lp-h2 { font-size: 1.32em; padding-top: 0.45em !important; padding-bottom: 0.05em !important; }
65
+ .cm-lp-h3 { font-size: 1.14em; padding-top: 0.35em !important; }
66
+ .cm-lp-h4 { font-size: 1em; padding-top: 0.25em !important; }
67
+ .cm-lp-h5,
68
+ .cm-lp-h6 { font-size: 0.92em; color: var(--color-text-muted); padding-top: 0.2em !important; }
69
+
70
+ .cm-lp-outdent {
71
+ position: absolute;
72
+ right: 100%;
73
+ padding-right: 0.3em;
74
+ white-space: pre;
75
+ font-weight: var(--font-weight-regular, 400);
76
+ }
77
+
78
+ /* Quotes: a quiet fill, no edge stripe. */
79
+ .cm-lp-quote {
80
+ position: relative;
81
+ color: var(--color-text-soft);
82
+ background: var(--color-surface-subtle);
83
+ padding-left: calc(var(--lp-line-padding, 6px) + 0.85em * var(--lp-quote-depth, 1)) !important;
84
+ padding-right: 0.85em !important;
85
+ }
86
+
87
+ .cm-lp-quote-first {
88
+ border-top-left-radius: var(--radius-md);
89
+ border-top-right-radius: var(--radius-md);
90
+ padding-top: 0.3em !important;
91
+ }
92
+
93
+ .cm-lp-quote-last {
94
+ border-bottom-left-radius: var(--radius-md);
95
+ border-bottom-right-radius: var(--radius-md);
96
+ padding-bottom: 0.3em !important;
97
+ }
98
+
99
+ /* A nested quote is a deeper fill inset by its parent's indent. */
100
+ .cm-lp-quote-nested {
101
+ --lp-quote-tint: color-mix(in oklab, currentColor 6%, transparent);
102
+ background-image: linear-gradient(to right,
103
+ transparent calc(var(--lp-line-padding, 6px) + 0.4em), var(--lp-quote-tint) 0);
104
+ }
105
+
106
+ /* Deeper quotes add one more fill from their own indent. */
107
+ .cm-lp-quote-deep {
108
+ background-image:
109
+ linear-gradient(to right,
110
+ transparent calc(var(--lp-line-padding, 6px) + 0.85em * (var(--lp-quote-depth) - 1) - 0.45em), var(--lp-quote-tint) 0),
111
+ linear-gradient(to right, transparent calc(var(--lp-line-padding, 6px) + 0.4em), var(--lp-quote-tint) 0);
112
+ }
113
+
114
+ .cm-lp-quote .cm-lp-outdent {
115
+ right: calc(100% - 0.85em * var(--lp-quote-depth, 1));
116
+ }
117
+
118
+ /* Phones have no margin to hang marks in, so revealed marks sit inline. */
119
+ @media (max-width: 640px) {
120
+ .cm-lp-outdent,
121
+ .cm-lp-quote .cm-lp-outdent {
122
+ position: static;
123
+ padding-right: 0;
124
+ }
125
+ }
126
+
127
+ /* Lists hang wrapped lines under their text. */
128
+ .cm-lp-list {
129
+ padding-left: calc(var(--lp-line-padding, 6px) + var(--lp-list-indent)) !important;
130
+ text-indent: calc(-1 * var(--lp-list-indent));
131
+ }
132
+
133
+ .cm-lp-list-continue {
134
+ padding-left: calc(var(--lp-line-padding, 6px) + var(--lp-list-indent)) !important;
135
+ }
136
+
137
+ .cm-lp-list-prefix {
138
+ display: inline-block;
139
+ box-sizing: border-box;
140
+ width: var(--lp-list-indent);
141
+ text-indent: 0;
142
+ white-space: pre;
143
+ vertical-align: top;
144
+ }
145
+
146
+ .cm-lp-bullet {
147
+ display: inline-block;
148
+ color: var(--color-text-muted);
149
+ }
150
+
151
+ .cm-lp-bullet::before { content: "•"; }
152
+ .cm-lp-bullet-1::before { content: "◦"; }
153
+ .cm-lp-bullet-2::before { content: "▪"; font-size: 0.8em; }
154
+
155
+ .cm-lp-ordinal {
156
+ display: inline-block;
157
+ box-sizing: border-box;
158
+ padding-right: 1ch;
159
+ text-align: right;
160
+ color: var(--color-text-muted);
161
+ font-variant-numeric: tabular-nums;
162
+ }
163
+
164
+ .cm-lp-task {
165
+ margin: 0 2px 0 1px;
166
+ vertical-align: -2px;
167
+ }
168
+
169
+ .cm-lp-task-done {
170
+ color: var(--color-text-muted);
171
+ }
172
+
173
+ /* A thematic break is a rule across the line. */
174
+ .cm-lp-rule {
175
+ position: relative;
176
+ }
177
+
178
+ .cm-lp-rule::after {
179
+ content: "";
180
+ position: absolute;
181
+ inset: 50% 0 auto;
182
+ border-top: 1px solid var(--color-border-strong);
183
+ pointer-events: none;
184
+ }
185
+
186
+ /* Tables are their own Markdown rows laid out as a grid: each line is a row and each cell's text a cell. */
187
+ .cm-lp-table {
188
+ display: table;
189
+ width: max-content;
190
+ max-width: 100%;
191
+ margin: var(--space-2) 0;
192
+ border-collapse: separate;
193
+ border-spacing: 0;
194
+ table-layout: auto;
195
+ font-variant-numeric: tabular-nums;
196
+ line-height: 1.5;
197
+ }
198
+
199
+ .cm-lp-table > .cm-line.cm-lp-tr {
200
+ display: table-row;
201
+ padding: 0;
202
+ background: none;
203
+ }
204
+
205
+ .cm-lp-table-frame {
206
+ overflow-x: auto;
207
+ scrollbar-width: thin;
208
+ padding: var(--space-2) 0 var(--space-2) var(--lp-table-indent);
209
+ }
210
+
211
+ .cm-lp-table-frame > .cm-lp-table { margin: 0; }
212
+
213
+ /* A table inside a quote continues the quote's fill. */
214
+ .cm-lp-table-quote {
215
+ padding-inline: calc(var(--lp-line-padding, 6px) + 0.85em * var(--lp-quote-depth) + var(--lp-table-indent)) 0.85em;
216
+ background: var(--color-surface-subtle);
217
+ }
218
+
219
+ .cm-lp-table-quote-last {
220
+ border-bottom-left-radius: var(--radius-md);
221
+ border-bottom-right-radius: var(--radius-md);
222
+ padding-bottom: var(--space-3);
223
+ }
224
+
225
+ .cm-lp-table-quote .cm-lp-td { background: var(--color-surface); }
226
+ .cm-lp-table-quote .cm-lp-th { background: var(--color-surface-subtle); }
227
+
228
+ /* Hidden pipes leave empty placeholders behind; in a row they would become cells of their own. */
229
+ .cm-lp-tr > :not(.cm-lp-td) { display: none; }
230
+ /*
231
+ * The editor measures a caret beside an empty cell's widget on these buffers. Taken out of
232
+ * flow rather than hidden, they keep a box at the cell, so scrolling to that caret stays put.
233
+ */
234
+ .cm-lp-tr > img.cm-widgetBuffer { display: inline; position: absolute; }
235
+
236
+ .cm-lp-td {
237
+ display: table-cell;
238
+ min-width: 4em;
239
+ max-width: 28em;
240
+ padding: var(--space-1) var(--space-3);
241
+ border-bottom: 1px solid var(--color-border);
242
+ border-inline-end: 1px solid var(--color-border);
243
+ vertical-align: top;
244
+ white-space: pre-wrap;
245
+ overflow-wrap: break-word;
246
+ word-break: normal;
247
+ transition: background-color var(--motion-quick) var(--ease-standard);
248
+ }
249
+
250
+ /* Words wrap whole; only links, which have no natural breaks, may split anywhere. */
251
+ .cm-lp-td .cm-lp-link { overflow-wrap: anywhere; }
252
+
253
+ .cm-lp-td:first-child { border-inline-start: 1px solid var(--color-border); }
254
+ .cm-lp-tr-header > .cm-lp-td { border-top: 1px solid var(--color-border); }
255
+ .cm-lp-tr-header > .cm-lp-td:first-child { border-start-start-radius: var(--radius-md); }
256
+ .cm-lp-tr-header > .cm-lp-td:last-child { border-start-end-radius: var(--radius-md); }
257
+ .cm-lp-tr-last > .cm-lp-td:first-child { border-end-start-radius: var(--radius-md); }
258
+ .cm-lp-tr-last > .cm-lp-td:last-child { border-end-end-radius: var(--radius-md); }
259
+
260
+ /* An empty cell keeps its column and a caret-sized line. */
261
+ .cm-lp-td:empty::before { content: "\200b"; }
262
+
263
+ .cm-lp-th {
264
+ background: var(--color-surface-subtle);
265
+ color: var(--color-text);
266
+ font-weight: var(--font-weight-semibold);
267
+ }
268
+
269
+ .cm-lp-align-center { text-align: center; }
270
+ .cm-lp-align-right { text-align: end; }
271
+
272
+ /* The delimiter row is structure, not content: it takes no space. */
273
+ .cm-lp-table > .cm-line.cm-lp-tr-delimiter { height: 0; font-size: 0; line-height: 0; }
274
+ .cm-lp-tr-delimiter > br { display: none; }
275
+
276
+ /* A block of cells is drawn as cells; the text selection running through it is not. */
277
+ .cm-content .cm-lp-table.cm-lp-table-cells ::selection { background: transparent; }
278
+ .cm-lp-tr > .cm-lp-td-selected { background: var(--color-accent-soft); }
279
+
280
+ .cm-focused .cm-lp-td-active {
281
+ background: var(--color-accent-soft);
282
+ outline: 1px solid var(--color-accent);
283
+ outline-offset: -1px;
284
+ }
285
+
286
+ /* Row and column grips sit on the table's edges; the add buttons run along its sides. */
287
+ .cm-lp-table-controls {
288
+ position: absolute;
289
+ inset: 0 auto auto 0;
290
+ z-index: 2;
291
+ pointer-events: none;
292
+ opacity: 0;
293
+ transition: opacity var(--motion-quick) var(--ease-standard);
294
+ }
295
+
296
+ .cm-lp-table-controls-visible { opacity: 1; }
297
+ .cm-lp-table-controls-visible > button { pointer-events: auto; }
298
+
299
+ .cm-lp-table-controls > button {
300
+ position: absolute;
301
+ display: grid;
302
+ place-items: center;
303
+ padding: 0;
304
+ border: 1px solid var(--color-border);
305
+ border-radius: var(--radius-sm);
306
+ color: var(--color-text-muted);
307
+ background: var(--color-surface);
308
+ cursor: pointer;
309
+ }
310
+
311
+ .cm-lp-table-controls > button:hover {
312
+ border-color: var(--color-border-strong);
313
+ color: var(--color-text);
314
+ background: var(--color-surface-subtle);
315
+ }
316
+
317
+ .cm-lp-table-controls svg { width: 14px; height: 14px; fill: currentColor; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; }
318
+ .cm-lp-table-grip svg { stroke: none; }
319
+ .cm-lp-table-controls > .cm-lp-table-grip { cursor: grab; touch-action: none; }
320
+ .cm-lp-table-dragging,
321
+ .cm-lp-table-controls.cm-lp-table-dragging > .cm-lp-table-grip { cursor: grabbing; }
322
+
323
+ /* While dragging, the moved row or column is tinted and a line marks where it lands. */
324
+ .cm-lp-table-drag-source,
325
+ .cm-lp-table-drop { position: absolute; pointer-events: none; }
326
+ .cm-lp-table-drag-source { background: var(--color-accent-soft); opacity: 0.6; }
327
+ .cm-lp-table-drop { border: 1px solid var(--color-accent); translate: -1px -1px; }
328
+ .cm-lp-table-drag-source[hidden],
329
+ .cm-lp-table-drop[hidden] { display: none; }
330
+
331
+ .cm-lp-table-grip-column { width: 24px; height: 14px; translate: -50% -50%; }
332
+ .cm-lp-table-grip-row { width: 14px; height: 24px; translate: -50% -50%; }
333
+
334
+ .cm-lp-table-add {
335
+ opacity: 0;
336
+ transition: opacity var(--motion-quick) var(--ease-standard);
337
+ }
338
+
339
+ .cm-lp-table-add-row { height: 16px; translate: 0 4px; }
340
+ .cm-lp-table-add-column { width: 16px; translate: 4px 0; }
341
+ .cm-lp-table-controls > .cm-lp-table-add:hover,
342
+ .cm-lp-table-controls > .cm-lp-table-add:focus-visible { opacity: 1; }
343
+
344
+ .cm-lp-table-menu { z-index: 50; min-width: 12rem; box-shadow: var(--elevation-low); }
345
+ .cm-lp-table-menu-separator { height: 1px; margin: 4px 2px; background: var(--color-border); }
346
+ .cm-lp-table-menu [aria-checked="true"]::after { content: ""; width: 8px; height: 4px; margin-inline-start: auto; border-bottom: 1.5px solid currentColor; border-left: 1.5px solid currentColor; rotate: -45deg; translate: 0 -2px; }
347
+
348
+ @media (pointer: coarse) {
349
+ .cm-lp-table-grip-column { width: 32px; height: 20px; }
350
+ .cm-lp-table-grip-row { width: 20px; height: 32px; }
351
+ .cm-lp-table-add { opacity: 1; }
352
+ }
353
+
354
+ /* Code blocks retain real editable lines, including nested syntax highlighting. */
355
+ .cm-lp-code-block {
356
+ background: var(--color-surface-subtle);
357
+ font-family: var(--mono);
358
+ font-size: 0.88em;
359
+ overflow-wrap: anywhere;
360
+ white-space: pre-wrap;
361
+ padding-left: 1em !important;
362
+ padding-right: 1em !important;
363
+ }
364
+ .cm-lp-code-first { border-radius: var(--radius-md) var(--radius-md) 0 0; padding-top: 0.5em !important; }
365
+ .cm-lp-code-last { border-radius: 0 0 var(--radius-md) var(--radius-md); padding-bottom: 0.5em !important; }
366
+ .cm-lp-code-first.cm-lp-code-last { border-radius: var(--radius-md); }
367
+ .cm-lp-code-fence-end { line-height: 0; min-height: 0; }
368
+ .cm-lp-code-header { display: inline-flex; width: 100%; vertical-align: middle; align-items: center; justify-content: space-between; gap: 1em; min-height: 28px; color: var(--color-text-muted); font-family: var(--sans); font-size: var(--font-size-caption); }
369
+ .cm-lp-code-header button, .cm-lp-callout-header button { border: 0; border-radius: var(--radius-sm); background: transparent; color: inherit; cursor: pointer; min-width: 28px; min-height: 28px; font: inherit; }
370
+ .cm-lp-code-header button:hover, .cm-lp-callout-header button:hover { background: var(--color-surface); color: var(--color-text); }
371
+ .cm-lp-code-header button:focus-visible, .cm-lp-callout-header button:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 1px; }
372
+
373
+ .cm-lp-callout { background: var(--color-surface-subtle); padding-left: 1em !important; padding-right: 1em !important; }
374
+ .cm-lp-callout-first { border-radius: var(--radius-md) var(--radius-md) 0 0; padding-top: 0.3em !important; font-weight: 600; }
375
+ .cm-lp-callout-last { border-radius: 0 0 var(--radius-md) var(--radius-md); padding-bottom: 0.3em !important; }
376
+ .cm-lp-callout-first.cm-lp-callout-last { border-radius: var(--radius-md); }
377
+ .cm-lp-callout-note, .cm-lp-callout-info, .cm-lp-callout-question { background: color-mix(in srgb, var(--color-accent) 7%, var(--color-surface)); }
378
+ .cm-lp-callout-tip, .cm-lp-callout-success, .cm-lp-callout-todo { background: color-mix(in srgb, var(--color-success) 8%, var(--color-surface)); }
379
+ .cm-lp-callout-warning { background: color-mix(in srgb, var(--color-warning) 9%, var(--color-surface)); }
380
+ .cm-lp-callout-danger { background: color-mix(in srgb, var(--color-danger) 8%, var(--color-surface)); }
381
+ .cm-lp-callout-header { display: inline-flex; align-items: center; gap: 0.55em; width: 100%; }
382
+ .cm-lp-callout-header button { margin-left: auto; }
383
+ .cm-lp-callout-icon { width: 1em; text-align: center; color: var(--color-text-soft); }
384
+ .cm-lp-footnote-ref { font-size: 0.75em; vertical-align: super; color: var(--color-text-soft); }
385
+ .cm-lp-footnote-definition { color: var(--color-text-muted); font-size: 0.9em; }
386
+ .cm-lp-footnote-ref, .cm-lp-footnote-ref * { color: var(--color-text-soft) !important; text-decoration: none !important; }
387
+ .cm-lp-footnote-definition span { color: inherit !important; text-decoration: none !important; }
package/css/palette.css CHANGED
@@ -82,7 +82,8 @@
82
82
  .mdbase-command-results > button[aria-selected="true"] {
83
83
  color: var(--color-text);
84
84
  background: light-dark(oklch(94% 0.001 286), oklch(29% 0.004 286));
85
- box-shadow: inset 0 0 0 1px light-dark(oklch(60% 0.004 286), oklch(63% 0.004 286));
85
+ outline: 1px solid light-dark(oklch(60% 0.004 286), oklch(63% 0.004 286));
86
+ outline-offset: -1px;
86
87
  }
87
88
 
88
89
  @media (forced-colors: active) {
package/dist/apps.d.ts CHANGED
@@ -12,10 +12,15 @@ export interface MdbaseApp {
12
12
  readonly url: string;
13
13
  }
14
14
  export declare const mdbaseApps: readonly MdbaseApp[];
15
+ /** Every app mdbase makes: the family above plus apps with their own identity. */
16
+ export interface OfficialApp extends Omit<MdbaseApp, "id"> {
17
+ readonly id: MdbaseAppId | "journal" | "tasknotes";
18
+ }
19
+ export declare const officialApps: readonly OfficialApp[];
15
20
  /**
16
21
  * Replaces app URLs for a lab or local build, for example from
17
22
  * `import.meta.env.VITE_MDBASE_WRITER_URL`. Apps without a URL are omitted.
18
23
  */
19
- export declare function withAppUrls(urls: Partial<Record<MdbaseAppId, string | undefined>>, apps?: readonly MdbaseApp[]): readonly MdbaseApp[];
24
+ export declare function withAppUrls<App extends OfficialApp = MdbaseApp>(urls: Partial<Record<App["id"], string | undefined>>, apps?: readonly App[]): readonly App[];
20
25
  /** A link that opens the current page's collection in another app. */
21
26
  export declare function mdbaseAppHref(appUrl: string, currentHref: string): string;
package/dist/apps.js CHANGED
@@ -37,6 +37,31 @@ export const mdbaseApps = [{
37
37
  },
38
38
  url: ""
39
39
  }];
40
+ export const officialApps = [...mdbaseApps, {
41
+ id: "journal",
42
+ name: "Journal",
43
+ get description() {
44
+ return _i18n._(
45
+ /** i18n */
46
+ {
47
+ id: "jGhSFf",
48
+ message: "Keep a daily journal"
49
+ });
50
+ },
51
+ url: ""
52
+ }, {
53
+ id: "tasknotes",
54
+ name: "TaskNotes",
55
+ get description() {
56
+ return _i18n._(
57
+ /** i18n */
58
+ {
59
+ id: "xyK1aJ",
60
+ message: "Plan tasks and projects"
61
+ });
62
+ },
63
+ url: ""
64
+ }];
40
65
  /**
41
66
  * Replaces app URLs for a lab or local build, for example from
42
67
  * `import.meta.env.VITE_MDBASE_WRITER_URL`. Apps without a URL are omitted.
@@ -355,9 +355,20 @@ function GateBody({
355
355
  layout: layout
356
356
  }, view.collectionId);
357
357
  case "problem":
358
- return _jsx(NoticeBlock, {
359
- notice: view.notice,
360
- ui: ui
358
+ return _jsxs(_Fragment, {
359
+ children: [_jsx(NoticeBlock, {
360
+ notice: view.notice,
361
+ ui: ui
362
+ }), view.unsynced && !view.signedIn && _jsx("div", {
363
+ className: "mdbase-collections-actions",
364
+ children: _jsx(ActionButton, {
365
+ tone: "secondary",
366
+ inert: inert,
367
+ progress: busy === "sign_in" ? copy.addingCollection : null,
368
+ onClick: actions.signIn,
369
+ children: copy.signIn
370
+ })
371
+ })]
361
372
  });
362
373
  case "unavailable":
363
374
  case "closed":
@@ -108,10 +108,13 @@ export type CollectionView = Common & ({
108
108
  } | {
109
109
  readonly kind: "needs_setup";
110
110
  readonly collectionId: string;
111
- } | {
111
+ }
112
+ /** `unsynced`: the problem is the app's unsynced collection's (work before connecting). */
113
+ | {
112
114
  readonly kind: "problem";
113
115
  readonly collectionId: string | null;
114
116
  readonly notice: CollectionNotice;
117
+ readonly unsynced: boolean;
115
118
  } | {
116
119
  readonly kind: "ready";
117
120
  readonly collectionId: string;
@@ -143,16 +143,28 @@ export function collectionView(snapshot, options) {
143
143
  case "problem":
144
144
  {
145
145
  const name = nameOf(phase.collectionId, snapshot.selection.requested.displayName);
146
- const notice = problemNotice(phase.problem, {
146
+ const open = isOpen(snapshot);
147
+ const unsynced = phase.collectionId !== null && phase.collectionId === unsyncedCollectionId(snapshot);
148
+ let notice = problemNotice(phase.problem, {
147
149
  collectionId: phase.collectionId,
148
150
  signedIn,
149
- open: isOpen(snapshot)
151
+ open
150
152
  });
153
+ // The unsynced collection sets itself up when it opens, so it has no setup
154
+ // to review: an open one that is still not set up is checked again instead.
155
+ if (unsynced && open && (!notice.control || notice.control.kind === "set_up")) notice = {
156
+ ...notice,
157
+ control: {
158
+ kind: "assess",
159
+ label: copy.tryAgain
160
+ }
161
+ };
151
162
  return {
152
163
  ...common,
153
164
  kind: "problem",
154
165
  collectionId: phase.collectionId,
155
166
  notice,
167
+ unsynced,
156
168
  heading: name ? say(copy.problemHeading, name) : say(copy.problemHeadingUnnamed),
157
169
  lead: null
158
170
  };
@@ -298,6 +310,11 @@ function currentCollectionId(phase) {
298
310
  function isOpen(snapshot) {
299
311
  return snapshot.status === "ready" || snapshot.status === "setup_required";
300
312
  }
313
+ /** The ID of the unsynced collection this tab shows, read structurally (see unsynced.ts), or null. */
314
+ function unsyncedCollectionId(snapshot) {
315
+ const shown = snapshot.unsynced;
316
+ return typeof shown?.collectionId === "string" ? shown.collectionId : null;
317
+ }
301
318
  const roleLabels = copy => ({
302
319
  owner: copy.roleOwner,
303
320
  editor: copy.roleEditor,
@@ -0,0 +1,3 @@
1
+ import { StateField } from "@codemirror/state";
2
+ export declare function calloutHeader(text: string): RegExpExecArray | null;
3
+ export declare function blockPreview(): (StateField<ReadonlyMap<number, boolean>> | import("@codemirror/state").Extension)[];