@tinycloud/web-sdk 3.7.0-beta.1 → 3.7.0-beta.3
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/credentials.cjs +1 -1
- package/dist/credentials.mjs +1 -1
- 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,12 @@
|
|
|
1
|
+
import type { PanelDataHost, PanelDataSource } from "../data";
|
|
2
|
+
import type { PanelClient } from "../slots";
|
|
3
|
+
/**
|
|
4
|
+
* Live panel data. Every read is stale-while-revalidate per section:
|
|
5
|
+
* - no snapshot: await one attempt;
|
|
6
|
+
* - fresh snapshot (within TTL): return it;
|
|
7
|
+
* - stale snapshot: return it now and refresh in the background.
|
|
8
|
+
* A failed refresh keeps the previous ready snapshot. Reset (sign-out or
|
|
9
|
+
* account switch) drops all snapshots and discards in-flight results.
|
|
10
|
+
*/
|
|
11
|
+
export declare function createRealPanelData(host: PanelDataHost, client: PanelClient, appName: string): PanelDataSource;
|
|
12
|
+
//# sourceMappingURL=real.d.ts.map
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Data contract for the settings panel shell (TC-848 P1).
|
|
3
|
+
*
|
|
4
|
+
* Types only. No behaviour lives in this module.
|
|
5
|
+
*
|
|
6
|
+
* Source tags:
|
|
7
|
+
* - `source` on a record: `"real"` when read from an SDK accessor that exists
|
|
8
|
+
* today, `"stub"` for labelled placeholders, `"derived"` for values computed
|
|
9
|
+
* from real fields.
|
|
10
|
+
* - `fieldSources` on a record: per-field override for partially real records.
|
|
11
|
+
* Absent means every field carries the record's `source`.
|
|
12
|
+
*
|
|
13
|
+
* Panel code reads these shapes through a `PanelDataSource`. It never reads
|
|
14
|
+
* TinyCloudWeb directly.
|
|
15
|
+
*/
|
|
16
|
+
import type { AccountDelegationRecord, AccountService, AccountStatus, DelegationManager, IStorageService, StorageStatus, StorageUsage } from "@tinycloud/sdk-core";
|
|
17
|
+
import type { PanelClient, SyncState } from "./slots";
|
|
18
|
+
export type DataSource = "real" | "stub" | "derived";
|
|
19
|
+
/** Per-field source for records that mix real and stub fields. */
|
|
20
|
+
export type FieldSources = Readonly<Record<string, DataSource>>;
|
|
21
|
+
/** Common source metadata on every record the panel renders. */
|
|
22
|
+
export interface Tagged {
|
|
23
|
+
readonly source: DataSource;
|
|
24
|
+
readonly fieldSources?: FieldSources;
|
|
25
|
+
}
|
|
26
|
+
export declare const PANEL_VIEWS: readonly ["overview", "local", "copy", "delegations", "nodes", "storage", "activity"];
|
|
27
|
+
export type PanelView = (typeof PANEL_VIEWS)[number];
|
|
28
|
+
/** `#/panel[/view]` renders the drawer; `#/page[/view]` renders the full page. */
|
|
29
|
+
export type PanelLayout = "panel" | "page";
|
|
30
|
+
export interface PanelRoute {
|
|
31
|
+
readonly layout: PanelLayout;
|
|
32
|
+
readonly view: PanelView;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Capabilities the panel may ask the user to allow. Names match the SDK
|
|
36
|
+
* capability strings without the `tinycloud.` prefix.
|
|
37
|
+
*/
|
|
38
|
+
export type PermissionAbility = "delegation/list" | "space/info" | "space/list";
|
|
39
|
+
/** Read freshness, attached to ready results by the live adapter. */
|
|
40
|
+
export interface Freshness {
|
|
41
|
+
/** When the shown data was last read successfully (epoch ms). */
|
|
42
|
+
readonly updatedAt: number;
|
|
43
|
+
/** A refresh is in flight. */
|
|
44
|
+
readonly refreshing: boolean;
|
|
45
|
+
/** Code of the last refresh that failed. Cleared by the next success. */
|
|
46
|
+
readonly lastError?: string;
|
|
47
|
+
}
|
|
48
|
+
export type ViewResult<T> = {
|
|
49
|
+
readonly state: "loading";
|
|
50
|
+
} | {
|
|
51
|
+
readonly state: "ready";
|
|
52
|
+
readonly data: T;
|
|
53
|
+
readonly freshness?: Freshness;
|
|
54
|
+
} | {
|
|
55
|
+
readonly state: "needs-permission";
|
|
56
|
+
readonly ability: PermissionAbility;
|
|
57
|
+
} | {
|
|
58
|
+
readonly state: "error";
|
|
59
|
+
readonly code: string;
|
|
60
|
+
};
|
|
61
|
+
/** Result of a write action (toggle, revoke). */
|
|
62
|
+
export type ActionResult = {
|
|
63
|
+
readonly ok: true;
|
|
64
|
+
} | {
|
|
65
|
+
readonly ok: false;
|
|
66
|
+
readonly code: string;
|
|
67
|
+
};
|
|
68
|
+
export interface AccountInfo extends Tagged, Omit<AccountStatus, "applications" | "spaces"> {
|
|
69
|
+
/** Indexed application count. Absent while the account index does not exist yet: unknown, never 0. */
|
|
70
|
+
readonly applications?: number;
|
|
71
|
+
/** Indexed space count. Absent while the account index does not exist yet: unknown, never 0. */
|
|
72
|
+
readonly spaces?: number;
|
|
73
|
+
/** ENS name when one resolves. No SDK source today, so absent or stub. */
|
|
74
|
+
readonly displayName?: string;
|
|
75
|
+
/** Stub: no public getter for session expiry. */
|
|
76
|
+
readonly sessionExpiresAt?: Date;
|
|
77
|
+
/** Name of the app this panel is running inside. */
|
|
78
|
+
readonly appName: string;
|
|
79
|
+
/** Host of the app origin, when the app is embedded. */
|
|
80
|
+
readonly appHost?: string;
|
|
81
|
+
}
|
|
82
|
+
export type LocalNodeConnection = "off" | "looking" | "found" | "not-found" | "unavailable";
|
|
83
|
+
export interface LocalNodeState extends Tagged {
|
|
84
|
+
/** Stub today. */
|
|
85
|
+
readonly connection: LocalNodeConnection;
|
|
86
|
+
readonly url?: string;
|
|
87
|
+
readonly identity?: {
|
|
88
|
+
readonly origin: string;
|
|
89
|
+
readonly nodeDid: string;
|
|
90
|
+
};
|
|
91
|
+
/** Stub until the node reports its version. */
|
|
92
|
+
readonly version?: string;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* One replicated folder. `items`, `bytes` and `waiting` are STUB in P1: no real
|
|
96
|
+
* per-folder status read exists yet (W4). Real records leave them absent.
|
|
97
|
+
*/
|
|
98
|
+
export interface LocalFolder {
|
|
99
|
+
readonly prefix: string;
|
|
100
|
+
readonly state: "syncing" | "ok" | "paused";
|
|
101
|
+
readonly items?: number;
|
|
102
|
+
readonly bytes?: number;
|
|
103
|
+
readonly waiting?: number;
|
|
104
|
+
}
|
|
105
|
+
export interface LocalCopyStatus extends Tagged, SyncState {
|
|
106
|
+
readonly lastSyncedAt?: Date;
|
|
107
|
+
readonly folders: readonly LocalFolder[];
|
|
108
|
+
readonly pending: number;
|
|
109
|
+
readonly bytesOnDevice?: number;
|
|
110
|
+
}
|
|
111
|
+
export type DelegationStatus = AccountDelegationRecord["status"];
|
|
112
|
+
/**
|
|
113
|
+
* Computed in the mapper, never stored:
|
|
114
|
+
* - `this-app`: `delegateDid` equals the current session DID (`tc.sessionDid`).
|
|
115
|
+
* - `to-others`: `direction === "granted"` and the delegate is another DID.
|
|
116
|
+
* - `received`: `direction === "received"`.
|
|
117
|
+
*/
|
|
118
|
+
export type DelegationGroup = "this-app" | "to-others" | "received";
|
|
119
|
+
export interface DelegationResource {
|
|
120
|
+
readonly resource: string;
|
|
121
|
+
readonly actions: readonly string[];
|
|
122
|
+
}
|
|
123
|
+
/** Plain-words rendering of a resource list. `chips` keeps raw action names for unknown ones. */
|
|
124
|
+
export interface DescribedAbilities {
|
|
125
|
+
readonly plain: string;
|
|
126
|
+
readonly chips: readonly string[];
|
|
127
|
+
}
|
|
128
|
+
export interface DelegationRow extends Tagged {
|
|
129
|
+
readonly cid: string;
|
|
130
|
+
readonly direction: AccountDelegationRecord["direction"];
|
|
131
|
+
readonly status: DelegationStatus;
|
|
132
|
+
/** Derived in the mapper. */
|
|
133
|
+
readonly group: DelegationGroup;
|
|
134
|
+
/** Friendly name when resolvable, else the short DID. */
|
|
135
|
+
readonly label: {
|
|
136
|
+
readonly text: string;
|
|
137
|
+
readonly source: "derived" | "stub";
|
|
138
|
+
};
|
|
139
|
+
readonly delegatorDid: string;
|
|
140
|
+
readonly delegateDid: string;
|
|
141
|
+
readonly resources: readonly DelegationResource[];
|
|
142
|
+
/** Parent delegation CIDs. */
|
|
143
|
+
readonly parents: readonly string[];
|
|
144
|
+
readonly issuedAt: Date | null;
|
|
145
|
+
readonly notBefore: Date | null;
|
|
146
|
+
readonly expiresAt: Date | null;
|
|
147
|
+
/** Derived: `expiresAt` falls within 24 h of now. */
|
|
148
|
+
readonly expiringSoon: boolean;
|
|
149
|
+
readonly revokedAt?: AccountDelegationRecord["revokedAt"];
|
|
150
|
+
readonly revokedBy?: AccountDelegationRecord["revokedBy"];
|
|
151
|
+
readonly revokedAncestorCid?: AccountDelegationRecord["revokedAncestorCid"];
|
|
152
|
+
/**
|
|
153
|
+
* Terminal marker. The account record does not carry it. The real mapper
|
|
154
|
+
* never sets it. Stub data sets it with `fieldSources.terminal = "stub"`.
|
|
155
|
+
*/
|
|
156
|
+
readonly terminal?: boolean;
|
|
157
|
+
}
|
|
158
|
+
export interface DelegationPage {
|
|
159
|
+
readonly rows: readonly DelegationRow[];
|
|
160
|
+
/** Pass back as `cursor` to fetch the next page. Absent on the last page. */
|
|
161
|
+
readonly nextCursor?: string;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Result of `revoke(cid)`. The SDK receipt is `{ revoked: true, cid }`.
|
|
165
|
+
* `code` is the SDK error code, or a neutral code when none is given.
|
|
166
|
+
*/
|
|
167
|
+
export type RevokeOutcome = {
|
|
168
|
+
readonly ok: true;
|
|
169
|
+
readonly cid: string;
|
|
170
|
+
} | {
|
|
171
|
+
readonly ok: false;
|
|
172
|
+
readonly code: string;
|
|
173
|
+
};
|
|
174
|
+
export type NodeKind = "hosted" | "local";
|
|
175
|
+
export type NodeStatus = "ok" | "slow" | "down";
|
|
176
|
+
export interface NodeRow extends Tagged {
|
|
177
|
+
/** Real: from `tc.hosts`. */
|
|
178
|
+
readonly origin: string;
|
|
179
|
+
/** Real: local when the origin is `localNodeUrl`, else hosted. */
|
|
180
|
+
readonly kind: NodeKind;
|
|
181
|
+
/** Real: true for the node in `activeNodeIdentity()`. */
|
|
182
|
+
readonly active: boolean;
|
|
183
|
+
/** Real for the active node only. */
|
|
184
|
+
readonly nodeDid?: string;
|
|
185
|
+
/** Stub until latency is measured. */
|
|
186
|
+
readonly status: NodeStatus;
|
|
187
|
+
/** Stub: the node `/info` call is not wrapped in the SDK. */
|
|
188
|
+
readonly version?: string;
|
|
189
|
+
/** Stub until latency is measured. */
|
|
190
|
+
readonly latencyMs?: number;
|
|
191
|
+
readonly lastSeenAt?: Date;
|
|
192
|
+
/** Stub: space names are not mapped to nodes yet. */
|
|
193
|
+
readonly spaces: readonly string[];
|
|
194
|
+
}
|
|
195
|
+
export interface SpaceUsageRow extends Tagged {
|
|
196
|
+
readonly space: string;
|
|
197
|
+
readonly usage: StorageUsage;
|
|
198
|
+
}
|
|
199
|
+
export interface StorageView extends Tagged, StorageStatus {
|
|
200
|
+
readonly perSpace?: readonly SpaceUsageRow[];
|
|
201
|
+
}
|
|
202
|
+
export declare function describeAbilities(resources: readonly DelegationResource[]): DescribedAbilities;
|
|
203
|
+
export interface PanelDataHost {
|
|
204
|
+
readonly account: Pick<AccountService, "index">;
|
|
205
|
+
readonly delegations: Pick<DelegationManager, "query" | "revoke" | "status">;
|
|
206
|
+
readonly storage: Pick<IStorageService, "status">;
|
|
207
|
+
readonly hosts: readonly string[];
|
|
208
|
+
/** Current account DID (`tc.did`). */
|
|
209
|
+
readonly did: string;
|
|
210
|
+
/** Session DID (`tc.sessionDid`). Compared against `delegateDid` for `this-app`. */
|
|
211
|
+
readonly sessionDid: string;
|
|
212
|
+
activeNodeIdentity(): Promise<{
|
|
213
|
+
readonly origin: string;
|
|
214
|
+
readonly nodeDid: string;
|
|
215
|
+
}>;
|
|
216
|
+
}
|
|
217
|
+
export interface PanelDataSource {
|
|
218
|
+
/** Fires when any view's data changes (toggle, revoke, stub change). Returns unsubscribe. */
|
|
219
|
+
subscribe(listener: (view: PanelView) => void): () => void;
|
|
220
|
+
/**
|
|
221
|
+
* Account DID this source reads for, known without a network read. Lets Overview keep the identity on
|
|
222
|
+
* screen when the account read fails. Absent on sources that cannot tell.
|
|
223
|
+
*/
|
|
224
|
+
knownDid?(): string | undefined;
|
|
225
|
+
account(): Promise<ViewResult<AccountInfo>>;
|
|
226
|
+
localNode(): Promise<ViewResult<LocalNodeState>>;
|
|
227
|
+
/** Stub today. */
|
|
228
|
+
setLocalNodeEnabled(on: boolean): Promise<ActionResult>;
|
|
229
|
+
localCopy(): Promise<ViewResult<LocalCopyStatus>>;
|
|
230
|
+
/** Pass `cursor` from the previous page's `nextCursor`. */
|
|
231
|
+
delegations(cursor?: string): Promise<ViewResult<DelegationPage>>;
|
|
232
|
+
revoke(cid: string): Promise<RevokeOutcome>;
|
|
233
|
+
nodes(): Promise<ViewResult<readonly NodeRow[]>>;
|
|
234
|
+
/** `fresh` awaits a network read now. Otherwise a cached value is returned, refreshed in the background only when stale. */
|
|
235
|
+
storage(options?: {
|
|
236
|
+
readonly fresh?: boolean;
|
|
237
|
+
}): Promise<ViewResult<StorageView>>;
|
|
238
|
+
}
|
|
239
|
+
/** Builds the data source for one registered client. */
|
|
240
|
+
export type PanelDataFactory = (client: PanelClient) => PanelDataSource;
|
|
241
|
+
//# sourceMappingURL=data.d.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Top-level page only. The TinyCloud UI never renders inside an iframe or an
|
|
3
|
+
* opaque origin (sandboxed, data:, srcdoc). Evaluated at registration and at
|
|
4
|
+
* every open(); never cached.
|
|
5
|
+
*/
|
|
6
|
+
export declare function canRenderUi(): boolean;
|
|
7
|
+
//# sourceMappingURL=frame-guard.d.ts.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { PanelClientHandle } from "./client";
|
|
2
|
+
import type { ResolvedUiConfig } from "./config";
|
|
3
|
+
import type { ArmOptions } from "./panel-data-entry";
|
|
4
|
+
import type { ToastRequest } from "./toast-store";
|
|
5
|
+
import type { PanelClient, SectionId } from "./slots";
|
|
6
|
+
/** Global registry key. Shared across bundled copies of the SDK on one page. */
|
|
7
|
+
export declare const REGISTRY_KEY: unique symbol;
|
|
8
|
+
export declare const HOST_API_VERSION = 1;
|
|
9
|
+
/** The only eager import of the lazy panel-data entry. Every gate lives in that module. */
|
|
10
|
+
export declare function armPanelData(client: PanelClient, opts: ArmOptions): void;
|
|
11
|
+
export interface ClientRegistration {
|
|
12
|
+
readonly handle: PanelClientHandle;
|
|
13
|
+
readonly config: ResolvedUiConfig;
|
|
14
|
+
readonly manifestAppId: () => string | undefined;
|
|
15
|
+
readonly manifestName?: () => string | undefined;
|
|
16
|
+
}
|
|
17
|
+
export interface HostRuntime {
|
|
18
|
+
nextClientId(): number;
|
|
19
|
+
register(id: number, registration: ClientRegistration): void;
|
|
20
|
+
unregister(id: number): void;
|
|
21
|
+
reset(id: number): void;
|
|
22
|
+
open(section?: SectionId): void;
|
|
23
|
+
openPage(section?: SectionId): void;
|
|
24
|
+
close(): void;
|
|
25
|
+
isOpen(): boolean;
|
|
26
|
+
toast(request: ToastRequest, owner?: number): boolean;
|
|
27
|
+
}
|
|
28
|
+
export declare function createHostRuntime(): HostRuntime;
|
|
29
|
+
//# sourceMappingURL=host.d.ts.map
|
package/dist/ui/ids.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Id of the settings panel element. The launcher's aria-controls, the eager
|
|
3
|
+
* pending element, and the lazy panel all use it. Lives outside button.ts and
|
|
4
|
+
* panel.ts so the lazy panel chunk does not bundle the launcher.
|
|
5
|
+
*/
|
|
6
|
+
export declare const PANEL_ID = "tinycloud-ui-panel";
|
|
7
|
+
//# sourceMappingURL=ids.d.ts.map
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type TinyCloudUI } from "./api";
|
|
2
|
+
import { type ClientSource } from "./client";
|
|
3
|
+
import type { PanelDataFactory, PanelDataHost } from "./data";
|
|
4
|
+
import { type UiConfig } from "./config";
|
|
5
|
+
import type { ToastRequest } from "./toast-store";
|
|
6
|
+
import { type PromptScope } from "./parts/prompts";
|
|
7
|
+
export type { TinyCloudUI } from "./api";
|
|
8
|
+
export type { UiConfig, UiPosition } from "./config";
|
|
9
|
+
export type { ClientSource } from "./client";
|
|
10
|
+
export interface UiClientHandle {
|
|
11
|
+
readonly api: TinyCloudUI;
|
|
12
|
+
/** Sign-out: clears this client's view state and closes the panel. Window listeners stay. */
|
|
13
|
+
reset(): void;
|
|
14
|
+
/** Cleanup: removes this client. The host unmounts when the last client unregisters. */
|
|
15
|
+
unregister(): void;
|
|
16
|
+
/** Shows a toast in the host. False when this client is headless, detached in a frame, or unregistered. */
|
|
17
|
+
toast(request: ToastRequest): boolean;
|
|
18
|
+
/** Prompts this client opens. `uiEnabled` is false for `ui: false` and detached clients. */
|
|
19
|
+
readonly promptScope: PromptScope;
|
|
20
|
+
/** Arms the background panel-data pull for this client. Call once sign-in or restore has produced a session. */
|
|
21
|
+
armPrefetch(host: PanelDataHost): void;
|
|
22
|
+
}
|
|
23
|
+
export interface UiClientOptions {
|
|
24
|
+
readonly ui: UiConfig | false | undefined;
|
|
25
|
+
readonly source: ClientSource;
|
|
26
|
+
/** manifest.app_id, read lazily so setManifest() re-keys the hide flag. */
|
|
27
|
+
readonly manifestAppId: () => string | undefined;
|
|
28
|
+
/** manifest.name, the display name the panel shows the user. Read lazily like `manifestAppId`. */
|
|
29
|
+
readonly manifestName?: () => string | undefined;
|
|
30
|
+
/** Panel data factory. Production passes the live adapter; the harness passes its stub. */
|
|
31
|
+
readonly data?: PanelDataFactory;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Registers a TinyCloudWeb instance with the page's UI host. `ui: false` and
|
|
35
|
+
* frames/opaque origins never create a host element or listener.
|
|
36
|
+
*/
|
|
37
|
+
export declare function registerUiClient(options: UiClientOptions): UiClientHandle;
|
|
38
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where the owner frees up space or upgrades their plan. Mirrors
|
|
3
|
+
* `STORAGE_MANAGE_URL` in sdk-services `src/storage/status.ts`. Owned here so
|
|
4
|
+
* the UI module does not import a runtime value from sdk-core, which would
|
|
5
|
+
* pull the whole client into the lazy-loaded UI bundle.
|
|
6
|
+
*/
|
|
7
|
+
export declare const STORAGE_MANAGE_URL = "https://account.tinycloud.xyz/storage";
|
|
8
|
+
//# sourceMappingURL=manage-url.d.ts.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { PanelDataHost, PanelDataSource } from "./data";
|
|
2
|
+
import type { PanelClient } from "./slots";
|
|
3
|
+
/** The part of ClientSource the prefetch gates on. */
|
|
4
|
+
export interface RegistryGate {
|
|
5
|
+
waitForAccountRegistrySync?(): Promise<void>;
|
|
6
|
+
}
|
|
7
|
+
export interface ArmOptions {
|
|
8
|
+
/** Sign-in or restore: the app host the real adapter reads from. */
|
|
9
|
+
readonly host?: PanelDataHost;
|
|
10
|
+
/** Sign-in or restore: the source whose account registry sync gates the pull. */
|
|
11
|
+
readonly gate?: RegistryGate;
|
|
12
|
+
/** Sign-in or restore: the app name shown in the account view. */
|
|
13
|
+
readonly appName?: () => string | undefined;
|
|
14
|
+
/** Launcher hover, focus or open: start an armed pull now, skipping the idle gate. */
|
|
15
|
+
readonly now?: boolean;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Sign-in or restore (`host` and `gate` set): builds this client's live source once and
|
|
19
|
+
* arms the pull behind the idle and registry gates. Launcher intent (`now`): starts an
|
|
20
|
+
* armed pull at once; a no-op before arm. A reset drops the source, so the next sign-in
|
|
21
|
+
* builds a fresh one.
|
|
22
|
+
*/
|
|
23
|
+
export declare function arm(client: PanelClient, opts?: ArmOptions): void;
|
|
24
|
+
/** The live source for this client, or undefined before arm and after reset. */
|
|
25
|
+
export declare function livePanelData(client: PanelClient): PanelDataSource | undefined;
|
|
26
|
+
/** Calls `cb` whenever the live source is armed or dropped. Returns unsubscribe. */
|
|
27
|
+
export declare function onLivePanelDataChange(client: PanelClient, cb: () => void): () => void;
|
|
28
|
+
//# sourceMappingURL=panel-data-entry.d.ts.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { LayoutOptions, PanelHandle, PanelOptions, ShellLayout } from "./panel";
|
|
2
|
+
import type { HostContext, SectionId } from "./slots";
|
|
3
|
+
import type { ToastStore } from "./toast-store";
|
|
4
|
+
/** What the host passes on each render. The shell keeps the section between renders. */
|
|
5
|
+
export interface ShellView extends LayoutOptions {
|
|
6
|
+
readonly open: boolean;
|
|
7
|
+
readonly layout: ShellLayout;
|
|
8
|
+
/** Section to show next. Undefined keeps the current one. */
|
|
9
|
+
readonly section?: SectionId | undefined;
|
|
10
|
+
}
|
|
11
|
+
export interface ShellPanel extends PanelHandle {
|
|
12
|
+
render(view: ShellView): void;
|
|
13
|
+
/** Disposes the mounted section. The host calls it on unmount. */
|
|
14
|
+
dispose(): void;
|
|
15
|
+
/** After a close that returns focus: puts it back on the page element that had it before the drawer opened. False when there is none. */
|
|
16
|
+
restoreFocus(): boolean;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Builds the panel and its stylesheet in the host's open shadow root. Owns section state and mounting.
|
|
20
|
+
* `toasts` is the host's store: the host passes it so this chunk never imports the eager toasts module.
|
|
21
|
+
*/
|
|
22
|
+
export declare function mountPanel(root: ShadowRoot, options: Omit<PanelOptions, "onNavigate">, base: HostContext, toasts: ToastStore): ShellPanel;
|
|
23
|
+
//# sourceMappingURL=panel-entry.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface DrawerModal {
|
|
2
|
+
/** The shell's view: `open` is the panel's state, `active` is open as the drawer. Call before the section draws. */
|
|
3
|
+
sync(open: boolean, active: boolean): void;
|
|
4
|
+
/** After a close, returns focus to the page element that had it before the drawer opened. False when there is none. */
|
|
5
|
+
restoreFocus(): boolean;
|
|
6
|
+
dispose(): void;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* `layer` is the host layer, `panel` the shell element. `dismiss` closes the panel the way its own close
|
|
10
|
+
* control does. Prompts the SDK raises (they mount in the layer after the panel) keep their own focus.
|
|
11
|
+
*/
|
|
12
|
+
export declare function mountDrawerModal(root: ShadowRoot, layer: HTMLElement, panel: HTMLElement, dismiss: () => void): DrawerModal;
|
|
13
|
+
//# sourceMappingURL=panel-modal.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Panel stylesheet. Loaded with the lazy panel chunk and appended to the open
|
|
3
|
+
* shadow root on first open. Launcher rules stay in styles.ts.
|
|
4
|
+
* Order matters: focus rings, desktop panel rules, phone, reduced motion, dark.
|
|
5
|
+
* Focus rings come first so the equal-specificity state rules below
|
|
6
|
+
* (aria-current, .ring) keep winning box-shadow where they did before the split.
|
|
7
|
+
* The drawer edge (#e4e4e7 / #69696b) is decorative, not a 3:1 target.
|
|
8
|
+
*/
|
|
9
|
+
export declare const PANEL_CSS = "\n.glance-row:focus-visible,.nav-i:focus-visible,.action:focus-visible,.switch:focus-visible,.icon-btn:focus-visible,.menu-i:focus-visible{outline:2px solid #111827;outline-offset:2px;box-shadow:0 0 0 6px #fafafa}\n.panel{position:fixed;top:0;bottom:0;right:0;box-sizing:border-box;width:min(420px,100%);display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:auto auto minmax(0,1fr);grid-template-areas:\"head\" \"nav\" \"main\";overflow:hidden;border-left:1px solid #e4e4e7;background:#fff;color:#111827;box-shadow:-18px 0 48px -18px rgba(0,0,0,.35);pointer-events:auto;animation:tc-in .42s cubic-bezier(.22,1,.36,1)}\n.layer[data-position=\"bottom-left\"] .panel{left:0;right:auto;border-left:0;border-right:1px solid #e4e4e7;box-shadow:18px 0 48px -18px rgba(0,0,0,.35);animation-name:tc-in-l}\n.layer .panel[data-layout=\"page\"]{top:0;bottom:0;left:0;right:0;width:auto;border:0;box-shadow:none;grid-template-rows:auto minmax(0,1fr);grid-template-columns:288px minmax(0,1fr);grid-template-areas:\"head head\" \"nav main\"}\n.head{grid-area:head;display:flex;flex-wrap:nowrap;align-items:center;justify-content:space-between;gap:8px;box-sizing:border-box;min-height:68px;padding:14px 12px 10px 20px}\n.brand{display:flex;flex-direction:column;min-width:0;flex:1 0 92px}\n.title{margin:0;font-size:15px;font-weight:600}\n.ctx{overflow:hidden;font-size:12.5px;color:#71717a;text-overflow:ellipsis;white-space:nowrap}\n.head-actions{display:flex;flex-wrap:nowrap;align-items:center;min-width:0;flex-shrink:1;gap:6px}\n.head-actions .layout-switch{flex-shrink:0}\n.head-actions > .action{min-width:44px;overflow:hidden}\n.head-actions > .action span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}\n.icon-btn{display:inline-flex;flex:none;align-items:center;justify-content:center;box-sizing:border-box;width:44px;height:44px;min-width:44px;min-height:44px;padding:0;border:0;border-radius:50%;background:transparent;color:inherit;cursor:pointer}\n.icon-btn.ring{box-shadow:inset 0 0 0 1px #71717a}\n.icon-btn svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round}\n.status{font-size:12px;color:#4b5563}\n.nav{grid-area:nav;display:flex;flex-wrap:wrap;gap:6px;padding:6px 20px 14px}\n.nav-i{display:inline-flex;align-items:center;min-height:44px;padding:0 13px;border:0;border-radius:999px;background:#f4f4f5;color:#09090b;font:inherit;font-size:13.5px;font-weight:500;white-space:nowrap;cursor:pointer}\n.nav-i[aria-current=\"page\"]{background:#fff;font-weight:700;box-shadow:inset 0 0 0 2px #09090b}\n.nav-n,.nav-ic,.nav-m{display:none}\n.main{grid-area:main;min-width:0;min-height:0;overflow:auto;overflow-wrap:anywhere;box-sizing:border-box;padding:24px 20px 56px;border-top:2px solid #09090b}\n.sec-title{margin:0 0 28px;font-family:\"Literata Variable\",\"Iowan Old Style\",\"Palatino Linotype\",Palatino,Georgia,serif;font-size:1.5rem;font-weight:400;line-height:1.2;letter-spacing:-.005em}\n.section+.section{margin-top:12px;padding-top:12px;border-top:1px solid #e4e4e7}\n.action{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-width:44px;min-height:44px;padding:0 20px;border:1px solid;border-color:#71717a;border-radius:999px;background:#fff;color:#09090b;font:inherit;font-size:13.5px;font-weight:700;white-space:nowrap;cursor:pointer}\n.action:hover{background:#f4f4f5}\n.layout-switch{display:inline-flex;align-items:center;gap:8px;white-space:nowrap}\n.layout-switch[hidden]{display:none}\n.layout-switch svg{width:16px;height:16px;flex:none;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round}\n.row{display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:44px}\n.label{font-weight:500}\n.switch{display:inline-flex;align-items:center;width:56px;min-width:44px;height:44px;padding:0;border:0;background:none;cursor:pointer}\n.switch:disabled{cursor:default;opacity:.6}\n/* The mockup switch: a 56x30 track with a 1px #71717a edge (the .knob background, so it clears 3:1 on the panel) around a muted fill (::before), and a 22px thumb that is black when off and white on a black track when on. */\n.knob{position:relative;display:block;width:56px;height:30px;border-radius:999px;background:#71717a}\n.knob::before{content:\"\";position:absolute;inset:1px;border-radius:999px;background:#f4f4f5}\n.knob::after{content:\"\";position:absolute;top:4px;left:4px;width:22px;height:22px;border-radius:50%;background:#09090b;transition:transform .3s cubic-bezier(.22,1,.36,1)}\n.switch[aria-checked=\"true\"] .knob{background:#09090b}\n.switch[aria-checked=\"true\"] .knob::before{background:#09090b}\n.switch[aria-checked=\"true\"] .knob::after{transform:translateX(26px);background:#fff}\n.busy,.note,.error{margin:6px 0 0;font-size:12px;color:#4b5563}\n.note{text-wrap:pretty}\n.action+.note,.note:not([hidden])+.action,.row~.action{margin-top:8px}\n.error{color:#111827}\n.confirm{margin-top:8px}\n.confirm .actions{display:flex;flex-wrap:wrap;gap:8px;margin:8px 0}\n.layer .panel[data-layout=\"page\"] .head{padding:12px 24px;border-bottom:1px solid #e4e4e7;background:#fff}\n.layer .panel[data-layout=\"page\"] .nav{flex-direction:column;flex-wrap:nowrap;width:288px;box-sizing:border-box;padding:24px 16px;border-right:1px solid #e4e4e7;background:#fafafa}\n.layer .panel[data-layout=\"page\"] .nav-i{width:100%;min-height:48px;padding:0 12px;border-radius:14px;background:transparent;font-size:14.5px}\n.layer .panel[data-layout=\"page\"] .nav-i[aria-current=\"page\"]{background:#fff}\n.layer .panel[data-layout=\"page\"] .nav-i{gap:8px}\n.layer .panel[data-layout=\"page\"] .nav-ic{display:inline-block;width:16px;height:16px}\n.layer .panel[data-layout=\"page\"] .nav-m{display:inline;max-width:90px;margin-left:auto;overflow:hidden;color:#71717a;font-size:12.5px;font-weight:400;text-overflow:ellipsis;white-space:nowrap}\n.layer .panel[data-layout=\"page\"] .nav-i[aria-current=\"page\"] .nav-m{color:#09090b}\n.layer .panel[data-layout=\"page\"] .nav-n{display:inline-block;width:18px;font:500 11px/1 ui-monospace,SFMono-Regular,Menlo,Consolas,\"Liberation Mono\",monospace;color:#71717a}\n.layer .panel[data-layout=\"page\"] .main{padding:40px 40px 80px;border-top:0;max-width:960px;width:100%;margin:0 auto}\n.layer .panel[data-layout=\"page\"] .sec-title{font-size:1.75rem;line-height:2.125rem;font-weight:600}\n@keyframes tc-in{from{transform:translateX(104%)}to{transform:none}}\n@keyframes tc-in-l{from{transform:translateX(-104%)}to{transform:none}}\n.menu-wrap{display:none;position:relative}\n.menu{position:absolute;top:calc(100% + 6px);right:0;z-index:2;box-sizing:border-box;width:min(280px,calc(100vw - 24px));padding:6px;border-radius:16px;background:#fff;box-shadow:inset 0 0 0 1px #e4e4e7,0 12px 32px -8px rgba(0,0,0,.3)}\n.menu[hidden]{display:none}\n.menu-i{display:flex;align-items:center;width:100%;min-height:44px;padding:0 12px;border:0;border-radius:12px;background:transparent;color:inherit;font:inherit;text-align:left;white-space:nowrap;cursor:pointer}\n.menu-i[aria-current=\"page\"]{font-weight:700;background:#f4f4f5}\n.layer[data-phone] .menu-wrap{display:block}\n.layer[data-phone] .nav{display:none}\n.layer[data-phone] .panel[data-layout=\"page\"]{grid-template-columns:minmax(0,1fr);grid-template-areas:\"head\" \"main\"}\n.layer[data-phone] .panel[data-layout=\"page\"] .head{padding:12px 12px 12px 16px}\n.layer[data-phone] .panel[data-layout=\"page\"] .main{padding:24px 16px 56px}\n.layer{--tc-color-overlay:rgb(9 9 11 / .4)}\n.scrim{position:fixed;inset:0;background:var(--tc-color-overlay);opacity:0;visibility:hidden;pointer-events:none;transition:opacity .35s cubic-bezier(.22,1,.36,1),visibility 0s .35s}\n.layer[data-panel-open][data-layout=\"drawer\"] .scrim{opacity:1;visibility:visible;pointer-events:auto;transition:opacity .35s cubic-bezier(.22,1,.36,1)}\n@media (prefers-reduced-motion:reduce){\n.panel,.knob::after,.scrim,.layer[data-panel-open][data-layout=\"drawer\"] .scrim{animation:none;transition:none}\n}\n@media (prefers-color-scheme: dark){\n.layer{--tc-color-overlay:rgb(0 0 0 / .6)}\n.glance-row:focus-visible,.nav-i:focus-visible,.action:focus-visible,.switch:focus-visible,.icon-btn:focus-visible,.menu-i:focus-visible{outline-color:#fafafa;box-shadow:0 0 0 6px #111827}\n.panel{border-left-color:#69696b;background:#151517;color:#fafafa}\n.main{border-top-color:#fafafa}\n.ctx,.status,.busy,.note{color:#a1a1aa}\n.nav-i{background:#27272a;color:#fafafa}\n.nav-i[aria-current=\"page\"]{background:#151517;box-shadow:inset 0 0 0 2px #fafafa}\n.icon-btn.ring{box-shadow:inset 0 0 0 1px #71717a}\n.section+.section{border-top-color:#69696b}\n.action{border-color:#71717a;background:#151517;color:#fafafa}\n.action:hover{background:#27272a}\n.error{color:#fafafa}\n.knob::before{background:#27272a}\n.knob::after{background:#fafafa}\n.switch[aria-checked=\"true\"] .knob{background:#fafafa}\n.switch[aria-checked=\"true\"] .knob::before{background:#fafafa}\n.switch[aria-checked=\"true\"] .knob::after{background:#09090b}\n.layer .panel[data-layout=\"page\"] .head{background:#151517;border-bottom-color:#69696b}\n.layer .panel[data-layout=\"page\"] .nav{background:#151517;border-right-color:#69696b}\n.layer .panel[data-layout=\"page\"] .nav-i{background:transparent}\n.layer .panel[data-layout=\"page\"] .nav-i[aria-current=\"page\"]{background:#27272a}\n.layer .panel[data-layout=\"page\"] .nav-n,.layer .panel[data-layout=\"page\"] .nav-m{color:#a1a1aa}\n.layer .panel[data-layout=\"page\"] .nav-i[aria-current=\"page\"] .nav-m{color:#fafafa}\n.menu{background:#151517;box-shadow:inset 0 0 0 1px #69696b,0 12px 32px -8px rgba(0,0,0,.6)}\n.menu-i[aria-current=\"page\"]{background:#27272a}\n}\n";
|
|
10
|
+
//# sourceMappingURL=panel-styles.d.ts.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { ToastRequest, ToastStore } from "./toast-store";
|
|
2
|
+
type Code = string;
|
|
3
|
+
/** One receipt row: a label code and a data value (an ID), never prose. */
|
|
4
|
+
export interface ReceiptRow {
|
|
5
|
+
readonly labelCode: Code;
|
|
6
|
+
readonly value: string;
|
|
7
|
+
/** What Copy receipt writes for this row (for example the full ID when `value` is a short form). Default: `value`. */
|
|
8
|
+
readonly copyValue?: string;
|
|
9
|
+
}
|
|
10
|
+
/** A confirmation with a dashed slip of identifiers and a Copy receipt action. */
|
|
11
|
+
export interface ReceiptRequest {
|
|
12
|
+
readonly titleCode: Code;
|
|
13
|
+
readonly bodyCode?: Code;
|
|
14
|
+
readonly rows: readonly ReceiptRow[];
|
|
15
|
+
}
|
|
16
|
+
export interface ToastRegion {
|
|
17
|
+
/** Shows a receipt. Returns false when it duplicates one on screen. */
|
|
18
|
+
receipt(request: ReceiptRequest): boolean;
|
|
19
|
+
/** Drops every receipt slip. A receipt belongs to the account that made it, so an account change clears them. */
|
|
20
|
+
clearReceipts(): void;
|
|
21
|
+
dispose(): void;
|
|
22
|
+
}
|
|
23
|
+
export declare const TOAST_REGION_CSS = "\n.tstack{position:fixed;bottom:calc(var(--b) + 56px);display:flex;flex-direction:column;gap:10px;width:min(400px,calc(100vw - 24px));pointer-events:none}\n.layer[data-position=\"bottom-right\"] .tstack{right:var(--tinycloud-ui-offset-inline,12px)}\n.layer[data-position=\"bottom-left\"] .tstack{left:var(--tinycloud-ui-offset-inline,12px)}\n.layer[data-position=\"bottom-center\"] .tstack{left:50%;transform:translateX(-50%)}\n.layer[data-panel-open][data-layout=\"drawer\"] .tstack{bottom:12px;width:min(396px,calc(100vw - 24px))}\n.layer[data-panel-open][data-layout=\"drawer\"][data-position=\"bottom-right\"] .tstack{right:12px}\n.layer[data-panel-open][data-layout=\"drawer\"][data-position=\"bottom-left\"] .tstack{left:12px}\n.layer[data-panel-open][data-layout=\"page\"] .tstack{bottom:24px;right:24px;left:auto;transform:none;width:min(420px,calc(100vw - 32px))}\n.layer[data-phone][data-panel-open] .tstack{bottom:calc(var(--b));left:12px;right:12px;transform:none;width:auto}\n.tstack>div{display:contents}\n.tstack .toast{display:flex;align-items:flex-start;gap:12px;box-sizing:border-box;padding:14px 8px 14px 16px;border:0;border-radius:16px;background:#fff;color:#111827;box-shadow:0 12px 32px -8px rgba(0,0,0,.3),0 0 0 1px #a1a1aa;pointer-events:auto;animation:tc-toast-in .45s cubic-bezier(.22,1,.36,1)}\n.tstack .toast__icon{display:inline-flex;flex:none;margin-top:12px}\n.tstack .toast__icon .ui-ic{width:20px;height:20px}\n.tstack .toast__body{flex:1;min-width:0;padding-top:12px;overflow-wrap:anywhere}\n.tstack .toast__title{display:block;font-weight:700}\n.tstack .toast a,.tstack .toast__copy{display:inline-flex;align-items:center;min-height:44px;margin-top:2px;padding:0;border:0;background:transparent;color:inherit;font:inherit;font-weight:700;text-decoration:underline;text-underline-offset:3px;white-space:nowrap;cursor:pointer}\n.tstack .toast__close{display:inline-flex;align-items:center;justify-content:center;flex:none;box-sizing:border-box;width:44px;height:44px;padding:0;border:0;border-radius:50%;background:transparent;color:inherit;cursor:pointer}\n.tstack .toast__close .ui-ic{width:20px;height:20px}\n.tstack .slip{margin-top:8px;padding:8px 0;border-top:2px dashed #71717a;border-bottom:2px dashed #71717a;font:12px/1.7 ui-monospace,SFMono-Regular,Menlo,Consolas,\"Liberation Mono\",monospace;overflow-wrap:anywhere}\n.tstack .slip>div{display:block}\n.toast a:focus-visible,.toast__close:focus-visible,.toast__copy:focus-visible{outline:2px solid #111827;outline-offset:2px;box-shadow:0 0 0 6px #fafafa}\n@keyframes tc-toast-in{from{opacity:0;transform:translateY(14px)}}\n@media (prefers-reduced-motion:reduce){\n.tstack .toast{animation:none}\n}\n@media (prefers-color-scheme: dark){\n.tstack .toast{background:#151517;color:#fafafa;box-shadow:0 12px 32px -8px rgba(0,0,0,.6),0 0 0 1px #69696b}\n.toast a:focus-visible,.toast__close:focus-visible,.toast__copy:focus-visible{outline-color:#fafafa;box-shadow:0 0 0 6px #111827}\n}\n";
|
|
24
|
+
/**
|
|
25
|
+
* Appends the region to `layer`, after the panel's slot, so it paints over the panel. `store` is the shared toast store; `toast`
|
|
26
|
+
* pushes a plain toast (used to confirm a copy) and honors `ui.toasts`.
|
|
27
|
+
*/
|
|
28
|
+
export declare function mountToastRegion(layer: HTMLElement, store: ToastStore, toast: (request: ToastRequest) => unknown): ToastRegion;
|
|
29
|
+
export {};
|
|
30
|
+
//# sourceMappingURL=panel-toasts.d.ts.map
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { SectionId, StatusCode } from "./slots";
|
|
2
|
+
import type { StringKey } from "./strings";
|
|
3
|
+
import { type IconName } from "./sections/ui";
|
|
4
|
+
/** `drawer` is the sidebar overlay; `page` fills the host layer. */
|
|
5
|
+
export type ShellLayout = "drawer" | "page";
|
|
6
|
+
export interface NavItem {
|
|
7
|
+
readonly id: SectionId;
|
|
8
|
+
readonly labelCode: StringKey;
|
|
9
|
+
readonly icon: IconName;
|
|
10
|
+
/** Short status on the full-page rail: the section status's `count ?? text`. Undefined shows nothing. */
|
|
11
|
+
readonly meta?: string | undefined;
|
|
12
|
+
}
|
|
13
|
+
export interface LayoutOptions {
|
|
14
|
+
/** Shows the switch control. Callers hide it on phones and when `ui.mode` fixes the layout. */
|
|
15
|
+
readonly showLayoutToggle: boolean;
|
|
16
|
+
/** Phone: the close control is a 44px icon, never the text back action. */
|
|
17
|
+
readonly phone: boolean;
|
|
18
|
+
}
|
|
19
|
+
export interface PanelHandle {
|
|
20
|
+
readonly el: HTMLElement;
|
|
21
|
+
/** Holds the one mounted section while the shell is open. */
|
|
22
|
+
readonly main: HTMLElement;
|
|
23
|
+
setOpen(open: boolean): void;
|
|
24
|
+
setLayout(layout: ShellLayout, options: LayoutOptions): void;
|
|
25
|
+
/** App name shown after "TinyCloud". Undefined hides it and the page back label. */
|
|
26
|
+
setAppLabel(label: string | undefined): void;
|
|
27
|
+
setNav(items: readonly NavItem[], active: SectionId | undefined): void;
|
|
28
|
+
setStatus(status: StatusCode | null): void;
|
|
29
|
+
focusFirst(): void;
|
|
30
|
+
}
|
|
31
|
+
export interface PanelOptions {
|
|
32
|
+
onClose(): void;
|
|
33
|
+
onEscape(): void;
|
|
34
|
+
onLayout(target: ShellLayout): void;
|
|
35
|
+
onNavigate(id: SectionId): void;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* `role="dialog"`: modal (`aria-modal="true"`) only while open as a desktop drawer, which dims the page and
|
|
39
|
+
* holds focus; non-modal while hidden, on phones, or as the full page. Escape is handled on the panel element only.
|
|
40
|
+
*/
|
|
41
|
+
export declare function createPanel(options: PanelOptions): PanelHandle;
|
|
42
|
+
//# sourceMappingURL=panel.d.ts.map
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { HostPart } from "../slots";
|
|
2
|
+
/**
|
|
3
|
+
* Prompt host. Permission and space-creation prompts render into the host
|
|
4
|
+
* layer, which lives inside the host's open shadow root, never into
|
|
5
|
+
* `document.body`. Fail closed: a prompt that cannot render is refused before
|
|
6
|
+
* it mounts, and the caller resolves it as declined/dismissed.
|
|
7
|
+
*/
|
|
8
|
+
/** Fixed codes for a refused prompt. Each refusal logs exactly one of these. */
|
|
9
|
+
export type PromptRefusal = "ui-unavailable-frame" | "ui-disabled";
|
|
10
|
+
/** Identity of one registered UI client. Owns the prompts that client opened. */
|
|
11
|
+
export interface PromptScope {
|
|
12
|
+
/** False for `ui: false`. */
|
|
13
|
+
readonly uiEnabled: boolean;
|
|
14
|
+
}
|
|
15
|
+
/** A prompt is either mounted (`release` detaches it from the registry) or refused. */
|
|
16
|
+
export type PromptMount = {
|
|
17
|
+
readonly refusal: PromptRefusal;
|
|
18
|
+
} | {
|
|
19
|
+
readonly release: () => void;
|
|
20
|
+
};
|
|
21
|
+
export declare const PROMPT_SETTLED_EVENT = "tinycloud-prompt-settled";
|
|
22
|
+
export declare function createPromptScope(uiEnabled: boolean): PromptScope;
|
|
23
|
+
/** A held lazy dialog has no visible element and must not displace panel focus. */
|
|
24
|
+
export declare function hasMountedPrompt(): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Mounts `element` into the host layer, or refuses it. `dismiss` must settle
|
|
27
|
+
* the prompt as dismissed and remove it; teardown and `dismissPrompts` call it.
|
|
28
|
+
*/
|
|
29
|
+
export declare function mountPrompt(scope: PromptScope, element: HTMLElement, dismiss: () => void): PromptMount;
|
|
30
|
+
/**
|
|
31
|
+
* Registers a prompt that has no dialog on screen yet (its dialog chunk is still loading). `dismissPrompts` and
|
|
32
|
+
* the part's teardown decline it like a mounted one, so a reset, sign-out or account change reaches it. Returns
|
|
33
|
+
* the release that takes it out of the registry.
|
|
34
|
+
*/
|
|
35
|
+
export declare function holdPrompt(scope: PromptScope, dismiss: () => void): () => void;
|
|
36
|
+
/** Dismisses every pending prompt opened by `scope`. Used on reset and unregister. */
|
|
37
|
+
export declare function dismissPrompts(scope: PromptScope): void;
|
|
38
|
+
export declare const prompts: HostPart;
|
|
39
|
+
//# sourceMappingURL=prompts.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { HostPart } from "../slots";
|
|
2
|
+
/**
|
|
3
|
+
* Always-on storage warnings for the active client. While the own-storage episode is on, publishes
|
|
4
|
+
* storage_full and shows one info toast per episode. A delegated owner found full shows one info
|
|
5
|
+
* toast per SDK notification (the SDK emits once per owner until that owner is cleared). Every toast
|
|
6
|
+
* links to the manage page: the status `manageUrl` when it is https, read at toast time, and the
|
|
7
|
+
* constant otherwise. The own toast is shown again only after the episode ends and starts again.
|
|
8
|
+
* Re-points on client change.
|
|
9
|
+
*/
|
|
10
|
+
export declare const storageWatch: HostPart;
|
|
11
|
+
//# sourceMappingURL=storage-watch.d.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { HostPart } from "../slots";
|
|
2
|
+
/**
|
|
3
|
+
* Always-on: publishes sync_pending and sync_attention while the client is registered,
|
|
4
|
+
* including while the panel is closed. Follows the active client's facade and re-points on client change.
|
|
5
|
+
*/
|
|
6
|
+
export declare const syncStatusPart: HostPart;
|
|
7
|
+
//# sourceMappingURL=sync-status.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { HostPart } from "../slots";
|
|
2
|
+
import { type ToastStore } from "../toast-store";
|
|
3
|
+
/** Shared store: host.ts pushes here; the registered part renders it. */
|
|
4
|
+
export declare const toastStore: ToastStore;
|
|
5
|
+
/** Renders `store` into the host layer. Exposed for tests with a short-duration store. */
|
|
6
|
+
export declare function createToastsPart(store: ToastStore): HostPart;
|
|
7
|
+
export declare const toasts: HostPart;
|
|
8
|
+
//# sourceMappingURL=toasts.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stands in for the panel until the lazy chunk loads. It carries the panel id so
|
|
3
|
+
* the launcher's aria-controls resolves while loading, and it handles Escape the
|
|
4
|
+
* way the panel does. It is eager: the root renders it before any panel code exists.
|
|
5
|
+
*/
|
|
6
|
+
export interface PendingPanel {
|
|
7
|
+
readonly el: HTMLElement;
|
|
8
|
+
setOpen(open: boolean): void;
|
|
9
|
+
showLoading(): void;
|
|
10
|
+
showError(retry: () => void): void;
|
|
11
|
+
}
|
|
12
|
+
export declare function createPendingPanel(onEscape: () => void): PendingPanel;
|
|
13
|
+
//# sourceMappingURL=pending.d.ts.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Persistence for the "button hidden" flag. Scope is origin-wide (plus appId),
|
|
3
|
+
* never pathname, never wallet address or DID.
|
|
4
|
+
*
|
|
5
|
+
* Same pattern as permissionPromptSuppression.ts: storage access is guarded,
|
|
6
|
+
* and when storage is blocked or throws, the flag lasts for the page only.
|
|
7
|
+
*/
|
|
8
|
+
export declare const HIDE_KEY_PREFIX = "tinycloud:ui:button-hidden:v1:";
|
|
9
|
+
export declare const FALLBACK_APP_ID = "_page";
|
|
10
|
+
export interface HideScope {
|
|
11
|
+
readonly origin: string;
|
|
12
|
+
readonly appId: string;
|
|
13
|
+
}
|
|
14
|
+
export interface ButtonHideStore {
|
|
15
|
+
read(scope: HideScope): boolean;
|
|
16
|
+
write(scope: HideScope, hidden: boolean): void;
|
|
17
|
+
}
|
|
18
|
+
export declare function hideStorageKey(scope: HideScope): string;
|
|
19
|
+
/** config.ui.appId, then manifest.app_id, then the origin-wide constant. */
|
|
20
|
+
export declare function resolveUiAppId(configured: string | undefined, manifestAppId: string | undefined): string;
|
|
21
|
+
/**
|
|
22
|
+
* `storage` is resolved per call so a blocked localStorage getter is caught on
|
|
23
|
+
* every access, not only at construction.
|
|
24
|
+
*/
|
|
25
|
+
export declare function createButtonHideStore(storage: () => Storage | undefined): ButtonHideStore;
|
|
26
|
+
/** Default storage: window.localStorage, or undefined when access throws. */
|
|
27
|
+
export declare function defaultLocalStorage(): Storage | undefined;
|
|
28
|
+
//# sourceMappingURL=persistence.d.ts.map
|