Skip to content

Commit 2269d17

Browse files
Version Packages
1 parent cf224a5 commit 2269d17

12 files changed

Lines changed: 91 additions & 76 deletions

File tree

.changeset/hungry-apricots-shake.md

Lines changed: 0 additions & 45 deletions
This file was deleted.

.changeset/proud-tomatoes-flow.md

Lines changed: 0 additions & 22 deletions
This file was deleted.

extension/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# preact-signals-devtools
22

3+
## 1.1.6
4+
5+
### Patch Changes
6+
7+
- Updated dependencies [[`19ac39b`](https://github.com/preactjs/signals/commit/19ac39bb4a7a3273090753a50a58efb717f5553d)]:
8+
- @preact/signals-core@1.13.0
9+
310
## 1.1.5
411

512
### Patch Changes

extension/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "preact-signals-devtools",
3-
"version": "1.1.5",
3+
"version": "1.1.6",
44
"description": "Chrome DevTools extension for debugging Preact Signals",
55
"private": true,
66
"type": "module",

packages/core/CHANGELOG.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,50 @@
11
# @preact/signals-core
22

3+
## 1.13.0
4+
5+
### Minor Changes
6+
7+
- [#812](https://github.com/preactjs/signals/pull/812) [`19ac39b`](https://github.com/preactjs/signals/commit/19ac39bb4a7a3273090753a50a58efb717f5553d) Thanks [@andrewiggins](https://github.com/andrewiggins)! - Add `createModel` and `action` to signals core package
8+
9+
**`createModel`** provides a structured way to create reactive model classes that encapsulate signals, computed values, and actions:
10+
11+
```js
12+
const CounterModel = createModel((initialCount = 0) => {
13+
const count = signal(initialCount);
14+
const doubled = computed(() => count.value * 2);
15+
16+
effect(() => {
17+
console.log("Count changed:", count.value);
18+
});
19+
20+
return {
21+
count,
22+
doubled,
23+
increment() {
24+
count.value++;
25+
},
26+
};
27+
});
28+
29+
const counter = new CounterModel(5);
30+
counter.increment(); // Updates are automatically batched
31+
counter[Symbol.dispose](); // Cleans up all effects
32+
```
33+
34+
Key features:
35+
- Factory functions can accept arguments for initialization
36+
- All methods are automatically wrapped as actions (batched & untracked)
37+
- Effects created during model construction are captured and disposed when the model is disposed via `Symbol.dispose`
38+
- TypeScript validates that models only contain signals, actions, or nested objects with signals/actions
39+
40+
**`action`** is a helper that wraps a function to run batched and untracked:
41+
42+
```js
43+
const updateAll = action(items => {
44+
items.forEach(item => item.value++);
45+
}); // All updates batched into single notification
46+
```
47+
348
## 1.12.2
449

550
### Patch Changes

packages/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@preact/signals-core",
3-
"version": "1.12.2",
3+
"version": "1.13.0",
44
"license": "MIT",
55
"description": "Manage state with style in every framework",
66
"keywords": [],

packages/debug/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# @preact/signals-debug
22

3+
## 2.0.0
4+
5+
### Patch Changes
6+
7+
- Updated dependencies [[`19ac39b`](https://github.com/preactjs/signals/commit/19ac39bb4a7a3273090753a50a58efb717f5553d)]:
8+
- @preact/signals-core@1.13.0
9+
310
## 1.3.0
411

512
### Minor Changes

packages/debug/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@preact/signals-debug",
3-
"version": "1.3.0",
3+
"version": "2.0.0",
44
"license": "MIT",
55
"description": "Debugging tools for @preact/signals",
66
"keywords": [],
@@ -41,10 +41,10 @@
4141
"prepublishOnly": "cd ../.. && pnpm build:debug"
4242
},
4343
"devDependencies": {
44-
"@preact/signals-core": "workspace:^1.12.2"
44+
"@preact/signals-core": "workspace:^1.13.0"
4545
},
4646
"peerDependencies": {
47-
"@preact/signals-core": ">=1.12.2"
47+
"@preact/signals-core": ">=1.13.0"
4848
},
4949
"publishConfig": {
5050
"access": "public",

packages/preact/utils/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
}
1919
},
2020
"dependencies": {
21-
"@preact/signals-core": "workspace:^1.12.2"
21+
"@preact/signals-core": "workspace:^1.13.0"
2222
},
2323
"peerDependencies": {
2424
"@preact/signals": "workspace:*",

packages/react-transform/CHANGELOG.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,28 @@
11
# @preact/signals-react-transform
22

3+
## 0.8.1
4+
5+
### Patch Changes
6+
7+
- [#814](https://github.com/preactjs/signals/pull/814) [`a5d0a6e`](https://github.com/preactjs/signals/commit/a5d0a6e74684a91cbe2354b60f3da3d862e1198b) Thanks [@andrewiggins](https://github.com/andrewiggins)! - Fix JSX detection leaking to non-component functions in the same scope
8+
9+
Previously, when a component containing JSX was defined inside another function, the JSX detection could incorrectly "leak" to sibling functions or the parent function, causing non-components to be transformed. This was especially problematic in test files where components are defined inside `it()` or `describe()` blocks.
10+
11+
```js
12+
describe("suite", () => {
13+
it("test", () => {
14+
// This arrow function was incorrectly transformed because
15+
// Counter's JSX detection leaked to sibling functions
16+
const CountModel = () => signal.value;
17+
function Counter() {
18+
return <div>Hello</div>;
19+
}
20+
});
21+
});
22+
```
23+
24+
The transform now correctly scopes JSX and signal usage detection to only the containing component or custom hook function.
25+
326
## 0.8.0
427

528
### Minor Changes

0 commit comments

Comments
 (0)