@solidrt/components 0.0.10 → 0.0.11
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 +67 -0
- package/README.md +2 -0
- package/package.json +3 -4
package/AGENTS.md
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# @solidrt/components - agent notes
|
|
2
|
+
|
|
3
|
+
Higher-level components built on @solidrt/core primitives. Optional: an app can
|
|
4
|
+
be built with core primitives alone. For the underlying element model, events,
|
|
5
|
+
reactivity, and how to run/verify, see @solidrt/core and @solidrt/cli (their
|
|
6
|
+
AGENTS.md). Full prop tables are in this package's README.
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
```sh
|
|
11
|
+
bun add @solidrt/components # peers: @solidrt/core, @solidjs/signals
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Props: layout vs style (the non-obvious split)
|
|
15
|
+
|
|
16
|
+
Most components group props into two objects, plus top-level event handlers:
|
|
17
|
+
|
|
18
|
+
- `layout={{...}}` - the core LayoutProps: flex/grid, sizing, padding/margin,
|
|
19
|
+
position. For `Text`, also the font fields (fontSize, fontWeight, ...).
|
|
20
|
+
Changing these relayouts.
|
|
21
|
+
- `style={{...}}` - paint only, never affects layout: `backgroundColor`,
|
|
22
|
+
`borderColor`, `borderWidth`, `borderRadius`, `color` (Text), and the
|
|
23
|
+
transform `x`/`y`/`rotate`/`scale`.
|
|
24
|
+
- Event handlers (`onPointerDown`, `onKeyDown`, ...) are top-level props, NOT
|
|
25
|
+
inside `layout`/`style`.
|
|
26
|
+
|
|
27
|
+
## Exports
|
|
28
|
+
|
|
29
|
+
- `Window` - root surface; renders a core `<window>`, so `render()` accepts it.
|
|
30
|
+
Applies `layout` and `style.backgroundColor` only (a window cannot be
|
|
31
|
+
transformed or bordered). Also: `title`, `fullscreen`, `vsync`, `fps`.
|
|
32
|
+
- `View` - general box; draws a background/border when the matching `style`
|
|
33
|
+
props are set.
|
|
34
|
+
- `Text` - text in a layout box; font fields go in `layout`, `color` in `style`.
|
|
35
|
+
- `Image` - fetches/decodes/uploads an image: `src: string | Uint8Array`.
|
|
36
|
+
- `TextInput` - single-line input; `value`/`onInput`/`onSubmit`, controlled or
|
|
37
|
+
uncontrolled, plus `placeholder`, `maxLength`, `autoFocus`, `disabled`.
|
|
38
|
+
- `SafeArea` - pads children clear of system UI (notches, status bars); top and
|
|
39
|
+
bottom on by default, pass `false`/a number per edge.
|
|
40
|
+
- `theme` / `setTheme` - shared appearance (colors, spacing, radii, font sizes);
|
|
41
|
+
call `setTheme({...})` to override defaults.
|
|
42
|
+
|
|
43
|
+
## Minimal app (verified to render)
|
|
44
|
+
|
|
45
|
+
```tsx
|
|
46
|
+
import { render } from "@solidrt/core"
|
|
47
|
+
import { Window, View, Text } from "@solidrt/components"
|
|
48
|
+
import { createSignal } from "@solidjs/signals"
|
|
49
|
+
|
|
50
|
+
function App() {
|
|
51
|
+
let [count, setCount] = createSignal(0)
|
|
52
|
+
return (
|
|
53
|
+
<Window title="App" style={{ backgroundColor: "#0b0f17" }}
|
|
54
|
+
layout={{ flexDirection: "column", alignItems: "center", justifyContent: "center", gap: 24 }}>
|
|
55
|
+
<Text layout={{ fontSize: 48, fontWeight: 800 }} style={{ color: "#1f6feb" }}>
|
|
56
|
+
{count()}
|
|
57
|
+
</Text>
|
|
58
|
+
<View onPointerDown={() => setCount((c) => c + 1)}
|
|
59
|
+
layout={{ padding: 16 }} style={{ backgroundColor: "#1f6feb", borderRadius: 12 }}>
|
|
60
|
+
<Text style={{ color: "#ffffff" }}>increment</Text>
|
|
61
|
+
</View>
|
|
62
|
+
</Window>
|
|
63
|
+
)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
render(() => <App />)
|
|
67
|
+
```
|
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solidrt/components",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.11",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Antoine van Wel",
|
|
6
6
|
"type": "module",
|
|
@@ -10,11 +10,10 @@
|
|
|
10
10
|
},
|
|
11
11
|
"files": [
|
|
12
12
|
"src/",
|
|
13
|
-
"
|
|
14
|
-
"LICENSE"
|
|
13
|
+
"AGENTS.md"
|
|
15
14
|
],
|
|
16
15
|
"peerDependencies": {
|
|
17
16
|
"@solidjs/signals": "2.0.0-beta.14",
|
|
18
|
-
"@solidrt/core": "0.0.
|
|
17
|
+
"@solidrt/core": "0.0.11"
|
|
19
18
|
}
|
|
20
19
|
}
|