Skip to content

Commit 056f86c

Browse files
authored
Solid support (#92)
* db complexity type fix * bumped * removed some index types from database * add SolidJS support with data-solid library and dashboard sample Introduces @adobe/data-solid — minimal bindings for SolidJS (DatabaseContext, DatabaseProvider, useDatabase, fromObserve). Observable bridging uses Solid's native from() directly; fromObserve is a thin typed wrapper that fixes TypeScript inference through Setter<T> overloads. Includes data-solid-dashboard sample: four components sharing one ECS database, each observing only its slice via individual from() signals for fine-grained reactivity. Made-with: Cursor * simplified fromObserve * bumped * separate presentation from data wiring in solid dashboard components Extract pure render functions into *.presentation.tsx files matching the project's UI standards. Components pass reactive getters to preserve Solid's fine-grained reactivity through the presentation layer. Made-with: Cursor * fromObserve accepts default value; pass accessors directly to presentation fromObserve<T, D> now takes an optional default so the returned accessor is Accessor<T | D> (collapses to Accessor<T> when D subtypes T), removing scattered ?? fallbacks. Presentations accept accessor functions and call them in JSX, so components just pass accessors by name — no getters needed. Made-with: Cursor * use const generic on fromObserve to eliminate default value casts const D infers [] as readonly [] which collapses with T, so call sites no longer need `as readonly string[]` casts on array defaults. Made-with: Cursor * flatten data-solid src — drop hooks/ and context/ subdirectories All exports come from the package root; internal folder structure adds no value. Files now live directly under src/. Made-with: Cursor * add README documentation for data-solid and data-solid-dashboard Made-with: Cursor
1 parent 953149d commit 056f86c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1400
-95
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "data-monorepo",
3-
"version": "0.9.49",
3+
"version": "0.9.51",
44
"private": true,
55
"scripts": {
66
"build": "pnpm -r run build",

packages/data-lit-tictactoe/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "data-lit-tictactoe",
3-
"version": "0.9.49",
3+
"version": "0.9.51",
44
"description": "Tic-Tac-Toe sample - Lit web components with @adobe/data-lit and AgenticService",
55
"type": "module",
66
"private": true,

packages/data-lit-todo/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "data-lit-todo",
3-
"version": "0.9.49",
3+
"version": "0.9.51",
44
"description": "Todo sample app demonstrating @adobe/data with Lit",
55
"type": "module",
66
"private": true,

packages/data-lit/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@adobe/data-lit",
3-
"version": "0.9.49",
3+
"version": "0.9.51",
44
"description": "Adobe data Lit bindings - hooks, elements, decorators",
55
"type": "module",
66
"private": false,

packages/data-react-hello/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "data-react-hello",
3-
"version": "0.9.49",
3+
"version": "0.9.51",
44
"description": "Hello World sample - click counter using @adobe/data-react",
55
"type": "module",
66
"private": true,

packages/data-react-pixie/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "data-react-pixie",
3-
"version": "0.9.49",
3+
"version": "0.9.51",
44
"description": "PixiJS React sample - ECS sprites (bunny, fox) with @adobe/data-react",
55
"type": "module",
66
"private": true,

packages/data-react/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@adobe/data-react",
3-
"version": "0.9.49",
3+
"version": "0.9.51",
44
"description": "Adobe data React bindings — hooks and context for ECS database",
55
"type": "module",
66
"private": false,
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# data-solid-dashboard
2+
3+
Mini dashboard sample demonstrating [@adobe/data-solid](../data-solid) with
4+
multiple components sharing a single ECS database.
5+
6+
## Run
7+
8+
```bash
9+
pnpm install
10+
pnpm dev # starts Vite on http://localhost:3004
11+
```
12+
13+
## What it demonstrates
14+
15+
- **Shared database** — one `DatabaseProvider` at the app root, consumed by
16+
every component via `useDatabase`.
17+
- **Fine-grained reactivity** — each component observes only the slices it
18+
needs (`count`, `log`, `userName`). Updating one resource does not re-render
19+
components that don't depend on it.
20+
- **Cross-component actions** — the control panel fires transactions
21+
(`increment`, `setUserName`, …) that are reflected in the counter display,
22+
activity log, and status bar.
23+
- **Presentation separation** — each component is split into a data-wiring
24+
file (`counter-display.tsx`) and a pure render function
25+
(`counter-display.presentation.tsx`). The presentation receives accessors
26+
and action callbacks, keeping rendering free of database concerns.
27+
28+
## Structure
29+
30+
```
31+
src/
32+
state/
33+
dashboard-plugin.ts ECS plugin — resources and transactions
34+
components/
35+
control-panel.tsx data wiring — observes count, exposes transactions
36+
control-panel.presentation.tsx
37+
counter-display.tsx data wiring — observes count
38+
counter-display.presentation.tsx
39+
activity-log.tsx data wiring — observes log
40+
activity-log.presentation.tsx
41+
status-bar.tsx data wiring — observes userName, count, log
42+
status-bar.presentation.tsx
43+
app.tsx root component — sets up DatabaseProvider
44+
main.tsx entry point
45+
```
46+
47+
## Pattern summary
48+
49+
```tsx
50+
// data wiring: setup reactive graph, delegate to presentation
51+
function CounterDisplay() {
52+
const db = useDatabase(dashboardPlugin);
53+
const count = fromObserve(db.observe.resources.count, 0);
54+
return presentation.render({ count });
55+
}
56+
57+
// presentation: pure render, accepts accessors and callbacks
58+
function render(args: { count: () => number }) {
59+
return <span>{args.count()}</span>;
60+
}
61+
```
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>data-solid-dashboard</title>
7+
<style>
8+
* { box-sizing: border-box; margin: 0; padding: 0; }
9+
body { font-family: system-ui, sans-serif; background: #0f1117; color: #e1e4e8; min-height: 100vh; }
10+
</style>
11+
</head>
12+
<body>
13+
<div id="root"></div>
14+
<script type="module" src="/src/main.tsx"></script>
15+
</body>
16+
</html>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"name": "data-solid-dashboard",
3+
"version": "0.9.51",
4+
"description": "Mini dashboard sample — multiple components sharing one @adobe/data ECS database with SolidJS",
5+
"type": "module",
6+
"private": true,
7+
"scripts": {
8+
"build": "vite build",
9+
"dev": "vite",
10+
"publish-public": "true"
11+
},
12+
"dependencies": {
13+
"@adobe/data": "workspace:*",
14+
"@adobe/data-solid": "workspace:*",
15+
"solid-js": "^1.9.12"
16+
},
17+
"devDependencies": {
18+
"typescript": "^5.8.3",
19+
"vite": "^5.1.1",
20+
"vite-plugin-solid": "^2.11.0"
21+
}
22+
}

0 commit comments

Comments
 (0)