@aardarch/aardink-web 0.8.0 → 0.10.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/README.md +68 -2
- package/index.d.ts +445 -13
- package/index.js +171 -37
- package/kotlin/aardink-web.import-object.mjs +38 -2
- package/kotlin/aardink-web.mjs +7 -0
- package/kotlin/aardink-web.wasm +0 -0
- package/package.json +1 -1
- package/kotlin/js-reexport-symbols.mjs +0 -999
- package/kotlin/skikod8.mjs +0 -1118
package/index.js
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
// Adapts the Kotlin module's integer-handle exports (aardinkCreate, aardinkGetValue, ...) into
|
|
18
18
|
// the Monaco-shaped object described in index.d.ts.
|
|
19
19
|
|
|
20
|
-
export const version = '0.
|
|
20
|
+
export const version = '0.10.0';
|
|
21
21
|
|
|
22
22
|
/** Monaco's flags for a completion's `insertText`. */
|
|
23
23
|
export const CompletionItemInsertTextRule = Object.freeze({ None: 0, KeepWhitespace: 1, InsertAsSnippet: 4 });
|
|
@@ -139,9 +139,55 @@ function monarchToJson(value) {
|
|
|
139
139
|
return value;
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
+
/** A language configuration's RegExp literals, for JSON.stringify: VS Code's `{ pattern, flags }`. */
|
|
143
|
+
function regexAsPattern(key, value) {
|
|
144
|
+
return value instanceof RegExp ? { pattern: value.source, flags: value.flags } : value;
|
|
145
|
+
}
|
|
146
|
+
|
|
142
147
|
/** The decorations owner deltaDecorations sets; each collection has its own. */
|
|
143
148
|
const DELTA_OWNER = 'delta';
|
|
144
149
|
|
|
150
|
+
/**
|
|
151
|
+
* What the Kotlin side asks by name, and the host's function that answers it, read at each call. A
|
|
152
|
+
* new provider is one line here; a name not here has no provider, and gets null.
|
|
153
|
+
*/
|
|
154
|
+
const PROVIDERS = new Map([
|
|
155
|
+
['completions', (providers) => providers.provideCompletionItems],
|
|
156
|
+
['hover', (providers) => providers.provideHover],
|
|
157
|
+
['diagnostics', (providers) => providers.provideDiagnostics &&
|
|
158
|
+
((text) => Promise.resolve(providers.provideDiagnostics(text)).then((list) => (list == null ? null : list.map(toKotlinDiagnostic))))],
|
|
159
|
+
['documentSymbols', (providers) => providers.provideDocumentSymbols],
|
|
160
|
+
['documentColors', (providers) => providers.provideDocumentColors],
|
|
161
|
+
['inlayHints', (providers) => providers.provideInlayHints],
|
|
162
|
+
['codeLenses', (providers) => providers.provideCodeLenses],
|
|
163
|
+
// A click is about a command, so no text comes with it.
|
|
164
|
+
['runCodeLensCommand', (providers) => providers.runCodeLensCommand && ((_text, id, args) => providers.runCodeLensCommand(id, args))],
|
|
165
|
+
['formatOnType', (providers) => providers.provideOnTypeFormattingEdits],
|
|
166
|
+
['definition', (providers) => providers.provideDefinition],
|
|
167
|
+
['references', (providers) => providers.provideReferences],
|
|
168
|
+
['formatDocument', (providers) => providers.provideDocumentFormattingEdits],
|
|
169
|
+
['formatRange', (providers) => providers.provideDocumentRangeFormattingEdits],
|
|
170
|
+
['signatureHelp', (providers) => providers.provideSignatureHelp],
|
|
171
|
+
// Monaco's context: the markers as Monaco has them.
|
|
172
|
+
['codeActions', (providers) => providers.provideCodeActions &&
|
|
173
|
+
((text, range, markers) => providers.provideCodeActions(text, range, { markers: markers.map(fromKotlinDiagnostic) }))],
|
|
174
|
+
['rename', (providers) => providers.provideRenameEdits],
|
|
175
|
+
['resolveRename', (providers) => providers.resolveRenameLocation],
|
|
176
|
+
['foldingRanges', (providers) => providers.provideFoldingRanges],
|
|
177
|
+
// A Uint32Array's JSON is an object, so the numbers go as an array.
|
|
178
|
+
['semanticTokens', (providers) => providers.provideDocumentSemanticTokens &&
|
|
179
|
+
((text) => Promise.resolve(providers.provideDocumentSemanticTokens(text))
|
|
180
|
+
.then((tokens) => (tokens == null ? null : { ...tokens, data: Array.from(tokens.data ?? []) })))],
|
|
181
|
+
['resolveCompletionItem', (providers) => providers.resolveCompletionItem && ((_text, item) => providers.resolveCompletionItem(item))],
|
|
182
|
+
['resolveCodeLens', (providers) => providers.resolveCodeLens],
|
|
183
|
+
]);
|
|
184
|
+
|
|
185
|
+
/** Monaco's legend of a semantic tokens provider: `getLegend()`, or a `legend` given as data. */
|
|
186
|
+
function semanticLegend(providers) {
|
|
187
|
+
if (!providers.provideDocumentSemanticTokens) return undefined;
|
|
188
|
+
return typeof providers.getLegend === 'function' ? providers.getLegend() : providers.legend;
|
|
189
|
+
}
|
|
190
|
+
|
|
145
191
|
/** A provider's answer (a value or a Promise of one) as the Promise of JSON the Kotlin side awaits. */
|
|
146
192
|
function answer(provider, ...args) {
|
|
147
193
|
if (!provider) return Promise.resolve(null);
|
|
@@ -166,49 +212,50 @@ export async function registerLanguage(definition, providers = {}) {
|
|
|
166
212
|
extensions: definition.extensions,
|
|
167
213
|
inheritCompletions: definition.inheritCompletions,
|
|
168
214
|
schema: definition.schema,
|
|
215
|
+
configuration: JSON.parse(JSON.stringify(definition.configuration ?? null, regexAsPattern)),
|
|
169
216
|
// On the providers, as on Monaco's completion provider; the Kotlin side reads it with the definition.
|
|
170
217
|
triggerCharacters: providers.triggerCharacters,
|
|
218
|
+
autoFormatTriggerCharacters: providers.provideOnTypeFormattingEdits ? providers.autoFormatTriggerCharacters : undefined,
|
|
219
|
+
semanticTokensLegend: semanticLegend(providers),
|
|
220
|
+
// Which providers there are: whether there is one decides whether a rename is offered and whose folds show.
|
|
221
|
+
provided: [...PROVIDERS.keys()].filter((name) => PROVIDERS.get(name)(providers)),
|
|
171
222
|
grammar,
|
|
172
223
|
}),
|
|
173
|
-
(
|
|
174
|
-
(text, line, column) => answer(providers.provideHover, text, line, column),
|
|
175
|
-
(text) =>
|
|
176
|
-
answer(
|
|
177
|
-
providers.provideDiagnostics &&
|
|
178
|
-
((t) => Promise.resolve(providers.provideDiagnostics(t)).then((list) => (list == null ? null : list.map(toKotlinDiagnostic)))),
|
|
179
|
-
text,
|
|
180
|
-
),
|
|
181
|
-
(text) => answer(providers.provideDocumentSymbols, text),
|
|
182
|
-
(text) => answer(providers.provideDocumentColors, text),
|
|
224
|
+
(method, text, argsJson) => answer(PROVIDERS.get(method)?.(providers), text, ...JSON.parse(argsJson)),
|
|
183
225
|
);
|
|
184
226
|
if (error) throw new Error(`Aardink: ${error}`);
|
|
185
227
|
}
|
|
186
228
|
|
|
187
|
-
/**
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
229
|
+
/**
|
|
230
|
+
* Has the language server at a WebSocket URL follow every editor of a language. See index.d.ts: it
|
|
231
|
+
* resolves once asked, not once connected, and a server that cannot be reached costs no editor.
|
|
232
|
+
*/
|
|
233
|
+
export async function connectLanguageServer(url, languageId) {
|
|
234
|
+
const k = await load();
|
|
235
|
+
const id = k.aardinkConnectLanguageServer(String(url), languageId);
|
|
236
|
+
return { dispose: () => k.aardinkDisconnectLanguageServer(id) };
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Has `provider.provideInlineCompletions` offer ghost text in every editor of a language, as Monaco's
|
|
241
|
+
* registerInlineCompletionsProvider. See index.d.ts.
|
|
242
|
+
*/
|
|
243
|
+
export async function registerInlineCompletionsProvider(languageId, provider) {
|
|
244
|
+
const k = await load();
|
|
245
|
+
const id = k.aardinkRegisterInlineCompletionsProvider(
|
|
246
|
+
languageId,
|
|
247
|
+
(text, line, column) => answer((...args) => provider.provideInlineCompletions(...args), text, line, column),
|
|
248
|
+
);
|
|
249
|
+
return { dispose: () => k.aardinkDisposeInlineCompletionsProvider(id) };
|
|
206
250
|
}
|
|
207
251
|
|
|
208
|
-
/**
|
|
252
|
+
/**
|
|
253
|
+
* Adds a theme for createEditor's `theme` option, from Monaco's defineTheme data or VS Code theme
|
|
254
|
+
* JSON, each as it is: the Kotlin side tells them apart by Monaco's `rules`.
|
|
255
|
+
*/
|
|
209
256
|
export async function registerTheme(name, theme) {
|
|
210
257
|
const k = await load();
|
|
211
|
-
const error = k.aardinkRegisterTheme(name, JSON.stringify(
|
|
258
|
+
const error = k.aardinkRegisterTheme(name, JSON.stringify(theme));
|
|
212
259
|
if (error) throw new Error(`Aardink: ${error}`);
|
|
213
260
|
}
|
|
214
261
|
|
|
@@ -216,15 +263,63 @@ export async function registerTheme(name, theme) {
|
|
|
216
263
|
export const defineTheme = registerTheme;
|
|
217
264
|
|
|
218
265
|
/**
|
|
219
|
-
*
|
|
220
|
-
*
|
|
266
|
+
* Adds a font for the `fontFamily` option, from a URL (fetched) or a font file's bytes (an
|
|
267
|
+
* ArrayBuffer or a typed array). Resolves once the editors can use it; rejects for what is not a
|
|
268
|
+
* TrueType or OpenType font.
|
|
269
|
+
*/
|
|
270
|
+
export async function registerFont(name, urlOrBytes) {
|
|
271
|
+
const k = await load();
|
|
272
|
+
let bytes = urlOrBytes;
|
|
273
|
+
if (typeof urlOrBytes === 'string' || urlOrBytes instanceof URL) {
|
|
274
|
+
const response = await fetch(urlOrBytes);
|
|
275
|
+
if (!response.ok) throw new Error(`Aardink: could not fetch the font ${name}: ${response.status}`);
|
|
276
|
+
bytes = await response.arrayBuffer();
|
|
277
|
+
}
|
|
278
|
+
const view = ArrayBuffer.isView(bytes) ? new Int8Array(bytes.buffer, bytes.byteOffset, bytes.byteLength) : new Int8Array(bytes);
|
|
279
|
+
const error = k.aardinkRegisterFont(name, view);
|
|
280
|
+
if (error) throw new Error(`Aardink: ${error}`);
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
/** Monaco's names for the built-in themes, as Aardink's. */
|
|
284
|
+
const MONACO_THEMES = { vs: 'vscode-light', 'vs-dark': 'vscode-dark' };
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* Keeps only the fields the Kotlin side knows, translating Monaco's wordWrap ('on', 'off',
|
|
288
|
+
* 'wordWrapColumn', 'bounded'), its { enabled } objects for minimap and stickyScroll (a plain
|
|
289
|
+
* boolean works too), its guides and its lineNumbers.
|
|
221
290
|
*/
|
|
222
291
|
function toKotlinOptions(options) {
|
|
223
292
|
const out = {};
|
|
224
|
-
for (const key of ['language', '
|
|
293
|
+
for (const key of ['language', 'fontSize', 'readOnly', 'showGutter', 'showLineNumbers', 'showFoldMarkers', 'tabSize', 'insertSpaces', 'highlightCurrentLine', 'renderWhitespace']) {
|
|
294
|
+
if (options[key] !== undefined) out[key] = options[key];
|
|
295
|
+
}
|
|
296
|
+
if (options.theme !== undefined) out.theme = MONACO_THEMES[options.theme] ?? options.theme;
|
|
297
|
+
if (options.wordWrap !== undefined) {
|
|
298
|
+
const bounded = options.wordWrap === 'wordWrapColumn' || options.wordWrap === 'bounded';
|
|
299
|
+
out.wordWrap = options.wordWrap === 'on' || options.wordWrap === true || bounded;
|
|
300
|
+
out.wordWrapColumn = bounded ? options.wordWrapColumn ?? 80 : null;
|
|
301
|
+
} else if (options.wordWrapColumn !== undefined) {
|
|
302
|
+
out.wordWrapColumn = options.wordWrapColumn;
|
|
303
|
+
}
|
|
304
|
+
if (options.lineNumbers !== undefined) {
|
|
305
|
+
// A function, Monaco's other form, cannot cross to the Kotlin side: it counts as 'on'.
|
|
306
|
+
out.lineNumbers = typeof options.lineNumbers === 'string' ? options.lineNumbers : 'on';
|
|
307
|
+
}
|
|
308
|
+
if (options.guides !== undefined && options.guides !== null) {
|
|
309
|
+
if (options.guides.indentation !== undefined) out.indentGuides = !!options.guides.indentation;
|
|
310
|
+
// Monaco's 'active' shows only the caret's pair; here it shows them all.
|
|
311
|
+
if (options.guides.bracketPairs !== undefined) out.bracketPairGuides = !!options.guides.bracketPairs;
|
|
312
|
+
}
|
|
313
|
+
if (options.rulers !== undefined) {
|
|
314
|
+
// Monaco's { column, color } rulers keep their column; one colour comes from the theme.
|
|
315
|
+
out.rulers = (options.rulers ?? []).map((r) => (typeof r === 'number' ? r : r?.column)).filter((c) => Number.isInteger(c));
|
|
316
|
+
}
|
|
317
|
+
for (const key of ['cursorStyle', 'cursorBlinking', 'wrappingIndent', 'cursorSurroundingLines', 'fontFamily']) {
|
|
225
318
|
if (options[key] !== undefined) out[key] = options[key];
|
|
226
319
|
}
|
|
227
|
-
|
|
320
|
+
for (const key of ['smoothScrolling', 'scrollBeyondLastLine', 'dragAndDrop']) {
|
|
321
|
+
if (options[key] !== undefined) out[key] = !!options[key];
|
|
322
|
+
}
|
|
228
323
|
if (options.renderLineHighlight !== undefined) out.highlightCurrentLine = options.renderLineHighlight !== 'none';
|
|
229
324
|
if (options.quickSuggestions !== undefined) {
|
|
230
325
|
// Monaco's { other, comments, strings }: the editor opens the list in code, so `other` decides.
|
|
@@ -236,9 +331,16 @@ function toKotlinOptions(options) {
|
|
|
236
331
|
if (options.overviewRuler !== undefined) out.overviewRuler = !!options.overviewRuler;
|
|
237
332
|
if (options.occurrencesHighlight !== undefined) out.occurrencesHighlight = options.occurrencesHighlight !== false && options.occurrencesHighlight !== 'off';
|
|
238
333
|
if (options.fontLigatures !== undefined) out.fontLigatures = options.fontLigatures !== false && options.fontLigatures !== 'off';
|
|
239
|
-
for (const key of ['linkedEditing', 'colorDecorators', 'breadcrumbs']) {
|
|
334
|
+
for (const key of ['linkedEditing', 'colorDecorators', 'breadcrumbs', 'semanticHighlighting', 'codeLens', 'formatOnType']) {
|
|
240
335
|
if (options[key] !== undefined) out[key] = !!options[key];
|
|
241
336
|
}
|
|
337
|
+
if (options.inlayHints !== undefined) {
|
|
338
|
+
// Monaco's { enabled: 'on' | 'off' | 'onUnlessPressed' | 'offUnlessPressed' }; a key held down is not
|
|
339
|
+
// read, so those two are their first word. A plain boolean works too.
|
|
340
|
+
const value = options.inlayHints;
|
|
341
|
+
const enabled = typeof value === 'object' && value !== null ? value.enabled ?? 'on' : value;
|
|
342
|
+
out.inlayHints = !!enabled && enabled !== 'off' && enabled !== 'offUnlessPressed';
|
|
343
|
+
}
|
|
242
344
|
for (const key of ['minimap', 'stickyScroll', 'bracketPairColorization']) {
|
|
243
345
|
const value = options[key];
|
|
244
346
|
if (value !== undefined) out[key] = typeof value === 'object' && value !== null ? value.enabled !== false : !!value;
|
|
@@ -297,6 +399,16 @@ export async function createEditor(container, onChange, options = {}) {
|
|
|
297
399
|
for (const listener of scrollListeners) listener(event);
|
|
298
400
|
});
|
|
299
401
|
|
|
402
|
+
// Unlike the listeners above, the Kotlin side hears of these only while there is one: with none it
|
|
403
|
+
// opens http and https links itself. It does that in the click, which a popup blocker wants.
|
|
404
|
+
const linkListeners = new Set();
|
|
405
|
+
const openLink = (target) => linkListeners.forEach((listener) => listener(target));
|
|
406
|
+
const searchListeners = new Set();
|
|
407
|
+
const searchWorkspace = (json) => {
|
|
408
|
+
const args = JSON.parse(json);
|
|
409
|
+
searchListeners.forEach((listener) => listener(args));
|
|
410
|
+
};
|
|
411
|
+
|
|
300
412
|
// Decorations: those set through deltaDecorations, with their ids, and each collection's own.
|
|
301
413
|
let deltaDecorations = [];
|
|
302
414
|
let nextDecorationId = 1;
|
|
@@ -390,6 +502,26 @@ export async function createEditor(container, onChange, options = {}) {
|
|
|
390
502
|
scrollListeners.add(listener);
|
|
391
503
|
return () => scrollListeners.delete(listener);
|
|
392
504
|
},
|
|
505
|
+
onSearchWorkspace(listener) {
|
|
506
|
+
if (searchListeners.size === 0) k.aardinkOnSearchWorkspace(id, searchWorkspace);
|
|
507
|
+
searchListeners.add(listener);
|
|
508
|
+
return {
|
|
509
|
+
dispose() {
|
|
510
|
+
searchListeners.delete(listener);
|
|
511
|
+
if (searchListeners.size === 0 && !disposed) k.aardinkOnSearchWorkspace(id, null);
|
|
512
|
+
},
|
|
513
|
+
};
|
|
514
|
+
},
|
|
515
|
+
onOpenLink(listener) {
|
|
516
|
+
if (linkListeners.size === 0) k.aardinkOnOpenLink(id, openLink);
|
|
517
|
+
linkListeners.add(listener);
|
|
518
|
+
return {
|
|
519
|
+
dispose() {
|
|
520
|
+
linkListeners.delete(listener);
|
|
521
|
+
if (linkListeners.size === 0 && !disposed) k.aardinkOnOpenLink(id, null);
|
|
522
|
+
},
|
|
523
|
+
};
|
|
524
|
+
},
|
|
393
525
|
layout: () => k.aardinkLayout(id),
|
|
394
526
|
onDidChangeDiagnostics(listener) {
|
|
395
527
|
diagnosticsListeners.add(listener);
|
|
@@ -471,6 +603,8 @@ export async function createEditor(container, onChange, options = {}) {
|
|
|
471
603
|
focusListeners.clear();
|
|
472
604
|
blurListeners.clear();
|
|
473
605
|
scrollListeners.clear();
|
|
606
|
+
linkListeners.clear();
|
|
607
|
+
searchListeners.clear();
|
|
474
608
|
k.aardinkDispose(id);
|
|
475
609
|
},
|
|
476
610
|
};
|
|
@@ -214,6 +214,7 @@ const js_code = {
|
|
|
214
214
|
'org.w3c.dom.events.target_$external_prop_getter' : (_this) => _this.target,
|
|
215
215
|
'org.w3c.dom.events.cancelable_$external_prop_getter' : (_this) => _this.cancelable,
|
|
216
216
|
'org.w3c.dom.events.timeStamp_$external_prop_getter' : (_this) => _this.timeStamp,
|
|
217
|
+
'org.w3c.dom.events.stopPropagation_$external_fun' : (_this, ) => _this.stopPropagation(),
|
|
217
218
|
'org.w3c.dom.events.preventDefault_$external_fun' : (_this, ) => _this.preventDefault(),
|
|
218
219
|
'org.w3c.dom.events.Event_$external_class_instanceof' : (x) => x instanceof Event,
|
|
219
220
|
'org.w3c.dom.events.Event_$external_class_get' : () => Event,
|
|
@@ -240,8 +241,9 @@ const js_code = {
|
|
|
240
241
|
'org.w3c.dom.events.FocusEvent_$external_class_instanceof' : (x) => x instanceof FocusEvent,
|
|
241
242
|
'org.w3c.dom.events.FocusEvent_$external_class_get' : () => FocusEvent,
|
|
242
243
|
'org.w3c.dom.events.addEventListener_$external_fun' : (_this, p0, p1, p2) => _this.addEventListener(p0, p1, p2),
|
|
243
|
-
'org.w3c.dom.events.addEventListener_$external_fun_1' : (_this, p0, p1) => _this.addEventListener(p0, p1),
|
|
244
|
+
'org.w3c.dom.events.addEventListener_$external_fun_1' : (_this, p0, p1, p2) => _this.addEventListener(p0, p1, p2),
|
|
244
245
|
'org.w3c.dom.events.addEventListener_$external_fun_2' : (_this, p0, p1) => _this.addEventListener(p0, p1),
|
|
246
|
+
'org.w3c.dom.events.addEventListener_$external_fun_3' : (_this, p0, p1) => _this.addEventListener(p0, p1),
|
|
245
247
|
'org.w3c.dom.events.removeEventListener_$external_fun' : (_this, p0, p1) => _this.removeEventListener(p0, p1),
|
|
246
248
|
'org.w3c.dom.events.removeEventListener_$external_fun_1' : (_this, p0, p1) => _this.removeEventListener(p0, p1),
|
|
247
249
|
'org.w3c.dom.events.clientX_$external_prop_getter' : (_this) => _this.clientX,
|
|
@@ -272,6 +274,7 @@ const js_code = {
|
|
|
272
274
|
'org.w3c.dom.getComputedStyle_$external_fun' : (_this, p0, p1, isDefault0) => _this.getComputedStyle(p0, isDefault0 ? undefined : p1, ),
|
|
273
275
|
'org.w3c.dom.matches_$external_prop_getter' : (_this) => _this.matches,
|
|
274
276
|
'org.w3c.dom.addListener_$external_fun' : (_this, p0) => _this.addListener(p0),
|
|
277
|
+
'org.w3c.dom.removeListener_$external_fun' : (_this, p0) => _this.removeListener(p0),
|
|
275
278
|
'org.w3c.dom.MediaQueryList_$external_class_instanceof' : (x) => x instanceof MediaQueryList,
|
|
276
279
|
'org.w3c.dom.MediaQueryList_$external_class_get' : () => MediaQueryList,
|
|
277
280
|
'org.w3c.dom.protocol_$external_prop_getter' : (_this) => _this.protocol,
|
|
@@ -329,11 +332,15 @@ const js_code = {
|
|
|
329
332
|
'org.w3c.dom.userAgent_$external_prop_getter' : (_this) => _this.userAgent,
|
|
330
333
|
'org.w3c.dom.language_$external_prop_getter' : (_this) => _this.language,
|
|
331
334
|
'org.w3c.dom.caches_$external_prop_getter' : (_this) => _this.caches,
|
|
335
|
+
'org.w3c.dom.setTimeout_$external_fun' : (_this, p0, p1, p2, isDefault0, isDefault1) => _this.setTimeout(p0, isDefault0 ? undefined : p1, ...p2, ),
|
|
332
336
|
'org.w3c.dom.fetch_$external_fun' : (_this, p0, p1, isDefault0) => _this.fetch(p0, isDefault0 ? undefined : p1, ),
|
|
333
337
|
'org.w3c.dom.top_$external_prop_getter' : (_this) => _this.top,
|
|
334
338
|
'org.w3c.dom.left_$external_prop_getter' : (_this) => _this.left,
|
|
335
339
|
'org.w3c.dom.remove_$external_fun' : (_this, ) => _this.remove(),
|
|
336
340
|
'org.w3c.dom.Companion_$external_object_getInstance' : () => ({}),
|
|
341
|
+
'org.w3c.dom.data_$external_prop_getter' : (_this) => _this.data,
|
|
342
|
+
'org.w3c.dom.MessageEvent_$external_class_instanceof' : (x) => x instanceof MessageEvent,
|
|
343
|
+
'org.w3c.dom.MessageEvent_$external_class_get' : () => MessageEvent,
|
|
337
344
|
'org.w3c.dom.value_$external_prop_getter' : (_this) => _this.value,
|
|
338
345
|
'org.w3c.dom.value_$external_prop_setter' : (_this, v) => _this.value = v,
|
|
339
346
|
'org.w3c.dom.add_$external_fun_1' : (_this, p0) => _this.add(p0),
|
|
@@ -348,6 +355,14 @@ const js_code = {
|
|
|
348
355
|
'org.w3c.dom.HTMLOptionElement_$external_class_get' : () => HTMLOptionElement,
|
|
349
356
|
'org.w3c.dom.HTMLButtonElement_$external_class_instanceof' : (x) => x instanceof HTMLButtonElement,
|
|
350
357
|
'org.w3c.dom.HTMLButtonElement_$external_class_get' : () => HTMLButtonElement,
|
|
358
|
+
'org.w3c.dom.WebSocket_$external_fun' : (p0, p1, isDefault0) => new WebSocket(p0, isDefault0 ? undefined : p1, ),
|
|
359
|
+
'org.w3c.dom.readyState_$external_prop_getter' : (_this) => _this.readyState,
|
|
360
|
+
'org.w3c.dom.onopen_$external_prop_setter' : (_this, v) => _this.onopen = v,
|
|
361
|
+
'org.w3c.dom.onerror_$external_prop_setter' : (_this, v) => _this.onerror = v,
|
|
362
|
+
'org.w3c.dom.onclose_$external_prop_setter' : (_this, v) => _this.onclose = v,
|
|
363
|
+
'org.w3c.dom.onmessage_$external_prop_setter' : (_this, v) => _this.onmessage = v,
|
|
364
|
+
'org.w3c.dom.close_$external_fun' : (_this, p0, p1, isDefault0, isDefault1) => _this.close(isDefault0 ? undefined : p0, isDefault1 ? undefined : p1, ),
|
|
365
|
+
'org.w3c.dom.send_$external_fun' : (_this, p0) => _this.send(p0),
|
|
351
366
|
'org.w3c.dom.pointerevents.pointerId_$external_prop_getter' : (_this) => _this.pointerId,
|
|
352
367
|
'org.w3c.dom.pointerevents.pressure_$external_prop_getter' : (_this) => _this.pressure,
|
|
353
368
|
'org.w3c.dom.pointerevents.PointerEvent_$external_class_instanceof' : (x) => x instanceof PointerEvent,
|
|
@@ -423,6 +438,7 @@ const js_code = {
|
|
|
423
438
|
'androidx.compose.ui.events.withSignalAndPassive' : (signal, passive) => ({signal: signal, passive: passive}),
|
|
424
439
|
'androidx.compose.ui.events.AbortController_$external_fun' : () => new AbortController(),
|
|
425
440
|
'androidx.compose.ui.events.signal_$external_prop_getter' : (_this) => _this.signal,
|
|
441
|
+
'androidx.compose.ui.events.abort_$external_fun' : (_this, ) => _this.abort(),
|
|
426
442
|
'androidx.compose.ui.internal.focusExt' : (element, _preventScroll) => element.focus({ preventScroll: _preventScroll }),
|
|
427
443
|
'androidx.compose.ui.node.WeakRef_$external_fun' : (p0) => new WeakRef(p0),
|
|
428
444
|
'androidx.compose.ui.node.deref_$external_fun' : (_this, ) => _this.deref(),
|
|
@@ -587,12 +603,32 @@ const js_code = {
|
|
|
587
603
|
observer.disconnect();
|
|
588
604
|
};
|
|
589
605
|
},
|
|
606
|
+
'com.aardarch.aardink.web.openNewTab' : (url) => {
|
|
607
|
+
try {
|
|
608
|
+
window.open(url, '_blank', 'noopener');
|
|
609
|
+
} catch (e) {
|
|
610
|
+
console.warn('Aardink: could not open ' + url, e);
|
|
611
|
+
}
|
|
612
|
+
},
|
|
590
613
|
'com.aardarch.aardink.web.dispatchResize' : () => window.dispatchEvent(new Event('resize')),
|
|
591
614
|
'com.aardarch.aardink.web.callStop' : (stop) => stop(),
|
|
615
|
+
'com.aardarch.aardink.web.releaseWebGlContexts' : (element) => {
|
|
616
|
+
const roots = [element];
|
|
617
|
+
while (roots.length > 0) {
|
|
618
|
+
const root = roots.pop();
|
|
619
|
+
for (const node of root.querySelectorAll('*')) {
|
|
620
|
+
if (node.shadowRoot) roots.push(node.shadowRoot);
|
|
621
|
+
if (node.tagName !== 'CANVAS') continue;
|
|
622
|
+
const gl = node.getContext('webgl2') || node.getContext('webgl');
|
|
623
|
+
const lose = gl && gl.getExtension('WEBGL_lose_context');
|
|
624
|
+
if (lose && !gl.isContextLost()) lose.loseContext();
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
},
|
|
592
628
|
'com.aardarch.aardink.sampleweb.__callJsClosure_((String)->Unit)' : (f, p0) => f(p0),
|
|
593
629
|
'com.aardarch.aardink.sampleweb.__callJsClosure_((Int,Int)->Unit)' : (f, p0, p1) => f(p0, p1),
|
|
630
|
+
'com.aardarch.aardink.sampleweb.__callJsClosure_((String,String,String)->Js)' : (f, p0, p1, p2) => f(p0, p1, p2),
|
|
594
631
|
'com.aardarch.aardink.sampleweb.__callJsClosure_((String,Int,Int)->Js)' : (f, p0, p1, p2) => f(p0, p1, p2),
|
|
595
|
-
'com.aardarch.aardink.sampleweb.__callJsClosure_((String)->Js)' : (f, p0) => f(p0),
|
|
596
632
|
'com.aardarch.aardink.sampleweb.__callJsClosure_((String,Int,String,String)->Unit)' : (f, p0, p1, p2, p3) => f(p0, p1, p2, p3),
|
|
597
633
|
'com.aardarch.aardink.sampleweb.__callJsClosure_((Boolean)->Unit)' : (f, p0) => f(p0),
|
|
598
634
|
'com.aardarch.aardink.sampleweb.usedJsHeapBytes' : () => (performance.memory ? performance.memory.usedJSHeapSize : -1)
|
package/kotlin/aardink-web.mjs
CHANGED
|
@@ -94,6 +94,8 @@ export const {
|
|
|
94
94
|
aardinkSetScrollTop,
|
|
95
95
|
aardinkGetScrollHeight,
|
|
96
96
|
aardinkOnScrollChange,
|
|
97
|
+
aardinkOnOpenLink,
|
|
98
|
+
aardinkOnSearchWorkspace,
|
|
97
99
|
aardinkLayout,
|
|
98
100
|
aardinkSetDecorations,
|
|
99
101
|
aardinkGetDecorationRanges,
|
|
@@ -101,7 +103,12 @@ export const {
|
|
|
101
103
|
aardinkGetSymbolPathAt,
|
|
102
104
|
aardinkRevalidate,
|
|
103
105
|
aardinkRegisterLanguage,
|
|
106
|
+
aardinkConnectLanguageServer,
|
|
107
|
+
aardinkDisconnectLanguageServer,
|
|
108
|
+
aardinkRegisterInlineCompletionsProvider,
|
|
109
|
+
aardinkDisposeInlineCompletionsProvider,
|
|
104
110
|
aardinkRegisterTheme,
|
|
111
|
+
aardinkRegisterFont,
|
|
105
112
|
aardinkOnContentChange,
|
|
106
113
|
aardinkOnSelectionChange,
|
|
107
114
|
aardinkOnFocusChange,
|
package/kotlin/aardink-web.wasm
CHANGED
|
Binary file
|
package/package.json
CHANGED