Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Standard Signals #39

Merged
merged 6 commits into from
Apr 9, 2024
Merged

Standard Signals #39

merged 6 commits into from
Apr 9, 2024

Conversation

justinfagnani
Copy link
Contributor

Getting an RFC up before I put up a PR for the @lit-labs/signals package. Copied and edited from the Preact signals RFC.

Copy link

@rictic rictic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hell yeah!

rfcs/NNNN-standard-signals.md Outdated Show resolved Hide resolved
Copy link

@augustjk augustjk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor suggestions

rfcs/NNNN-standard-signals.md Outdated Show resolved Hide resolved
rfcs/NNNN-standard-signals.md Outdated Show resolved Hide resolved
rfcs/NNNN-standard-signals.md Outdated Show resolved Hide resolved
@redfox-mx
Copy link

Hello @justinfagnani n.n Nice to meet you.

So, when @lit-labs/preact-signals was launched proposal suggests offer integration with different framework signals could be "possible".

In that sense, @lit-labs/signals is meant to be the right option for signals flavour in lit?

justinfagnani and others added 3 commits April 9, 2024 15:47
Co-authored-by: Augustine Kim <ajk830@gmail.com>
Co-authored-by: Augustine Kim <ajk830@gmail.com>
Co-authored-by: Peter Burns <rictic@gmail.com>
Copy link
Member

@e111077 e111077 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my suggestions have been addressed

@justinfagnani
Copy link
Contributor Author

@redfox-mx the mention of support for other signals packages in the Preact signals RFC is acknowledging the interop problem of having many incompatible userland signals implementations. Standard signals would solve this problem. In that sense, this RFC would be the right way forward and @lit-labs/preact-signals might be retired instead of ever graduating, and @lit-labs/signals would either graduate or be superseded by support int he core libraries.

However, they would both be labs packages for some time, and the underlying signals implementations aren't compatible, so if you're already using Preact signals elsewhere, you'd want to use @lit-labs/preact-signals, and if you're using another userland implementation, then presumably you'd still like an adapter for it until you can move to standard signals.

@justinfagnani
Copy link
Contributor Author

Thanks y'all. Merging RFC #0005 now!

@hunterloftis
Copy link

hunterloftis commented May 27, 2024

@justinfagnani glad I searched before starting to write a lit-signals package!

For others looking for the referenced PR: lit/lit#4615

gordonbrander added a commit to gordonbrander/spellcaster that referenced this pull request Jul 4, 2024
Fixes #39 

This PR:

- adds `signal-polyfill` as a dependency
- replaces our signals implementation with the native signals proposal polyfill
- introduces a vanilla browser bundle via esbuild

**Background**: It looks likely that [reactive signals will become a language feature](https://github.com/proposal-signals/proposal-signals). TC39 signals are meant to be a lower-level primitive that is wrapped in a library. We're going to adopt signals by wrapping these low-level features in a higher-level API. The library API for Spellcaster will not change.

Using native signals has some significant advantages:

- Standard signals act as a Schelling point for the ecosystem.
  - Many libraries are contributing to the spec and/or adopting.
  - For example, [Lit is implementing signal support](lit/rfcs#39), so adopting native signals would mean Spellcaster *just works* with Lit.
  - It seems plausible that future platform APIs may use them as well.
- All libraries that use TC39 signals under the hood will share the same signal graph, even if they expose different surface-level APIs.
- Spellcaster becomes even smaller.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants