slint-ui 1.8.0-nightly.2024091119 → 1.8.0-nightly.2024091220
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 +1 -2
- package/index.js +23 -23
- package/index.ts +26 -23
- package/package.json +6 -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 = "eed03345b5d02dd4dc5aee01d83198fcda3e5e79", version = "=1.8.0", default-features = false }
|
|
44
|
+
i-slint-core = { features = ["default"] , git = "https://github.com/slint-ui/slint", rev = "eed03345b5d02dd4dc5aee01d83198fcda3e5e79", version = "=1.8.0", default-features = false }
|
|
45
|
+
i-slint-backend-selector = { git = "https://github.com/slint-ui/slint", rev = "eed03345b5d02dd4dc5aee01d83198fcda3e5e79", 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 = "eed03345b5d02dd4dc5aee01d83198fcda3e5e79", 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
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"useArrowFunction": "off",
|
|
12
12
|
"noForEach": "off",
|
|
13
13
|
"noUselessConstructor": "off",
|
|
14
|
-
"noBannedTypes": "
|
|
14
|
+
"noBannedTypes": "warn"
|
|
15
15
|
},
|
|
16
16
|
"style": {
|
|
17
17
|
"noNonNullAssertion": "off",
|
|
@@ -29,7 +29,6 @@
|
|
|
29
29
|
"noExplicitAny": "off",
|
|
30
30
|
"noAssignInExpressions": "off",
|
|
31
31
|
"noImplicitAnyLet": "off",
|
|
32
|
-
"noDoubleEquals": "warn",
|
|
33
32
|
"noRedundantUseStrict": "off"
|
|
34
33
|
}
|
|
35
34
|
}
|
package/index.js
CHANGED
|
@@ -13,7 +13,7 @@ class ModelIterator {
|
|
|
13
13
|
}
|
|
14
14
|
next() {
|
|
15
15
|
if (this.row < this.model.rowCount()) {
|
|
16
|
-
|
|
16
|
+
const row = this.row;
|
|
17
17
|
this.row++;
|
|
18
18
|
return {
|
|
19
19
|
done: false,
|
|
@@ -189,7 +189,7 @@ class ArrayModel extends Model {
|
|
|
189
189
|
* @param values list of values that will be pushed to the array.
|
|
190
190
|
*/
|
|
191
191
|
push(...values) {
|
|
192
|
-
|
|
192
|
+
const size = this.#array.length;
|
|
193
193
|
Array.prototype.push.apply(this.#array, values);
|
|
194
194
|
this.notifyRowAdded(size, arguments.length);
|
|
195
195
|
}
|
|
@@ -199,7 +199,7 @@ class ArrayModel extends Model {
|
|
|
199
199
|
* @returns The removed element or undefined if the array is empty.
|
|
200
200
|
*/
|
|
201
201
|
pop() {
|
|
202
|
-
|
|
202
|
+
const last = this.#array.pop();
|
|
203
203
|
if (last !== undefined) {
|
|
204
204
|
this.notifyRowRemoved(this.#array.length, 1);
|
|
205
205
|
}
|
|
@@ -213,7 +213,7 @@ class ArrayModel extends Model {
|
|
|
213
213
|
* @param size number of rows to remove.
|
|
214
214
|
*/
|
|
215
215
|
remove(index, size) {
|
|
216
|
-
|
|
216
|
+
const r = this.#array.splice(index, size);
|
|
217
217
|
this.notifyRowRemoved(index, size);
|
|
218
218
|
}
|
|
219
219
|
/**
|
|
@@ -377,7 +377,7 @@ var private_api;
|
|
|
377
377
|
* @returns undefined if row is out of range otherwise the data.
|
|
378
378
|
*/
|
|
379
379
|
rowData(row) {
|
|
380
|
-
|
|
380
|
+
const data = this.sourceModel.rowData(row);
|
|
381
381
|
if (data === undefined) {
|
|
382
382
|
return undefined;
|
|
383
383
|
}
|
|
@@ -447,7 +447,7 @@ class CompileError extends Error {
|
|
|
447
447
|
exports.CompileError = CompileError;
|
|
448
448
|
function loadSlint(loadData) {
|
|
449
449
|
const { filePath, options } = loadData.fileData;
|
|
450
|
-
|
|
450
|
+
const compiler = new napi.ComponentCompiler();
|
|
451
451
|
if (typeof options !== "undefined") {
|
|
452
452
|
if (typeof options.style !== "undefined") {
|
|
453
453
|
compiler.style = options.style;
|
|
@@ -459,32 +459,32 @@ function loadSlint(loadData) {
|
|
|
459
459
|
compiler.libraryPaths = options.libraryPaths;
|
|
460
460
|
}
|
|
461
461
|
}
|
|
462
|
-
|
|
462
|
+
const definitions = loadData.from === "file"
|
|
463
463
|
? compiler.buildFromPath(filePath)
|
|
464
464
|
: compiler.buildFromSource(loadData.fileData.source, filePath);
|
|
465
|
-
|
|
465
|
+
const diagnostics = compiler.diagnostics;
|
|
466
466
|
if (diagnostics.length > 0) {
|
|
467
|
-
|
|
467
|
+
const warnings = diagnostics.filter((d) => d.level === napi.DiagnosticLevel.Warning);
|
|
468
468
|
if (typeof options !== "undefined" && options.quiet !== true) {
|
|
469
469
|
warnings.forEach((w) => console.warn("Warning: " + w));
|
|
470
470
|
}
|
|
471
|
-
|
|
471
|
+
const errors = diagnostics.filter((d) => d.level === napi.DiagnosticLevel.Error);
|
|
472
472
|
if (errors.length > 0) {
|
|
473
473
|
throw new CompileError("Could not compile " + filePath, errors);
|
|
474
474
|
}
|
|
475
475
|
}
|
|
476
|
-
|
|
476
|
+
const slint_module = Object.create({});
|
|
477
477
|
Object.keys(definitions).forEach((key) => {
|
|
478
|
-
|
|
478
|
+
const definition = definitions[key];
|
|
479
479
|
Object.defineProperty(slint_module, definition.name.replace(/-/g, "_"), {
|
|
480
480
|
value: function (properties) {
|
|
481
|
-
|
|
481
|
+
const instance = definition.create();
|
|
482
482
|
if (instance == null) {
|
|
483
483
|
throw Error("Could not create a component handle for" +
|
|
484
484
|
filePath);
|
|
485
485
|
}
|
|
486
486
|
for (var key in properties) {
|
|
487
|
-
|
|
487
|
+
const value = properties[key];
|
|
488
488
|
if (value instanceof Function) {
|
|
489
489
|
instance.setCallback(key, value);
|
|
490
490
|
}
|
|
@@ -492,9 +492,9 @@ function loadSlint(loadData) {
|
|
|
492
492
|
instance.setProperty(key, properties[key]);
|
|
493
493
|
}
|
|
494
494
|
}
|
|
495
|
-
|
|
495
|
+
const componentHandle = new Component(instance);
|
|
496
496
|
instance.definition().properties.forEach((prop) => {
|
|
497
|
-
|
|
497
|
+
const propName = prop.name.replace(/-/g, "_");
|
|
498
498
|
if (componentHandle[propName] !== undefined) {
|
|
499
499
|
console.warn("Duplicated property name " + propName);
|
|
500
500
|
}
|
|
@@ -511,7 +511,7 @@ function loadSlint(loadData) {
|
|
|
511
511
|
}
|
|
512
512
|
});
|
|
513
513
|
instance.definition().callbacks.forEach((cb) => {
|
|
514
|
-
|
|
514
|
+
const callbackName = cb.replace(/-/g, "_");
|
|
515
515
|
if (componentHandle[callbackName] !== undefined) {
|
|
516
516
|
console.warn("Duplicated callback name " + callbackName);
|
|
517
517
|
}
|
|
@@ -530,7 +530,7 @@ function loadSlint(loadData) {
|
|
|
530
530
|
}
|
|
531
531
|
});
|
|
532
532
|
instance.definition().functions.forEach((cb) => {
|
|
533
|
-
|
|
533
|
+
const functionName = cb.replace(/-/g, "_");
|
|
534
534
|
if (componentHandle[functionName] !== undefined) {
|
|
535
535
|
console.warn("Duplicated function name " + functionName);
|
|
536
536
|
}
|
|
@@ -551,12 +551,12 @@ function loadSlint(loadData) {
|
|
|
551
551
|
console.warn("Duplicated property name " + globalName);
|
|
552
552
|
}
|
|
553
553
|
else {
|
|
554
|
-
|
|
554
|
+
const globalObject = Object.create({});
|
|
555
555
|
instance
|
|
556
556
|
.definition()
|
|
557
557
|
.globalProperties(globalName)
|
|
558
558
|
.forEach((prop) => {
|
|
559
|
-
|
|
559
|
+
const propName = prop.name.replace(/-/g, "_");
|
|
560
560
|
if (globalObject[propName] !== undefined) {
|
|
561
561
|
console.warn("Duplicated property name " +
|
|
562
562
|
propName +
|
|
@@ -579,7 +579,7 @@ function loadSlint(loadData) {
|
|
|
579
579
|
.definition()
|
|
580
580
|
.globalCallbacks(globalName)
|
|
581
581
|
.forEach((cb) => {
|
|
582
|
-
|
|
582
|
+
const callbackName = cb.replace(/-/g, "_");
|
|
583
583
|
if (globalObject[callbackName] !== undefined) {
|
|
584
584
|
console.warn("Duplicated property name " +
|
|
585
585
|
cb +
|
|
@@ -604,7 +604,7 @@ function loadSlint(loadData) {
|
|
|
604
604
|
.definition()
|
|
605
605
|
.globalFunctions(globalName)
|
|
606
606
|
.forEach((cb) => {
|
|
607
|
-
|
|
607
|
+
const functionName = cb.replace(/-/g, "_");
|
|
608
608
|
if (globalObject[functionName] !== undefined) {
|
|
609
609
|
console.warn("Duplicated function name " +
|
|
610
610
|
cb +
|
|
@@ -733,7 +733,7 @@ class EventLoop {
|
|
|
733
733
|
// Give the nodejs event loop 16 ms to tick. This polling is sub-optimal, but it's the best we
|
|
734
734
|
// can do right now.
|
|
735
735
|
const nodejsPollInterval = 16;
|
|
736
|
-
|
|
736
|
+
const id = setInterval(() => {
|
|
737
737
|
if (napi.processEvents() === napi.ProcessEventsResult.Exited ||
|
|
738
738
|
this.#quit_loop) {
|
|
739
739
|
clearInterval(id);
|
package/index.ts
CHANGED
|
@@ -126,7 +126,7 @@ class ModelIterator<T> implements Iterator<T> {
|
|
|
126
126
|
|
|
127
127
|
public next(): IteratorResult<T> {
|
|
128
128
|
if (this.row < this.model.rowCount()) {
|
|
129
|
-
|
|
129
|
+
const row = this.row;
|
|
130
130
|
this.row++;
|
|
131
131
|
return {
|
|
132
132
|
done: false,
|
|
@@ -341,7 +341,7 @@ export class ArrayModel<T> extends Model<T> {
|
|
|
341
341
|
* @param values list of values that will be pushed to the array.
|
|
342
342
|
*/
|
|
343
343
|
push(...values: T[]) {
|
|
344
|
-
|
|
344
|
+
const size = this.#array.length;
|
|
345
345
|
Array.prototype.push.apply(this.#array, values);
|
|
346
346
|
this.notifyRowAdded(size, arguments.length);
|
|
347
347
|
}
|
|
@@ -352,7 +352,7 @@ export class ArrayModel<T> extends Model<T> {
|
|
|
352
352
|
* @returns The removed element or undefined if the array is empty.
|
|
353
353
|
*/
|
|
354
354
|
pop(): T | undefined {
|
|
355
|
-
|
|
355
|
+
const last = this.#array.pop();
|
|
356
356
|
if (last !== undefined) {
|
|
357
357
|
this.notifyRowRemoved(this.#array.length, 1);
|
|
358
358
|
}
|
|
@@ -367,7 +367,7 @@ export class ArrayModel<T> extends Model<T> {
|
|
|
367
367
|
* @param size number of rows to remove.
|
|
368
368
|
*/
|
|
369
369
|
remove(index: number, size: number) {
|
|
370
|
-
|
|
370
|
+
const r = this.#array.splice(index, size);
|
|
371
371
|
this.notifyRowRemoved(index, size);
|
|
372
372
|
}
|
|
373
373
|
|
|
@@ -535,7 +535,7 @@ export namespace private_api {
|
|
|
535
535
|
* @returns undefined if row is out of range otherwise the data.
|
|
536
536
|
*/
|
|
537
537
|
rowData(row: number): U | undefined {
|
|
538
|
-
|
|
538
|
+
const data = this.sourceModel.rowData(row);
|
|
539
539
|
if (data === undefined) {
|
|
540
540
|
return undefined;
|
|
541
541
|
}
|
|
@@ -692,7 +692,7 @@ type LoadData =
|
|
|
692
692
|
function loadSlint(loadData: LoadData): Object {
|
|
693
693
|
const { filePath, options } = loadData.fileData;
|
|
694
694
|
|
|
695
|
-
|
|
695
|
+
const compiler = new napi.ComponentCompiler();
|
|
696
696
|
|
|
697
697
|
if (typeof options !== "undefined") {
|
|
698
698
|
if (typeof options.style !== "undefined") {
|
|
@@ -706,14 +706,14 @@ function loadSlint(loadData: LoadData): Object {
|
|
|
706
706
|
}
|
|
707
707
|
}
|
|
708
708
|
|
|
709
|
-
|
|
709
|
+
const definitions =
|
|
710
710
|
loadData.from === "file"
|
|
711
711
|
? compiler.buildFromPath(filePath)
|
|
712
712
|
: compiler.buildFromSource(loadData.fileData.source, filePath);
|
|
713
|
-
|
|
713
|
+
const diagnostics = compiler.diagnostics;
|
|
714
714
|
|
|
715
715
|
if (diagnostics.length > 0) {
|
|
716
|
-
|
|
716
|
+
const warnings = diagnostics.filter(
|
|
717
717
|
(d) => d.level === napi.DiagnosticLevel.Warning,
|
|
718
718
|
);
|
|
719
719
|
|
|
@@ -721,7 +721,7 @@ function loadSlint(loadData: LoadData): Object {
|
|
|
721
721
|
warnings.forEach((w) => console.warn("Warning: " + w));
|
|
722
722
|
}
|
|
723
723
|
|
|
724
|
-
|
|
724
|
+
const errors = diagnostics.filter(
|
|
725
725
|
(d) => d.level === napi.DiagnosticLevel.Error,
|
|
726
726
|
);
|
|
727
727
|
|
|
@@ -730,17 +730,17 @@ function loadSlint(loadData: LoadData): Object {
|
|
|
730
730
|
}
|
|
731
731
|
}
|
|
732
732
|
|
|
733
|
-
|
|
733
|
+
const slint_module = Object.create({});
|
|
734
734
|
|
|
735
735
|
Object.keys(definitions).forEach((key) => {
|
|
736
|
-
|
|
736
|
+
const definition = definitions[key];
|
|
737
737
|
|
|
738
738
|
Object.defineProperty(
|
|
739
739
|
slint_module,
|
|
740
740
|
definition.name.replace(/-/g, "_"),
|
|
741
741
|
{
|
|
742
742
|
value: function (properties: any) {
|
|
743
|
-
|
|
743
|
+
const instance = definition.create();
|
|
744
744
|
|
|
745
745
|
if (instance == null) {
|
|
746
746
|
throw Error(
|
|
@@ -750,7 +750,7 @@ function loadSlint(loadData: LoadData): Object {
|
|
|
750
750
|
}
|
|
751
751
|
|
|
752
752
|
for (var key in properties) {
|
|
753
|
-
|
|
753
|
+
const value = properties[key];
|
|
754
754
|
|
|
755
755
|
if (value instanceof Function) {
|
|
756
756
|
instance.setCallback(key, value);
|
|
@@ -759,9 +759,9 @@ function loadSlint(loadData: LoadData): Object {
|
|
|
759
759
|
}
|
|
760
760
|
}
|
|
761
761
|
|
|
762
|
-
|
|
762
|
+
const componentHandle = new Component(instance!);
|
|
763
763
|
instance!.definition().properties.forEach((prop) => {
|
|
764
|
-
|
|
764
|
+
const propName = prop.name.replace(/-/g, "_");
|
|
765
765
|
|
|
766
766
|
if (componentHandle[propName] !== undefined) {
|
|
767
767
|
console.warn(
|
|
@@ -781,7 +781,7 @@ function loadSlint(loadData: LoadData): Object {
|
|
|
781
781
|
});
|
|
782
782
|
|
|
783
783
|
instance!.definition().callbacks.forEach((cb) => {
|
|
784
|
-
|
|
784
|
+
const callbackName = cb.replace(/-/g, "_");
|
|
785
785
|
|
|
786
786
|
if (componentHandle[callbackName] !== undefined) {
|
|
787
787
|
console.warn(
|
|
@@ -810,7 +810,7 @@ function loadSlint(loadData: LoadData): Object {
|
|
|
810
810
|
});
|
|
811
811
|
|
|
812
812
|
instance!.definition().functions.forEach((cb) => {
|
|
813
|
-
|
|
813
|
+
const functionName = cb.replace(/-/g, "_");
|
|
814
814
|
|
|
815
815
|
if (componentHandle[functionName] !== undefined) {
|
|
816
816
|
console.warn(
|
|
@@ -842,13 +842,16 @@ function loadSlint(loadData: LoadData): Object {
|
|
|
842
842
|
"Duplicated property name " + globalName,
|
|
843
843
|
);
|
|
844
844
|
} else {
|
|
845
|
-
|
|
845
|
+
const globalObject = Object.create({});
|
|
846
846
|
|
|
847
847
|
instance!
|
|
848
848
|
.definition()
|
|
849
849
|
.globalProperties(globalName)
|
|
850
850
|
.forEach((prop) => {
|
|
851
|
-
|
|
851
|
+
const propName = prop.name.replace(
|
|
852
|
+
/-/g,
|
|
853
|
+
"_",
|
|
854
|
+
);
|
|
852
855
|
|
|
853
856
|
if (globalObject[propName] !== undefined) {
|
|
854
857
|
console.warn(
|
|
@@ -885,7 +888,7 @@ function loadSlint(loadData: LoadData): Object {
|
|
|
885
888
|
.definition()
|
|
886
889
|
.globalCallbacks(globalName)
|
|
887
890
|
.forEach((cb) => {
|
|
888
|
-
|
|
891
|
+
const callbackName = cb.replace(/-/g, "_");
|
|
889
892
|
|
|
890
893
|
if (
|
|
891
894
|
globalObject[callbackName] !== undefined
|
|
@@ -929,7 +932,7 @@ function loadSlint(loadData: LoadData): Object {
|
|
|
929
932
|
.definition()
|
|
930
933
|
.globalFunctions(globalName)
|
|
931
934
|
.forEach((cb) => {
|
|
932
|
-
|
|
935
|
+
const functionName = cb.replace(/-/g, "_");
|
|
933
936
|
|
|
934
937
|
if (
|
|
935
938
|
globalObject[functionName] !== undefined
|
|
@@ -1089,7 +1092,7 @@ class EventLoop {
|
|
|
1089
1092
|
// Give the nodejs event loop 16 ms to tick. This polling is sub-optimal, but it's the best we
|
|
1090
1093
|
// can do right now.
|
|
1091
1094
|
const nodejsPollInterval = 16;
|
|
1092
|
-
|
|
1095
|
+
const id = setInterval(() => {
|
|
1093
1096
|
if (
|
|
1094
1097
|
napi.processEvents() === napi.ProcessEventsResult.Exited ||
|
|
1095
1098
|
this.#quit_loop
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "slint-ui",
|
|
3
|
-
"version": "1.8.0-nightly.
|
|
3
|
+
"version": "1.8.0-nightly.2024091220",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"types": "index.d.ts",
|
|
6
6
|
"homepage": "https://github.com/slint-ui/slint",
|
|
@@ -65,10 +65,10 @@
|
|
|
65
65
|
"@napi-rs/cli": "^2.16.5"
|
|
66
66
|
},
|
|
67
67
|
"optionalDependencies": {
|
|
68
|
-
"@slint-ui/slint-ui-binary-linux-x64-gnu": "1.8.0-nightly.
|
|
69
|
-
"@slint-ui/slint-ui-binary-darwin-x64": "1.8.0-nightly.
|
|
70
|
-
"@slint-ui/slint-ui-binary-darwin-arm64": "1.8.0-nightly.
|
|
71
|
-
"@slint-ui/slint-ui-binary-win32-x64-msvc": "1.8.0-nightly.
|
|
72
|
-
"@slint-ui/slint-ui-binary-win32-ia32-msvc": "1.8.0-nightly.
|
|
68
|
+
"@slint-ui/slint-ui-binary-linux-x64-gnu": "1.8.0-nightly.2024091220",
|
|
69
|
+
"@slint-ui/slint-ui-binary-darwin-x64": "1.8.0-nightly.2024091220",
|
|
70
|
+
"@slint-ui/slint-ui-binary-darwin-arm64": "1.8.0-nightly.2024091220",
|
|
71
|
+
"@slint-ui/slint-ui-binary-win32-x64-msvc": "1.8.0-nightly.2024091220",
|
|
72
|
+
"@slint-ui/slint-ui-binary-win32-ia32-msvc": "1.8.0-nightly.2024091220"
|
|
73
73
|
}
|
|
74
74
|
}
|