@solidrt/core 0.0.1-exp.5 → 0.0.1-exp.7

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Antoine van Wel
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,58 @@
1
+ # SolidRT
2
+
3
+ A low-level toolkit for creating cross-platform applications.
4
+
5
+ _SolidRT is in pre-alpha stage. Anything can and will be changed._
6
+
7
+ ## Getting started
8
+
9
+ Prerequisites: [bun](https://bun.sh) (only required for development; not needed to run built apps).
10
+
11
+ ```sh
12
+ bun init
13
+ bun add @solidrt/core
14
+ bun add -d @solidrt/cli
15
+ ```
16
+
17
+ Create an entry file `src/index.tsx`:
18
+
19
+ ```jsx
20
+ import { render } from "@solidrt/core"
21
+
22
+ function App() {
23
+ return (
24
+ <window>
25
+ <text>Hello, World!</text>
26
+ </window>
27
+ )
28
+ }
29
+
30
+ render(() => <App />)
31
+ ```
32
+
33
+ Run the app:
34
+
35
+ ```sh
36
+ bunx srt run src/index.tsx
37
+ ```
38
+
39
+ Optionally, create a `tsconfig.json` to enable JSX support and type recognition for SolidRT elements:
40
+
41
+ ```json
42
+ {
43
+ "compilerOptions": {
44
+ "jsx": "preserve",
45
+ "jsxImportSource": "@solidrt/core",
46
+ "moduleResolution": "bundler",
47
+ "strict": true
48
+ }
49
+ }
50
+ ```
51
+
52
+ ## API
53
+
54
+ See [docs/api.md](https://github.com/wellawaretech/solidrt/blob/main/docs/api.md) for the full API reference.
55
+
56
+ ## License
57
+
58
+ MIT. Copyright (c) 2026 Antoine van Wel.
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@solidrt/core",
3
- "version": "0.0.1-exp.5",
3
+ "version": "0.0.1-exp.7",
4
+ "license": "MIT",
4
5
  "type": "module",
5
6
  "main": "src/index.ts",
6
7
  "exports": {
@@ -10,7 +11,8 @@
10
11
  },
11
12
  "files": [
12
13
  "src/",
13
- "jsx-runtime.d.ts"
14
+ "jsx-runtime.d.ts",
15
+ "LICENSE"
14
16
  ],
15
17
  "peerDependencies": {
16
18
  "@solidjs/signals": "2.0.0-beta.7",
package/src/window.ts CHANGED
@@ -9,11 +9,11 @@ let animationFrames = new Map<number, Function>()
9
9
  * Calls `fn` on every rendered frame. Returns a cleanup function to stop rendering.
10
10
  * When called within a reactive scope (e.g. a component or createEffect), cleanup is also automatic.
11
11
  */
12
- export function onRender(fn: (tick: number) => void) {
12
+ export function onRender(fn: (tick: number, frame: number) => void) {
13
13
  let frameId: number = null!
14
14
 
15
- let extendedFn = (tick: number) => {
16
- fn(tick)
15
+ let extendedFn = (tick: number, frame: number) => {
16
+ fn(tick, frame)
17
17
  frameId = nextFrameId++
18
18
  animationFrames.set(frameId, extendedFn)
19
19
  }
@@ -54,13 +54,13 @@ export function attachWindow(_nodeId: number) {
54
54
  let unsubscribe: () => void = null!
55
55
 
56
56
  onSettled(() => {
57
- unsubscribe = Flux.on("render", (time: number) => {
57
+ unsubscribe = Flux.on("render", ({ time, frame }: { time: number, frame: number }) => {
58
58
  if (animationFrames.size > 0) {
59
59
  let frames = animationFrames
60
60
  animationFrames = new Map()
61
61
 
62
62
  let t = (time * 1000) | 0
63
- for (let fn of frames.values()) fn(t)
63
+ for (let fn of frames.values()) fn(t, frame)
64
64
  }
65
65
 
66
66
  draw()