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.
Files changed (59) hide show
  1. package/dist-sdk/bridge.constants.json +1 -1
  2. package/dist-sdk/{_companion_context.js → companion_context.js} +2 -2
  3. package/dist-sdk/core/_helpers.d.ts +1 -1
  4. package/dist-sdk/core/_main.js +3 -3
  5. package/dist-sdk/desktopr/_helpers.d.ts +1 -1
  6. package/dist-sdk/desktopr/_main.d.ts +1 -1
  7. package/dist-sdk/desktopr/_main.js +3 -3
  8. package/dist-sdk/modules/rs/app/_main.d.ts +1 -1
  9. package/dist-sdk/modules/rs/app/_types.d.ts +1 -1
  10. package/dist-sdk/modules/rs/autostart/_main.d.ts +1 -1
  11. package/dist-sdk/modules/rs/badge/_main.d.ts +1 -1
  12. package/dist-sdk/modules/rs/badge/_main.js +3 -3
  13. package/dist-sdk/modules/rs/clipboard/_main.d.ts +1 -1
  14. package/dist-sdk/modules/rs/companion/_helpers.d.ts +1 -1
  15. package/dist-sdk/modules/rs/companion/_main.d.ts +1 -1
  16. package/dist-sdk/modules/rs/companion/_main.js +2 -2
  17. package/dist-sdk/modules/rs/companion/_types.d.ts +1 -1
  18. package/dist-sdk/modules/rs/contextMenu/_helpers.d.ts +1 -1
  19. package/dist-sdk/modules/rs/contextMenu/_helpers.js +2 -2
  20. package/dist-sdk/modules/rs/contextMenu/_main.d.ts +1 -1
  21. package/dist-sdk/modules/rs/contextMenu/_main.js +4 -4
  22. package/dist-sdk/modules/rs/contextMenu/_types.d.ts +1 -1
  23. package/dist-sdk/modules/rs/diagnostics/_helpers.d.ts +1 -1
  24. package/dist-sdk/modules/rs/diagnostics/_helpers.js +2 -2
  25. package/dist-sdk/modules/rs/diagnostics/_main.d.ts +1 -1
  26. package/dist-sdk/modules/rs/dragdrop/_main.d.ts +1 -1
  27. package/dist-sdk/modules/rs/dragdrop/_main.js +2 -2
  28. package/dist-sdk/modules/rs/events/_main.d.ts +2 -2
  29. package/dist-sdk/modules/rs/events/_main.js +10 -10
  30. package/dist-sdk/modules/rs/events/_types.d.ts +10 -9
  31. package/dist-sdk/modules/rs/files/_main.d.ts +1 -1
  32. package/dist-sdk/modules/rs/fs/_main.d.ts +2 -2
  33. package/dist-sdk/modules/rs/fs/_main.js +2 -2
  34. package/dist-sdk/modules/rs/globalVariables/_main.d.ts +1 -1
  35. package/dist-sdk/modules/rs/menu/_helpers.d.ts +1 -1
  36. package/dist-sdk/modules/rs/menu/_main.d.ts +1 -1
  37. package/dist-sdk/modules/rs/menu/_main.js +2 -2
  38. package/dist-sdk/modules/rs/network/_main.d.ts +1 -1
  39. package/dist-sdk/modules/rs/notifications/_main.d.ts +1 -1
  40. package/dist-sdk/modules/rs/plugins/_main.d.ts +1 -1
  41. package/dist-sdk/modules/rs/shortcuts/_main.d.ts +1 -1
  42. package/dist-sdk/modules/rs/shortcuts/_main.js +5 -5
  43. package/dist-sdk/modules/rs/window/_helpers.js +7 -7
  44. package/dist-sdk/modules/rs/window/_main.d.ts +1 -1
  45. package/dist-sdk/modules/rs/window/_types.d.ts +1 -1
  46. package/dist-sdk/modules/rs/worker/_main.d.ts +1 -1
  47. package/dist-sdk/modules/rs/worker/_main.js +5 -5
  48. package/dist-sdk/sdk/_proxy.d.ts +1 -1
  49. package/dist-sdk/sdk/index.d.ts +1 -1
  50. package/package.json +2 -2
  51. /package/dist-sdk/{_companion_context.d.ts → companion_context.d.ts} +0 -0
  52. /package/dist-sdk/{_constants.d.ts → constants.d.ts} +0 -0
  53. /package/dist-sdk/{_constants.js → constants.js} +0 -0
  54. /package/dist-sdk/{_helpers.d.ts → helpers.d.ts} +0 -0
  55. /package/dist-sdk/{_helpers.js → helpers.js} +0 -0
  56. /package/dist-sdk/{_main.d.ts → main.d.ts} +0 -0
  57. /package/dist-sdk/{_main.js → main.js} +0 -0
  58. /package/dist-sdk/{_types.d.ts → types.d.ts} +0 -0
  59. /package/dist-sdk/{_types.js → types.js} +0 -0
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "appUrl": "http://blank.html",
3
- "apiVersion": "2.1.0",
3
+ "apiVersion": "2.1.1",
4
4
  "companionWindowLabelPrefix": "dtr-cache-only-window-"
