@livx.cc/native-kit 0.45.23 → 0.45.24

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@livx.cc/native-kit",
3
- "version": "0.45.23",
3
+ "version": "0.45.24",
4
4
  "description": "Isomorphic native-capabilities kit for PWAs — same API in browser and in an appwrap native shell. Zero dependencies.",
5
5
  "license": "MIT",
6
6
  "author": "Elya Livshitz",
package/src/index.ts CHANGED
@@ -43,7 +43,7 @@ export { isScanResult } from './modules/scanner';
43
43
  export type { SpeechVoice, SpeakOptions, ListenOptions, SpeechPartial } from './modules/speech';
44
44
  export type { CalendarEventOptions } from './modules/calendar';
45
45
  export type { BrowserOptions } from './modules/browser';
46
- export type { WebViewState, WebViewOpenOptions, WebViewNavOp } from './modules/webview';
46
+ export type { WebViewState, WebViewOpenOptions, WebViewNavOp, WebViewFabOptions } from './modules/webview';
47
47
  export type { OAuthAuthorizeParams, OAuthResult } from './modules/oauth';
48
48
  export type { TrackingStatus } from './modules/tracking';
49
49
  export type {
@@ -17,6 +17,19 @@ export interface WebViewOpenOptions {
17
17
  bottom?: number;
18
18
  }
19
19
 
20
+ export interface WebViewFabOptions {
21
+ show: boolean;
22
+ bottom?: number;
23
+ right?: number;
24
+ size?: number;
25
+ /** Corner radius (px); default = round. */
26
+ radius?: number;
27
+ color?: string;
28
+ symbol?: string;
29
+ text?: string;
30
+ label?: string;
31
+ }
32
+
20
33
  /** A cookie as data; `expires` = unix seconds, absent/null = session cookie. A leading-dot `domain` = domain cookie. */
21
34
  export interface WebViewCookie {
22
35
  name: string;
@@ -80,6 +93,18 @@ export class WebViewModule {
80
93
  return (await this.kit.invoke<{ result: T }>('webview.eval', { js, ...opts }, { timeoutMs: 35_000 })).result; // (native gives up at 30s)
81
94
  }
82
95
 
96
+ /** A round floating button over the app and the overlay (stays tappable while a page is shown) — e.g. an assistant
97
+ * button. `bottom`/`right`: CSS px from the app WebView's bottom-right; `color` #rrggbb; `symbol`: an SF Symbol (iOS,
98
+ * default 'sparkles'); `text`: its glyph on Android ('✦'); `label`: accessibility. `show:false` hides it. Taps →
99
+ * {@link onFab}. Works with or without an open overlay. */
100
+ fab(opts: WebViewFabOptions): Promise<{ shown: boolean }> {
101
+ return this.kit.invoke('webview.fab', { ...opts });
102
+ }
103
+
104
+ onFab(cb: () => void): Unsubscribe {
105
+ return this.kit.on('webview.fab', () => cb());
106
+ }
107
+
83
108
  /** Tear the overlay down (fires {@link onClosed}). */
84
109
  close(): Promise<void> {
85
110
  return this.kit.invoke('webview.close', {});