slint-ui 0.3.2 → 0.3.4

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/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Slint License
2
2
 
3
- Slint is available under either a [commercial license](LICENSES/LicenseRef-Slint-commercial.md)
4
- or [GNU GPLv3](LICENSES/GPL-3.0-only.txt), at your choice.
3
+ Slint is available under either a [proprietary license](LICENSES/LicenseRef-Slint-commercial.md)
4
+ or [GNU GPLv3](LICENSES/GPL-3.0-only.txt).
5
5
 
6
6
  Third party licenses listed in the `LICENSES` folder also apply to parts of the product.
@@ -43,9 +43,9 @@ The Licensed Software includes
43
43
  treaties. The Licensed Software is licensed, not sold.
44
44
 
45
45
  2. The Licensed Software may provide links to third Party libraries or code
46
- (collectively **Third Party Libraries**) to implement various functions.
47
- Third Party Libraries do not comprise part of the Licensed Software. In some
48
- cases, access to Third Party Libraries may be included along with the
46
+ (collectively **Third-Party Libraries**) to implement various functions.
47
+ Third-Party Libraries do not comprise part of the Licensed Software. In some
48
+ cases, access to Third-Party Libraries may be included along with the
49
49
  Licensed Software delivery as a convenience for development and testing
50
50
  only. You acknowledge:
51
51
 
@@ -54,7 +54,7 @@ The Licensed Software includes
54
54
 
55
55
  2. that distribution of any of the Licensed Software referencing any portion
56
56
  of a Third-Party Library may require appropriate licensing from such
57
- third parties. All such Third Party Libraries, along with applicable
57
+ third parties. All such Third-Party Libraries, along with applicable
58
58
  copyright notices and licenses, will be listed and made available to
59
59
  you.
60
60
 
@@ -67,89 +67,88 @@ The Licensed Software includes
67
67
 
68
68
  3. your contact details.
69
69
 
70
- In case of any changes or deviations to the information noted in the License
70
+ 4. In case of any changes or deviations to the information noted in the License
71
71
  Certificate, you are obliged to notify us in writing, not later than 7 days
72
- after any such change or deviation has occured.
72
+ after any such change or deviation has occurred.
73
73
 
74
- 4. The Term of this Agreement shall begin on the date mentioned in the License
74
+ 5. The Term of this Agreement shall begin on the date mentioned in the License
75
75
  Certificate (**Effective Date**) and shall continue unless terminated
76
76
  earlier as herein provided (**Term**).
77
77
 
78
- 5. New releases of the Licensed Software (**Updates**) will be made available
78
+ 6. New releases of the Licensed Software (**Updates**) will be made available
79
79
  to you for the period (**Maintenance Period**) specified in the License
80
80
  Certificate. Such Updates may be bound by additional license terms. You
81
81
  consent to any such additional license terms, without which you may not
82
82
  install, copy, or otherwise use such Updates.
83
83
 
84
- 6. The Licensed Software is to be used exclusively with your software
84
+ 7. The Licensed Software is to be used exclusively with your software
85
85
  products (**Products**) specified in the License Certificate.
86
86
 
87
- 7. We grant you a perpetual, non-exclusive, non-transferable right to use the
87
+ 8. We grant you a perpetual, non-exclusive, non-transferable right to use the
88
88
  Licensed Software, including making modifications, for the sole purposes of
89
89
  designing, developing, and testing your Products during the Term. The number
90
- of **Users** using the Licensed Software to design, develop and test your
90
+ of **Users** using the Licensed Software to design, develop, and test your
91
91
  Products is limited to the amount of **User Seats** specified in the License
92
92
  Certificate. For clarity, each unique User is counted as one User Seat.
93
93
 
94
- 8. We grant you a perpetual, non-exclusive, non-transferable right to reproduce
94
+ 9. We grant you a perpetual, non-exclusive, non-transferable right to reproduce
95
95
  and distribute the object code form of the Licensed Software, including any
96
96
  modifications made to the Licensed Software, during the Term. Such