5
5
  }
@@ -5,12 +5,12 @@ exports.getCacheOnlyWindowContext = getCacheOnlyWindowContext;
5
5
  exports.isCacheOnlyWindow = isCacheOnlyWindow;
6
6
  exports.getCacheOnlyWindowLabel = getCacheOnlyWindowLabel;
7
7
  exports.getCacheOnlySessionId = getCacheOnlySessionId;
8
- const _constants_1 = require("./_constants");
8
+ const constants_1 = require("./constants");
9
9
  let state = {
10
10
  isCacheOnly: false,
11
11
  };
12
12
  function parseCompanionWindowLabel(label) {
13
- const prefix = _constants_1.COMAPNION_WINDOW_LABEL_PREFIX.trim();
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 "../_types";
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;
@@ -1,14 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.buildCore = buildCore;
4
- const _helpers_1 = require("../_helpers");
4
+ const helpers_1 = require("../helpers");
5
5
  function buildCore() {
6
6
  return {
7
7
  get ready() {
8
- return (0, _helpers_1.ensureCore)().then(() => true);
8
+ return (0, helpers_1.ensureCore)().then(() => true);
9
9
  },
10
10
  async invoke(cmd, payload) {
11
- const core = await (0, _helpers_1.ensureCore)();
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 { DtrPlatform } from "../_types";
1
+ import { DtrPlatform } from "../types";
2
2
  export declare const normalizeString: (str: string, options?: {
3
3
  toLowerCase: boolean;
4
4
  spacesFiller: string;
@@ -1,4 +1,4 @@
1
- import { DesktoprInstanceInterface } from "../_types";
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 _constants_1 = require("../_constants");
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(_constants_1.READY_EVENT_NAME);
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(_constants_1.READY_EVENT_NAME, () => callback());
31
+ const dtrReadyEventListener = (callback) => window.addEventListener(constants_1.READY_EVENT_NAME, () => callback());
32
32
  exports.dtrReadyEventListener = dtrReadyEventListener;
@@ -1,4 +1,4 @@
1
- import { AppInterface, DesktoprAPI } from "../../../_types";
1
+ import { AppInterface, DesktoprAPI } from "../../../types";
2
2
  export declare function buildAppInfo(core: {
3
3
  invoke: DesktoprAPI["invoke"];
4
4
  }): AppInterface;
@@ -1,4 +1,4 @@
1
- import { DtrPlatform } from "../../../_types";
1
+ import { DtrPlatform } from "../../../types";
2
2
  import { I32 } from "../../../utils";
3
3
  /**
4
4
  * Information about a window managed by Desktopr.
@@ -1,4 +1,4 @@
1
- import type { DesktoprAPI } from "../../../_types";
1
+ import type { DesktoprAPI } from "../../../types";
2
2
  import { AutostartInterface } from "./_types";
3
3
  export declare function buildAutostart(core: {
4
4
  invoke: DesktoprAPI["invoke"];
@@ -1,4 +1,4 @@
1
- import { BadgeInterface, DesktoprAPI } from "../../../_types";
1
+ import { BadgeInterface, DesktoprAPI } from "../../../types";
2
2
  export declare function buildBadge(core: {
3
3
  invoke: DesktoprAPI["invoke"];
4
4
  }): BadgeInterface;
@@ -1,15 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.buildBadge = buildBadge;
4
- const _helpers_1 = require("../../../_helpers");
4
+ const helpers_1 = require("../../../helpers");
5
5
  function buildBadge(core) {
6
6
  return {
7
7
  set: async (count) => {
8
- await (0, _helpers_1.platformSpecifcFilter)(["macos"]);
8
+ await (0, helpers_1.platformSpecifcFilter)(["macos"]);
9
9
  core.invoke("dtr_badge_set", { count });
10
10
  },
11
11
  clear: async () => {
12
- await (0, _helpers_1.platformSpecifcFilter)(["macos"]);
12
+ await (0, helpers_1.platformSpecifcFilter)(["macos"]);
13
13
  core.invoke("dtr_badge_clear");
14
14
  },
15
15
  };
@@ -1,4 +1,4 @@
1
- import type { DesktoprAPI, ClipboardInterface } from "../../../_types";
1
+ import type { DesktoprAPI, ClipboardInterface } from "../../../types";
2
2
  export declare function buildClipboard(core: {
3
3
  invoke: DesktoprAPI["invoke"];
4
4
  }): ClipboardInterface;
@@ -1,4 +1,4 @@
1
- import { DesktoprAPI, CompanionConfig } from "../../../_types";
1
+ import { DesktoprAPI, CompanionConfig } from "../../../types";
2
2
  /**
3
3
  * Validate whether a string is:
4
4
  * - a valid absolute URL (http/https)
@@ -1,4 +1,4 @@
1
- import type { DesktoprAPI, CompanionInterface } from "../../../_types";
1
+ import type { DesktoprAPI, CompanionInterface } from "../../../types";
2
2
  export declare function buildCompanion(core: {
3
3
  invoke: DesktoprAPI["invoke"];
4
4
  }): CompanionInterface;
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.buildCompanion = buildCompanion;
4
- const _helpers_1 = require("../../../_helpers");
4
+ const helpers_1 = require("../../../helpers");
5
5
  function buildCompanion(core) {
6
6
  return {
7
- launch: (appConfig) => (0, _helpers_1.launchCompanion)(core, appConfig),
7
+ launch: (appConfig) => (0, helpers_1.launchCompanion)(core, appConfig),
8
8
  state: {}
9
9
  };
10
10
  }
@@ -1,4 +1,4 @@
1
- import { CompanionState } from "../../../_companion_context";
1
+ import { CompanionState } from "../../../companion_context";
2
2
  export interface CompanionInterface {
3
3
  launch: (appConfig?: CompanionConfig) => Promise<void>;
4
4
  state: CompanionState;
@@ -1,4 +1,4 @@
1
- import { CmListenerCallback, CmNode, CmType } from "../../../_types";
1
+ import { CmListenerCallback, CmNode, CmType } from "../../../types";
2
2
  export declare const CM_TYPES: string[];
3
3
  export declare function isCmType(value: unknown): value is CmType;
4
4
  /**
@@ -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 _helpers_1 = require("../../../_helpers");
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, _helpers_1.normalizeString)(value);
31
+ const normalized = (0, helpers_1.normalizeString)(value);
32
32
  return isCmType(normalized) ? normalized : null;
33
33
  }
34
34
  /**
@@ -1,4 +1,4 @@
1
- import type { DesktoprAPI, ContextMenuInterface } from "../../../_types";
1
+ import type { DesktoprAPI, ContextMenuInterface } from "../../../types";
2
2
  export declare function buildContextMenu(core: {
3
3
  invoke: DesktoprAPI["invoke"];
4
4
  }): ContextMenuInterface;
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.buildContextMenu = buildContextMenu;
4
- const _helpers_1 = require("../../../_helpers");
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, _helpers_1.normalizeEntries)(entries), options }),
7
+ show: (entries, options) => core.invoke("dtr_context_menu_popup", { items: (0, helpers_1.normalizeEntries)(entries), options }),
8
8
  handler: {
9
- init: _helpers_1.initContextMenuListener,
10
- remove: _helpers_1.removeContextMenuListener
9
+ init: helpers_1.initContextMenuListener,
10
+ remove: helpers_1.removeContextMenuListener
11
11
  }
12
12
  };
13
13
  }
@@ -1,4 +1,4 @@
1
- import { CM_TYPES } from "../../../_helpers";
1
+ import { CM_TYPES } from "../../../helpers";
2
2
  export type CmType = (typeof CM_TYPES)[number];
3
3
  export type CmItem = {
4
4
  type: Extract<CmType, "item">;
@@ -1,4 +1,4 @@
1
- import { DesktoprAPI } from "../../../_types";
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 _helpers_1 = require("../../../_helpers");
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, _helpers_1.getAppVersion)();
28
+ const version = await (0, helpers_1.getAppVersion)();
29
29
  return version;
30
30
  };
31
31
  exports.deriveAppVersion = deriveAppVersion;
@@ -1,4 +1,4 @@
1
- import { DesktoprAPI } from "../../../_types";
1
+ import { DesktoprAPI } from "../../../types";
2
2
  import { DiagnosticsInterface } from "./_types";
3
3
  export declare function buildDiagnostics(core: {
4
4
  invoke: DesktoprAPI["invoke"];
@@ -1,4 +1,4 @@
1
- import { DragDropPayload } from "../../../_types";
1
+ import { DragDropPayload } from "../../../types";
2
2
  export declare function buildDragDrop(): {
3
3
  on: (handler: (name: string, payload: DragDropPayload) => void, options?: {
4
4
  includeHover?: boolean;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.buildDragDrop = buildDragDrop;
4
- const _helpers_1 = require("../../../_helpers");
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, _helpers_1.listenForEvent)(n, (p) => handler(n, p))));
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 "../../../_types";
2
- import type { EventsInterface } from "../../../_types";
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 _helpers_1 = require("../../../_helpers");
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, _helpers_1.listenForEvent)(event, handler),
10
+ on: async (event, handler) => (0, helpers_1.listenForEvent)(event, handler),
11
11
  once: (event) => new Promise(async (resolve) => {
12
- const off = await (0, _helpers_1.listenForEvent)(event, (p) => {
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, _helpers_1.listenForEvent)(n, (p) => handler(n, p))));
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, _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),
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, _helpers_1.listenForEvent)(n, (p) => handler(n, p))));
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, _helpers_1.listenForEvent)("menu:event", handler),
32
- onTrayIconEvent: async (handler) => (0, _helpers_1.listenForEvent)("tray:icon", handler)
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 "../../../_types";
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<() => void>;
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<() => void>;
9
- onNetworkStatus: (handler: (payload: any) => void) => Promise<() => any>;
10
- onDeeplink: (handler: (payload: any) => void) => Promise<() => any>;
11
- onShortcut: (handler: (payload: any) => void) => Promise<() => void>;
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<() => void>;
15
- onMenuEvent: (handler: (payload: any) => void) => Promise<() => any>;
16
- onTrayIconEvent: (handler: (payload: any) => void) => Promise<() => any>;
15
+ }) => Promise<Unlisten>;
16
+ onMenuEvent: (handler: (payload: any) => void) => Promise<Unlisten>;
17
+ onTrayIconEvent: (handler: (payload: any) => void) => Promise<Unlisten>;
17
18
  }
@@ -1,4 +1,4 @@
1
- import { DesktoprAPI, FilesInterface } from "../../../_types";
1
+ import { DesktoprAPI, FilesInterface } from "../../../types";
2
2
  export declare function buildFiles(core: {
3
3
  invoke: DesktoprAPI["invoke"];
4
4
  }): FilesInterface;
@@ -1,5 +1,5 @@
1
- import { DesktoprAPI } from "../../../_types";
2
- import type { FsInterface } from "../../../_types";
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 _helpers_1 = require("../../../_helpers");
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, _helpers_1.normalizeModuleName)(pluginModuleName)?.trim()) ?? undefined;
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,4 +1,4 @@
1
- import { DesktoprAPI } from "../../../_types";
1
+ import { DesktoprAPI } from "../../../types";
2
2
  import { GlobalVariablesInterface } from "./_types";
3
3
  export declare function buildGlobVar(core: {
4
4
  invoke: DesktoprAPI["invoke"];
@@ -1,4 +1,4 @@
1
- import { DesktoprAPI, MenuConfig } from "../../../_types";
1
+ import { DesktoprAPI, MenuConfig } from "../../../types";
2
2
  export declare const initMenuConfig: (core: {
3
3
  invoke: DesktoprAPI["invoke"];
4
4
  }, menuConfig: MenuConfig, windowLabel?: string) => Promise<void>;
@@ -1,4 +1,4 @@
1
- import type { DesktoprAPI, MenuInterface } from "../../../_types";
1
+ import type { DesktoprAPI, MenuInterface } from "../../../types";
2
2
  export declare function buildMenu(core: {
3
3
  invoke: DesktoprAPI["invoke"];
4
4
  }): MenuInterface;
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.buildMenu = buildMenu;
4
- const _helpers_1 = require("../../../_helpers");
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, _helpers_1.initMenuConfig)(core, config, windowLabel),
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,4 +1,4 @@
1
- import type { DesktoprAPI } from "../../../_types";
1
+ import type { DesktoprAPI } from "../../../types";
2
2
  import { NetworkInterface } from "./_types";
3
3
  export declare function buildNetwork(core: {
4
4
  invoke: DesktoprAPI["invoke"];
@@ -1,4 +1,4 @@
1
- import type { DesktoprAPI, NotificationsInterface } from "../../../_types";
1
+ import type { DesktoprAPI, NotificationsInterface } from "../../../types";
2
2
  export declare function buildNotifications(core: {
3
3
  invoke: DesktoprAPI["invoke"];
4
4
  }): NotificationsInterface;
@@ -1,4 +1,4 @@
1
- import { DesktoprAPI } from "../../../_types";
1
+ import { DesktoprAPI } from "../../../types";
2
2
  import { PluginsInterface } from "./_types";
3
3
  export declare function buildPlugins(core: {
4
4
  invoke: DesktoprAPI["invoke"];
@@ -1,4 +1,4 @@
1
- import { ShortcutsInterface } from "../../../_types";
1
+ import { ShortcutsInterface } from "../../../types";
2
2
  export declare function buildShortcuts(core: {
3
3
  invoke: <T = unknown>(cmd: string, payload?: any) => Promise<T>;
4
4
  }): ShortcutsInterface;
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.buildShortcuts = buildShortcuts;
4
- const _helpers_1 = require("../../../_helpers");
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, _helpers_1.tauriGlobalShortcut)();
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, _helpers_1.tauriGlobalShortcut)();
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, _helpers_1.tauriGlobalShortcut)();
23
+ const gs = (0, helpers_1.tauriGlobalShortcut)();
24
24
  await gs.unregisterAll();
25
25
  },
26
26
  isRegistered: async (accelerator) => {
27
- const gs = (0, _helpers_1.tauriGlobalShortcut)();
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 _constants_1 = require("../../../_constants");
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((_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`);
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(_constants_1.WINDOWS_LABELS_TRACKER_VARIABLE_NAME);
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(_constants_1.WINDOWS_LABELS_TRACKER_VARIABLE_NAME, updatedUsedLabelsJSON);
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(_constants_1.WINDOWS_LABELS_TRACKER_VARIABLE_NAME);
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(_constants_1.WINDOWS_LABELS_TRACKER_VARIABLE_NAME, updatedUsedLabelsJSON);
57
+ await sdk_1.Desktopr.globalVariables.set(constants_1.WINDOWS_LABELS_TRACKER_VARIABLE_NAME, updatedUsedLabelsJSON);
58
58
  }
59
59
  }
60
60
  catch (error) {
@@ -1,4 +1,4 @@
1
- import type { DesktoprAPI, WindowInterface } from "../../../_types";
1
+ import type { DesktoprAPI, WindowInterface } from "../../../types";
2
2
  export declare function buildWindow(core: {
3
3
  invoke: DesktoprAPI["invoke"];
4
4
  }): WindowInterface;
@@ -1,4 +1,4 @@
1
- import { CompanionState } from "../../../_companion_context";
1
+ import { CompanionState } from "../../../companion_context";
2
2
  export type _WindowTypesPlaceholder = unknown;
3
3
  export interface WindowInterface {
4
4
  new: (options?: NewWindowOptions) => Promise<void>;
@@ -1,4 +1,4 @@
1
- import { DesktoprAPI } from "../../../_types";
1
+ import { DesktoprAPI } from "../../../types";
2
2
  import { U64, U8 } from "../../../utils";
3
3
  import { WorkerCallPayload } from "./_types";
4
4
  export declare function buildWorker(core: {
@@ -1,18 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.buildWorker = buildWorker;
4
- const _helpers_1 = require("../../../_helpers");
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, _helpers_1.normalizeModuleName)(method), payload, timeoutMs }),
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, _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) }),
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"),
@@ -1,3 +1,3 @@
1
- import type { DesktoprAPI } from "../_types";
1
+ import type { DesktoprAPI } from "../types";
2
2
  export declare function isDesktoprAvailable(): boolean;
3
3
  export declare const Desktopr: DesktoprAPI;
@@ -1,2 +1,2 @@
1
1
  export { Desktopr } from "./_proxy";
2
- export { type DesktoprAPI } from "../_types";
2
+ export { type DesktoprAPI } from "../types";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "desktopr",
3
- "version": "2.1.0",
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