@hanzo/rooms 0.1.100 → 0.1.101
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/App.js +19 -13
- package/dist/Drawer.d.ts +6 -0
- package/dist/Drawer.js +10 -1
- package/dist/Me.js +1 -1
- package/dist/dev.js +5 -14
- package/package.json +1 -1
package/dist/App.js
CHANGED
|
@@ -73,7 +73,7 @@ import { useRooms } from './host.js';
|
|
|
73
73
|
import { useKept } from './kept.js';
|
|
74
74
|
import { Mark, raised, Rail, Toggle } from './Rail.js';
|
|
75
75
|
import { Foot, Layer, Lift, RAISED, useDrawer } from './Drawer.js';
|
|
76
|
-
import { empty, openThread, useOpen } from './open.js';
|
|
76
|
+
import { empty, openThread, showSettings, useOpen } from './open.js';
|
|
77
77
|
import { Paned } from './Shell.js';
|
|
78
78
|
import { Palette } from './Palette.js';
|
|
79
79
|
import { summons } from './seek.js';
|
|
@@ -103,7 +103,7 @@ export function App({ bar } = {}) {
|
|
|
103
103
|
/** The window itself, drawn once the organization is settled. */
|
|
104
104
|
function Window({ bar }) {
|
|
105
105
|
const drawer = useDrawer();
|
|
106
|
-
const { close: shut, depart } = drawer;
|
|
106
|
+
const { close: shut, depart, exit } = drawer;
|
|
107
107
|
// On a phone the window stands in the visual viewport, so the keyboard never covers the composer (view.ts).
|
|
108
108
|
const view = useView();
|
|
109
109
|
const hold = drawer.window;
|
|
@@ -117,11 +117,12 @@ function Window({ bar }) {
|
|
|
117
117
|
const [finding, setFinding] = useState(false);
|
|
118
118
|
const found = useCallback(() => setFinding(false), []);
|
|
119
119
|
const dev = useDevHost();
|
|
120
|
-
// The builder's moves put the drawer away, in its place in the history
|
|
120
|
+
// The builder's moves put the drawer away, in its place in the history; one to
|
|
121
|
+
// a page outside the app (Settings) leaves it through the router.
|
|
121
122
|
const host = useMemo(() => ({
|
|
122
123
|
...dev,
|
|
123
|
-
go: (to, how) => depart((replace) => dev.go(to, replace ? { ...how, replace } : how)),
|
|
124
|
-
}), [dev, depart]);
|
|
124
|
+
go: (to, how) => (place(app(to)) ? depart : exit)((replace) => dev.go(to, replace ? { ...how, replace } : how)),
|
|
125
|
+
}), [dev, depart, exit]);
|
|
125
126
|
const { client } = useAi();
|
|
126
127
|
const { router, path } = useRooms();
|
|
127
128
|
const here = path ?? '/';
|
|
@@ -145,12 +146,6 @@ function Window({ bar }) {
|
|
|
145
146
|
const run = where !== null && route(where).kind === 'run';
|
|
146
147
|
const asked = at.mode === 'chat' ? at.thread : null;
|
|
147
148
|
const { thread, settings: wanted } = useOpen();
|
|
148
|
-
// A row of the account menu asks for Settings: the drawer goes away as the
|
|
149
|
-
// router leaves for the page (dev.tsx).
|
|
150
|
-
useEffect(() => {
|
|
151
|
-
if (wanted)
|
|
152
|
-
shut();
|
|
153
|
-
}, [wanted, shut]);
|
|
154
149
|
const plans = where !== null && isPlans(where);
|
|
155
150
|
useEffect(() => {
|
|
156
151
|
if (plans)
|
|
@@ -197,8 +192,19 @@ function Window({ bar }) {
|
|
|
197
192
|
if (!inPlace)
|
|
198
193
|
away.current = `${window.location.pathname}${window.location.search}`;
|
|
199
194
|
}, [inPlace, here]);
|
|
200
|
-
/**
|
|
201
|
-
|
|
195
|
+
/**
|
|
196
|
+
* A move: the drawer away, the address in its place. One of the app's moves
|
|
197
|
+
* the app; any other page of the site (Settings) is the router's, and leaves it.
|
|
198
|
+
*/
|
|
199
|
+
const move = useCallback((address) => (place(address.split(/[?#]/)[0]) ? depart : exit)((replace) => visit(router, address, replace)), [depart, exit, router]);
|
|
200
|
+
// A pane asks for Settings — the account menu's rows, Chat's See usage: its
|
|
201
|
+
// page (lib/host `settings`), through the router, the drawer away.
|
|
202
|
+
useEffect(() => {
|
|
203
|
+
if (!wanted)
|
|
204
|
+
return;
|
|
205
|
+
showSettings(null);
|
|
206
|
+
move(settings(wanted));
|
|
207
|
+
}, [wanted, move]);
|
|
202
208
|
// The app's keys.
|
|
203
209
|
useEffect(() => {
|
|
204
210
|
const key = (e) => {
|
package/dist/Drawer.d.ts
CHANGED
|
@@ -9,6 +9,12 @@ export interface Drawer {
|
|
|
9
9
|
close: () => void;
|
|
10
10
|
/** Moves the app from the menu: the move replaces the menu's history entry, and the menu goes. */
|
|
11
11
|
depart: (move: Move) => void;
|
|
12
|
+
/**
|
|
13
|
+
* Leaves the app from the menu for a page the host's router draws: the page
|
|
14
|
+
* takes the menu's history entry, and the menu goes. Nothing is popped, for
|
|
15
|
+
* the router moves the address after this returns.
|
|
16
|
+
*/
|
|
17
|
+
exit: (move: Move) => void;
|
|
12
18
|
/** The address moved under the menu, by a way that was not `depart`: the menu goes, and its entry stays behind the move. */
|
|
13
19
|
drop: () => void;
|
|
14
20
|
/** The window: everything in it but the menu is inert while the menu is out. */
|
package/dist/Drawer.js
CHANGED
|
@@ -31,7 +31,9 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
31
31
|
// back to what opened it as it shuts; Escape closes it, unless a menu or dialog
|
|
32
32
|
// it opened holds the focus; Back closes it, because opening it pushed an entry
|
|
33
33
|
// of the same address that Back pops. A move made from inside it takes that
|
|
34
|
-
// entry's place (`depart`), so the history holds the move and never the menu
|
|
34
|
+
// entry's place (`depart`), so the history holds the move and never the menu;
|
|
35
|
+
// so does a page the host's router draws outside the app (`exit`: Settings),
|
|
36
|
+
// whose address moves only after the press returns.
|
|
35
37
|
// Its list's scroll stays its own (Recents' `overscrollBehavior`), and the pane,
|
|
36
38
|
// never unmounted, keeps its own.
|
|
37
39
|
import { useI18n } from '@hanzo/i18n/react';
|
|
@@ -112,6 +114,12 @@ export function useDrawer() {
|
|
|
112
114
|
window.history.back();
|
|
113
115
|
home();
|
|
114
116
|
}, [home]);
|
|
117
|
+
const exit = useCallback((move) => {
|
|
118
|
+
const replace = marked.current;
|
|
119
|
+
marked.current = false;
|
|
120
|
+
move(replace);
|
|
121
|
+
home();
|
|
122
|
+
}, [home]);
|
|
115
123
|
const drop = useCallback(() => {
|
|
116
124
|
marked.current = false;
|
|
117
125
|
home();
|
|
@@ -287,6 +295,7 @@ export function useDrawer() {
|
|
|
287
295
|
open,
|
|
288
296
|
close,
|
|
289
297
|
depart,
|
|
298
|
+
exit,
|
|
290
299
|
drop,
|
|
291
300
|
window: useCallback((node) => {
|
|
292
301
|
win.current = element(node);
|
package/dist/Me.js
CHANGED
|
@@ -10,7 +10,7 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
|
|
|
10
10
|
// Help ›, the site's own pages and the keyboard shortcuts (⌘/ / Ctrl+/ from
|
|
11
11
|
// anywhere); and Log out. Every row opens a real destination: Settings'
|
|
12
12
|
// pages through `showSettings` (open.ts), which the app answers with the
|
|
13
|
-
// site's Settings at /settings (
|
|
13
|
+
// site's Settings at /settings (App.tsx) and the shell with its own pane; the plans on the
|
|
14
14
|
// pay site (`leave`); the site's pages through `site()`, so hanzo.team names
|
|
15
15
|
// hanzo.ai (help.ts).
|
|
16
16
|
//
|
package/dist/dev.js
CHANGED
|
@@ -17,10 +17,10 @@
|
|
|
17
17
|
//
|
|
18
18
|
// SETTINGS IS THE SITE'S, never Dev's: one tree at /settings, the host's own
|
|
19
19
|
// pages (lib/host.ts `settings`). A builder section the builder moves to
|
|
20
|
-
// (`go`)
|
|
21
|
-
// (`showSettings`, open.ts
|
|
22
|
-
//
|
|
23
|
-
//
|
|
20
|
+
// (`go`) and a link it opens (`open`) reach that page through the host's router
|
|
21
|
+
// (`visit`); a pane that asks for Settings (`showSettings`, open.ts) is App's to
|
|
22
|
+
// answer, where the phone's menu is. The rooms' shell draws its own Settings
|
|
23
|
+
// pane; the app has none.
|
|
24
24
|
//
|
|
25
25
|
// THE PLANS ARE THE PAY SITE'S. Every way the app reaches the plans — the
|
|
26
26
|
// account menu's View all plans and its plan's Upgrade, Billing's Adjust plan,
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
// coming back once paid. A typed or reloaded plans address leaves the same way
|
|
30
30
|
// (App.tsx). A page load, at once, not a move inside the app: the pay site is
|
|
31
31
|
// where a plan is bought.
|
|
32
|
-
import {
|
|
32
|
+
import { useMemo } from 'react';
|
|
33
33
|
import { useLook, useRooms } from './host.js';
|
|
34
34
|
import { useIam } from '@hanzo/iam/react';
|
|
35
35
|
import { useSignOut } from './lib/signout.js';
|
|
@@ -41,7 +41,6 @@ import { CAST } from './agents.js';
|
|
|
41
41
|
import { app, place, settings, visit } from './lib/host.js';
|
|
42
42
|
import { link } from './lib/tags.js';
|
|
43
43
|
import { payUrl } from './lib/pay.js';
|
|
44
|
-
import { showSettings, useOpen } from './open.js';
|
|
45
44
|
/** Where the builder links out: every one of them an address of this site. */
|
|
46
45
|
const LINKS = {
|
|
47
46
|
github: app('-/sync'),
|
|
@@ -81,14 +80,6 @@ export function useDevHost() {
|
|
|
81
80
|
const { router, path: pathname } = useRooms();
|
|
82
81
|
const here = path(route(at(pathname)));
|
|
83
82
|
const look = useLook();
|
|
84
|
-
const { settings: asked } = useOpen();
|
|
85
|
-
// A pane asked for Settings: its page, through the router.
|
|
86
|
-
useEffect(() => {
|
|
87
|
-
if (!asked)
|
|
88
|
-
return;
|
|
89
|
-
showSettings(null);
|
|
90
|
-
router.push(settings(asked));
|
|
91
|
-
}, [asked, router]);
|
|
92
83
|
// The token's claims change only when the token does: a sign-in, a refresh.
|
|
93
84
|
const memberships = useMemo(() => orgs(), [accessToken]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
94
85
|
const scoped = useMemo(() => org(), [accessToken]); // eslint-disable-line react-hooks/exhaustive-deps
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hanzo/rooms",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.101",
|
|
4
4
|
"description": "The workspace rooms — Home, Chat, Inbox, Contacts, Meet, Cal, Drive, Board, Work, Bots — and the frame that holds them, once, for every Hanzo surface.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|