97
- distributions is permitted only with your Products and limited to the amount
97
+ distributions are permitted only with your Products and limited to the number
98
98
  of **Distributions** specified in the License Certificate.
99
99
 
100
- 9. The license grants are conditional on the full and timely payment of all
100
+ 10. The license grants are conditional on the full and timely payment of all
101
101
  applicable **Fees**; if said Fees are not paid in full and by their due
102
102
  date, the license shall not be granted and your Products shall be deemed as
103
103
  made in breach of the Agreement ex tunc.
104
104
 
105
- 10. Clause 9 above shall not apply if the license has been granted to you under
105
+ 11. Clause 10 above shall not apply if the license has been granted to you under
106
106
  the **Ambassador** program. Instead, the license grants shall be conditional
107
- on the fullfilment of the obligations as specified herein. If said
107
+ on the fulfillment of the obligations as specified herein. If said
108
108
  obligations are not fulfilled, the license shall not be granted and your
109
109
  Products shall be deemed as made in breach of the Agreement ex tunc. The
110
110
  obligations are as follows:
111
111
 
112
- 1. Showcase: You grant us the right to use your name, logo and your
112
+ 1. Showcase: You grant us the right to use your name, logo, and your
113
113
  Products in our marketing materials,
114
114
 
115
- 2. Spread the word: You will include reasonably visible notices in the
116
- documentation, marketing materials and social media channels related to
117
- your Products that such were built with the Licensed Software,
115
+ 2. Spread the word: You will include visible notices in the documentation,
116
+ marketing materials, and social media channels related to your Products
117
+ that such were built with the Licensed Software,
118
118
 
119
- 3. Give feedback: You agree to provide relevant feedback that would
120
- help us improve the Licensed Software. We may use any such
121
- feedback in testimonials.
119
+ 3. Give feedback: You agree to provide feedback that would help us improve
120
+ the Licensed Software. We may use any such feedback in testimonials.
122
121
 
123
- 11. The Fees and any other charges under this Agreement shall be paid by
122
+ 12. The Fees and any other charges under this Agreement shall be paid by
124
123
  you no later than thirty (30) days from the date of the applicable
125
- invoice from us. A late payment charge of the lower of (a) one percent
126
- per month; or (b) the interest rate stipulated by applicable law, shall be
127
- charged on any unpaid balances that remain past due and which have not been
128
- disputed by you in good faith.
124
+ invoice from us. A late payment charge of five percent per month over and
125
+ above the interest rate stipulated by applicable law shall be charged on any
126
+ unpaid balances that remain past due and which have not been disputed by you
127
+ in good faith.
129
128
 
130
- 12. The Fees and any other charges payable under this Agreement are gross
129
+ 13. The Fees and any other charges payable under this Agreement are gross
131
130
  amounts but exclusive of any value added tax, use tax, sales tax,
132
131
  withholding tax and other taxes, duties or tariffs levied directly for the
133
- sale, delivery or use of the Licensed Software pursuant to any applicable
132
+ sale, delivery, or use of the Licensed Software pursuant to any applicable
134
133
  law.
135
134
 
136
- 13. The Parties also agree to all of the following conditions:
135
+ 14. The Parties also agree to all the following conditions:
137
136
 
138
- 1. You may not remove or alter any copyright, trademark or other
137
+ 1. You may not remove or alter any copyright, trademark, or other
139
138
  proprietary rights notice contained in any portion of the Licensed
140
139
  Software,
141
140
 
142
141
  2. Your Products may not compete with the Licensed Software,
143
142
 
144
- 3. You will indemnify and hold us, our affiliated companies and our
143
+ 3. You will indemnify and hold us, our affiliated companies, and our
145
144
  suppliers, harmless from and against any claims or liabilities
146
- arising out of the use, reproduction or distribution of your
147
- Products, except as set out in clause 13.4. immediately below,
145
+ arising out of the use, reproduction, or distribution of your
146
+ Products, except as set out in clause 14.4. immediately below,
148
147
 
149
148
  4. We shall indemnify and hold you harmless from and against any
