slint-ui 1.9.0-nightly.2024102609 → 1.9.0-nightly.2024102921

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 CHANGED
@@ -41,10 +41,10 @@ accessibility = ["slint-interpreter/accessibility"]
41
41
  [dependencies]
42
42
  napi = { version = "2.14.0", default-features = false, features = ["napi8"] }
43
43
  napi-derive = "2.14.0"
44
- i-slint-compiler = { features = ["default"] , git = "https://github.com/slint-ui/slint", rev = "e01a121165c24e96dbf37644f9c6cfc319582f18", version = "=1.9.0", default-features = false }
45
- i-slint-core = { features = ["default", "gettext-rs"] , git = "https://github.com/slint-ui/slint", rev = "e01a121165c24e96dbf37644f9c6cfc319582f18", version = "=1.9.0", default-features = false }
46
- i-slint-backend-selector = { git = "https://github.com/slint-ui/slint", rev = "e01a121165c24e96dbf37644f9c6cfc319582f18", version = "=1.9.0", default-features = false }
47
- slint-interpreter = { default-features = false , features = ["display-diagnostics", "internal", "compat-1-2"] , git = "https://github.com/slint-ui/slint", rev = "e01a121165c24e96dbf37644f9c6cfc319582f18", version = "=1.9.0"}
44
+ i-slint-compiler = { features = ["default"] , git = "https://github.com/slint-ui/slint", rev = "d00655b05962adae3559778c05c7e2e81aa4e9f7", version = "=1.9.0", default-features = false }
45
+ i-slint-core = { features = ["default", "gettext-rs"] , git = "https://github.com/slint-ui/slint", rev = "d00655b05962adae3559778c05c7e2e81aa4e9f7", version = "=1.9.0", default-features = false }
46
+ i-slint-backend-selector = { git = "https://github.com/slint-ui/slint", rev = "d00655b05962adae3559778c05c7e2e81aa4e9f7", version = "=1.9.0", default-features = false }
47
+ slint-interpreter = { default-features = false , features = ["display-diagnostics", "internal", "compat-1-2"] , git = "https://github.com/slint-ui/slint", rev = "d00655b05962adae3559778c05c7e2e81aa4e9f7", version = "=1.9.0"}
48
48
  spin_on = { version = "0.1" }
49
49
  css-color-parser2 = { version = "1.0.1" }
50
50
  itertools = { version = "0.13" }
@@ -1,6 +1,6 @@
1
1
  # Slint Software License
2
2
 
3
- Version 3.0
3
+ Version 3.0.1
4
4
 
5
5
  ## Preamble
6
6
 
@@ -24,18 +24,12 @@ Desktop Application, Mobile Application, and Web Application are hereafter refer
24
24
 
25
25
  The grant of rights in section 1 are conditional, provided that You do all of the following:
26
26
 
