cursedbelt 6.30.1 → 6.31.0
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/react/back/backName.d.ts +16 -0
- package/dist/react/back/backName.d.ts.map +1 -0
- package/dist/react/back/backName.js +19 -0
- package/dist/react/back/backName.js.map +1 -0
- package/dist/react/back/index.d.ts +1 -0
- package/dist/react/back/index.d.ts.map +1 -1
- package/dist/react/back/index.js +1 -0
- package/dist/react/back/index.js.map +1 -1
- package/dist/react/lib/apiClient.d.ts +24 -0
- package/dist/react/lib/apiClient.d.ts.map +1 -0
- package/dist/react/lib/apiClient.js +46 -0
- package/dist/react/lib/apiClient.js.map +1 -0
- package/dist/react/shell-doors/index.d.ts +8 -0
- package/dist/react/shell-doors/index.d.ts.map +1 -0
- package/dist/react/shell-doors/index.js +8 -0
- package/dist/react/shell-doors/index.js.map +1 -0
- package/dist/react/shell-doors/shellDoors.d.ts +79 -0
- package/dist/react/shell-doors/shellDoors.d.ts.map +1 -0
- package/dist/react/shell-doors/shellDoors.js +95 -0
- package/dist/react/shell-doors/shellDoors.js.map +1 -0
- package/dist/styles-areas/workspace-shell.css +25 -10
- package/dist/styles-utilities.css +44 -0
- package/package.json +15 -2
- package/scripts/styleAreas.ts +1 -1
- package/src/react/back/backName.spec.ts +27 -0
- package/src/react/back/backName.ts +24 -0
- package/src/react/back/index.ts +1 -0
- package/src/react/lib/apiClient.spec.ts +36 -0
- package/src/react/lib/apiClient.ts +57 -0
- package/src/react/shell-doors/index.ts +7 -0
- package/src/react/shell-doors/shellDoors.spec.tsx +93 -0
- package/src/react/shell-doors/shellDoors.tsx +150 -0
- package/src/styles-areas/workspace-shell.css +25 -10
- package/src/styles-utilities.css +44 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a place is called in Back's "Back to …" — the `back.name` an app hands `WorkspaceShell` (forge task 5560; games,
|
|
3
|
+
* home and trivia each held this body). A record opened below a place is "Lists · one list", every other place its label.
|
|
4
|
+
*/
|
|
5
|
+
/** The places table's lookup: a place by id, the first place when the id is unknown. */
|
|
6
|
+
export declare function placeLookup<P extends {
|
|
7
|
+
id: string;
|
|
8
|
+
}>(places: readonly P[]): (id: P['id']) => P;
|
|
9
|
+
/** `parse` is the app's `links.parse`; `placeOf` its place lookup. */
|
|
10
|
+
export declare function makeBackName<V extends string>(parse: (href: string) => {
|
|
11
|
+
view: V;
|
|
12
|
+
path: readonly string[];
|
|
13
|
+
}, placeOf: (id: V) => {
|
|
14
|
+
label: string;
|
|
15
|
+
}): (href: string) => string;
|
|
16
|
+
//# sourceMappingURL=backName.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"backName.d.ts","sourceRoot":"","sources":["../../../src/react/back/backName.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,wFAAwF;AACxF,wBAAgB,WAAW,CAAC,CAAC,SAAS;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAE9F;AAKD,sEAAsE;AACtE,wBAAgB,YAAY,CAAC,CAAC,SAAS,MAAM,EAC3C,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK;IAAE,IAAI,EAAE,CAAC,CAAC;IAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,EAC7D,OAAO,EAAE,CAAC,EAAE,EAAE,CAAC,KAAK;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,GACpC,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAM1B"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a place is called in Back's "Back to …" — the `back.name` an app hands `WorkspaceShell` (forge task 5560; games,
|
|
3
|
+
* home and trivia each held this body). A record opened below a place is "Lists · one list", every other place its label.
|
|
4
|
+
*/
|
|
5
|
+
/** The places table's lookup: a place by id, the first place when the id is unknown. */
|
|
6
|
+
export function placeLookup(places) {
|
|
7
|
+
return (id) => places.find((place) => place.id === id) ?? places[0];
|
|
8
|
+
}
|
|
9
|
+
/** `Lists` → `list`, `Libraries` → `library`: the singular a "one …" says. */
|
|
10
|
+
const singular = (label) => label.toLowerCase().replace(/ies$/, 'y').replace(/s$/, '');
|
|
11
|
+
/** `parse` is the app's `links.parse`; `placeOf` its place lookup. */
|
|
12
|
+
export function makeBackName(parse, placeOf) {
|
|
13
|
+
return (href) => {
|
|
14
|
+
const at = parse(href);
|
|
15
|
+
const place = placeOf(at.view);
|
|
16
|
+
return at.path.length ? `${place.label} · one ${singular(place.label)}` : place.label;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=backName.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"backName.js","sourceRoot":"","sources":["../../../src/react/back/backName.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,wFAAwF;AACxF,MAAM,UAAU,WAAW,CAA2B,MAAoB;IACxE,OAAO,CAAC,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,CAAC,IAAK,MAAM,CAAC,CAAC,CAAO,CAAC;AAC7E,CAAC;AAED,8EAA8E;AAC9E,MAAM,QAAQ,GAAG,CAAC,KAAa,EAAU,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;AAEvG,sEAAsE;AACtE,MAAM,UAAU,YAAY,CAC1B,KAA6D,EAC7D,OAAqC;IAErC,OAAO,CAAC,IAAI,EAAE,EAAE;QACd,MAAM,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;QACvB,MAAM,KAAK,GAAG,OAAO,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;QAC/B,OAAO,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,KAAK,UAAU,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC;IACxF,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -2,4 +2,5 @@ export { type BackRow, type BackStep, backRows } from './backTrail.js';
|
|
|
2
2
|
export { backReach, goBack, startBack, type StartBackOptions, useBackSteps } from './back.js';
|
|
3
3
|
export { type BackControl, NOWHERE_BACK, stepBack, useBack } from './useBack.js';
|
|
4
4
|
export { BackButton, type BackButtonProps } from './BackButton.js';
|
|
5
|
+
export { makeBackName, placeLookup } from './backName.js';
|
|
5
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/react/back/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,QAAQ,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,gBAAgB,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC9F,OAAO,EAAE,KAAK,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACjF,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/react/back/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,QAAQ,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,gBAAgB,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC9F,OAAO,EAAE,KAAK,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACjF,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC"}
|
package/dist/react/back/index.js
CHANGED
|
@@ -4,4 +4,5 @@ export { backRows } from './backTrail.js';
|
|
|
4
4
|
export { backReach, goBack, startBack, useBackSteps } from './back.js';
|
|
5
5
|
export { NOWHERE_BACK, stepBack, useBack } from './useBack.js';
|
|
6
6
|
export { BackButton } from './BackButton.js';
|
|
7
|
+
export { makeBackName, placeLookup } from './backName.js';
|
|
7
8
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/react/back/index.ts"],"names":[],"mappings":"AAAA,8HAA8H;AAC9H,mEAAmE;AACnE,OAAO,EAA+B,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAyB,YAAY,EAAE,MAAM,WAAW,CAAC;AAC9F,OAAO,EAAoB,YAAY,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACjF,OAAO,EAAE,UAAU,EAAwB,MAAM,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/react/back/index.ts"],"names":[],"mappings":"AAAA,8HAA8H;AAC9H,mEAAmE;AACnE,OAAO,EAA+B,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAyB,YAAY,EAAE,MAAM,WAAW,CAAC;AAC9F,OAAO,EAAoB,YAAY,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACjF,OAAO,EAAE,UAAU,EAAwB,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An app's one road to its own `/api`: a typed JSON `request` that sends the session cookie, reads a refusal's own words
|
|
3
|
+
* and throws an `ApiError` carrying the status (forge task 5560 — games, home and trivia each held this body).
|
|
4
|
+
*
|
|
5
|
+
* 🔴 A non-JSON body is an error page in a costume (a 502 from a proxy, an Access redirect): the status says what
|
|
6
|
+
* happened, so the reason falls back to "The server answered 502." rather than to the page's HTML or a parse error.
|
|
7
|
+
*/
|
|
8
|
+
/** A request the server refused or could not answer: `status` is the HTTP status; the message is the server's `error` words. */
|
|
9
|
+
export declare class ApiError extends Error {
|
|
10
|
+
readonly status: number;
|
|
11
|
+
constructor(status: number, message: string);
|
|
12
|
+
}
|
|
13
|
+
export type ApiRequest = <T>(method: string, path: string, body?: unknown) => Promise<T>;
|
|
14
|
+
export interface ApiRequestOptions {
|
|
15
|
+
/** Headers sent on every call (trivia's reader zone). A function is asked afresh for each call. */
|
|
16
|
+
headers?: Record<string, string> | (() => Record<string, string>);
|
|
17
|
+
/** The `fetch` to call; the global one by default. */
|
|
18
|
+
fetch?: typeof fetch;
|
|
19
|
+
}
|
|
20
|
+
/** A `request` with its own always-on headers. A 204 answers `undefined`; JSON is sent for any body that is not `undefined`. */
|
|
21
|
+
export declare function createRequest(options?: ApiRequestOptions): ApiRequest;
|
|
22
|
+
/** The plain `request`: no extra headers. */
|
|
23
|
+
export declare const request: ApiRequest;
|
|
24
|
+
//# sourceMappingURL=apiClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apiClient.d.ts","sourceRoot":"","sources":["../../../src/react/lib/apiClient.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,gIAAgI;AAChI,qBAAa,QAAS,SAAQ,KAAK;IAE/B,QAAQ,CAAC,MAAM,EAAE,MAAM;gBAAd,MAAM,EAAE,MAAM,EACvB,OAAO,EAAE,MAAM;CAIlB;AAED,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;AAEzF,MAAM,WAAW,iBAAiB;IAChC,mGAAmG;IACnG,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,MAAM,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAClE,sDAAsD;IACtD,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;CACtB;AAED,gIAAgI;AAChI,wBAAgB,aAAa,CAAC,OAAO,GAAE,iBAAsB,GAAG,UAAU,CAyBzE;AAED,6CAA6C;AAC7C,eAAO,MAAM,OAAO,EAAE,UAA4B,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An app's one road to its own `/api`: a typed JSON `request` that sends the session cookie, reads a refusal's own words
|
|
3
|
+
* and throws an `ApiError` carrying the status (forge task 5560 — games, home and trivia each held this body).
|
|
4
|
+
*
|
|
5
|
+
* 🔴 A non-JSON body is an error page in a costume (a 502 from a proxy, an Access redirect): the status says what
|
|
6
|
+
* happened, so the reason falls back to "The server answered 502." rather than to the page's HTML or a parse error.
|
|
7
|
+
*/
|
|
8
|
+
/** A request the server refused or could not answer: `status` is the HTTP status; the message is the server's `error` words. */
|
|
9
|
+
export class ApiError extends Error {
|
|
10
|
+
status;
|
|
11
|
+
constructor(status, message) {
|
|
12
|
+
super(message);
|
|
13
|
+
this.status = status;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
/** A `request` with its own always-on headers. A 204 answers `undefined`; JSON is sent for any body that is not `undefined`. */
|
|
17
|
+
export function createRequest(options = {}) {
|
|
18
|
+
return async function request(method, path, body) {
|
|
19
|
+
const doFetch = options.fetch ?? fetch;
|
|
20
|
+
const always = typeof options.headers === 'function' ? options.headers() : (options.headers ?? {});
|
|
21
|
+
const response = await doFetch(path, {
|
|
22
|
+
method,
|
|
23
|
+
credentials: 'same-origin',
|
|
24
|
+
headers: { ...always, ...(body === undefined ? {} : { 'content-type': 'application/json' }) },
|
|
25
|
+
...(body === undefined ? {} : { body: JSON.stringify(body) }),
|
|
26
|
+
});
|
|
27
|
+
if (response.status === 204)
|
|
28
|
+
return undefined;
|
|
29
|
+
const text = await response.text();
|
|
30
|
+
let parsed = null;
|
|
31
|
+
try {
|
|
32
|
+
parsed = text ? JSON.parse(text) : null;
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
// A non-JSON body is an error page in a costume; the status says what happened.
|
|
36
|
+
}
|
|
37
|
+
if (!response.ok) {
|
|
38
|
+
const reason = parsed && typeof parsed === 'object' && 'error' in parsed ? String(parsed.error) : `The server answered ${response.status}.`;
|
|
39
|
+
throw new ApiError(response.status, reason);
|
|
40
|
+
}
|
|
41
|
+
return parsed;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/** The plain `request`: no extra headers. */
|
|
45
|
+
export const request = createRequest();
|
|
46
|
+
//# sourceMappingURL=apiClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apiClient.js","sourceRoot":"","sources":["../../../src/react/lib/apiClient.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,gIAAgI;AAChI,MAAM,OAAO,QAAS,SAAQ,KAAK;IAEtB;IADX,YACW,MAAc,EACvB,OAAe;QAEf,KAAK,CAAC,OAAO,CAAC,CAAC;QAHN,WAAM,GAAN,MAAM,CAAQ;IAIzB,CAAC;CACF;AAWD,gIAAgI;AAChI,MAAM,UAAU,aAAa,CAAC,UAA6B,EAAE;IAC3D,OAAO,KAAK,UAAU,OAAO,CAAI,MAAc,EAAE,IAA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,MAAM,GAAG,CAAC;YACvJ,MAAM,IAAI,QAAQ,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAC9C,CAAC;QACD,OAAO,MAAW,CAAC;IACrB,CAAC,CAAC;AACJ,CAAC;AAED,6CAA6C;AAC7C,MAAM,CAAC,MAAM,OAAO,GAAe,aAAa,EAAE,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `cursedbelt/react/shell-doors` — the wiring a deep-linked app repeats around `WorkspaceShell` (forge task 5560).
|
|
3
|
+
* A subpath of its own, never re-exported by `./react/workspace-shell`: an app that lazy-loads a shell part through
|
|
4
|
+
* that barrel keeps every module the barrel names in the chunk, and this hook (with the deep-link router it reads)
|
|
5
|
+
* would ride into the shell chunk of an app that never calls it — arch's grew 5.40 → 6.87 kB gzip.
|
|
6
|
+
*/
|
|
7
|
+
export { COMPACT_TOASTER, railPlaces, type ShellDoors, type ShellSession, useShellDoors } from './shellDoors.js';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/react/shell-doors/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,KAAK,UAAU,EAAE,KAAK,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `cursedbelt/react/shell-doors` — the wiring a deep-linked app repeats around `WorkspaceShell` (forge task 5560).
|
|
3
|
+
* A subpath of its own, never re-exported by `./react/workspace-shell`: an app that lazy-loads a shell part through
|
|
4
|
+
* that barrel keeps every module the barrel names in the chunk, and this hook (with the deep-link router it reads)
|
|
5
|
+
* would ride into the shell chunk of an app that never calls it — arch's grew 5.40 → 6.87 kB gzip.
|
|
6
|
+
*/
|
|
7
|
+
export { COMPACT_TOASTER, railPlaces, useShellDoors } from './shellDoors.js';
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/react/shell-doors/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,eAAe,EAAE,UAAU,EAAsC,aAAa,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The wiring every deep-linked app shell repeats around `WorkspaceShell` (forge task 5560): the three badge doors
|
|
3
|
+
* (Notifications, Settings, Help) as paths, the banner lane, the connection dot, the account the badge shows, the
|
|
4
|
+
* suite's other apps, the ⌘K palette's open state, and the notifications page the Notifications door draws. games,
|
|
5
|
+
* home and trivia each wrote it out (~45 lines apiece); an app now passes what differs — its session, and the view
|
|
6
|
+
* it is on — and keeps the parts that are its own (its pages, its palette's contents, its title).
|
|
7
|
+
*
|
|
8
|
+
* Call it inside a `DeepLinkProvider`: the paths come from that provider's `links`.
|
|
9
|
+
*/
|
|
10
|
+
import { type ReactNode } from 'react';
|
|
11
|
+
import { type DeepLinkLocation } from '../deep-link/index.js';
|
|
12
|
+
import type { ToasterProps } from '../Toast.js';
|
|
13
|
+
import { useIssueBanners } from '../notifications/index.js';
|
|
14
|
+
import type { ShellApp, ShellBadge, ShellConnection, ShellPlace } from '../workspace-shell/WorkspaceShell.js';
|
|
15
|
+
/** The part of an SSO session the doors read (`cursedauth/session-probe`'s `Session` satisfies it). */
|
|
16
|
+
export interface ShellSession {
|
|
17
|
+
user?: {
|
|
18
|
+
name?: string;
|
|
19
|
+
email?: string;
|
|
20
|
+
};
|
|
21
|
+
accountsUrl?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface ShellDoors<V extends string> {
|
|
24
|
+
/** The view the URL names. */
|
|
25
|
+
view: V;
|
|
26
|
+
location: DeepLinkLocation<V>;
|
|
27
|
+
/** Go to a path of this app (`/settings?at=keys`), as the deep links parse it. */
|
|
28
|
+
go: (path: string) => void;
|
|
29
|
+
goToRoot: (view: V) => void;
|
|
30
|
+
openNotifications: () => void;
|
|
31
|
+
/** Settings, opened at a section when one is named. */
|
|
32
|
+
openSettings: (at?: string) => void;
|
|
33
|
+
openHelp: () => void;
|
|
34
|
+
/** The banner lane's rows — none on the notifications page, which shows the issues in full. */
|
|
35
|
+
banners: ReturnType<typeof useIssueBanners>;
|
|
36
|
+
apps: readonly ShellApp[];
|
|
37
|
+
connection: ShellConnection;
|
|
38
|
+
/** The first trouble's title, for the connection dot's tooltip; absent while live. */
|
|
39
|
+
connectionLabel?: string;
|
|
40
|
+
/** What the settings page and the badge show of the signed-in person. */
|
|
41
|
+
account: {
|
|
42
|
+
name: string;
|
|
43
|
+
email: string;
|
|
44
|
+
accountsUrl: string;
|
|
45
|
+
};
|
|
46
|
+
/** The badge's props, from a name and a mark. */
|
|
47
|
+
badge: (name: string, mark: ReactNode) => ShellBadge;
|
|
48
|
+
palette: {
|
|
49
|
+
open: boolean;
|
|
50
|
+
mounted: boolean;
|
|
51
|
+
};
|
|
52
|
+
openPalette: () => void;
|
|
53
|
+
setPaletteOpen: (open: boolean) => void;
|
|
54
|
+
/** The notifications page, for the Notifications door — `/notifications?show=…` is where its filter lives. */
|
|
55
|
+
notificationsPlace: ReactNode;
|
|
56
|
+
}
|
|
57
|
+
export declare function useShellDoors<V extends string>(session: ShellSession): ShellDoors<V>;
|
|
58
|
+
/**
|
|
59
|
+
* The toaster's own stack, made compact (photos' forge task 5340): each toast as wide as its words and centered, the
|
|
60
|
+
* close × inline at the end. `!` because sonner's own `[data-sonner-toast]` rules land after the app's utilities.
|
|
61
|
+
*/
|
|
62
|
+
export declare const COMPACT_TOASTS: string;
|
|
63
|
+
/**
|
|
64
|
+
* `<LazyToaster {...COMPACT_TOASTER} />`: a small pill at the foot, centered, as wide as its words; above a phone's
|
|
65
|
+
* bottom bar.
|
|
66
|
+
*/
|
|
67
|
+
export declare const COMPACT_TOASTER: ToasterProps;
|
|
68
|
+
/**
|
|
69
|
+
* A place's rail row for each place that has a `section`, in the order given. `family` maps a section to the rail's
|
|
70
|
+
* family key; `include` leaves a place off (an owner-only place for anyone else).
|
|
71
|
+
*/
|
|
72
|
+
export declare function railPlaces<P extends {
|
|
73
|
+
id: string;
|
|
74
|
+
label: string;
|
|
75
|
+
icon: ReactNode;
|
|
76
|
+
section?: string;
|
|
77
|
+
pinned?: true;
|
|
78
|
+
}>(places: readonly P[], rootHref: (id: P['id']) => string, family: Readonly<Record<string, string>>, include?: (place: P) => boolean): ShellPlace[];
|
|
79
|
+
//# sourceMappingURL=shellDoors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shellDoors.d.ts","sourceRoot":"","sources":["../../../src/react/shell-doors/shellDoors.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAsB,KAAK,SAAS,EAAkC,MAAM,OAAO,CAAC;AAC3F,OAAO,EAAE,KAAK,gBAAgB,EAAe,MAAM,uBAAuB,CAAC;AAE3E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,EAAwB,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAElF,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AAO9G,uGAAuG;AACvG,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACzC,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,UAAU,CAAC,CAAC,SAAS,MAAM;IAC1C,8BAA8B;IAC9B,IAAI,EAAE,CAAC,CAAC;IACR,QAAQ,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAAC;IAC9B,kFAAkF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E,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,SAAS,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,IAAI,CAAA;CAAE,EAClH,MAAM,EAAE,SAAS,CAAC,EAAE,EACpB,QAAQ,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,MAAM,EACjC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EACxC,OAAO,GAAE,CAAC,KAAK,EAAE,CAAC,KAAK,OAAoB,GAC1C,UAAU,EAAE,CAWd"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* The wiring every deep-linked app shell repeats around `WorkspaceShell` (forge task 5560): the three badge doors
|
|
4
|
+
* (Notifications, Settings, Help) as paths, the banner lane, the connection dot, the account the badge shows, the
|
|
5
|
+
* suite's other apps, the ⌘K palette's open state, and the notifications page the Notifications door draws. games,
|
|
6
|
+
* home and trivia each wrote it out (~45 lines apiece); an app now passes what differs — its session, and the view
|
|
7
|
+
* it is on — and keeps the parts that are its own (its pages, its palette's contents, its title).
|
|
8
|
+
*
|
|
9
|
+
* Call it inside a `DeepLinkProvider`: the paths come from that provider's `links`.
|
|
10
|
+
*/
|
|
11
|
+
import { useCallback, useMemo, useState } from 'react';
|
|
12
|
+
import { useDeepLink } from '../deep-link/index.js';
|
|
13
|
+
import { lazyWithReload } from '../lazy/index.js';
|
|
14
|
+
import { issueNotifications } from '../workspace-shell/notificationSource.js';
|
|
15
|
+
import { useConnectionTrouble, useIssueBanners } from '../notifications/index.js';
|
|
16
|
+
import { useSuiteApps } from '../workspace-shell/suiteApps.js';
|
|
17
|
+
// Through the barrel, as every app's own lazy handle was: importing './NotificationsPlace.js' directly split it into a
|
|
18
|
+
// chunk of its own and pulled the shell's parts into SettingsView's (games' SettingsView chunk 4.3 -> 12.1 kB gzip).
|
|
19
|
+
const LazyNotificationsPlace = lazyWithReload(() => import('../workspace-shell/index.js').then((m) => ({ default: m.NotificationsPlace })));
|
|
20
|
+
export function useShellDoors(session) {
|
|
21
|
+
const { location, navigateTo, goToRoot, links } = useDeepLink();
|
|
22
|
+
const view = location.view;
|
|
23
|
+
const go = useCallback((path) => navigateTo(links.parse(path)), [navigateTo, links]);
|
|
24
|
+
const openNotifications = useCallback(() => go(links.root('notifications')), [go, links]);
|
|
25
|
+
const openSettings = useCallback((at) => go(at ? `/settings?at=${encodeURIComponent(at)}` : '/settings'), [go]);
|
|
26
|
+
const openHelp = useCallback(() => go(links.root('help')), [go, links]);
|
|
27
|
+
const issueBanners = useIssueBanners({ onView: openNotifications });
|
|
28
|
+
const banners = view === 'notifications' ? [] : issueBanners;
|
|
29
|
+
const [palette, setPalette] = useState({ open: false, mounted: false });
|
|
30
|
+
const apps = useSuiteApps(session.accountsUrl);
|
|
31
|
+
const trouble = useConnectionTrouble();
|
|
32
|
+
const connection = trouble.length === 0 ? 'live' : trouble.some((issue) => issue.area === 'offline') ? 'offline' : 'connecting';
|
|
33
|
+
const email = session.user?.email ?? '';
|
|
34
|
+
const name = session.user?.name || email;
|
|
35
|
+
const accountsUrl = session.accountsUrl ?? '';
|
|
36
|
+
const account = useMemo(() => ({ name, email, accountsUrl }), [name, email, accountsUrl]);
|
|
37
|
+
const show = (location.params.show ?? 'unread');
|
|
38
|
+
const notificationsPlace = (_jsx(LazyNotificationsPlace, { show: show, source: issueNotifications(), onShow: (next) => navigateTo(links.parse(next === 'unread' ? '/notifications' : `/notifications?show=${next}`), { replace: true }) }));
|
|
39
|
+
return {
|
|
40
|
+
view,
|
|
41
|
+
location,
|
|
42
|
+
go,
|
|
43
|
+
goToRoot: (next) => goToRoot(next),
|
|
44
|
+
openNotifications,
|
|
45
|
+
openSettings,
|
|
46
|
+
openHelp,
|
|
47
|
+
banners,
|
|
48
|
+
apps,
|
|
49
|
+
connection,
|
|
50
|
+
...(trouble[0] ? { connectionLabel: trouble[0].title } : {}),
|
|
51
|
+
account,
|
|
52
|
+
badge: (badgeName, mark) => ({ name: badgeName, mark, ...(email ? { detail: email } : {}) }),
|
|
53
|
+
palette,
|
|
54
|
+
openPalette: () => setPalette({ open: true, mounted: true }),
|
|
55
|
+
setPaletteOpen: (open) => setPalette((p) => ({ ...p, open })),
|
|
56
|
+
notificationsPlace,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* The toaster's own stack, made compact (photos' forge task 5340): each toast as wide as its words and centered, the
|
|
61
|
+
* close × inline at the end. `!` because sonner's own `[data-sonner-toast]` rules land after the app's utilities.
|
|
62
|
+
*/
|
|
63
|
+
export const COMPACT_TOASTS = [
|
|
64
|
+
'[&_[data-sonner-toast]]:w-fit! [&_[data-sonner-toast]]:max-w-full! [&_[data-sonner-toast]]:inset-x-0! [&_[data-sonner-toast]]:mx-auto!',
|
|
65
|
+
'[&_[data-sonner-toast]]:gap-2! [&_[data-sonner-toast]]:py-1.5! [&_[data-sonner-toast]]:ps-3! [&_[data-sonner-toast]]:pe-1!',
|
|
66
|
+
'[&_[data-close-button]]:static! [&_[data-close-button]]:order-last! [&_[data-close-button]]:size-7! [&_[data-close-button]]:transform-none! [&_[data-close-button]]:border-0! [&_[data-close-button]]:bg-transparent!',
|
|
67
|
+
].join(' ');
|
|
68
|
+
/**
|
|
69
|
+
* `<LazyToaster {...COMPACT_TOASTER} />`: a small pill at the foot, centered, as wide as its words; above a phone's
|
|
70
|
+
* bottom bar.
|
|
71
|
+
*/
|
|
72
|
+
export const COMPACT_TOASTER = {
|
|
73
|
+
position: 'bottom-center',
|
|
74
|
+
offset: { bottom: '20px' },
|
|
75
|
+
mobileOffset: { bottom: 'calc(var(--cb-bottom-chrome-h, 0px) + 12px)', left: '12px', right: '12px' },
|
|
76
|
+
style: { '--width': '24rem' },
|
|
77
|
+
className: COMPACT_TOASTS,
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* A place's rail row for each place that has a `section`, in the order given. `family` maps a section to the rail's
|
|
81
|
+
* family key; `include` leaves a place off (an owner-only place for anyone else).
|
|
82
|
+
*/
|
|
83
|
+
export function railPlaces(places, rootHref, family, include = () => true) {
|
|
84
|
+
return places
|
|
85
|
+
.filter((place) => place.section && include(place))
|
|
86
|
+
.map((place) => ({
|
|
87
|
+
id: place.id,
|
|
88
|
+
label: place.label,
|
|
89
|
+
icon: place.icon,
|
|
90
|
+
href: rootHref(place.id),
|
|
91
|
+
family: family[place.section],
|
|
92
|
+
...(place.pinned ? { onBar: true } : {}),
|
|
93
|
+
}));
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=shellDoors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shellDoors.js","sourceRoot":"","sources":["../../../src/react/shell-doors/shellDoors.tsx"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;AACH,OAAO,EAAsC,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC3F,OAAO,EAAyB,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,EAAE,kBAAkB,EAAE,MAAM,0CAA0C,CAAC;AAC9E,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAClF,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAI/D,uHAAuH;AACvH,qHAAqH;AACrH,MAAM,sBAAsB,GAAG,cAAc,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,6BAA6B,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,kBAAkB,EAAE,CAAC,CAAC,CAAC,CAAC;AAoC5I,MAAM,UAAU,aAAa,CAAmB,OAAq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EACjC,MAAwC,EACxC,UAAiC,GAAG,EAAE,CAAC,IAAI;IAE3C,OAAO,MAAM;SACV,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC;SAClD,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QACf,EAAE,EAAE,KAAK,CAAC,EAAE;QACZ,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,IAAI,EAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QACxB,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,OAAiB,CAAW;QACjD,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACzC,CAAC,CAAC,CAAC;AACR,CAAC"}
|
|
@@ -18,23 +18,38 @@
|
|
|
18
18
|
* after an app's responsive variant (task 2124). An app that imports every area gets exactly
|
|
19
19
|
* what `cursedbelt/styles-utilities.css` emits — proved rule by rule in
|
|
20
20
|
* src/stylesAreas.spec.ts, which is also what fails when this file is stale.
|
|
21
|
-
*
|
|
21
|
+
* 117 candidate(s).
|
|
22
22
|
*
|
|
23
23
|
* Written by scripts/generateAreaStyles.ts (`bun run styles:areas`), which
|
|
24
24
|
* `bun run build` runs. The map of what is in which area, and why the areas are
|
|
25
25
|
* import closures rather than a hand-written list, is scripts/styleAreas.ts.
|
|
26
26
|
*/
|
|
27
|
-
@source inline("-my-1.5 @max-meta:hidden [&::-webkit-scrollbar]:hidden [&>svg]:opacity-45
|
|
28
|
-
@source inline("[
|
|
29
|
-
@source inline("
|
|
30
|
-
@source inline("
|
|
27
|
+
@source inline("-my-1.5 -right-0.5 -top-0.5 @max-meta:hidden [&::-webkit-scrollbar]:hidden [&>svg]:opacity-45");
|
|
28
|
+
@source inline("[&>svg]:size-5 [&_[data-cb-banner-icon]]:text-accent [&_[data-cb-banner-icon]]:text-destructive");
|
|
29
|
+
@source inline("[&_[data-cb-banner-icon]]:text-warning [&_[data-close-button]]:bg-transparent!");
|
|
30
|
+
@source inline("[&_[data-close-button]]:border-0! [&_[data-close-button]]:order-last!");
|
|
31
|
+
@source inline("[&_[data-close-button]]:size-7! [&_[data-close-button]]:static!");
|
|
32
|
+
@source inline("[&_[data-close-button]]:transform-none! [&_[data-sonner-toast]]:gap-2!");
|
|
33
|
+
@source inline("[&_[data-sonner-toast]]:inset-x-0! [&_[data-sonner-toast]]:max-w-full!");
|
|
34
|
+
@source inline("[&_[data-sonner-toast]]:mx-auto! [&_[data-sonner-toast]]:pe-1! [&_[data-sonner-toast]]:ps-3!");
|
|
35
|
+
@source inline("[&_[data-sonner-toast]]:py-1.5! [&_[data-sonner-toast]]:w-fit! [&_svg]:size-4.5");
|
|
36
|
+
@source inline("[&_svg]:text-accent [&_svg]:text-muted-foreground [scrollbar-width:none] bg-accent/15");
|
|
37
|
+
@source inline("bg-destructive/10 bg-foreground bg-muted/50 bg-warning/10 border-solid");
|
|
38
|
+
@source inline("bottom-[calc(env(safe-area-inset-bottom)+0.5rem)] flex-auto focus-visible:[&>svg]:opacity-100");
|
|
39
|
+
@source inline("group-focus-within:opacity-100 group-focus-within:pointer-events-auto");
|
|
40
|
+
@source inline("group-hover:pointer-events-auto h-14 h-[calc(3.5rem+env(safe-area-inset-bottom))]");
|
|
31
41
|
@source inline("hover:[&>svg]:opacity-100 hover:bg-accent-solid/90 hover:bg-muted/60 items-stretch left-2.5");
|
|
32
42
|
@source inline("left-[calc(env(safe-area-inset-left)+0.5rem)] list-none max-md:border-t-0 max-md:pt-0");
|
|
33
43
|
@source inline("md:[&:has(>[data-cb-place-actions]_[role=tablist])>[data-cb-place-name]]:min-w-24 md:bg-muted");
|
|
34
44
|
@source inline("md:block md:border-r md:flex md:h-12 md:has-[[role=tablist]]:min-w-0");
|
|
35
45
|
@source inline("md:has-[[role=tablist]]:shrink md:hidden md:px-6 md:px-8 md:py-6 md:shrink-0 md:text-foreground");
|
|
36
|
-
@source inline("md:w-64 min-h-2 mt-3 no-underline pb-12 pb-[env(safe-area-inset-bottom)]");
|
|
37
|
-
@source inline("pointer-coarse:
|
|
38
|
-
@source inline("pointer-coarse:pointer-
|
|
39
|
-
@source inline("pointer-coarse:
|
|
40
|
-
@source inline("
|
|
46
|
+
@source inline("md:w-64 min-h-10 min-h-2 ml-1.5 ml-2 mt-3 no-underline pb pb-12 pb-[env(safe-area-inset-bottom)]");
|
|
47
|
+
@source inline("place-items-center pointer-coarse:basis-full pointer-coarse:bg-transparent");
|
|
48
|
+
@source inline("pointer-coarse:justify-end pointer-coarse:landscape:pl-[calc(env(safe-area-inset-left)+3.75rem)]");
|
|
49
|
+
@source inline("pointer-coarse:p-0 pointer-coarse:pointer-events-auto");
|
|
50
|
+
@source inline("pointer-coarse:portrait:pb-[calc(env(safe-area-inset-bottom)+3.75rem)]");
|
|
51
|
+
@source inline("pointer-coarse:shadow-none pointer-coarse:size-11 pointer-coarse:static pr-16 pr-24 pr-9 pt pt-6");
|
|
52
|
+
@source inline("py-10 right-1 right-3 ring-1 ring-accent ring-destructive/25 ring-inset rotate rotate-180");
|
|
53
|
+
@source inline("scroll-mt-4 self-stretch sha shadow-md size-9 size-control-lg sm:flex-row sm:gap-4");
|
|
54
|
+
@source inline("sm:items-center sm:justify-between sm:w-60 text-background text-muted-foreground/50 text-success");
|
|
55
|
+
@source inline("top-1 top-3 w-14");
|
|
@@ -5762,6 +5762,26 @@
|
|
|
5762
5762
|
.\[\&_\[data-cb-page-subtitle\]\]\:mt-0 [data-cb-page-subtitle] {
|
|
5763
5763
|
margin-top: 0px;
|
|
5764
5764
|
}
|
|
5765
|
+
.\[\&_\[data-close-button\]\]\:static\! [data-close-button] {
|
|
5766
|
+
position: static !important;
|
|
5767
|
+
}
|
|
5768
|
+
.\[\&_\[data-close-button\]\]\:order-last\! [data-close-button] {
|
|
5769
|
+
order: 9999 !important;
|
|
5770
|
+
}
|
|
5771
|
+
.\[\&_\[data-close-button\]\]\:size-7\! [data-close-button] {
|
|
5772
|
+
width: calc(var(--spacing) * 7) !important;
|
|
5773
|
+
height: calc(var(--spacing) * 7) !important;
|
|
5774
|
+
}
|
|
5775
|
+
.\[\&_\[data-close-button\]\]\:transform-none\! [data-close-button] {
|
|
5776
|
+
transform: none !important;
|
|
5777
|
+
}
|
|
5778
|
+
.\[\&_\[data-close-button\]\]\:border-0\! [data-close-button] {
|
|
5779
|
+
border-style: var(--tw-border-style) !important;
|
|
5780
|
+
border-width: 0px !important;
|
|
5781
|
+
}
|
|
5782
|
+
.\[\&_\[data-close-button\]\]\:bg-transparent\! [data-close-button] {
|
|
5783
|
+
background-color: transparent !important;
|
|
5784
|
+
}
|
|
5765
5785
|
.\[\&_\[data-icon\]\]\:text-accent [data-icon] {
|
|
5766
5786
|
color: var(--accent);
|
|
5767
5787
|
}
|
|
@@ -5774,6 +5794,30 @@
|
|
|
5774
5794
|
.\[\&_\[data-icon\]\]\:text-warning [data-icon] {
|
|
5775
5795
|
color: var(--warning);
|
|
5776
5796
|
}
|
|
5797
|
+
.\[\&_\[data-sonner-toast\]\]\:inset-x-0\! [data-sonner-toast] {
|
|
5798
|
+
inset-inline: 0px !important;
|
|
5799
|
+
}
|
|
5800
|
+
.\[\&_\[data-sonner-toast\]\]\:mx-auto\! [data-sonner-toast] {
|
|
5801
|
+
margin-inline: auto !important;
|
|
5802
|
+
}
|
|
5803
|
+
.\[\&_\[data-sonner-toast\]\]\:w-fit\! [data-sonner-toast] {
|
|
5804
|
+
width: fit-content !important;
|
|
5805
|
+
}
|
|
5806
|
+
.\[\&_\[data-sonner-toast\]\]\:max-w-full\! [data-sonner-toast] {
|
|
5807
|
+
max-width: 100% !important;
|
|
5808
|
+
}
|
|
5809
|
+
.\[\&_\[data-sonner-toast\]\]\:gap-2\! [data-sonner-toast] {
|
|
5810
|
+
gap: calc(var(--spacing) * 2) !important;
|
|
5811
|
+
}
|
|
5812
|
+
.\[\&_\[data-sonner-toast\]\]\:py-1\.5\! [data-sonner-toast] {
|
|
5813
|
+
padding-block: calc(var(--spacing) * 1.5) !important;
|
|
5814
|
+
}
|
|
5815
|
+
.\[\&_\[data-sonner-toast\]\]\:ps-3\! [data-sonner-toast] {
|
|
5816
|
+
padding-inline-start: calc(var(--spacing) * 3) !important;
|
|
5817
|
+
}
|
|
5818
|
+
.\[\&_\[data-sonner-toast\]\]\:pe-1\! [data-sonner-toast] {
|
|
5819
|
+
padding-inline-end: var(--spacing) !important;
|
|
5820
|
+
}
|
|
5777
5821
|
.\[\&_button\:not\(\[role\=checkbox\]\)\]\:size-7 button:not([role=checkbox]) {
|
|
5778
5822
|
width: calc(var(--spacing) * 7);
|
|
5779
5823
|
height: calc(var(--spacing) * 7);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cursedbelt",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.31.0",
|
|
4
4
|
"license": "ISC",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "The React design system of the cursedbelt split — components, styles, theme. cursedbelt-core below it; server tier in cursedbelt-server.",
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
"./react/rich-text",
|
|
39
39
|
"./react/search-input",
|
|
40
40
|
"./react/sheet-tab-strip",
|
|
41
|
+
"./react/shell-doors",
|
|
41
42
|
"./react/slider-field",
|
|
42
43
|
"./react/spreadsheet",
|
|
43
44
|
"./react/workbook-viewer",
|
|
@@ -513,6 +514,12 @@
|
|
|
513
514
|
"source": "./src/react/hooks/useSwipeToDismiss.ts",
|
|
514
515
|
"import": "./dist/react/hooks/useSwipeToDismiss.js"
|
|
515
516
|
},
|
|
517
|
+
"./react/api-client": {
|
|
518
|
+
"types": "./dist/react/lib/apiClient.d.ts",
|
|
519
|
+
"bun": "./src/react/lib/apiClient.ts",
|
|
520
|
+
"source": "./src/react/lib/apiClient.ts",
|
|
521
|
+
"import": "./dist/react/lib/apiClient.js"
|
|
522
|
+
},
|
|
516
523
|
"./react/back": {
|
|
517
524
|
"types": "./dist/react/back/index.d.ts",
|
|
518
525
|
"bun": "./src/react/back/index.ts",
|
|
@@ -693,6 +700,12 @@
|
|
|
693
700
|
"source": "./src/react/workbook-viewer/index.ts",
|
|
694
701
|
"import": "./dist/react/workbook-viewer/index.js"
|
|
695
702
|
},
|
|
703
|
+
"./react/shell-doors": {
|
|
704
|
+
"types": "./dist/react/shell-doors/index.d.ts",
|
|
705
|
+
"bun": "./src/react/shell-doors/index.ts",
|
|
706
|
+
"source": "./src/react/shell-doors/index.ts",
|
|
707
|
+
"import": "./dist/react/shell-doors/index.js"
|
|
708
|
+
},
|
|
696
709
|
"./react/workspace-shell": {
|
|
697
710
|
"types": "./dist/react/workspace-shell/index.d.ts",
|
|
698
711
|
"bun": "./src/react/workspace-shell/index.ts",
|
|
@@ -991,7 +1004,7 @@
|
|
|
991
1004
|
"@vidstack/react": "1.15.6",
|
|
992
1005
|
"@vitejs/plugin-react": "^5.2.0",
|
|
993
1006
|
"cursedbelt-server": "^4.78.0",
|
|
994
|
-
"cursedops": "^0.
|
|
1007
|
+
"cursedops": "^0.37.0",
|
|
995
1008
|
"diff": "^9.0.0",
|
|
996
1009
|
"emoji-mart": "^5.6.0",
|
|
997
1010
|
"hls.js": "^1.5.0",
|
package/scripts/styleAreas.ts
CHANGED
|
@@ -449,7 +449,7 @@ export const AREAS: readonly Area[] = [
|
|
|
449
449
|
},
|
|
450
450
|
{ name: 'wizard', why: 'the multi-step Wizard and its step chrome', roots: ['components/Wizard'] },
|
|
451
451
|
{ name: 'workbook-viewer', why: 'the lazy XLSX viewer (an optional peer already)', roots: ['workbook-viewer'] },
|
|
452
|
-
{ name: 'workspace-shell', why: 'the icon rail, badge menu and phone bar every app frames itself in (`components/BuildVersion.tsx` is named because Settings → About reaches it through `import()`, which the walk does not follow)', roots: ['workspace-shell', 'components/BuildVersion.tsx'] },
|
|
452
|
+
{ name: 'workspace-shell', why: 'the icon rail, badge menu and phone bar every app frames itself in (`components/BuildVersion.tsx` is named because Settings → About reaches it through `import()`, which the walk does not follow)', roots: ['workspace-shell', 'shell-doors', 'components/BuildVersion.tsx'] },
|
|
453
453
|
];
|
|
454
454
|
|
|
455
455
|
export const CORE = 'core';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { describe, expect, test } from 'bun:test';
|
|
2
|
+
import { makeBackName, placeLookup } from './backName.js';
|
|
3
|
+
|
|
4
|
+
const PLACES = [
|
|
5
|
+
{ id: 'today', label: 'Today' },
|
|
6
|
+
{ id: 'lists', label: 'Lists' },
|
|
7
|
+
{ id: 'libraries', label: 'Libraries' },
|
|
8
|
+
] as const;
|
|
9
|
+
const parse = (href: string) => {
|
|
10
|
+
const [view = 'today', ...path] = href.split('/').filter(Boolean);
|
|
11
|
+
return { view: view as 'today' | 'lists' | 'libraries', path };
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
describe('backName', () => {
|
|
15
|
+
const backName = makeBackName(parse, placeLookup(PLACES));
|
|
16
|
+
|
|
17
|
+
test('a place root is its label; a record below it is "one" of it', () => {
|
|
18
|
+
expect(backName('/lists')).toBe('Lists');
|
|
19
|
+
expect(backName('/lists/abc')).toBe('Lists · one list');
|
|
20
|
+
expect(backName('/libraries/x')).toBe('Libraries · one library');
|
|
21
|
+
expect(backName('/today/x')).toBe('Today · one today');
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
test('an unknown id falls back to the first place', () => {
|
|
25
|
+
expect(placeLookup(PLACES)('nope' as 'today').label).toBe('Today');
|
|
26
|
+
});
|
|
27
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a place is called in Back's "Back to …" — the `back.name` an app hands `WorkspaceShell` (forge task 5560; games,
|
|
3
|
+
* home and trivia each held this body). A record opened below a place is "Lists · one list", every other place its label.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/** The places table's lookup: a place by id, the first place when the id is unknown. */
|
|
7
|
+
export function placeLookup<P extends { id: string }>(places: readonly P[]): (id: P['id']) => P {
|
|
8
|
+
return (id) => places.find((place) => place.id === id) ?? (places[0] as P);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/** `Lists` → `list`, `Libraries` → `library`: the singular a "one …" says. */
|
|
12
|
+
const singular = (label: string): string => label.toLowerCase().replace(/ies$/, 'y').replace(/s$/, '');
|
|
13
|
+
|
|
14
|
+
/** `parse` is the app's `links.parse`; `placeOf` its place lookup. */
|
|
15
|
+
export function makeBackName<V extends string>(
|
|
16
|
+
parse: (href: string) => { view: V; path: readonly string[] },
|
|
17
|
+
placeOf: (id: V) => { label: string },
|
|
18
|
+
): (href: string) => string {
|
|
19
|
+
return (href) => {
|
|
20
|
+
const at = parse(href);
|
|
21
|
+
const place = placeOf(at.view);
|
|
22
|
+
return at.path.length ? `${place.label} · one ${singular(place.label)}` : place.label;
|
|
23
|
+
};
|
|
24
|
+
}
|
package/src/react/back/index.ts
CHANGED
|
@@ -4,3 +4,4 @@ export { type BackRow, type BackStep, backRows } from './backTrail.js';
|
|
|
4
4
|
export { backReach, goBack, startBack, type StartBackOptions, useBackSteps } from './back.js';
|
|
5
5
|
export { type BackControl, NOWHERE_BACK, stepBack, useBack } from './useBack.js';
|
|
6
6
|
export { BackButton, type BackButtonProps } from './BackButton.js';
|
|
7
|
+
export { makeBackName, placeLookup } from './backName.js';
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { describe, expect, test } from 'bun:test';
|
|
2
|
+
import { ApiError, createRequest } from './apiClient.js';
|
|
3
|
+
|
|
4
|
+
const reply = (status: number, body: string) => async () => new Response(body, { status });
|
|
5
|
+
|
|
6
|
+
describe('createRequest', () => {
|
|
7
|
+
test('sends the cookie, JSON for a body and nothing for none; always-on headers ride every call', async () => {
|
|
8
|
+
const seen: RequestInit[] = [];
|
|
9
|
+
const request = createRequest({
|
|
10
|
+
headers: () => ({ 'x-zone': 'UTC' }),
|
|
11
|
+
fetch: (async (_url: string, init: RequestInit) => {
|
|
12
|
+
seen.push(init);
|
|
13
|
+
return new Response('{"ok":1}');
|
|
14
|
+
}) as unknown as typeof fetch,
|
|
15
|
+
});
|
|
16
|
+
await request('GET', '/api/a');
|
|
17
|
+
expect(await request<{ ok: number }>('POST', '/api/b', { n: 1 })).toEqual({ ok: 1 });
|
|
18
|
+
expect(seen[0]).toMatchObject({ method: 'GET', credentials: 'same-origin', headers: { 'x-zone': 'UTC' } });
|
|
19
|
+
expect(seen[0]?.body).toBeUndefined();
|
|
20
|
+
expect(seen[1]?.headers).toEqual({ 'x-zone': 'UTC', 'content-type': 'application/json' });
|
|
21
|
+
expect(seen[1]?.body).toBe('{"n":1}');
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
test('a 204 answers undefined and an empty body answers null', async () => {
|
|
25
|
+
expect(await createRequest({ fetch: reply(204, '') as unknown as typeof fetch })('DELETE', '/x')).toBeUndefined();
|
|
26
|
+
expect(await createRequest({ fetch: reply(200, '') as unknown as typeof fetch })('GET', '/x')).toBeNull();
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
test('🔴 a refusal throws an ApiError with the server’s words; an error page falls back to the status', async () => {
|
|
30
|
+
const refused = await createRequest({ fetch: reply(403, '{"error":"Not yours."}') as unknown as typeof fetch })('GET', '/x').catch((e) => e);
|
|
31
|
+
expect(refused).toBeInstanceOf(ApiError);
|
|
32
|
+
expect(refused).toMatchObject({ status: 403, message: 'Not yours.' });
|
|
33
|
+
const page = await createRequest({ fetch: reply(502, '<html>Bad gateway</html>') as unknown as typeof fetch })('GET', '/x').catch((e) => e);
|
|
34
|
+
expect(page).toMatchObject({ status: 502, message: 'The server answered 502.' });
|
|
35
|
+
});
|
|
36
|
+
});
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An app's one road to its own `/api`: a typed JSON `request` that sends the session cookie, reads a refusal's own words
|
|
3
|
+
* and throws an `ApiError` carrying the status (forge task 5560 — games, home and trivia each held this body).
|
|
4
|
+
*
|
|
5
|
+
* 🔴 A non-JSON body is an error page in a costume (a 502 from a proxy, an Access redirect): the status says what
|
|
6
|
+
* happened, so the reason falls back to "The server answered 502." rather than to the page's HTML or a parse error.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/** A request the server refused or could not answer: `status` is the HTTP status; the message is the server's `error` words. */
|
|
10
|
+
export class ApiError extends Error {
|
|
11
|
+
constructor(
|
|
12
|
+
readonly status: number,
|
|
13
|
+
message: string,
|
|
14
|
+
) {
|
|
15
|
+
super(message);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export type ApiRequest = <T>(method: string, path: string, body?: unknown) => Promise<T>;
|
|
20
|
+
|
|
21
|
+
export interface ApiRequestOptions {
|
|
22
|
+
/** Headers sent on every call (trivia's reader zone). A function is asked afresh for each call. */
|
|
23
|
+
headers?: Record<string, string> | (() => Record<string, string>);
|
|
24
|
+
/** The `fetch` to call; the global one by default. */
|
|
25
|
+
fetch?: typeof fetch;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** A `request` with its own always-on headers. A 204 answers `undefined`; JSON is sent for any body that is not `undefined`. */
|
|
29
|
+
export function createRequest(options: ApiRequestOptions = {}): ApiRequest {
|
|
30
|
+
return async function request<T>(method: string, path: string, body?: unknown): Promise<T> {
|
|
31
|
+
const doFetch = options.fetch ?? fetch;
|
|
32
|
+
const always = typeof options.headers === 'function' ? options.headers() : (options.headers ?? {});
|
|
33
|
+
const response = await doFetch(path, {
|
|
34
|
+
method,
|
|
35
|
+
credentials: 'same-origin',
|
|
36
|
+
headers: { ...always, ...(body === undefined ? {} : { 'content-type': 'application/json' }) },
|
|
37
|
+
...(body === undefined ? {} : { body: JSON.stringify(body) }),
|
|
38
|
+
});
|
|
39
|
+
if (response.status === 204) return undefined as T;
|
|
40
|
+
const text = await response.text();
|
|
41
|
+
let parsed: unknown = null;
|
|
42
|
+
try {
|
|
43
|
+
parsed = text ? JSON.parse(text) : null;
|
|
44
|
+
} catch {
|
|
45
|
+
// A non-JSON body is an error page in a costume; the status says what happened.
|
|
46
|
+
}
|
|
47
|
+
if (!response.ok) {
|
|
48
|
+
const reason =
|
|
49
|
+
parsed && typeof parsed === 'object' && 'error' in parsed ? String((parsed as { error: unknown }).error) : `The server answered ${response.status}.`;
|
|
50
|
+
throw new ApiError(response.status, reason);
|
|
51
|
+
}
|
|
52
|
+
return parsed as T;
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** The plain `request`: no extra headers. */
|
|
57
|
+
export const request: ApiRequest = createRequest();
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `cursedbelt/react/shell-doors` — the wiring a deep-linked app repeats around `WorkspaceShell` (forge task 5560).
|
|
3
|
+
* A subpath of its own, never re-exported by `./react/workspace-shell`: an app that lazy-loads a shell part through
|
|
4
|
+
* that barrel keeps every module the barrel names in the chunk, and this hook (with the deep-link router it reads)
|
|
5
|
+
* would ride into the shell chunk of an app that never calls it — arch's grew 5.40 → 6.87 kB gzip.
|
|
6
|
+
*/
|
|
7
|
+
export { COMPACT_TOASTER, railPlaces, type ShellDoors, type ShellSession, useShellDoors } from './shellDoors.js';
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { afterEach, beforeEach, describe, expect, test } from 'bun:test';
|
|
2
|
+
import { act, cleanup, renderHook } from '@testing-library/react';
|
|
3
|
+
import type { ReactNode } from 'react';
|
|
4
|
+
import { defineDeepLinks } from '../deep-link/links.js';
|
|
5
|
+
import { DeepLinkProvider } from '../deep-link/useDeepLink.js';
|
|
6
|
+
import { resetIssuesForTest } from '../notifications/issues.js';
|
|
7
|
+
import { forgetSuiteApps } from '../workspace-shell/suiteApps.js';
|
|
8
|
+
import { COMPACT_TOASTER, railPlaces, useShellDoors } from './shellDoors.js';
|
|
9
|
+
|
|
10
|
+
type V = 'today' | 'settings' | 'notifications' | 'help';
|
|
11
|
+
const links = defineDeepLinks({
|
|
12
|
+
mode: 'history',
|
|
13
|
+
fallback: 'today',
|
|
14
|
+
views: {
|
|
15
|
+
today: { path: '/' },
|
|
16
|
+
settings: { path: '/settings', params: ['at'] },
|
|
17
|
+
notifications: { path: '/notifications', params: ['show'] },
|
|
18
|
+
help: { path: '/help' },
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
const wrapper = ({ children }: { children: ReactNode }) => <DeepLinkProvider links={links}>{children}</DeepLinkProvider>;
|
|
22
|
+
const SESSION = { user: { name: 'Curt', email: 'c@x.test' } };
|
|
23
|
+
|
|
24
|
+
beforeEach(() => {
|
|
25
|
+
window.history.replaceState(null, '', '/');
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
afterEach(() => {
|
|
29
|
+
cleanup();
|
|
30
|
+
resetIssuesForTest();
|
|
31
|
+
forgetSuiteApps();
|
|
32
|
+
window.history.replaceState(null, '', '/');
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
describe('useShellDoors', () => {
|
|
36
|
+
test('the three doors navigate to their own paths; settings carries the section it is opened at', () => {
|
|
37
|
+
const { result } = renderHook(() => useShellDoors<V>(SESSION), { wrapper });
|
|
38
|
+
expect(result.current.view).toBe('today');
|
|
39
|
+
act(() => result.current.openSettings('keys & more'));
|
|
40
|
+
expect(window.location.pathname + window.location.search).toBe('/settings?at=keys+%26+more');
|
|
41
|
+
expect(result.current.view).toBe('settings');
|
|
42
|
+
act(() => result.current.openNotifications());
|
|
43
|
+
expect(window.location.pathname).toBe('/notifications');
|
|
44
|
+
act(() => result.current.openHelp());
|
|
45
|
+
expect(window.location.pathname).toBe('/help');
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
test('the account is the name, or the address when there is none; the badge carries the address as its detail', () => {
|
|
49
|
+
const named = renderHook(() => useShellDoors<V>(SESSION), { wrapper }).result.current;
|
|
50
|
+
expect(named.account).toEqual({ name: 'Curt', email: 'c@x.test', accountsUrl: '' });
|
|
51
|
+
expect(named.badge('Home', null)).toEqual({ name: 'Home', mark: null, detail: 'c@x.test' });
|
|
52
|
+
const bare = renderHook(() => useShellDoors<V>({ user: { email: 'a@x.test' } }), { wrapper }).result.current;
|
|
53
|
+
expect(bare.account.name).toBe('a@x.test');
|
|
54
|
+
expect(renderHook(() => useShellDoors<V>({}), { wrapper }).result.current.badge('Home', null)).toEqual({ name: 'Home', mark: null });
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
test('a signed-in page with no trouble is live, and ⌘K opens and mounts the palette once', () => {
|
|
58
|
+
const { result } = renderHook(() => useShellDoors<V>(SESSION), { wrapper });
|
|
59
|
+
expect(result.current.connection).toBe('live');
|
|
60
|
+
expect(result.current.connectionLabel).toBeUndefined();
|
|
61
|
+
expect(result.current.palette).toEqual({ open: false, mounted: false });
|
|
62
|
+
act(() => result.current.openPalette());
|
|
63
|
+
expect(result.current.palette).toEqual({ open: true, mounted: true });
|
|
64
|
+
act(() => result.current.setPaletteOpen(false));
|
|
65
|
+
expect(result.current.palette).toEqual({ open: false, mounted: true });
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
describe('railPlaces', () => {
|
|
70
|
+
const PLACES = [
|
|
71
|
+
{ id: 'a', label: 'A', icon: null, section: 'Plan', pinned: true as const },
|
|
72
|
+
{ id: 'b', label: 'B', icon: null, section: 'Keep' },
|
|
73
|
+
{ id: 'settings', label: 'Settings', icon: null },
|
|
74
|
+
];
|
|
75
|
+
test('only places with a section reach the rail, in their family, pinned ones on the bar', () => {
|
|
76
|
+
const rail = railPlaces(PLACES, (id) => `/${id}`, { Plan: 'plan', Keep: 'keep' });
|
|
77
|
+
expect(rail).toEqual([
|
|
78
|
+
{ id: 'a', label: 'A', icon: null, href: '/a', family: 'plan', onBar: true },
|
|
79
|
+
{ id: 'b', label: 'B', icon: null, href: '/b', family: 'keep' },
|
|
80
|
+
]);
|
|
81
|
+
});
|
|
82
|
+
test('include leaves a place off', () => {
|
|
83
|
+
expect(railPlaces(PLACES, (id) => `/${id}`, { Plan: 'plan', Keep: 'keep' }, (p) => p.id !== 'a').map((p) => p.id)).toEqual(['b']);
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
describe('COMPACT_TOASTER', () => {
|
|
88
|
+
test('a pill as wide as its words, centered at the foot, lifted above a phone’s bar', () => {
|
|
89
|
+
expect(COMPACT_TOASTER.position).toBe('bottom-center');
|
|
90
|
+
expect(COMPACT_TOASTER.className).toContain('[&_[data-sonner-toast]]:w-fit!');
|
|
91
|
+
expect(JSON.stringify(COMPACT_TOASTER.mobileOffset)).toContain('--cb-bottom-chrome-h');
|
|
92
|
+
});
|
|
93
|
+
});
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The wiring every deep-linked app shell repeats around `WorkspaceShell` (forge task 5560): the three badge doors
|
|
3
|
+
* (Notifications, Settings, Help) as paths, the banner lane, the connection dot, the account the badge shows, the
|
|
4
|
+
* suite's other apps, the ⌘K palette's open state, and the notifications page the Notifications door draws. games,
|
|
5
|
+
* home and trivia each wrote it out (~45 lines apiece); an app now passes what differs — its session, and the view
|
|
6
|
+
* it is on — and keeps the parts that are its own (its pages, its palette's contents, its title).
|
|
7
|
+
*
|
|
8
|
+
* Call it inside a `DeepLinkProvider`: the paths come from that provider's `links`.
|
|
9
|
+
*/
|
|
10
|
+
import { type CSSProperties, type ReactNode, useCallback, useMemo, useState } from 'react';
|
|
11
|
+
import { type DeepLinkLocation, useDeepLink } from '../deep-link/index.js';
|
|
12
|
+
import { lazyWithReload } from '../lazy/index.js';
|
|
13
|
+
import type { ToasterProps } from '../Toast.js';
|
|
14
|
+
import { issueNotifications } from '../workspace-shell/notificationSource.js';
|
|
15
|
+
import { useConnectionTrouble, useIssueBanners } from '../notifications/index.js';
|
|
16
|
+
import { useSuiteApps } from '../workspace-shell/suiteApps.js';
|
|
17
|
+
import type { ShellApp, ShellBadge, ShellConnection, ShellPlace } from '../workspace-shell/WorkspaceShell.js';
|
|
18
|
+
import type { NotificationsShow } from '../workspace-shell/NotificationsPlace.js';
|
|
19
|
+
|
|
20
|
+
// Through the barrel, as every app's own lazy handle was: importing './NotificationsPlace.js' directly split it into a
|
|
21
|
+
// chunk of its own and pulled the shell's parts into SettingsView's (games' SettingsView chunk 4.3 -> 12.1 kB gzip).
|
|
22
|
+
const LazyNotificationsPlace = lazyWithReload(() => import('../workspace-shell/index.js').then((m) => ({ default: m.NotificationsPlace })));
|
|
23
|
+
|
|
24
|
+
/** The part of an SSO session the doors read (`cursedauth/session-probe`'s `Session` satisfies it). */
|
|
25
|
+
export interface ShellSession {
|
|
26
|
+
user?: { name?: string; email?: string };
|
|
27
|
+
accountsUrl?: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface ShellDoors<V extends string> {
|
|
31
|
+
/** The view the URL names. */
|
|
32
|
+
view: V;
|
|
33
|
+
location: DeepLinkLocation<V>;
|
|
34
|
+
/** Go to a path of this app (`/settings?at=keys`), as the deep links parse it. */
|
|
35
|
+
go: (path: string) => void;
|
|
36
|
+
goToRoot: (view: V) => void;
|
|
37
|
+
openNotifications: () => void;
|
|
38
|
+
/** Settings, opened at a section when one is named. */
|
|
39
|
+
openSettings: (at?: string) => void;
|
|
40
|
+
openHelp: () => void;
|
|
41
|
+
/** The banner lane's rows — none on the notifications page, which shows the issues in full. */
|
|
42
|
+
banners: ReturnType<typeof useIssueBanners>;
|
|
43
|
+
apps: readonly ShellApp[];
|
|
44
|
+
connection: ShellConnection;
|
|
45
|
+
/** The first trouble's title, for the connection dot's tooltip; absent while live. */
|
|
46
|
+
connectionLabel?: string;
|
|
47
|
+
/** What the settings page and the badge show of the signed-in person. */
|
|
48
|
+
account: { name: string; email: string; accountsUrl: string };
|
|
49
|
+
/** The badge's props, from a name and a mark. */
|
|
50
|
+
badge: (name: string, mark: ReactNode) => ShellBadge;
|
|
51
|
+
palette: { open: boolean; mounted: boolean };
|
|
52
|
+
openPalette: () => void;
|
|
53
|
+
setPaletteOpen: (open: boolean) => void;
|
|
54
|
+
/** The notifications page, for the Notifications door — `/notifications?show=…` is where its filter lives. */
|
|
55
|
+
notificationsPlace: ReactNode;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export function useShellDoors<V extends string>(session: ShellSession): ShellDoors<V> {
|
|
59
|
+
const { location, navigateTo, goToRoot, links } = useDeepLink<V>();
|
|
60
|
+
const view = location.view;
|
|
61
|
+
const go = useCallback((path: string) => navigateTo(links.parse(path)), [navigateTo, links]);
|
|
62
|
+
const openNotifications = useCallback(() => go(links.root('notifications' as V)), [go, links]);
|
|
63
|
+
const openSettings = useCallback((at?: string) => go(at ? `/settings?at=${encodeURIComponent(at)}` : '/settings'), [go]);
|
|
64
|
+
const openHelp = useCallback(() => go(links.root('help' as V)), [go, links]);
|
|
65
|
+
|
|
66
|
+
const issueBanners = useIssueBanners({ onView: openNotifications });
|
|
67
|
+
const banners = (view as string) === 'notifications' ? [] : issueBanners;
|
|
68
|
+
|
|
69
|
+
const [palette, setPalette] = useState({ open: false, mounted: false });
|
|
70
|
+
const apps = useSuiteApps(session.accountsUrl);
|
|
71
|
+
const trouble = useConnectionTrouble();
|
|
72
|
+
const connection: ShellConnection = trouble.length === 0 ? 'live' : trouble.some((issue) => issue.area === 'offline') ? 'offline' : 'connecting';
|
|
73
|
+
const email = session.user?.email ?? '';
|
|
74
|
+
const name = session.user?.name || email;
|
|
75
|
+
const accountsUrl = session.accountsUrl ?? '';
|
|
76
|
+
const account = useMemo(() => ({ name, email, accountsUrl }), [name, email, accountsUrl]);
|
|
77
|
+
|
|
78
|
+
const show = (location.params.show ?? 'unread') as NotificationsShow;
|
|
79
|
+
const notificationsPlace = (
|
|
80
|
+
<LazyNotificationsPlace
|
|
81
|
+
show={show}
|
|
82
|
+
source={issueNotifications()}
|
|
83
|
+
onShow={(next) => navigateTo(links.parse(next === 'unread' ? '/notifications' : `/notifications?show=${next}`), { replace: true })}
|
|
84
|
+
/>
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
return {
|
|
88
|
+
view,
|
|
89
|
+
location,
|
|
90
|
+
go,
|
|
91
|
+
goToRoot: (next) => goToRoot(next),
|
|
92
|
+
openNotifications,
|
|
93
|
+
openSettings,
|
|
94
|
+
openHelp,
|
|
95
|
+
banners,
|
|
96
|
+
apps,
|
|
97
|
+
connection,
|
|
98
|
+
...(trouble[0] ? { connectionLabel: trouble[0].title } : {}),
|
|
99
|
+
account,
|
|
100
|
+
badge: (badgeName, mark) => ({ name: badgeName, mark, ...(email ? { detail: email } : {}) }),
|
|
101
|
+
palette,
|
|
102
|
+
openPalette: () => setPalette({ open: true, mounted: true }),
|
|
103
|
+
setPaletteOpen: (open) => setPalette((p) => ({ ...p, open })),
|
|
104
|
+
notificationsPlace,
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* The toaster's own stack, made compact (photos' forge task 5340): each toast as wide as its words and centered, the
|
|
110
|
+
* close × inline at the end. `!` because sonner's own `[data-sonner-toast]` rules land after the app's utilities.
|
|
111
|
+
*/
|
|
112
|
+
export const COMPACT_TOASTS = [
|
|
113
|
+
'[&_[data-sonner-toast]]:w-fit! [&_[data-sonner-toast]]:max-w-full! [&_[data-sonner-toast]]:inset-x-0! [&_[data-sonner-toast]]:mx-auto!',
|
|
114
|
+
'[&_[data-sonner-toast]]:gap-2! [&_[data-sonner-toast]]:py-1.5! [&_[data-sonner-toast]]:ps-3! [&_[data-sonner-toast]]:pe-1!',
|
|
115
|
+
'[&_[data-close-button]]:static! [&_[data-close-button]]:order-last! [&_[data-close-button]]:size-7! [&_[data-close-button]]:transform-none! [&_[data-close-button]]:border-0! [&_[data-close-button]]:bg-transparent!',
|
|
116
|
+
].join(' ');
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* `<LazyToaster {...COMPACT_TOASTER} />`: a small pill at the foot, centered, as wide as its words; above a phone's
|
|
120
|
+
* bottom bar.
|
|
121
|
+
*/
|
|
122
|
+
export const COMPACT_TOASTER: ToasterProps = {
|
|
123
|
+
position: 'bottom-center',
|
|
124
|
+
offset: { bottom: '20px' },
|
|
125
|
+
mobileOffset: { bottom: 'calc(var(--cb-bottom-chrome-h, 0px) + 12px)', left: '12px', right: '12px' },
|
|
126
|
+
style: { '--width': '24rem' } as CSSProperties,
|
|
127
|
+
className: COMPACT_TOASTS,
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* A place's rail row for each place that has a `section`, in the order given. `family` maps a section to the rail's
|
|
132
|
+
* family key; `include` leaves a place off (an owner-only place for anyone else).
|
|
133
|
+
*/
|
|
134
|
+
export function railPlaces<P extends { id: string; label: string; icon: ReactNode; section?: string; pinned?: true }>(
|
|
135
|
+
places: readonly P[],
|
|
136
|
+
rootHref: (id: P['id']) => string,
|
|
137
|
+
family: Readonly<Record<string, string>>,
|
|
138
|
+
include: (place: P) => boolean = () => true,
|
|
139
|
+
): ShellPlace[] {
|
|
140
|
+
return places
|
|
141
|
+
.filter((place) => place.section && include(place))
|
|
142
|
+
.map((place) => ({
|
|
143
|
+
id: place.id,
|
|
144
|
+
label: place.label,
|
|
145
|
+
icon: place.icon,
|
|
146
|
+
href: rootHref(place.id),
|
|
147
|
+
family: family[place.section as string] as string,
|
|
148
|
+
...(place.pinned ? { onBar: true } : {}),
|
|
149
|
+
}));
|
|
150
|
+
}
|
|
@@ -18,23 +18,38 @@
|
|
|
18
18
|
* after an app's responsive variant (task 2124). An app that imports every area gets exactly
|
|
19
19
|
* what `cursedbelt/styles-utilities.css` emits — proved rule by rule in
|
|
20
20
|
* src/stylesAreas.spec.ts, which is also what fails when this file is stale.
|
|
21
|
-
*
|
|
21
|
+
* 117 candidate(s).
|
|
22
22
|
*
|
|
23
23
|
* Written by scripts/generateAreaStyles.ts (`bun run styles:areas`), which
|
|
24
24
|
* `bun run build` runs. The map of what is in which area, and why the areas are
|
|
25
25
|
* import closures rather than a hand-written list, is scripts/styleAreas.ts.
|
|
26
26
|
*/
|
|
27
|
-
@source inline("-my-1.5 @max-meta:hidden [&::-webkit-scrollbar]:hidden [&>svg]:opacity-45
|
|
28
|
-
@source inline("[
|
|
29
|
-
@source inline("
|
|
30
|
-
@source inline("
|
|
27
|
+
@source inline("-my-1.5 -right-0.5 -top-0.5 @max-meta:hidden [&::-webkit-scrollbar]:hidden [&>svg]:opacity-45");
|
|
28
|
+
@source inline("[&>svg]:size-5 [&_[data-cb-banner-icon]]:text-accent [&_[data-cb-banner-icon]]:text-destructive");
|
|
29
|
+
@source inline("[&_[data-cb-banner-icon]]:text-warning [&_[data-close-button]]:bg-transparent!");
|
|
30
|
+
@source inline("[&_[data-close-button]]:border-0! [&_[data-close-button]]:order-last!");
|
|
31
|
+
@source inline("[&_[data-close-button]]:size-7! [&_[data-close-button]]:static!");
|
|
32
|
+
@source inline("[&_[data-close-button]]:transform-none! [&_[data-sonner-toast]]:gap-2!");
|
|
33
|
+
@source inline("[&_[data-sonner-toast]]:inset-x-0! [&_[data-sonner-toast]]:max-w-full!");
|
|
34
|
+
@source inline("[&_[data-sonner-toast]]:mx-auto! [&_[data-sonner-toast]]:pe-1! [&_[data-sonner-toast]]:ps-3!");
|
|
35
|
+
@source inline("[&_[data-sonner-toast]]:py-1.5! [&_[data-sonner-toast]]:w-fit! [&_svg]:size-4.5");
|
|
36
|
+
@source inline("[&_svg]:text-accent [&_svg]:text-muted-foreground [scrollbar-width:none] bg-accent/15");
|
|
37
|
+
@source inline("bg-destructive/10 bg-foreground bg-muted/50 bg-warning/10 border-solid");
|
|
38
|
+
@source inline("bottom-[calc(env(safe-area-inset-bottom)+0.5rem)] flex-auto focus-visible:[&>svg]:opacity-100");
|
|
39
|
+
@source inline("group-focus-within:opacity-100 group-focus-within:pointer-events-auto");
|
|
40
|
+
@source inline("group-hover:pointer-events-auto h-14 h-[calc(3.5rem+env(safe-area-inset-bottom))]");
|
|
31
41
|
@source inline("hover:[&>svg]:opacity-100 hover:bg-accent-solid/90 hover:bg-muted/60 items-stretch left-2.5");
|
|
32
42
|
@source inline("left-[calc(env(safe-area-inset-left)+0.5rem)] list-none max-md:border-t-0 max-md:pt-0");
|
|
33
43
|
@source inline("md:[&:has(>[data-cb-place-actions]_[role=tablist])>[data-cb-place-name]]:min-w-24 md:bg-muted");
|
|
34
44
|
@source inline("md:block md:border-r md:flex md:h-12 md:has-[[role=tablist]]:min-w-0");
|
|
35
45
|
@source inline("md:has-[[role=tablist]]:shrink md:hidden md:px-6 md:px-8 md:py-6 md:shrink-0 md:text-foreground");
|
|
36
|
-
@source inline("md:w-64 min-h-2 mt-3 no-underline pb-12 pb-[env(safe-area-inset-bottom)]");
|
|
37
|
-
@source inline("pointer-coarse:
|
|
38
|
-
@source inline("pointer-coarse:pointer-
|
|
39
|
-
@source inline("pointer-coarse:
|
|
40
|
-
@source inline("
|
|
46
|
+
@source inline("md:w-64 min-h-10 min-h-2 ml-1.5 ml-2 mt-3 no-underline pb pb-12 pb-[env(safe-area-inset-bottom)]");
|
|
47
|
+
@source inline("place-items-center pointer-coarse:basis-full pointer-coarse:bg-transparent");
|
|
48
|
+
@source inline("pointer-coarse:justify-end pointer-coarse:landscape:pl-[calc(env(safe-area-inset-left)+3.75rem)]");
|
|
49
|
+
@source inline("pointer-coarse:p-0 pointer-coarse:pointer-events-auto");
|
|
50
|
+
@source inline("pointer-coarse:portrait:pb-[calc(env(safe-area-inset-bottom)+3.75rem)]");
|
|
51
|
+
@source inline("pointer-coarse:shadow-none pointer-coarse:size-11 pointer-coarse:static pr-16 pr-24 pr-9 pt pt-6");
|
|
52
|
+
@source inline("py-10 right-1 right-3 ring-1 ring-accent ring-destructive/25 ring-inset rotate rotate-180");
|
|
53
|
+
@source inline("scroll-mt-4 self-stretch sha shadow-md size-9 size-control-lg sm:flex-row sm:gap-4");
|
|
54
|
+
@source inline("sm:items-center sm:justify-between sm:w-60 text-background text-muted-foreground/50 text-success");
|
|
55
|
+
@source inline("top-1 top-3 w-14");
|
package/src/styles-utilities.css
CHANGED
|
@@ -5762,6 +5762,26 @@
|
|
|
5762
5762
|
.\[\&_\[data-cb-page-subtitle\]\]\:mt-0 [data-cb-page-subtitle] {
|
|
5763
5763
|
margin-top: 0px;
|
|
5764
5764
|
}
|
|
5765
|
+
.\[\&_\[data-close-button\]\]\:static\! [data-close-button] {
|
|
5766
|
+
position: static !important;
|
|
5767
|
+
}
|
|
5768
|
+
.\[\&_\[data-close-button\]\]\:order-last\! [data-close-button] {
|
|
5769
|
+
order: 9999 !important;
|
|
5770
|
+
}
|
|
5771
|
+
.\[\&_\[data-close-button\]\]\:size-7\! [data-close-button] {
|
|
5772
|
+
width: calc(var(--spacing) * 7) !important;
|
|
5773
|
+
height: calc(var(--spacing) * 7) !important;
|
|
5774
|
+
}
|
|
5775
|
+
.\[\&_\[data-close-button\]\]\:transform-none\! [data-close-button] {
|
|
5776
|
+
transform: none !important;
|
|
5777
|
+
}
|
|
5778
|
+
.\[\&_\[data-close-button\]\]\:border-0\! [data-close-button] {
|
|
5779
|
+
border-style: var(--tw-border-style) !important;
|
|
5780
|
+
border-width: 0px !important;
|
|
5781
|
+
}
|
|
5782
|
+
.\[\&_\[data-close-button\]\]\:bg-transparent\! [data-close-button] {
|
|
5783
|
+
background-color: transparent !important;
|
|
5784
|
+
}
|
|
5765
5785
|
.\[\&_\[data-icon\]\]\:text-accent [data-icon] {
|
|
5766
5786
|
color: var(--accent);
|
|
5767
5787
|
}
|
|
@@ -5774,6 +5794,30 @@
|
|
|
5774
5794
|
.\[\&_\[data-icon\]\]\:text-warning [data-icon] {
|
|
5775
5795
|
color: var(--warning);
|
|
5776
5796
|
}
|
|
5797
|
+
.\[\&_\[data-sonner-toast\]\]\:inset-x-0\! [data-sonner-toast] {
|
|
5798
|
+
inset-inline: 0px !important;
|
|
5799
|
+
}
|
|
5800
|
+
.\[\&_\[data-sonner-toast\]\]\:mx-auto\! [data-sonner-toast] {
|
|
5801
|
+
margin-inline: auto !important;
|
|
5802
|
+
}
|
|
5803
|
+
.\[\&_\[data-sonner-toast\]\]\:w-fit\! [data-sonner-toast] {
|
|
5804
|
+
width: fit-content !important;
|
|
5805
|
+
}
|
|
5806
|
+
.\[\&_\[data-sonner-toast\]\]\:max-w-full\! [data-sonner-toast] {
|
|
5807
|
+
max-width: 100% !important;
|
|
5808
|
+
}
|
|
5809
|
+
.\[\&_\[data-sonner-toast\]\]\:gap-2\! [data-sonner-toast] {
|
|
5810
|
+
gap: calc(var(--spacing) * 2) !important;
|
|
5811
|
+
}
|
|
5812
|
+
.\[\&_\[data-sonner-toast\]\]\:py-1\.5\! [data-sonner-toast] {
|
|
5813
|
+
padding-block: calc(var(--spacing) * 1.5) !important;
|
|
5814
|
+
}
|
|
5815
|
+
.\[\&_\[data-sonner-toast\]\]\:ps-3\! [data-sonner-toast] {
|
|
5816
|
+
padding-inline-start: calc(var(--spacing) * 3) !important;
|
|
5817
|
+
}
|
|
5818
|
+
.\[\&_\[data-sonner-toast\]\]\:pe-1\! [data-sonner-toast] {
|
|
5819
|
+
padding-inline-end: var(--spacing) !important;
|
|
5820
|
+
}
|
|
5777
5821
|
.\[\&_button\:not\(\[role\=checkbox\]\)\]\:size-7 button:not([role=checkbox]) {
|
|
5778
5822
|
width: calc(var(--spacing) * 7);
|
|
5779
5823
|
height: calc(var(--spacing) * 7);
|