150
149
  claims from third parties alleging that the use of the Licensed Software
151
150
  as set out in this Agreement infringes or will infringe such third
152
- parties intellectual property rights or other rights,
151
+ parties' intellectual property rights or other rights,
153
152
 
154
153
  5. A Party shall promptly notify the other Party if it receives a claim that
155
154
  the other Party shall or may be obliged to indemnify. The Parties shall
@@ -169,17 +168,17 @@ The Licensed Software includes
169
168
  the indemnifying Party, such consent not to be unreasonably withheld or
170
169
  delayed.
171
170
 
172
- 14. The Licensed Software is licensed to you "as is". To the maximum extent
171
+ 15. The Licensed Software is licensed to you "as is". To the maximum extent
173
172
  permitted by applicable law, we on behalf of us and our suppliers,
174
173
  disclaim all warranties and conditions, either express or implied,
175
174
  including, but not limited to, any implied warranties of merchantability or
176
- fitness for a particular purpose, title and non-infringement with regard to
175
+ fitness for a particular purpose, title, and non-infringement with regard to
177
176
  the Licensed Software. The warranty disclaimer in the foregoing
178
177
  notwithstanding, you may have specific legal rights which may vary from
179
178
  state/jurisdiction to state/jurisdiction; as far as legally permissible, you
180
179
  waive any such legal rights vis-à-vis us.
181
180
 
182
- 15. We shall not under any circumstances be liable to you based on failure of
181
+ 16. We shall not under any circumstances be liable to you based on failure of
183
182
  the Licensed Software if the failure resulted from your changing of the
184
183
  Licensed Software, from your accident, abuse or misapplication, nor shall
185
184
  we except in case of gross negligence or willful misconduct be
@@ -188,7 +187,7 @@ The Licensed Software includes
188
187
  nor shall any award of damages exceed the total amount you paid to us in
189
188
  connection with this Agreement.
190
189
 
191
- 16. Each Party shall hold Confidential Information of the other Party, its
190
+ 17. Each Party shall hold Confidential Information of the other Party, its
192
191
  customers, and licensors in confidence, and without written permission from
193
192
  will not disclose to any person or use for its own benefit, any such
194
193
  information. **Confidential Information** includes without limitation the
@@ -200,7 +199,7 @@ The Licensed Software includes
200
199
  licensors, or customers as proprietary or confidential, or which would
201
200
  reasonably be understood under the circumstances to be confidential. All
202
201
  Confidential Information shall remain the sole property of each respective
203
- Party. Information will not be considered to be Confidential Information if
202
+ Party. Information will not be considered as Confidential Information if
204
203
 
205
204
  1. available to the public other than by a breach of this Agreement;
206
205
 
@@ -220,21 +219,20 @@ The Licensed Software includes
220
219
  remedies available, each Party shall be entitled to enforcement of such
221
220
  obligations by court injunction.
222
221
 
223
- 17. During the Term, an independent, certified auditor on our behalf, may, upon
222
+ 18. During the Term, an independent, certified auditor on our behalf, may, upon
224
223
  its reasonable request, with 30 (thirty) days written notice, and at its
225
224
  sole expense, examine your books and records solely with respect to your use
226
225
  of the Licensed Software. Any such audit shall be conducted during regular
227
226
  business hours at your facilities and shall not unreasonably interfere with
228
227
  your business activities. Our auditor shall not remove, copy, or
229
- redistribute any electronic material during the course of an audit. If an
230
- audit reveals that you are using the Licensed Software in a way that is in
231
- material violation of the terms of this Agreement, then you shall pay us
232
- reasonable costs of conducting the audit. Our auditor shall only be allowed
233
- to report violations of the terms of this Agreement, with a copy to you. You
234
- shall be provided the right to provide comments to the report before it is
235
- finalized.
236
-
237
- 18. If you materially breach this Agreement, we will provide a 60 (sixty) days
228
+ redistribute any electronic material during an audit. If an audit reveals that
229
+ you are using the Licensed Software in a way that is in material violation
230
+ of the terms of this Agreement, then you shall pay us reasonable costs of
231
+ conducting the audit. Our auditor shall only be allowed to report violations
232
+ of the terms of this Agreement, with a copy to you. You shall be provided
233
+ the right to provide comments to the report before it is finalized.
234
+
235
+ 19. If you materially breach this Agreement, we will provide a 60 (sixty) days
238
236
  written notice to you during which any such breach(es) may be cured, failing
