@geastack/geatsc-plugin-gea 0.1.22 → 0.1.24
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/dist/analyze-literals.js +10 -7
- package/dist/analyze-node-aux.js +1 -1
- package/dist/analyze-runtime.js +11 -4
- package/dist/analyze.js +29 -0
- package/dist/cpp-ir.js +7 -14
- package/dist/host-declarations.js +10 -0
- package/dist/host-shims.js +182 -64
- package/dist/types.d.ts +1 -0
- package/package.json +3 -2
package/dist/analyze-literals.js
CHANGED
|
@@ -6,6 +6,9 @@ import path from 'node:path';
|
|
|
6
6
|
// escape their declaration/import/indexed-read paths.
|
|
7
7
|
export function sourceLiteralResolver(files, initiallyOpaque) {
|
|
8
8
|
const sources = new Map([...files].filter(([file]) => !/\.css$/i.test(file)).map(([file, text]) => [file, ts.createSourceFile(file, text, ts.ScriptTarget.Latest, true, /\.[jt]sx$/i.test(file) ? ts.ScriptKind.TSX : ts.ScriptKind.TS)]));
|
|
9
|
+
// Ownership by identity: the program hands back these very SourceFiles, but
|
|
10
|
+
// with fileName normalized to forward slashes, which no Windows key matches.
|
|
11
|
+
const owned = new Set(sources.values());
|
|
9
12
|
const variables = new Map();
|
|
10
13
|
const properties = new Map();
|
|
11
14
|
const arrays = new Set(), escapedArrays = new Set();
|
|
@@ -92,7 +95,7 @@ export function sourceLiteralResolver(files, initiallyOpaque) {
|
|
|
92
95
|
symbol = typeChecker().getAliasedSymbol(symbol);
|
|
93
96
|
const declaration = symbol?.valueDeclaration;
|
|
94
97
|
return declaration && ts.isVariableDeclaration(declaration) && ts.isIdentifier(declaration.name) &&
|
|
95
|
-
|
|
98
|
+
owned.has(declaration.getSourceFile()) && ts.isVariableDeclarationList(declaration.parent) &&
|
|
96
99
|
(declaration.parent.flags & ts.NodeFlags.Const) ? declaration : undefined;
|
|
97
100
|
};
|
|
98
101
|
const localReceiver = (node, seen = new Set()) => {
|
|
@@ -116,14 +119,14 @@ export function sourceLiteralResolver(files, initiallyOpaque) {
|
|
|
116
119
|
symbol = typeChecker().getAliasedSymbol(symbol);
|
|
117
120
|
const exported = symbol?.valueDeclaration;
|
|
118
121
|
return !!exported && ts.isExportAssignment(exported) &&
|
|
119
|
-
|
|
122
|
+
owned.has(exported.getSourceFile()) && localReceiver(exported.expression, seen);
|
|
120
123
|
}
|
|
121
124
|
if (ts.isNewExpression(node)) {
|
|
122
125
|
let symbol = typeChecker().getSymbolAtLocation(node.expression);
|
|
123
126
|
if (symbol && (symbol.flags & ts.SymbolFlags.Alias))
|
|
124
127
|
symbol = typeChecker().getAliasedSymbol(symbol);
|
|
125
128
|
const declaration = symbol?.valueDeclaration;
|
|
126
|
-
if (!declaration || !ts.isClassDeclaration(declaration) || !
|
|
129
|
+
if (!declaration || !ts.isClassDeclaration(declaration) || !owned.has(declaration.getSourceFile()))
|
|
127
130
|
return false;
|
|
128
131
|
// A constructor returning another object breaks the local-instance proof.
|
|
129
132
|
let returnsObject = false;
|
|
@@ -160,7 +163,7 @@ export function sourceLiteralResolver(files, initiallyOpaque) {
|
|
|
160
163
|
if (ts.isCallExpression(node) && (ts.isPropertyAccessExpression(node.expression) || ts.isElementAccessExpression(node.expression)) && localReceiver(node.expression.expression)) {
|
|
161
164
|
const declaration = typeChecker().getResolvedSignature(node)?.declaration;
|
|
162
165
|
// An opaque method receives the object implicitly through `this`.
|
|
163
|
-
if (!declaration || !
|
|
166
|
+
if (!declaration || !owned.has(declaration.getSourceFile()) ||
|
|
164
167
|
!(ts.isMethodDeclaration(declaration) || ts.isFunctionDeclaration(declaration) || ts.isFunctionExpression(declaration) || ts.isArrowFunction(declaration)))
|
|
165
168
|
opaque = true;
|
|
166
169
|
}
|
|
@@ -266,7 +269,7 @@ export function sourceLiteralResolver(files, initiallyOpaque) {
|
|
|
266
269
|
return undefined;
|
|
267
270
|
const at = ts.isPropertyAccessExpression(node) ? node.name : ts.isElementAccessExpression(node) ? node.argumentExpression : node;
|
|
268
271
|
const symbol = at && typeChecker().getSymbolAtLocation(at);
|
|
269
|
-
if (!symbol?.declarations?.some(declaration =>
|
|
272
|
+
if (!symbol?.declarations?.some(declaration => owned.has(declaration.getSourceFile()) &&
|
|
270
273
|
(ts.isPropertyDeclaration(declaration) || ts.isGetAccessorDeclaration(declaration) || ts.isPropertyAssignment(declaration))))
|
|
271
274
|
return undefined;
|
|
272
275
|
const key = 'property:' + name;
|
|
@@ -332,7 +335,7 @@ export function sourceLiteralResolver(files, initiallyOpaque) {
|
|
|
332
335
|
if (symbol && (symbol.flags & ts.SymbolFlags.Alias))
|
|
333
336
|
symbol = typeChecker().getAliasedSymbol(symbol);
|
|
334
337
|
const declarations = symbol?.declarations;
|
|
335
|
-
if (declarations?.length && declarations.every(declaration =>
|
|
338
|
+
if (declarations?.length && declarations.every(declaration => owned.has(declaration.getSourceFile()) && ts.isFunctionDeclaration(declaration) && !!declaration.body)) {
|
|
336
339
|
let reassigned = false;
|
|
337
340
|
const checkWrites = (child) => {
|
|
338
341
|
if (ts.isBinaryExpression(child) && child.operatorToken.kind >= ts.SyntaxKind.FirstAssignment &&
|
|
@@ -360,7 +363,7 @@ export function sourceLiteralResolver(files, initiallyOpaque) {
|
|
|
360
363
|
return false;
|
|
361
364
|
const name = ts.isPropertyAccessExpression(access) ? access.name : access.argumentExpression;
|
|
362
365
|
const declarations = name && typeChecker().getSymbolAtLocation(name)?.declarations;
|
|
363
|
-
return !!declarations?.length && declarations.every(declaration =>
|
|
366
|
+
return !!declarations?.length && declarations.every(declaration => owned.has(declaration.getSourceFile()) && ts.isMethodDeclaration(declaration) && !!declaration.body);
|
|
364
367
|
},
|
|
365
368
|
});
|
|
366
369
|
}
|
package/dist/analyze-node-aux.js
CHANGED
|
@@ -47,7 +47,7 @@ export function addNodeAuxFeatures(file, text, features, isNumeric) {
|
|
|
47
47
|
const source = ts.createSourceFile(file, text, ts.ScriptTarget.Latest, true, /\.[jt]sx$/i.test(file) ? ts.ScriptKind.TSX : ts.ScriptKind.TS);
|
|
48
48
|
const unknown = () => addUnknownNodeAux(features);
|
|
49
49
|
const token = (name) => {
|
|
50
|
-
if (/^(?:addEventListener|removeEventListener|setEventListener|dispatchEvent|on[A-Z].*|on(?:click|pointer.*|touch.*|input|keydown|keyup|scroll)|click|touchstart|touchmove|touchend|pointerdown|pointermove|pointerup|input|keydown|keyup|scroll)$/.test(name))
|
|
50
|
+
if (/^(?:addEventListener|removeEventListener|setEventListener|dispatchEvent|on[A-Z].*|on(?:click|pointer.*|touch.*|input|keydown|keyup|scroll)|click|touchstart|touchmove|touchend|pointerdown|pointermove|pointerup|input|change|keydown|keyup|scroll)$/.test(name))
|
|
51
51
|
features.add('node-listeners');
|
|
52
52
|
if (/^(?:id|dataset|attributes|getElementById|querySelector|querySelectorAll|ensureAppRoot|setAttribute|getAttribute|removeAttribute|hasAttribute|toggleAttribute|setPressId|setPressValue|pressId|pressValue|data-press-id|data-press-value)$/.test(name))
|
|
53
53
|
features.add('node-attributes');
|
package/dist/analyze-runtime.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
1
2
|
import ts from 'typescript';
|
|
2
3
|
// This proof is intentionally narrower than "no JSX". The canvas frame/boot
|
|
3
4
|
// path omits document refresh and service callbacks, so every executable import
|
|
@@ -20,26 +21,32 @@ const canvasModule = /^(?:gea-embedded|@geastack\/core)$/;
|
|
|
20
21
|
export function inferCanvasOnly(sources, unknown) {
|
|
21
22
|
if (unknown || !sources.size)
|
|
22
23
|
return false;
|
|
24
|
+
// Keyed by resolved path: TypeScript asks the host for `C:/app/index.tsx`
|
|
25
|
+
// where discovery recorded `C:\app\index.tsx`, and a missed lookup left the
|
|
26
|
+
// checker binding no file at all on Windows.
|
|
27
|
+
const key = (file) => path.resolve(file);
|
|
23
28
|
const files = new Map();
|
|
29
|
+
const texts = new Map();
|
|
24
30
|
for (const [file, text] of sources) {
|
|
25
31
|
if (!/\.[cm]?[jt]sx?$/.test(file))
|
|
26
32
|
return false;
|
|
27
33
|
const source = ts.createSourceFile(file, text, ts.ScriptTarget.Latest, true, /\.[jt]sx$/.test(file) ? ts.ScriptKind.TSX : /\.[cm]?js$/.test(file) ? ts.ScriptKind.JS : ts.ScriptKind.TS);
|
|
28
34
|
if (source.parseDiagnostics?.length)
|
|
29
35
|
return false;
|
|
30
|
-
files.set(file, source);
|
|
36
|
+
files.set(key(file), source);
|
|
37
|
+
texts.set(key(file), text);
|
|
31
38
|
}
|
|
32
39
|
// Binding local names avoids both a host-global blacklist (which misses new
|
|
33
40
|
// APIs) and false positives for ordinary app methods named fetch/document.
|
|
34
41
|
// No library or filesystem resolution: discovery already owns the graph.
|
|
35
42
|
const options = { noLib: true, noResolve: true, types: [], allowJs: true, target: ts.ScriptTarget.Latest };
|
|
36
43
|
const host = ts.createCompilerHost(options);
|
|
37
|
-
host.getSourceFile = file => files.get(file);
|
|
44
|
+
host.getSourceFile = file => files.get(key(file));
|
|
38
45
|
host.resolveModuleNames = names => names.map(() => undefined);
|
|
39
46
|
host.directoryExists = () => false;
|
|
40
47
|
host.getDirectories = () => [];
|
|
41
|
-
host.fileExists = file => files.has(file);
|
|
42
|
-
host.readFile = file =>
|
|
48
|
+
host.fileExists = file => files.has(key(file));
|
|
49
|
+
host.readFile = file => texts.get(key(file));
|
|
43
50
|
const checker = ts.createProgram([...files.keys()], options, host).getTypeChecker();
|
|
44
51
|
let safe = true;
|
|
45
52
|
let display = false;
|
package/dist/analyze.js
CHANGED
|
@@ -70,6 +70,7 @@ export function analyzeSourceHostBindings(entry) {
|
|
|
70
70
|
addBindingsForGeaEmbeddedImports(text, bindings);
|
|
71
71
|
addBindingsForEmbeddedHostNames(text, bindings);
|
|
72
72
|
addBindingsForHostGlobals(text, bindings);
|
|
73
|
+
addMediaCapabilities(file, text, bindings, features);
|
|
73
74
|
addFeaturesForUrlSchemes(text, features);
|
|
74
75
|
if (analyzeWorkerModules(file, text).realms)
|
|
75
76
|
features.add('worker-realms');
|
|
@@ -113,6 +114,7 @@ const importBindingNames = new Map([
|
|
|
113
114
|
// WiFi/network bring-up binding so the TCP/IP stack is initialized.
|
|
114
115
|
['http', 'wifi'],
|
|
115
116
|
['Accelerometer', 'imu'],
|
|
117
|
+
['Magnetometer', 'imu'],
|
|
116
118
|
['Audio', 'audio'],
|
|
117
119
|
['Display', 'display'],
|
|
118
120
|
['Memory', 'memory'],
|
|
@@ -124,6 +126,7 @@ const importBindingNames = new Map([
|
|
|
124
126
|
]);
|
|
125
127
|
const embeddedHostNamePrefixes = [
|
|
126
128
|
['__gea_Accelerometer', 'imu'],
|
|
129
|
+
['__gea_Magnetometer', 'imu'],
|
|
127
130
|
['__gea_audioContext', 'audio'],
|
|
128
131
|
['__gea_Audio', 'audio'],
|
|
129
132
|
['__gea_Display', 'display'],
|
|
@@ -184,6 +187,32 @@ function addBindingsForHostGlobals(text, bindings) {
|
|
|
184
187
|
bindings.add(binding);
|
|
185
188
|
}
|
|
186
189
|
}
|
|
190
|
+
function addMediaCapabilities(file, text, bindings, features) {
|
|
191
|
+
const source = ts.createSourceFile(file, text, ts.ScriptTarget.Latest, true);
|
|
192
|
+
const visit = (node) => {
|
|
193
|
+
if (ts.isCallExpression(node) && node.expression.getText(source) === 'navigator.mediaDevices.getUserMedia') {
|
|
194
|
+
const constraints = node.arguments[0];
|
|
195
|
+
for (const kind of ['audio', 'video']) {
|
|
196
|
+
const property = constraints && ts.isObjectLiteralExpression(constraints)
|
|
197
|
+
? constraints.properties.find(member => member.name && member.name.getText(source).replace(/['"]/g, '') === kind)
|
|
198
|
+
: undefined;
|
|
199
|
+
const requested = !constraints || !ts.isObjectLiteralExpression(constraints) ||
|
|
200
|
+
(property && (!ts.isPropertyAssignment(property) || property.initializer.kind !== ts.SyntaxKind.FalseKeyword));
|
|
201
|
+
if (requested) {
|
|
202
|
+
if (kind === 'video')
|
|
203
|
+
bindings.add('camera');
|
|
204
|
+
else
|
|
205
|
+
features.add('audio-capture');
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
if (ts.isNewExpression(node) && /^(?:(?:window|globalThis)\.)?(?:AudioContext|PcmAudioStream|Audio)$/.test(node.expression.getText(source))) {
|
|
210
|
+
features.add('audio-playback');
|
|
211
|
+
}
|
|
212
|
+
ts.forEachChild(node, visit);
|
|
213
|
+
};
|
|
214
|
+
visit(source);
|
|
215
|
+
}
|
|
187
216
|
// Only a quoted `https://` counts: a bare one is almost always a comment
|
|
188
217
|
// citing a source, and linking mbedtls for a comment would cost every app
|
|
189
218
|
// that documents itself ~100 KB of flash and the TLS heap at first use.
|
package/dist/cpp-ir.js
CHANGED
|
@@ -1915,9 +1915,7 @@ function canvasInteropSource(usesCanvas, directCanvas) {
|
|
|
1915
1915
|
" for (int i = 0;; i++) {",
|
|
1916
1916
|
" auto c = node.childAt(i);",
|
|
1917
1917
|
" if (!c.valid()) break;",
|
|
1918
|
-
"
|
|
1919
|
-
" const std::string __gea_child_tag = gea::embedded::ui::tagFromId(__gea_child_node.tag_id);",
|
|
1920
|
-
' if (__gea_child_node.type == gea::embedded::ui::NodeType::Text || __gea_child_tag == "#comment" || __gea_child_tag == "#fragment" || __gea_child_tag == "#document-frag" || __gea_child_tag == "#document-fragment") continue;',
|
|
1918
|
+
" if (static_cast<int>(c.nodeType) != 1) continue;",
|
|
1921
1919
|
" kids.push_back(nodeValue(c));",
|
|
1922
1920
|
" }",
|
|
1923
1921
|
" return gea_cpp_value(kids);",
|
|
@@ -1940,6 +1938,7 @@ function canvasInteropSource(usesCanvas, directCanvas) {
|
|
|
1940
1938
|
" },",
|
|
1941
1939
|
" [node](const std::string &key, gea_cpp_value assigned_value) {",
|
|
1942
1940
|
" const std::string value = nodeStringArg(assigned_value);",
|
|
1941
|
+
' if (key == "disabled") { node.setDisabled(gea::runtime::coerce::to_boolean(gea_cpp_key(assigned_value))); return; }',
|
|
1943
1942
|
' if (key == "className") {',
|
|
1944
1943
|
" node.classList().set(value);",
|
|
1945
1944
|
" return;",
|
|
@@ -1966,13 +1965,7 @@ function canvasInteropSource(usesCanvas, directCanvas) {
|
|
|
1966
1965
|
"// node representations resolve these properties identically.",
|
|
1967
1966
|
"inline double domNodeType(gea::embedded::ui::NodeHandle node) {",
|
|
1968
1967
|
" if (!node) return 0.0;",
|
|
1969
|
-
"
|
|
1970
|
-
" const auto &__gea_n = __gea_tree.node(node.id());",
|
|
1971
|
-
' if (std::string(gea::embedded::ui::tagFromId(__gea_n.tag_id)) == "#comment") return 8.0;',
|
|
1972
|
-
" if (__gea_n.type == gea::embedded::ui::NodeType::Text) return 3.0;",
|
|
1973
|
-
" const std::string __gea_tag = gea::embedded::ui::tagFromId(__gea_n.tag_id);",
|
|
1974
|
-
' if (__gea_tag == "#fragment" || __gea_tag == "#document-frag" || __gea_tag == "#document-fragment") return 11.0;',
|
|
1975
|
-
" return 1.0;",
|
|
1968
|
+
" return static_cast<double>(static_cast<int>(node.nodeType));",
|
|
1976
1969
|
"}",
|
|
1977
1970
|
"",
|
|
1978
1971
|
"inline gea_cpp_value domParentNode(gea::embedded::ui::NodeHandle node) {",
|
|
@@ -2044,13 +2037,13 @@ function canvasInteropSource(usesCanvas, directCanvas) {
|
|
|
2044
2037
|
" return gea_cpp_key(gea::runtime::host::document());",
|
|
2045
2038
|
"}",
|
|
2046
2039
|
"",
|
|
2047
|
-
"inline
|
|
2048
|
-
"
|
|
2049
|
-
" return child.valid() ? nodeValue(child) : gea_cpp_value::null_v();",
|
|
2040
|
+
"inline gea::embedded::ui::NodeHandle domFirstChild(gea::embedded::ui::NodeHandle node) {",
|
|
2041
|
+
" return node.firstChildHandle();",
|
|
2050
2042
|
"}",
|
|
2051
2043
|
"",
|
|
2052
2044
|
"inline gea_cpp_value domFirstChild(const gea_cpp_value &node) {",
|
|
2053
|
-
"
|
|
2045
|
+
" const auto child = domFirstChild(gea::embedded::ui::NodeHandle(nodeIdFromValue(node)));",
|
|
2046
|
+
" return child.valid() ? nodeValue(child) : gea_cpp_value::null_v();",
|
|
2054
2047
|
"}",
|
|
2055
2048
|
"",
|
|
2056
2049
|
"// `node.nextSibling`: typed NodeHandle (not boxed) so the compiled-component",
|
|
@@ -62,6 +62,9 @@ const geaGeolocationHostMethods = [
|
|
|
62
62
|
];
|
|
63
63
|
const geaInputHostMethods = ['consumeBackButton'];
|
|
64
64
|
const geaGpioHostMethods = ['configureOutput', 'configureInput', 'write', 'read'];
|
|
65
|
+
const geaMagnetometerHostMethods = ['open', 'close', 'count', 'read'];
|
|
66
|
+
const geaEspNowHostMethods = ['open', 'isOpen', 'canSend', 'setMaxTxPower', 'getMaxTxPower', 'close', 'addPeer', 'send', 'receive'];
|
|
67
|
+
const geaUartHostMethods = ['open', 'isOpen', 'close', 'read', 'write', 'available', 'writable'];
|
|
65
68
|
const geaLedHostMethods = ['set', 'off', 'attach', 'setPixel', 'show', 'detach'];
|
|
66
69
|
const geaClockHostMethods = ['epochMs', 'setEpochMs'];
|
|
67
70
|
const geaProfilerHostMethods = ['nowUs', 'nowCycles'];
|
|
@@ -131,6 +134,10 @@ const rawGeaHostExternDeclarations = Object.fromEntries([
|
|
|
131
134
|
['gea::host::Storage', geaHostDeclarations],
|
|
132
135
|
['gea::host::window.innerWidth', geaHostDeclarations],
|
|
133
136
|
['gea::host::window.innerHeight', geaHostDeclarations],
|
|
137
|
+
['gea::host::window.addEventListener', geaHostDeclarations],
|
|
138
|
+
['gea::host::window.removeEventListener', geaHostDeclarations],
|
|
139
|
+
['gea::embedded::ui::Document::instance().addEventListener({args})', geaHostDeclarations],
|
|
140
|
+
['gea::embedded::ui::Document::instance().removeEventListener({args})', geaHostDeclarations],
|
|
134
141
|
['gea::host::navigator.userAgent', geaHostDeclarations],
|
|
135
142
|
['gea::host::navigator.language', geaHostDeclarations],
|
|
136
143
|
['gea::host::navigator.platform', geaHostDeclarations],
|
|
@@ -140,6 +147,9 @@ const rawGeaHostExternDeclarations = Object.fromEntries([
|
|
|
140
147
|
...geaMemoryHostMethods.map((method) => [`gea::host::Memory.${method}`, geaHostDeclarations]),
|
|
141
148
|
...geaInputHostMethods.map((method) => [`gea::host::Input.${method}`, geaHostDeclarations]),
|
|
142
149
|
...geaGpioHostMethods.map((method) => [`gea::host::Gpio.${method}`, geaHostDeclarations]),
|
|
150
|
+
...geaMagnetometerHostMethods.map((method) => [`gea::host::Magnetometer.${method}`, geaHostDeclarations]),
|
|
151
|
+
...geaEspNowHostMethods.map((method) => [`gea::host::EspNow.${method}`, geaHostDeclarations]),
|
|
152
|
+
...geaUartHostMethods.map((method) => [`gea::host::Uart.${method}`, geaHostDeclarations]),
|
|
143
153
|
...geaLedHostMethods.map((method) => [`gea::host::Led.${method}`, geaHostDeclarations]),
|
|
144
154
|
...geaClockHostMethods.map((method) => [`gea::host::Clock.${method}`, geaHostDeclarations]),
|
|
145
155
|
...geaProfilerHostMethods.map((method) => [`gea::host::Profiler.${method}`, geaHostDeclarations]),
|
package/dist/host-shims.js
CHANGED
|
@@ -24,6 +24,8 @@ const NODE_HANDLE_RECEIVER_TYPES = [
|
|
|
24
24
|
"GeaCanvasElement",
|
|
25
25
|
"GeaCameraElement",
|
|
26
26
|
"VirtualListElement",
|
|
27
|
+
"ButtonElement",
|
|
28
|
+
"InputElement",
|
|
27
29
|
];
|
|
28
30
|
// Receiver type names for the event a listener is handed. One native struct
|
|
29
31
|
// backs every gea event (`gea::framework::events::PointerEvent`), so the
|
|
@@ -271,6 +273,12 @@ export function createGeaHostShims() {
|
|
|
271
273
|
// gea runtime is written against all lower to that one concrete handle, so
|
|
272
274
|
// component templates flow as `NodeHandle` end-to-end with no `gea_cpp_value`
|
|
273
275
|
// record bridge.
|
|
276
|
+
nativeReferenceIdentities: [
|
|
277
|
+
"gea::embedded::ui::NodeHandle",
|
|
278
|
+
"gea::embedded::ui::ChildNodeList",
|
|
279
|
+
"gea::framework::events::EventTarget",
|
|
280
|
+
"gea::framework::events::PointerEvent",
|
|
281
|
+
],
|
|
274
282
|
nativeTypes: {
|
|
275
283
|
// The ambient DOM global `document` (lib.dom.d.ts's `Document`) — a
|
|
276
284
|
// singleton, not a tree node, so it gets its own storage rather than
|
|
@@ -289,6 +297,7 @@ export function createGeaHostShims() {
|
|
|
289
297
|
// property-access callee resolve SOME carrier.
|
|
290
298
|
Document: "gea::embedded::ui::Document",
|
|
291
299
|
Node: "gea::embedded::ui::NodeHandle",
|
|
300
|
+
NodeList: "gea::embedded::ui::ChildNodeList",
|
|
292
301
|
ChildNode: "gea::embedded::ui::NodeHandle",
|
|
293
302
|
ParentNode: "gea::embedded::ui::NodeHandle",
|
|
294
303
|
Element: "gea::embedded::ui::NodeHandle",
|
|
@@ -349,6 +358,7 @@ export function createGeaHostShims() {
|
|
|
349
358
|
// attribute). v1 emitted exactly this:
|
|
350
359
|
// `event.currentTarget.getAttribute("value")`.
|
|
351
360
|
InputEventTarget: "gea::framework::events::EventTarget",
|
|
361
|
+
GeaWindow: "gea::host::WindowFacade",
|
|
352
362
|
PressEventTarget: "gea::framework::events::EventTarget",
|
|
353
363
|
// gea-embedded's own element interfaces (index.d.ts) — without these a
|
|
354
364
|
// `Component<GeaCanvasElement>`'s `this.el` lowers to a record-alias struct
|
|
@@ -364,6 +374,8 @@ export function createGeaHostShims() {
|
|
|
364
374
|
// `VirtualListElement | null` field is not a node at all, and its
|
|
365
375
|
// `rowHeight`/`scrollTop` reads fall to the dynamic path.
|
|
366
376
|
VirtualListElement: "gea::embedded::ui::NodeHandle",
|
|
377
|
+
ButtonElement: "gea::embedded::ui::NodeHandle",
|
|
378
|
+
InputElement: "gea::embedded::ui::NodeHandle",
|
|
367
379
|
// The result of `fetch(...)` flows as the concrete C++ struct (which carries
|
|
368
380
|
// `ok`/`status`/`body` data members plus `text()`/`bytes()`/`arrayBuffer()`
|
|
369
381
|
// methods), not a `gea_cpp_value` record — so `await fetch(url).arrayBuffer()`
|
|
@@ -515,10 +527,7 @@ export function createGeaHostShims() {
|
|
|
515
527
|
},
|
|
516
528
|
hostNamespaces: {
|
|
517
529
|
navigator: "gea::host::navigator",
|
|
518
|
-
//
|
|
519
|
-
// (packages/host/include/host/window.h) whose `innerWidth`/`innerHeight`
|
|
520
|
-
// are METHODS, which is why they are listed as accessors below --
|
|
521
|
-
// `navigator`'s siblings are plain fields and are not.
|
|
530
|
+
// Fixed singleton member paths are native host calls, alongside its value carrier.
|
|
522
531
|
window: "gea::host::window",
|
|
523
532
|
image: "image",
|
|
524
533
|
// Async tile/image loader (second-core worker: SD read -> HTTP fetch ->
|
|
@@ -561,6 +570,9 @@ export function createGeaHostShims() {
|
|
|
561
570
|
__gea_Memory: "gea::host::Memory",
|
|
562
571
|
__gea_Input: "gea::host::Input",
|
|
563
572
|
__gea_Gpio: "gea::host::Gpio",
|
|
573
|
+
__gea_EspNow: "gea::host::EspNow",
|
|
574
|
+
__gea_Magnetometer: "gea::host::Magnetometer",
|
|
575
|
+
__gea_Uart: "gea::host::Uart",
|
|
564
576
|
__gea_Led: "gea::host::Led",
|
|
565
577
|
__gea_Clock: "gea::host::Clock",
|
|
566
578
|
__gea_Haptics: "gea::host::Haptics",
|
|
@@ -583,6 +595,10 @@ export function createGeaHostShims() {
|
|
|
583
595
|
Display: { moduleSpecifier: "/", exportName: "Display" },
|
|
584
596
|
},
|
|
585
597
|
hostNamespaceMethods: {
|
|
598
|
+
window: {
|
|
599
|
+
addEventListener: "gea::host::window.addEventListener",
|
|
600
|
+
removeEventListener: "gea::host::window.removeEventListener",
|
|
601
|
+
},
|
|
586
602
|
// Free functions in `gea::host::console` (geatsc's `gea_runtime.h`
|
|
587
603
|
// declares them unconditionally, outside any `GEA_HOST_DECLARED` guard,
|
|
588
604
|
// so they are reachable from a gea build too). `warn`/`info`/`debug` are
|
|
@@ -1303,6 +1319,32 @@ export function createGeaHostShims() {
|
|
|
1303
1319
|
write: "gea::host::Gpio.write",
|
|
1304
1320
|
read: "gea::host::Gpio.read",
|
|
1305
1321
|
},
|
|
1322
|
+
__gea_Magnetometer: {
|
|
1323
|
+
open: "gea::host::Magnetometer.open",
|
|
1324
|
+
close: "gea::host::Magnetometer.close",
|
|
1325
|
+
count: "gea::host::Magnetometer.count",
|
|
1326
|
+
read: "gea::host::Magnetometer.read",
|
|
1327
|
+
},
|
|
1328
|
+
__gea_EspNow: {
|
|
1329
|
+
open: "gea::host::EspNow.open",
|
|
1330
|
+
isOpen: "gea::host::EspNow.isOpen",
|
|
1331
|
+
canSend: "gea::host::EspNow.canSend",
|
|
1332
|
+
setMaxTxPower: "gea::host::EspNow.setMaxTxPower",
|
|
1333
|
+
getMaxTxPower: "gea::host::EspNow.getMaxTxPower",
|
|
1334
|
+
close: "gea::host::EspNow.close",
|
|
1335
|
+
addPeer: "gea::host::EspNow.addPeer",
|
|
1336
|
+
send: "gea::host::EspNow.send",
|
|
1337
|
+
receive: "gea::host::EspNow.receive",
|
|
1338
|
+
},
|
|
1339
|
+
__gea_Uart: {
|
|
1340
|
+
open: "gea::host::Uart.open",
|
|
1341
|
+
isOpen: "gea::host::Uart.isOpen",
|
|
1342
|
+
close: "gea::host::Uart.close",
|
|
1343
|
+
read: "gea::host::Uart.read",
|
|
1344
|
+
write: "gea::host::Uart.write",
|
|
1345
|
+
available: "gea::host::Uart.available",
|
|
1346
|
+
writable: "gea::host::Uart.writable",
|
|
1347
|
+
},
|
|
1306
1348
|
Led: {
|
|
1307
1349
|
set: "gea::host::Led.set",
|
|
1308
1350
|
off: "gea::host::Led.off",
|
|
@@ -1383,6 +1425,9 @@ export function createGeaHostShims() {
|
|
|
1383
1425
|
__gea_Input: ["consumeBackButton"],
|
|
1384
1426
|
Gpio: ["configureOutput", "configureInput", "write", "read"],
|
|
1385
1427
|
__gea_Gpio: ["configureOutput", "configureInput", "write", "read"],
|
|
1428
|
+
__gea_EspNow: ["open", "isOpen", "canSend", "setMaxTxPower", "getMaxTxPower", "close"],
|
|
1429
|
+
__gea_Magnetometer: ["open", "close", "count"],
|
|
1430
|
+
__gea_Uart: ["open", "isOpen", "close", "available", "writable"],
|
|
1386
1431
|
Led: ["set", "off", "attach", "setPixel", "show", "detach"],
|
|
1387
1432
|
__gea_Led: ["set", "off", "attach", "setPixel", "show", "detach"],
|
|
1388
1433
|
Clock: ["epochMs"],
|
|
@@ -1615,15 +1660,10 @@ export function createGeaHostShims() {
|
|
|
1615
1660
|
emit: "gea::embedded::ui::Document::instance().createDocumentFragment()",
|
|
1616
1661
|
returnType: "gea::embedded::ui::NodeHandle",
|
|
1617
1662
|
},
|
|
1618
|
-
//
|
|
1619
|
-
//
|
|
1620
|
-
// parked in the tree so a later `insertBefore` has a stable anchor
|
|
1621
|
-
// (`conditional-truthy.ts`'s `sentinel`, the keyed-list row anchors). An
|
|
1622
|
-
// empty text node is exactly that on this target: it occupies a position,
|
|
1623
|
-
// renders nothing, and is a real `NodeHandle`. Without a binding here the
|
|
1624
|
-
// call had no plan at all and took its whole function out of the program.
|
|
1663
|
+
// Structural comments retain their data and insertion identity without
|
|
1664
|
+
// becoming text, layout boxes, paint commands or pointer targets.
|
|
1625
1665
|
createComment: {
|
|
1626
|
-
emit: "gea::embedded::ui::Document::instance().
|
|
1666
|
+
emit: "gea::embedded::ui::Document::instance().createComment(({arg0}))",
|
|
1627
1667
|
returnType: "gea::embedded::ui::NodeHandle",
|
|
1628
1668
|
},
|
|
1629
1669
|
},
|
|
@@ -1644,6 +1684,11 @@ export function createGeaHostShims() {
|
|
|
1644
1684
|
// `document.body.appendChild(node)` refused at emission ("Document.body
|
|
1645
1685
|
// is claimed by no host member table"), which is the fail-closed guard
|
|
1646
1686
|
// correctly naming the missing statement.
|
|
1687
|
+
activeElement: [{
|
|
1688
|
+
emit: "gea::embedded::ui::Document::instance().activeElement()",
|
|
1689
|
+
returnType: "gea::embedded::ui::NodeHandle",
|
|
1690
|
+
receiverTypes: ["gea::embedded::ui::Document", "Document"],
|
|
1691
|
+
}],
|
|
1647
1692
|
body: [
|
|
1648
1693
|
{
|
|
1649
1694
|
emit: "gea::embedded::ui::Document::instance().body()",
|
|
@@ -1672,6 +1717,8 @@ export function createGeaHostShims() {
|
|
|
1672
1717
|
receiverTypes: EVENT_RECEIVER_TYPES,
|
|
1673
1718
|
},
|
|
1674
1719
|
],
|
|
1720
|
+
button: [{ emit: "static_cast<double>(({receiver}).button)", returnType: "double", receiverTypes: EVENT_RECEIVER_TYPES }],
|
|
1721
|
+
buttons: [{ emit: "static_cast<double>(({receiver}).buttons)", returnType: "double", receiverTypes: EVENT_RECEIVER_TYPES }],
|
|
1675
1722
|
pointerId: [
|
|
1676
1723
|
{
|
|
1677
1724
|
emit: "static_cast<double>(({receiver}).pointerId)",
|
|
@@ -1710,6 +1757,71 @@ export function createGeaHostShims() {
|
|
|
1710
1757
|
receiverTypes: EVENT_RECEIVER_TYPES,
|
|
1711
1758
|
},
|
|
1712
1759
|
],
|
|
1760
|
+
defaultPrevented: [
|
|
1761
|
+
{
|
|
1762
|
+
emit: "static_cast<bool>(({receiver}).defaultPrevented)",
|
|
1763
|
+
returnType: "bool",
|
|
1764
|
+
receiverTypes: EVENT_RECEIVER_TYPES,
|
|
1765
|
+
},
|
|
1766
|
+
],
|
|
1767
|
+
// Typed native keyboard carrier fields, populated by the host. No
|
|
1768
|
+
// reconstructed browser records or permissive synthetic defaults.
|
|
1769
|
+
key: [
|
|
1770
|
+
{
|
|
1771
|
+
emit: "(({receiver}).key)",
|
|
1772
|
+
returnType: "std::string",
|
|
1773
|
+
receiverTypes: EVENT_RECEIVER_TYPES,
|
|
1774
|
+
},
|
|
1775
|
+
],
|
|
1776
|
+
code: [
|
|
1777
|
+
{
|
|
1778
|
+
emit: "(({receiver}).code)",
|
|
1779
|
+
returnType: "std::string",
|
|
1780
|
+
receiverTypes: EVENT_RECEIVER_TYPES,
|
|
1781
|
+
},
|
|
1782
|
+
],
|
|
1783
|
+
altKey: [
|
|
1784
|
+
{
|
|
1785
|
+
emit: "(({receiver}).altKey)",
|
|
1786
|
+
returnType: "bool",
|
|
1787
|
+
receiverTypes: EVENT_RECEIVER_TYPES,
|
|
1788
|
+
},
|
|
1789
|
+
],
|
|
1790
|
+
ctrlKey: [
|
|
1791
|
+
{
|
|
1792
|
+
emit: "(({receiver}).ctrlKey)",
|
|
1793
|
+
returnType: "bool",
|
|
1794
|
+
receiverTypes: EVENT_RECEIVER_TYPES,
|
|
1795
|
+
},
|
|
1796
|
+
],
|
|
1797
|
+
metaKey: [
|
|
1798
|
+
{
|
|
1799
|
+
emit: "(({receiver}).metaKey)",
|
|
1800
|
+
returnType: "bool",
|
|
1801
|
+
receiverTypes: EVENT_RECEIVER_TYPES,
|
|
1802
|
+
},
|
|
1803
|
+
],
|
|
1804
|
+
shiftKey: [
|
|
1805
|
+
{
|
|
1806
|
+
emit: "(({receiver}).shiftKey)",
|
|
1807
|
+
returnType: "bool",
|
|
1808
|
+
receiverTypes: EVENT_RECEIVER_TYPES,
|
|
1809
|
+
},
|
|
1810
|
+
],
|
|
1811
|
+
repeat: [
|
|
1812
|
+
{
|
|
1813
|
+
emit: "(({receiver}).repeat)",
|
|
1814
|
+
returnType: "bool",
|
|
1815
|
+
receiverTypes: EVENT_RECEIVER_TYPES,
|
|
1816
|
+
},
|
|
1817
|
+
],
|
|
1818
|
+
isComposing: [
|
|
1819
|
+
{
|
|
1820
|
+
emit: "(({receiver}).isComposing)",
|
|
1821
|
+
returnType: "bool",
|
|
1822
|
+
receiverTypes: EVENT_RECEIVER_TYPES,
|
|
1823
|
+
},
|
|
1824
|
+
],
|
|
1713
1825
|
// The node an event names. Both are real members of the engine's event
|
|
1714
1826
|
// struct, so the getter is the member read itself -- but it must be
|
|
1715
1827
|
// STATED, because without a row here the emitter has no spelling for
|
|
@@ -1939,17 +2051,37 @@ export function createGeaHostShims() {
|
|
|
1939
2051
|
receiverTypes: NODE_HANDLE_RECEIVER_TYPES,
|
|
1940
2052
|
},
|
|
1941
2053
|
],
|
|
2054
|
+
disabled: [{ emit: "gea::embedded::ui::NodeHandle({receiver}).disabled()", returnType: "bool", receiverTypes: [...NODE_HANDLE_RECEIVER_TYPES, ...EVENT_TARGET_RECEIVER_TYPES] }],
|
|
2055
|
+
isConnected: [
|
|
2056
|
+
{
|
|
2057
|
+
emit: "gea::embedded::ui::NodeHandle({receiver}).isConnected()",
|
|
2058
|
+
returnType: "bool",
|
|
2059
|
+
receiverTypes: EVENT_TARGET_RECEIVER_TYPES,
|
|
2060
|
+
},
|
|
2061
|
+
{
|
|
2062
|
+
emit: "({receiver}).isConnected()",
|
|
2063
|
+
returnType: "bool",
|
|
2064
|
+
receiverTypes: NODE_HANDLE_RECEIVER_TYPES,
|
|
2065
|
+
},
|
|
2066
|
+
],
|
|
1942
2067
|
nodeType: [
|
|
1943
2068
|
{
|
|
1944
|
-
emit: "
|
|
2069
|
+
emit: "static_cast<double>(static_cast<int>(({receiver}).nodeType))",
|
|
1945
2070
|
returnType: "double",
|
|
1946
2071
|
receiverTypes: NODE_HANDLE_RECEIVER_TYPES,
|
|
1947
2072
|
},
|
|
1948
2073
|
],
|
|
1949
2074
|
parentNode: [
|
|
1950
2075
|
{
|
|
1951
|
-
emit: "
|
|
1952
|
-
returnType: "
|
|
2076
|
+
emit: "({receiver}).parentHandle()",
|
|
2077
|
+
returnType: "gea::embedded::ui::NodeHandle",
|
|
2078
|
+
receiverTypes: NODE_HANDLE_RECEIVER_TYPES,
|
|
2079
|
+
},
|
|
2080
|
+
],
|
|
2081
|
+
lastElementChild: [
|
|
2082
|
+
{
|
|
2083
|
+
emit: "({receiver}).lastElementChildHandle()",
|
|
2084
|
+
returnType: "gea::embedded::ui::NodeHandle",
|
|
1953
2085
|
receiverTypes: NODE_HANDLE_RECEIVER_TYPES,
|
|
1954
2086
|
},
|
|
1955
2087
|
],
|
|
@@ -1981,8 +2113,8 @@ export function createGeaHostShims() {
|
|
|
1981
2113
|
],
|
|
1982
2114
|
firstChild: [
|
|
1983
2115
|
{
|
|
1984
|
-
emit: "
|
|
1985
|
-
returnType: "
|
|
2116
|
+
emit: "({receiver}).firstChildHandle()",
|
|
2117
|
+
returnType: "gea::embedded::ui::NodeHandle",
|
|
1986
2118
|
receiverTypes: NODE_HANDLE_RECEIVER_TYPES,
|
|
1987
2119
|
},
|
|
1988
2120
|
],
|
|
@@ -1999,14 +2131,14 @@ export function createGeaHostShims() {
|
|
|
1999
2131
|
],
|
|
2000
2132
|
childNodes: [
|
|
2001
2133
|
{
|
|
2002
|
-
emit: "
|
|
2003
|
-
returnType: "
|
|
2134
|
+
emit: "({receiver}).childNodesHandle()",
|
|
2135
|
+
returnType: "gea::embedded::ui::ChildNodeList",
|
|
2004
2136
|
receiverTypes: NODE_HANDLE_RECEIVER_TYPES,
|
|
2005
2137
|
},
|
|
2006
2138
|
],
|
|
2007
2139
|
children: [
|
|
2008
2140
|
{
|
|
2009
|
-
emit: "
|
|
2141
|
+
emit: "({receiver}).elementChildren()",
|
|
2010
2142
|
returnType: "std::vector<gea::embedded::ui::NodeHandle>",
|
|
2011
2143
|
receiverTypes: NODE_HANDLE_RECEIVER_TYPES,
|
|
2012
2144
|
},
|
|
@@ -2177,6 +2309,7 @@ export function createGeaHostShims() {
|
|
|
2177
2309
|
},
|
|
2178
2310
|
],
|
|
2179
2311
|
length: [
|
|
2312
|
+
{ emit: "static_cast<double>(({receiver}).length())", returnType: "double", receiverTypes: ["gea::embedded::ui::ChildNodeList", "NodeList"] },
|
|
2180
2313
|
{
|
|
2181
2314
|
emit: "({receiver}).getLength()",
|
|
2182
2315
|
returnType: "double",
|
|
@@ -2278,6 +2411,7 @@ export function createGeaHostShims() {
|
|
|
2278
2411
|
// The write half of the two scroll offsets above. `setScrollTop` narrows
|
|
2279
2412
|
// to the engine's `int`, exactly as the dynamic path already does before
|
|
2280
2413
|
// calling the same setter.
|
|
2414
|
+
disabled: [{ emit: "gea::embedded::ui::NodeHandle({receiver}).setDisabled({value})", returnType: "void", receiverTypes: [...NODE_HANDLE_RECEIVER_TYPES, ...EVENT_TARGET_RECEIVER_TYPES] }],
|
|
2281
2415
|
scrollTop: [
|
|
2282
2416
|
{
|
|
2283
2417
|
emit: "gea::embedded::ui::Tree::instance().setScrollTop(({receiver}).id(), static_cast<int>({value}))",
|
|
@@ -2352,6 +2486,13 @@ export function createGeaHostShims() {
|
|
|
2352
2486
|
emit: "({receiver}).value = {value}",
|
|
2353
2487
|
receiverTypes: ["gea::host::AudioParam", "AudioParam"],
|
|
2354
2488
|
},
|
|
2489
|
+
// ButtonElement.value reflects the actual node attribute; it is not
|
|
2490
|
+
// a label mutation or an event. NodeHandle guards allocation lifetime.
|
|
2491
|
+
{
|
|
2492
|
+
emit: 'gea::embedded::ui::NodeHandle({receiver}).setAttribute(std::string("value"), {value})',
|
|
2493
|
+
receiverTypes: NODE_HANDLE_RECEIVER_TYPES,
|
|
2494
|
+
returnType: "void",
|
|
2495
|
+
},
|
|
2355
2496
|
],
|
|
2356
2497
|
// The recorder's two callbacks. `MediaRecorder.ondataavailable` and
|
|
2357
2498
|
// `.onstop` are DECLARED settable (`core/index.d.ts`: `ondataavailable:
|
|
@@ -2539,6 +2680,8 @@ export function createGeaHostShims() {
|
|
|
2539
2680
|
// setTimeout"). Naming the spelling makes the call
|
|
2540
2681
|
// `gea::host::setTimeout(cb, ms)`, which is the function the engine
|
|
2541
2682
|
// actually exports.
|
|
2683
|
+
// Promise jobs and author microtasks share one FIFO, not a zero-delay timer.
|
|
2684
|
+
queueMicrotask: "gea::detail::queuePromiseJob",
|
|
2542
2685
|
setTimeout: "gea::host::setTimeout",
|
|
2543
2686
|
clearTimeout: "gea::host::clearTimeout",
|
|
2544
2687
|
setInterval: "gea::host::setInterval",
|
|
@@ -2807,6 +2950,11 @@ export function createGeaHostShims() {
|
|
|
2807
2950
|
// returnType-only bindings (no `emit`) keep the normal direct method-call
|
|
2808
2951
|
// emit; receiverTypes bound the match to FetchResponse.
|
|
2809
2952
|
nativeMemberMethods: {
|
|
2953
|
+
item: [{ emit: "({receiver}).item({arg0})", returnType: "gea::embedded::ui::NodeHandle", receiverTypes: ["gea::embedded::ui::ChildNodeList", "NodeList"] }],
|
|
2954
|
+
matches: [{ receiverTypes: [...NODE_HANDLE_RECEIVER_TYPES, ...EVENT_TARGET_RECEIVER_TYPES], emit: "gea::embedded::ui::NodeHandle({receiver}).matches({arg0})", returnType: "bool" }],
|
|
2955
|
+
closest: [{ receiverTypes: [...NODE_HANDLE_RECEIVER_TYPES, ...EVENT_TARGET_RECEIVER_TYPES], emit: "gea::embedded::ui::NodeHandle({receiver}).closest({arg0})", returnType: "gea::embedded::ui::NodeHandle" }],
|
|
2956
|
+
querySelector: [{ receiverTypes: [...NODE_HANDLE_RECEIVER_TYPES, ...EVENT_TARGET_RECEIVER_TYPES], emit: "gea::embedded::ui::NodeHandle({receiver}).querySelector({arg0})", returnType: "gea::embedded::ui::NodeHandle" }],
|
|
2957
|
+
querySelectorAll: [{ receiverTypes: [...NODE_HANDLE_RECEIVER_TYPES, ...EVENT_TARGET_RECEIVER_TYPES], emit: "gea::embedded::ui::NodeHandle({receiver}).querySelectorAll({arg0})", returnType: "std::vector<gea::embedded::ui::NodeHandle>" }],
|
|
2810
2958
|
// `Event.preventDefault()` / `.stopPropagation()` (index.d.ts:269-270),
|
|
2811
2959
|
// which every event interface inherits. Both are real methods on the
|
|
2812
2960
|
// engine's own event struct -- `PointerEvent::preventDefault` /
|
|
@@ -2865,31 +3013,7 @@ export function createGeaHostShims() {
|
|
|
2865
3013
|
// `document` identifier. The receiver carrier and operation role are
|
|
2866
3014
|
// authenticated by host-runtime-v1 before this physical symbol is used.
|
|
2867
3015
|
addEventListener: [
|
|
2868
|
-
{
|
|
2869
|
-
receiverTypes: ["gea::embedded::ui::Document"],
|
|
2870
|
-
emit: "gea::runtime::host::geaDocumentAddEventListener({receiver}, {arg0}, {arg1})",
|
|
2871
|
-
returnType: "gea_cpp_value",
|
|
2872
|
-
dynamicRecordSchemas: [
|
|
2873
|
-
{
|
|
2874
|
-
protocolId: "gea.pointer-event-record-v1",
|
|
2875
|
-
fields: [{ key: "target", value: "checker-carrier" }],
|
|
2876
|
-
},
|
|
2877
|
-
],
|
|
2878
|
-
argumentRoles: [
|
|
2879
|
-
"dynamic-value",
|
|
2880
|
-
{
|
|
2881
|
-
kind: "callback",
|
|
2882
|
-
parameters: [
|
|
2883
|
-
{
|
|
2884
|
-
kind: "dynamic-record",
|
|
2885
|
-
protocolId: "gea.pointer-event-record-v1",
|
|
2886
|
-
},
|
|
2887
|
-
],
|
|
2888
|
-
result: "void",
|
|
2889
|
-
lifetime: "retained",
|
|
2890
|
-
},
|
|
2891
|
-
],
|
|
2892
|
-
},
|
|
3016
|
+
{ receiverTypes: ["gea::embedded::ui::Document"], emit: "gea::embedded::ui::Document::instance().addEventListener({args})", returnType: "void" },
|
|
2893
3017
|
// The same member on a NODE, which is a different receiver carrier and
|
|
2894
3018
|
// therefore a different physical symbol -- `el.addEventListener('touchstart',
|
|
2895
3019
|
// handler)` written imperatively on a `Component<GeaCanvasElement>`'s `this.el`,
|
|
@@ -2922,38 +3046,32 @@ export function createGeaHostShims() {
|
|
|
2922
3046
|
returnType: "void",
|
|
2923
3047
|
},
|
|
2924
3048
|
],
|
|
3049
|
+
// Options are ordinary configuration properties; callback and event carriers stay typed.
|
|
3050
|
+
removeEventListener: [
|
|
3051
|
+
{ receiverTypes: ["gea::embedded::ui::Document"], emit: "gea::embedded::ui::Document::instance().removeEventListener({args})", returnType: "void" },
|
|
3052
|
+
],
|
|
2925
3053
|
appendChild: [
|
|
2926
3054
|
{
|
|
2927
3055
|
receiverTypes: NODE_HANDLE_RECEIVER_TYPES,
|
|
2928
3056
|
emit: "gea_ir::domAppendChild({receiver}, {arg0})",
|
|
2929
3057
|
},
|
|
2930
3058
|
],
|
|
2931
|
-
//
|
|
2932
|
-
//
|
|
2933
|
-
// (`compiler/packages/geatsc/src/targets/cpp/runtime/host_document_gea.cpp`,
|
|
2934
|
-
// namespace `gea::runtime::host`, fully typed `NodeHandle` params, `void`
|
|
2935
|
-
// result — a perfect fit for a receiver-carrying flat symbol call). This
|
|
2936
|
-
// is geatsc's OWN runtime, not a `gea_ir`-generated overload: there is no
|
|
2937
|
-
// `gea_ir::domInsertBefore` (the doc comment at `cpp-ir.ts:1826-1827`
|
|
2938
|
-
// documents only `domNextSibling`'s role in feeding `container.
|
|
2939
|
-
// insertBefore(ref, ...)`'s reference argument, not a codegen'd
|
|
2940
|
-
// `insertBefore` binding itself), so this entry is qualified with the
|
|
2941
|
-
// runtime's real namespace instead of the plugin-generated one.
|
|
3059
|
+
// The actual native facade preserves allocation identity, validates the
|
|
3060
|
+
// reference and returns the inserted node (including an emptied Fragment).
|
|
2942
3061
|
insertBefore: [
|
|
2943
3062
|
{
|
|
2944
3063
|
receiverTypes: NODE_HANDLE_RECEIVER_TYPES,
|
|
2945
|
-
emit: "
|
|
2946
|
-
returnType: "
|
|
3064
|
+
emit: "({receiver}).insertBefore({arg0}, {arg1})",
|
|
3065
|
+
returnType: "gea::embedded::ui::NodeHandle",
|
|
2947
3066
|
},
|
|
2948
3067
|
],
|
|
2949
|
-
//
|
|
2950
|
-
//
|
|
2951
|
-
// detaches the child; void, matching appendChild/insertBefore above.
|
|
3068
|
+
// The actual facade validates both allocation owners/direct parent,
|
|
3069
|
+
// detaches without retiring, and returns the same native child handle.
|
|
2952
3070
|
removeChild: [
|
|
2953
3071
|
{
|
|
2954
3072
|
receiverTypes: NODE_HANDLE_RECEIVER_TYPES,
|
|
2955
|
-
emit: "
|
|
2956
|
-
returnType: "
|
|
3073
|
+
emit: "({receiver}).removeChild({arg0})",
|
|
3074
|
+
returnType: "gea::embedded::ui::NodeHandle",
|
|
2957
3075
|
},
|
|
2958
3076
|
],
|
|
2959
3077
|
// `parent.replaceChild(replacement, child)`. Keep both operands on the
|
|
@@ -3040,7 +3158,7 @@ export function createGeaHostShims() {
|
|
|
3040
3158
|
focus: [
|
|
3041
3159
|
{
|
|
3042
3160
|
receiverTypes: NODE_HANDLE_RECEIVER_TYPES,
|
|
3043
|
-
emit: "({receiver}).focus()",
|
|
3161
|
+
emit: "({receiver}).focus({args})",
|
|
3044
3162
|
returnType: "void",
|
|
3045
3163
|
},
|
|
3046
3164
|
],
|
package/dist/types.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ export interface HostShimDefinitions {
|
|
|
19
19
|
declarationFileName: string;
|
|
20
20
|
}>;
|
|
21
21
|
nativeTypes?: Record<string, string>;
|
|
22
|
+
nativeReferenceIdentities?: string[];
|
|
22
23
|
/** Identity-preserving views: destination carrier -> source carrier -> {value} template. */
|
|
23
24
|
nativeViews?: Record<string, Record<string, string>>;
|
|
24
25
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geastack/geatsc-plugin-gea",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.24",
|
|
4
4
|
"description": "Gea IR backend plugin for geatsc.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -53,7 +53,8 @@
|
|
|
53
53
|
"typescript": "^5.9.3"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@types/node": "^22.15.3"
|
|
56
|
+
"@types/node": "^22.15.3",
|
|
57
|
+
"livekit-client": "2.22.3"
|
|
57
58
|
},
|
|
58
59
|
"peerDependencies": {
|
|
59
60
|
"@geastack/compiler": ">=1.0.22"
|