@tinycloud/web-sdk 3.7.0-beta.2 → 3.7.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +40 -0
- package/dist/adapters/BrowserNotificationHandler.d.ts +22 -6
- package/dist/authorization/WebSpaceCreationHandler.d.ts +12 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +1 -1
- package/dist/modals.cjs +1 -0
- package/dist/modals.mjs +1 -0
- package/dist/modules/tcw.d.ts +16 -2
- package/dist/notifications/ModalManager.d.ts +21 -7
- package/dist/notifications/PermissionRequestModal.d.ts +8 -1
- package/dist/notifications/SpaceCreationModal.d.ts +8 -1
- package/dist/notifications/dialogFocus.d.ts +39 -0
- package/dist/notifications/index.d.ts +1 -6
- package/dist/notifications/lazy-prompts.d.ts +16 -0
- package/dist/notifications/legacy-config.d.ts +11 -0
- package/dist/notifications/modals-entry.d.ts +7 -0
- package/dist/notifications/modals-registry.d.ts +15 -0
- package/dist/notifications/scrollLock.d.ts +2 -0
- package/dist/notifications/types.d.ts +6 -33
- package/dist/notifications/types.schema.d.ts +7 -148
- package/dist/panel-data.cjs +1 -0
- package/dist/panel-data.mjs +1 -0
- package/dist/panel.cjs +1 -0
- package/dist/panel.mjs +1 -0
- package/dist/ui/api.d.ts +30 -0
- package/dist/ui/button.d.ts +10 -0
- package/dist/ui/client.d.ts +27 -0
- package/dist/ui/config.d.ts +35 -0
- package/dist/ui/data/map.d.ts +23 -0
- package/dist/ui/data/prefetch.d.ts +18 -0
- package/dist/ui/data/real.d.ts +12 -0
- package/dist/ui/data.d.ts +241 -0
- package/dist/ui/frame-guard.d.ts +7 -0
- package/dist/ui/host.d.ts +29 -0
- package/dist/ui/ids.d.ts +7 -0
- package/dist/ui/index.d.ts +38 -0
- package/dist/ui/manage-url.d.ts +8 -0
- package/dist/ui/panel-data-entry.d.ts +28 -0
- package/dist/ui/panel-entry.d.ts +23 -0
- package/dist/ui/panel-modal.d.ts +13 -0
- package/dist/ui/panel-styles.d.ts +10 -0
- package/dist/ui/panel-toasts.d.ts +30 -0
- package/dist/ui/panel.d.ts +42 -0
- package/dist/ui/parts/index.d.ts +4 -0
- package/dist/ui/parts/prompts.d.ts +39 -0
- package/dist/ui/parts/storage-watch.d.ts +11 -0
- package/dist/ui/parts/sync-status.d.ts +7 -0
- package/dist/ui/parts/toasts.d.ts +8 -0
- package/dist/ui/pending.d.ts +13 -0
- package/dist/ui/persistence.d.ts +28 -0
- package/dist/ui/phone.d.ts +14 -0
- package/dist/ui/section-data.d.ts +20 -0
- package/dist/ui/section-dialogs.d.ts +10 -0
- package/dist/ui/sections/account.d.ts +3 -0
- package/dist/ui/sections/account.strings.d.ts +29 -0
- package/dist/ui/sections/activity.d.ts +7 -0
- package/dist/ui/sections/activity.strings.d.ts +46 -0
- package/dist/ui/sections/delegations.d.ts +25 -0
- package/dist/ui/sections/delegations.strings.d.ts +143 -0
- package/dist/ui/sections/freshness-copy.d.ts +17 -0
- package/dist/ui/sections/index.d.ts +4 -0
- package/dist/ui/sections/local-copy.d.ts +3 -0
- package/dist/ui/sections/local-copy.strings.d.ts +70 -0
- package/dist/ui/sections/local-tinycloud.d.ts +9 -0
- package/dist/ui/sections/local-tinycloud.strings.d.ts +48 -0
- package/dist/ui/sections/nodes.d.ts +7 -0
- package/dist/ui/sections/nodes.strings.d.ts +27 -0
- package/dist/ui/sections/placeholder.d.ts +8 -0
- package/dist/ui/sections/status.d.ts +10 -0
- package/dist/ui/sections/storage.d.ts +37 -0
- package/dist/ui/sections/storage.strings.d.ts +37 -0
- package/dist/ui/sections/ui.d.ts +77 -0
- package/dist/ui/sections/view-body.d.ts +23 -0
- package/dist/ui/sign-out-purge.d.ts +39 -0
- package/dist/ui/slots.d.ts +218 -0
- package/dist/ui/status.d.ts +16 -0
- package/dist/ui/storage-state.d.ts +12 -0
- package/dist/ui/strings-panel.d.ts +29 -0
- package/dist/ui/strings.d.ts +76 -0
- package/dist/ui/stub/index.d.ts +48 -0
- package/dist/ui/styles.d.ts +9 -0
- package/dist/ui/toast-store.d.ts +46 -0
- package/dist/ui/view-result.d.ts +6 -0
- package/package.json +13 -4
- package/dist/notifications/ErrorHandler.d.ts +0 -32
- package/dist/notifications/NodeSelectionModal.d.ts +0 -29
- package/dist/notifications/ToastContainer.d.ts +0 -16
- package/dist/notifications/ToastElement.d.ts +0 -22
- package/dist/notifications/ToastManager.d.ts +0 -36
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared panel components from the settings mockup: confirm box, glance rows,
|
|
3
|
+
* details drawer. Sections pass resolved text in; nothing here
|
|
4
|
+
* reads client data or strings.ts. Each control is at least 44px tall.
|
|
5
|
+
*/
|
|
6
|
+
import type { SectionStatus } from "../slots";
|
|
7
|
+
/** Light and dark tokens for these components, mirroring the mockup's hairline and chrome. */
|
|
8
|
+
export declare const UI_STYLE = "\n.glance{display:flex;flex-direction:column;margin:0;padding:0;list-style:none}\n.glance-row{display:flex;align-items:center;gap:14px;width:100%;min-height:56px;padding:6px 6px 6px 0;border:0;border-bottom:1px solid #e4e4e7;background:transparent;color:inherit;font:inherit;text-align:left;cursor:pointer}\n.glance-row:last-child{border-bottom:0}\n.glance-row .gl{flex:1;min-width:0}\n.glance-row .gl b{display:block;font-size:14.5px;font-weight:600}\n.glance-row .gl span{display:block;font-size:13px;color:#71717a}\n.glance-row .gr{display:flex;align-items:center;gap:10px;color:#71717a}\n.glance-row .gr .ui-ic{width:16px;height:16px}\n.glance-row .gi{display:inline-flex;flex:none;color:#71717a}\n.glance-row .gi .ui-ic{width:20px;height:20px}\n.ui-ic{width:18px;height:18px;flex:none;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}\n.st{display:inline-flex;align-items:center;gap:8px;font-size:13.5px;font-weight:600;white-space:nowrap}\n.st .dot{top:auto;right:auto;width:9px;height:9px;border:0;border-radius:50%;background:transparent;flex:none;position:relative}\n.st-ok{color:#18181b}\n.st-ok .dot{background:currentColor}\n.st-warn{color:#92400e}\n/* Warning colour from the mockup (panel-mock index.html: --tc-color-warning #b35309 light line 34, #fbbd23 dark line 57; .st-warn .dot line 259). */\n.st-warn .dot{background:#b35309;box-shadow:0 0 0 1.5px #fff,0 0 0 2.5px #b35309}\n.st-off,.st-info{color:#71717a}\n.st-off .dot,.st-info .dot{box-shadow:inset 0 0 0 2px currentColor}\n.st-info .dot::after{content:\"\";position:absolute;left:-1px;right:-1px;top:3.5px;height:2px;background:currentColor;transform:rotate(-45deg)}\n.drawer{margin-top:12px;padding:14px 16px;border:1px solid #d4d4d8;border-radius:12px;background:#fafafa}\n.drawer>h3{margin:0 0 8px;font-size:15px;font-weight:600;overflow-wrap:anywhere}\n@media (prefers-color-scheme: dark){\n.glance-row{border-bottom-color:#3f3f46}\n.glance-row .gl span,.glance-row .gr{color:#a1a1aa}\n.drawer{border-color:#3f3f46;background:#151517}\n.st-ok{color:#fafafa}\n.st-warn{color:#fcd34d}\n.st-warn .dot{background:#fbbd23;box-shadow:0 0 0 1.5px #151517,0 0 0 2.5px #fbbd23}\n.st-off,.st-info{color:#a1a1aa}\n}\n";
|
|
9
|
+
/** A `button.action` (44px minimum, from panel-styles). */
|
|
10
|
+
export declare function actionButton(label: string): HTMLButtonElement;
|
|
11
|
+
export interface ConfirmOptions {
|
|
12
|
+
readonly question: string;
|
|
13
|
+
/** The safe action. It is focused by the caller; Enter and Escape take it. */
|
|
14
|
+
readonly cancelLabel: string;
|
|
15
|
+
readonly confirmLabel: string;
|
|
16
|
+
readonly onCancel: () => void;
|
|
17
|
+
readonly onConfirm: () => void;
|
|
18
|
+
}
|
|
19
|
+
export interface ConfirmBox {
|
|
20
|
+
readonly el: HTMLElement;
|
|
21
|
+
/** Focus this after the box is attached. It is the safe action. */
|
|
22
|
+
readonly cancel: HTMLButtonElement;
|
|
23
|
+
readonly confirm: HTMLButtonElement;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Inline confirm for a destructive action. The cancel (safe) action comes first
|
|
27
|
+
* in the DOM and is the one the caller focuses. The box is an alertdialog whose
|
|
28
|
+
* question is its description, so a screen reader reads the question when focus
|
|
29
|
+
* lands on the safe action. Each box gets its own id, so two boxes never collide.
|
|
30
|
+
*/
|
|
31
|
+
export declare function confirmBox(options: ConfirmOptions): ConfirmBox;
|
|
32
|
+
/** Icon paths from the settings mockup's sprite, stroked with currentColor. Static constants only. */
|
|
33
|
+
declare const ICON_PATHS: {
|
|
34
|
+
readonly monitor: "<rect x=\"3\" y=\"4\" width=\"18\" height=\"12\" rx=\"2\"/><path d=\"M8 20h8M12 16v4\"/>";
|
|
35
|
+
readonly sync: "<path d=\"M4 12a8 8 0 0 1 14-5l2 2M20 4v5h-5M20 12a8 8 0 0 1-14 5l-2-2M4 20v-5h5\"/>";
|
|
36
|
+
readonly key: "<circle cx=\"8\" cy=\"15\" r=\"4\"/><path d=\"M11 12l9-9M17 6l3 3M14 9l2 2\"/>";
|
|
37
|
+
readonly nodes: "<circle cx=\"6\" cy=\"6\" r=\"2.5\"/><circle cx=\"18\" cy=\"6\" r=\"2.5\"/><circle cx=\"12\" cy=\"18\" r=\"2.5\"/><path d=\"M8.5 6h7M7.2 8.2l3.6 7.6M16.8 8.2l-3.6 7.6\"/>";
|
|
38
|
+
readonly drive: "<rect x=\"3\" y=\"13\" width=\"18\" height=\"7\" rx=\"2\"/><path d=\"M3 13l3-8h12l3 8M7 16.5h.01\"/>";
|
|
39
|
+
readonly term: "<rect x=\"3\" y=\"4\" width=\"18\" height=\"16\" rx=\"3\"/><path d=\"M7 10l3 2-3 2M13 15h4\"/>";
|
|
40
|
+
readonly chev: "<path d=\"M9 5l7 7-7 7\"/>";
|
|
41
|
+
readonly ext: "<path d=\"M14 4h6v6M20 4l-9 9M18 14v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h5\"/>";
|
|
42
|
+
readonly sidebar: "<rect x=\"3\" y=\"4\" width=\"18\" height=\"16\" rx=\"3\"/><path d=\"M15 4v16\"/>";
|
|
43
|
+
readonly out: "<path d=\"M10 4H5a1 1 0 0 0-1 1v14a1 1 0 0 0 1 1h5M16 8l4 4-4 4M20 12H9\"/>";
|
|
44
|
+
readonly copy: "<rect x=\"9\" y=\"9\" width=\"11\" height=\"11\" rx=\"2\"/><path d=\"M5 15V5a1 1 0 0 1 1-1h10\"/>";
|
|
45
|
+
readonly check: "<path d=\"M5 12l5 5 9-10\"/>";
|
|
46
|
+
readonly warn: "<path d=\"M12 3l10 18H2zM12 10v5M12 18h.01\"/>";
|
|
47
|
+
readonly info: "<circle cx=\"12\" cy=\"12\" r=\"9\"/><path d=\"M12 11v5M12 8h.01\"/>";
|
|
48
|
+
readonly close: "<path d=\"M6 6l12 12M18 6L6 18\"/>";
|
|
49
|
+
readonly person: "<circle cx=\"12\" cy=\"8\" r=\"4\"/><path d=\"M4 21c0-4 4-6 8-6s8 2 8 6\"/>";
|
|
50
|
+
readonly eyeoff: "<path d=\"M3 12s3.5-6 9-6 9 6 9 6-3.5 6-9 6-9-6-9-6zM4 4l16 16\"/>";
|
|
51
|
+
};
|
|
52
|
+
export type IconName = keyof typeof ICON_PATHS;
|
|
53
|
+
/** A decorative 18px icon. The path is a static constant, so innerHTML takes no user input. */
|
|
54
|
+
export declare function icon(name: IconName): SVGSVGElement;
|
|
55
|
+
/** Status text with the mockup dot: solid for ok, ringed for warn, hollow for off, hollow with a slash for info. */
|
|
56
|
+
export declare function statusNode(status: SectionStatus): HTMLSpanElement;
|
|
57
|
+
export interface GlanceRowOptions {
|
|
58
|
+
readonly icon: IconName;
|
|
59
|
+
readonly label: string;
|
|
60
|
+
readonly sublabel: string;
|
|
61
|
+
readonly status?: SectionStatus;
|
|
62
|
+
readonly onOpen: () => void;
|
|
63
|
+
}
|
|
64
|
+
/** One "At a glance" row: icon, label, sublabel, optional status, and a chevron. */
|
|
65
|
+
export declare function glanceRow(options: GlanceRowOptions): HTMLButtonElement;
|
|
66
|
+
export interface DrawerOptions {
|
|
67
|
+
readonly title: string;
|
|
68
|
+
readonly body: readonly Node[];
|
|
69
|
+
readonly closeLabel: string;
|
|
70
|
+
readonly onClose: () => void;
|
|
71
|
+
}
|
|
72
|
+
/** Inline details drawer: a titled region with a close action. */
|
|
73
|
+
export declare function detailsDrawer(options: DrawerOptions): HTMLElement;
|
|
74
|
+
/** Replaces a row's status in place, so a refresh keeps focus on the row. Undefined clears it. */
|
|
75
|
+
export declare function setGlanceStatus(row: HTMLButtonElement, status: SectionStatus | undefined): void;
|
|
76
|
+
export {};
|
|
77
|
+
//# sourceMappingURL=ui.d.ts.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ViewResult } from "../data";
|
|
2
|
+
import type { HostContext } from "../slots";
|
|
3
|
+
/** One status line and one retry, shared by a data-backed section. */
|
|
4
|
+
export interface StateLine {
|
|
5
|
+
readonly status: HTMLParagraphElement;
|
|
6
|
+
readonly retry: HTMLButtonElement;
|
|
7
|
+
}
|
|
8
|
+
/** A paragraph with one class and text. Sections use it for every text line. */
|
|
9
|
+
export declare function textLine(className: string, value: string): HTMLParagraphElement;
|
|
10
|
+
export declare function createStateLine(ctx: HostContext, onRetry: () => void): StateLine;
|
|
11
|
+
/**
|
|
12
|
+
* Shows the loading, permission, or error word for a non-ready result, and the
|
|
13
|
+
* retry button for errors only. Returns the data when the result is ready.
|
|
14
|
+
*/
|
|
15
|
+
export declare function applyResult<T>(line: StateLine, ctx: HostContext, result: ViewResult<T>): T | undefined;
|
|
16
|
+
/** The loading state, for the first paint before any read resolves. */
|
|
17
|
+
export declare function startLoading(line: StateLine, ctx: HostContext): void;
|
|
18
|
+
/**
|
|
19
|
+
* Runs a data read. A rejected or throwing read becomes an error result, so one
|
|
20
|
+
* failing source cannot break the panel.
|
|
21
|
+
*/
|
|
22
|
+
export declare function settle<T>(read: () => Promise<ViewResult<T>>): Promise<ViewResult<T>>;
|
|
23
|
+
//# sourceMappingURL=view-body.d.ts.map
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { PanelClient } from "./slots";
|
|
2
|
+
import type { ToastRequest } from "./toast-store";
|
|
3
|
+
/** Longest a single purge attempt may run before it counts as failed, so a hung host purge cannot hang sign-out. */
|
|
4
|
+
export declare const PURGE_TIMEOUT_MS = 10000;
|
|
5
|
+
/** Why the local copy is still on the device after sign-out. `readable`: its keys may still be in the database. */
|
|
6
|
+
export type PurgeFailure = "pending" | "readable";
|
|
7
|
+
/** What the Local copy section reads and does about an outstanding purge. */
|
|
8
|
+
export interface PurgeWatch {
|
|
9
|
+
/** The outstanding failure, or undefined. Always undefined while a session is signed in. */
|
|
10
|
+
failure(): PurgeFailure | undefined;
|
|
11
|
+
subscribe(cb: () => void): () => void;
|
|
12
|
+
/** One more attempt. Resolves true when the copy is gone. Refuses while signed in. */
|
|
13
|
+
retry(): Promise<boolean>;
|
|
14
|
+
}
|
|
15
|
+
/** The purge watch for a client (wrapped or not) the sign-out guard has seen. */
|
|
16
|
+
export declare function purgeWatch(client: PanelClient | undefined): PurgeWatch | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* Builds the panel's view of a client in which `signOut` removes the local copy after the session ends.
|
|
19
|
+
*
|
|
20
|
+
* Order, which the replica depends on: `signOut()` runs first, so the replica gate is denied and its keys are
|
|
21
|
+
* deleted in the deny transaction; only then does `purgeLocalCopy()` run, whether `signOut` resolved or rejected,
|
|
22
|
+
* and only if the session is actually gone (`!client.signedIn()`). A rejected sign-out that left the session live
|
|
23
|
+
* never purges: a live copy must not be erased. It records the pending state instead, which the section shows
|
|
24
|
+
* once the session is gone. The panel never touches the replica's storage keys and never deletes a database itself.
|
|
25
|
+
* Each purge attempt is raced against `PURGE_TIMEOUT_MS`, so the returned promise always settles and a later
|
|
26
|
+
* sign-out is never blocked behind a hung purge. When the purge fails with `retryNow` (keys may still be in the
|
|
27
|
+
* database) it is retried once at once. A purge that still fails raises a warning toast and leaves a retry in the
|
|
28
|
+
* Local copy section through `purgeWatch`. A `signOut` rejection is rethrown after the purge. The returned promise
|
|
29
|
+
* settles after the purge, so the panel never reports sign-out done while a purge is still running.
|
|
30
|
+
*
|
|
31
|
+
* A purge result is dropped in one case only: a newer purge (a later sign-out or a retry) has started since, and
|
|
32
|
+
* owns the state. A reset never drops a result: app code calling `tc.signOut()` resets the client in its finally,
|
|
33
|
+
* and the copy must still be reported as not removed. The immediate retry runs whenever nobody is signed in. If
|
|
34
|
+
* someone signed in while a purge ran, a failure is only recorded (shown once they sign out) and an ok is dropped.
|
|
35
|
+
*
|
|
36
|
+
* Only calls made through the panel pass through here; `tc.signOut()` called directly does not.
|
|
37
|
+
*/
|
|
38
|
+
export declare function createSignOutGuard(toast: (request: ToastRequest) => unknown): (client: PanelClient | undefined) => PanelClient | undefined;
|
|
39
|
+
//# sourceMappingURL=sign-out-purge.d.ts.map
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal view-slot interface. The only contract the panel sections and
|
|
3
|
+
* always-on parts code against. Panel code never sees TinyCloudWeb.
|
|
4
|
+
*/
|
|
5
|
+
import type { IStorageService } from "@tinycloud/sdk-core";
|
|
6
|
+
import type { AccountInfo, DelegationPage, LocalCopyStatus, LocalNodeState, NodeRow, PanelDataSource, StorageView, ViewResult } from "./data";
|
|
7
|
+
import type { ShellLayout } from "./panel";
|
|
8
|
+
import type { ReceiptRequest } from "./panel-toasts";
|
|
9
|
+
import type { IconName } from "./sections/ui";
|
|
10
|
+
import type { StringKey } from "./strings";
|
|
11
|
+
import type { ToastRequest } from "./toast-store";
|
|
12
|
+
/** Panel sections, in nav order. Ids match the full-page and sidebar mockup. */
|
|
13
|
+
export type SectionId = "account" | "local-tinycloud" | "local-copy" | "delegations" | "nodes" | "storage" | "activity";
|
|
14
|
+
/** Priority order lives in status.ts. */
|
|
15
|
+
export type StatusCode = "storage_full" | "sync_pending" | "sync_attention";
|
|
16
|
+
/** Effective sync state as exposed by the replication facade. */
|
|
17
|
+
export type SyncEffective = "off" | "enabling" | "on" | "wiping" | "pending" | "unavailable";
|
|
18
|
+
export interface SyncState {
|
|
19
|
+
readonly requested: boolean;
|
|
20
|
+
readonly effective: SyncEffective;
|
|
21
|
+
readonly reason?: string;
|
|
22
|
+
}
|
|
23
|
+
/** Open string union: unknown codes are rendered as the neutral line. */
|
|
24
|
+
export type FacadeErrorCode = "declined" | "unsupported" | "failed" | (string & {});
|
|
25
|
+
export interface SyncFacade {
|
|
26
|
+
readonly state: SyncState;
|
|
27
|
+
subscribe(cb: () => void): () => void;
|
|
28
|
+
setEnabled(on: boolean): Promise<void>;
|
|
29
|
+
wipeLocalData(): Promise<void>;
|
|
30
|
+
}
|
|
31
|
+
/** Request-log reader for developer mode (E). Event payload is opaque here. */
|
|
32
|
+
export interface RequestLogReader {
|
|
33
|
+
snapshot(): readonly unknown[];
|
|
34
|
+
subscribe(cb: (event: unknown) => void): () => void;
|
|
35
|
+
onClear(cb: () => void): () => void;
|
|
36
|
+
}
|
|
37
|
+
export interface HostContext {
|
|
38
|
+
client(): PanelClient | undefined;
|
|
39
|
+
onClientChange(cb: () => void): () => void;
|
|
40
|
+
developerMode(): boolean;
|
|
41
|
+
setStatus(source: string, status: StatusCode | null): void;
|
|
42
|
+
/** Status currently shown in the panel header (highest priority), or null. */
|
|
43
|
+
topStatus(): StatusCode | null;
|
|
44
|
+
/** Fires whenever `topStatus()` changes. Returns the unsubscribe function. */
|
|
45
|
+
onStatusChange(cb: () => void): () => void;
|
|
46
|
+
/** False when `ui.toasts` is false. Parts check it before any work that only feeds a toast. */
|
|
47
|
+
toastsEnabled(): boolean;
|
|
48
|
+
/** Returns the toast id, or null when `ui.toasts` is false. */
|
|
49
|
+
toast(t: ToastRequest): string | null;
|
|
50
|
+
/** strings.ts lookup. Unknown codes return the neutral line, never raw text. */
|
|
51
|
+
text(code: string, params?: Readonly<Record<string, string | number>>): string;
|
|
52
|
+
/** App name for the header ("in <app>"). Undefined when the app id is the page fallback. */
|
|
53
|
+
appLabel(): string | undefined;
|
|
54
|
+
/** True when the launcher button exists, so Overview can offer to hide it. */
|
|
55
|
+
canHideButton(): boolean;
|
|
56
|
+
/** Hides the launcher button, persists it, and closes the panel. */
|
|
57
|
+
hideButton(): void;
|
|
58
|
+
}
|
|
59
|
+
/** Views the shell reads for statuses. `account` is read by Overview itself. */
|
|
60
|
+
export interface DataViews {
|
|
61
|
+
readonly localNode: LocalNodeState;
|
|
62
|
+
readonly localCopy: LocalCopyStatus;
|
|
63
|
+
readonly delegations: DelegationPage;
|
|
64
|
+
readonly nodes: readonly NodeRow[];
|
|
65
|
+
readonly storage: StorageView;
|
|
66
|
+
readonly account: AccountInfo;
|
|
67
|
+
}
|
|
68
|
+
export type DataKey = keyof DataViews;
|
|
69
|
+
/**
|
|
70
|
+
* The shell's read cache over `PanelDataSource`. `status(ctx)` is synchronous,
|
|
71
|
+
* so it reads `latest` instead of awaiting the source. The shell fills the
|
|
72
|
+
* cache when the panel opens, on every source change, and each minute while open.
|
|
73
|
+
*/
|
|
74
|
+
export interface SectionData {
|
|
75
|
+
/** The client's data source. Undefined when the host gave none. */
|
|
76
|
+
readonly source: PanelDataSource | undefined;
|
|
77
|
+
/** Last result the shell read for `key`; undefined until the first read settles. Never waits. */
|
|
78
|
+
latest<K extends Exclude<DataKey, "account">>(key: K): ViewResult<DataViews[K]> | undefined;
|
|
79
|
+
/**
|
|
80
|
+
* Account generation: a number that changes on every reset (sign-out, account switch, client change).
|
|
81
|
+
* Capture it before any await whose result is keyed by account and discard the result if it changed.
|
|
82
|
+
*/
|
|
83
|
+
generation(): number;
|
|
84
|
+
/** Milliseconds since `latest(key)` settled; undefined when it never has. */
|
|
85
|
+
age(key: Exclude<DataKey, "account">): number | undefined;
|
|
86
|
+
/** Re-reads one view, or all of them. Resolves once the cache holds the new results. */
|
|
87
|
+
refresh(key?: Exclude<DataKey, "account">): Promise<void>;
|
|
88
|
+
/** Calls `listener` after any cached result changes. Returns the unsubscribe function. */
|
|
89
|
+
subscribe(listener: () => void): () => void;
|
|
90
|
+
}
|
|
91
|
+
/** Visible state of a one-line status. `info` is neutral: checking, needs permission, unavailable. */
|
|
92
|
+
export type StatusTone = "ok" | "warn" | "off" | "info";
|
|
93
|
+
/**
|
|
94
|
+
* What a section says about itself in the At-a-glance rows and on the page rail.
|
|
95
|
+
* The rail shows `count ?? text`; the glance row shows `text` with its tone dot.
|
|
96
|
+
*/
|
|
97
|
+
export interface SectionStatus {
|
|
98
|
+
readonly text: string;
|
|
99
|
+
readonly tone: StatusTone;
|
|
100
|
+
readonly count?: string;
|
|
101
|
+
}
|
|
102
|
+
export interface ConfirmRequest {
|
|
103
|
+
readonly question: string;
|
|
104
|
+
/** The safe action. It takes focus, and Enter and Escape take it. */
|
|
105
|
+
readonly cancelLabel: string;
|
|
106
|
+
readonly confirmLabel: string;
|
|
107
|
+
/** The box is inserted after this element. Default: the end of the section. */
|
|
108
|
+
readonly anchor?: HTMLElement;
|
|
109
|
+
/** Runs after the safe action or Escape. The box is already closed. */
|
|
110
|
+
readonly onCancel?: () => void;
|
|
111
|
+
/** Runs on the destructive action. The box stays until `close()`. */
|
|
112
|
+
readonly onConfirm: () => void;
|
|
113
|
+
}
|
|
114
|
+
export interface ConfirmHandle {
|
|
115
|
+
readonly cancel: HTMLButtonElement;
|
|
116
|
+
readonly confirm: HTMLButtonElement;
|
|
117
|
+
close(): void;
|
|
118
|
+
}
|
|
119
|
+
export interface DrawerRequest {
|
|
120
|
+
readonly title: string;
|
|
121
|
+
readonly body: readonly Node[];
|
|
122
|
+
readonly closeLabel: string;
|
|
123
|
+
/** The drawer is inserted after this element. Default: the end of the section. */
|
|
124
|
+
readonly anchor?: HTMLElement;
|
|
125
|
+
/** Runs after the drawer closes. */
|
|
126
|
+
readonly onClose?: () => void;
|
|
127
|
+
}
|
|
128
|
+
export interface DrawerHandle {
|
|
129
|
+
readonly el: HTMLElement;
|
|
130
|
+
close(): void;
|
|
131
|
+
}
|
|
132
|
+
/** Context the panel shell gives sections. Only the lazy shell builds it. */
|
|
133
|
+
export interface SectionContext extends HostContext {
|
|
134
|
+
/** Closes the panel. Focus returns to the launcher when the shell owned it. */
|
|
135
|
+
closePanel(): void;
|
|
136
|
+
/** Opens a section in the panel. Used by At-a-glance rows. */
|
|
137
|
+
openSection(id: SectionId): void;
|
|
138
|
+
/** Shows a receipt slip (title, identifiers, Copy receipt). False when toasts are off or the same receipt is already up. */
|
|
139
|
+
receipt(request: ReceiptRequest): boolean;
|
|
140
|
+
/** Read cache over the client's data source. */
|
|
141
|
+
readonly data: SectionData;
|
|
142
|
+
/** Layout the panel is in now. Read at mount; the shell remounts the section when it changes. */
|
|
143
|
+
layout(): ShellLayout;
|
|
144
|
+
/** Sections the panel offers right now, in nav order, Overview included. */
|
|
145
|
+
sections(): readonly PanelSection[];
|
|
146
|
+
/** Repaints statuses (page rail, At a glance) after a change the data source did not announce. Does not remount the section. */
|
|
147
|
+
requestRender(): void;
|
|
148
|
+
/** Inline confirm for a destructive action; the safe action takes focus. */
|
|
149
|
+
confirm(request: ConfirmRequest): ConfirmHandle;
|
|
150
|
+
/** Inline details drawer. */
|
|
151
|
+
openDrawer(request: DrawerRequest): DrawerHandle;
|
|
152
|
+
}
|
|
153
|
+
/** A body section in the panel. Mounted only while the panel is open and `isAvailable`. */
|
|
154
|
+
export interface PanelSection {
|
|
155
|
+
readonly id: SectionId;
|
|
156
|
+
/** strings.ts key for the title: the nav label and the rail text. */
|
|
157
|
+
readonly labelCode: StringKey;
|
|
158
|
+
/** Icon on the full-page rail and the At-a-glance row. */
|
|
159
|
+
readonly icon: IconName;
|
|
160
|
+
/** Panel string code for the one-line description under the title on Overview. Undefined: no row for this section. */
|
|
161
|
+
readonly summaryCode?: string;
|
|
162
|
+
isAvailable(ctx: HostContext): boolean;
|
|
163
|
+
/** Synchronous read of what the section knows from `ctx.data`. Undefined shows nothing. */
|
|
164
|
+
status(ctx: SectionContext): SectionStatus | undefined;
|
|
165
|
+
/** Renders the body into `el`. Returns dispose. May touch only `el`. */
|
|
166
|
+
mount(el: HTMLElement, ctx: SectionContext): () => void;
|
|
167
|
+
}
|
|
168
|
+
/** Always-on part. Runs while the client is registered, even with the panel closed and button hidden. */
|
|
169
|
+
export interface HostPart {
|
|
170
|
+
readonly id: "toasts" | "prompts" | "storage-watch" | "sync-status";
|
|
171
|
+
/** Returns stop. */
|
|
172
|
+
start(ctx: HostContext, layer: HTMLElement): () => void;
|
|
173
|
+
}
|
|
174
|
+
/** Authority kinds a client can be asked for. The bridge is internal; views without it show a neutral line. */
|
|
175
|
+
export type AuthorityKind = "kv/sync" | "space/info" | "delegation/list" | "space/list";
|
|
176
|
+
/**
|
|
177
|
+
* Outcome of `purgeLocalCopy`. `retryNow` is true when the replica keys may still be in the database
|
|
178
|
+
* (deny outcome marker or unguarded), so the copy may still be readable and one immediate retry is worthwhile.
|
|
179
|
+
*/
|
|
180
|
+
export type PurgeLocalCopyResult = {
|
|
181
|
+
readonly ok: true;
|
|
182
|
+
} | {
|
|
183
|
+
readonly ok: false;
|
|
184
|
+
readonly retryNow: boolean;
|
|
185
|
+
};
|
|
186
|
+
/** Narrow adapter built by ui/client.ts from TinyCloudWeb. */
|
|
187
|
+
export interface PanelClient {
|
|
188
|
+
readonly id: number;
|
|
189
|
+
signedIn(): boolean;
|
|
190
|
+
/** Sign-out or account switch. */
|
|
191
|
+
onReset(cb: () => void): () => void;
|
|
192
|
+
/** = tc.sync when present. */
|
|
193
|
+
readonly sync?: SyncFacade | undefined;
|
|
194
|
+
readonly storage: Pick<IStorageService, "status">;
|
|
195
|
+
/** Storage episode view. Undefined when the client does not expose it. `subscribeDelegated` fires once per delegated owner found full. */
|
|
196
|
+
readonly storageEpisode?: {
|
|
197
|
+
current(): unknown;
|
|
198
|
+
subscribe(cb: () => void): () => void;
|
|
199
|
+
subscribeDelegated(cb: () => void): () => void;
|
|
200
|
+
} | undefined;
|
|
201
|
+
/** Authority request for storage and sync prompts. Undefined when the client does not expose it. */
|
|
202
|
+
readonly requestAuthority?: ((kind: AuthorityKind) => Promise<{
|
|
203
|
+
approved: boolean;
|
|
204
|
+
code?: FacadeErrorCode;
|
|
205
|
+
}>) | undefined;
|
|
206
|
+
/** E: request log, present only in developer mode. */
|
|
207
|
+
readonly requests?: RequestLogReader | undefined;
|
|
208
|
+
/** Panel data for the views. Undefined unless the host supplied a data factory (harness or preview); production panels show placeholders. */
|
|
209
|
+
readonly data?: PanelDataSource | undefined;
|
|
210
|
+
/** Signs out of the TinyCloud session. Undefined when the host cannot sign out; Overview then omits the control. */
|
|
211
|
+
readonly signOut?: (() => Promise<void>) | undefined;
|
|
212
|
+
/**
|
|
213
|
+
* Removes the local copy from this browser after sign-out. Supplied by the host app or the SDK; the panel
|
|
214
|
+
* only calls it, after `signOut` has settled. Undefined: nothing to purge.
|
|
215
|
+
*/
|
|
216
|
+
readonly purgeLocalCopy?: (() => Promise<PurgeLocalCopyResult>) | undefined;
|
|
217
|
+
}
|
|
218
|
+
//# sourceMappingURL=slots.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { StatusCode, SyncEffective } from "./slots";
|
|
2
|
+
/** Highest priority first. The button dot and panel header show the first status present. */
|
|
3
|
+
export declare const STATUS_PRIORITY: readonly StatusCode[];
|
|
4
|
+
/** Unknown effective values are treated as `unavailable`. */
|
|
5
|
+
export declare function normalizeSyncEffective(value: unknown): SyncEffective;
|
|
6
|
+
/** Status for the sync section: pending always; unavailable only when the user asked for sync. */
|
|
7
|
+
export declare function syncStatus(effective: unknown, requested: boolean): StatusCode | null;
|
|
8
|
+
export declare function highestStatus(statuses: Iterable<StatusCode | null>): StatusCode | null;
|
|
9
|
+
/**
|
|
10
|
+
* Per-source status. `onChange` fires only when the highest-priority status changes.
|
|
11
|
+
*/
|
|
12
|
+
export declare function createStatusBoard(onChange: (top: StatusCode | null) => void): {
|
|
13
|
+
set(source: string, status: StatusCode | null): void;
|
|
14
|
+
top(): StatusCode | null;
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=status.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { StorageStatus } from "@tinycloud/sdk-core";
|
|
2
|
+
/**
|
|
3
|
+
* Pure checks the Storage page, the storage-full part and the live adapter share. No DOM, no strings.
|
|
4
|
+
* An untrusted body is a status only when every number is a non-negative safe integer and the state is known.
|
|
5
|
+
*/
|
|
6
|
+
/** The `manageUrl` in a status value, if it is https. The constant otherwise. */
|
|
7
|
+
export declare function manageHrefFor(value: unknown): string;
|
|
8
|
+
/** Failure codes that mean this node cannot report usage at all, so retrying will not help. */
|
|
9
|
+
export declare function isUnavailableCode(code: string): boolean;
|
|
10
|
+
/** Narrow an untrusted body to a usable status; anything else is unavailable. */
|
|
11
|
+
export declare function isStorageStatus(value: unknown): value is StorageStatus;
|
|
12
|
+
//# sourceMappingURL=storage-state.d.ts.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shell copy: the layout switch, toasts, and the three words every status can
|
|
3
|
+
* show. Lazy: only the panel chunk imports this, so the launcher bundle never
|
|
4
|
+
* carries these keys. Launcher and legacy section keys stay in strings.ts.
|
|
5
|
+
* Each section owns its own strings in `sections/<id>.strings.ts` and
|
|
6
|
+
* registers them here with `registerPanelStrings`.
|
|
7
|
+
*/
|
|
8
|
+
declare const PANEL_STRINGS: {
|
|
9
|
+
readonly "panel.full_page": "Open full page";
|
|
10
|
+
readonly "panel.sidebar": "Show as sidebar";
|
|
11
|
+
readonly "toast.dismiss": "Dismiss";
|
|
12
|
+
readonly "toast.copy_receipt": "Copy receipt";
|
|
13
|
+
readonly "toast.copied": "Copied";
|
|
14
|
+
readonly "toast.copy_failed": "Couldn't copy. Select the text and copy it by hand.";
|
|
15
|
+
readonly "section.status.checking": "Checking";
|
|
16
|
+
readonly "section.status.needs_permission": "Needs permission";
|
|
17
|
+
readonly "section.status.unavailable": "Unavailable";
|
|
18
|
+
};
|
|
19
|
+
export type PanelStringKey = keyof typeof PANEL_STRINGS;
|
|
20
|
+
/**
|
|
21
|
+
* The one merge point for section copy. A section calls it once, at module
|
|
22
|
+
* load, with its own table. Keys start with the section id and must not reuse
|
|
23
|
+
* a key from strings.ts or another section (tests/ui/section-contract.test.ts checks).
|
|
24
|
+
*/
|
|
25
|
+
export declare function registerPanelStrings(table: Readonly<Record<string, string>>): void;
|
|
26
|
+
/** Panel lookup: shell table, then section tables, then the launcher table, then the neutral line. */
|
|
27
|
+
export declare function panelText(code: string, params?: Readonly<Record<string, string | number>>): string;
|
|
28
|
+
export {};
|
|
29
|
+
//# sourceMappingURL=strings-panel.d.ts.map
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* All panel, button, and toast copy. Rendered only through lookup by code.
|
|
3
|
+
* Reason and error codes from the SDK never render as raw text.
|
|
4
|
+
*/
|
|
5
|
+
export declare const STRINGS: {
|
|
6
|
+
readonly "panel.title": "TinyCloud";
|
|
7
|
+
readonly "panel.close": "Close";
|
|
8
|
+
readonly "panel.hide": "Hide button";
|
|
9
|
+
readonly "panel.sections": "Sections";
|
|
10
|
+
readonly "panel.in": "in";
|
|
11
|
+
readonly "panel.back": "Back to";
|
|
12
|
+
readonly "section.placeholder": "Not available yet.";
|
|
13
|
+
readonly "view.loading": "Loading…";
|
|
14
|
+
readonly "view.error": "This didn't load.";
|
|
15
|
+
readonly "view.retry": "Try again";
|
|
16
|
+
readonly "view.permission": "This session can't show this yet.";
|
|
17
|
+
readonly "nodes.kind.hosted": "Hosted";
|
|
18
|
+
readonly "nodes.status.down": "Down";
|
|
19
|
+
readonly "nodes.version": "Version";
|
|
20
|
+
readonly "nodes.latency": "Latency";
|
|
21
|
+
readonly "activity.empty": "No requests yet.";
|
|
22
|
+
readonly "nav.account": "Overview";
|
|
23
|
+
readonly "nav.local-tinycloud": "Local TinyCloud";
|
|
24
|
+
readonly "nav.local-copy": "Local copy";
|
|
25
|
+
readonly "nav.delegations": "Delegations";
|
|
26
|
+
readonly "nav.nodes": "Nodes";
|
|
27
|
+
readonly "nav.storage": "Storage";
|
|
28
|
+
readonly "nav.activity": "Activity";
|
|
29
|
+
readonly "button.aria": "TinyCloud settings";
|
|
30
|
+
readonly "status.storage_full": "Storage is full";
|
|
31
|
+
readonly "status.sync_pending": "Erase not confirmed";
|
|
32
|
+
readonly "status.sync_attention": "Local copy needs attention";
|
|
33
|
+
readonly "storage.state.full": "Storage is full";
|
|
34
|
+
readonly "storage.declined": "You declined. Storage usage stays hidden.";
|
|
35
|
+
readonly "storage.try_again": "Try again";
|
|
36
|
+
readonly "storage.unavailable": "Storage usage isn't available here.";
|
|
37
|
+
readonly "storage.manage": "Manage storage";
|
|
38
|
+
readonly "storage.full": "Storage is full. Free up space or upgrade to keep saving.";
|
|
39
|
+
readonly "sync.wipe.note": "Erases TinyCloud's copy on this device. Your data stays on your TinyCloud; the app's own files are not touched.";
|
|
40
|
+
readonly "sync.error.declined": "You declined. The local copy stays off.";
|
|
41
|
+
readonly "sync.error.unsupported": "This browser can't keep a local copy.";
|
|
42
|
+
readonly "sync.error.failed": "That didn't work. Try again.";
|
|
43
|
+
readonly "sync.reason.unsupported-browser": "This browser can't keep a local copy.";
|
|
44
|
+
readonly "sync.reason.no-eligible-scope": "No space on this TinyCloud account can keep a local copy.";
|
|
45
|
+
readonly "sync.reason.consent-declined": "You declined. The local copy stays off.";
|
|
46
|
+
readonly "sync.reason.storage-blocked": "This browser blocks the storage the local copy needs.";
|
|
47
|
+
readonly "sync.reason.erase-pending": "The last erase is not confirmed yet.";
|
|
48
|
+
readonly "sync.reason.budget-reached": "This device's local copy has reached its size limit.";
|
|
49
|
+
readonly "sync.reason.signed-out": "Sign in to use the local copy.";
|
|
50
|
+
readonly "sync.reason.stale-tab": "Another tab changed this. Reload to continue.";
|
|
51
|
+
readonly "sync.reason.wipe-failed": "Erase didn't finish. The local copy may still be on this device.";
|
|
52
|
+
readonly "sync.reason.session-expired": "Your session expired. Sign in again.";
|
|
53
|
+
readonly "sync.reason.unknown": "Something went wrong with the local copy.";
|
|
54
|
+
readonly "toast.done": "Done";
|
|
55
|
+
readonly "toast.signed_in": "Successfully signed in";
|
|
56
|
+
readonly "toast.attention": "Something needs your attention. Details are in the console.";
|
|
57
|
+
readonly "toast.error_generic": "Something went wrong.";
|
|
58
|
+
readonly "toast.unexpected_error": "An unexpected error occurred. Try refreshing the page.";
|
|
59
|
+
readonly "toast.space_created": "TinyCloud Space created successfully";
|
|
60
|
+
readonly "toast.space_creation_timeout": "Setting up your TinyCloud Space timed out";
|
|
61
|
+
readonly "toast.space_creation_failed": "Failed to create your TinyCloud Space";
|
|
62
|
+
readonly "toast.error.auth.wallet_not_connected": "Please connect your wallet to continue";
|
|
63
|
+
readonly "toast.error.auth.signature_rejected": "Signature was rejected. Please try again";
|
|
64
|
+
readonly "toast.error.auth.chain_mismatch": "Please switch to the correct network";
|
|
65
|
+
readonly "toast.error.storage.upload_failed": "Failed to upload file. Please check your connection";
|
|
66
|
+
readonly "toast.error.storage.insufficient_space": "Insufficient storage space available";
|
|
67
|
+
readonly "toast.error.storage.permission_denied": "Permission denied. Please check your access rights";
|
|
68
|
+
readonly "toast.error.network.connection_failed": "Network connection failed. Please try again";
|
|
69
|
+
readonly "toast.error.network.timeout": "Request timed out. Please try again";
|
|
70
|
+
readonly "toast.error.wasm.initialization_failed": "Failed to initialize security module";
|
|
71
|
+
};
|
|
72
|
+
export type StringKey = keyof typeof STRINGS;
|
|
73
|
+
export declare function hasString(key: string): key is StringKey;
|
|
74
|
+
/** Lookup by code. Unknown codes return the neutral line, never the raw code. */
|
|
75
|
+
export declare function text(code: string): string;
|
|
76
|
+
//# sourceMappingURL=strings.d.ts.map
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stub panel data for preview and tests. Every value is labelled `source: "stub"`,
|
|
3
|
+
* except the local-copy state, which is read from the client's sync facade.
|
|
4
|
+
*
|
|
5
|
+
* Preview and tests only. The SDK real path never imports this module (TC-1749).
|
|
6
|
+
*/
|
|
7
|
+
import type { DelegationRow, LocalCopyStatus, LocalNodeState, NodeRow, PanelDataFactory, StorageView, ViewResult } from "../data";
|
|
8
|
+
/**
|
|
9
|
+
* Per-view stub overrides, so a preview or e2e spec can reach states the defaults never produce.
|
|
10
|
+
* One optional field per section; a missing field keeps that section's default.
|
|
11
|
+
*/
|
|
12
|
+
export interface StubSeed {
|
|
13
|
+
storage?: ViewResult<StorageView>;
|
|
14
|
+
nodes?: ViewResult<readonly NodeRow[]>;
|
|
15
|
+
delegations?: StubDelegationsSeed;
|
|
16
|
+
/**
|
|
17
|
+
* Local TinyCloud state. Default: off. Enabling moves off -> looking -> found,
|
|
18
|
+
* or -> not-found when this is `not-found`.
|
|
19
|
+
*/
|
|
20
|
+
localNode?: LocalNodeState;
|
|
21
|
+
/** Local copy status. Replaces the default (a settled copy that follows the sync facade). */
|
|
22
|
+
readonly localCopy?: LocalCopyStatus;
|
|
23
|
+
}
|
|
24
|
+
export declare function createStubPanelData(seed?: StubSeed): PanelDataFactory;
|
|
25
|
+
/** A delegation row as a JSON seed: dates are ISO strings, and `source` is always "stub". */
|
|
26
|
+
export type StubDelegationRowSeed = Omit<DelegationRow, "source" | "issuedAt" | "notBefore" | "expiresAt" | "revokedAt"> & {
|
|
27
|
+
readonly issuedAt?: string | null;
|
|
28
|
+
readonly notBefore?: string | null;
|
|
29
|
+
readonly expiresAt?: string | null;
|
|
30
|
+
readonly revokedAt?: string | null;
|
|
31
|
+
};
|
|
32
|
+
/** Delegations a preview or test can pin. Absent fields keep the one-row default. */
|
|
33
|
+
export interface StubDelegationsSeed {
|
|
34
|
+
/** The read state of the first page. Default: ready. */
|
|
35
|
+
readonly state?: "ready" | "loading" | "needs-permission" | "error";
|
|
36
|
+
readonly rows?: readonly StubDelegationRowSeed[];
|
|
37
|
+
readonly nextCursor?: string;
|
|
38
|
+
/** Pages after the first, by the cursor that reads them. */
|
|
39
|
+
readonly pages?: Readonly<Record<string, {
|
|
40
|
+
readonly rows: readonly StubDelegationRowSeed[];
|
|
41
|
+
readonly nextCursor?: string;
|
|
42
|
+
}>>;
|
|
43
|
+
/** Failure code `revoke(cid)` returns for a CID, with the row left as it is. */
|
|
44
|
+
readonly revokeFails?: Readonly<Record<string, string>>;
|
|
45
|
+
/** Milliseconds `revoke` waits before it answers. */
|
|
46
|
+
readonly revokeDelayMs?: number;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Launcher stylesheet for the open shadow root. Eager: the only CSS the root
|
|
3
|
+
* injects before the panel loads. Panel rules live in panel-styles.ts and
|
|
4
|
+
* ship in the lazy panel chunk. One inline string, no fonts, no
|
|
5
|
+
* adoptedStyleSheets. Neutral palette only. Offsets are CSS custom properties
|
|
6
|
+
* so an app can reserve space without an API.
|
|
7
|
+
*/
|
|
8
|
+
export declare const HOST_CSS = "\n[hidden]{display:none!important}\n.layer{--b:calc(env(safe-area-inset-bottom,0px) + var(--tinycloud-ui-offset-bottom,12px));position:fixed;inset:0;pointer-events:none;font:14px/1.4 system-ui,-apple-system,\"Segoe UI\",sans-serif;color:#111827}\n.button{position:fixed;bottom:var(--b);width:44px;height:44px;padding:0;display:inline-flex;align-items:center;justify-content:center;border:1px solid #71717a;border-radius:50%;background:#fff;color:#111827;box-shadow:0 1px 3px rgba(0,0,0,.16);cursor:pointer;pointer-events:auto}\n.button svg{width:20px;height:20px}\n.button:focus-visible{outline:2px solid #111827;outline-offset:2px;box-shadow:0 0 0 6px #fafafa}\n.dot{position:absolute;top:6px;right:6px;width:8px;height:8px;border-radius:50%;background:#4b5563;border:2px solid #fff}\n.layer[data-position=\"bottom-right\"] .button{right:var(--tinycloud-ui-offset-inline,12px)}\n.layer[data-position=\"bottom-left\"] .button{left:var(--tinycloud-ui-offset-inline,12px)}\n.layer[data-position=\"bottom-center\"] .button{left:50%;transform:translateX(-50%)}\n.pending{position:fixed;top:0;bottom:0;right:0;box-sizing:border-box;width:min(420px,100%);padding:20px;overflow:auto;border-left:1px solid #e4e4e7;background:#fff;color:#111827;box-shadow:-18px 0 48px -18px rgba(0,0,0,.35);pointer-events:auto}\n.layer[data-position=\"bottom-left\"] .pending{right:auto;left:0;border-left:0;border-right:1px solid #e4e4e7}\n.pending p{margin:0 0 12px;color:#71717a}\n.pending button{min-height:44px;padding:0 16px;border:1px solid #71717a;border-radius:12px;background:transparent;color:inherit;font:inherit;cursor:pointer}\n.pending button:focus-visible{outline:2px solid #111827;outline-offset:2px;box-shadow:0 0 0 6px #fafafa}\n@media (prefers-color-scheme: dark){\n.layer{color:#fafafa}\n.button{border-color:#71717a;background:#151517;color:#fafafa}\n.button:focus-visible{outline-color:#fafafa;box-shadow:0 0 0 6px #111827}\n.dot{background:#a1a1aa;border-color:#151517}\n.pending{border-left-color:#69696b;background:#151517;color:#fafafa;box-shadow:-18px 0 48px -18px rgba(0,0,0,.6)}\n.layer[data-position=\"bottom-left\"] .pending{border-right-color:#69696b}\n.pending p{color:#a1a1aa}\n.pending button:focus-visible{outline-color:#fafafa;box-shadow:0 0 0 6px #111827}\n}\n";
|
|
9
|
+
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Toast queue for the always-on toasts part. Pure state, no DOM: the part
|
|
3
|
+
* subscribes and renders. Text is a strings.ts code, never raw text.
|
|
4
|
+
*/
|
|
5
|
+
export type ToastKind = "info" | "success" | "warning" | "error";
|
|
6
|
+
export interface ToastRequest {
|
|
7
|
+
readonly kind: ToastKind;
|
|
8
|
+
/** A launcher code, or a panel or section code when the panel raises the toast. Unknown codes render the neutral line. */
|
|
9
|
+
readonly textCode: string;
|
|
10
|
+
readonly href?: string;
|
|
11
|
+
readonly hrefLabelCode?: string;
|
|
12
|
+
}
|
|
13
|
+
/** Delivers a toast to the page's host. Returns false when nothing was shown. */
|
|
14
|
+
export type ToastSink = (request: ToastRequest) => boolean;
|
|
15
|
+
export interface ToastView {
|
|
16
|
+
readonly id: string;
|
|
17
|
+
readonly kind: ToastKind;
|
|
18
|
+
readonly textCode: string;
|
|
19
|
+
/** Present only when it is an absolute https URL. */
|
|
20
|
+
readonly href?: string;
|
|
21
|
+
readonly hrefLabelCode?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface ToastStoreOptions {
|
|
24
|
+
/** Auto-dismiss delay per toast. Default 7000. */
|
|
25
|
+
readonly durationMs?: number;
|
|
26
|
+
/** Oldest toasts are dropped past this count. Default 3. */
|
|
27
|
+
readonly maxVisible?: number;
|
|
28
|
+
}
|
|
29
|
+
export interface ToastStore {
|
|
30
|
+
/**
|
|
31
|
+
* Returns the toast id. A request identical to a visible toast (same kind,
|
|
32
|
+
* text code, and link) returns that toast's id and shows nothing new; that
|
|
33
|
+
* toast keeps its original owner.
|
|
34
|
+
*/
|
|
35
|
+
push(request: ToastRequest, owner?: number): string;
|
|
36
|
+
dismiss(id: string): void;
|
|
37
|
+
/** Removes every toast pushed with `owner`. Ownerless toasts are untouched. */
|
|
38
|
+
clearOwner(owner: number): void;
|
|
39
|
+
/** Ref-counted hold: auto-dismiss stops while any hold is outstanding. */
|
|
40
|
+
pause(): void;
|
|
41
|
+
resume(): void;
|
|
42
|
+
/** Calls `listener` with the current list immediately, then on every change. */
|
|
43
|
+
subscribe(listener: (toasts: readonly ToastView[]) => void): () => void;
|
|
44
|
+
}
|
|
45
|
+
export declare function createToastStore(options?: ToastStoreOptions): ToastStore;
|
|
46
|
+
//# sourceMappingURL=toast-store.d.ts.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { PermissionAbility, ViewResult } from "./data";
|
|
2
|
+
export declare function viewLoading<T>(): ViewResult<T>;
|
|
3
|
+
export declare function viewReady<T>(data: T): ViewResult<T>;
|
|
4
|
+
export declare function viewNeedsPermission<T>(ability: PermissionAbility): ViewResult<T>;
|
|
5
|
+
export declare function viewError<T>(code: string): ViewResult<T>;
|
|
6
|
+
//# sourceMappingURL=view-result.d.ts.map
|