Skip to content

Commit

Permalink
Merge pull request #1 from rodydavis/preact-signals
Browse files Browse the repository at this point in the history
Preact Signals
  • Loading branch information
rodydavis authored Nov 21, 2023
2 parents acb7b8b + 2650609 commit 4c6d02f
Show file tree
Hide file tree
Showing 16 changed files with 966 additions and 219 deletions.
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"cSpell.words": [
"preact"
]
}
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## 0.0.1

- Adding `computed`, `effect`, `signal`
- Adding `computed`, `effect`, `signal`, `untracked`
- Adding tests
- Adding web example
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ Based on the [following article](http://webcache.googleusercontent.com/search?q=

```dart
// Create signals
final count = createSignal(0);
final multiplier = createSignal(2);
final count = signal(0);
final multiplier = signal(2);
// Creating a computed value
final multipliedCount = createComputed(() {
final multipliedCount = computed(() {
return count.value * multiplier.value;
});
createEffect(() {
effect(() {
print('Effect called: Count is ${count.value} and multiplier is ${multiplier.value}');
});
Expand Down
20 changes: 10 additions & 10 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,10 @@ packages:
dependency: "direct dev"
description:
name: build_web_compilers
sha256: "70d67a571b068aa0b8f5569fea8f2d91647731643ad6d744f9035b47eefb2ace"
sha256: "66a068988c1c409021a2fe646f428c362ab49021bbf2380b6965a34fbc90c8f8"
url: "https://pub.dev"
source: hosted
version: "4.0.7"
version: "4.0.6"
built_collection:
dependency: transitive
description:
Expand Down Expand Up @@ -337,6 +337,13 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.5.1"
preact_signals:
dependency: "direct main"
description:
path: ".."
relative: true
source: path
version: "0.0.1"
protobuf:
dependency: transitive
description:
Expand Down Expand Up @@ -385,13 +392,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.0.4"
signals:
dependency: "direct main"
description:
path: ".."
relative: true
source: path
version: "0.0.1"
source_maps:
dependency: transitive
description:
Expand Down Expand Up @@ -497,4 +497,4 @@ packages:
source: hosted
version: "3.1.2"
sdks:
dart: ">=3.1.3 <3.4.0"
dart: ">=3.0.0 <3.4.0"
4 changes: 2 additions & 2 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ version: 1.0.0
publish_to: 'none'

environment:
sdk: ^3.1.3
sdk: ^3.0.0

dependencies:
signals:
preact_signals:
path: ..

dev_dependencies:
Expand Down
2 changes: 1 addition & 1 deletion example/web/main.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'dart:html';

import 'package:signals/signals.dart';
import 'package:preact_signals/preact_signals.dart';

typedef Task = ({String title, bool completed});

Expand Down
3 changes: 3 additions & 0 deletions lib/preact_signals.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
library preact_signals;

export 'src/signals.dart' show signal, computed, effect, untracked;
36 changes: 0 additions & 36 deletions lib/signals.dart

This file was deleted.

42 changes: 0 additions & 42 deletions lib/src/computed.dart

This file was deleted.

39 changes: 0 additions & 39 deletions lib/src/effect.dart

This file was deleted.

26 changes: 0 additions & 26 deletions lib/src/listenable.dart

This file was deleted.

23 changes: 0 additions & 23 deletions lib/src/signal.dart

This file was deleted.

Loading

0 comments on commit 4c6d02f

Please sign in to comment.