slint-ui 0.3.4 → 0.3.5

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/native/Cargo.toml CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  [package]
5
5
  name = "slint-node"
6
- version = "0.3.4"
6
+ version = "0.3.5"
7
7
  authors = ["Slint Developers <info@slint-ui.com>"]
8
8
  edition = "2021"
9
9
  build = "build.rs"
@@ -20,9 +20,9 @@ crate-type = ["cdylib"]
20
20
  name = "slint_node_native"
21
21
 
22
22
  [dependencies]
23
- i-slint-compiler = { version = "=0.3.4"}
24
- i-slint-core = { version = "=0.3.4"}
25
- slint-interpreter = { version = "=0.3.4", features = ["display-diagnostics"] }
23
+ i-slint-compiler = { version = "=0.3.5"}
24
+ i-slint-core = { version = "=0.3.5"}
25
+ slint-interpreter = { version = "=0.3.5", features = ["display-diagnostics"] }
26
26
 
27
27
  vtable = { version = "0.1.6"}
28
28
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "slint-ui",
3
- "version": "0.3.4",
3
+ "version": "0.3.5",
4
4
  "homepage": "https://github.com/slint-ui/slint",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "repository": {
package/dist/index.d.ts DELETED
@@ -1,172 +0,0 @@
1
- /**
2
- * @hidden
3
- */
4
- declare function load_native_lib(): any;
5
- /**
6
- * @hidden
7
- */
8
- declare let native: any;
9
- /**
10
- * @hidden
11
- */
12
- declare class Component {
13
- protected comp: any;
14
- constructor(comp: any);
15
- run(): void;
16
- show(): void;
17
- hide(): void;
18
- get window(): SlintWindow;
19
- send_mouse_click(x: number, y: number): void;
20
- send_keyboard_string_sequence(s: String): void;
21
- }
22
- interface Point {
23
- x: number;
24
- y: number;
25
- }
26
- interface Size {
27
- width: number;
28
- height: number;
29
- }
30
- interface SlintWindow {
31
- show(): void;
32
- hide(): void;
33
- is_visible: boolean;
34
- logical_position: Point;
35
- physical_position: Point;
36
- logical_size: Size;
37
- physical_size: Size;
38
- }
39
- /**
40
- * @hidden
41
- */
42
- declare class WindowAPI implements SlintWindow {
43
- protected impl: any;
44
- constructor(impl: any);
45
- show(): void;
46
- hide(): void;
47
- get is_visible(): boolean;
48
- get logical_position(): Point;
49
- set logical_position(pos: Point);
50
- get physical_position(): Point;
51
- set physical_position(pos: Point);
52
- get logical_size(): Size;
53
- set logical_size(size: Size);
54
- get physical_size(): Size;
55
- set physical_size(size: Size);
56
- }
57
- /**
58
- * @hidden
59
- */
60
- interface Callback {
61
- (): any;
62
- setHandler(cb: any): void;
63
- }
64
- /**
65
- * ModelPeer is the interface that the run-time implements. An instance is
66
- * set on dynamic Model<T> instances and can be used to notify the run-time
67
- * of changes in the structure or data of the model.
68
- */
69
- interface ModelPeer {
70
- /**
71
- * Call this function from our own model to notify that fields of data
72
- * in the specified row have changed.
73
- * @argument row
74
- */
75
- rowDataChanged(row: number): void;
76
- /**
77
- * Call this function from your own model to notify that one or multiple
78
- * rows were added to the model, starting at the specified row.
79
- * @param row
80
- * @param count
81
- */
82
- rowAdded(row: number, count: number): void;
83
- /**
84
- * Call this function from your own model to notify that one or multiple
85
- * rows were removed from the model, starting at the specified row.
86
- * @param row
87
- * @param count
88
- */
89
- rowRemoved(row: number, count: number): void;
90
- /**
91
- * Call this function from your own model to notify that the model has been
92
- * changed and everything must be reloaded
93
- */
94
- reset(): void;
95
- }
96
- /**
97
- * Model<T> is the interface for feeding dynamic data into
98
- * `.slint` views.
99
- *
100
- * A model is organized like a table with rows of data. The
101
- * fields of the data type T behave like columns.
102
- */
103
- interface Model<T> {
104
- /**
105
- * Implementations of this function must return the current number of rows.
106
- */
107
- rowCount(): number;
108
- /**
109
- * Implementations of this function must return the data at the specified row.
110
- * @param row
111
- */
112
- rowData(row: number): T;
113
- /**
114
- * Implementations of this function must store the provided data parameter
115
- * in the model at the specified row.
116
- * @param row
117
- * @param data
118
- */
119
- setRowData(row: number, data: T): void;
120
- /**
121
- * This public member is set by the run-time and implementation must use this
122
- * to notify the run-time of changes in the model.
123
- */
124
- notify: ModelPeer;
125
- }
126
- /**
127
- * @hidden
128
- */
129
- declare class NullPeer implements ModelPeer {
130
- rowDataChanged(row: number): void;
131
- rowAdded(row: number, count: number): void;
132
- rowRemoved(row: number, count: number): void;
133
- reset(): void;
134
- }
135
- /**
136
- * ArrayModel wraps a JavaScript array for use in `.slint` views. The underlying
137
- * array can be modified with the [[ArrayModel.push]] and [[ArrayModel.remove]] methods.
138
- */
139
- declare class ArrayModel<T> implements Model<T> {
140
- /**
141
- * @hidden
142
- */
143
- private a;
144
- notify: ModelPeer;
145
- /**
146
- * Creates a new ArrayModel.
147
- *
148
- * @param arr
149
- */
150
- constructor(arr: Array<T>);
151
- rowCount(): number;
152
- rowData(row: number): T;
153
- setRowData(row: number, data: T): void;
154
- /**
155
- * Pushes new values to the array that's backing the model and notifies
156
- * the run-time about the added rows.
157
- * @param values
158
- */
159
- push(...values: T[]): void;
160
- /**
161
- * Removes the specified number of element from the array that's backing
162
- * the model, starting at the specified index. This is equivalent to calling
163
- * Array.slice() on the array and notifying the run-time about the removed
164
- * rows.
165
- * @param index
166
- * @param size
167
- */
168
- remove(index: number, size: number): void;
169
- get length(): number;
170
- values(): IterableIterator<T>;
171
- entries(): IterableIterator<[number, T]>;
172
- }
package/dist/index.js DELETED
@@ -1,184 +0,0 @@
1
- "use strict";
2
- // Copyright © SixtyFPS GmbH <info@slint-ui.com>
3
- // SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-commercial
4
- // Load the native library with `process.dlopen` instead of with `require`.
5
- // This is only done for autotest that do not require nom or neon_cli to
6
- // copy the lib to its right place
7
- /**
8
- * @hidden
9
- */
10
- function load_native_lib() {
11
- const os = require('os');
12
- process.dlopen(module, process.env.SLINT_NODE_NATIVE_LIB, os.constants.dlopen.RTLD_NOW);
13
- return module.exports;
14
- }
15
- /**
16
- * @hidden
17
- */
18
- let native = !process.env.SLINT_NODE_NATIVE_LIB ? require('../native/index.node') : load_native_lib();
19
- /**
20
- * @hidden
21
- */
22
- class Component {
23
- constructor(comp) {
24
- this.comp = comp;
25
- }
26
- run() {
27
- this.comp.run();
28
- }
29
- show() {
30
- this.window.show();
31
- }
32
- hide() {
33
- this.window.hide();
34
- }
35
- get window() {
36
- return new WindowAPI(this.comp.window());
37
- }
38
- send_mouse_click(x, y) {
39
- this.comp.send_mouse_click(x, y);
40
- }
41
- send_keyboard_string_sequence(s) {
42
- this.comp.send_keyboard_string_sequence(s);
43
- }
44
- }
45
- /**
46
- * @hidden
47
- */
48
- class WindowAPI {
49
- constructor(impl) {
50
- this.impl = impl;
51
- }
52
- show() {
53
- this.impl.show();
54
- }
55
- hide() {
56
- this.impl.hide();
57
- }
58
- get is_visible() {
59
- return this.impl.get_is_visible();
60
- }
61
- get logical_position() {
62
- return this.impl.get_logical_position();
63
- }
64
- set logical_position(pos) {
65
- this.impl.set_logical_position(pos);
66
- }
67
- get physical_position() {
68
- return this.impl.get_physical_position();
69
- }
70
- set physical_position(pos) {
71
- this.impl.set_physical_position(pos);
72
- }
73
- get logical_size() {
74
- return this.impl.get_logical_size();
75
- }
76
- set logical_size(size) {
77
- this.impl.set_logical_size(size);
78
- }
79
- get physical_size() {
80
- return this.impl.get_physical_size();
81
- }
82
- set physical_size(size) {
83
- this.impl.set_physical_size(size);
84
- }
85
- }
86
- require.extensions['.60'] = require.extensions['.slint'] =
87
- function (module, filename) {
88
- var c = native.load(filename);
89
- module.exports[c.name().replace(/-/g, '_')] = function (init_properties) {
90
- let comp = c.create(init_properties);
91
- let ret = new Component(comp);
92
- c.properties().forEach((x) => {
93
- Object.defineProperty(ret, x.replace(/-/g, '_'), {
94
- get() { return comp.get_property(x); },
95
- set(newValue) { comp.set_property(x, newValue); },
96
- enumerable: true,
97
- });
98
- });
99
- c.callbacks().forEach((x) => {
100
- Object.defineProperty(ret, x.replace(/-/g, '_'), {
101
- get() {
102
- let callback = function () { return comp.invoke_callback(x, [...arguments]); };
103
- callback.setHandler = function (callback) { comp.connect_callback(x, callback); };
104
- return callback;
105
- },
106
- enumerable: true,
107
- });
108
- });
109
- return ret;
110
- };
111
- };
112
- /**
113
- * @hidden
114
- */
115
- class NullPeer {
116
- rowDataChanged(row) { }
117
- rowAdded(row, count) { }
118
- rowRemoved(row, count) { }
119
- reset() { }
120
- }
121
- /**
122
- * ArrayModel wraps a JavaScript array for use in `.slint` views. The underlying
123
- * array can be modified with the [[ArrayModel.push]] and [[ArrayModel.remove]] methods.
124
- */
125
- class ArrayModel {
126
- /**
127
- * Creates a new ArrayModel.
128
- *
129
- * @param arr
130
- */
131
- constructor(arr) {
132
- this.a = arr;
133
- this.notify = new NullPeer();
134
- }
135
- rowCount() {
136
- return this.a.length;
137
- }
138
- rowData(row) {
139
- return this.a[row];
140
- }
141
- setRowData(row, data) {
142
- this.a[row] = data;
143
- this.notify.rowDataChanged(row);
144
- }
145
- /**
146
- * Pushes new values to the array that's backing the model and notifies
147
- * the run-time about the added rows.
148
- * @param values
149
- */
150
- push(...values) {
151
- let size = this.a.length;
152
- Array.prototype.push.apply(this.a, values);
153
- this.notify.rowAdded(size, arguments.length);
154
- }
155
- // FIXME: should this be named splice and have the splice api?
156
- /**
157
- * Removes the specified number of element from the array that's backing
158
- * the model, starting at the specified index. This is equivalent to calling
159
- * Array.slice() on the array and notifying the run-time about the removed
160
- * rows.
161
- * @param index
162
- * @param size
163
- */
164
- remove(index, size) {
165
- let r = this.a.splice(index, size);
166
- this.notify.rowRemoved(index, size);
167
- }
168
- get length() {
169
- return this.a.length;
170
- }
171
- values() {
172
- return this.a.values();
173
- }
174
- entries() {
175
- return this.a.entries();
176
- }
177
- }
178
- module.exports = {
179
- private_api: native,
180
- ArrayModel: ArrayModel,
181
- Timer: {
182
- singleShot: native.singleshot_timer,
183
- },
184
- };