239
237
  which we will terminate the agreement. You undertake to pay a contractual
240
238
  penalty for each case of negligent breach of this Agreement of EUR 10000
@@ -243,32 +241,32 @@ The Licensed Software includes
243
241
  other claims. The amount of contractual penalty shall be offset against
244
242
  claims for damages, if any.
245
243
 
246
- 19. You may terminate this Agreement at any time for any reason upon 90 (ninety)
244
+ 20. You may terminate this Agreement at any time for any reason upon 90 (ninety)
247
245
  days notice to us and upon payment of all applicable fees and contractual
248
246
  penalties, if any, in connection with the use of the Licensed Software.
249
247
 
250
- 20. Both Parties shall comply with all applicable laws and regulations relating
248
+ 21. Both Parties shall comply with all applicable laws and regulations relating
251
249
  to the Licensed Software in the countries in which the Parties use or modify
252
250
  the Licensed Software.
253
251
 
254
- 21. All notices and communications between the Parties shall be in writing and
252
+ 22. All notices and communications between the Parties shall be in writing and
255
253
  shall be deemed given when received. For avoidance of doubt, email is
256
254
  considered a written form of communication.
257
255
 
258
- 22. This Agreement shall be construed, interpreted and governed by the laws of
256
+ 23. This Agreement shall be construed, interpreted, and governed by the laws of
259
257
  the Federal Republic of Germany.
260
258
 
261
- 23. No term or condition contained in your purchase order will apply unless
259
+ 24. No term or condition contained in your purchase order will apply unless
262
260
  expressly accepted by us in writing.
263
261
 
264
- 24. You may assign this Agreement, in whole or in part (whether by operation of
262
+ 25. You may assign this Agreement, in whole or in part (whether by operation of
265
263
  law or otherwise), with prior consent from us, which shall not be
266
264
  unreasonably withheld or delayed. We may assign this Agreement or any of its
267
265
  rights hereunder or delegate any of its obligations hereunder with prior
268
266
  notice to you. Any attempt to assign this Agreement other than in accordance
269
267
  with this provision shall be null and void.
270
268
 
271
- 25. This Agreement constitutes the complete agreement between the Parties and
269
+ 26. This Agreement constitutes the complete agreement between the Parties and
272
270
  supersedes all prior or contemporaneous discussions, representations, and
273
271
  proposals, written or oral, with respect to the subject matters discussed
274
272
  herein. No modification of this Agreement will be effective unless contained
@@ -0,0 +1,172 @@
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 ADDED
@@ -0,0 +1,184 @@
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
+ };
package/native/Cargo.toml CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  [package]
5
5
  name = "slint-node"
6
- version = "0.3.2"
6
+ version = "0.3.4"
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.2"}
24
- i-slint-core = { version = "=0.3.2"}
25
- slint-interpreter = { version = "=0.3.2", features = ["display-diagnostics"] }
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"] }
26
26
 
27
27
  vtable = { version = "0.1.6"}
28
28
 
package/native/lib.rs CHANGED
@@ -422,7 +422,7 @@ declare_types! {
422
422
  };
423
423
 
424
424
  let res = run_scoped(&mut cx,this.downcast().unwrap(), || {
425
- component.invoke_callback(callback_name.as_str(), args.as_slice())
425
+ component.invoke(callback_name.as_str(), args.as_slice())
426
426
  .map_err(|_| "Cannot emit callback".to_string())
427
427
  })?;
428
428
  to_js_value(res, &mut cx, &persistent_context)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "slint-ui",
3
- "version": "0.3.2",
3
+ "version": "0.3.4",
4
4
  "homepage": "https://github.com/slint-ui/slint",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "repository": {