A project that strives to develop high-quality, community contributed Solid Primitives.

  • Small
    aggregate tree-shaking benefits
  • Isomorphic
    client and server side functionality
  • Stable
    consistent and managed testing + maintenance

Primitives

NameStagePrimitivesSizeNPM

Inputs

active-element
v2.0.17
autofocus
v0.0.108
input-mask
v0.2.0
keyboard
v1.2.5
mouse
v2.0.16
pointer
v0.2.16
scroll
v2.0.20
selection
v0.0.6

Display & Media

audio
v1.3.14
bounds
v0.0.118
devices
v1.2.4
filesystem
v1.2.0
idle
v0.0.105
intersection-observer
v2.1.3
media
v2.2.5
page-visibility
v2.0.14
resize-observer
v2.0.22
styles
v0.0.111

Browser APIs

broadcast-channel
v0.0.103
clipboard
v1.5.7
event-listener
v2.3.0
event-props
v0.2.5
fullscreen
v1.2.4
geolocation
v1.4.11
mutation-observer
v1.1.14
permission
v1.2.4
storage
v2.1.1
timer
v1.3.7
upload
v0.0.114
workers
v0.2.5

Network

connectivity
v0.3.17
fetch
v2.4.6
graphql
v2.0.1
stream
v0.6.11
websocket
v1.1.0

Control Flow

context
v0.2.1
jsx-tokenizer
v1.0.7
keyed
v1.2.0
range
v0.1.15
refs
v1.0.5

Utilities

controlled-props
v0.0.12
cursor
v0.0.112
date
v2.0.18
event-bus
v1.0.8
event-dispatcher
v0.0.105
flux-store
v0.0.2
history
v0.1.2
i18n
v2.0.0
platform
v0.1.0
promise
v1.0.13
props
v3.1.8
scheduled
v1.4.1
script-loader
v2.0.2
share
v2.0.4

Reactivity

deep
v0.2.4
destructure
v0.1.14
immutable
v1.0.3
lifecycle
v0.0.100
map
v0.4.8
memo
v1.3.5
mutable
v1.0.0
resource
v0.1.0
rootless
v1.4.2
set
v0.4.8
signal-builders
v0.1.14
state-machine
v0.0.1
static-store
v0.0.5
trigger
v1.0.8

UI Patterns

marker
v0.0.1
masonry
v0.0.4
pagination
v0.2.8

Animation

presence
v0.0.3
raf
v2.1.13
transition-group
v1.0.3
tween
v1.2.6

Solid Start

start
v0.0.2

#Contribution Process


StageDescription
XDeprecated or rejected
0Initial Submission
1Demonstrations and examples
2General use (experimental)
3Pre-shipping (final effort)
4Accepted/Shipped

Solid Primitives strives to provide idiomatic Solid principles but also allow room for innovation and experimentation. In a growing community many opinions and patterns merge together to produce a de facto standard. Managing opinions and expectations can be difficult. As a result, in November 2021 Solid Primitives implemented a ratification/approval tracking process roughly modelled on TC39 Proposal Stage Process. The following summarizes these stages briefly:

Any primitive Stage 01 should be used with caution and with the understanding that the design or implementation may change. Beyond Stage 2 we make an effort to mitigate changes. If a primitive reaches Stage 2 it's likely to remain an official package with additional approvement until fully accepted and shipped.

#Philosophy

The goal of Solid Primitives is to wrap client and server side functionality to provide a fully reactive API layer. Ultimately the more rooted our tertiary primitives are, the more they act as foundation within Solid's base ecosystem. With well built and re-used foundations, the smaller (aggregate tree-shaking benefits), more concise (readability) and stable (consistent and managed testing + maintenance) applications can be overall.

#Design Maxims

Other frameworks have large and extremely well established ecosystems. Notably React which has a vast array of component and hooks. The amount of choice within the ecosystem is great but often these tools are built as one-offs resulting in often un-tested logic or are designed with narrow needs. Over time the less concise these building blocks are the more they tend to repeat themselves. Our goal with Primitives is to bring the community together to contribute, evolve and utilize a powerful centralize primitive foundation.

All our primitives are meant to be consistent and sustain a level of quality. We guarantee that each is created with the utmost care. Our primitives are:

  1. Documented and follow a consistent style guide
  2. Be well tested
  3. Small, concise and practical as possible
  4. A single primitive for a single purpose
  5. No dependencies or as few as possible
  6. SSR safe entries (or short-circuits where needed) provided
  7. Wrap base level Browser APIs
  8. Should be progressively improved for future features
  9. Be focused on composition vs. isolation of logic
  10. Community voice and needs guide road map and planning
  11. Strong TypeScript support
  12. Support for both CJS and ESM
  13. Solid performance!

#Basic and Compound Primitives

Each primitive is designed with composition in mind. A major rule in designing our primitives is deciding that the interface of primitives should be composable or segmented. For this reason every API is intricately studied and considered to be composed (stacked with features) or decomposed into smaller units. Designing our primitives in this manner allows for better tree-shaking and extendable complexity only as needed. You should only ship what you have to by picking from existing primitives as your foundational building blocks.

Much of the design decisions in naming are best described in the 7 Lessons to Outlive React talk by swyx. We strive to follow a similar design pattern promoted by the React core team.

#make (non-reactive) vs create (reactive)

Solid uses the create prefix to define a primitive that provides reactive utility. Solid Primitives reinforces this pattern but in an effort to enhance composability we have also introduced the make prefix for identifying non-reactive foundation primitives. Having a non-reactive alternative means that the primitive does the bare essentials such as cleaning up events or interupting a process. ie. makeTimer will create and clean-up the scheduler, providing only a clear method. createTimer provides a properly reactive primitive that composes it.

#Managing Primitive Complexity

Solid Primitives is mostly about supplying 80-90% of the common-use cases for the end-user. We prefer to be less prescriptive than other hook libraries such as VueUse and supply granular solutions as opposed to monolithic primitives. The remaining 10-20% of complex use cases are likely not to be covered with this library. This is on purpose to limit the potential of bloat and extended complexity. This project strives to provide foundations and not cumulative solutions. We expect the broader ecosystem will fill the remaining need as further composition to this projects effort. This allows for just the right amount of prescription and opinion.