Skip to content

Commit de4e195

Browse files
committed
Rename internal crates and add a README.md to them
The README.md contains the warning that used to be in lib.rs. Add README.md files to all internal crates ... pointing to the official public crate to use instead. Rename internal crates fixup: README files fixup rename
1 parent c245c0f commit de4e195

File tree

124 files changed

+868
-997
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

124 files changed

+868
-997
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ jobs:
8181
uses: actions-rs/cargo@v1
8282
with:
8383
command: build
84-
args: --verbose --all-features --workspace --exclude slint-backend-mcu-internal # mcu backend requires nightly
84+
args: --verbose --all-features --workspace --exclude i-slint-backend-mcu # mcu backend requires nightly
8585
- name: Run tests
8686
uses: actions-rs/cargo@v1
8787
with:

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ members = [
3030
'internal/backends/testing',
3131
'internal/common',
3232
'internal/compiler',
33-
'internal/compiler/parser_test_macro',
33+
'internal/compiler/parser-test-macro',
3434
'internal/core',
3535
'internal/core-macros',
3636
'internal/interpreter',

api/cpp/Cargo.toml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,20 @@ crate-type = ["lib", "cdylib"]
2222
# Note, these features need to be kept in sync (along with their defaults) in
2323
# the C++ crate's CMakeLists.txt
2424
[features]
25-
backend-gl = ["slint-backend-selector-internal/slint-backend-gl-internal"]
26-
backend-qt = ["slint-backend-selector-internal/slint-backend-qt-internal"]
25+
backend-gl = ["i-slint-backend-selector/i-slint-backend-gl"]
26+
backend-qt = ["i-slint-backend-selector/i-slint-backend-qt"]
2727
interpreter = ["slint-interpreter"]
28-
testing = ["slint-backend-testing-internal"] # Enable some function used by the integration tests
29-
wayland = ["slint-backend-selector-internal/wayland"]
30-
x11 = ["slint-backend-selector-internal/x11"]
28+
testing = ["i-slint-backend-testing"] # Enable some function used by the integration tests
29+
wayland = ["i-slint-backend-selector/wayland"]
30+
x11 = ["i-slint-backend-selector/x11"]
3131

3232
default = ["backend-gl", "x11", "backend-qt"]
3333

3434
[dependencies]
35-
slint-core-internal = { version = "=0.2.0", path="../../internal/core", features = ["ffi"] }
35+
i-slint-backend-selector = { version = "=0.2.0", path="../../internal/backends/selector" }
36+
i-slint-backend-testing = { version = "=0.2.0", path="../../internal/backends/testing", optional = true }
37+
i-slint-core = { version = "=0.2.0", path="../../internal/core", features = ["ffi"] }
3638
slint-interpreter = { version = "=0.2.0", path="../../internal/interpreter", default-features = false, features = ["ffi", "compat-0-2-0"], optional = true }
37-
slint-backend-selector-internal = { version = "=0.2.0", path="../../internal/backends/selector" }
38-
slint-backend-testing-internal = { version = "=0.2.0", path="../../internal/backends/testing", optional = true }
3939

4040
[build-dependencies]
4141
anyhow = "1.0"

api/cpp/lib.rs

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@
44
/*! This crate just expose the function used by the C++ integration */
55

66
use core::ffi::c_void;
7-
use slint_backend_selector_internal::backend;
8-
use slint_core_internal::window::ffi::WindowRcOpaque;
9-
use slint_core_internal::window::WindowRc;
7+
use i_slint_backend_selector::backend;
8+
use i_slint_core::window::ffi::WindowRcOpaque;
9+
use i_slint_core::window::WindowRc;
1010

1111
#[doc(hidden)]
1212
#[cold]
1313
pub fn use_modules() -> usize {
1414
#[cfg(feature = "slint-interpreter")]
1515
slint_interpreter::use_modules();
16-
slint_backend_selector_internal::use_modules();
17-
slint_core_internal::use_modules()
16+
i_slint_backend_selector::use_modules();
17+
i_slint_core::use_modules()
1818
}
1919

2020
#[no_mangle]
@@ -25,9 +25,8 @@ pub unsafe extern "C" fn slint_windowrc_init(out: *mut WindowRcOpaque) {
2525

2626
#[no_mangle]
2727
pub unsafe extern "C" fn slint_run_event_loop() {
28-
crate::backend().run_event_loop(
29-
slint_core_internal::backend::EventLoopQuitBehavior::QuitOnLastWindowClosed,
30-
);
28+
crate::backend()
29+
.run_event_loop(i_slint_core::backend::EventLoopQuitBehavior::QuitOnLastWindowClosed);
3130
}
3231

3332
/// Will execute the given functor in the main thread
@@ -64,8 +63,8 @@ pub unsafe extern "C" fn slint_quit_event_loop() {
6463

6564
#[no_mangle]
6665
pub unsafe extern "C" fn slint_register_font_from_path(
67-
path: &slint_core_internal::SharedString,
68-
error_str: *mut slint_core_internal::SharedString,
66+
path: &i_slint_core::SharedString,
67+
error_str: *mut i_slint_core::SharedString,
6968
) {
7069
core::ptr::write(
7170
error_str,
@@ -78,8 +77,8 @@ pub unsafe extern "C" fn slint_register_font_from_path(
7877

7978
#[no_mangle]
8079
pub unsafe extern "C" fn slint_register_font_from_data(
81-
data: slint_core_internal::slice::Slice<'static, u8>,
82-
error_str: *mut slint_core_internal::SharedString,
80+
data: i_slint_core::slice::Slice<'static, u8>,
81+
error_str: *mut i_slint_core::SharedString,
8382
) {
8483
core::ptr::write(
8584
error_str,
@@ -93,5 +92,5 @@ pub unsafe extern "C" fn slint_register_font_from_data(
9392
#[cfg(feature = "testing")]
9493
#[no_mangle]
9594
pub unsafe extern "C" fn slint_testing_init_backend() {
96-
slint_backend_testing_internal::init();
95+
i_slint_backend_testing::init();
9796
}

api/node/native/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ crate-type = ["cdylib"]
2020
name = "slint_node_native"
2121

2222
[dependencies]
23-
slint-compiler-internal = { version = "=0.2.0", path="../../../internal/compiler" }
24-
slint-core-internal = { version = "=0.2.0", path="../../../internal/core" }
23+
i-slint-compiler = { version = "=0.2.0", path="../../../internal/compiler" }
24+
i-slint-core = { version = "=0.2.0", path="../../../internal/core" }
2525
slint-interpreter = { version = "=0.2.0", path="../../../internal/interpreter", features = ["display-diagnostics"] }
2626

2727
vtable = { version = "0.1.1", path="../../../helper_crates/vtable" }

api/node/native/js_model.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
// Copyright © SixtyFPS GmbH <[email protected]>
22
// SPDX-License-Identifier: (GPL-3.0-only OR LicenseRef-SixtyFPS-commercial)
33

4+
use i_slint_compiler::langtype::Type;
5+
use i_slint_core::model::Model;
46
use neon::prelude::*;
5-
use slint_compiler_internal::langtype::Type;
6-
use slint_core_internal::model::Model;
77
use std::cell::Cell;
88
use std::rc::{Rc, Weak};
99

1010
/// Model coming from JS
1111
pub struct JsModel {
12-
notify: slint_core_internal::model::ModelNotify,
12+
notify: i_slint_core::model::ModelNotify,
1313
/// The index of the value in the PersistentContext
1414
value_index: u32,
1515
data_type: Type,
@@ -87,7 +87,7 @@ impl Model for JsModel {
8787
}
8888
}
8989

90-
fn model_tracker(&self) -> &dyn slint_core_internal::model::ModelTracker {
90+
fn model_tracker(&self) -> &dyn i_slint_core::model::ModelTracker {
9191
&self.notify
9292
}
9393

api/node/native/lib.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@
22
// SPDX-License-Identifier: (GPL-3.0-only OR LicenseRef-SixtyFPS-commercial)
33

44
use core::cell::RefCell;
5+
use i_slint_compiler::langtype::Type;
6+
use i_slint_core::model::{Model, ModelRc};
7+
use i_slint_core::window::WindowHandleAccess;
8+
use i_slint_core::{ImageInner, SharedVector};
59
use neon::prelude::*;
610
use rand::RngCore;
7-
use slint_compiler_internal::langtype::Type;
8-
use slint_core_internal::model::{Model, ModelRc};
9-
use slint_core_internal::window::WindowHandleAccess;
10-
use slint_core_internal::{ImageInner, SharedVector};
1111
use slint_interpreter::ComponentHandle;
1212

1313
mod js_model;
1414
mod persistent_context;
1515

1616
struct WrappedComponentType(Option<slint_interpreter::ComponentDefinition>);
1717
struct WrappedComponentRc(Option<slint_interpreter::ComponentInstance>);
18-
struct WrappedWindow(Option<slint_core_internal::window::WindowRc>);
18+
struct WrappedWindow(Option<i_slint_core::window::WindowRc>);
1919

2020
/// We need to do some gymnastic with closures to pass the ExecuteContext with the right lifetime
2121
type GlobalContextCallback<'c> =
@@ -154,7 +154,7 @@ fn create<'cx>(
154154

155155
fn to_eval_value<'cx>(
156156
val: Handle<'cx, JsValue>,
157-
ty: slint_compiler_internal::langtype::Type,
157+
ty: i_slint_compiler::langtype::Type,
158158
cx: &mut impl Context<'cx>,
159159
persistent_context: &persistent_context::PersistentContext<'cx>,
160160
) -> NeonResult<slint_interpreter::Value> {
@@ -177,12 +177,12 @@ fn to_eval_value<'cx>(
177177
.value()
178178
.parse::<css_color_parser2::Color>()
179179
.or_else(|e| cx.throw_error(&e.to_string()))?;
180-
Ok((slint_core_internal::Color::from_argb_u8((c.a * 255.) as u8, c.r, c.g, c.b)).into())
180+
Ok((i_slint_core::Color::from_argb_u8((c.a * 255.) as u8, c.r, c.g, c.b)).into())
181181
}
182182
Type::Array(a) => match val.downcast::<JsArray>() {
183183
Ok(arr) => {
184184
let vec = arr.to_vec(cx)?;
185-
Ok(Value::Model(ModelRc::new(slint_core_internal::model::SharedVectorModel::from(
185+
Ok(Value::Model(ModelRc::new(i_slint_core::model::SharedVectorModel::from(
186186
vec.into_iter()
187187
.map(|i| to_eval_value(i, (*a).clone(), cx, persistent_context))
188188
.collect::<Result<SharedVector<_>, _>>()?,
@@ -199,7 +199,7 @@ fn to_eval_value<'cx>(
199199
Type::Image => {
200200
let path = val.to_string(cx)?.value();
201201
Ok(Value::Image(
202-
slint_core_internal::graphics::Image::load_from_path(std::path::Path::new(&path))
202+
i_slint_core::graphics::Image::load_from_path(std::path::Path::new(&path))
203203
.or_else(|_| cx.throw_error(format!("cannot load image {:?}", path)))?,
204204
))
205205
}
@@ -284,7 +284,7 @@ fn to_js_value<'cx>(
284284
}
285285
js_object.as_value(cx)
286286
}
287-
Value::Brush(slint_core_internal::Brush::SolidColor(c)) => JsString::new(
287+
Value::Brush(i_slint_core::Brush::SolidColor(c)) => JsString::new(
288288
cx,
289289
&format!("#{:02x}{:02x}{:02x}{:02x}", c.red(), c.green(), c.blue(), c.alpha()),
290290
)
@@ -546,7 +546,7 @@ fn singleshot_timer(mut cx: FunctionContext) -> JsResult<JsValue> {
546546
});
547547
};
548548

549-
slint_core_internal::timers::Timer::single_shot(
549+
i_slint_core::timers::Timer::single_shot(
550550
std::time::Duration::from_millis(duration_in_msecs),
551551
callback,
552552
);
@@ -564,6 +564,6 @@ register_module!(mut m, {
564564
/// let some time elapse for testing purposes
565565
fn mock_elapsed_time(mut cx: FunctionContext) -> JsResult<JsValue> {
566566
let ms = cx.argument::<JsNumber>(0)?.value();
567-
slint_core_internal::tests::slint_mock_elapsed_time(ms as _);
567+
i_slint_core::tests::slint_mock_elapsed_time(ms as _);
568568
Ok(JsUndefined::new().as_value(&mut cx))
569569
}

api/rs/build/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ path = "lib.rs"
1919
default = []
2020

2121
[dependencies]
22-
slint-compiler-internal = { version = "=0.2.0", path = "../../../internal/compiler", features = ["rust", "display-diagnostics"] }
22+
i-slint-compiler = { version = "=0.2.0", path = "../../../internal/compiler", features = ["rust", "display-diagnostics"] }
2323

2424
spin_on = "0.1"
2525
thiserror = "1"

api/rs/build/lib.rs

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// SPDX-License-Identifier: (GPL-3.0-only OR LicenseRef-SixtyFPS-commercial)
33

44
/*!
5-
This crate serves as a companion crate for the slint crate.
5+
This crate serves as a companion crate of the slint crate.
66
It is meant to allow you to compile the `.slint` files from your `build.rs` script.
77
88
The main entry point of this crate is the [`compile()`] function
@@ -54,18 +54,18 @@ use std::env;
5454
use std::io::Write;
5555
use std::path::Path;
5656

57-
use slint_compiler_internal::diagnostics::BuildDiagnostics;
57+
use i_slint_compiler::diagnostics::BuildDiagnostics;
5858

5959
/// The structure for configuring aspects of the compilation of `.slint` markup files to Rust.
6060
pub struct CompilerConfiguration {
61-
config: slint_compiler_internal::CompilerConfiguration,
61+
config: i_slint_compiler::CompilerConfiguration,
6262
}
6363

6464
impl Default for CompilerConfiguration {
6565
fn default() -> Self {
6666
Self {
67-
config: slint_compiler_internal::CompilerConfiguration::new(
68-
slint_compiler_internal::generator::OutputFormat::Rust,
67+
config: i_slint_compiler::CompilerConfiguration::new(
68+
i_slint_compiler::generator::OutputFormat::Rust,
6969
),
7070
}
7171
}
@@ -189,7 +189,7 @@ pub fn compile_with_config(
189189
.join(path.as_ref());
190190

191191
let mut diag = BuildDiagnostics::default();
192-
let syntax_node = slint_compiler_internal::parser::parse_file(&path, &mut diag);
192+
let syntax_node = i_slint_compiler::parser::parse_file(&path, &mut diag);
193193

194194
if diag.has_error() {
195195
let vec = diag.to_string_vec();
@@ -208,9 +208,9 @@ pub fn compile_with_config(
208208

209209
if std::env::var_os("SLINT_STYLE").is_none() && compiler_config.style.is_none() {
210210
compiler_config.style = std::env::var_os("OUT_DIR").and_then(|path| {
211-
// Same logic as in slint-backend-selector-internal's build script to get the path
211+
// Same logic as in i-slint-backend-selector's build script to get the path
212212
let path = Path::new(&path).parent()?.parent()?.join("SLINT_DEFAULT_STYLE.txt");
213-
// unfortunately, if for some reason the file is changed by the slint-backend-selector-internal's build script,
213+
// unfortunately, if for some reason the file is changed by the i-slint-backend-selector's build script,
214214
// it is changed after cargo decide to re-run this build script or not. So that means one will need two build
215215
// to settle the right thing.
216216
rerun_if_changed = format!("cargo:rerun-if-changed={}", path.display());
@@ -222,11 +222,8 @@ pub fn compile_with_config(
222222
let syntax_node = syntax_node.expect("diags contained no compilation errors");
223223

224224
// 'spin_on' is ok here because the compiler in single threaded and does not block if there is no blocking future
225-
let (doc, diag) = spin_on::spin_on(slint_compiler_internal::compile_syntax_node(
226-
syntax_node,
227-
diag,
228-
compiler_config,
229-
));
225+
let (doc, diag) =
226+
spin_on::spin_on(i_slint_compiler::compile_syntax_node(syntax_node, diag, compiler_config));
230227

231228
if diag.has_error() {
232229
let vec = diag.to_string_vec();
@@ -244,7 +241,7 @@ pub fn compile_with_config(
244241

245242
let file = std::fs::File::create(&output_file_path).map_err(CompileError::SaveError)?;
246243
let mut code_formatter = CodeFormatter { indentation: 0, in_string: false, sink: file };
247-
let generated = slint_compiler_internal::generator::rust::generate(&doc);
244+
let generated = i_slint_compiler::generator::rust::generate(&doc);
248245

249246
for x in &diag.all_loaded_files {
250247
if x.is_absolute() {

api/rs/macros/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ proc-macro = true
1717
path = "lib.rs"
1818

1919
[dependencies]
20-
slint-compiler-internal = { version = "=0.2.0", path = "../../../internal/compiler", features = ["proc_macro_span", "rust", "display-diagnostics"] }
20+
i-slint-compiler = { version = "=0.2.0", path = "../../../internal/compiler", features = ["proc_macro_span", "rust", "display-diagnostics"] }
2121

2222
proc-macro2 = "1.0.17"
2323
quote = "1.0"

0 commit comments

Comments
 (0)