@ng-desktop/platform 0.3.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +43 -7
- package/fesm2022/bridge-fs-compute.d.ts +1 -1
- package/fesm2022/bridge-fs-compute.js +5 -2
- package/fesm2022/bridge-sqlite.d.ts +0 -1
- package/fesm2022/bridge-sqlite.js +2 -12
- package/fesm2022/bridge.d.ts +62 -2
- package/fesm2022/bridge.js +406 -219
- package/fesm2022/css-style-parser.d.ts +33 -0
- package/fesm2022/css-style-parser.js +259 -0
- package/fesm2022/ecosystem-compat.d.ts +0 -1
- package/fesm2022/ecosystem-compat.js +9 -10
- package/fesm2022/image-loader.d.ts +1 -2
- package/fesm2022/image-loader.js +1 -2
- package/fesm2022/index.d.ts +5 -3
- package/fesm2022/index.js +4 -2
- package/fesm2022/native-directives.d.ts +188 -0
- package/fesm2022/native-directives.js +742 -0
- package/fesm2022/native-element.d.ts +7 -2
- package/fesm2022/native-element.js +21 -2
- package/fesm2022/native-renderer.d.ts +44 -3
- package/fesm2022/native-renderer.js +951 -44
- package/fesm2022/native-title.d.ts +1 -1
- package/fesm2022/native-title.js +17 -5
- package/fesm2022/platform.d.ts +2 -2
- package/fesm2022/platform.js +8 -2
- package/fesm2022/system-providers.d.ts +2 -1
- package/fesm2022/system-providers.js +63 -13
- package/fesm2022/viewport-scroller.d.ts +2 -1
- package/fesm2022/viewport-scroller.js +19 -7
- package/fesm2022/virtual-list.component.d.ts +57 -0
- package/fesm2022/virtual-list.component.js +200 -0
- package/package.json +4 -2
- package/fesm2022/bridge-fs-compute.d.ts.map +0 -1
- package/fesm2022/bridge-fs-compute.js.map +0 -1
- package/fesm2022/bridge-sqlite.d.ts.map +0 -1
- package/fesm2022/bridge-sqlite.js.map +0 -1
- package/fesm2022/bridge.d.ts.map +0 -1
- package/fesm2022/bridge.js.map +0 -1
- package/fesm2022/ecosystem-compat.d.ts.map +0 -1
- package/fesm2022/ecosystem-compat.js.map +0 -1
- package/fesm2022/image-loader.d.ts.map +0 -1
- package/fesm2022/image-loader.js.map +0 -1
- package/fesm2022/index.d.ts.map +0 -1
- package/fesm2022/index.js.map +0 -1
- package/fesm2022/native-element.d.ts.map +0 -1
- package/fesm2022/native-element.js.map +0 -1
- package/fesm2022/native-renderer.d.ts.map +0 -1
- package/fesm2022/native-renderer.js.map +0 -1
- package/fesm2022/native-title.d.ts.map +0 -1
- package/fesm2022/native-title.js.map +0 -1
- package/fesm2022/platform.d.ts.map +0 -1
- package/fesm2022/platform.js.map +0 -1
- package/fesm2022/system-providers.d.ts.map +0 -1
- package/fesm2022/system-providers.js.map +0 -1
- package/fesm2022/viewport-scroller.d.ts.map +0 -1
- package/fesm2022/viewport-scroller.js.map +0 -1
|
@@ -27,6 +27,8 @@ export declare class NativeElementNode {
|
|
|
27
27
|
readonly id: string;
|
|
28
28
|
readonly tag: string;
|
|
29
29
|
readonly isComment: boolean;
|
|
30
|
+
readonly isVirtual: boolean;
|
|
31
|
+
readonly isText: boolean;
|
|
30
32
|
parent: NativeElementNode | null;
|
|
31
33
|
readonly children: NativeElementNode[];
|
|
32
34
|
readonly attributes: Map<string, string>;
|
|
@@ -40,7 +42,7 @@ export declare class NativeElementNode {
|
|
|
40
42
|
toggle: (token: string, force?: boolean) => boolean;
|
|
41
43
|
contains: (token: string) => boolean;
|
|
42
44
|
};
|
|
43
|
-
constructor(id: string, tag: string, isComment?: boolean);
|
|
45
|
+
constructor(id: string, tag: string, isComment?: boolean, isVirtual?: boolean, isText?: boolean);
|
|
44
46
|
get tagName(): string;
|
|
45
47
|
get nodeName(): string;
|
|
46
48
|
get parentNode(): NativeElementNode | null;
|
|
@@ -53,6 +55,10 @@ export declare class NativeElementNode {
|
|
|
53
55
|
set tabIndex(value: number);
|
|
54
56
|
get role(): string | null;
|
|
55
57
|
set role(value: string | null);
|
|
58
|
+
get value(): string;
|
|
59
|
+
set value(val: string);
|
|
60
|
+
get checked(): boolean;
|
|
61
|
+
set checked(val: boolean);
|
|
56
62
|
getAttribute(name: string): string | null;
|
|
57
63
|
setAttribute(name: string, value: string): void;
|
|
58
64
|
removeAttribute(name: string): void;
|
|
@@ -65,4 +71,3 @@ export declare class NativeElementNode {
|
|
|
65
71
|
dispatchEvent(event: NativeElementEvent | string): boolean;
|
|
66
72
|
getBoundingClientRect(): NativeDomRect;
|
|
67
73
|
}
|
|
68
|
-
//# sourceMappingURL=native-element.d.ts.map
|
|
@@ -16,6 +16,8 @@ export class NativeElementNode {
|
|
|
16
16
|
id;
|
|
17
17
|
tag;
|
|
18
18
|
isComment;
|
|
19
|
+
isVirtual;
|
|
20
|
+
isText;
|
|
19
21
|
parent = null;
|
|
20
22
|
children = [];
|
|
21
23
|
attributes = new Map();
|
|
@@ -24,10 +26,12 @@ export class NativeElementNode {
|
|
|
24
26
|
listeners = new Map();
|
|
25
27
|
textContent = '';
|
|
26
28
|
classList;
|
|
27
|
-
constructor(id, tag, isComment = false) {
|
|
29
|
+
constructor(id, tag, isComment = false, isVirtual = false, isText = false) {
|
|
28
30
|
this.id = id;
|
|
29
31
|
this.tag = tag;
|
|
30
32
|
this.isComment = isComment;
|
|
33
|
+
this.isVirtual = isVirtual;
|
|
34
|
+
this.isText = isText;
|
|
31
35
|
this.classList = {
|
|
32
36
|
add: (...tokens) => {
|
|
33
37
|
for (const token of tokens) {
|
|
@@ -114,6 +118,22 @@ export class NativeElementNode {
|
|
|
114
118
|
this.attributes.set('role', value);
|
|
115
119
|
}
|
|
116
120
|
}
|
|
121
|
+
get value() {
|
|
122
|
+
return this.attributes.get('value') ?? this.textContent;
|
|
123
|
+
}
|
|
124
|
+
set value(val) {
|
|
125
|
+
const normalized = String(val ?? '');
|
|
126
|
+
this.textContent = normalized;
|
|
127
|
+
this.attributes.set('value', normalized);
|
|
128
|
+
}
|
|
129
|
+
get checked() {
|
|
130
|
+
return this.attributes.get('active') === 'true' || this.attributes.get('checked') === 'true';
|
|
131
|
+
}
|
|
132
|
+
set checked(val) {
|
|
133
|
+
const strVal = val ? 'true' : 'false';
|
|
134
|
+
this.attributes.set('active', strVal);
|
|
135
|
+
this.attributes.set('checked', strVal);
|
|
136
|
+
}
|
|
117
137
|
getAttribute(name) {
|
|
118
138
|
return this.attributes.get(name) ?? null;
|
|
119
139
|
}
|
|
@@ -190,4 +210,3 @@ export class NativeElementNode {
|
|
|
190
210
|
};
|
|
191
211
|
}
|
|
192
212
|
}
|
|
193
|
-
//# sourceMappingURL=native-element.js.map
|
|
@@ -2,11 +2,27 @@ import { Renderer2, RendererFactory2, RendererStyleFlags2, RendererType2 } from
|
|
|
2
2
|
import { NgNativeBridge } from './bridge';
|
|
3
3
|
import { NativeElementNode } from './native-element';
|
|
4
4
|
import * as i0 from "@angular/core";
|
|
5
|
+
/**
|
|
6
|
+
* 1:1 mapping from standard HTML elements to native desktop widget primitives.
|
|
7
|
+
* Containers map to `ng-box` (1D Flexbox); text elements map to `ng-label`.
|
|
8
|
+
* Angular component selectors (e.g. `app-*`, `router-outlet`, `ng-container`) are omitted
|
|
9
|
+
* so they continue operating as virtual hosts.
|
|
10
|
+
*/
|
|
11
|
+
export declare const HTML_TO_NATIVE_TAG: Readonly<Record<string, string>>;
|
|
12
|
+
/**
|
|
13
|
+
* Resolves an Angular template element tag into a native desktop widget tag (`ng-*`, `gtk-*`,
|
|
14
|
+
* `adw-*`), returning `null` for virtual Angular hosts (`ng-container`, `router-outlet`, `app-*`).
|
|
15
|
+
*/
|
|
16
|
+
export declare function resolveNativeTag(tag: string): string | null;
|
|
5
17
|
/**
|
|
6
18
|
* Custom Angular `Renderer2` implementation that translates Ivy template instructions
|
|
7
19
|
* (`createElement`, `createComment`, `insertBefore`, `removeChild`, `setAttribute`, `listen`)
|
|
8
20
|
* into `globalThis.__NG_NATIVE__` scene graph commands.
|
|
9
21
|
*/
|
|
22
|
+
interface NativeRendererHooks {
|
|
23
|
+
onRealElementCreated?: (tag: string, id: string) => void;
|
|
24
|
+
getPrimaryWindowId?: () => string | null;
|
|
25
|
+
}
|
|
10
26
|
export declare class NativeRenderer2 extends Renderer2 {
|
|
11
27
|
readonly data: {
|
|
12
28
|
[key: string]: unknown;
|
|
@@ -15,7 +31,13 @@ export declare class NativeRenderer2 extends Renderer2 {
|
|
|
15
31
|
private readonly bridge;
|
|
16
32
|
private readonly nodesById;
|
|
17
33
|
private readonly nextId;
|
|
18
|
-
|
|
34
|
+
private readonly hooks?;
|
|
35
|
+
private readonly materializedTextLabels;
|
|
36
|
+
private readonly imageLoadSeq;
|
|
37
|
+
private readonly enabledEventTokens;
|
|
38
|
+
private readonly pendingVirtualListeners;
|
|
39
|
+
constructor(bridge: NgNativeBridge, nodesById: Map<string, NativeElementNode>, nextId: () => string, hooks?: NativeRendererHooks);
|
|
40
|
+
private destroySubtreeNodes;
|
|
19
41
|
destroy(): void;
|
|
20
42
|
createElement(name: string, _namespace?: string | null): NativeElementNode;
|
|
21
43
|
createComment(value: string): NativeElementNode;
|
|
@@ -34,19 +56,38 @@ export declare class NativeRenderer2 extends Renderer2 {
|
|
|
34
56
|
removeStyle(el: NativeElementNode, style: string, _flags?: RendererStyleFlags2): void;
|
|
35
57
|
setProperty(el: NativeElementNode, name: string, value: unknown): void;
|
|
36
58
|
setValue(node: NativeElementNode, value: string): void;
|
|
59
|
+
private ensureLazyEventController;
|
|
37
60
|
listen(target: 'window' | 'document' | 'body' | NativeElementNode, eventName: string, callback: (event: unknown) => boolean | void): () => void;
|
|
61
|
+
private attachRegistrationToRealIds;
|
|
62
|
+
private attachVirtualListenersForAncestors;
|
|
63
|
+
private attachGlobalWindowIcon;
|
|
64
|
+
private syncClassList;
|
|
65
|
+
private handleImageSource;
|
|
66
|
+
private findRealAncestor;
|
|
67
|
+
private collectRealRootIds;
|
|
68
|
+
private findFirstRealId;
|
|
69
|
+
private findNextRealSiblingId;
|
|
70
|
+
private collectTextContent;
|
|
71
|
+
private syncTextBearingParent;
|
|
72
|
+
private materializeTextIntoContainer;
|
|
73
|
+
private projectInsertion;
|
|
38
74
|
}
|
|
39
75
|
export declare class NativeRendererFactory2 implements RendererFactory2 {
|
|
40
76
|
private readonly bridge;
|
|
41
77
|
private readonly nodesById;
|
|
42
78
|
private readonly defaultRenderer;
|
|
79
|
+
private readonly registeredTypeIds;
|
|
43
80
|
private nodeCounter;
|
|
81
|
+
private primaryWindowId;
|
|
82
|
+
private primaryScrollId;
|
|
44
83
|
constructor();
|
|
45
|
-
createRenderer(_hostElement: unknown,
|
|
84
|
+
createRenderer(_hostElement: unknown, type: RendererType2 | null): Renderer2;
|
|
46
85
|
begin(): void;
|
|
47
86
|
end(): void;
|
|
87
|
+
getPrimaryWindowId(): string | null;
|
|
88
|
+
getPrimaryScrollId(): string | null;
|
|
48
89
|
getNode(id: string): NativeElementNode | undefined;
|
|
49
90
|
static ɵfac: i0.ɵɵFactoryDeclaration<NativeRendererFactory2, never>;
|
|
50
91
|
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
51
92
|
}
|
|
52
|
-
|
|
93
|
+
export {};
|