@mdbase-dev/ui 0.1.41 → 0.2.1

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/css/controls.css CHANGED
@@ -1206,6 +1206,27 @@ textarea.mdbase-field {
1206
1206
  width: min(440px, calc(100vw - 32px));
1207
1207
  }
1208
1208
 
1209
+ /* The dialog sits in the top layer, so it sets its own text size rather than inheriting the page's. */
1210
+ .mdbase-confirm-dialog .mdbase-dialog-body {
1211
+ font-size: var(--font-size-ui);
1212
+ line-height: 1.5;
1213
+ }
1214
+
1215
+ .mdbase-confirm-dialog .mdbase-dialog-body p {
1216
+ margin: 0;
1217
+ }
1218
+
1219
+ /* A field the confirmation asks for: its label sits just above it. */
1220
+ .mdbase-confirm-dialog .mdbase-dialog-body > label {
1221
+ display: grid;
1222
+ gap: 6px;
1223
+ font-weight: var(--font-weight-medium);
1224
+ }
1225
+
1226
+ .mdbase-confirm-dialog .mdbase-dialog-actions {
1227
+ margin-top: var(--space-2);
1228
+ }
1229
+
1209
1230
  /* Save notices: small, quiet, and gone once there is nothing to act on. */
1210
1231
  .mdbase-save-notice {
1211
1232
  display: inline-flex;
@@ -10,7 +10,7 @@ import { ActionButton, CollectionMark, GateFooter, ItemCopy, ItemMore, NoticeBlo
10
10
  import { SetupReview } from "./SetupReview.js";
11
11
  import { BringInBanner, UnsyncedLine } from "./UnsyncedWork.js";
12
12
  import { unsyncedApi } from "./unsynced.js";
13
- import { useAutoStart, useCollectionUi } from "./use-collection-ui.js";
13
+ import { cancelAuthorizationApi, useAutoStart, useCollectionUi } from "./use-collection-ui.js";
14
14
  /**
15
15
  * Everything before a collection is open: sign-in, choosing, approval, setup
16
16
  * review and problems. In phase `ready` it renders the app, with a banner
@@ -299,18 +299,25 @@ function GateBody({
299
299
  })]
300
300
  });
301
301
  case "authorizing":
302
- return _jsxs("div", {
303
- className: "mdbase-collections-actions",
304
- children: [_jsx(ActionButton, {
305
- tone: "secondary",
306
- onClick: actions.reopen,
307
- children: copy.openWindowAgain
308
- }), busy === "sign_in" || busy === "add" || busy === "approve" ? _jsx(ActionButton, {
309
- tone: "quiet",
310
- onClick: actions.cancel,
311
- children: copy.cancel
312
- }) : null]
313
- });
302
+ {
303
+ // Signing in from work before connecting: cancelling goes back to it.
304
+ const unsynced = view.purpose === "sign_in" && ui.options.unsynced && unsyncedApi(ui.options.mdbase);
305
+ const cancellable = cancelAuthorizationApi(ui.options.mdbase) !== null || busy === "sign_in" || busy === "add" || busy === "approve";
306
+ return _jsxs("div", {
307
+ className: "mdbase-collections-actions",
308
+ children: [_jsx(ActionButton, {
309
+ tone: "secondary",
310
+ inert: busy === "cancel",
311
+ onClick: actions.reopen,
312
+ children: copy.openWindowAgain
313
+ }), cancellable && _jsx(ActionButton, {
314
+ tone: "quiet",
315
+ inert: busy === "cancel",
316
+ onClick: actions.cancel,
317
+ children: unsynced ? copy.continueWithoutConnecting : copy.cancel
318
+ })]
319
+ });
320
+ }
314
321
  case "choosing":
315
322
  return _jsxs(_Fragment, {
316
323
  children: [view.notice && _jsx(NoticeBlock, {
@@ -97,7 +97,7 @@ export interface CollectionUiOptions {
97
97
  readonly unsynced?: CollectionUnsyncedOptions | boolean | undefined;
98
98
  }
99
99
  /** `add_private` remains available to legacy track callers; both add APIs now emit `add`. */
100
- export type CollectionActionName = "sign_in" | "add" | "add_private" | "approve" | "select" | "choose_another" | "assess" | "start" | "sign_out" | "setup" | "open_unsynced" | "bring_in" | "discard_unsynced";
100
+ export type CollectionActionName = "sign_in" | "add" | "add_private" | "approve" | "select" | "choose_another" | "assess" | "start" | "sign_out" | "setup" | "open_unsynced" | "bring_in" | "discard_unsynced" | "cancel";
101
101
  export interface CollectionUi {
102
102
  readonly view: CollectionView;
103
103
  readonly copy: CollectionCopy;
@@ -130,7 +130,9 @@ export interface CollectionActions {
130
130
  chooseAnother(): void;
131
131
  /** Open the Connect window again for the authorization in progress. */
132
132
  reopen(): void;
133
- /** Abandon the authorization this page started. */
133
+ /** Stop waiting for Connect: signed out again (or back to work before
134
+ * connecting), or the collection list when signed in. On an SDK without
135
+ * `cancelAuthorization` it only abandons the call this page started. */
134
136
  cancel(): void;
135
137
  assess(): void;
136
138
  start(): void;
@@ -153,6 +155,15 @@ export interface CollectionActions {
153
155
  discardUnsynced(): void;
154
156
  dismissUnsyncedNotice(): void;
155
157
  }
158
+ type CancelAuthorization = (options: {
159
+ readonly signal?: AbortSignal;
160
+ }) => Promise<unknown>;
161
+ /**
162
+ * `mdbase.cancelAuthorization`, or null on an SDK release that predates it.
163
+ * Read structurally because this package builds against the vendored
164
+ * production SDK; drop it once that SDK and the peer floor include it.
165
+ */
166
+ export declare function cancelAuthorizationApi(mdbase: Mdbase): CancelAuthorization | null;
156
167
  /** The first current item across the app's sections. */
157
168
  export declare function appOpenItem(sections: readonly CollectionSection[] | undefined): OpenSectionItem | null;
158
169
  /**
@@ -163,3 +174,4 @@ export declare function appOpenItem(sections: readonly CollectionSection[] | und
163
174
  export declare function useAutoStart(mdbase: Mdbase, enabled?: boolean): void;
164
175
  /** Subscribe to the app's mdbase entry and get its view plus gesture-safe actions. */
165
176
  export declare function useCollectionUi(options: CollectionUiOptions): CollectionUi;
177
+ export {};
@@ -5,6 +5,15 @@ import { defaultCollectionCopy, fill } from "./copy.js";
5
5
  import { actionNotice, collectionView } from "./model.js";
6
6
  import { planNeedsReview, unsyncedApi } from "./unsynced.js";
7
7
  const popupActions = new Set(["sign_in", "add", "add_private", "approve"]);
8
+ /**
9
+ * `mdbase.cancelAuthorization`, or null on an SDK release that predates it.
10
+ * Read structurally because this package builds against the vendored
11
+ * production SDK; drop it once that SDK and the peer floor include it.
12
+ */
13
+ export function cancelAuthorizationApi(mdbase) {
14
+ const cancel = mdbase.cancelAuthorization;
15
+ return typeof cancel === "function" ? options => cancel.call(mdbase, options) : null;
16
+ }
8
17
  /** The first current item across the app's sections. */
9
18
  export function appOpenItem(sections) {
10
19
  for (const section of sections ?? []) {
@@ -224,6 +233,10 @@ export function useCollectionUi(options) {
224
233
  cancel: () => {
225
234
  const current = running.current;
226
235
  if (current && popupActions.has(current.name)) current.controller.abort();
236
+ const cancel = cancelAuthorizationApi(mdbase);
237
+ if (cancel) void run("cancel", signal => cancel({
238
+ signal
239
+ }), true);
227
240
  },
228
241
  assess: () => {
229
242
  void run("assess", signal => mdbase.assess({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mdbase-dev/ui",
3
- "version": "0.1.41",
3
+ "version": "0.2.1",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -208,7 +208,7 @@
208
208
  "@lingui/format-po": "6.9.0",
209
209
  "@lingui/react": "6.9.0",
210
210
  "@lingui/vite-plugin": "6.9.0",
211
- "@mdbase-dev/sdk": "0.1.0-beta.188",
211
+ "@mdbase-dev/sdk": "file:../../apps/editor/vendor/sdk-74869d08-production-0.1.41.tgz",
212
212
  "@rolldown/plugin-babel": "^0.2.4",
213
213
  "@types/jsdom": "^30.0.0",
214
214
  "@types/node": "^24.0.0",
@@ -258,6 +258,6 @@
258
258
  "typecheck": "node scripts/compile-catalogues.mjs && tsc -p tsconfig.json --noEmit"
259
259
  },
260
260
  "mdbaseRelease": {
261
- "commit": "74869d0822543c9a4d4621d9c3ee40d6a79b6fd6"
261
+ "commit": "884f642bf70a59990cc82c7bc0abdfcf248021aa"
262
262
  }
263
263
  }