@hanzo/app 0.3.10 → 0.3.12

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/dist/Setup.d.ts CHANGED
@@ -20,6 +20,12 @@ export interface Linked {
20
20
  export declare function linked(providersData: unknown, connectionsData: unknown): Linked | null;
21
21
  /** Where Disconnect lets go of GitHub: the reader's own link, or the org's App accounts. */
22
22
  export declare const leaving: (own: boolean) => "/v1/provider/github/disconnect" | "/v1/provider/github/user/disconnect";
23
+ /**
24
+ * Said on the window when GitHub's connection changes, here or on Projects and
25
+ * Settings (@hanzo/build, which says and hears the same name), so each reads it
26
+ * again without a reload. Setup hears its own word too.
27
+ */
28
+ export declare const GITHUB_CHANGED = "hanzo:github";
23
29
  export declare function Setup({ go }?: {
24
30
  go?: (address: string) => void;
25
31
  }): import("react").JSX.Element;
package/dist/Setup.js CHANGED
@@ -77,6 +77,13 @@ export function linked(providersData, connectionsData) {
77
77
  }
78
78
  /** Where Disconnect lets go of GitHub: the reader's own link, or the org's App accounts. */
79
79
  export const leaving = (own) => (own ? '/v1/provider/github/user/disconnect' : '/v1/provider/github/disconnect');
80
+ /**
81
+ * Said on the window when GitHub's connection changes, here or on Projects and
82
+ * Settings (@hanzo/build, which says and hears the same name), so each reads it
83
+ * again without a reload. Setup hears its own word too.
84
+ */
85
+ export const GITHUB_CHANGED = 'hanzo:github';
86
+ const changed = () => window.dispatchEvent(new Event(GITHUB_CHANGED));
80
87
  /** Inline Slack Mark */
81
88
  function SlackMark({ size = 18 }) {
82
89
  return (_jsxs("svg", { width: size, height: size, viewBox: "0 0 54 54", fill: "none", "aria-hidden": true, children: [_jsx("path", { d: "M11.379 33.9993C11.379 37.1358 8.84512 39.6507 5.7276 39.6507C2.61008 39.6507 0.0572205 37.1168 0.0572205 33.9993C0.0572205 30.8817 2.5911 28.3479 5.70862 28.3479H11.36V33.9993H11.379Z", fill: "#E01E5A" }), _jsx("path", { d: "M14.1962 33.9997C14.1962 30.8632 16.7301 28.3483 19.8476 28.3483C22.9651 28.3483 25.499 30.8822 25.499 33.9997V48.1353C25.499 51.2718 22.9651 53.7867 19.8476 53.7867C16.7301 53.7867 14.1962 51.2718 14.1962 48.1353V33.9997Z", fill: "#E01E5A" }), _jsx("path", { d: "M19.8662 11.2673C16.7296 11.2673 14.2148 8.73347 14.2148 5.61594C14.2148 2.49842 16.7486 -0.0354538 19.8662 -0.0354538C22.9837 -0.0354538 25.5175 2.49842 25.5175 5.61594V11.2673H19.8662Z", fill: "#36C5F0" }), _jsx("path", { d: "M19.8682 14.1334C23.0047 14.1334 25.5196 16.6673 25.5196 19.7848C25.5196 22.9023 22.9857 25.4362 19.8682 25.4362H5.67566C2.53916 25.4362 0.0242615 22.9023 0.0242615 19.7848C0.0242615 16.6673 2.55814 14.1334 5.67566 14.1334H19.8682Z", fill: "#36C5F0" }), _jsx("path", { d: "M42.5323 19.7853C42.5323 16.6488 45.0662 14.1339 48.1837 14.1339C51.3012 14.1339 53.8351 16.6678 53.8351 19.7853C53.8351 22.9028 51.3012 25.4367 48.1837 25.4367H42.5323V19.7853Z", fill: "#2EB67D" }), _jsx("path", { d: "M39.7126 19.7934C39.7126 22.9299 37.1787 25.4448 34.0612 25.4448C30.9436 25.4448 28.4098 22.911 28.4098 19.7934V5.61986C28.4098 2.48336 30.9436 -0.0315399 34.0612 -0.0315399C37.1787 -0.0315399 39.7126 2.48336 39.7126 5.61986V19.7934Z", fill: "#2EB67D" }), _jsx("path", { d: "M34.0376 42.482C37.1741 42.482 39.689 45.0158 39.689 48.1334C39.689 51.2509 37.1552 53.7848 34.0376 53.7848C30.9201 53.7848 28.3862 51.2509 28.3862 48.1334V42.482H34.0376Z", fill: "#ECB22E" }), _jsx("path", { d: "M34.0381 39.6507C30.9016 39.6507 28.3867 37.1168 28.3867 33.9993C28.3867 30.8818 30.9206 28.3479 34.0381 28.3479H48.2306C51.3671 28.3479 53.882 30.8818 53.882 33.9993C53.882 37.1168 51.3482 39.6507 48.2306 39.6507H34.0381Z", fill: "#ECB22E" })] }));
@@ -182,7 +189,8 @@ export function Setup({ go } = {}) {
182
189
  live = false;
183
190
  };
184
191
  }, [signed, syncTurn]);
