@solidrt/core 0.0.65 → 0.0.66
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/AGENTS.md +3 -3
- package/README.md +1 -1
- package/agents/performance.md +3 -3
- package/docs/index.md +1 -1
- package/package.json +3 -3
- package/src/camera.ts +1 -1
- package/src/core.ts +1 -1
- package/src/environment.ts +3 -3
- package/src/gamepad.ts +1 -1
- package/src/gpu.ts +1 -1
- package/src/renderer.ts +8 -8
- package/src/runtime-modules.d.ts +9 -9
- package/src/textures.ts +1 -1
- package/src/transform.ts +1 -1
- package/src/types.d.ts +3 -3
- package/src/window.ts +4 -4
package/AGENTS.md
CHANGED
|
@@ -92,7 +92,7 @@ real design decision, not an afterthought:
|
|
|
92
92
|
|
|
93
93
|
```sh
|
|
94
94
|
bun add @solidrt/core # the renderer
|
|
95
|
-
bun add -d @solidrt/cli # the `
|
|
95
|
+
bun add -d @solidrt/cli # the `sol` tool (see its AGENTS.md)
|
|
96
96
|
```
|
|
97
97
|
|
|
98
98
|
Core primitives alone are enough to build a full app. The optional extensions
|
|
@@ -320,7 +320,7 @@ that reads exactly like Solid fallout.
|
|
|
320
320
|
input happened. Time anything about input with it (a press length, the
|
|
321
321
|
gap between two taps, a speed from two positions), never with
|
|
322
322
|
`performance.now()` in the handler: that is when the handler ran, and
|
|
323
|
-
it does not follow the dev clock, `
|
|
323
|
+
it does not follow the dev clock, `sol render` or a test. The stamp is
|
|
324
324
|
the input's own time, not its delivery's: a move carries the time the
|
|
325
325
|
pointer was at the position it reports, however late the frame that
|
|
326
326
|
delivers it; a down, up, wheel or key the time the platform recorded.
|
|
@@ -616,7 +616,7 @@ that reads exactly like Solid fallout.
|
|
|
616
616
|
seldom changes the picture. `frameTime()` is the current frame's `tick`
|
|
617
617
|
read from anywhere (not reactive, requests nothing): the app's own
|
|
618
618
|
clock for code with no tick in hand, where `performance.now()` would
|
|
619
|
-
ignore the dev clock, `
|
|
619
|
+
ignore the dev clock, `sol render` and tests. A JS
|
|
620
620
|
tween loop or an animation library pushing interpolated values through
|
|
621
621
|
signals is the single most expensive mistake available here - read
|
|
622
622
|
agents/performance.md before writing either.
|
package/README.md
CHANGED
package/agents/performance.md
CHANGED
|
@@ -149,7 +149,7 @@ Rules, in order of leverage:
|
|
|
149
149
|
anything needing what is behind it does not - and is split from content
|
|
150
150
|
invalidation, so a params-only change re-runs the pass against the cached
|
|
151
151
|
snapshot instead of re-rasterizing. A window shader's output is invisible
|
|
152
|
-
to get_snapshot and every other MCP tool; `bun run
|
|
152
|
+
to get_snapshot and every other MCP tool; `bun run sol render` is the only
|
|
153
153
|
way to see it (see @solidrt/cli AGENTS.md).
|
|
154
154
|
8. `flux:wasm` runs a pure interpreter (wasmi, no JIT), so temper browser
|
|
155
155
|
expectations - but do not write it off for compute. A genuinely numeric
|
|
@@ -208,7 +208,7 @@ let n = await worker.crunch(bytes) // main keeps rendering meanwhil
|
|
|
208
208
|
```
|
|
209
209
|
|
|
210
210
|
The bundler builds each such module as its own bundle and ships it with the
|
|
211
|
-
app (dev pushes and `
|
|
211
|
+
app (dev pushes and `sol pack` alike). Rules: main may only `import type`
|
|
212
212
|
from an isolate module (a value import is a build error); arguments and
|
|
213
213
|
results are copies (numbers, strings, byte buffers, arrays, plain objects -
|
|
214
214
|
no functions, no class instances); the child has the non-gui `flux:*`
|
|
@@ -248,7 +248,7 @@ not infer it from the desktop number.
|
|
|
248
248
|
- **Some paints cost a frame each on a tiled mobile GPU.** Measured on a
|
|
249
249
|
mid-range 2020 tablet (Adreno 610, Impeller GLES) with ten panes sliding
|
|
250
250
|
and resizing on a layout transition, each row by subtraction from the
|
|
251
|
-
compositor's own present record (`
|
|
251
|
+
compositor's own present record (`sol android --census`), against a
|
|
252
252
|
frame that ran at 60 fps with a 13 ms GPU span:
|
|
253
253
|
- a 3-stop linear-gradient fill per pane: +15 ms, 20 fps. A gradient is
|
|
254
254
|
shaded per pixel per frame; the same tint as a flat `d-rect` costs
|
package/docs/index.md
CHANGED
|
@@ -176,7 +176,7 @@ animation and audio, not the persistence moment.
|
|
|
176
176
|
A link from outside (a custom scheme link the OS routed to the app, or one
|
|
177
177
|
a dev tool sent) arrives raw: `env.launchLink` is the one this run of the
|
|
178
178
|
app was started with (null without; a hot reload starts at the location
|
|
179
|
-
the app last reported, see `reportLocation` in `
|
|
179
|
+
the app last reported, see `reportLocation` in `sol:dev`), `onLink` fires
|
|
180
180
|
for one arriving while the app runs. What a link names is the app's to decide, and it is untrusted input:
|
|
181
181
|
validate before acting on any part of it. A router turns links into screens
|
|
182
182
|
for you; without one, parse it yourself. The scheme a packed app answers to
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solidrt/core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.66",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"funding": "https://github.com/sponsors/wellawaretech",
|
|
6
6
|
"author": "Antoine van Wel",
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
"AGENTS.md"
|
|
34
34
|
],
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@solidrt/flux-types": "0.0.
|
|
37
|
-
"@solidrt/test": "0.0.
|
|
36
|
+
"@solidrt/flux-types": "0.0.66",
|
|
37
|
+
"@solidrt/test": "0.0.66"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"@solidjs/signals": "2.0.0-rc.13",
|
package/src/camera.ts
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import { createSignal, onCleanup } from "@solidjs/signals"
|
|
10
10
|
import { listCameras, open } from "flux:camera"
|
|
11
11
|
import type { TextureId } from "flux:gpu"
|
|
12
|
-
import { on } from "
|
|
12
|
+
import { on } from "sol:events"
|
|
13
13
|
|
|
14
14
|
export type CameraFacing = "front" | "back" | "unknown"
|
|
15
15
|
|
package/src/core.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as tree from "flux:rendertree"
|
|
2
2
|
import type { TextureId } from "flux:gpu"
|
|
3
3
|
import { createSignal, getOwner, onCleanup } from "@solidjs/signals"
|
|
4
|
-
import { on } from "
|
|
4
|
+
import { on } from "sol:events"
|
|
5
5
|
|
|
6
6
|
let handlers = new Map<number, Map<string, Function>>()
|
|
7
7
|
|
package/src/environment.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createSignal, runWithOwner } from "@solidjs/signals"
|
|
2
|
-
import { on } from "
|
|
2
|
+
import { on } from "sol:events"
|
|
3
3
|
import { onPointerMove } from "./core"
|
|
4
4
|
import { windowSize, safeArea, displayScale, windowFocused, keyboardHeight } from "./window"
|
|
5
5
|
|
|
@@ -16,7 +16,7 @@ import { windowSize, safeArea, displayScale, windowFocused, keyboardHeight } fro
|
|
|
16
16
|
// runs, which is usually inside a component or a computation (a memo's first
|
|
17
17
|
// read of env.inputDevices, a HUD effect's first read of pointerLocked()).
|
|
18
18
|
// Created there, the fact would belong to that reader: sticky events replay
|
|
19
|
-
// their cached value synchronously on subscribe (
|
|
19
|
+
// their cached value synchronously on subscribe (sol:events' on()), so the
|
|
20
20
|
// on() call writes the signal it just created inside the reader's owned
|
|
21
21
|
// scope - a render-time write, which the guard rejects - and a root or a
|
|
22
22
|
// subscription created there is disposed with the reader. The facts are
|
|
@@ -274,7 +274,7 @@ export let env = {
|
|
|
274
274
|
},
|
|
275
275
|
/**
|
|
276
276
|
* The link this process was started with, or null: a custom scheme link
|
|
277
|
-
* the OS routed to the app (Android intent data; `
|
|
277
|
+
* the OS routed to the app (Android intent data; `sol render --link`),
|
|
278
278
|
* raw, exactly as it arrived. What it names is the app's to decide, and
|
|
279
279
|
* it is untrusted input: validate before acting on any part of it. A link
|
|
280
280
|
* arriving while the app runs is an event instead: `onLink`. Fixed for the
|
package/src/gamepad.ts
CHANGED
package/src/gpu.ts
CHANGED
|
@@ -347,7 +347,7 @@ export function createMutableTexture(
|
|
|
347
347
|
* `packed` as a keyword, so `vec4 packed = texture(...)` fails with a syntax
|
|
348
348
|
* error that does not name the identifier - pick another name.
|
|
349
349
|
*
|
|
350
|
-
* A bad source is a runtime failure, not one `
|
|
350
|
+
* A bad source is a runtime failure, not one `sol check` catches: the compile
|
|
351
351
|
* throws at this call, so a shader created in a component body takes the app
|
|
352
352
|
* to the error window unless an `<Errored>` closer in the tree claims it.
|
|
353
353
|
*/
|
package/src/renderer.ts
CHANGED
|
@@ -86,7 +86,7 @@ function flushDestroy(): void {
|
|
|
86
86
|
function removeNode(parent: ProxyNode, node: ProxyNode): void {
|
|
87
87
|
if (!node || !parent) return
|
|
88
88
|
|
|
89
|
-
// console.debug("[
|
|
89
|
+
// console.debug("[sol] removeNode", parent.id, node.id)
|
|
90
90
|
|
|
91
91
|
// Update JS tree references
|
|
92
92
|
let index = parent.children.indexOf(node)
|
|
@@ -113,7 +113,7 @@ function removeNode(parent: ProxyNode, node: ProxyNode): void {
|
|
|
113
113
|
// bookkeeping on the hot create/insert paths, orphans are derived from the
|
|
114
114
|
// proxy map itself: parentless, not the window root, and not awaiting the
|
|
115
115
|
// destroy sweep. window.ts runs the scan on a rendered frame every few
|
|
116
|
-
// seconds; dev bundles only (
|
|
116
|
+
// seconds; dev bundles only (sol always defines import.meta.env.DEV, so a
|
|
117
117
|
// production bundle folds the check into a constant early return).
|
|
118
118
|
const SENTINEL_INTERVAL_MS = 5000
|
|
119
119
|
let sentinelDue = 0
|
|
@@ -208,7 +208,7 @@ function routeFor(name: string): number {
|
|
|
208
208
|
function applyProp<T>(node: ProxyNode, name: string, value: T): void {
|
|
209
209
|
if (!node) return
|
|
210
210
|
|
|
211
|
-
// console.debug("[
|
|
211
|
+
// console.debug("[sol] applyProp", node.id, name, value)
|
|
212
212
|
|
|
213
213
|
switch (routeFor(name)) {
|
|
214
214
|
case ROUTE_EVENT:
|
|
@@ -234,7 +234,7 @@ let renderer = createRenderer<ProxyNode>({
|
|
|
234
234
|
createElement: (elementType: string, props?: Record<string, any>): ProxyNode => {
|
|
235
235
|
let proxy = createProxyNode(elementType)
|
|
236
236
|
|
|
237
|
-
// console.debug("[
|
|
237
|
+
// console.debug("[sol] createElement", proxy.id, elementType)
|
|
238
238
|
|
|
239
239
|
if (elementType === "window") tree.createRoot(proxy.id)
|
|
240
240
|
else tree.createNode(proxy.id, elementType)
|
|
@@ -257,20 +257,20 @@ let renderer = createRenderer<ProxyNode>({
|
|
|
257
257
|
// no element form of its own (the DOM's "#text" node name).
|
|
258
258
|
createTextNode: (value: string): ProxyNode => {
|
|
259
259
|
let proxy = createProxyNode("#text")
|
|
260
|
-
// console.debug("[
|
|
260
|
+
// console.debug("[sol] createTextNode", proxy.id, value)
|
|
261
261
|
tree.createNode(proxy.id, "#text")
|
|
262
262
|
tree.setProperty(proxy.id, "text", "" + value)
|
|
263
263
|
return proxy
|
|
264
264
|
},
|
|
265
265
|
|
|
266
266
|
replaceText: (node: ProxyNode, value: string): void => {
|
|
267
|
-
// console.debug("[
|
|
267
|
+
// console.debug("[sol] replaceText", node.id, value)
|
|
268
268
|
tree.setProperty(node.id, "text", "" + value)
|
|
269
269
|
},
|
|
270
270
|
|
|
271
271
|
isTextNode: (node: ProxyNode): boolean => node?.elementType === "#text",
|
|
272
272
|
setProperty: <T>(node: ProxyNode, name: string, value: T): void => {
|
|
273
|
-
// console.debug("[
|
|
273
|
+
// console.debug("[sol] setProperty", node.id, name, value)
|
|
274
274
|
applyProp(node, name, value)
|
|
275
275
|
},
|
|
276
276
|
|
|
@@ -294,7 +294,7 @@ let renderer = createRenderer<ProxyNode>({
|
|
|
294
294
|
pendingDestroy.delete(node.id)
|
|
295
295
|
|
|
296
296
|
if (parent) {
|
|
297
|
-
// console.debug("[
|
|
297
|
+
// console.debug("[sol] insertNode", parent.id, node.id, anchor?.id ?? "")
|
|
298
298
|
|
|
299
299
|
// Native first: the tree refuses a laid-out element under a d-* parent
|
|
300
300
|
// (it throws, naming both tags), and the mirror must not record a child
|
package/src/runtime-modules.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Lattice runner builtin modules (the "
|
|
1
|
+
// Lattice runner builtin modules (the "sol:*" surface). These are ambient
|
|
2
2
|
// module declarations, so they live in this global-script .d.ts (no top-level
|
|
3
3
|
// import/export) rather than in types.d.ts: an ambient `declare module` only
|
|
4
4
|
// becomes globally visible to consumers from a non-module declaration file.
|
|
@@ -51,7 +51,7 @@ declare module "*.glb" {
|
|
|
51
51
|
const bytes: Uint8Array
|
|
52
52
|
export default bytes
|
|
53
53
|
}
|
|
54
|
-
declare module "*.
|
|
54
|
+
declare module "*.sol3m" {
|
|
55
55
|
const bytes: Uint8Array
|
|
56
56
|
export default bytes
|
|
57
57
|
}
|
|
@@ -63,13 +63,13 @@ declare module "*.srtm" {
|
|
|
63
63
|
// pointer moves have dispatched, every pointer the same age - multi-pointer
|
|
64
64
|
// recognizers measure there; its `timeStamp` is theirs), and "render" (the
|
|
65
65
|
// per-frame signal).
|
|
66
|
-
declare module "
|
|
66
|
+
declare module "sol:events" {
|
|
67
67
|
export function on(event: string, callback: (data: any) => void): () => void
|
|
68
68
|
export function once(event: string, callback: (data: any) => void): () => void
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
// The running application's own surface (lattice), present in every build.
|
|
72
|
-
declare module "
|
|
72
|
+
declare module "sol:app" {
|
|
73
73
|
/**
|
|
74
74
|
* End the current app now, without running the quit hooks: back to the
|
|
75
75
|
* player in a dev client, quit when standalone or at the player root (on
|
|
@@ -100,7 +100,7 @@ declare module "srt:app" {
|
|
|
100
100
|
|
|
101
101
|
// Dev-server control surface (lattice). Present only in dev/go builds; in other
|
|
102
102
|
// builds `available` is false and the functions are no-ops.
|
|
103
|
-
declare module "
|
|
103
|
+
declare module "sol:dev" {
|
|
104
104
|
export const available: boolean
|
|
105
105
|
export const canDiscover: boolean
|
|
106
106
|
export const recents: string[]
|
|
@@ -139,7 +139,7 @@ declare module "srt:dev" {
|
|
|
139
139
|
// Installed-app management (lattice), the player's surface over the client's
|
|
140
140
|
// version store. Present only in go/dev client builds; elsewhere `available`
|
|
141
141
|
// is false, `list` returns [], and launch/remove are no-ops.
|
|
142
|
-
declare module "
|
|
142
|
+
declare module "sol:apps" {
|
|
143
143
|
export const available: boolean
|
|
144
144
|
/**
|
|
145
145
|
* An installed app: id, display name (the installed manifest's displayName,
|
|
@@ -233,16 +233,16 @@ declare module "srt:apps" {
|
|
|
233
233
|
// submits the display list. To schedule a future frame instead, use
|
|
234
234
|
// requestFrame() from "flux:rendertree". The tree-building surface itself is
|
|
235
235
|
// "flux:rendertree" (from @solidrt/flux-types).
|
|
236
|
-
declare module "
|
|
236
|
+
declare module "sol:render" {
|
|
237
237
|
export function renderFrame(): void
|
|
238
238
|
}
|
|
239
239
|
|
|
240
240
|
// The engine verbs of an app test (lattice, dev client only), which
|
|
241
241
|
// @solidrt/test builds its surface on; tests import that, not this.
|
|
242
|
-
// The verbs work only in an engine a test host built (`
|
|
242
|
+
// The verbs work only in an engine a test host built (`sol test`) and throw
|
|
243
243
|
// anywhere else. App time there is frame / frameRate and nothing else: no
|
|
244
244
|
// frame runs unless one is asked for.
|
|
245
|
-
declare module "
|
|
245
|
+
declare module "sol:test" {
|
|
246
246
|
/**
|
|
247
247
|
* Runs one frame: timers due by its time fire, then frame callbacks and
|
|
248
248
|
* the flush, then the draw if anything demanded one. Fulfills once the
|
package/src/textures.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// the runtime: this entry imports nothing the runtime provides, so a bake
|
|
3
3
|
// script under bun and an extension's pure modules use it as it is
|
|
4
4
|
// (tests/textures.test.ts imports it on the bare flux binary and fails the
|
|
5
|
-
// moment a gui or
|
|
5
|
+
// moment a gui or sol: import creeps in). Any extension that bakes or loads textures
|
|
6
6
|
// builds on this, the first-party 3d one included.
|
|
7
7
|
//
|
|
8
8
|
// isKtx2 tells a compressed texture file from a PNG or JPEG.
|
package/src/transform.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { onSettled } from "@solidjs/signals"
|
|
2
|
-
import { on } from "
|
|
2
|
+
import { on } from "sol:events"
|
|
3
3
|
import type { PointerEvent } from "./types"
|
|
4
4
|
import { arena, type ArenaOwner } from "./arena"
|
|
5
5
|
import { createVelocityTracker, flingVelocity } from "./velocity"
|
package/src/types.d.ts
CHANGED
|
@@ -9,14 +9,14 @@ import type { Element } from "solid-js"
|
|
|
9
9
|
|
|
10
10
|
export type { TextInputHints }
|
|
11
11
|
|
|
12
|
-
// The "
|
|
12
|
+
// The "sol:*" lattice runner modules are declared in ./runtime-modules.d.ts
|
|
13
13
|
// (referenced above) - ambient `declare module` only reaches consumers from a
|
|
14
14
|
// non-module declaration file, and this file is a module.
|
|
15
15
|
|
|
16
16
|
declare global {
|
|
17
17
|
interface ImportMeta {
|
|
18
18
|
/**
|
|
19
|
-
* Build-mode constants, substituted textually by the
|
|
19
|
+
* Build-mode constants, substituted textually by the sol bundler (Vite
|
|
20
20
|
* vocabulary). `DEV` is true in dev bundles and false in production
|
|
21
21
|
* bundles, where the substituted constant lets the minifier fold
|
|
22
22
|
* dev-only code away entirely.
|
|
@@ -291,7 +291,7 @@ export interface PointerEvent {
|
|
|
291
291
|
* pointer, so the real move after it can carry an earlier time. Use it
|
|
292
292
|
* where you would reach for `performance.now()` in a handler: that one
|
|
293
293
|
* measures when the handler ran, not when the input happened, and it does
|
|
294
|
-
* not follow the dev clock, `
|
|
294
|
+
* not follow the dev clock, `sol render` or a test. The origin is
|
|
295
295
|
* arbitrary (compare stamps with each other, not with `performance.now()`,
|
|
296
296
|
* a timer or the `onFrame` tick).
|
|
297
297
|
*/
|
package/src/window.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createSignal, getOwner, onCleanup, onSettled, runWithOwner, flush } from "@solidjs/signals"
|
|
2
2
|
import { requestFrame, setPointerLock } from "flux:rendertree"
|
|
3
|
-
import { renderFrame } from "
|
|
4
|
-
import { on, once } from "
|
|
5
|
-
import { exit as nativeExit, background as nativeBackground, registerProtocolHandler as nativeRegisterProtocolHandler } from "
|
|
3
|
+
import { renderFrame } from "sol:render"
|
|
4
|
+
import { on, once } from "sol:events"
|
|
5
|
+
import { exit as nativeExit, background as nativeBackground, registerProtocolHandler as nativeRegisterProtocolHandler } from "sol:app"
|
|
6
6
|
import { platform } from "flux:process"
|
|
7
7
|
import { getEventHandler, focusedNode, setFocus, activateTextInput, setInterestRoot } from "./core"
|
|
8
8
|
import { scanForOrphans, getNodePath } from "./renderer"
|
|
@@ -269,7 +269,7 @@ export function onFrame(fn: (tick: number, frame: number, rate: number) => void,
|
|
|
269
269
|
* between frames (an event handler, a timer) it is the latest frame's. It
|
|
270
270
|
* is 0 before the first frame. Not reactive, and reading it requests no
|
|
271
271
|
* frame. Use it to time things against the app's own clock from code that
|
|
272
|
-
* has no tick in hand: it follows the dev tools' clock control, `
|
|
272
|
+
* has no tick in hand: it follows the dev tools' clock control, `sol
|
|
273
273
|
* render` and a test, where performance.now() does not.
|
|
274
274
|
*/
|
|
275
275
|
export function frameTime(): number {
|