27
- (a) You have purchased an appropriate **Pricing Plan** (*Startup & Individual* / *Small Enterprise* / *Enterprise*) and the required amount of seats to cover all individual users of the Software associated with the designing, developing, or testing your Application or Embedded System. For clarity, each individual user is counted as one seat.
27
+ (a) You have purchased an appropriate **Paid License Plan** ([see Annex 1](#annex-1-paid-license-plans)) and the required amount of seats to cover all individual users of the Software associated with the designing, developing, or testing your Application or Embedded System. For clarity, each individual user is counted as one seat.
28
28
 
29
29
  (b) In the case that You are distributing the Software as as part of an Embedded System, You have purchased an appropriate quantity of **Royalties**, one Royalty for each Embedded System.
30
30
 
31
31
  (c) You have fully paid all applicable fees (**Fees**) pursuant to Section 6.
32
32
 
33
- *Startup & Individual Plan* is limited to individuals as well as individual companies with a staff headcount of less than 10 with either turnover or balance sheet of 2MEUR or less.
34
-
35
- *Small Enterprise Plan* is limited to individual companies with a staff headcount of less than 50 with either turnover or balance sheet of 10MEUR or less.
36
-
37
- *Enterprise Plan* is available to all individuals and individual companies.
38
-
39
33
  ## 3. Limitations
40
34
 
41
35
  The License does not permit to distribute or make the Software publicly available alone and without integration into an Application or into an Embedded System. For this purpose you may use the Software under the GNU General Public License, version 3.
@@ -87,3 +81,41 @@ In the event that any provision of this License will, for any reason, be determi
87
81
  ## 10. Governing Law
88
82
 
89
83
  This Agreement shall be construed, interpreted, and governed by the laws of the Federal Republic of Germany.
84
+
85
+ ## Annex 1: Paid License Plans
86
+
87
+ ### Enterprise Plan
88
+
89
+ The following is included as part of the plan
90
+
91
+ (a) No restriction on the number of applications that are developed with Slint.
92
+
93
+ (b) Live Preview.
94
+
95
+ (c) Standard Support that includes addressing technical queries, troubleshooting, and rectifying bugs or errors (faults) present in the latest official stable release.
96
+
97
+ (d) Perpetual Fallback License that allows continued use of a specific Slint version, including all bugfix updates (i.e., all Z releases within the X.Y.Z version), without an active subscription. This license applies only to those versions of Slint for which at least 12 consecutive months of subscription have been paid.
98
+
99
+ (e) GUI Test Framework.
100
+
101
+ ### Small Enterprise Plan
102
+
103
+ This plan is limited to individual companies with a staff headcount between 10 and 50 and either a turnover or balance sheet total of 10 million EUR or less.
104
+
105
+ The following is included as part of the plan
106
+
107
+ (a) No restriction on the number of applications that are developed with Slint.
108
+
109
+ (b) Live Preview.
110
+
111
+ (c) Standard Support that includes addressing technical queries, troubleshooting, and rectifying bugs or errors (faults) present in the latest official stable release.
112
+
113
+ ### Startup & Individual Plan
114
+
115
+ This plan is limited to individuals and individual companies with a staff headcount of less than 10 and either a turnover or balance sheet total of 2 million EUR or less.
116
+
117
+ The following is included as part of the plan
118
+
119
+ (a) No restriction on the number of applications that are developed with Slint.
120
+
121
+ (b) Live Preview.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "slint-ui",
3
- "version": "1.9.0-nightly.2024102609",
3
+ "version": "1.9.0-nightly.2024102921",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "homepage": "https://github.com/slint-ui/slint",
@@ -67,10 +67,10 @@
67
67
  "@napi-rs/cli": "2.16.5"
68
68
  },
69
69
  "optionalDependencies": {
70
- "@slint-ui/slint-ui-binary-linux-x64-gnu": "1.9.0-nightly.2024102609",
71
- "@slint-ui/slint-ui-binary-darwin-x64": "1.9.0-nightly.2024102609",
72
- "@slint-ui/slint-ui-binary-darwin-arm64": "1.9.0-nightly.2024102609",
73
- "@slint-ui/slint-ui-binary-win32-x64-msvc": "1.9.0-nightly.2024102609",
74
- "@slint-ui/slint-ui-binary-win32-ia32-msvc": "1.9.0-nightly.2024102609"
70
+ "@slint-ui/slint-ui-binary-linux-x64-gnu": "1.9.0-nightly.2024102921",
71
+ "@slint-ui/slint-ui-binary-darwin-x64": "1.9.0-nightly.2024102921",
72
+ "@slint-ui/slint-ui-binary-darwin-arm64": "1.9.0-nightly.2024102921",
73
+ "@slint-ui/slint-ui-binary-win32-x64-msvc": "1.9.0-nightly.2024102921",
74
+ "@slint-ui/slint-ui-binary-win32-ia32-msvc": "1.9.0-nightly.2024102921"
75
75
  }
76
76
  }
