mirror of
https://github.com/slint-ui/slint.git
synced 2025-12-23 09:19:32 +00:00
Rename sixtyfps-node
This doesn't touch the documentation, just the package/API side
This commit is contained in:
parent
476c7f5654
commit
809fbfc7a6
148 changed files with 211 additions and 211 deletions
|
|
@ -20,10 +20,10 @@ npm install sixtyfps
|
|||
|
||||
## Using SixtyFPS
|
||||
|
||||
To initialize the API, you first need to import the `sixtyfps` module in our code:
|
||||
To initialize the API, you first need to import the `slint` module in our code:
|
||||
|
||||
```js
|
||||
let sixtyfps = require("sixtyfps");
|
||||
let slint = require("slint");
|
||||
```
|
||||
|
||||
This step also installs a hook in NodeJS that allows you to import `.60` files directly:
|
||||
|
|
@ -35,7 +35,7 @@ let ui = require("../ui/main.60");
|
|||
Combining these two steps leads us to the obligator "Hello World" example:
|
||||
|
||||
```js
|
||||
require("sixtyfps");
|
||||
require("slint");
|
||||
let ui = require("../ui/main.60");
|
||||
let main = new ui.Main();
|
||||
main.run();
|
||||
|
|
@ -51,7 +51,7 @@ The exported component is exposed as a type constructor. The type constructor ta
|
|||
an object which allow to initialize the value of public properties or callbacks.
|
||||
|
||||
```js
|
||||
require("sixtyfps");
|
||||
require("slint");
|
||||
// In this example, the main.60 file exports a module which
|
||||
// has a counter property and a clicked callback
|
||||
let ui = require("ui/main.60");
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
*/
|
||||
function load_native_lib() {
|
||||
const os = require('os');
|
||||
(process as any).dlopen(module, process.env.SIXTYFPS_NODE_NATIVE_LIB,
|
||||
(process as any).dlopen(module, process.env.SLINT_NODE_NATIVE_LIB,
|
||||
os.constants.dlopen.RTLD_NOW);
|
||||
return module.exports;
|
||||
}
|
||||
|
|
@ -17,7 +17,7 @@ function load_native_lib() {
|
|||
/**
|
||||
* @hidden
|
||||
*/
|
||||
let native = !process.env.SIXTYFPS_NODE_NATIVE_LIB ? require('../native/index.node') : load_native_lib();
|
||||
let native = !process.env.SLINT_NODE_NATIVE_LIB ? require('../native/index.node') : load_native_lib();
|
||||
|
||||
/**
|
||||
* @hidden
|
||||
|
|
@ -67,7 +67,7 @@ interface Callback {
|
|||
setHandler(cb: any): void;
|
||||
}
|
||||
|
||||
require.extensions['.60'] =
|
||||
require.extensions['.60'] = require.extensions['.slint'] =
|
||||
function (module, filename) {
|
||||
var c = native.load(filename);
|
||||
module.exports[c.name().replace(/-/g, '_')] = function (init_properties: any) {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
import { URL, pathToFileURL } from 'url';
|
||||
|
||||
const extensionsRegex = /\.60$/;
|
||||
const extensionsRegex = /\.(60|slint)$/;
|
||||
const baseURL = pathToFileURL(`${process.cwd()}/`).href;
|
||||
|
||||
export function resolve(specifier, context, defaultResolve) {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
# SPDX-License-Identifier: (GPL-3.0-only OR LicenseRef-SixtyFPS-commercial)
|
||||
|
||||
[package]
|
||||
name = "sixtyfps-node"
|
||||
name = "slint-node"
|
||||
version = "0.2.0"
|
||||
authors = ["SixtyFPS <info@sixtyfps.io>"]
|
||||
edition = "2021"
|
||||
|
|
@ -17,7 +17,7 @@ homepage = "https://sixtyfps.io"
|
|||
[lib]
|
||||
path = "lib.rs"
|
||||
crate-type = ["cdylib"]
|
||||
name = "sixtyfps_node_native"
|
||||
name = "slint_node_native"
|
||||
|
||||
[dependencies]
|
||||
slint-compiler-internal = { version = "=0.2.0", path="../../../internal/compiler" }
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ impl JsModel {
|
|||
data_type,
|
||||
});
|
||||
|
||||
let mut notify = SixtyFpsModelNotify::new::<_, JsValue, _>(cx, std::iter::empty())?;
|
||||
let mut notify = SlintModelNotify::new::<_, JsValue, _>(cx, std::iter::empty())?;
|
||||
cx.borrow_mut(&mut notify, |mut notify| notify.0 = Rc::downgrade(&model));
|
||||
let notify = notify.as_value(cx);
|
||||
obj.set(cx, "notify", notify)?;
|
||||
|
|
@ -112,7 +112,7 @@ impl Model for JsModel {
|
|||
struct WrappedJsModel(Weak<JsModel>);
|
||||
|
||||
declare_types! {
|
||||
class SixtyFpsModelNotify for WrappedJsModel {
|
||||
class SlintModelNotify for WrappedJsModel {
|
||||
init(_) {
|
||||
Ok(WrappedJsModel(Weak::default()))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,11 +49,11 @@ fn run_with_global_context(f: &GlobalContextCallback) {
|
|||
///
|
||||
/// The first argument of this function is a string to the .60 file
|
||||
///
|
||||
/// The return value is a SixtyFpsComponentType
|
||||
/// The return value is a SlintComponentType
|
||||
fn load(mut cx: FunctionContext) -> JsResult<JsValue> {
|
||||
let path = cx.argument::<JsString>(0)?.value();
|
||||
let path = std::path::Path::new(path.as_str());
|
||||
let include_paths = match std::env::var_os("SIXTYFPS_INCLUDE_PATH") {
|
||||
let include_paths = match std::env::var_os("SLINT_INCLUDE_PATH") {
|
||||
Some(paths) => {
|
||||
std::env::split_paths(&paths).filter(|path| !path.as_os_str().is_empty()).collect()
|
||||
}
|
||||
|
|
@ -67,7 +67,7 @@ fn load(mut cx: FunctionContext) -> JsResult<JsValue> {
|
|||
|
||||
let c = if let Some(c) = c { c } else { return cx.throw_error("Compilation error") };
|
||||
|
||||
let mut obj = SixtyFpsComponentType::new::<_, JsValue, _>(&mut cx, std::iter::empty())?;
|
||||
let mut obj = SlintComponentType::new::<_, JsValue, _>(&mut cx, std::iter::empty())?;
|
||||
cx.borrow_mut(&mut obj, |mut obj| obj.0 = Some(c));
|
||||
Ok(obj.as_value(&mut cx))
|
||||
}
|
||||
|
|
@ -146,7 +146,7 @@ fn create<'cx>(
|
|||
}
|
||||
}
|
||||
|
||||
let mut obj = SixtyFpsComponent::new::<_, JsValue, _>(cx, std::iter::empty())?;
|
||||
let mut obj = SlintComponent::new::<_, JsValue, _>(cx, std::iter::empty())?;
|
||||
persistent_context.save_to_object(cx, obj.downcast().unwrap());
|
||||
cx.borrow_mut(&mut obj, |mut obj| obj.0 = Some(component));
|
||||
Ok(obj.as_value(cx))
|
||||
|
|
@ -237,7 +237,7 @@ fn to_eval_value<'cx>(
|
|||
| Type::Component(_)
|
||||
| Type::PathData
|
||||
| Type::LayoutCache
|
||||
| Type::ElementReference => cx.throw_error("Cannot convert to a Sixtyfps property value"),
|
||||
| Type::ElementReference => cx.throw_error("Cannot convert to a Slint property value"),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -294,7 +294,7 @@ fn to_js_value<'cx>(
|
|||
}
|
||||
|
||||
declare_types! {
|
||||
class SixtyFpsComponentType for WrappedComponentType {
|
||||
class SlintComponentType for WrappedComponentType {
|
||||
init(_) {
|
||||
Ok(WrappedComponentType(None))
|
||||
}
|
||||
|
|
@ -336,7 +336,7 @@ declare_types! {
|
|||
}
|
||||
}
|
||||
|
||||
class SixtyFpsComponent for WrappedComponentRc {
|
||||
class SlintComponent for WrappedComponentRc {
|
||||
init(_) {
|
||||
Ok(WrappedComponentRc(None))
|
||||
}
|
||||
|
|
@ -355,7 +355,7 @@ declare_types! {
|
|||
let component = cx.borrow(&this, |x| x.0.as_ref().map(|c| c.clone_strong()));
|
||||
let component = component.ok_or(()).or_else(|()| cx.throw_error("Invalid type"))?;
|
||||
let window = component.window().window_handle().clone();
|
||||
let mut obj = SixtyFpsWindow::new::<_, JsValue, _>(&mut cx, std::iter::empty())?;
|
||||
let mut obj = SlintWindow::new::<_, JsValue, _>(&mut cx, std::iter::empty())?;
|
||||
cx.borrow_mut(&mut obj, |mut obj| obj.0 = Some(window));
|
||||
Ok(obj.as_value(&mut cx))
|
||||
}
|
||||
|
|
@ -485,7 +485,7 @@ declare_types! {
|
|||
}
|
||||
}
|
||||
|
||||
class SixtyFpsWindow for WrappedWindow {
|
||||
class SlintWindow for WrappedWindow {
|
||||
init(_) {
|
||||
Ok(WrappedWindow(None))
|
||||
}
|
||||
|
|
@ -509,7 +509,7 @@ declare_types! {
|
|||
}
|
||||
|
||||
fn singleshot_timer_property(id: u32) -> String {
|
||||
format!("$__sixtyfps_singleshot_timer_{}", id)
|
||||
format!("$__slint_singleshot_timer_{}", id)
|
||||
}
|
||||
|
||||
fn singleshot_timer(mut cx: FunctionContext) -> JsResult<JsValue> {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"name": "sixtyfps",
|
||||
"name": "slint",
|
||||
"version": "0.2.0",
|
||||
"homepage": "https://github.com/sixtyfpsui/sixtyfps",
|
||||
"license": "SEE LICENSE IN LICENSE.md",
|
||||
|
|
@ -22,4 +22,4 @@
|
|||
"devDependencies": {
|
||||
"typedoc": "^0.19.2"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -66,6 +66,6 @@
|
|||
"disableSources": true,
|
||||
"theme": "minimal",
|
||||
"hideGenerator": true,
|
||||
"name": "SixtyFPS Node"
|
||||
"name": "Slint Node"
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue