@dxos/plugin-native 0.8.4-main.c85a9c8dae → 0.8.4-main.d9fc60f731

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 (121) hide show
  1. package/LICENSE +102 -5
  2. package/PLUGIN.mdl +284 -0
  3. package/README.md +1 -1
  4. package/dist/lib/neutral/NativePlugin.mjs +46 -0
  5. package/dist/lib/neutral/NativePlugin.mjs.map +7 -0
  6. package/dist/lib/neutral/NativeSettings-CLYG5TJH.mjs +113 -0
  7. package/dist/lib/neutral/NativeSettings-CLYG5TJH.mjs.map +7 -0
  8. package/dist/lib/neutral/capabilities/index.mjs +17 -0
  9. package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
  10. package/dist/lib/neutral/chunk-75E24KAJ.mjs +34 -0
  11. package/dist/lib/neutral/chunk-75E24KAJ.mjs.map +7 -0
  12. package/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -0
  13. package/dist/lib/neutral/chunk-J5LGTIGS.mjs.map +7 -0
  14. package/dist/lib/neutral/components/index.mjs +9 -0
  15. package/dist/lib/neutral/components/index.mjs.map +7 -0
  16. package/dist/lib/neutral/index.mjs +8 -0
  17. package/dist/lib/neutral/index.mjs.map +7 -0
  18. package/dist/lib/neutral/meta.json +1 -0
  19. package/dist/lib/neutral/meta.mjs +8 -0
  20. package/dist/lib/neutral/meta.mjs.map +7 -0
  21. package/dist/lib/{browser/ollama-QOB3EVAJ.mjs → neutral/ollama-BHWFTROM.mjs} +8 -21
  22. package/dist/lib/{browser/ollama-QOB3EVAJ.mjs.map → neutral/ollama-BHWFTROM.mjs.map} +3 -3
  23. package/dist/lib/neutral/plugin.mjs +12 -0
  24. package/dist/lib/neutral/plugin.mjs.map +7 -0
  25. package/dist/lib/neutral/react-surface-ETNGHN4X.mjs +27 -0
  26. package/dist/lib/neutral/react-surface-ETNGHN4X.mjs.map +7 -0
  27. package/dist/lib/neutral/settings-HF6TQNU4.mjs +28 -0
  28. package/dist/lib/neutral/settings-HF6TQNU4.mjs.map +7 -0
  29. package/dist/lib/neutral/spotlight-listener-K7S6LGL3.mjs +48 -0
  30. package/dist/lib/neutral/spotlight-listener-K7S6LGL3.mjs.map +7 -0
  31. package/dist/lib/neutral/translations.mjs +35 -0
  32. package/dist/lib/neutral/translations.mjs.map +7 -0
  33. package/dist/lib/neutral/types/index.mjs +31 -0
  34. package/dist/lib/neutral/types/index.mjs.map +7 -0
  35. package/dist/lib/neutral/updater-JEBXWSSK.mjs +244 -0
  36. package/dist/lib/neutral/updater-JEBXWSSK.mjs.map +7 -0
  37. package/dist/types/src/NativePlugin.d.ts +1 -0
  38. package/dist/types/src/NativePlugin.d.ts.map +1 -1
  39. package/dist/types/src/capabilities/index.d.ts +6 -3
  40. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  41. package/dist/types/src/capabilities/ollama.d.ts.map +1 -0
  42. package/dist/types/src/capabilities/react-surface.d.ts +5 -0
  43. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
  44. package/dist/types/src/capabilities/settings.d.ts +7 -0
  45. package/dist/types/src/capabilities/settings.d.ts.map +1 -0
  46. package/dist/types/src/capabilities/spotlight-listener.d.ts +8 -0
  47. package/dist/types/src/capabilities/spotlight-listener.d.ts.map +1 -0
  48. package/dist/types/src/capabilities/updater.d.ts +6 -0
  49. package/dist/types/src/capabilities/updater.d.ts.map +1 -0
  50. package/dist/types/src/components/NativeSettings/NativeSettings.d.ts +6 -0
  51. package/dist/types/src/components/NativeSettings/NativeSettings.d.ts.map +1 -0
  52. package/dist/types/src/components/NativeSettings/index.d.ts +2 -0
  53. package/dist/types/src/components/NativeSettings/index.d.ts.map +1 -0
  54. package/dist/types/src/components/index.d.ts +3 -0
  55. package/dist/types/src/components/index.d.ts.map +1 -0
  56. package/dist/types/src/constants.d.ts +2 -0
  57. package/dist/types/src/constants.d.ts.map +1 -0
  58. package/dist/types/src/index.d.ts +0 -2
  59. package/dist/types/src/index.d.ts.map +1 -1
  60. package/dist/types/src/meta.d.ts +1 -1
  61. package/dist/types/src/meta.d.ts.map +1 -1
  62. package/dist/types/src/plugin.d.ts +3 -0
  63. package/dist/types/src/plugin.d.ts.map +1 -0
  64. package/dist/types/src/translations.d.ts +20 -6
  65. package/dist/types/src/translations.d.ts.map +1 -1
  66. package/dist/types/src/types/NativeCapabilities.d.ts +5 -0
  67. package/dist/types/src/types/NativeCapabilities.d.ts.map +1 -0
  68. package/dist/types/src/types/Settings.d.ts +5 -0
  69. package/dist/types/src/types/Settings.d.ts.map +1 -0
  70. package/dist/types/src/types/Update.d.ts +30 -0
  71. package/dist/types/src/types/Update.d.ts.map +1 -0
  72. package/dist/types/src/types/index.d.ts +4 -0
  73. package/dist/types/src/types/index.d.ts.map +1 -0
  74. package/dist/types/tsconfig.tsbuildinfo +1 -1
  75. package/package.json +75 -27
  76. package/src/NativePlugin.tsx +19 -9
  77. package/src/capabilities/index.ts +7 -3
  78. package/src/capabilities/react-surface.tsx +29 -0
  79. package/src/capabilities/settings.ts +31 -0
  80. package/src/capabilities/spotlight-listener.ts +58 -0
  81. package/src/capabilities/updater.ts +194 -0
  82. package/src/components/NativeSettings/NativeSettings.tsx +132 -0
  83. package/src/components/NativeSettings/index.ts +5 -0
  84. package/src/components/index.ts +7 -0
  85. package/src/constants.ts +7 -0
  86. package/src/index.ts +0 -2
  87. package/src/meta.ts +24 -7
  88. package/src/plugin.ts +9 -0
  89. package/src/translations.ts +20 -5
  90. package/src/types/NativeCapabilities.ts +16 -0
  91. package/src/types/Settings.ts +11 -0
  92. package/src/types/Update.ts +24 -0
  93. package/src/types/index.ts +7 -0
  94. package/src/vite-env.d.ts +10 -0
  95. package/dist/lib/browser/chunk-6374DBU4.mjs +0 -15
  96. package/dist/lib/browser/chunk-6374DBU4.mjs.map +0 -7
  97. package/dist/lib/browser/index.mjs +0 -59
  98. package/dist/lib/browser/index.mjs.map +0 -7
  99. package/dist/lib/browser/meta.json +0 -1
  100. package/dist/lib/browser/updater-AR27PYM4.mjs +0 -190
  101. package/dist/lib/browser/updater-AR27PYM4.mjs.map +0 -7
  102. package/dist/lib/browser/window-GKYYTCEI.mjs +0 -38
  103. package/dist/lib/browser/window-GKYYTCEI.mjs.map +0 -7
  104. package/dist/types/src/capabilities/ollama/index.d.ts +0 -3
  105. package/dist/types/src/capabilities/ollama/index.d.ts.map +0 -1
  106. package/dist/types/src/capabilities/ollama/ollama.d.ts.map +0 -1
  107. package/dist/types/src/capabilities/updater/index.d.ts +0 -3
  108. package/dist/types/src/capabilities/updater/index.d.ts.map +0 -1
  109. package/dist/types/src/capabilities/updater/updater.d.ts +0 -5
  110. package/dist/types/src/capabilities/updater/updater.d.ts.map +0 -1
  111. package/dist/types/src/capabilities/window/index.d.ts +0 -3
  112. package/dist/types/src/capabilities/window/index.d.ts.map +0 -1
  113. package/dist/types/src/capabilities/window/window.d.ts +0 -11
  114. package/dist/types/src/capabilities/window/window.d.ts.map +0 -1
  115. package/src/capabilities/ollama/index.ts +0 -7
  116. package/src/capabilities/updater/index.ts +0 -7
  117. package/src/capabilities/updater/updater.ts +0 -120
  118. package/src/capabilities/window/index.ts +0 -7
  119. package/src/capabilities/window/window.ts +0 -72
  120. /package/dist/types/src/capabilities/{ollama/ollama.d.ts → ollama.d.ts} +0 -0
  121. /package/src/capabilities/{ollama/ollama.ts → ollama.ts} +0 -0
