slint-ui 1.8.0-nightly.2024090616 → 1.8.0-nightly.2024091017
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/Cargo.toml +4 -4
- package/biome.json +10 -0
- package/build-on-demand.mjs +10 -9
- package/index.d.ts +108 -108
- package/index.js +147 -126
- package/index.ts +399 -292
- package/package.json +12 -6
package/Cargo.toml
CHANGED
|
@@ -40,10 +40,10 @@ accessibility = ["slint-interpreter/accessibility"]
|
|
|
40
40
|
[dependencies]
|
|
41
41
|
napi = { version = "2.14.0", default-features = false, features = ["napi8"] }
|
|
42
42
|
napi-derive = "2.14.0"
|
|
43
|
-
i-slint-compiler = { features = ["default"] , git = "https://github.com/slint-ui/slint", rev = "
|
|
44
|
-
i-slint-core = { features = ["default"] , git = "https://github.com/slint-ui/slint", rev = "
|
|
45
|
-
i-slint-backend-selector = { git = "https://github.com/slint-ui/slint", rev = "
|
|
46
|
-
slint-interpreter = { default-features = false , features = ["display-diagnostics", "internal", "compat-1-2"] , git = "https://github.com/slint-ui/slint", rev = "
|
|
43
|
+
i-slint-compiler = { features = ["default"] , git = "https://github.com/slint-ui/slint", rev = "d7007f5356ba8caedf82be5d0ea42f8df8729bb0", version = "=1.8.0", default-features = false }
|
|
44
|
+
i-slint-core = { features = ["default"] , git = "https://github.com/slint-ui/slint", rev = "d7007f5356ba8caedf82be5d0ea42f8df8729bb0", version = "=1.8.0", default-features = false }
|
|
45
|
+
i-slint-backend-selector = { git = "https://github.com/slint-ui/slint", rev = "d7007f5356ba8caedf82be5d0ea42f8df8729bb0", version = "=1.8.0", default-features = false }
|
|
46
|
+
slint-interpreter = { default-features = false , features = ["display-diagnostics", "internal", "compat-1-2"] , git = "https://github.com/slint-ui/slint", rev = "d7007f5356ba8caedf82be5d0ea42f8df8729bb0", version = "=1.8.0"}
|
|
47
47
|
spin_on = { version = "0.1" }
|
|
48
48
|
css-color-parser2 = { version = "1.0.1" }
|
|
49
49
|
itertools = { version = "0.13" }
|
package/biome.json
ADDED
package/build-on-demand.mjs
CHANGED
|
@@ -7,15 +7,16 @@
|
|
|
7
7
|
import { Worker } from "node:worker_threads";
|
|
8
8
|
import { spawn } from "child_process";
|
|
9
9
|
|
|
10
|
-
const worker = new Worker("./rust-module.cjs")
|
|
10
|
+
const worker = new Worker("./rust-module.cjs");
|
|
11
11
|
// Define dummy error handler to prevent node from aborting on errors
|
|
12
|
-
worker.on(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
worker.on("error", (error) => {
|
|
13
|
+
console.log(`Error loading rust-module.cjs: {error}`);
|
|
14
|
+
});
|
|
15
|
+
worker.on("exit", (code) => {
|
|
16
|
+
if (code !== 0) {
|
|
17
|
+
console.log("slint-ui: loading rust-module.cjs failed, building now");
|
|
16
18
|
spawn("npm", ["run", "build"], {
|
|
17
|
-
stdio:
|
|
18
|
-
})
|
|
19
|
+
stdio: "inherit",
|
|
20
|
+
});
|
|
19
21
|
}
|
|
20
|
-
})
|
|
21
|
-
|
|
22
|
+
});
|
package/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as napi from "./rust-module.cjs";
|
|
2
|
-
export { Diagnostic, DiagnosticLevel, RgbaColor, Brush } from "./rust-module";
|
|
2
|
+
export { Diagnostic, DiagnosticLevel, RgbaColor, Brush, } from "./rust-module";
|
|
3
3
|
/**
|
|
4
4
|
* Represents a two-dimensional point.
|
|
5
5
|
*/
|
|
@@ -264,111 +264,111 @@ export declare namespace private_api {
|
|
|
264
264
|
*
|
|
265
265
|
* ```ts
|
|
266
266
|
* import { Model, ArrayModel, MapModel } from "./index";
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
267
|
+
*
|
|
268
|
+
* interface Name {
|
|
269
|
+
* first: string;
|
|
270
|
+
* last: string;
|
|
271
|
+
* }
|
|
272
|
+
*
|
|
273
|
+
* const model = new ArrayModel<Name>([
|
|
274
|
+
* {
|
|
275
|
+
* first: "Hans",
|
|
276
|
+
* last: "Emil",
|
|
277
|
+
* },
|
|
278
|
+
* {
|
|
279
|
+
* first: "Max",
|
|
280
|
+
* last: "Mustermann",
|
|
281
|
+
* },
|
|
282
|
+
* {
|
|
283
|
+
* first: "Roman",
|
|
284
|
+
* last: "Tisch",
|
|
285
|
+
* },
|
|
286
|
+
* ]);
|
|
287
|
+
*
|
|
288
|
+
* const mappedModel = new MapModel(
|
|
289
|
+
* model,
|
|
290
|
+
* (data) => {
|
|
291
|
+
* return data.last + ", " + data.first;
|
|
292
|
+
* }
|
|
293
|
+
* );
|
|
294
|
+
*
|
|
295
|
+
* // prints "Emil, Hans"
|
|
296
|
+
* console.log(mappedModel.rowData(0));
|
|
297
|
+
*
|
|
298
|
+
* // prints "Mustermann, Max"
|
|
299
|
+
* console.log(mappedModel.rowData(1));
|
|
300
|
+
*
|
|
301
|
+
* // prints "Tisch, Roman"
|
|
302
|
+
* console.log(mappedModel.rowData(2));
|
|
303
|
+
*
|
|
304
|
+
* // Alternatively you can use the shortcut {@link MapModel.map}.
|
|
305
|
+
*
|
|
306
|
+
* const model = new ArrayModel<Name>([
|
|
307
|
+
* {
|
|
308
|
+
* first: "Hans",
|
|
309
|
+
* last: "Emil",
|
|
310
|
+
* },
|
|
311
|
+
* {
|
|
312
|
+
* first: "Max",
|
|
313
|
+
* last: "Mustermann",
|
|
314
|
+
* },
|
|
315
|
+
* {
|
|
316
|
+
* first: "Roman",
|
|
317
|
+
* last: "Tisch",
|
|
318
|
+
* },
|
|
319
|
+
* ]);
|
|
320
|
+
*
|
|
321
|
+
* const mappedModel = model.map(
|
|
322
|
+
* (data) => {
|
|
323
|
+
* return data.last + ", " + data.first;
|
|
324
|
+
* }
|
|
325
|
+
* );
|
|
326
|
+
*
|
|
327
|
+
*
|
|
328
|
+
* // prints "Emil, Hans"
|
|
329
|
+
* console.log(mappedModel.rowData(0));
|
|
330
|
+
*
|
|
331
|
+
* // prints "Mustermann, Max"
|
|
332
|
+
* console.log(mappedModel.rowData(1));
|
|
333
|
+
*
|
|
334
|
+
* // prints "Tisch, Roman"
|
|
335
|
+
* console.log(mappedModel.rowData(2));
|
|
336
|
+
*
|
|
337
|
+
* // You can modifying the underlying {@link ArrayModel}:
|
|
338
|
+
*
|
|
339
|
+
* const model = new ArrayModel<Name>([
|
|
340
|
+
* {
|
|
341
|
+
* first: "Hans",
|
|
342
|
+
* last: "Emil",
|
|
343
|
+
* },
|
|
344
|
+
* {
|
|
345
|
+
* first: "Max",
|
|
346
|
+
* last: "Mustermann",
|
|
347
|
+
* },
|
|
348
|
+
* {
|
|
349
|
+
* first: "Roman",
|
|
350
|
+
* last: "Tisch",
|
|
351
|
+
* },
|
|
352
|
+
* ]);
|
|
353
|
+
*
|
|
354
|
+
* const mappedModel = model.map(
|
|
355
|
+
* (data) => {
|
|
356
|
+
* return data.last + ", " + data.first;
|
|
357
|
+
* }
|
|
358
|
+
* );
|
|
359
|
+
*
|
|
360
|
+
* model.setRowData(1, { first: "Minnie", last: "Musterfrau" } );
|
|
361
|
+
*
|
|
362
|
+
* // prints "Emil, Hans"
|
|
363
|
+
* console.log(mappedModel.rowData(0));
|
|
364
|
+
*
|
|
365
|
+
* // prints "Musterfrau, Minnie"
|
|
366
|
+
* console.log(mappedModel.rowData(1));
|
|
367
|
+
*
|
|
368
|
+
* // prints "Tisch, Roman"
|
|
369
|
+
* console.log(mappedModel.rowData(2));
|
|
370
|
+
* ```
|
|
371
|
+
*/
|
|
372
372
|
class MapModel<T, U> extends Model<U> {
|
|
373
373
|
#private;
|
|
374
374
|
readonly sourceModel: Model<T>;
|
|
@@ -431,8 +431,8 @@ declare class Component implements ComponentHandle {
|
|
|
431
431
|
constructor(instance: napi.ComponentInstance);
|
|
432
432
|
get window(): Window;
|
|
433
433
|
/**
|
|
434
|
-
|
|
435
|
-
|
|
434
|
+
* @hidden
|
|
435
|
+
*/
|
|
436
436
|
get component_instance(): napi.ComponentInstance;
|
|
437
437
|
run(): Promise<void>;
|
|
438
438
|
show(): void;
|