185
- // Listen for postMessage completion from /auth/callback popup and focus/visibility return
192
+ // Listen for postMessage completion from /auth/callback popup, focus/visibility return,
193
+ // and GitHub changed on this page (here, on Projects or in Settings)
186
194
  useEffect(() => {
187
195
  if (typeof window === 'undefined')
188
196
  return;
@@ -204,13 +212,16 @@ export function Setup({ go } = {}) {
204
212
  }
205
213
  };
206
214
  const onFocus = () => setSyncTurn((n) => n + 1);
215
+ const onGithub = () => setSyncTurn((n) => n + 1);
207
216
  window.addEventListener('message', onMessage);
208
217
  document.addEventListener('visibilitychange', onReturn);
209
218
  window.addEventListener('focus', onFocus);
219
+ window.addEventListener(GITHUB_CHANGED, onGithub);
210
220
  return () => {
211
221
  window.removeEventListener('message', onMessage);
212
222
  document.removeEventListener('visibilitychange', onReturn);
213
223
  window.removeEventListener('focus', onFocus);
224
+ window.removeEventListener(GITHUB_CHANGED, onGithub);
214
225
  };
215
226
  }, [signed, googleAccounts]);
216
227
  const totalDone = (githubDone ? 1 : 0) + (slackDone ? 1 : 0) + (pluginDone ? 1 : 0);
@@ -226,13 +237,17 @@ export function Setup({ go } = {}) {
226
237
  return;
227
238
  }
228
239
  // The return page hands the answer back and closes the popup (lib/oauth);
229
- // a popup closed without one still re-reads what is connected.
240
+ // a popup closed without one still re-reads what is connected. GitHub's is
241
+ // said on the page, so Projects reads it too.
230
242
  awaitAnswer(popup, provider, (answer) => {
231
243
  if (answer?.ok)
232
244
  onDone();
233
245
  else if (answer)
234
246
  setErrorMsg(t('Could not connect {provider} right now. Please try again.', { provider: label }));
235
- setSyncTurn((n) => n + 1);
247
+ if (provider === 'github')
248
+ changed();
249
+ else
250
+ setSyncTurn((n) => n + 1);
236
251
  });
237
252
  };
238
253
  const connectOAuthProvider = async (provider, label, onDone) => {
@@ -323,7 +338,8 @@ export function Setup({ go } = {}) {
323
338
  }
324
339
  setGithubDone(false);
325
340
  setStep(1);
326
- setSyncTurn((n) => n + 1);
341
+ // Projects reads it again, and so does this card.
342
+ changed();
327
343
  }
328
344
  catch {
329
345
  setErrorMsg(t('Could not disconnect {provider} right now. Please try again.', { provider: 'GitHub' }));
package/dist/chord.d.ts CHANGED
@@ -9,6 +9,8 @@ export interface Press {
9
9
  shiftKey: boolean;
10
10
  repeat?: boolean;
11
11
  isComposing?: boolean;
12
+ /** Something on the page already answered the press. */
13
+ defaultPrevented?: boolean;
12
14
  target: EventTarget | null;
13
15
  }
14
16
  /** Whether a key pressed on `target` is typing: a field, a picker, or text that edits itself. */
package/dist/seek.d.ts CHANGED
@@ -35,5 +35,8 @@ export declare function rank<T extends Hit>(rows: T[], query: string, cap?: numb
35
35
  * first, ties in the order given.
36
36
  */
37
37
  export declare function find<T extends Hit>(query: string, recent: T[], idle: Group<T>[], all: Group<T>[]): Group<T>[];
38
- /** Whether a key press opens the palette: ⌘K or Ctrl+K, once a press, from anywhere, a field included. */
38
+ /**
39
+ * Whether a key press opens the palette: ⌘K or Ctrl+K, once a press, from anywhere, a field included,
40
+ * unless something on the page already answered it (Dev's composer opens its own commands and claims it).
41
+ */
39
42
  export declare const summons: (e: Press) => boolean;
package/dist/seek.js CHANGED
@@ -76,5 +76,8 @@ export function find(query, recent, idle, all) {
76
76
  .sort((a, b) => b.best - a.best || a.i - b.i)
77
77
  .map((x) => x.g);
78
78
  }
79
- /** Whether a key press opens the palette: ⌘K or Ctrl+K, once a press, from anywhere, a field included. */
80
- export const summons = (e) => (e.metaKey || e.ctrlKey) && !e.altKey && !e.shiftKey && !e.repeat && !e.isComposing && (e.key ?? '').toLowerCase() === 'k';
79
+ /**
80
+ * Whether a key press opens the palette: ⌘K or Ctrl+K, once a press, from anywhere, a field included,
81
+ * unless something on the page already answered it (Dev's composer opens its own commands and claims it).
82
+ */
83
+ export const summons = (e) => !e.defaultPrevented && (e.metaKey || e.ctrlKey) && !e.altKey && !e.shiftKey && !e.repeat && !e.isComposing && (e.key ?? '').toLowerCase() === 'k';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hanzo/app",
3
- "version": "0.3.10",
3
+ "version": "0.3.12",
4
4
  "description": "Hanzo's app: the shell and its apps (Home, Chat, Inbox, Contacts, Meet, Calendar, Drive, Board, Work, Bots), once, for every Hanzo surface.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",