@ng-desktop/desktop 0.0.0-stage → 0.3.0

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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Gaspar1992 and NgDesktop Engine Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,14 @@
1
- # Temporary Holding Version
1
+ # @ng-desktop/desktop
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Linux GTK4 / Desktop OS system services (Theme, Clipboard, Notifications, Dialogs, SQLite, Network, Compute, FileSystem, DropTarget)
4
+
5
+ Part of **[NgDesktop Engine](https://github.com/Gaspar1992/ng-desktop-engine)** — Native desktop rendering engine for Angular 22+ (`GTK4`, `WinUI 3`, `AppKit`).
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ pnpm add @ng-desktop/desktop
11
+ ```
12
+
13
+ - Repository path: `packages/desktop-native`
14
+ - Documentation & Ecosystem Guide: https://github.com/Gaspar1992/ng-desktop-engine/blob/main/docs/ECOSYSTEM_COMPATIBILITY.md
@@ -0,0 +1,20 @@
1
+ import { type NativeComputeMatch } from '@ng-desktop/platform';
2
+ import * as i0 from "@angular/core";
3
+ export interface NativeScoredItem<T> {
4
+ item: T;
5
+ index: number;
6
+ score: number;
7
+ }
8
+ /**
9
+ * Injectable Angular service delegating CPU-intensive fuzzy search, scoring, and FNV-1a hashing
10
+ * to the multithreaded Rust `NativeComputePool` without blocking the UI thread.
11
+ */
12
+ export declare class NativeComputeService {
13
+ private readonly bridge;
14
+ fuzzyFilterStrings(items: readonly string[], query: string, limit?: number): NativeComputeMatch[];
15
+ fuzzyFilter<T>(items: readonly T[], selector: (item: T) => string, query: string, limit?: number): NativeScoredItem<T>[];
16
+ hash(input: string): string;
17
+ static ɵfac: i0.ɵɵFactoryDeclaration<NativeComputeService, never>;
18
+ static ɵprov: i0.ɵɵInjectableDeclaration<any>;
19
+ }
20
+ //# sourceMappingURL=compute-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compute-service.d.ts","sourceRoot":"","sources":["../../../../packages/desktop-native/src/compute-service.ts"],"names":[],"mappings":"AACA,OAAO,EAAwB,KAAK,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;;AAErF,MAAM,WAAW,gBAAgB,CAAC,CAAC;IACjC,IAAI,EAAE,CAAC,CAAC;IACR,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;GAGG;AACH,qBACa,oBAAoB;IAC/B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA0B;IAEjD,kBAAkB,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,SAAK,GAAG,kBAAkB,EAAE;IAI7F,WAAW,CAAC,CAAC,EACX,KAAK,EAAE,SAAS,CAAC,EAAE,EACnB,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,EAC7B,KAAK,EAAE,MAAM,EACb,KAAK,SAAK,GACT,gBAAgB,CAAC,CAAC,CAAC,EAAE;IAUxB,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;yCAtBhB,oBAAoB;;CAyBhC"}
@@ -0,0 +1,32 @@
1
+ import { Injectable } from '@angular/core';
2
+ import { ensureNgNativeBridge } from '@ng-desktop/platform';
3
+ import * as i0 from "@angular/core";
4
+ /**
5
+ * Injectable Angular service delegating CPU-intensive fuzzy search, scoring, and FNV-1a hashing
6
+ * to the multithreaded Rust `NativeComputePool` without blocking the UI thread.
7
+ */
8
+ export class NativeComputeService {
9
+ bridge = ensureNgNativeBridge();
10
+ fuzzyFilterStrings(items, query, limit = 50) {
11
+ return this.bridge.computeFuzzyFilter(items, query, limit);
12
+ }
13
+ fuzzyFilter(items, selector, query, limit = 50) {
14
+ const keys = items.map((item) => selector(item));
15
+ const matches = this.bridge.computeFuzzyFilter(keys, query, limit);
16
+ return matches.map((m) => ({
17
+ item: items[m.index],
18
+ index: m.index,
19
+ score: m.score,
20
+ }));
21
+ }
22
+ hash(input) {
23
+ return this.bridge.computeHash(input);
24
+ }
25
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.6", ngImport: i0, type: NativeComputeService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
26
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.2.6", ngImport: i0, type: NativeComputeService, providedIn: 'root' });
27
+ }
28
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.6", ngImport: i0, type: NativeComputeService, decorators: [{
29
+ type: Injectable,
30
+ args: [{ providedIn: 'root' }]
31
+ }] });
32
+ //# sourceMappingURL=compute-service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compute-service.js","sourceRoot":"","sources":["../../../../packages/desktop-native/src/compute-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,oBAAoB,EAA2B,MAAM,sBAAsB,CAAC;;AAQrF;;;GAGG;AAEH,MAAM,OAAO,oBAAoB;IACd,MAAM,GAAG,oBAAoB,EAAE,CAAC;IAEjD,kBAAkB,CAAC,KAAwB,EAAE,KAAa,EAAE,KAAK,GAAG,EAAE;QACpE,OAAO,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;IAC7D,CAAC;IAED,WAAW,CACT,KAAmB,EACnB,QAA6B,EAC7B,KAAa,EACb,KAAK,GAAG,EAAE;QAEV,MAAM,IAAI,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;QACjD,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;QACnE,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACzB,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;YACpB,KAAK,EAAE,CAAC,CAAC,KAAK;YACd,KAAK,EAAE,CAAC,CAAC,KAAK;SACf,CAAC,CAAC,CAAC;IACN,CAAC;IAED,IAAI,CAAC,KAAa;QAChB,OAAO,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IACxC,CAAC;uGAxBU,oBAAoB;2GAApB,oBAAoB,cADP,MAAM;;2FACnB,oBAAoB;kBADhC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE","sourcesContent":["import { Injectable } from '@angular/core';\nimport { ensureNgNativeBridge, type NativeComputeMatch } from '@ng-desktop/platform';\n\nexport interface NativeScoredItem<T> {\n item: T;\n index: number;\n score: number;\n}\n\n/**\n * Injectable Angular service delegating CPU-intensive fuzzy search, scoring, and FNV-1a hashing\n * to the multithreaded Rust `NativeComputePool` without blocking the UI thread.\n */\n@Injectable({ providedIn: 'root' })\nexport class NativeComputeService {\n private readonly bridge = ensureNgNativeBridge();\n\n fuzzyFilterStrings(items: readonly string[], query: string, limit = 50): NativeComputeMatch[] {\n return this.bridge.computeFuzzyFilter(items, query, limit);\n }\n\n fuzzyFilter<T>(\n items: readonly T[],\n selector: (item: T) => string,\n query: string,\n limit = 50,\n ): NativeScoredItem<T>[] {\n const keys = items.map((item) => selector(item));\n const matches = this.bridge.computeFuzzyFilter(keys, query, limit);\n return matches.map((m) => ({\n item: items[m.index],\n index: m.index,\n score: m.score,\n }));\n }\n\n hash(input: string): string {\n return this.bridge.computeHash(input);\n }\n}\n"]}
@@ -0,0 +1,34 @@
1
+ import { EnvironmentProviders, WritableSignal } from '@angular/core';
2
+ import * as i0 from "@angular/core";
3
+ export type NativeThemeMode = 'dark' | 'light';
4
+ export interface OpenFileDialogOptions {
5
+ title?: string;
6
+ defaultPath?: string;
7
+ }
8
+ export interface SaveFileDialogOptions {
9
+ title?: string;
10
+ suggestedName?: string;
11
+ }
12
+ /**
13
+ * Injectable Angular service providing reactive access to native Desktop OS capabilities:
14
+ * - System Dark/Light theme (`theme` signal synchronized with `GtkSettings` / `AdwStyleManager`)
15
+ * - Native Clipboard (`GdkClipboard`)
16
+ * - Desktop Notifications (`GNotification`)
17
+ * - Native File Dialogs (`GtkFileDialog` open/save)
18
+ */
19
+ export declare class NativeDesktopService {
20
+ private readonly bridge;
21
+ readonly theme: WritableSignal<NativeThemeMode>;
22
+ constructor();
23
+ setTheme(mode: NativeThemeMode): void;
24
+ toggleTheme(): NativeThemeMode;
25
+ getClipboardText(): string;
26
+ setClipboardText(text: string): void;
27
+ notify(title: string, body: string, icon?: string): void;
28
+ openFileDialog(options?: OpenFileDialogOptions): string;
29
+ saveFileDialog(options?: SaveFileDialogOptions): string;
30
+ static ɵfac: i0.ɵɵFactoryDeclaration<NativeDesktopService, never>;
31
+ static ɵprov: i0.ɵɵInjectableDeclaration<any>;
32
+ }
33
+ export declare function provideNativeDesktop(): EnvironmentProviders;
34
+ //# sourceMappingURL=desktop-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"desktop-service.d.ts","sourceRoot":"","sources":["../../../../packages/desktop-native/src/desktop-service.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EAIpB,cAAc,EACf,MAAM,eAAe,CAAC;;AAOvB,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,OAAO,CAAC;AAE/C,MAAM,WAAW,qBAAqB;IACpC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,qBAAqB;IACpC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;GAMG;AACH,qBACa,oBAAoB;IAC/B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA0B;IACjD,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAC,eAAe,CAAC,CAAC;;IAMhD,QAAQ,CAAC,IAAI,EAAE,eAAe,GAAG,IAAI;IAKrC,WAAW,IAAI,eAAe;IAM9B,gBAAgB,IAAI,MAAM;IAI1B,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAIpC,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI;IAIxD,cAAc,CAAC,OAAO,CAAC,EAAE,qBAAqB,GAAG,MAAM;IAIvD,cAAc,CAAC,OAAO,CAAC,EAAE,qBAAqB,GAAG,MAAM;yCAnC5C,oBAAoB;;CAsChC;AAED,wBAAgB,oBAAoB,IAAI,oBAAoB,CAQ3D"}
@@ -0,0 +1,62 @@
1
+ import { Injectable, makeEnvironmentProviders, signal, } from '@angular/core';
2
+ import { ensureNgNativeBridge } from '@ng-desktop/platform';
3
+ import { NativeComputeService } from './compute-service.js';
4
+ import { NativeFileSystemService } from './fs-service.js';
5
+ import { NativeNetworkService } from './network-service.js';
6
+ import { NativeSqliteService } from './sqlite-service.js';
7
+ import * as i0 from "@angular/core";
8
+ /**
9
+ * Injectable Angular service providing reactive access to native Desktop OS capabilities:
10
+ * - System Dark/Light theme (`theme` signal synchronized with `GtkSettings` / `AdwStyleManager`)
11
+ * - Native Clipboard (`GdkClipboard`)
12
+ * - Desktop Notifications (`GNotification`)
13
+ * - Native File Dialogs (`GtkFileDialog` open/save)
14
+ */
15
+ export class NativeDesktopService {
16
+ bridge = ensureNgNativeBridge();
17
+ theme;
18
+ constructor() {
19
+ this.theme = signal(this.bridge.getSystemTheme(), /* @ts-ignore */
20
+ ...(ngDevMode ? [{ debugName: "theme" }] : /* istanbul ignore next */ []));
21
+ }
22
+ setTheme(mode) {
23
+ this.bridge.setSystemTheme(mode);
24
+ this.theme.set(mode);
25
+ }
26
+ toggleTheme() {
27
+ const next = this.theme() === 'dark' ? 'light' : 'dark';
28
+ this.setTheme(next);
29
+ return next;
30
+ }
31
+ getClipboardText() {
32
+ return this.bridge.getClipboard();
33
+ }
34
+ setClipboardText(text) {
35
+ this.bridge.setClipboard(text);
36
+ }
37
+ notify(title, body, icon) {
38
+ this.bridge.sendNotification(title, body, icon);
39
+ }
40
+ openFileDialog(options) {
41
+ return this.bridge.openFileDialog(options?.title, options?.defaultPath);
42
+ }
43
+ saveFileDialog(options) {
44
+ return this.bridge.saveFileDialog(options?.title, options?.suggestedName);
45
+ }
46
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.6", ngImport: i0, type: NativeDesktopService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
47
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.2.6", ngImport: i0, type: NativeDesktopService, providedIn: 'root' });
48
+ }
49
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.6", ngImport: i0, type: NativeDesktopService, decorators: [{
50
+ type: Injectable,
51
+ args: [{ providedIn: 'root' }]
52
+ }], ctorParameters: () => [] });
53
+ export function provideNativeDesktop() {
54
+ return makeEnvironmentProviders([
55
+ NativeDesktopService,
56
+ NativeSqliteService,
57
+ NativeNetworkService,
58
+ NativeComputeService,
59
+ NativeFileSystemService,
60
+ ]);
61
+ }
62
+ //# sourceMappingURL=desktop-service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"desktop-service.js","sourceRoot":"","sources":["../../../../packages/desktop-native/src/desktop-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,UAAU,EACV,wBAAwB,EACxB,MAAM,GAEP,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;;AAcvD;;;;;;GAMG;AAEH,MAAM,OAAO,oBAAoB;IACd,MAAM,GAAG,oBAAoB,EAAE,CAAC;IACxC,KAAK,CAAkC;IAEhD;QACE,IAAI,CAAC,KAAK,GAAG,MAAM,CAAkB,IAAI,CAAC,MAAM,CAAC,cAAc,EAAE;kFAAC,CAAC;IACrE,CAAC;IAED,QAAQ,CAAC,IAAqB;QAC5B,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;QACjC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACvB,CAAC;IAED,WAAW;QACT,MAAM,IAAI,GAAoB,IAAI,CAAC,KAAK,EAAE,KAAK,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC;QACzE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACpB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,gBAAgB;QACd,OAAO,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC;IACpC,CAAC;IAED,gBAAgB,CAAC,IAAY;QAC3B,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;IACjC,CAAC;IAED,MAAM,CAAC,KAAa,EAAE,IAAY,EAAE,IAAa;QAC/C,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IAClD,CAAC;IAED,cAAc,CAAC,OAA+B;QAC5C,OAAO,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC;IAC1E,CAAC;IAED,cAAc,CAAC,OAA+B;QAC5C,OAAO,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,aAAa,CAAC,CAAC;IAC5E,CAAC;uGArCU,oBAAoB;2GAApB,oBAAoB,cADP,MAAM;;2FACnB,oBAAoB;kBADhC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;AAyClC,MAAM,UAAU,oBAAoB;IAClC,OAAO,wBAAwB,CAAC;QAC9B,oBAAoB;QACpB,mBAAmB;QACnB,oBAAoB;QACpB,oBAAoB;QACpB,uBAAuB;KACxB,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {\n EnvironmentProviders,\n Injectable,\n makeEnvironmentProviders,\n signal,\n WritableSignal,\n} from '@angular/core';\nimport { ensureNgNativeBridge } from '@ng-desktop/platform';\nimport { NativeComputeService } from './compute-service';\nimport { NativeFileSystemService } from './fs-service';\nimport { NativeNetworkService } from './network-service';\nimport { NativeSqliteService } from './sqlite-service';\n\nexport type NativeThemeMode = 'dark' | 'light';\n\nexport interface OpenFileDialogOptions {\n title?: string;\n defaultPath?: string;\n}\n\nexport interface SaveFileDialogOptions {\n title?: string;\n suggestedName?: string;\n}\n\n/**\n * Injectable Angular service providing reactive access to native Desktop OS capabilities:\n * - System Dark/Light theme (`theme` signal synchronized with `GtkSettings` / `AdwStyleManager`)\n * - Native Clipboard (`GdkClipboard`)\n * - Desktop Notifications (`GNotification`)\n * - Native File Dialogs (`GtkFileDialog` open/save)\n */\n@Injectable({ providedIn: 'root' })\nexport class NativeDesktopService {\n private readonly bridge = ensureNgNativeBridge();\n readonly theme: WritableSignal<NativeThemeMode>;\n\n constructor() {\n this.theme = signal<NativeThemeMode>(this.bridge.getSystemTheme());\n }\n\n setTheme(mode: NativeThemeMode): void {\n this.bridge.setSystemTheme(mode);\n this.theme.set(mode);\n }\n\n toggleTheme(): NativeThemeMode {\n const next: NativeThemeMode = this.theme() === 'dark' ? 'light' : 'dark';\n this.setTheme(next);\n return next;\n }\n\n getClipboardText(): string {\n return this.bridge.getClipboard();\n }\n\n setClipboardText(text: string): void {\n this.bridge.setClipboard(text);\n }\n\n notify(title: string, body: string, icon?: string): void {\n this.bridge.sendNotification(title, body, icon);\n }\n\n openFileDialog(options?: OpenFileDialogOptions): string {\n return this.bridge.openFileDialog(options?.title, options?.defaultPath);\n }\n\n saveFileDialog(options?: SaveFileDialogOptions): string {\n return this.bridge.saveFileDialog(options?.title, options?.suggestedName);\n }\n}\n\nexport function provideNativeDesktop(): EnvironmentProviders {\n return makeEnvironmentProviders([\n NativeDesktopService,\n NativeSqliteService,\n NativeNetworkService,\n NativeComputeService,\n NativeFileSystemService,\n ]);\n}\n"]}
@@ -0,0 +1,21 @@
1
+ import { OnDestroy } from '@angular/core';
2
+ import * as i0 from "@angular/core";
3
+ export interface NativeFileDropPayload {
4
+ value?: string;
5
+ paths?: string[];
6
+ }
7
+ /**
8
+ * Standalone directive (`[ngNativeDropTarget]`) that enables OS-native file drag-and-drop
9
+ * (`GtkDropTarget` on Linux GTK4, `AllowDrop` on WinUI 3, `registerForDraggedTypes` on macOS AppKit)
10
+ * and emits dropped file paths through `(fileDrop)`.
11
+ */
12
+ export declare class NativeDropTargetDirective implements OnDestroy {
13
+ readonly fileDrop: import("@angular/core").OutputEmitterRef<string[]>;
14
+ private readonly unlisten;
15
+ constructor();
16
+ static extractPaths(event: unknown): string[];
17
+ ngOnDestroy(): void;
18
+ static ɵfac: i0.ɵɵFactoryDeclaration<NativeDropTargetDirective, never>;
19
+ static ɵdir: i0.ɵɵDirectiveDeclaration<NativeDropTargetDirective, "[ngNativeDropTarget]", never, {}, { "fileDrop": "fileDrop"; }, never, never, true, never>;
20
+ }
21
+ //# sourceMappingURL=drop-target.directive.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"drop-target.directive.d.ts","sourceRoot":"","sources":["../../../../packages/desktop-native/src/drop-target.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiC,SAAS,EAAqB,MAAM,eAAe,CAAC;;AAE5F,MAAM,WAAW,qBAAqB;IACpC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;CAClB;AAED;;;;GAIG;AACH,qBAIa,yBAA0B,YAAW,SAAS;IACzD,QAAQ,CAAC,QAAQ,qDAAsB;IACvC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAa;;IAgBtC,MAAM,CAAC,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,EAAE;IAsB7C,WAAW,IAAI,IAAI;yCAxCR,yBAAyB;2CAAzB,yBAAyB;CA2CrC"}
@@ -0,0 +1,57 @@
1
+ import { Directive, ElementRef, inject, output, Renderer2 } from '@angular/core';
2
+ import * as i0 from "@angular/core";
3
+ /**
4
+ * Standalone directive (`[ngNativeDropTarget]`) that enables OS-native file drag-and-drop
5
+ * (`GtkDropTarget` on Linux GTK4, `AllowDrop` on WinUI 3, `registerForDraggedTypes` on macOS AppKit)
6
+ * and emits dropped file paths through `(fileDrop)`.
7
+ */
8
+ export class NativeDropTargetDirective {
9
+ fileDrop = output();
10
+ unlisten;
11
+ constructor() {
12
+ const renderer = inject(Renderer2);
13
+ const elRef = inject(ElementRef);
14
+ const nativeEl = elRef.nativeElement;
15
+ renderer.setAttribute(nativeEl, 'drop-target', 'true');
16
+ this.unlisten = renderer.listen(nativeEl, 'file-drop', (event) => {
17
+ const paths = NativeDropTargetDirective.extractPaths(event);
18
+ if (paths.length > 0) {
19
+ this.fileDrop.emit(paths);
20
+ }
21
+ });
22
+ }
23
+ static extractPaths(event) {
24
+ if (typeof event === 'string') {
25
+ return event
26
+ .split(/\r?\n|,/)
27
+ .map((p) => p.trim())
28
+ .filter((p) => p.length > 0);
29
+ }
30
+ if (event && typeof event === 'object') {
31
+ const payload = event;
32
+ if (Array.isArray(payload.paths)) {
33
+ return payload.paths.map((p) => String(p).trim()).filter((p) => p.length > 0);
34
+ }
35
+ if (typeof payload.value === 'string') {
36
+ return payload.value
37
+ .split(/\r?\n|,/)
38
+ .map((p) => p.trim())
39
+ .filter((p) => p.length > 0);
40
+ }
41
+ }
42
+ return [];
43
+ }
44
+ ngOnDestroy() {
45
+ this.unlisten();
46
+ }
47
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.6", ngImport: i0, type: NativeDropTargetDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
48
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.2.6", type: NativeDropTargetDirective, isStandalone: true, selector: "[ngNativeDropTarget]", outputs: { fileDrop: "fileDrop" }, ngImport: i0 });
49
+ }
50
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.6", ngImport: i0, type: NativeDropTargetDirective, decorators: [{
51
+ type: Directive,
52
+ args: [{
53
+ selector: '[ngNativeDropTarget]',
54
+ standalone: true,
55
+ }]
56
+ }], ctorParameters: () => [], propDecorators: { fileDrop: [{ type: i0.Output, args: ["fileDrop"] }] } });
57
+ //# sourceMappingURL=drop-target.directive.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"drop-target.directive.js","sourceRoot":"","sources":["../../../../packages/desktop-native/src/drop-target.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,EAAa,MAAM,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;;AAO5F;;;;GAIG;AAKH,MAAM,OAAO,yBAAyB;IAC3B,QAAQ,GAAG,MAAM,EAAY,CAAC;IACtB,QAAQ,CAAa;IAEtC;QACE,MAAM,QAAQ,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;QACnC,MAAM,KAAK,GAAG,MAAM,CAAsB,UAAU,CAAC,CAAC;QACtD,MAAM,QAAQ,GAAG,KAAK,CAAC,aAAa,CAAC;QAErC,QAAQ,CAAC,YAAY,CAAC,QAAQ,EAAE,aAAa,EAAE,MAAM,CAAC,CAAC;QACvD,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC,MAAM,CAAC,QAAQ,EAAE,WAAW,EAAE,CAAC,KAAe,EAAE,EAAE;YACzE,MAAM,KAAK,GAAG,yBAAyB,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;YAC5D,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACrB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAC5B,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED,MAAM,CAAC,YAAY,CAAC,KAAc;QAChC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAC9B,OAAO,KAAK;iBACT,KAAK,CAAC,SAAS,CAAC;iBAChB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;iBACpB,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QACjC,CAAC;QACD,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YACvC,MAAM,OAAO,GAAG,KAA8B,CAAC;YAC/C,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;gBACjC,OAAO,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;YAChF,CAAC;YACD,IAAI,OAAO,OAAO,CAAC,KAAK,KAAK,QAAQ,EAAE,CAAC;gBACtC,OAAO,OAAO,CAAC,KAAK;qBACjB,KAAK,CAAC,SAAS,CAAC;qBAChB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;qBACpB,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;YACjC,CAAC;QACH,CAAC;QACD,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,WAAW;QACT,IAAI,CAAC,QAAQ,EAAE,CAAC;IAClB,CAAC;uGA1CU,yBAAyB;2FAAzB,yBAAyB;;2FAAzB,yBAAyB;kBAJrC,SAAS;mBAAC;oBACT,QAAQ,EAAE,sBAAsB;oBAChC,UAAU,EAAE,IAAI;iBACjB","sourcesContent":["import { Directive, ElementRef, inject, OnDestroy, output, Renderer2 } from '@angular/core';\n\nexport interface NativeFileDropPayload {\n value?: string;\n paths?: string[];\n}\n\n/**\n * Standalone directive (`[ngNativeDropTarget]`) that enables OS-native file drag-and-drop\n * (`GtkDropTarget` on Linux GTK4, `AllowDrop` on WinUI 3, `registerForDraggedTypes` on macOS AppKit)\n * and emits dropped file paths through `(fileDrop)`.\n */\n@Directive({\n selector: '[ngNativeDropTarget]',\n standalone: true,\n})\nexport class NativeDropTargetDirective implements OnDestroy {\n readonly fileDrop = output<string[]>();\n private readonly unlisten: () => void;\n\n constructor() {\n const renderer = inject(Renderer2);\n const elRef = inject<ElementRef<unknown>>(ElementRef);\n const nativeEl = elRef.nativeElement;\n\n renderer.setAttribute(nativeEl, 'drop-target', 'true');\n this.unlisten = renderer.listen(nativeEl, 'file-drop', (event?: unknown) => {\n const paths = NativeDropTargetDirective.extractPaths(event);\n if (paths.length > 0) {\n this.fileDrop.emit(paths);\n }\n });\n }\n\n static extractPaths(event: unknown): string[] {\n if (typeof event === 'string') {\n return event\n .split(/\\r?\\n|,/)\n .map((p) => p.trim())\n .filter((p) => p.length > 0);\n }\n if (event && typeof event === 'object') {\n const payload = event as NativeFileDropPayload;\n if (Array.isArray(payload.paths)) {\n return payload.paths.map((p) => String(p).trim()).filter((p) => p.length > 0);\n }\n if (typeof payload.value === 'string') {\n return payload.value\n .split(/\\r?\\n|,/)\n .map((p) => p.trim())\n .filter((p) => p.length > 0);\n }\n }\n return [];\n }\n\n ngOnDestroy(): void {\n this.unlisten();\n }\n}\n"]}
@@ -0,0 +1,27 @@
1
+ import { Signal } from '@angular/core';
2
+ import { type NativeXdgDirKind } from '@ng-desktop/platform';
3
+ import * as i0 from "@angular/core";
4
+ export interface NativeWatchedFileRef<T> {
5
+ readonly path: string;
6
+ readonly value: Signal<T>;
7
+ reload(): void;
8
+ }
9
+ /**
10
+ * Injectable Angular service for XDG Base Directory resolution (`config`, `data`, `cache`),
11
+ * atomic file writes, and reactive file watching backed by OS kernel notifications (`inotify` / `FSEvents` / `ReadDirectoryChangesW`).
12
+ */
13
+ export declare class NativeFileSystemService {
14
+ private readonly bridge;
15
+ private readonly watchedEntries;
16
+ resolveXdgPath(kind: NativeXdgDirKind, relPath: string): string;
17
+ readText(path: string): string | null;
18
+ writeText(path: string, content: string): boolean;
19
+ readJson<T>(path: string, fallback: T): T;
20
+ writeJson(path: string, data: unknown): boolean;
21
+ watchFile(path: string, initialContent?: string): NativeWatchedFileRef<string>;
22
+ watchJson<T>(path: string, fallback: T): NativeWatchedFileRef<T>;
23
+ refreshWatchedFiles(): string[];
24
+ static ɵfac: i0.ɵɵFactoryDeclaration<NativeFileSystemService, never>;
25
+ static ɵprov: i0.ɵɵInjectableDeclaration<any>;
26
+ }
27
+ //# sourceMappingURL=fs-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fs-service.d.ts","sourceRoot":"","sources":["../../../../packages/desktop-native/src/fs-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,MAAM,EAA0B,MAAM,eAAe,CAAC;AAC3E,OAAO,EAAwB,KAAK,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;;AAEnF,MAAM,WAAW,oBAAoB,CAAC,CAAC;IACrC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;IAC1B,MAAM,IAAI,IAAI,CAAC;CAChB;AAOD;;;GAGG;AACH,qBACa,uBAAuB;IAClC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA0B;IACjD,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAmC;IAElE,cAAc,CAAC,IAAI,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM;IAI/D,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAIrC,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO;IAQjD,QAAQ,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,GAAG,CAAC;IAYzC,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO;IAI/C,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,cAAc,SAAK,GAAG,oBAAoB,CAAC,MAAM,CAAC;IAiB1E,SAAS,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,GAAG,oBAAoB,CAAC,CAAC,CAAC;IAchE,mBAAmB,IAAI,MAAM,EAAE;yCAnEpB,uBAAuB;;CA0EnC"}
@@ -0,0 +1,84 @@
1
+ import { Injectable, signal } from '@angular/core';
2
+ import { ensureNgNativeBridge } from '@ng-desktop/platform';
3
+ import * as i0 from "@angular/core";
4
+ /**
5
+ * Injectable Angular service for XDG Base Directory resolution (`config`, `data`, `cache`),
6
+ * atomic file writes, and reactive file watching backed by OS kernel notifications (`inotify` / `FSEvents` / `ReadDirectoryChangesW`).
7
+ */
8
+ export class NativeFileSystemService {
9
+ bridge = ensureNgNativeBridge();
10
+ watchedEntries = new Map();
11
+ resolveXdgPath(kind, relPath) {
12
+ return this.bridge.fsResolvePath(kind, relPath);
13
+ }
14
+ readText(path) {
15
+ return this.bridge.fsReadText(path);
16
+ }
17
+ writeText(path, content) {
18
+ const ok = this.bridge.fsWriteText(path, content);
19
+ if (ok) {
20
+ this.refreshWatchedFiles();
21
+ }
22
+ return ok;
23
+ }
24
+ readJson(path, fallback) {
25
+ const raw = this.readText(path);
26
+ if (raw === null || raw.trim().length === 0) {
27
+ return fallback;
28
+ }
29
+ try {
30
+ return JSON.parse(raw);
31
+ }
32
+ catch {
33
+ return fallback;
34
+ }
35
+ }
36
+ writeJson(path, data) {
37
+ return this.writeText(path, JSON.stringify(data, null, 2));
38
+ }
39
+ watchFile(path, initialContent = '') {
40
+ this.bridge.fsWatchFile(path);
41
+ const sig = signal(this.readText(path) ?? initialContent, /* @ts-ignore */
42
+ ...(ngDevMode ? [{ debugName: "sig" }] : /* istanbul ignore next */ []));
43
+ const reload = () => {
44
+ const latest = this.readText(path);
45
+ if (latest !== null) {
46
+ sig.set(latest);
47
+ }
48
+ };
49
+ this.watchedEntries.set(path, { path, reload });
50
+ return {
51
+ path,
52
+ value: sig.asReadonly(),
53
+ reload,
54
+ };
55
+ }
56
+ watchJson(path, fallback) {
57
+ this.bridge.fsWatchFile(path);
58
+ const sig = signal(this.readJson(path, fallback), /* @ts-ignore */
59
+ ...(ngDevMode ? [{ debugName: "sig" }] : /* istanbul ignore next */ []));
60
+ const reload = () => {
61
+ sig.set(this.readJson(path, fallback));
62
+ };
63
+ this.watchedEntries.set(path, { path, reload });
64
+ return {
65
+ path,
66
+ value: sig.asReadonly(),
67
+ reload,
68
+ };
69
+ }
70
+ refreshWatchedFiles() {
71
+ const changed = this.bridge.fsPollChangedFiles();
72
+ for (const path of changed) {
73
+ this.watchedEntries.get(path)?.reload();
74
+ }
75
+ return changed;
76
+ }
77
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.6", ngImport: i0, type: NativeFileSystemService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
78
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.2.6", ngImport: i0, type: NativeFileSystemService, providedIn: 'root' });
79
+ }
80
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.6", ngImport: i0, type: NativeFileSystemService, decorators: [{
81
+ type: Injectable,
82
+ args: [{ providedIn: 'root' }]
83
+ }] });
84
+ //# sourceMappingURL=fs-service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fs-service.js","sourceRoot":"","sources":["../../../../packages/desktop-native/src/fs-service.ts"],"names":[],"mappings":"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","sourcesContent":["import { Injectable, Signal, signal, WritableSignal } from '@angular/core';\nimport { ensureNgNativeBridge, type NativeXdgDirKind } from '@ng-desktop/platform';\n\nexport interface NativeWatchedFileRef<T> {\n readonly path: string;\n readonly value: Signal<T>;\n reload(): void;\n}\n\ninterface WatchedEntry {\n path: string;\n reload: () => void;\n}\n\n/**\n * Injectable Angular service for XDG Base Directory resolution (`config`, `data`, `cache`),\n * atomic file writes, and reactive file watching backed by OS kernel notifications (`inotify` / `FSEvents` / `ReadDirectoryChangesW`).\n */\n@Injectable({ providedIn: 'root' })\nexport class NativeFileSystemService {\n private readonly bridge = ensureNgNativeBridge();\n private readonly watchedEntries = new Map<string, WatchedEntry>();\n\n resolveXdgPath(kind: NativeXdgDirKind, relPath: string): string {\n return this.bridge.fsResolvePath(kind, relPath);\n }\n\n readText(path: string): string | null {\n return this.bridge.fsReadText(path);\n }\n\n writeText(path: string, content: string): boolean {\n const ok = this.bridge.fsWriteText(path, content);\n if (ok) {\n this.refreshWatchedFiles();\n }\n return ok;\n }\n\n readJson<T>(path: string, fallback: T): T {\n const raw = this.readText(path);\n if (raw === null || raw.trim().length === 0) {\n return fallback;\n }\n try {\n return JSON.parse(raw) as T;\n } catch {\n return fallback;\n }\n }\n\n writeJson(path: string, data: unknown): boolean {\n return this.writeText(path, JSON.stringify(data, null, 2));\n }\n\n watchFile(path: string, initialContent = ''): NativeWatchedFileRef<string> {\n this.bridge.fsWatchFile(path);\n const sig: WritableSignal<string> = signal(this.readText(path) ?? initialContent);\n const reload = (): void => {\n const latest = this.readText(path);\n if (latest !== null) {\n sig.set(latest);\n }\n };\n this.watchedEntries.set(path, { path, reload });\n return {\n path,\n value: sig.asReadonly(),\n reload,\n };\n }\n\n watchJson<T>(path: string, fallback: T): NativeWatchedFileRef<T> {\n this.bridge.fsWatchFile(path);\n const sig: WritableSignal<T> = signal(this.readJson(path, fallback));\n const reload = (): void => {\n sig.set(this.readJson(path, fallback));\n };\n this.watchedEntries.set(path, { path, reload });\n return {\n path,\n value: sig.asReadonly(),\n reload,\n };\n }\n\n refreshWatchedFiles(): string[] {\n const changed = this.bridge.fsPollChangedFiles();\n for (const path of changed) {\n this.watchedEntries.get(path)?.reload();\n }\n return changed;\n }\n}\n"]}
@@ -0,0 +1,7 @@
1
+ export { NativeComputeService, type NativeScoredItem } from './compute-service';
2
+ export { NativeDesktopService, provideNativeDesktop, type NativeThemeMode, type OpenFileDialogOptions, type SaveFileDialogOptions, } from './desktop-service';
3
+ export { NativeDropTargetDirective, type NativeFileDropPayload } from './drop-target.directive';
4
+ export { NativeFileSystemService, type NativeWatchedFileRef } from './fs-service';
5
+ export { NativeNetworkService } from './network-service';
6
+ export { NativeSqliteService, type NativeLiveQueryRef } from './sqlite-service';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../packages/desktop-native/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,KAAK,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAChF,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,GAC3B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,yBAAyB,EAAE,KAAK,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChG,OAAO,EAAE,uBAAuB,EAAE,KAAK,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAClF,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,KAAK,kBAAkB,EAAE,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,7 @@
1
+ export { NativeComputeService } from './compute-service.js';
2
+ export { NativeDesktopService, provideNativeDesktop, } from './desktop-service.js';
3
+ export { NativeDropTargetDirective } from './drop-target.directive.js';
4
+ export { NativeFileSystemService } from './fs-service.js';
5
+ export { NativeNetworkService } from './network-service.js';
6
+ export { NativeSqliteService } from './sqlite-service.js';
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/desktop-native/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAyB,MAAM,mBAAmB,CAAC;AAChF,OAAO,EACL,oBAAoB,EACpB,oBAAoB,GAIrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,yBAAyB,EAA8B,MAAM,yBAAyB,CAAC;AAChG,OAAO,EAAE,uBAAuB,EAA6B,MAAM,cAAc,CAAC;AAClF,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAA2B,MAAM,kBAAkB,CAAC","sourcesContent":["export { NativeComputeService, type NativeScoredItem } from './compute-service';\nexport {\n NativeDesktopService,\n provideNativeDesktop,\n type NativeThemeMode,\n type OpenFileDialogOptions,\n type SaveFileDialogOptions,\n} from './desktop-service';\nexport { NativeDropTargetDirective, type NativeFileDropPayload } from './drop-target.directive';\nexport { NativeFileSystemService, type NativeWatchedFileRef } from './fs-service';\nexport { NativeNetworkService } from './network-service';\nexport { NativeSqliteService, type NativeLiveQueryRef } from './sqlite-service';\n"]}
@@ -0,0 +1,19 @@
1
+ import { Signal, WritableSignal } from '@angular/core';
2
+ import { NativeConnectivity } from '@ng-desktop/platform';
3
+ import * as i0 from "@angular/core";
4
+ /**
5
+ * Reactive OS Network Monitor backed by `GNetworkMonitor` (Linux GIO), `NWPathMonitor` (macOS),
6
+ * or `NetworkInformation` (Windows), exposing Signal-based online/metered state.
7
+ */
8
+ export declare class NativeNetworkService {
9
+ private readonly bridge;
10
+ readonly isOnline: WritableSignal<boolean>;
11
+ readonly isMetered: WritableSignal<boolean>;
12
+ readonly connectivity: Signal<NativeConnectivity>;
13
+ constructor();
14
+ refresh(): void;
15
+ setOnlineStatus(online: boolean, metered?: boolean): void;
16
+ static ɵfac: i0.ɵɵFactoryDeclaration<NativeNetworkService, never>;
17
+ static ɵprov: i0.ɵɵInjectableDeclaration<any>;
18
+ }
19
+ //# sourceMappingURL=network-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"network-service.d.ts","sourceRoot":"","sources":["../../../../packages/desktop-native/src/network-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,MAAM,EAAU,cAAc,EAAE,MAAM,eAAe,CAAC;AACrF,OAAO,EAAwB,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;;AAEhF;;;GAGG;AACH,qBACa,oBAAoB;IAC/B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA0B;IACjD,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC;IAC3C,QAAQ,CAAC,SAAS,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC;IAC5C,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC,kBAAkB,CAAC,CAAC;;IAYlD,OAAO,IAAI,IAAI;IAMf,eAAe,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,UAAQ,GAAG,IAAI;yCAtB5C,oBAAoB;;CA2BhC"}
@@ -0,0 +1,43 @@
1
+ import { computed, Injectable, signal } from '@angular/core';
2
+ import { ensureNgNativeBridge } from '@ng-desktop/platform';
3
+ import * as i0 from "@angular/core";
4
+ /**
5
+ * Reactive OS Network Monitor backed by `GNetworkMonitor` (Linux GIO), `NWPathMonitor` (macOS),
6
+ * or `NetworkInformation` (Windows), exposing Signal-based online/metered state.
7
+ */
8
+ export class NativeNetworkService {
9
+ bridge = ensureNgNativeBridge();
10
+ isOnline;
11
+ isMetered;
12
+ connectivity;
13
+ constructor() {
14
+ const initial = this.bridge.getNetworkStatus();
15
+ this.isOnline = signal(initial.online, /* @ts-ignore */
16
+ ...(ngDevMode ? [{ debugName: "isOnline" }] : /* istanbul ignore next */ []));
17
+ this.isMetered = signal(initial.metered, /* @ts-ignore */
18
+ ...(ngDevMode ? [{ debugName: "isMetered" }] : /* istanbul ignore next */ []));
19
+ this.connectivity = computed(() => {
20
+ if (!this.isOnline())
21
+ return 'offline';
22
+ return this.isMetered() ? 'limited' : 'full';
23
+ }, /* @ts-ignore */
24
+ ...(ngDevMode ? [{ debugName: "connectivity" }] : /* istanbul ignore next */ []));
25
+ }
26
+ refresh() {
27
+ const current = this.bridge.getNetworkStatus();
28
+ this.isOnline.set(current.online);
29
+ this.isMetered.set(current.metered);
30
+ }
31
+ setOnlineStatus(online, metered = false) {
32
+ this.bridge.setNetworkStatus(online, metered);
33
+ this.isOnline.set(online);
34
+ this.isMetered.set(metered);
35
+ }
36
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.6", ngImport: i0, type: NativeNetworkService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
37
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.2.6", ngImport: i0, type: NativeNetworkService, providedIn: 'root' });
38
+ }
39
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.6", ngImport: i0, type: NativeNetworkService, decorators: [{
40
+ type: Injectable,
41
+ args: [{ providedIn: 'root' }]
42
+ }], ctorParameters: () => [] });
43
+ //# sourceMappingURL=network-service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"network-service.js","sourceRoot":"","sources":["../../../../packages/desktop-native/src/network-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAU,MAAM,EAAkB,MAAM,eAAe,CAAC;AACrF,OAAO,EAAE,oBAAoB,EAAsB,MAAM,sBAAsB,CAAC;;AAEhF;;;GAGG;AAEH,MAAM,OAAO,oBAAoB;IACd,MAAM,GAAG,oBAAoB,EAAE,CAAC;IACxC,QAAQ,CAA0B;IAClC,SAAS,CAA0B;IACnC,YAAY,CAA6B;IAElD;QACE,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,gBAAgB,EAAE,CAAC;QAC/C,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAU,OAAO,CAAC,MAAM;qFAAC,CAAC;QAChD,IAAI,CAAC,SAAS,GAAG,MAAM,CAAU,OAAO,CAAC,OAAO;sFAAC,CAAC;QAClD,IAAI,CAAC,YAAY,GAAG,QAAQ,CAAqB,GAAG,EAAE;YACpD,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;gBAAE,OAAO,SAAS,CAAC;YACvC,OAAO,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC;QAC/C,CAAC;yFAAC,CAAC;IACL,CAAC;IAED,OAAO;QACL,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,gBAAgB,EAAE,CAAC;QAC/C,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAClC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC;IAED,eAAe,CAAC,MAAe,EAAE,OAAO,GAAG,KAAK;QAC9C,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC9C,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAC1B,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAC9B,CAAC;uGA1BU,oBAAoB;2GAApB,oBAAoB,cADP,MAAM;;2FACnB,oBAAoB;kBADhC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE","sourcesContent":["import { computed, Injectable, Signal, signal, WritableSignal } from '@angular/core';\nimport { ensureNgNativeBridge, NativeConnectivity } from '@ng-desktop/platform';\n\n/**\n * Reactive OS Network Monitor backed by `GNetworkMonitor` (Linux GIO), `NWPathMonitor` (macOS),\n * or `NetworkInformation` (Windows), exposing Signal-based online/metered state.\n */\n@Injectable({ providedIn: 'root' })\nexport class NativeNetworkService {\n private readonly bridge = ensureNgNativeBridge();\n readonly isOnline: WritableSignal<boolean>;\n readonly isMetered: WritableSignal<boolean>;\n readonly connectivity: Signal<NativeConnectivity>;\n\n constructor() {\n const initial = this.bridge.getNetworkStatus();\n this.isOnline = signal<boolean>(initial.online);\n this.isMetered = signal<boolean>(initial.metered);\n this.connectivity = computed<NativeConnectivity>(() => {\n if (!this.isOnline()) return 'offline';\n return this.isMetered() ? 'limited' : 'full';\n });\n }\n\n refresh(): void {\n const current = this.bridge.getNetworkStatus();\n this.isOnline.set(current.online);\n this.isMetered.set(current.metered);\n }\n\n setOnlineStatus(online: boolean, metered = false): void {\n this.bridge.setNetworkStatus(online, metered);\n this.isOnline.set(online);\n this.isMetered.set(metered);\n }\n}\n"]}
@@ -0,0 +1,22 @@
1
+ import { Signal } from '@angular/core';
2
+ import * as i0 from "@angular/core";
3
+ export interface NativeLiveQueryRef<T> {
4
+ readonly rows: Signal<T[]>;
5
+ readonly count: Signal<number>;
6
+ refresh(): T[];
7
+ }
8
+ /**
9
+ * Reactive native SQLite service backed by Rust `libsqlite3.so.0` FFI (`NativeSqliteDatabase`)
10
+ * with Signal-based `liveQuery()` subscriptions that refresh automatically after mutations.
11
+ */
12
+ export declare class NativeSqliteService {
13
+ private readonly bridge;
14
+ private readonly liveQueryRefreshers;
15
+ readonly mutationVersion: import("@angular/core").WritableSignal<number>;
16
+ execute(sql: string): boolean;
17
+ query<T = Record<string, string>>(sql: string, mapRow?: (row: Record<string, string>) => T): T[];
18
+ liveQuery<T = Record<string, string>>(sqlOrFn: string | (() => string), mapRow?: (row: Record<string, string>) => T): NativeLiveQueryRef<T>;
19
+ static ɵfac: i0.ɵɵFactoryDeclaration<NativeSqliteService, never>;
20
+ static ɵprov: i0.ɵɵInjectableDeclaration<any>;
21
+ }
22
+ //# sourceMappingURL=sqlite-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sqlite-service.d.ts","sourceRoot":"","sources":["../../../../packages/desktop-native/src/sqlite-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,MAAM,EAAU,MAAM,eAAe,CAAC;;AAGrE,MAAM,WAAW,kBAAkB,CAAC,CAAC;IACnC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;IAC/B,OAAO,IAAI,CAAC,EAAE,CAAC;CAChB;AAED;;;GAGG;AACH,qBACa,mBAAmB;IAC9B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA0B;IACjD,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAA4B;IAEhE,QAAQ,CAAC,eAAe,iDAAa;IAErC,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAW7B,KAAK,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE;IAKhG,SAAS,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAClC,OAAO,EAAE,MAAM,GAAG,CAAC,MAAM,MAAM,CAAC,EAChC,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,GAC1C,kBAAkB,CAAC,CAAC,CAAC;yCAzBb,mBAAmB;;CA2C/B"}
@@ -0,0 +1,51 @@
1
+ import { computed, Injectable, signal } from '@angular/core';
2
+ import { ensureNgNativeBridge } from '@ng-desktop/platform';
3
+ import * as i0 from "@angular/core";
4
+ /**
5
+ * Reactive native SQLite service backed by Rust `libsqlite3.so.0` FFI (`NativeSqliteDatabase`)
6
+ * with Signal-based `liveQuery()` subscriptions that refresh automatically after mutations.
7
+ */
8
+ export class NativeSqliteService {
9
+ bridge = ensureNgNativeBridge();
10
+ liveQueryRefreshers = new Set();
11
+ mutationVersion = signal(0, /* @ts-ignore */
12
+ ...(ngDevMode ? [{ debugName: "mutationVersion" }] : /* istanbul ignore next */ []));
13
+ execute(sql) {
14
+ const ok = this.bridge.sqliteExecute(sql);
15
+ if (ok) {
16
+ this.mutationVersion.update((v) => v + 1);
17
+ for (const refresh of this.liveQueryRefreshers) {
18
+ refresh();
19
+ }
20
+ }
21
+ return ok;
22
+ }
23
+ query(sql, mapRow) {
24
+ const rawRows = this.bridge.sqliteQuery(sql);
25
+ return mapRow ? rawRows.map(mapRow) : rawRows;
26
+ }
27
+ liveQuery(sqlOrFn, mapRow) {
28
+ const rowsSignal = signal([], /* @ts-ignore */
29
+ ...(ngDevMode ? [{ debugName: "rowsSignal" }] : /* istanbul ignore next */ []));
30
+ const refresh = () => {
31
+ const sql = typeof sqlOrFn === 'function' ? sqlOrFn() : sqlOrFn;
32
+ const next = this.query(sql, mapRow);
33
+ rowsSignal.set(next);
34
+ return next;
35
+ };
36
+ refresh();
37
+ this.liveQueryRefreshers.add(refresh);
38
+ return {
39
+ rows: rowsSignal.asReadonly(),
40
+ count: computed(() => rowsSignal().length),
41
+ refresh,
42
+ };
43
+ }
44
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.6", ngImport: i0, type: NativeSqliteService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
45
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.2.6", ngImport: i0, type: NativeSqliteService, providedIn: 'root' });
46
+ }
47
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.6", ngImport: i0, type: NativeSqliteService, decorators: [{
48
+ type: Injectable,
49
+ args: [{ providedIn: 'root' }]
50
+ }] });
51
+ //# sourceMappingURL=sqlite-service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sqlite-service.js","sourceRoot":"","sources":["../../../../packages/desktop-native/src/sqlite-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAU,MAAM,EAAE,MAAM,eAAe,CAAC;AACrE,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;;AAQ5D;;;GAGG;AAEH,MAAM,OAAO,mBAAmB;IACb,MAAM,GAAG,oBAAoB,EAAE,CAAC;IAChC,mBAAmB,GAAG,IAAI,GAAG,EAAiB,CAAC;IAEvD,eAAe,GAAG,MAAM,CAAC,CAAC;wFAAC,CAAC;IAErC,OAAO,CAAC,GAAW;QACjB,MAAM,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;QAC1C,IAAI,EAAE,EAAE,CAAC;YACP,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;YAC1C,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,mBAAmB,EAAE,CAAC;gBAC/C,OAAO,EAAE,CAAC;YACZ,CAAC;QACH,CAAC;QACD,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,KAAK,CAA6B,GAAW,EAAE,MAA2C;QACxF,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QAC7C,OAAO,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAE,OAA0B,CAAC;IACpE,CAAC;IAED,SAAS,CACP,OAAgC,EAChC,MAA2C;QAE3C,MAAM,UAAU,GAAG,MAAM,CAAM,EAAE;uFAAC,CAAC;QACnC,MAAM,OAAO,GAAG,GAAQ,EAAE;YACxB,MAAM,GAAG,GAAG,OAAO,OAAO,KAAK,UAAU,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;YAChE,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;YACrC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YACrB,OAAO,IAAI,CAAC;QACd,CAAC,CAAC;QAEF,OAAO,EAAE,CAAC;QACV,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAEtC,OAAO;YACL,IAAI,EAAE,UAAU,CAAC,UAAU,EAAE;YAC7B,KAAK,EAAE,QAAQ,CAAC,GAAG,EAAE,CAAC,UAAU,EAAE,CAAC,MAAM,CAAC;YAC1C,OAAO;SACR,CAAC;IACJ,CAAC;uGA1CU,mBAAmB;2GAAnB,mBAAmB,cADN,MAAM;;2FACnB,mBAAmB;kBAD/B,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE","sourcesContent":["import { computed, Injectable, Signal, signal } from '@angular/core';\nimport { ensureNgNativeBridge } from '@ng-desktop/platform';\n\nexport interface NativeLiveQueryRef<T> {\n readonly rows: Signal<T[]>;\n readonly count: Signal<number>;\n refresh(): T[];\n}\n\n/**\n * Reactive native SQLite service backed by Rust `libsqlite3.so.0` FFI (`NativeSqliteDatabase`)\n * with Signal-based `liveQuery()` subscriptions that refresh automatically after mutations.\n */\n@Injectable({ providedIn: 'root' })\nexport class NativeSqliteService {\n private readonly bridge = ensureNgNativeBridge();\n private readonly liveQueryRefreshers = new Set<() => unknown>();\n\n readonly mutationVersion = signal(0);\n\n execute(sql: string): boolean {\n const ok = this.bridge.sqliteExecute(sql);\n if (ok) {\n this.mutationVersion.update((v) => v + 1);\n for (const refresh of this.liveQueryRefreshers) {\n refresh();\n }\n }\n return ok;\n }\n\n query<T = Record<string, string>>(sql: string, mapRow?: (row: Record<string, string>) => T): T[] {\n const rawRows = this.bridge.sqliteQuery(sql);\n return mapRow ? rawRows.map(mapRow) : (rawRows as unknown as T[]);\n }\n\n liveQuery<T = Record<string, string>>(\n sqlOrFn: string | (() => string),\n mapRow?: (row: Record<string, string>) => T,\n ): NativeLiveQueryRef<T> {\n const rowsSignal = signal<T[]>([]);\n const refresh = (): T[] => {\n const sql = typeof sqlOrFn === 'function' ? sqlOrFn() : sqlOrFn;\n const next = this.query(sql, mapRow);\n rowsSignal.set(next);\n return next;\n };\n\n refresh();\n this.liveQueryRefreshers.add(refresh);\n\n return {\n rows: rowsSignal.asReadonly(),\n count: computed(() => rowsSignal().length),\n refresh,\n };\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,51 @@
1
1
  {
2
2
  "name": "@ng-desktop/desktop",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.3.0",
4
+ "description": "Linux GTK4 / Desktop OS system services (Theme, Clipboard, Notifications, Dialogs, SQLite, Network, Compute, FileSystem, DropTarget)",
5
+ "license": "MIT",
6
+ "keywords": [
7
+ "angular",
8
+ "angular22",
9
+ "desktop",
10
+ "native",
11
+ "gtk4",
12
+ "winui3",
13
+ "appkit",
14
+ "rust"
15
+ ],
16
+ "homepage": "https://github.com/Gaspar1992/ng-desktop-engine",
17
+ "bugs": {
18
+ "url": "https://github.com/Gaspar1992/ng-desktop-engine/issues"
19
+ },
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "git+https://github.com/Gaspar1992/ng-desktop-engine.git",
23
+ "directory": "packages/desktop-native"
24
+ },
25
+ "publishConfig": {
26
+ "access": "public"
27
+ },
28
+ "type": "module",
29
+ "sideEffects": false,
30
+ "files": [
31
+ "fesm2022",
32
+ "README.md",
33
+ "LICENSE"
34
+ ],
35
+ "main": "./fesm2022/index.js",
36
+ "module": "./fesm2022/index.js",
37
+ "types": "./fesm2022/index.d.ts",
38
+ "exports": {
39
+ ".": {
40
+ "types": "./fesm2022/index.d.ts",
41
+ "default": "./fesm2022/index.js"
42
+ },
43
+ "./package.json": {
44
+ "default": "./package.json"
45
+ }
46
+ },
47
+ "peerDependencies": {
48
+ "@angular/core": ">=22.0.0",
49
+ "@ng-desktop/platform": ">=0.3.0"
50
+ }
51
+ }