@tinycloud/web-sdk 3.16.0 → 3.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -20,7 +20,7 @@ export interface ToastRegion {
20
20
  clearReceipts(): void;
21
21
  dispose(): void;
22
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";
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,.tstack .toast__action{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,.toast__action: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,.toast__action:focus-visible{outline-color:#fafafa;box-shadow:0 0 0 6px #111827}\n}\n";
24
24
  /**
25
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
26
  * pushes a plain toast (used to confirm a copy) and honors `ui.toasts`.
@@ -55,6 +55,8 @@ export declare const STRINGS: {
55
55
  readonly "sync.reason.unknown": "Something went wrong with the local copy.";
56
56
  readonly "toast.done": "Done";
57
57
  readonly "toast.signed_in": "Successfully signed in";
58
+ readonly "toast.account_setup_pending": "Finish setting up your TinyCloud account";
59
+ readonly "toast.account_setup_action": "Set up";
58
60
  readonly "toast.attention": "Something needs your attention. Details are in the console.";
59
61
  readonly "toast.error_generic": "Something went wrong.";
60
62
  readonly "toast.unexpected_error": "An unexpected error occurred. Try refreshing the page.";
@@ -3,12 +3,19 @@
3
3
  * subscribes and renders. Text is a strings.ts code, never raw text.
4
4
  */
5
5
  export type ToastKind = "info" | "success" | "warning" | "error";
6
+ /** A button in the toast. Clicking it dismisses the toast, then calls `run` in the click's tick (a popup it opens is not blocked). */
7
+ export interface ToastAction {
8
+ readonly labelCode: string;
9
+ readonly run: () => void;
10
+ }
6
11
  export interface ToastRequest {
7
12
  readonly kind: ToastKind;
8
13
  /** A launcher code, or a panel or section code when the panel raises the toast. Unknown codes render the neutral line. */
9
14
  readonly textCode: string;
10
15
  readonly href?: string;
11
16
  readonly hrefLabelCode?: string;
17
+ /** A toast with an action stays until it is clicked or closed; it never auto-dismisses. */
18
+ readonly action?: ToastAction;
12
19
  }
13
20
  /** Delivers a toast to the page's host. Returns false when nothing was shown. */
14
21
  export type ToastSink = (request: ToastRequest) => boolean;
@@ -19,6 +26,7 @@ export interface ToastView {
19
26
  /** Present only when it is an absolute https URL. */
20
27
  readonly href?: string;
21
28
  readonly hrefLabelCode?: string;
29
+ readonly action?: ToastAction;
22
30
  }
23
31
  export interface ToastStoreOptions {
24
32
  /** Auto-dismiss delay per toast. Default 7000. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tinycloud/web-sdk",
3
- "version": "3.16.0",
3
+ "version": "3.18.0",
4
4
  "description": "A set of tools and utilities to help you build your app with TinyCloud.",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",
@@ -68,10 +68,10 @@
68
68
  "@multiformats/multiaddr": "^13.0.1",
69
69
  "@multiformats/multiaddr-to-uri": "^12.0.0",
70
70
  "@noble/curves": "^1.9.7",
71
- "@tinycloud/node-sdk": "3.16.0",
71
+ "@tinycloud/node-sdk": "3.18.0",
72
72
  "@tinycloud/replica": "0.4.8",
73
73
  "@tinycloud/sdk-core": "3.15.0",
74
- "@tinycloud/share-envelope": "1.6.0",
74
+ "@tinycloud/share-envelope": "1.7.0",
75
75
  "@tinycloud/share-sdk": "1.6.0",
76
76
  "@tinycloud/web-sdk-wasm": "1.8.0",
77
77
  "axios": "^1.7.9",
@@ -1,23 +0,0 @@
1
- /*!
2
- * The buffer module from node.js, for the browser.
3
- *
4
- * @author Feross Aboukhadijeh <https://feross.org>
5
- * @license MIT
6
- */
7
-
8
- /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
9
-
10
- /*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) */
11
-
12
- /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
13
-
14
- /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
15
-
16
- /**
17
- * [js-sha3]{@link https://github.com/emn178/js-sha3}
18
- *
19
- * @version 0.8.0
20
- * @author Chen, Yi-Cyuan [emn178@gmail.com]
21
- * @copyright Chen, Yi-Cyuan 2015-2018
22
- * @license MIT
23
- */
@@ -1,23 +0,0 @@
1
- /*!
2
- * The buffer module from node.js, for the browser.
3
- *
4
- * @author Feross Aboukhadijeh <https://feross.org>
5
- * @license MIT
6
- */
7
-
8
- /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
9
-
10
- /*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) */
11
-
12
- /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
13
-
14
- /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
15
-
16
- /**
17
- * [js-sha3]{@link https://github.com/emn178/js-sha3}
18
- *
19
- * @version 0.8.0
20
- * @author Chen, Yi-Cyuan [emn178@gmail.com]
21
- * @copyright Chen, Yi-Cyuan 2015-2018
22
- * @license MIT
23
- */