slint-ui 1.9.0-nightly.2024101016 → 1.9.0-nightly.2024101112

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.
Files changed (3) hide show
  1. package/Cargo.toml +4 -4
  2. package/cover.md +58 -10
  3. package/package.json +6 -6
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 = "ccf5f04087c5d920c80e7e706230e99a12b9e9ef", version = "=1.9.0", default-features = false }
45
- i-slint-core = { features = ["default", "gettext-rs"] , git = "https://github.com/slint-ui/slint", rev = "ccf5f04087c5d920c80e7e706230e99a12b9e9ef", version = "=1.9.0", default-features = false }
46
- i-slint-backend-selector = { git = "https://github.com/slint-ui/slint", rev = "ccf5f04087c5d920c80e7e706230e99a12b9e9ef", 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 = "ccf5f04087c5d920c80e7e706230e99a12b9e9ef", version = "=1.9.0"}
44
+ i-slint-compiler = { features = ["default"] , git = "https://github.com/slint-ui/slint", rev = "f8f1d468a0aba1b11e7f9fb71739e46a178d4415", version = "=1.9.0", default-features = false }
45
+ i-slint-core = { features = ["default", "gettext-rs"] , git = "https://github.com/slint-ui/slint", rev = "f8f1d468a0aba1b11e7f9fb71739e46a178d4415", version = "=1.9.0", default-features = false }
46
+ i-slint-backend-selector = { git = "https://github.com/slint-ui/slint", rev = "f8f1d468a0aba1b11e7f9fb71739e46a178d4415", 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 = "f8f1d468a0aba1b11e7f9fb71739e46a178d4415", 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" }
package/cover.md CHANGED
@@ -66,9 +66,9 @@ This file declares the user interface.
66
66
 
67
67
  4. Create a new file called `index.mjs` with the following contents:
68
68
 
69
- ```
69
+ ```js
70
70
  import * as slint from "slint-ui";
71
- let ui = slint.loadFile("main.slint");
71
+ let ui = slint.loadFile(new URL("main.slint", import.meta.url));
72
72
  let demo = new ui.Demo();
73
73
 
74
74
  await demo.run();
@@ -124,9 +124,9 @@ This file declares the user interface.
124
124
 
125
125
  3. Create a new file called `index.ts` with the following contents:
126
126
 
127
- ```
127
+ ```ts
128
128
  import * as slint from "slint-ui";
129
- let ui = slint.loadFile("main.slint");
129
+ let ui = slint.loadFile(new URL("main.slint", import.meta.url));
130
130
  let demo = new ui.Demo();
131
131
 
132
132
  await demo.run();
@@ -142,6 +142,54 @@ This is your main JavaScript entry point:
142
142
 
143
143
  1. Run the example with `deno run --allow-read --allow-ffi --allow-sys index.ts`
144
144
 
145
+
146
+ ## Getting Started (bun)
147
+
148
+ 1. In a new directory, create a new `bun` project by calling [`bun init`](https://bun.sh/docs/cli/init).
149
+ 2. Install Slint for your project using [`bun install slint-ui`](https://bun.sh/docs/cli/install).
150
+ 3. Create a new file called `main.slint` with the following contents:
151
+
152
+ ```
153
+ import { AboutSlint, Button, VerticalBox } from "std-widgets.slint";
154
+ export component Demo inherits Window {
155
+ in-out property <string> greeting <=> label.text;
156
+ VerticalBox {
157
+ alignment: start;
158
+ label := Text {
159
+ text: "Hello World!";
160
+ font-size: 24px;
161
+ horizontal-alignment: center;
162
+ }
163
+ AboutSlint {
164
+ preferred-height: 150px;
165
+ }
166
+ HorizontalLayout { alignment: center; Button { text: "OK!"; } }
167
+ }
168
+ }
169
+ ```
170
+
171
+ This file declares the user interface.
172
+
173
+ 4. Clear the conent of`index.ts` and add the following code:
174
+
175
+ ```ts
176
+ import * as slint from "slint-ui";
177
+ let ui = slint.loadFile(new URL("main.slint", import.meta.url)) as any;
178
+ let demo = new ui.Demo();
179
+
180
+ await demo.run();
181
+ ```
182
+
183
+ This is your main TypeScript entry point:
184
+
185
+ * Import the Slint API as an [ECMAScript module](https://nodejs.org/api/esm.html#modules-ecmascript-modules) module.
186
+ * Invoke `loadFile()` to compile and load the `.slint` file.
187
+ * Instantiate the `Demo` component declared in `main.slint`.
188
+ * Run it by showing it on the screen and reacting to user input.
189
+
190
+ 5. Run the example with `bun run index.ts`
191
+
192
+
145
193
  ## API Overview
146
194
 
147
195
  ### Instantiating a Component
@@ -176,7 +224,7 @@ an object which allow to initialize the value of public properties or callbacks.
176
224
  import * as slint from "slint-ui";
177
225
  // In this example, the main.slint file exports a module which
178
226
  // has a counter property and a clicked callback
179
- let ui = slint.loadFile("ui/main.slint");
227
+ let ui = slint.loadFile(new URL("ui/main.slint", import.meta.url));
180
228
  let component = new ui.MainWindow({
181
229
  counter: 42,
182
230
  clicked: function() { console.log("hello"); }
@@ -194,7 +242,7 @@ export component MainWindow {
194
242
  }
195
243
 
196
244
  ```js
197
- let ui = slint.loadFile("main.slint");
245
+ let ui = slint.loadFile(new URL("main.slint", import.meta.url));
198
246
  let instance = new ui.MainWindow();
199
247
  console.log(instance.age); // Prints 42
200
248
  instance.name = "Joe";
@@ -223,7 +271,7 @@ export component MyComponent inherits Window {
223
271
  ```js
224
272
  import * as slint from "slint-ui";
225
273
 
226
- let ui = slint.loadFile("ui/my-component.slint");
274
+ let ui = slint.loadFile(new URL("ui/my-component.slint", import.meta.url));
227
275
  let component = new ui.MyComponent();
228
276
 
229
277
  // connect to a callback
@@ -294,7 +342,7 @@ export component MyComponent inherits Window {
294
342
 
295
343
  import * as slint from "slint-ui";
296
344
 
297
- let ui = slint.loadFile("my-component.slint");
345
+ let ui = slint.loadFile(new URL("my-component.slint", import.meta.url));
298
346
  let component = new ui.MyComponent();
299
347
 
300
348
  // object literal
@@ -330,7 +378,7 @@ export component MyComponent inherits Window {
330
378
 
331
379
  import * as slint from "slint-ui";
332
380
 
333
- let ui = slint.loadFile("my-component.slint");
381
+ let ui = slint.loadFile(new URL("my-component.slint", import.meta.url));
334
382
  let component = new ui.MyComponent();
335
383
 
336
384
  // set enum value as string
@@ -361,7 +409,7 @@ previous section, you can access `Logic` like this:
361
409
  ```js
362
410
  import * as slint from "slint-ui";
363
411
 
364
- let ui = slint.loadFile("ui/my-component.slint");
412
+ let ui = slint.loadFile(new URL("ui/my-component.slint", import.meta.url));
365
413
  let component = new ui.MyComponent();
366
414
 
367
415
  component.Logic.to_upper_case = (str) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "slint-ui",
3
- "version": "1.9.0-nightly.2024101016",
3
+ "version": "1.9.0-nightly.2024101112",
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.2024101016",
71
- "@slint-ui/slint-ui-binary-darwin-x64": "1.9.0-nightly.2024101016",
72
- "@slint-ui/slint-ui-binary-darwin-arm64": "1.9.0-nightly.2024101016",
73
- "@slint-ui/slint-ui-binary-win32-x64-msvc": "1.9.0-nightly.2024101016",
74
- "@slint-ui/slint-ui-binary-win32-ia32-msvc": "1.9.0-nightly.2024101016"
70
+ "@slint-ui/slint-ui-binary-linux-x64-gnu": "1.9.0-nightly.2024101112",
71
+ "@slint-ui/slint-ui-binary-darwin-x64": "1.9.0-nightly.2024101112",
72
+ "@slint-ui/slint-ui-binary-darwin-arm64": "1.9.0-nightly.2024101112",
73
+ "@slint-ui/slint-ui-binary-win32-x64-msvc": "1.9.0-nightly.2024101112",
74
+ "@slint-ui/slint-ui-binary-win32-ia32-msvc": "1.9.0-nightly.2024101112"
75
75
  }
76
76
  }