desktopr 2.1.0 → 2.1.1
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-sdk/bridge.constants.json +1 -1
- package/dist-sdk/{_companion_context.js → companion_context.js} +2 -2
- package/dist-sdk/core/_helpers.d.ts +1 -1
- package/dist-sdk/core/_main.js +3 -3
- package/dist-sdk/desktopr/_helpers.d.ts +1 -1
- package/dist-sdk/desktopr/_main.d.ts +1 -1
- package/dist-sdk/desktopr/_main.js +3 -3
- package/dist-sdk/modules/rs/app/_main.d.ts +1 -1
- package/dist-sdk/modules/rs/app/_types.d.ts +1 -1
- package/dist-sdk/modules/rs/autostart/_main.d.ts +1 -1
- package/dist-sdk/modules/rs/badge/_main.d.ts +1 -1
- package/dist-sdk/modules/rs/badge/_main.js +3 -3
- package/dist-sdk/modules/rs/clipboard/_main.d.ts +1 -1
- package/dist-sdk/modules/rs/companion/_helpers.d.ts +1 -1
- package/dist-sdk/modules/rs/companion/_main.d.ts +1 -1
- package/dist-sdk/modules/rs/companion/_main.js +2 -2
- package/dist-sdk/modules/rs/companion/_types.d.ts +1 -1
- package/dist-sdk/modules/rs/contextMenu/_helpers.d.ts +1 -1
- package/dist-sdk/modules/rs/contextMenu/_helpers.js +2 -2
- package/dist-sdk/modules/rs/contextMenu/_main.d.ts +1 -1
- package/dist-sdk/modules/rs/contextMenu/_main.js +4 -4
- package/dist-sdk/modules/rs/contextMenu/_types.d.ts +1 -1
- package/dist-sdk/modules/rs/diagnostics/_helpers.d.ts +1 -1
- package/dist-sdk/modules/rs/diagnostics/_helpers.js +2 -2
- package/dist-sdk/modules/rs/diagnostics/_main.d.ts +1 -1
- package/dist-sdk/modules/rs/dragdrop/_main.d.ts +1 -1
- package/dist-sdk/modules/rs/dragdrop/_main.js +2 -2
- package/dist-sdk/modules/rs/events/_main.d.ts +2 -2
- package/dist-sdk/modules/rs/events/_main.js +10 -10
- package/dist-sdk/modules/rs/events/_types.d.ts +10 -9
- package/dist-sdk/modules/rs/files/_main.d.ts +1 -1
- package/dist-sdk/modules/rs/fs/_main.d.ts +2 -2
- package/dist-sdk/modules/rs/fs/_main.js +2 -2
- package/dist-sdk/modules/rs/globalVariables/_main.d.ts +1 -1
- package/dist-sdk/modules/rs/menu/_helpers.d.ts +1 -1
- package/dist-sdk/modules/rs/menu/_main.d.ts +1 -1
- package/dist-sdk/modules/rs/menu/_main.js +2 -2
- package/dist-sdk/modules/rs/network/_main.d.ts +1 -1
- package/dist-sdk/modules/rs/notifications/_main.d.ts +1 -1
- package/dist-sdk/modules/rs/plugins/_main.d.ts +1 -1
- package/dist-sdk/modules/rs/shortcuts/_main.d.ts +1 -1
- package/dist-sdk/modules/rs/shortcuts/_main.js +5 -5
- package/dist-sdk/modules/rs/window/_helpers.js +7 -7
- package/dist-sdk/modules/rs/window/_main.d.ts +1 -1
- package/dist-sdk/modules/rs/window/_types.d.ts +1 -1
- package/dist-sdk/modules/rs/worker/_main.d.ts +1 -1
- package/dist-sdk/modules/rs/worker/_main.js +5 -5
- package/dist-sdk/sdk/_proxy.d.ts +1 -1
- package/dist-sdk/sdk/index.d.ts +1 -1
- package/package.json +2 -2
- /package/dist-sdk/{_companion_context.d.ts → companion_context.d.ts} +0 -0
- /package/dist-sdk/{_constants.d.ts → constants.d.ts} +0 -0
- /package/dist-sdk/{_constants.js → constants.js} +0 -0
- /package/dist-sdk/{_helpers.d.ts → helpers.d.ts} +0 -0
- /package/dist-sdk/{_helpers.js → helpers.js} +0 -0
- /package/dist-sdk/{_main.d.ts → main.d.ts} +0 -0
- /package/dist-sdk/{_main.js → main.js} +0 -0
- /package/dist-sdk/{_types.d.ts → types.d.ts} +0 -0
- /package/dist-sdk/{_types.js → types.js} +0 -0
|
@@ -5,12 +5,12 @@ exports.getCacheOnlyWindowContext = getCacheOnlyWindowContext;
|
|
|
5
5
|
exports.isCacheOnlyWindow = isCacheOnlyWindow;
|
|
6
6
|
exports.getCacheOnlyWindowLabel = getCacheOnlyWindowLabel;
|
|
7
7
|
exports.getCacheOnlySessionId = getCacheOnlySessionId;
|
|
8
|
-
const
|
|
8
|
+
const constants_1 = require("./constants");
|
|
9
9
|
let state = {
|
|
10
10
|
isCacheOnly: false,
|
|
11
11
|
};
|
|
12
12
|
function parseCompanionWindowLabel(label) {
|
|
13
|
-
const prefix =
|
|
13
|
+
const prefix = constants_1.COMAPNION_WINDOW_LABEL_PREFIX.trim();
|
|
14
14
|
if (!label.startsWith(prefix)) {
|
|
15
15
|
return { isCacheOnly: false };
|
|
16
16
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TauriCore, WindowTauri } from "../
|
|
1
|
+
import { TauriCore, WindowTauri } from "../types";
|
|
2
2
|
export declare function extractCore(source: unknown): TauriCore | null;
|
|
3
3
|
export declare const ensureCore: () => Promise<TauriCore>;
|
|
4
4
|
export declare const windowTauriProxy: WindowTauri;
|
package/dist-sdk/core/_main.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.buildCore = buildCore;
|
|
4
|
-
const
|
|
4
|
+
const helpers_1 = require("../helpers");
|
|
5
5
|
function buildCore() {
|
|
6
6
|
return {
|
|
7
7
|
get ready() {
|
|
8
|
-
return (0,
|
|
8
|
+
return (0, helpers_1.ensureCore)().then(() => true);
|
|
9
9
|
},
|
|
10
10
|
async invoke(cmd, payload) {
|
|
11
|
-
const core = await (0,
|
|
11
|
+
const core = await (0, helpers_1.ensureCore)();
|
|
12
12
|
return core.invoke(cmd, payload);
|
|
13
13
|
},
|
|
14
14
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DesktoprInstanceInterface } from "../
|
|
1
|
+
import { DesktoprInstanceInterface } from "../types";
|
|
2
2
|
export declare const DesktoprInstance: DesktoprInstanceInterface;
|
|
3
3
|
export declare const dtrInitiators: () => Promise<void>;
|
|
4
4
|
export declare const dtrReadyEventListener: (callback: Function) => void;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.dtrReadyEventListener = exports.dtrInitiators = exports.DesktoprInstance = void 0;
|
|
4
4
|
// import { listenForEvent } from "../_helpers";
|
|
5
|
-
const
|
|
5
|
+
const constants_1 = require("../constants");
|
|
6
6
|
exports.DesktoprInstance = {
|
|
7
7
|
ready: () => {
|
|
8
8
|
if (!window?.Desktopr)
|
|
@@ -20,7 +20,7 @@ const dtrInitiators = async () => {
|
|
|
20
20
|
if (!exports.DesktoprInstance.ready())
|
|
21
21
|
throw ("Desktopr instance not found");
|
|
22
22
|
console.log("## READY ##");
|
|
23
|
-
const eventReady = new CustomEvent(
|
|
23
|
+
const eventReady = new CustomEvent(constants_1.READY_EVENT_NAME);
|
|
24
24
|
window?.dispatchEvent(eventReady);
|
|
25
25
|
}
|
|
26
26
|
catch (error) {
|
|
@@ -28,5 +28,5 @@ const dtrInitiators = async () => {
|
|
|
28
28
|
}
|
|
29
29
|
};
|
|
30
30
|
exports.dtrInitiators = dtrInitiators;
|
|
31
|
-
const dtrReadyEventListener = (callback) => window.addEventListener(
|
|
31
|
+
const dtrReadyEventListener = (callback) => window.addEventListener(constants_1.READY_EVENT_NAME, () => callback());
|
|
32
32
|
exports.dtrReadyEventListener = dtrReadyEventListener;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.buildBadge = buildBadge;
|
|
4
|
-
const
|
|
4
|
+
const helpers_1 = require("../../../helpers");
|
|
5
5
|
function buildBadge(core) {
|
|
6
6
|
return {
|
|
7
7
|
set: async (count) => {
|
|
8
|
-
await (0,
|
|
8
|
+
await (0, helpers_1.platformSpecifcFilter)(["macos"]);
|
|
9
9
|
core.invoke("dtr_badge_set", { count });
|
|
10
10
|
},
|
|
11
11
|
clear: async () => {
|
|
12
|
-
await (0,
|
|
12
|
+
await (0, helpers_1.platformSpecifcFilter)(["macos"]);
|
|
13
13
|
core.invoke("dtr_badge_clear");
|
|
14
14
|
},
|
|
15
15
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.buildCompanion = buildCompanion;
|
|
4
|
-
const
|
|
4
|
+
const helpers_1 = require("../../../helpers");
|
|
5
5
|
function buildCompanion(core) {
|
|
6
6
|
return {
|
|
7
|
-
launch: (appConfig) => (0,
|
|
7
|
+
launch: (appConfig) => (0, helpers_1.launchCompanion)(core, appConfig),
|
|
8
8
|
state: {}
|
|
9
9
|
};
|
|
10
10
|
}
|
|
@@ -4,7 +4,7 @@ exports.removeContextMenuListener = exports.initContextMenuListener = exports.CM
|
|
|
4
4
|
exports.isCmType = isCmType;
|
|
5
5
|
exports.parseCmType = parseCmType;
|
|
6
6
|
exports.normalizeEntries = normalizeEntries;
|
|
7
|
-
const
|
|
7
|
+
const helpers_1 = require("../../../helpers");
|
|
8
8
|
const utils_1 = require("../../../utils");
|
|
9
9
|
// Keep CM_TYPES as a readonly tuple and assert it matches CmType[]
|
|
10
10
|
exports.CM_TYPES = [
|
|
@@ -28,7 +28,7 @@ function isCmType(value) {
|
|
|
28
28
|
function parseCmType(value) {
|
|
29
29
|
if (!utils_1.validate.nonEmptyString(value))
|
|
30
30
|
return null;
|
|
31
|
-
const normalized = (0,
|
|
31
|
+
const normalized = (0, helpers_1.normalizeString)(value);
|
|
32
32
|
return isCmType(normalized) ? normalized : null;
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.buildContextMenu = buildContextMenu;
|
|
4
|
-
const
|
|
4
|
+
const helpers_1 = require("../../../helpers");
|
|
5
5
|
function buildContextMenu(core) {
|
|
6
6
|
return {
|
|
7
|
-
show: (entries, options) => core.invoke("dtr_context_menu_popup", { items: (0,
|
|
7
|
+
show: (entries, options) => core.invoke("dtr_context_menu_popup", { items: (0, helpers_1.normalizeEntries)(entries), options }),
|
|
8
8
|
handler: {
|
|
9
|
-
init:
|
|
10
|
-
remove:
|
|
9
|
+
init: helpers_1.initContextMenuListener,
|
|
10
|
+
remove: helpers_1.removeContextMenuListener
|
|
11
11
|
}
|
|
12
12
|
};
|
|
13
13
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DesktoprAPI } from "../../../
|
|
1
|
+
import { DesktoprAPI } from "../../../types";
|
|
2
2
|
import { DiagnosticsTestFunctions, PrivacySettings, PrivacySettingsCamelCase } from "./_types";
|
|
3
3
|
export declare const diagnosticsSettings: (core: {
|
|
4
4
|
invoke: DesktoprAPI["invoke"];
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.deriveAppVersion = exports.diagnosticsSettings = void 0;
|
|
4
4
|
exports.buildDiagnosticsTestFunctions = buildDiagnosticsTestFunctions;
|
|
5
5
|
const utils_1 = require("../../../utils");
|
|
6
|
-
const
|
|
6
|
+
const helpers_1 = require("../../../helpers");
|
|
7
7
|
const diagnosticsSettings = async (core, settings) => {
|
|
8
8
|
if (settings?.retentionDaysAnalytics && !utils_1.Num.isU32(settings.retentionDaysAnalytics))
|
|
9
9
|
throw ("[retentionDaysAnalytics] the value must be a U32 integer number");
|
|
@@ -25,7 +25,7 @@ exports.diagnosticsSettings = diagnosticsSettings;
|
|
|
25
25
|
const deriveAppVersion = async (v) => {
|
|
26
26
|
if (v)
|
|
27
27
|
return v;
|
|
28
|
-
const version = await (0,
|
|
28
|
+
const version = await (0, helpers_1.getAppVersion)();
|
|
29
29
|
return version;
|
|
30
30
|
};
|
|
31
31
|
exports.deriveAppVersion = deriveAppVersion;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.buildDragDrop = buildDragDrop;
|
|
4
|
-
const
|
|
4
|
+
const helpers_1 = require("../../../helpers");
|
|
5
5
|
// Puoi esportare qui un builder che semplicemente re-esporta quella logica.
|
|
6
6
|
function buildDragDrop() {
|
|
7
7
|
return {
|
|
@@ -9,7 +9,7 @@ function buildDragDrop() {
|
|
|
9
9
|
const evs = ["dragdrop:enter", "dragdrop:drop", "dragdrop:cancel"];
|
|
10
10
|
if (options?.includeHover)
|
|
11
11
|
evs.push("dragdrop:hover");
|
|
12
|
-
const offs = await Promise.all(evs.map((n) => (0,
|
|
12
|
+
const offs = await Promise.all(evs.map((n) => (0, helpers_1.listenForEvent)(n, (p) => handler(n, p))));
|
|
13
13
|
return () => offs.forEach((off) => off());
|
|
14
14
|
},
|
|
15
15
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DesktoprAPI } from "../../../
|
|
2
|
-
import type { EventsInterface } from "../../../
|
|
1
|
+
import { DesktoprAPI } from "../../../types";
|
|
2
|
+
import type { EventsInterface } from "../../../types";
|
|
3
3
|
export declare function buildEvents(core: {
|
|
4
4
|
invoke: DesktoprAPI["invoke"];
|
|
5
5
|
}): EventsInterface;
|
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.buildEvents = buildEvents;
|
|
4
|
-
const
|
|
4
|
+
const helpers_1 = require("../../../helpers");
|
|
5
5
|
function buildEvents(core) {
|
|
6
6
|
return {
|
|
7
7
|
emit: (event, payload) => core.invoke("dtr_event_emit_to_current_window", { event, payload }),
|
|
8
8
|
emitToAll: (event, payload) => core.invoke("dtr_event_emit", { event, payload }),
|
|
9
9
|
emitTo: (windowLabel, event, payload) => core.invoke("dtr_event_emit_to", { windowLabel, event, payload }),
|
|
10
|
-
on: async (event, handler) => (0,
|
|
10
|
+
on: async (event, handler) => (0, helpers_1.listenForEvent)(event, handler),
|
|
11
11
|
once: (event) => new Promise(async (resolve) => {
|
|
12
|
-
const off = await (0,
|
|
12
|
+
const off = await (0, helpers_1.listenForEvent)(event, (p) => {
|
|
13
13
|
off();
|
|
14
14
|
resolve(p);
|
|
15
15
|
});
|
|
16
16
|
}),
|
|
17
17
|
onMany: async (events, handler) => {
|
|
18
|
-
const offs = await Promise.all(events.map((n) => (0,
|
|
18
|
+
const offs = await Promise.all(events.map((n) => (0, helpers_1.listenForEvent)(n, (p) => handler(n, p))));
|
|
19
19
|
return () => offs.forEach((off) => off());
|
|
20
20
|
},
|
|
21
|
-
onNetworkStatus: async (handler) => (0,
|
|
22
|
-
onDeeplink: async (handler) => (0,
|
|
23
|
-
onShortcut: async (handler) => (0,
|
|
21
|
+
onNetworkStatus: async (handler) => (0, helpers_1.listenForEvent)("network:status", handler),
|
|
22
|
+
onDeeplink: async (handler) => (0, helpers_1.listenForEvent)("deeplink", handler),
|
|
23
|
+
onShortcut: async (handler) => (0, helpers_1.listenForEvent)("shortcut:event", handler),
|
|
24
24
|
onDragDrop: async (handler, options) => {
|
|
25
25
|
const evs = ["dragdrop:enter", "dragdrop:drop", "dragdrop:cancel"];
|
|
26
26
|
if (options?.includeHover)
|
|
27
27
|
evs.push("dragdrop:hover");
|
|
28
|
-
const offs = await Promise.all(evs.map((n) => (0,
|
|
28
|
+
const offs = await Promise.all(evs.map((n) => (0, helpers_1.listenForEvent)(n, (p) => handler(n, p))));
|
|
29
29
|
return () => offs.forEach((off) => off());
|
|
30
30
|
},
|
|
31
|
-
onMenuEvent: async (handler) => (0,
|
|
32
|
-
onTrayIconEvent: async (handler) => (0,
|
|
31
|
+
onMenuEvent: async (handler) => (0, helpers_1.listenForEvent)("menu:event", handler),
|
|
32
|
+
onTrayIconEvent: async (handler) => (0, helpers_1.listenForEvent)("tray:icon", handler)
|
|
33
33
|
};
|
|
34
34
|
}
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import { DragDropPayload } from "../../../
|
|
1
|
+
import { DragDropPayload } from "../../../types";
|
|
2
|
+
import type { Unlisten } from "./_helpers";
|
|
2
3
|
export interface EventsInterface {
|
|
3
4
|
emit: (event: string, payload?: unknown) => Promise<unknown>;
|
|
4
5
|
emitToAll: (event: string, payload?: unknown) => Promise<unknown>;
|
|
5
6
|
emitTo: (windowLabel: string, event: string, payload?: unknown) => Promise<unknown>;
|
|
6
|
-
on: (event: string, handler: (payload: any) => void) => Promise<
|
|
7
|
+
on: (event: string, handler: (payload: any) => void) => Promise<Unlisten>;
|
|
7
8
|
once: (event: string) => Promise<any>;
|
|
8
|
-
onMany: (events: string[], handler: (name: string, payload: any) => void) => Promise<
|
|
9
|
-
onNetworkStatus: (handler: (payload: any) => void) => Promise<
|
|
10
|
-
onDeeplink: (handler: (payload: any) => void) => Promise<
|
|
11
|
-
onShortcut: (handler: (payload: any) => void) => Promise<
|
|
9
|
+
onMany: (events: string[], handler: (name: string, payload: any) => void) => Promise<Unlisten>;
|
|
10
|
+
onNetworkStatus: (handler: (payload: any) => void) => Promise<Unlisten>;
|
|
11
|
+
onDeeplink: (handler: (payload: any) => void) => Promise<Unlisten>;
|
|
12
|
+
onShortcut: (handler: (payload: any) => void) => Promise<Unlisten>;
|
|
12
13
|
onDragDrop: (handler: (name: string, payload: DragDropPayload) => void, options?: {
|
|
13
14
|
includeHover?: boolean;
|
|
14
|
-
}) => Promise<
|
|
15
|
-
onMenuEvent: (handler: (payload: any) => void) => Promise<
|
|
16
|
-
onTrayIconEvent: (handler: (payload: any) => void) => Promise<
|
|
15
|
+
}) => Promise<Unlisten>;
|
|
16
|
+
onMenuEvent: (handler: (payload: any) => void) => Promise<Unlisten>;
|
|
17
|
+
onTrayIconEvent: (handler: (payload: any) => void) => Promise<Unlisten>;
|
|
17
18
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DesktoprAPI } from "../../../
|
|
2
|
-
import type { FsInterface } from "../../../
|
|
1
|
+
import { DesktoprAPI } from "../../../types";
|
|
2
|
+
import type { FsInterface } from "../../../types";
|
|
3
3
|
export declare function buildFs(core: {
|
|
4
4
|
invoke: DesktoprAPI["invoke"];
|
|
5
5
|
}): FsInterface;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.buildFs = buildFs;
|
|
4
|
-
const
|
|
4
|
+
const helpers_1 = require("../../../helpers");
|
|
5
5
|
const getWindowLabelIfCompanion = () => {
|
|
6
6
|
const compState = window?.Desktopr?.window
|
|
7
7
|
?.state;
|
|
@@ -170,7 +170,7 @@ function scope(core, permanent) {
|
|
|
170
170
|
}
|
|
171
171
|
function pluginFsScope(core, plugin) {
|
|
172
172
|
const pluginModuleName = ((plugin?.trim()) ?? undefined);
|
|
173
|
-
const santizedluginModuleName = ((0,
|
|
173
|
+
const santizedluginModuleName = ((0, helpers_1.normalizeModuleName)(pluginModuleName)?.trim()) ?? undefined;
|
|
174
174
|
if (!santizedluginModuleName)
|
|
175
175
|
throw ("Invalid plugin name");
|
|
176
176
|
const coreMethods = scopeCoreMethods(core, true, santizedluginModuleName);
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.buildMenu = buildMenu;
|
|
4
|
-
const
|
|
4
|
+
const helpers_1 = require("../../../helpers");
|
|
5
5
|
function buildMenu(core) {
|
|
6
6
|
return {
|
|
7
7
|
setEnabled: (id, enabled) => core.invoke("dtr_menu_set_enabled", { id, enabled }),
|
|
8
8
|
setChecked: (id, checked) => core.invoke("dtr_menu_set_checked", { id, checked }),
|
|
9
9
|
init: {
|
|
10
|
-
fromConfig: (config, windowLabel) => (0,
|
|
10
|
+
fromConfig: (config, windowLabel) => (0, helpers_1.initMenuConfig)(core, config, windowLabel),
|
|
11
11
|
fromJsonFile: (filePath) => core.invoke("dtr_init_menu_from_file", { filePath })
|
|
12
12
|
}
|
|
13
13
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.buildShortcuts = buildShortcuts;
|
|
4
|
-
const
|
|
4
|
+
const helpers_1 = require("../../../helpers");
|
|
5
5
|
function buildShortcuts(core) {
|
|
6
6
|
return {
|
|
7
7
|
register: async (accelerator, cb, options) => {
|
|
8
|
-
const gs = (0,
|
|
8
|
+
const gs = (0, helpers_1.tauriGlobalShortcut)();
|
|
9
9
|
await gs.register(accelerator, async (e) => {
|
|
10
10
|
const payload = { accelerator, ...e };
|
|
11
11
|
if (options?.emitEvent)
|
|
@@ -14,17 +14,17 @@ function buildShortcuts(core) {
|
|
|
14
14
|
});
|
|
15
15
|
},
|
|
16
16
|
unregister: async (accelerator) => {
|
|
17
|
-
const gs = (0,
|
|
17
|
+
const gs = (0, helpers_1.tauriGlobalShortcut)();
|
|
18
18
|
const reg = await gs.isRegistered(accelerator);
|
|
19
19
|
if (reg)
|
|
20
20
|
await gs.unregister(accelerator);
|
|
21
21
|
},
|
|
22
22
|
unregisterAll: async () => {
|
|
23
|
-
const gs = (0,
|
|
23
|
+
const gs = (0, helpers_1.tauriGlobalShortcut)();
|
|
24
24
|
await gs.unregisterAll();
|
|
25
25
|
},
|
|
26
26
|
isRegistered: async (accelerator) => {
|
|
27
|
-
const gs = (0,
|
|
27
|
+
const gs = (0, helpers_1.tauriGlobalShortcut)();
|
|
28
28
|
return gs.isRegistered(accelerator);
|
|
29
29
|
},
|
|
30
30
|
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.closeWindow = exports.newWindow = exports.waitTauri = exports.tauriReadyCheck = void 0;
|
|
4
4
|
const sdk_1 = require("../../../sdk");
|
|
5
|
-
const
|
|
5
|
+
const constants_1 = require("../../../constants");
|
|
6
6
|
const utils_1 = require("../../../utils");
|
|
7
7
|
const tauriReadyCheck = () => typeof window !== "undefined" &&
|
|
8
8
|
window.__TAURI__ &&
|
|
@@ -19,8 +19,8 @@ const waitTauri = async () => {
|
|
|
19
19
|
exports.waitTauri = waitTauri;
|
|
20
20
|
const newWindow = async (core, options) => {
|
|
21
21
|
if (options?.label) {
|
|
22
|
-
if (options.label.trim().toLowerCase().startsWith((
|
|
23
|
-
throw new Error(`[Reserved window label] '${
|
|
22
|
+
if (options.label.trim().toLowerCase().startsWith((constants_1.COMAPNION_WINDOW_LABEL_PREFIX).trim().toLowerCase()))
|
|
23
|
+
throw new Error(`[Reserved window label] '${constants_1.COMAPNION_WINDOW_LABEL_PREFIX}' is an app reserved label`);
|
|
24
24
|
if (options.label.trim().toLowerCase().startsWith("main"))
|
|
25
25
|
throw new Error(`[Reserved window label] 'main' is an app reserved label`);
|
|
26
26
|
}
|
|
@@ -29,11 +29,11 @@ const newWindow = async (core, options) => {
|
|
|
29
29
|
.substring(2, 2 + 8)}`;
|
|
30
30
|
const labelToSet = (options?.label) ?? randomWindowLabel;
|
|
31
31
|
try {
|
|
32
|
-
const usedLabelsJSON = await sdk_1.Desktopr.globalVariables.get(
|
|
32
|
+
const usedLabelsJSON = await sdk_1.Desktopr.globalVariables.get(constants_1.WINDOWS_LABELS_TRACKER_VARIABLE_NAME);
|
|
33
33
|
let usedLabelsObj = await JSON.parse(usedLabelsJSON);
|
|
34
34
|
usedLabelsObj[labelToSet] = true;
|
|
35
35
|
const updatedUsedLabelsJSON = JSON.stringify(usedLabelsObj);
|
|
36
|
-
await sdk_1.Desktopr.globalVariables.set(
|
|
36
|
+
await sdk_1.Desktopr.globalVariables.set(constants_1.WINDOWS_LABELS_TRACKER_VARIABLE_NAME, updatedUsedLabelsJSON);
|
|
37
37
|
}
|
|
38
38
|
catch (error) {
|
|
39
39
|
console.warn("Could not update used windows labels tracker");
|
|
@@ -50,11 +50,11 @@ const closeWindow = async (core, label) => {
|
|
|
50
50
|
const _label = trimmedLabel ?? "main";
|
|
51
51
|
try {
|
|
52
52
|
if (trimmedLabel) {
|
|
53
|
-
const usedLabelsJSON = await sdk_1.Desktopr.globalVariables.get(
|
|
53
|
+
const usedLabelsJSON = await sdk_1.Desktopr.globalVariables.get(constants_1.WINDOWS_LABELS_TRACKER_VARIABLE_NAME);
|
|
54
54
|
let usedLabelsObj = await JSON.parse(usedLabelsJSON);
|
|
55
55
|
delete usedLabelsObj[trimmedLabel];
|
|
56
56
|
const updatedUsedLabelsJSON = JSON.stringify(usedLabelsObj);
|
|
57
|
-
await sdk_1.Desktopr.globalVariables.set(
|
|
57
|
+
await sdk_1.Desktopr.globalVariables.set(constants_1.WINDOWS_LABELS_TRACKER_VARIABLE_NAME, updatedUsedLabelsJSON);
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
catch (error) {
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.buildWorker = buildWorker;
|
|
4
|
-
const
|
|
4
|
+
const helpers_1 = require("../../../helpers");
|
|
5
5
|
function buildWorker(core) {
|
|
6
6
|
return {
|
|
7
|
-
call: (method, payload, timeoutMs) => core.invoke("dtr_worker_call", { modulePath: (0,
|
|
7
|
+
call: (method, payload, timeoutMs) => core.invoke("dtr_worker_call", { modulePath: (0, helpers_1.normalizeModuleName)(method), payload, timeoutMs }),
|
|
8
8
|
status: () => core.invoke("dtr_worker_status"),
|
|
9
9
|
restart: () => core.invoke("dtr_worker_restart"),
|
|
10
10
|
// delivery: (id: string, result: string): Promise<boolean> => core.invoke("dtr_worker_delivery", {id, result}),
|
|
11
11
|
modules: {
|
|
12
12
|
list: () => core.invoke("dtr_worker_list_modules"),
|
|
13
|
-
remove: (name) => core.invoke("dtr_worker_remove_module", { name: (0,
|
|
14
|
-
addFromBytes: (name, contents) => core.invoke("dtr_worker_add_module", { name: (0,
|
|
15
|
-
add: (name, maxBytes) => core.invoke("dtr_worker_pick_and_add_module", { maxBytes, defaultName: (0,
|
|
13
|
+
remove: (name) => core.invoke("dtr_worker_remove_module", { name: (0, helpers_1.normalizeModuleName)(name) }),
|
|
14
|
+
addFromBytes: (name, contents) => core.invoke("dtr_worker_add_module", { name: (0, helpers_1.normalizeModuleName)(name), contents }),
|
|
15
|
+
add: (name, maxBytes) => core.invoke("dtr_worker_pick_and_add_module", { maxBytes, defaultName: (0, helpers_1.normalizeModuleName)(name) }),
|
|
16
16
|
},
|
|
17
17
|
clearSandbox: () => core.invoke("dtr_worker_clear_all"),
|
|
18
18
|
paths: () => core.invoke("dtr_worker_paths"),
|
package/dist-sdk/sdk/_proxy.d.ts
CHANGED
package/dist-sdk/sdk/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { Desktopr } from "./_proxy";
|
|
2
|
-
export { type DesktoprAPI } from "../
|
|
2
|
+
export { type DesktoprAPI } from "../types";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "desktopr",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"description": "Official JS/TS SDK for the Desktopr native bridge",
|
|
5
5
|
"main": "dist-sdk/sdk/index.js",
|
|
6
6
|
"types": "dist-sdk/sdk/index.d.ts",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"scripts": {
|
|
14
14
|
"syncVersion": "bash ../scripts/sync-api-version.sh",
|
|
15
15
|
"build": "rm -rf dist-sdk && npm run syncVersion && tsc -p ../tsconfig.sdk.json",
|
|
16
|
-
"pub": "npm publish --access public",
|
|
16
|
+
"pub": "npm run build && npm publish --access public",
|
|
17
17
|
"prepublishOnly": "npm run build"
|
|
18
18
|
}
|
|
19
19
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|