slint-ui 1.9.0-nightly.2024101621 → 1.9.0-nightly.2024101718
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,14 +41,15 @@ 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 = "
|
|
45
|
-
i-slint-core = { features = ["default", "gettext-rs"] , git = "https://github.com/slint-ui/slint", rev = "
|
|
46
|
-
i-slint-backend-selector = { git = "https://github.com/slint-ui/slint", rev = "
|
|
47
|
-
slint-interpreter = { default-features = false , features = ["display-diagnostics", "internal", "compat-1-2"] , git = "https://github.com/slint-ui/slint", rev = "
|
|
44
|
+
i-slint-compiler = { features = ["default"] , git = "https://github.com/slint-ui/slint", rev = "617dc19f8ebc9302d5d17ce3c0e6e27278bcbbb3", version = "=1.9.0", default-features = false }
|
|
45
|
+
i-slint-core = { features = ["default", "gettext-rs"] , git = "https://github.com/slint-ui/slint", rev = "617dc19f8ebc9302d5d17ce3c0e6e27278bcbbb3", version = "=1.9.0", default-features = false }
|
|
46
|
+
i-slint-backend-selector = { git = "https://github.com/slint-ui/slint", rev = "617dc19f8ebc9302d5d17ce3c0e6e27278bcbbb3", 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 = "617dc19f8ebc9302d5d17ce3c0e6e27278bcbbb3", 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" }
|
|
51
51
|
send_wrapper = { version = "0.6.0" }
|
|
52
|
+
smol_str = { version = "0.3.1" }
|
|
52
53
|
|
|
53
54
|
[build-dependencies]
|
|
54
55
|
napi-build = "2.1.0"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "slint-ui",
|
|
3
|
-
"version": "1.9.0-nightly.
|
|
3
|
+
"version": "1.9.0-nightly.2024101718",
|
|
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.
|
|
71
|
-
"@slint-ui/slint-ui-binary-darwin-x64": "1.9.0-nightly.
|
|
72
|
-
"@slint-ui/slint-ui-binary-darwin-arm64": "1.9.0-nightly.
|
|
73
|
-
"@slint-ui/slint-ui-binary-win32-x64-msvc": "1.9.0-nightly.
|
|
74
|
-
"@slint-ui/slint-ui-binary-win32-ia32-msvc": "1.9.0-nightly.
|
|
70
|
+
"@slint-ui/slint-ui-binary-linux-x64-gnu": "1.9.0-nightly.2024101718",
|
|
71
|
+
"@slint-ui/slint-ui-binary-darwin-x64": "1.9.0-nightly.2024101718",
|
|
72
|
+
"@slint-ui/slint-ui-binary-darwin-arm64": "1.9.0-nightly.2024101718",
|
|
73
|
+
"@slint-ui/slint-ui-binary-win32-x64-msvc": "1.9.0-nightly.2024101718",
|
|
74
|
+
"@slint-ui/slint-ui-binary-win32-ia32-msvc": "1.9.0-nightly.2024101718"
|
|
75
75
|
}
|
|
76
76
|
}
|
|
@@ -14,6 +14,7 @@ use napi::JsString;
|
|
|
14
14
|
use napi::JsUnknown;
|
|
15
15
|
use slint_interpreter::Compiler;
|
|
16
16
|
use slint_interpreter::Value;
|
|
17
|
+
use smol_str::StrExt;
|
|
17
18
|
use std::collections::HashMap;
|
|
18
19
|
use std::path::PathBuf;
|
|
19
20
|
|
|
@@ -147,14 +148,14 @@ impl JsComponentCompiler {
|
|
|
147
148
|
let mut o = env.create_object().ok()?;
|
|
148
149
|
|
|
149
150
|
for value in en.values.iter() {
|
|
150
|
-
let value = value.
|
|
151
|
+
let value = value.replace_smolstr("-", "_");
|
|
151
152
|
o.set_property(
|
|
152
153
|
env.create_string(&value).ok()?,
|
|
153
154
|
env.create_string(&value).ok()?.into_unknown(),
|
|
154
155
|
)
|
|
155
156
|
.ok()?;
|
|
156
157
|
}
|
|
157
|
-
return Some((en.name.
|
|
158
|
+
return Some((en.name.to_string(), o.into_unknown()));
|
|
158
159
|
}
|
|
159
160
|
_ => return None,
|
|
160
161
|
}
|
|
@@ -13,6 +13,7 @@ use napi::bindgen_prelude::*;
|
|
|
13
13
|
use napi::{Env, JsBoolean, JsNumber, JsObject, JsString, JsUnknown, Result};
|
|
14
14
|
use napi_derive::napi;
|
|
15
15
|
use slint_interpreter::Value;
|
|
16
|
+
use smol_str::SmolStr;
|
|
16
17
|
|
|
17
18
|
#[napi(js_name = "ValueType")]
|
|
18
19
|
pub enum JsValueType {
|
|
@@ -229,7 +230,7 @@ pub fn to_value(env: &Env, unknown: JsUnknown, typ: &Type) -> Result<Value> {
|
|
|
229
230
|
} else {
|
|
230
231
|
to_value(env, prop, pro_ty)?
|
|
231
232
|
};
|
|
232
|
-
Ok((pro_name.
|
|
233
|
+
Ok((pro_name.to_string(), prop_value))
|
|
233
234
|
})
|
|
234
235
|
.collect::<Result<_, _>>()?,
|
|
235
236
|
))
|
|
@@ -260,7 +261,7 @@ pub fn to_value(env: &Env, unknown: JsUnknown, typ: &Type) -> Result<Value> {
|
|
|
260
261
|
}
|
|
261
262
|
Type::Enumeration(e) => {
|
|
262
263
|
let js_string: JsString = unknown.try_into()?;
|
|
263
|
-
let value:
|
|
264
|
+
let value: SmolStr = js_string.into_utf8()?.as_str()?.into();
|
|
264
265
|
|
|
265
266
|
if !e.values.contains(&value) {
|
|
266
267
|
return Err(napi::Error::from_reason(format!(
|
|
@@ -269,7 +270,7 @@ pub fn to_value(env: &Env, unknown: JsUnknown, typ: &Type) -> Result<Value> {
|
|
|
269
270
|
)));
|
|
270
271
|
}
|
|
271
272
|
|
|
272
|
-
Ok(Value::EnumerationValue(e.name.
|
|
273
|
+
Ok(Value::EnumerationValue(e.name.to_string(), value.to_string()))
|
|
273
274
|
}
|
|
274
275
|
Type::Invalid
|
|
275
276
|
| Type::Model
|