@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.
- package/LICENSE +102 -5
- package/PLUGIN.mdl +284 -0
- package/README.md +1 -1
- package/dist/lib/neutral/NativePlugin.mjs +46 -0
- package/dist/lib/neutral/NativePlugin.mjs.map +7 -0
- package/dist/lib/neutral/NativeSettings-CLYG5TJH.mjs +113 -0
- package/dist/lib/neutral/NativeSettings-CLYG5TJH.mjs.map +7 -0
- package/dist/lib/neutral/capabilities/index.mjs +17 -0
- package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
- package/dist/lib/neutral/chunk-75E24KAJ.mjs +34 -0
- package/dist/lib/neutral/chunk-75E24KAJ.mjs.map +7 -0
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs.map +7 -0
- package/dist/lib/neutral/components/index.mjs +9 -0
- package/dist/lib/neutral/components/index.mjs.map +7 -0
- package/dist/lib/neutral/index.mjs +8 -0
- package/dist/lib/neutral/index.mjs.map +7 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/lib/neutral/meta.mjs +8 -0
- package/dist/lib/neutral/meta.mjs.map +7 -0
- package/dist/lib/{browser/ollama-QOB3EVAJ.mjs → neutral/ollama-BHWFTROM.mjs} +8 -21
- package/dist/lib/{browser/ollama-QOB3EVAJ.mjs.map → neutral/ollama-BHWFTROM.mjs.map} +3 -3
- package/dist/lib/neutral/plugin.mjs +12 -0
- package/dist/lib/neutral/plugin.mjs.map +7 -0
- package/dist/lib/neutral/react-surface-ETNGHN4X.mjs +27 -0
- package/dist/lib/neutral/react-surface-ETNGHN4X.mjs.map +7 -0
- package/dist/lib/neutral/settings-HF6TQNU4.mjs +28 -0
- package/dist/lib/neutral/settings-HF6TQNU4.mjs.map +7 -0
- package/dist/lib/neutral/spotlight-listener-K7S6LGL3.mjs +48 -0
- package/dist/lib/neutral/spotlight-listener-K7S6LGL3.mjs.map +7 -0
- package/dist/lib/neutral/translations.mjs +35 -0
- package/dist/lib/neutral/translations.mjs.map +7 -0
- package/dist/lib/neutral/types/index.mjs +31 -0
- package/dist/lib/neutral/types/index.mjs.map +7 -0
- package/dist/lib/neutral/updater-JEBXWSSK.mjs +244 -0
- package/dist/lib/neutral/updater-JEBXWSSK.mjs.map +7 -0
- package/dist/types/src/NativePlugin.d.ts +1 -0
- package/dist/types/src/NativePlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +6 -3
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/ollama.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings.d.ts +7 -0
- package/dist/types/src/capabilities/settings.d.ts.map +1 -0
- package/dist/types/src/capabilities/spotlight-listener.d.ts +8 -0
- package/dist/types/src/capabilities/spotlight-listener.d.ts.map +1 -0
- package/dist/types/src/capabilities/updater.d.ts +6 -0
- package/dist/types/src/capabilities/updater.d.ts.map +1 -0
- package/dist/types/src/components/NativeSettings/NativeSettings.d.ts +6 -0
- package/dist/types/src/components/NativeSettings/NativeSettings.d.ts.map +1 -0
- package/dist/types/src/components/NativeSettings/index.d.ts +2 -0
- package/dist/types/src/components/NativeSettings/index.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +3 -0
- package/dist/types/src/components/index.d.ts.map +1 -0
- package/dist/types/src/constants.d.ts +2 -0
- package/dist/types/src/constants.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +0 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +1 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/plugin.d.ts +3 -0
- package/dist/types/src/plugin.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +20 -6
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/NativeCapabilities.d.ts +5 -0
- package/dist/types/src/types/NativeCapabilities.d.ts.map +1 -0
- package/dist/types/src/types/Settings.d.ts +5 -0
- package/dist/types/src/types/Settings.d.ts.map +1 -0
- package/dist/types/src/types/Update.d.ts +30 -0
- package/dist/types/src/types/Update.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +4 -0
- package/dist/types/src/types/index.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +75 -27
- package/src/NativePlugin.tsx +19 -9
- package/src/capabilities/index.ts +7 -3
- package/src/capabilities/react-surface.tsx +29 -0
- package/src/capabilities/settings.ts +31 -0
- package/src/capabilities/spotlight-listener.ts +58 -0
- package/src/capabilities/updater.ts +194 -0
- package/src/components/NativeSettings/NativeSettings.tsx +132 -0
- package/src/components/NativeSettings/index.ts +5 -0
- package/src/components/index.ts +7 -0
- package/src/constants.ts +7 -0
- package/src/index.ts +0 -2
- package/src/meta.ts +24 -7
- package/src/plugin.ts +9 -0
- package/src/translations.ts +20 -5
- package/src/types/NativeCapabilities.ts +16 -0
- package/src/types/Settings.ts +11 -0
- package/src/types/Update.ts +24 -0
- package/src/types/index.ts +7 -0
- package/src/vite-env.d.ts +10 -0
- package/dist/lib/browser/chunk-6374DBU4.mjs +0 -15
- package/dist/lib/browser/chunk-6374DBU4.mjs.map +0 -7
- package/dist/lib/browser/index.mjs +0 -59
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/updater-AR27PYM4.mjs +0 -190
- package/dist/lib/browser/updater-AR27PYM4.mjs.map +0 -7
- package/dist/lib/browser/window-GKYYTCEI.mjs +0 -38
- package/dist/lib/browser/window-GKYYTCEI.mjs.map +0 -7
- package/dist/types/src/capabilities/ollama/index.d.ts +0 -3
- package/dist/types/src/capabilities/ollama/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/ollama/ollama.d.ts.map +0 -1
- package/dist/types/src/capabilities/updater/index.d.ts +0 -3
- package/dist/types/src/capabilities/updater/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/updater/updater.d.ts +0 -5
- package/dist/types/src/capabilities/updater/updater.d.ts.map +0 -1
- package/dist/types/src/capabilities/window/index.d.ts +0 -3
- package/dist/types/src/capabilities/window/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/window/window.d.ts +0 -11
- package/dist/types/src/capabilities/window/window.d.ts.map +0 -1
- package/src/capabilities/ollama/index.ts +0 -7
- package/src/capabilities/updater/index.ts +0 -7
- package/src/capabilities/updater/updater.ts +0 -120
- package/src/capabilities/window/index.ts +0 -7
- package/src/capabilities/window/window.ts +0 -72
- /package/dist/types/src/capabilities/{ollama/ollama.d.ts → ollama.d.ts} +0 -0
- /package/src/capabilities/{ollama/ollama.ts → ollama.ts} +0 -0
|
@@ -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,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
|
-
};
|
|
File without changes
|
|
File without changes
|