@@ -114,10 +114,11 @@ impl JsComponentCompiler {
114
114
  pub fn structs(&self, env: Env) -> HashMap<String, JsUnknown> {
115
115
  fn convert_type(env: &Env, ty: &Type) -> Option<(String, JsUnknown)> {
116
116
  match ty {
117
- Type::Struct { fields, name: Some(name), node: Some(_), .. } => {
117
+ Type::Struct(s) if s.name.is_some() && s.node.is_some() => {
118
+ let name = s.name.as_ref().unwrap();
118
119
  let struct_instance = to_js_unknown(
119
120
  env,
120
- &Value::Struct(slint_interpreter::Struct::from_iter(fields.iter().map(
121
+ &Value::Struct(slint_interpreter::Struct::from_iter(s.fields.iter().map(
121
122
  |(name, field_type)| {
122
123
  (
123
124
  name.to_string(),
@@ -133,10 +133,10 @@ impl JsComponentInstance {
133
133
  ))
134
134
  })?;
135
135
 
136
- if let Type::Callback { return_type, .. } = ty {
136
+ if let Type::Callback(callback) = ty {
137
137
  self.inner
138
138
  .set_callback(callback_name.as_str(), {
139
- let return_type = return_type.clone();
139
+ let return_type = callback.return_type.clone();
140
140
  let callback_name = callback_name.clone();
141
141
 
142
142
  move |args| {
@@ -160,18 +160,13 @@ impl JsComponentInstance {
160
160
  }
161
161
  };
162
162
 
163
- if let Some(return_type) = &return_type {
164
- if let Ok(value) = super::to_value(&env, result, return_type) {
165
- return value;
166
- } else {
167
- eprintln!(
168
- "Node.js: cannot convert return type of callback {}",
169
- callback_name
170
- );
171
- return slint_interpreter::default_value_for_type(return_type);
172
- }
173
- } else {
163
+ if matches!(return_type, Type::Void) {
174
164
  Value::Void
165
+ } else if let Ok(value) = super::to_value(&env, result, &return_type) {
166
+ return value;
167
+ } else {
168
+ eprintln!("Node.js: cannot convert return type of callback {callback_name}");
169
+ return slint_interpreter::default_value_for_type(&return_type);
175
170
  }
176
171
  }
177
172
  })
@@ -206,10 +201,10 @@ impl JsComponentInstance {
206
201
  ))
207
202
  })?;
208
203
 
209
- if let Type::Callback { return_type, .. } = ty {
204
+ if let Type::Callback(callback) = ty {
210
205
  self.inner
211
206
  .set_global_callback(global_name.as_str(), callback_name.as_str(), {
212
- let return_type = return_type.clone();
207
+ let return_type = callback.return_type.clone();
213
208
  let global_name = global_name.clone();
214
209
  let callback_name = callback_name.clone();
215
210
 
@@ -237,18 +232,13 @@ impl JsComponentInstance {
237
232
  }
238
233
  };
239
234
 
240
- if let Some(return_type) = &return_type {
241
- if let Ok(value) = super::to_value(&env, result, return_type) {
242
- return value;
243
- } else {
244
- eprintln!(
245
- "Node.js: cannot convert return type of callback {}",
246
- callback_name
247
- );
248
- return slint_interpreter::default_value_for_type(return_type);
249
- }
250
- } else {
235
+ if matches!(return_type, Type::Void) {
251
236
  Value::Void
237
+ } else if let Ok(value) = super::to_value(&env, result, &return_type) {
238
+ return value;
239
+ } else {
240
+ eprintln!("Node.js: cannot convert return type of callback {callback_name}");
241
+ return slint_interpreter::default_value_for_type(&return_type);
252
242
  }
253
243
  }
254
244
  })
@@ -260,6 +250,32 @@ impl JsComponentInstance {
260
250
  Err(napi::Error::from_reason(format!("{} is not a callback", callback_name).as_str()))
261
251
  }
262
252
 
253
+ fn invoke_args(
254
+ env: Env,
255
+ callback_name: &String,
256
+ arguments: Vec<JsUnknown>,
257
+ args: &Vec<Type>,
258
+ ) -> Result<Vec<Value>> {
259
+ let count = args.len();
260
+ let args = arguments
261
+ .into_iter()
262
+ .zip(args.into_iter())
263
+ .map(|(a, ty)| super::value::to_value(&env, a, &ty))
264
+ .collect::<Result<Vec<_>, _>>()?;
265
+ if args.len() != count {
266
+ return Err(napi::Error::from_reason(
267
+ format!(
268
+ "{} expect {} arguments, but {} where provided",
269
+ callback_name,
270
+ count,
271
+ args.len()
272
+ )
273
+ .as_str(),
274
+ ));
275
+ }
276
+ Ok(args)
277
+ }
278
+
263
279
  #[napi]
264
280
  pub fn invoke(
265
281
  &self,
@@ -280,25 +296,8 @@ impl JsComponentInstance {
280
296
  })?;
281
297
 
282
298
  let args = match ty {
283
- Type::Callback { args, .. } | Type::Function { args, .. } => {
284
- let count = args.len();
285
- let args = arguments
286
- .into_iter()
287
- .zip(args.into_iter())
288
- .map(|(a, ty)| super::value::to_value(&env, a, &ty))
289
- .collect::<Result<Vec<_>, _>>()?;
290
- if args.len() != count {
291
- return Err(napi::Error::from_reason(
292
- format!(
293
- "{} expect {} arguments, but {} where provided",
294
- callback_name,
295
- count,
296
- args.len()
297
- )
298
- .as_str(),
299
- ));
300
- }
301
- args
299
+ Type::Callback(function) | Type::Function(function) => {
300
+ Self::invoke_args(env, &callback_name, arguments, &function.args)?
302
301
  }
303
302
  _ => {
304
303
  return Err(napi::Error::from_reason(
@@ -340,25 +339,8 @@ impl JsComponentInstance {
340
339
  })?;
341
340
 
342
341
  let args = match ty {
343
- Type::Callback { args, .. } | Type::Function { args, .. } => {
344
- let count = args.len();
345
- let args = arguments
346
- .into_iter()
347
- .zip(args.into_iter())
348
- .map(|(a, ty)| super::value::to_value(&env, a, &ty))
349
- .collect::<Result<Vec<_>, _>>()?;
350
- if args.len() != count {
351
- return Err(napi::Error::from_reason(
352
- format!(
353
- "{} expect {} arguments, but {} where provided",
354
- callback_name,
355
- count,
356
- args.len()
357
- )
358
- .as_str(),
359
- ));
360
- }
361
- args
342
+ Type::Callback(function) | Type::Function(function) => {
343
+ Self::invoke_args(env, &callback_name, arguments, &function.args)?
362
344
  }
363
345
  _ => {
364
346
  return Err(napi::Error::from_reason(
@@ -216,11 +216,11 @@ pub fn to_value(env: &Env, unknown: JsUnknown, typ: &Type) -> Result<Value> {
216
216
  Ok(Value::Image(Image::from_rgba8(pixel_buffer)))
217
217
  }
218
218
  }
219
- Type::Struct { fields, name: _, node: _, rust_attributes: _ } => {
219
+ Type::Struct(s) => {
220
220
  let js_object = unknown.coerce_to_object()?;
221
221
 
222
222
  Ok(Value::Struct(
223
- fields
223
+ s.fields
224
224
  .iter()
225
225
  .map(|(pro_name, pro_ty)| {
226
226
  let prop: JsUnknown = js_object