@nativedesktop/react 0.4.10 → 0.4.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js
CHANGED
|
@@ -742,7 +742,7 @@ var widgetCommands = {
|
|
|
742
742
|
tabview: [],
|
|
743
743
|
grid: [],
|
|
744
744
|
listview: [],
|
|
745
|
-
webview: ["goBack", "goForward", "reload", "stop", "executeJavaScript", "setZoom", "setUserAgent", "openDevTools", "addUserScript", "removeUserScript", "clearUserScripts", "registerScriptMessage", "unregisterScriptMessage", "respondScheme", "respondPermission", "getCookies", "setCookie", "deleteCookie", "findStart", "findNext", "findPrevious", "findStop", "saveSession", "restoreSession", "setMuted", "setContextMenuItems", "listExtensions", "watchExtensions", "listExtensionActions", "installExtension", "uninstallExtension", "setExtensionEnabled", "focus"],
|
|
745
|
+
webview: ["goBack", "goForward", "reload", "stop", "executeJavaScript", "setZoom", "setUserAgent", "openDevTools", "addUserScript", "removeUserScript", "clearUserScripts", "registerScriptMessage", "unregisterScriptMessage", "respondScheme", "respondPermission", "getCookies", "setCookie", "deleteCookie", "findStart", "findNext", "findPrevious", "findStop", "saveSession", "restoreSession", "setMuted", "setContextMenuItems", "listExtensions", "watchExtensions", "listExtensionActions", "readExtensionAction", "installExtension", "uninstallExtension", "setExtensionEnabled", "focus"],
|
|
746
746
|
nativeview: [],
|
|
747
747
|
splitview: [],
|
|
748
748
|
headerbar: [],
|
|
@@ -1935,6 +1935,7 @@ var pendingSessions = new Map;
|
|
|
1935
1935
|
var pendingExtensions = new Map;
|
|
1936
1936
|
var pendingActions = new Map;
|
|
1937
1937
|
var pendingWatches = new Map;
|
|
1938
|
+
var pendingActionState = new Map;
|
|
1938
1939
|
var seq2 = 0;
|
|
1939
1940
|
function nextId(prefix) {
|
|
1940
1941
|
return `${prefix}${++seq2}`;
|
|
@@ -2049,6 +2050,13 @@ function onExtensionsChanged(e) {
|
|
|
2049
2050
|
for (const listener of extensionsWatchers)
|
|
2050
2051
|
listener({ reason: result.reason ?? "" });
|
|
2051
2052
|
}
|
|
2053
|
+
function readExtensionAction(node) {
|
|
2054
|
+
const id = nextId("ext");
|
|
2055
|
+
return new Promise((resolve2, reject2) => {
|
|
2056
|
+
pendingActionState.set(id, { resolve: resolve2, reject: reject2 });
|
|
2057
|
+
sendCommand(node, "readExtensionAction", { id });
|
|
2058
|
+
});
|
|
2059
|
+
}
|
|
2052
2060
|
function listExtensionActions(node) {
|
|
2053
2061
|
const id = nextId("ext");
|
|
2054
2062
|
return new Promise((resolve2, reject2) => {
|
|
@@ -2058,6 +2066,15 @@ function listExtensionActions(node) {
|
|
|
2058
2066
|
}
|
|
2059
2067
|
function onExtensionActions(e) {
|
|
2060
2068
|
const result = e.data;
|
|
2069
|
+
const state3 = pendingActionState.get(result.id);
|
|
2070
|
+
if (state3) {
|
|
2071
|
+
pendingActionState.delete(result.id);
|
|
2072
|
+
if (result.ok && result.action)
|
|
2073
|
+
state3.resolve(result.action);
|
|
2074
|
+
else
|
|
2075
|
+
state3.reject(new Error(result.error ?? "readExtensionAction failed"));
|
|
2076
|
+
return;
|
|
2077
|
+
}
|
|
2061
2078
|
const call2 = pendingActions.get(result.id);
|
|
2062
2079
|
if (!call2)
|
|
2063
2080
|
return;
|
|
@@ -2455,6 +2472,7 @@ export {
|
|
|
2455
2472
|
render,
|
|
2456
2473
|
registerExports,
|
|
2457
2474
|
recentDocuments,
|
|
2475
|
+
readExtensionAction,
|
|
2458
2476
|
performRefresh,
|
|
2459
2477
|
openPath,
|
|
2460
2478
|
openFile,
|
|
@@ -29,7 +29,7 @@ export type WidgetCommandNames = {
|
|
|
29
29
|
"checkbox": "focus";
|
|
30
30
|
"radio": "focus";
|
|
31
31
|
"select": "focus";
|
|
32
|
-
"webview": "goBack" | "goForward" | "reload" | "stop" | "executeJavaScript" | "setZoom" | "setUserAgent" | "openDevTools" | "addUserScript" | "removeUserScript" | "clearUserScripts" | "registerScriptMessage" | "unregisterScriptMessage" | "respondScheme" | "respondPermission" | "getCookies" | "setCookie" | "deleteCookie" | "findStart" | "findNext" | "findPrevious" | "findStop" | "saveSession" | "restoreSession" | "setMuted" | "setContextMenuItems" | "listExtensions" | "watchExtensions" | "listExtensionActions" | "installExtension" | "uninstallExtension" | "setExtensionEnabled" | "focus";
|
|
32
|
+
"webview": "goBack" | "goForward" | "reload" | "stop" | "executeJavaScript" | "setZoom" | "setUserAgent" | "openDevTools" | "addUserScript" | "removeUserScript" | "clearUserScripts" | "registerScriptMessage" | "unregisterScriptMessage" | "respondScheme" | "respondPermission" | "getCookies" | "setCookie" | "deleteCookie" | "findStart" | "findNext" | "findPrevious" | "findStop" | "saveSession" | "restoreSession" | "setMuted" | "setContextMenuItems" | "listExtensions" | "watchExtensions" | "listExtensionActions" | "readExtensionAction" | "installExtension" | "uninstallExtension" | "setExtensionEnabled" | "focus";
|
|
33
33
|
"searchinput": "focus";
|
|
34
34
|
"switch": "focus";
|
|
35
35
|
"numberinput": "focus";
|
|
@@ -7,8 +7,8 @@ export type { SpacingScale } from "./metrics.ts";
|
|
|
7
7
|
export { getAppDataDir, ensureAppDataDir } from "./paths.ts";
|
|
8
8
|
export { defineNativeComponent } from "./native-component.ts";
|
|
9
9
|
export type { NativeComponentOptions, NativeComponentProps, NativeComponentRef } from "./native-component.ts";
|
|
10
|
-
export { executeJavaScript, onJavaScriptResult, getCookies, onCookiesResult, saveSession, onSessionSaved, setContextMenuItems, listExtensions, onExtensionsList, listExtensionActions, onExtensionActions, watchExtensions, onExtensionsChanged, installExtension, uninstallExtension, setExtensionEnabled, } from "./webview.ts";
|
|
11
|
-
export type { Cookie, ContextMenuContext, ContextMenuItem, ContextMenuItemClick, ExtensionAction, ExtensionsChange, InstalledExtension, } from "./webview.ts";
|
|
10
|
+
export { executeJavaScript, onJavaScriptResult, getCookies, onCookiesResult, saveSession, onSessionSaved, setContextMenuItems, listExtensions, onExtensionsList, listExtensionActions, readExtensionAction, onExtensionActions, watchExtensions, onExtensionsChanged, installExtension, uninstallExtension, setExtensionEnabled, } from "./webview.ts";
|
|
11
|
+
export type { Cookie, ContextMenuContext, ContextMenuItem, ContextMenuItemClick, ExtensionAction, ExtensionActionState, ExtensionsChange, InstalledExtension, } from "./webview.ts";
|
|
12
12
|
export { showAlert, openFile, saveFile, showAbout, showTabOverview, onAlertResult, onOpenFileResult, onSaveFileResult, } from "./dialogs.ts";
|
|
13
13
|
export type { DialogButton, ShowAlertOptions, AlertResult, OpenFileOptions as WindowOpenFileOptions, OpenFileResult as WindowOpenFileResult, SaveFileOptions as WindowSaveFileOptions, SaveFileResult as WindowSaveFileResult, ShowAboutOptions, } from "./dialogs.ts";
|
|
14
14
|
export { showToast, dismissToast, onToastButtonClicked, onToastDismissed } from "./toast.ts";
|
|
@@ -56,9 +56,20 @@ export interface ExtensionAction {
|
|
|
56
56
|
iconUrl: string;
|
|
57
57
|
/** `chrome-extension://…` popup page, or "" for an action that fires `onClicked`. */
|
|
58
58
|
popupUrl: string;
|
|
59
|
-
/** Always "":
|
|
59
|
+
/** Always "": read the live value with `readExtensionAction`. */
|
|
60
60
|
badgeText: string;
|
|
61
61
|
}
|
|
62
|
+
export interface ExtensionActionState {
|
|
63
|
+
id: string;
|
|
64
|
+
tabId: number;
|
|
65
|
+
tabUrl: string;
|
|
66
|
+
popupUrl: string;
|
|
67
|
+
badgeText: string;
|
|
68
|
+
badgeColor: number[];
|
|
69
|
+
title: string;
|
|
70
|
+
enabled: boolean;
|
|
71
|
+
}
|
|
72
|
+
export declare function readExtensionAction(node: NdNodeRef<"webview">): Promise<ExtensionActionState>;
|
|
62
73
|
export declare function listExtensionActions(node: NdNodeRef<"webview">): Promise<ExtensionAction[]>;
|
|
63
74
|
export declare function onExtensionActions(e: {
|
|
64
75
|
data: unknown;
|