@@ -1,7 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import { Capability } from '@dxos/app-framework';
6
-
7
- export const Updater = Capability.lazy('Updater', () => import('./updater'));
@@ -1,120 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import { type } from '@tauri-apps/plugin-os';
6
- import { relaunch } from '@tauri-apps/plugin-process';
7
- import * as Updater from '@tauri-apps/plugin-updater';
8
- import * as Duration from 'effect/Duration';
9
- import * as Effect from 'effect/Effect';
10
- import * as Fiber from 'effect/Fiber';
11
- import * as Match from 'effect/Match';
12
- import * as Schedule from 'effect/Schedule';
13
-
14
- import { Capabilities, Capability } from '@dxos/app-framework';
15
- import { LayoutOperation } from '@dxos/app-toolkit';
16
- import { log } from '@dxos/log';
17
-
18
- import { meta } from '../../meta';
19
-
20
- const SUPPORTS_OTA = ['linux', 'macos', 'windows'];
21
-
22
- /**
23
- * Safely check for updates with error logging.
24
- */
25
- const check = async (): Promise<Updater.Update | null> => {
26
- try {
27
- return await Updater.check();
28
- } catch (error) {
29
- log.error('failed to check for updates', { error });
30
- return null;
31
- }
32
- };
33
-
34
- /**
35
- * Safely download and install update with error logging.
36
- */
37
- const downloadAndInstall = async (
38
- update: Updater.Update,
39
- handleDownload: (event: Updater.DownloadEvent) => void,
40
- ): Promise<boolean> => {
41
- try {
42
- await update.downloadAndInstall(handleDownload);
43
- return true;
44
- } catch (error) {
45
- log.error('failed to download and install update', { error });
46
- return false;
47
- }
48
- };
49
-
50
- export default Capability.makeModule(
51
- Effect.fnUntraced(function* () {
52
- // Skip updates if not supported or in dev mode.
53
- const platform = type();
54
- if (!SUPPORTS_OTA.includes(platform) || window.location.hostname === 'localhost') {
55
- log.info('skipping updater', { platform, hostname: window.location.hostname });
56
- return;
57
- }
58
-
59
- const { invoke } = yield* Capability.get(Capabilities.OperationInvoker);
60
-
61
- // https://tauri.app/plugin/updater/#checking-for-updates
62
- const action = Effect.gen(function* () {
63
- log.info('checking for updates');
64
- const update = yield* Effect.promise(() => check());
65
- if (!update) {
66
- log.info('no update available');
67
- return;
68
- }
69
- log.info('update check complete', {
70
- available: update.available,
71
- currentVersion: update.currentVersion,
72
- version: update.version,
73
- date: update.date,
74
- body: update.body,
75
- });
76
- if (update.available) {
77
- log.info('update available, starting download', { version: update.version });
78
- let downloaded = 0;
79
- let contentLength = 0;
80
-
81
- const handleDownload = Match.type<Updater.DownloadEvent>().pipe(
82
- Match.when({ event: 'Started' }, (event) => {
83
- contentLength = event.data.contentLength ?? 0;
84
- log.info('download started', { contentLength });
85
- }),
86
- Match.when({ event: 'Progress' }, (event) => {
87
- downloaded += event.data.chunkLength;
88
- log.verbose('download progress', { downloaded, contentLength });
89
- }),
90
- Match.when({ event: 'Finished' }, () => {
91
- log.info('download completed');
92
- }),
93
- Match.exhaustive,
94
- );
95
-
96
- const downloadSuccess = yield* Effect.promise(() => downloadAndInstall(update, handleDownload));
97
-
98
- if (downloadSuccess) {
99
- yield* invoke(LayoutOperation.AddToast, {
100
- id: `${meta.id}/update-ready`,
101
- title: ['update ready label', { ns: meta.id }],
102
- description: ['update ready description', { ns: meta.id }],
103
- duration: Infinity,
104
- actionLabel: ['update label', { ns: meta.id }],
105
- actionAlt: ['update alt', { ns: meta.id }],
106
- onAction: () => relaunch(),
107
- });
108
- }
109
- }
110
- });
111
-
112
- // Run immediately on startup, then repeat every hour.
113
- const fiber = yield* action.pipe(Effect.repeat(Schedule.fixed(Duration.hours(1))), Effect.forkDaemon);
114
- log.info('updater module initialized, update check scheduled');
115
-
116
- return Capability.contributes(Capabilities.Null, null, () =>
117
- Effect.sync(() => Effect.runSync(Fiber.interrupt(fiber))),
118
- );
119
- }),
120
- );
@@ -1,7 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import { Capability } from '@dxos/app-framework';
6
-
7
- export const Window = Capability.lazy('Window', () => import('./window'));
@@ -1,72 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import { getCurrentWindow } from '@tauri-apps/api/window';
6
- import * as Effect from 'effect/Effect';
7
-
8
- import { Capabilities, Capability } from '@dxos/app-framework';
9
-
10
- /**
11
- * Window capability module.
12
- * Sets up window drag regions for Tauri windows.
13
- * Note: Window state persistence (size/position) is handled on the Rust side
14
- * in src-tauri/src/window_state.rs for instant restoration on startup.
15
- */
16
- export default Capability.makeModule(
17
- Effect.fnUntraced(function* () {
18
- const appWindow = getCurrentWindow();
19
-
20
- // Set up drag regions for window dragging.
21
- const cleanupDragRegions = setupWindowDrag(appWindow);
22
-
23
- return Capability.contributes(
24
- Capabilities.Null,
25
- null,
26
- Effect.fnUntraced(function* () {
27
- cleanupDragRegions();
28
- }),
29
- );
30
- }),
31
- );
32
-
33
- /**
34
- * Interactive element selectors that should not trigger window dragging.
35
- */
36
- const INTERACTIVE_SELECTORS = '.dx-app-no-drag, button, a, input, select, textarea, [role="button"], [role="menuitem"]';
37
-
38
- /**
39
- * Sets up window drag regions.
40
- *
41
- * Tauri 2.0 does not support the `-webkit-app-region` CSS property with overlay titlebars.
42
- * This uses the Tauri window API to enable dragging on elements with the `dx-app-drag` class.
43
- */
44
- const setupWindowDrag = (appWindow: ReturnType<typeof getCurrentWindow>): (() => void) => {
45
- const handleMouseDown = (event: MouseEvent) => {
46
- const target = event.target as Element | null;
47
- if (!target) {
48
- return;
49
- }
50
-
51
- // Check if the click target or any ancestor has the dx-app-drag class.
52
- const dragElement = target.closest('.dx-app-drag');
53
- if (!dragElement) {
54
- return;
55
- }
56
-
57
- // Don't trigger drag on interactive elements within the drag region.
58
- const interactiveElement = target.closest(INTERACTIVE_SELECTORS);
59
- if (interactiveElement && dragElement.contains(interactiveElement)) {
60
- return;
61
- }
62
-
63
- event.preventDefault();
64
- void appWindow.startDragging();
65
- };
66
-
67
- document.addEventListener('mousedown', handleMouseDown);
68
-
69
- return () => {
70
- document.removeEventListener('mousedown', handleMouseDown);
71
- };
72
- };