solid-js 1.8.17 → 1.8.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/README.md +223 -223
  2. package/dist/dev.cjs +29 -24
  3. package/dist/dev.js +344 -580
  4. package/dist/server.cjs +31 -18
  5. package/dist/server.js +103 -185
  6. package/dist/solid.cjs +29 -24
  7. package/dist/solid.js +302 -507
  8. package/h/dist/h.cjs +12 -1
  9. package/h/dist/h.js +19 -34
  10. package/h/jsx-runtime/dist/jsx.js +1 -1
  11. package/h/jsx-runtime/types/index.d.ts +8 -11
  12. package/h/jsx-runtime/types/jsx.d.ts +5 -0
  13. package/h/types/hyperscript.d.ts +11 -11
  14. package/html/dist/html.js +94 -216
  15. package/html/types/lit.d.ts +33 -47
  16. package/package.json +3 -3
  17. package/store/dist/dev.js +43 -122
  18. package/store/dist/server.js +8 -19
  19. package/store/dist/store.js +40 -113
  20. package/store/types/index.d.ts +7 -21
  21. package/store/types/modifiers.d.ts +3 -6
  22. package/store/types/mutable.d.ts +2 -5
  23. package/store/types/server.d.ts +4 -12
  24. package/store/types/store.d.ts +62 -219
  25. package/types/index.d.ts +10 -75
  26. package/types/jsx.d.ts +5 -0
  27. package/types/reactive/array.d.ts +6 -14
  28. package/types/reactive/observable.d.ts +18 -26
  29. package/types/reactive/scheduler.d.ts +6 -9
  30. package/types/reactive/signal.d.ts +164 -255
  31. package/types/render/Suspense.d.ts +7 -7
  32. package/types/render/component.d.ts +33 -64
  33. package/types/render/flow.d.ts +37 -49
  34. package/types/render/hydration.d.ts +15 -13
  35. package/types/server/index.d.ts +2 -57
  36. package/types/server/reactive.d.ts +42 -73
  37. package/types/server/rendering.d.ts +99 -168
  38. package/universal/dist/dev.js +12 -28
  39. package/universal/dist/universal.js +12 -28
  40. package/universal/types/index.d.ts +1 -3
  41. package/universal/types/universal.d.ts +1 -0
  42. package/web/dist/dev.cjs +6 -4
  43. package/web/dist/dev.js +88 -630
  44. package/web/dist/server.cjs +6 -6
  45. package/web/dist/server.js +102 -216
  46. package/web/dist/web.cjs +6 -4
  47. package/web/dist/web.js +86 -621
  48. package/web/storage/dist/storage.js +3 -3
  49. package/web/types/client.d.ts +2 -2
  50. package/web/types/core.d.ts +1 -10
  51. package/web/types/index.d.ts +12 -29
  52. package/web/types/server-mock.d.ts +32 -47
package/README.md CHANGED
@@ -1,223 +1,223 @@
1
- <p>
2
- <img src="https://assets.solidjs.com/banner?project=Library&type=core" alt="SolidJS" />
3
- </p>
4
-
5
- [![Build Status](https://img.shields.io/github/actions/workflow/status/solidjs/solid/main-ci.yml?branch=main&logo=github&style=for-the-badge)](https://github.com/solidjs/solid/actions/workflows/main-ci.yml)
6
- [![Coverage Status](https://img.shields.io/coveralls/github/solidjs/solid.svg?style=for-the-badge)](https://coveralls.io/github/solidjs/solid?branch=main)
7
-
8
- [![NPM Version](https://img.shields.io/npm/v/solid-js.svg?style=for-the-badge)](https://www.npmjs.com/package/solid-js)
9
- [![](https://img.shields.io/npm/dm/solid-js.svg?style=for-the-badge)](https://www.npmjs.com/package/solid-js)
10
- [![Discord](https://img.shields.io/discord/722131463138705510?style=for-the-badge)](https://discord.com/invite/solidjs)
11
- [![Subreddit subscribers](https://img.shields.io/reddit/subreddit-subscribers/solidjs?style=for-the-badge)](https://www.reddit.com/r/solidjs/)
12
-
13
- **[Website](https://www.solidjs.com/) • [API Docs](https://www.solidjs.com/docs/latest/api) • [Features Tutorial](https://www.solidjs.com/tutorial/introduction_basics) • [Playground](https://playground.solidjs.com/?version=1.3.13#NobwRAdghgtgpmAXGGUCWEwBowBcCeADgsrgM4Ae2YZA9gK4BOAxiWGjIbY7gAQi9GcCABM4jXgF9eAM0a0YvADo1aAGzQiAtACsyAegDucAEYqA3EogcuPfr2ZCouOAGU0Ac2hqps+YpU6DW09CysrGXoIZlw0WgheAGEGCBdGAAoASn4rXgd4sj5gZhTcLF4yOFxkqNwAXV4AXgcnF3cvKDV0gAZMywT8iELeDEc4eFSm3iymgD4KqprU9JLamYBqXgBGPvCBoVwmBPTcvN4AHhN6XFx43gJiRpUrm-iVXnjEjWYAa0aQUZCCa4SSzU5nfirZaZSTgi76F63CBgga7CCwiBWISicTpGaNebnJZpXj6WblES0Zj0YEAOg8VQAompxsJcAAhfAASREJzAUEIhBUmTRYEkdSAA) • [Discord](https://discord.com/invite/solidjs)**
14
-
15
- Solid is a declarative JavaScript library for creating user interfaces. Instead of using a Virtual DOM, it compiles its templates to real DOM nodes and updates them with fine-grained reactions. Declare your state and use it throughout your app, and when a piece of state changes, only the code that depends on it will rerun. Check out our [intro video](https://www.youtube.com/watch?v=J70HXl1KhWE&ab_channel=SolidJS) or read on!
16
-
17
- ## Key Features
18
-
19
- - Fine-grained updates to the real DOM
20
- - Declarative data: model your state as a system with reactive primitives
21
- - Render-once mental model: your components are regular JavaScript functions that run once to set up your view
22
- - Automatic dependency tracking: accessing your reactive state subscribes to it
23
- - [Small](https://dev.to/this-is-learning/javascript-framework-todomvc-size-comparison-504f) and [fast](https://krausest.github.io/js-framework-benchmark/current.html)
24
- - Simple: learn a few powerful concepts that can be reused, combined, and built on top of
25
- - Provides modern framework features like JSX, fragments, Context, Portals, Suspense, streaming SSR, progressive hydration, Error Boundaries and concurrent rendering.
26
- - Naturally debuggable: A `<div>` is a real div, so you can use your browser's devtools to inspect the rendering
27
- - [Web component friendly](https://github.com/solidjs/solid/tree/main/packages/solid-element#readme) and can author custom elements
28
- - Isomorphic: render your components on the client and the server
29
- - Universal: write [custom renderers](https://github.com/solidjs/solid/releases/tag/v1.2.0) to use Solid anywhere
30
- - A growing community and ecosystem with active core team support
31
-
32
- <details>
33
-
34
- <summary>Quick Start</summary>
35
-
36
- You can get started with a simple app by running the following in your terminal:
37
-
38
- ```sh
39
- > npx degit solidjs/templates/js my-app
40
- > cd my-app
41
- > npm i # or yarn or pnpm
42
- > npm run dev # or yarn or pnpm
43
- ```
44
-
45
- Or for TypeScript:
46
-
47
- ```sh
48
- > npx degit solidjs/templates/ts my-app
49
- > cd my-app
50
- > npm i # or yarn or pnpm
51
- > npm run dev # or yarn or pnpm
52
- ```
53
-
54
- This will create a minimal, client-rendered application powered by [Vite](https://vitejs.dev/).
55
-
56
- Or you can install the dependencies in your own setup. To use Solid with JSX (_recommended_), run:
57
-
58
- ```sh
59
- > npm i -D babel-preset-solid
60
- > npm i solid-js
61
- ```
62
-
63
- The easiest way to get set up is to add `babel-preset-solid` to your `.babelrc`, babel config for webpack, or rollup configuration:
64
-
65
- ```js
66
- "presets": ["solid"]
67
- ```
68
-
69
- For TypeScript to work, remember to set your `.tsconfig` to handle Solid's JSX:
70
-
71
- ```js
72
- "compilerOptions": {
73
- "jsx": "preserve",
74
- "jsxImportSource": "solid-js",
75
- }
76
- ```
77
-
78
- </details>
79
-
80
- ## Why Solid?
81
-
82
- ### Performant
83
-
84
- Meticulously engineered for performance and with half a decade of research behind it, Solid's performance is almost indistinguishable from optimized vanilla JavaScript (See Solid on the [JS Framework Benchmark](https://rawgit.com/krausest/js-framework-benchmark/master/webdriver-ts-results/table.html)). Solid is [small](https://bundlephobia.com/package/solid-js@1.3.15) and completely tree-shakable, and [fast](https://levelup.gitconnected.com/how-we-wrote-the-fastest-javascript-ui-framework-again-db097ddd99b6) when rendering on the server, too. Whether you're writing a fully client-rendered SPA or a server-rendered app, your users see it faster than ever. ([Read more about Solid's performance](https://dev.to/ryansolid/thinking-granular-how-is-solidjs-so-performant-4g37) from the library's creator.)
85
-
86
- ### Powerful
87
-
88
- Solid is fully-featured with everything you can expect from a modern framework. Performant state management is built-in with Context and Stores: you don't have to reach for a third party library to manage global state (if you don't want to). With Resources, you can use data loaded from the server like any other piece of state and build a responsive UI for it thanks to Suspense and concurrent rendering. And when you're ready to move to the server, Solid has full SSR and serverless support, with streaming and progressive hydration to get to interactive as quickly as possible. (Check out our full [interactive features walkthrough](https://www.solidjs.com/tutorial/introduction_basics).)
89
-
90
- ### Pragmatic
91
-
92
- Do more with less: use simple, composable primitives without hidden rules and gotchas. In Solid, components are just functions - rendering is determined purely by how your state is used - so you're free to organize your code how you like and you don't have to learn a new rendering system. Solid encourages patterns like declarative code and read-write segregation that help keep your project maintainable, but isn't opinionated enough to get in your way.
93
-
94
- ### Productive
95
-
96
- Solid is built on established tools like JSX and TypeScript and integrates with the Vite ecosystem. Solid's bare-metal, minimal abstractions give you direct access to the DOM, making it easy to use your favorite native JavaScript libraries like D3. And the Solid ecosystem is growing fast, with [custom primitives](https://github.com/solidjs-community/solid-primitives), [component libraries](https://hope-ui.com/), and build-time utilities that let you [write Solid code in new ways](https://github.com/LXSMNSYC/solid-labels).
97
-
98
- <details>
99
- <summary>Show Me!</summary>
100
-
101
- ```jsx
102
- import { render } from "solid-js/web";
103
- import { createSignal } from "solid-js";
104
-
105
- // A component is just a function that (optionally) accepts properties and returns a DOM node
106
- const Counter = props => {
107
- // Create a piece of reactive state, giving us a accessor, count(), and a setter, setCount()
108
- const [count, setCount] = createSignal(props.startingCount || 1);
109
-
110
- // The increment function calls the setter
111
- const increment = () => setCount(count() + 1);
112
-
113
- console.log(
114
- "The body of the function runs once, like you'd expect from calling any other function, so you only ever see this console log once."
115
- );
116
-
117
- // JSX allows us to write HTML within our JavaScript function and include dynamic expressions using the { } syntax
118
- // The only part of this that will ever rerender is the count() text.
119
- return (
120
- <button type="button" onClick={increment}>
121
- Increment {count()}
122
- </button>
123
- );
124
- };
125
-
126
- // The render function mounts a component onto your page
127
- render(() => <Counter startingCount={2} />, document.getElementById("app"));
128
- ```
129
-
130
- See it in action in our interactive [Playground](https://playground.solidjs.com/?hash=-894962706&version=1.3.13)!
131
-
132
- Solid compiles our JSX down to efficient real DOM expressions updates, still using the same reactive primitives (`createSignal`) at runtime but making sure there's as little rerendering as possible. Here's what that looks like in this example:
133
-
134
- ```js
135
- import { render, createComponent, delegateEvents, insert, template } from "solid-js/web";
136
- import { createSignal } from "solid-js";
137
-
138
- const _tmpl$ = /*#__PURE__*/ template(`<button type="button">Increment </button>`, 2);
139
-
140
- const Counter = props => {
141
- const [count, setCount] = createSignal(props.startingCount || 1);
142
- const increment = () => setCount(count() + 1);
143
-
144
- console.log("The body of the function runs once . . .");
145
-
146
- return (() => {
147
- //_el$ is a real DOM node!
148
- const _el$ = _tmpl$.cloneNode(true);
149
- _el$.firstChild;
150
-
151
- _el$.$$click = increment;
152
-
153
- //This inserts the count as a child of the button in a way that allows count to update without rerendering the whole button
154
- insert(_el$, count, null);
155
-
156
- return _el$;
157
- })();
158
- };
159
-
160
- render(
161
- () =>
162
- createComponent(Counter, {
163
- startingCount: 2
164
- }),
165
- document.getElementById("app")
166
- );
167
-
168
- delegateEvents(["click"]);
169
- ```
170
-
171
- </details>
172
-
173
- ## More
174
-
175
- Check out our official [documentation](https://www.solidjs.com/guide) or browse some [examples](https://github.com/solidjs/solid/blob/main/documentation/resources/examples.md)
176
-
177
- ## Browser Support
178
-
179
- SolidJS Core is committed to supporting the last 2 years of modern browsers including Firefox, Safari, Chrome and Edge (for desktop and mobile devices). We do not support IE or similar sunset browsers. For server environments, we support Node LTS and the latest Deno and Cloudflare Worker runtimes.
180
-
181
- <img src="https://saucelabs.github.io/images/opensauce/powered-by-saucelabs-badge-gray.svg?sanitize=true" alt="Testing Powered By SauceLabs" width="300"/>
182
-
183
- ## Community
184
-
185
- Come chat with us on [Discord](https://discord.com/invite/solidjs)! Solid's creator and the rest of the core team are active there, and we're always looking for contributions.
186
-
187
- ### Contributors
188
-
189
- <a href="https://github.com/solidjs/solid/graphs/contributors"><img src="https://opencollective.com/solid/contributors.svg?width=890&amp;button=false" style="max-width:100%;"></a>
190
-
191
- ### Open Collective
192
-
193
- Support us with a donation and help us continue our activities. [[Contribute](https://opencollective.com/solid)]
194
-
195
- <a href="https://opencollective.com/solid/backer/0/website" target="_blank"><img src="https://opencollective.com/solid/backer/0/avatar.svg"></a>
196
- <a href="https://opencollective.com/solid/backer/1/website" target="_blank"><img src="https://opencollective.com/solid/backer/1/avatar.svg"></a>
197
- <a href="https://opencollective.com/solid/backer/2/website" target="_blank"><img src="https://opencollective.com/solid/backer/2/avatar.svg"></a>
198
- <a href="https://opencollective.com/solid/backer/3/website" target="_blank"><img src="https://opencollective.com/solid/backer/3/avatar.svg"></a>
199
- <a href="https://opencollective.com/solid/backer/4/website" target="_blank"><img src="https://opencollective.com/solid/backer/4/avatar.svg"></a>
200
- <a href="https://opencollective.com/solid/backer/5/website" target="_blank"><img src="https://opencollective.com/solid/backer/5/avatar.svg"></a>
201
- <a href="https://opencollective.com/solid/backer/6/website" target="_blank"><img src="https://opencollective.com/solid/backer/6/avatar.svg"></a>
202
- <a href="https://opencollective.com/solid/backer/7/website" target="_blank"><img src="https://opencollective.com/solid/backer/7/avatar.svg"></a>
203
- <a href="https://opencollective.com/solid/backer/8/website" target="_blank"><img src="https://opencollective.com/solid/backer/8/avatar.svg"></a>
204
- <a href="https://opencollective.com/solid/backer/9/website" target="_blank"><img src="https://opencollective.com/solid/backer/9/avatar.svg"></a>
205
- <a href="https://opencollective.com/solid/backer/10/website" target="_blank"><img src="https://opencollective.com/solid/backer/10/avatar.svg"></a>
206
-
207
- ### Sponsors
208
-
209
- Become a sponsor and get your logo on our README on GitHub with a link to your site. [[Become a sponsor](https://opencollective.com/solid#sponsor)]
210
-
211
- <a href="https://opencollective.com/solid/sponsor/0/website" target="_blank"><img src="https://opencollective.com/solid/sponsor/0/avatar.svg"></a>
212
- <a href="https://opencollective.com/solid/sponsor/1/website" target="_blank"><img src="https://opencollective.com/solid/sponsor/1/avatar.svg"></a>
213
- <a href="https://opencollective.com/solid/sponsor/2/website" target="_blank"><img src="https://opencollective.com/solid/sponsor/2/avatar.svg"></a>
214
- <a href="https://opencollective.com/solid/sponsor/3/website" target="_blank"><img src="https://opencollective.com/solid/sponsor/3/avatar.svg"></a>
215
- <a href="https://opencollective.com/solid/sponsor/4/website" target="_blank"><img src="https://opencollective.com/solid/sponsor/4/avatar.svg"></a>
216
- <a href="https://opencollective.com/solid/sponsor/5/website" target="_blank"><img src="https://opencollective.com/solid/sponsor/5/avatar.svg"></a>
217
- <a href="https://opencollective.com/solid/sponsor/6/website" target="_blank"><img src="https://opencollective.com/solid/sponsor/6/avatar.svg"></a>
218
- <a href="https://opencollective.com/solid/sponsor/7/website" target="_blank"><img src="https://opencollective.com/solid/sponsor/7/avatar.svg"></a>
219
- <a href="https://opencollective.com/solid/sponsor/8/website" target="_blank"><img src="https://opencollective.com/solid/sponsor/8/avatar.svg"></a>
220
- <a href="https://opencollective.com/solid/sponsor/9/website" target="_blank"><img src="https://opencollective.com/solid/sponsor/9/avatar.svg"></a>
221
- <a href="https://opencollective.com/solid/sponsor/10/website" target="_blank"><img src="https://opencollective.com/solid/sponsor/10/avatar.svg"></a>
222
- <a href="https://opencollective.com/solid/sponsor/11/website" target="_blank"><img src="https://opencollective.com/solid/sponsor/11/avatar.svg"></a>
223
- <a href="https://opencollective.com/solid/sponsor/12/website" target="_blank"><img src="https://opencollective.com/solid/sponsor/12/avatar.svg"></a>
1
+ <p>
2
+ <img src="https://assets.solidjs.com/banner?project=Library&type=core" alt="SolidJS" />
3
+ </p>
4
+
5
+ [![Build Status](https://img.shields.io/github/actions/workflow/status/solidjs/solid/main-ci.yml?branch=main&logo=github&style=for-the-badge)](https://github.com/solidjs/solid/actions/workflows/main-ci.yml)
6
+ [![Coverage Status](https://img.shields.io/coveralls/github/solidjs/solid.svg?style=for-the-badge)](https://coveralls.io/github/solidjs/solid?branch=main)
7
+
8
+ [![NPM Version](https://img.shields.io/npm/v/solid-js.svg?style=for-the-badge)](https://www.npmjs.com/package/solid-js)
9
+ [![](https://img.shields.io/npm/dm/solid-js.svg?style=for-the-badge)](https://www.npmjs.com/package/solid-js)
10
+ [![Discord](https://img.shields.io/discord/722131463138705510?style=for-the-badge)](https://discord.com/invite/solidjs)
11
+ [![Subreddit subscribers](https://img.shields.io/reddit/subreddit-subscribers/solidjs?style=for-the-badge)](https://www.reddit.com/r/solidjs/)
12
+
13
+ **[Website](https://www.solidjs.com/) • [API Docs](https://docs.solidjs.com/) • [Features Tutorial](https://www.solidjs.com/tutorial/introduction_basics) • [Playground](https://playground.solidjs.com/?version=1.3.13#NobwRAdghgtgpmAXGGUCWEwBowBcCeADgsrgM4Ae2YZA9gK4BOAxiWGjIbY7gAQi9GcCABM4jXgF9eAM0a0YvADo1aAGzQiAtACsyAegDucAEYqA3EogcuPfr2ZCouOAGU0Ac2hqps+YpU6DW09CysrGXoIZlw0WgheAGEGCBdGAAoASn4rXgd4sj5gZhTcLF4yOFxkqNwAXV4AXgcnF3cvKDV0gAZMywT8iELeDEc4eFSm3iymgD4KqprU9JLamYBqXgBGPvCBoVwmBPTcvN4AHhN6XFx43gJiRpUrm-iVXnjEjWYAa0aQUZCCa4SSzU5nfirZaZSTgi76F63CBgga7CCwiBWISicTpGaNebnJZpXj6WblES0Zj0YEAOg8VQAompxsJcAAhfAASREJzAUEIhBUmTRYEkdSAA) • [Discord](https://discord.com/invite/solidjs)**
14
+
15
+ Solid is a declarative JavaScript library for creating user interfaces. Instead of using a Virtual DOM, it compiles its templates to real DOM nodes and updates them with fine-grained reactions. Declare your state and use it throughout your app, and when a piece of state changes, only the code that depends on it will rerun. Check out our [intro video](https://www.youtube.com/watch?v=J70HXl1KhWE&ab_channel=SolidJS) or read on!
16
+
17
+ ## Key Features
18
+
19
+ - Fine-grained updates to the real DOM
20
+ - Declarative data: model your state as a system with reactive primitives
21
+ - Render-once mental model: your components are regular JavaScript functions that run once to set up your view
22
+ - Automatic dependency tracking: accessing your reactive state subscribes to it
23
+ - [Small](https://dev.to/this-is-learning/javascript-framework-todomvc-size-comparison-504f) and [fast](https://krausest.github.io/js-framework-benchmark/current.html)
24
+ - Simple: learn a few powerful concepts that can be reused, combined, and built on top of
25
+ - Provides modern framework features like JSX, fragments, Context, Portals, Suspense, streaming SSR, progressive hydration, Error Boundaries and concurrent rendering.
26
+ - Naturally debuggable: A `<div>` is a real div, so you can use your browser's devtools to inspect the rendering
27
+ - [Web component friendly](https://github.com/solidjs/solid/tree/main/packages/solid-element#readme) and can author custom elements
28
+ - Isomorphic: render your components on the client and the server
29
+ - Universal: write [custom renderers](https://github.com/solidjs/solid/releases/tag/v1.2.0) to use Solid anywhere
30
+ - A growing community and ecosystem with active core team support
31
+
32
+ <details>
33
+
34
+ <summary>Quick Start</summary>
35
+
36
+ You can get started with a simple app by running the following in your terminal:
37
+
38
+ ```sh
39
+ > npx degit solidjs/templates/js my-app
40
+ > cd my-app
41
+ > npm i # or yarn or pnpm
42
+ > npm run dev # or yarn or pnpm
43
+ ```
44
+
45
+ Or for TypeScript:
46
+
47
+ ```sh
48
+ > npx degit solidjs/templates/ts my-app
49
+ > cd my-app
50
+ > npm i # or yarn or pnpm
51
+ > npm run dev # or yarn or pnpm
52
+ ```
53
+
54
+ This will create a minimal, client-rendered application powered by [Vite](https://vitejs.dev/).
55
+
56
+ Or you can install the dependencies in your own setup. To use Solid with JSX (_recommended_), run:
57
+
58
+ ```sh
59
+ > npm i -D babel-preset-solid
60
+ > npm i solid-js
61
+ ```
62
+
63
+ The easiest way to get set up is to add `babel-preset-solid` to your `.babelrc`, babel config for webpack, or rollup configuration:
64
+
65
+ ```js
66
+ "presets": ["solid"]
67
+ ```
68
+
69
+ For TypeScript to work, remember to set your `.tsconfig` to handle Solid's JSX:
70
+
71
+ ```js
72
+ "compilerOptions": {
73
+ "jsx": "preserve",
74
+ "jsxImportSource": "solid-js",
75
+ }
76
+ ```
77
+
78
+ </details>
79
+
80
+ ## Why Solid?
81
+
82
+ ### Performant
83
+
84
+ Meticulously engineered for performance and with half a decade of research behind it, Solid's performance is almost indistinguishable from optimized vanilla JavaScript (See Solid on the [JS Framework Benchmark](https://rawgit.com/krausest/js-framework-benchmark/master/webdriver-ts-results/table.html)). Solid is [small](https://bundlephobia.com/package/solid-js@1.3.15) and completely tree-shakable, and [fast](https://levelup.gitconnected.com/how-we-wrote-the-fastest-javascript-ui-framework-again-db097ddd99b6) when rendering on the server, too. Whether you're writing a fully client-rendered SPA or a server-rendered app, your users see it faster than ever. ([Read more about Solid's performance](https://dev.to/ryansolid/thinking-granular-how-is-solidjs-so-performant-4g37) from the library's creator.)
85
+
86
+ ### Powerful
87
+
88
+ Solid is fully-featured with everything you can expect from a modern framework. Performant state management is built-in with Context and Stores: you don't have to reach for a third party library to manage global state (if you don't want to). With Resources, you can use data loaded from the server like any other piece of state and build a responsive UI for it thanks to Suspense and concurrent rendering. And when you're ready to move to the server, Solid has full SSR and serverless support, with streaming and progressive hydration to get to interactive as quickly as possible. (Check out our full [interactive features walkthrough](https://www.solidjs.com/tutorial/introduction_basics).)
89
+
90
+ ### Pragmatic
91
+
92
+ Do more with less: use simple, composable primitives without hidden rules and gotchas. In Solid, components are just functions - rendering is determined purely by how your state is used - so you're free to organize your code how you like and you don't have to learn a new rendering system. Solid encourages patterns like declarative code and read-write segregation that help keep your project maintainable, but isn't opinionated enough to get in your way.
93
+
94
+ ### Productive
95
+
96
+ Solid is built on established tools like JSX and TypeScript and integrates with the Vite ecosystem. Solid's bare-metal, minimal abstractions give you direct access to the DOM, making it easy to use your favorite native JavaScript libraries like D3. And the Solid ecosystem is growing fast, with [custom primitives](https://github.com/solidjs-community/solid-primitives), [component libraries](https://hope-ui.com/), and build-time utilities that let you [write Solid code in new ways](https://github.com/LXSMNSYC/solid-labels).
97
+
98
+ <details>
99
+ <summary>Show Me!</summary>
100
+
101
+ ```jsx
102
+ import { render } from "solid-js/web";
103
+ import { createSignal } from "solid-js";
104
+
105
+ // A component is just a function that (optionally) accepts properties and returns a DOM node
106
+ const Counter = props => {
107
+ // Create a piece of reactive state, giving us a accessor, count(), and a setter, setCount()
108
+ const [count, setCount] = createSignal(props.startingCount || 1);
109
+
110
+ // The increment function calls the setter
111
+ const increment = () => setCount(count() + 1);
112
+
113
+ console.log(
114
+ "The body of the function runs once, like you'd expect from calling any other function, so you only ever see this console log once."
115
+ );
116
+
117
+ // JSX allows us to write HTML within our JavaScript function and include dynamic expressions using the { } syntax
118
+ // The only part of this that will ever rerender is the count() text.
119
+ return (
120
+ <button type="button" onClick={increment}>
121
+ Increment {count()}
122
+ </button>
123
+ );
124
+ };
125
+
126
+ // The render function mounts a component onto your page
127
+ render(() => <Counter startingCount={2} />, document.getElementById("app"));
128
+ ```
129
+
130
+ See it in action in our interactive [Playground](https://playground.solidjs.com/?hash=-894962706&version=1.3.13)!
131
+
132
+ Solid compiles our JSX down to efficient real DOM expressions updates, still using the same reactive primitives (`createSignal`) at runtime but making sure there's as little rerendering as possible. Here's what that looks like in this example:
133
+
134
+ ```js
135
+ import { render, createComponent, delegateEvents, insert, template } from "solid-js/web";
136
+ import { createSignal } from "solid-js";
137
+
138
+ const _tmpl$ = /*#__PURE__*/ template(`<button type="button">Increment </button>`, 2);
139
+
140
+ const Counter = props => {
141
+ const [count, setCount] = createSignal(props.startingCount || 1);
142
+ const increment = () => setCount(count() + 1);
143
+
144
+ console.log("The body of the function runs once . . .");
145
+
146
+ return (() => {
147
+ //_el$ is a real DOM node!
148
+ const _el$ = _tmpl$.cloneNode(true);
149
+ _el$.firstChild;
150
+
151
+ _el$.$$click = increment;
152
+
153
+ //This inserts the count as a child of the button in a way that allows count to update without rerendering the whole button
154
+ insert(_el$, count, null);
155
+
156
+ return _el$;
157
+ })();
158
+ };
159
+
160
+ render(
161
+ () =>
162
+ createComponent(Counter, {
163
+ startingCount: 2
164
+ }),
165
+ document.getElementById("app")
166
+ );
167
+
168
+ delegateEvents(["click"]);
169
+ ```
170
+
171
+ </details>
172
+
173
+ ## More
174
+
175
+ Check out our official [documentation](https://www.solidjs.com/guide) or browse some [examples](https://github.com/solidjs/solid/blob/main/documentation/resources/examples.md)
176
+
177
+ ## Browser Support
178
+
179
+ SolidJS Core is committed to supporting the last 2 years of modern browsers including Firefox, Safari, Chrome and Edge (for desktop and mobile devices). We do not support IE or similar sunset browsers. For server environments, we support Node LTS and the latest Deno and Cloudflare Worker runtimes.
180
+
181
+ <img src="https://saucelabs.github.io/images/opensauce/powered-by-saucelabs-badge-gray.svg?sanitize=true" alt="Testing Powered By SauceLabs" width="300"/>
182
+
183
+ ## Community
184
+
185
+ Come chat with us on [Discord](https://discord.com/invite/solidjs)! Solid's creator and the rest of the core team are active there, and we're always looking for contributions.
186
+
187
+ ### Contributors
188
+
189
+ <a href="https://github.com/solidjs/solid/graphs/contributors"><img src="https://opencollective.com/solid/contributors.svg?width=890&amp;button=false" style="max-width:100%;"></a>
190
+
191
+ ### Open Collective
192
+
193
+ Support us with a donation and help us continue our activities. [[Contribute](https://opencollective.com/solid)]
194
+
195
+ <a href="https://opencollective.com/solid/backer/0/website" target="_blank"><img src="https://opencollective.com/solid/backer/0/avatar.svg"></a>
196
+ <a href="https://opencollective.com/solid/backer/1/website" target="_blank"><img src="https://opencollective.com/solid/backer/1/avatar.svg"></a>
197
+ <a href="https://opencollective.com/solid/backer/2/website" target="_blank"><img src="https://opencollective.com/solid/backer/2/avatar.svg"></a>
198
+ <a href="https://opencollective.com/solid/backer/3/website" target="_blank"><img src="https://opencollective.com/solid/backer/3/avatar.svg"></a>
199
+ <a href="https://opencollective.com/solid/backer/4/website" target="_blank"><img src="https://opencollective.com/solid/backer/4/avatar.svg"></a>
200
+ <a href="https://opencollective.com/solid/backer/5/website" target="_blank"><img src="https://opencollective.com/solid/backer/5/avatar.svg"></a>
201
+ <a href="https://opencollective.com/solid/backer/6/website" target="_blank"><img src="https://opencollective.com/solid/backer/6/avatar.svg"></a>
202
+ <a href="https://opencollective.com/solid/backer/7/website" target="_blank"><img src="https://opencollective.com/solid/backer/7/avatar.svg"></a>
203
+ <a href="https://opencollective.com/solid/backer/8/website" target="_blank"><img src="https://opencollective.com/solid/backer/8/avatar.svg"></a>
204
+ <a href="https://opencollective.com/solid/backer/9/website" target="_blank"><img src="https://opencollective.com/solid/backer/9/avatar.svg"></a>
205
+ <a href="https://opencollective.com/solid/backer/10/website" target="_blank"><img src="https://opencollective.com/solid/backer/10/avatar.svg"></a>
206
+
207
+ ### Sponsors
208
+
209
+ Become a sponsor and get your logo on our README on GitHub with a link to your site. [[Become a sponsor](https://opencollective.com/solid#sponsor)]
210
+
211
+ <a href="https://opencollective.com/solid/sponsor/0/website" target="_blank"><img src="https://opencollective.com/solid/sponsor/0/avatar.svg"></a>
212
+ <a href="https://opencollective.com/solid/sponsor/1/website" target="_blank"><img src="https://opencollective.com/solid/sponsor/1/avatar.svg"></a>
213
+ <a href="https://opencollective.com/solid/sponsor/2/website" target="_blank"><img src="https://opencollective.com/solid/sponsor/2/avatar.svg"></a>
214
+ <a href="https://opencollective.com/solid/sponsor/3/website" target="_blank"><img src="https://opencollective.com/solid/sponsor/3/avatar.svg"></a>
215
+ <a href="https://opencollective.com/solid/sponsor/4/website" target="_blank"><img src="https://opencollective.com/solid/sponsor/4/avatar.svg"></a>
216
+ <a href="https://opencollective.com/solid/sponsor/5/website" target="_blank"><img src="https://opencollective.com/solid/sponsor/5/avatar.svg"></a>
217
+ <a href="https://opencollective.com/solid/sponsor/6/website" target="_blank"><img src="https://opencollective.com/solid/sponsor/6/avatar.svg"></a>
218
+ <a href="https://opencollective.com/solid/sponsor/7/website" target="_blank"><img src="https://opencollective.com/solid/sponsor/7/avatar.svg"></a>
219
+ <a href="https://opencollective.com/solid/sponsor/8/website" target="_blank"><img src="https://opencollective.com/solid/sponsor/8/avatar.svg"></a>
220
+ <a href="https://opencollective.com/solid/sponsor/9/website" target="_blank"><img src="https://opencollective.com/solid/sponsor/9/avatar.svg"></a>
221
+ <a href="https://opencollective.com/solid/sponsor/10/website" target="_blank"><img src="https://opencollective.com/solid/sponsor/10/avatar.svg"></a>
222
+ <a href="https://opencollective.com/solid/sponsor/11/website" target="_blank"><img src="https://opencollective.com/solid/sponsor/11/avatar.svg"></a>
223
+ <a href="https://opencollective.com/solid/sponsor/12/website" target="_blank"><img src="https://opencollective.com/solid/sponsor/12/avatar.svg"></a>
package/dist/dev.cjs CHANGED
@@ -118,15 +118,26 @@ function workLoop(hasTimeRemaining, initialTime) {
118
118
 
119
119
  const sharedConfig = {
120
120
  context: undefined,
121
- registry: undefined
121
+ registry: undefined,
122
+ getContextId() {
123
+ return getContextId(this.context.count);
124
+ },
125
+ getNextContextId() {
126
+ return getContextId(this.context.count++);
127
+ }
122
128
  };
129
+ function getContextId(count) {
130
+ const num = String(count),
131
+ len = num.length - 1;
132
+ return sharedConfig.context.id + (len ? String.fromCharCode(96 + len) : "") + num;
133
+ }
123
134
  function setHydrateContext(context) {
124
135
  sharedConfig.context = context;
125
136
  }
126
137
  function nextHydrateContext() {
127
138
  return {
128
139
  ...sharedConfig.context,
129
- id: `${sharedConfig.context.id}${sharedConfig.context.count++}-`,
140
+ id: sharedConfig.getNextContextId(),
130
141
  count: 0
131
142
  };
132
143
  }
@@ -285,7 +296,7 @@ function createResource(pSource, pFetcher, pOptions) {
285
296
  }),
286
297
  [state, setState] = createSignal(resolved ? "ready" : "unresolved");
287
298
  if (sharedConfig.context) {
288
- id = `${sharedConfig.context.id}${sharedConfig.context.count++}`;
299
+ id = sharedConfig.getNextContextId();
289
300
  let v;
290
301
  if (options.ssrLoadFrom === "initial") initP = options.initialValue;else if (sharedConfig.load && (v = sharedConfig.load(id))) initP = v;
291
302
  }
@@ -355,7 +366,7 @@ function createResource(pSource, pFetcher, pOptions) {
355
366
  }
356
367
  pr = p;
357
368
  if ("value" in p) {
358
- if (p.status === "success") loadEnd(pr, p.value, undefined, lookup);else loadEnd(pr, undefined, undefined, lookup);
369
+ if (p.status === "success") loadEnd(pr, p.value, undefined, lookup);else loadEnd(pr, undefined, castError(p.value), lookup);
359
370
  return p;
360
371
  }
361
372
  scheduled = true;
@@ -578,7 +589,8 @@ function createContext(defaultValue, options) {
578
589
  };
579
590
  }
580
591
  function useContext(context) {
581
- return Owner && Owner.context && Owner.context[context.id] !== undefined ? Owner.context[context.id] : context.defaultValue;
592
+ let value;
593
+ return Owner && Owner.context && (value = Owner.context[context.id]) !== undefined ? value : context.defaultValue;
582
594
  }
583
595
  function children(fn) {
584
596
  const children = createMemo(fn);
@@ -1109,20 +1121,12 @@ function mapArray(list, mapFn, options = {}) {
1109
1121
  onCleanup(() => dispose(disposers));
1110
1122
  return () => {
1111
1123
  let newItems = list() || [],
1124
+ newLen = newItems.length,
1112
1125
  i,
1113
1126
  j;
1114
1127
  newItems[$TRACK];
1115
1128
  return untrack(() => {
1116
- let newLen = newItems.length,
1117
- newIndices,
1118
- newIndicesNext,
1119
- temp,
1120
- tempdisposers,
1121
- tempIndexes,
1122
- start,
1123
- end,
1124
- newEnd,
1125
- item;
1129
+ let newIndices, newIndicesNext, temp, tempdisposers, tempIndexes, start, end, newEnd, item;
1126
1130
  if (newLen === 0) {
1127
1131
  if (len !== 0) {
1128
1132
  dispose(disposers);
@@ -1214,10 +1218,11 @@ function indexArray(list, mapFn, options = {}) {
1214
1218
  i;
1215
1219
  onCleanup(() => dispose(disposers));
1216
1220
  return () => {
1217
- const newItems = list() || [];
1221
+ const newItems = list() || [],
1222
+ newLen = newItems.length;
1218
1223
  newItems[$TRACK];
1219
1224
  return untrack(() => {
1220
- if (newItems.length === 0) {
1225
+ if (newLen === 0) {
1221
1226
  if (len !== 0) {
1222
1227
  dispose(disposers);
1223
1228
  disposers = [];
@@ -1243,7 +1248,7 @@ function indexArray(list, mapFn, options = {}) {
1243
1248
  mapped = [];
1244
1249
  len = 0;
1245
1250
  }
1246
- for (i = 0; i < newItems.length; i++) {
1251
+ for (i = 0; i < newLen; i++) {
1247
1252
  if (i < items.length && items[i] !== newItems[i]) {
1248
1253
  signals[i](() => newItems[i]);
1249
1254
  } else if (i >= items.length) {
@@ -1253,7 +1258,7 @@ function indexArray(list, mapFn, options = {}) {
1253
1258
  for (; i < items.length; i++) {
1254
1259
  disposers[i]();
1255
1260
  }
1256
- len = signals.length = disposers.length = newItems.length;
1261
+ len = signals.length = disposers.length = newLen;
1257
1262
  items = newItems.slice(0);
1258
1263
  return mapped = mapped.slice(0, len);
1259
1264
  });
@@ -1471,7 +1476,7 @@ function lazy(fn) {
1471
1476
  let counter = 0;
1472
1477
  function createUniqueId() {
1473
1478
  const ctx = sharedConfig.context;
1474
- return ctx ? `${ctx.id}${ctx.count++}` : `cl-${counter++}`;
1479
+ return ctx ? sharedConfig.getNextContextId() : `cl-${counter++}`;
1475
1480
  }
1476
1481
 
1477
1482
  const narrowedError = name => `Attempting to access a stale value from <${name}> that could possibly be undefined. This may occur because you are reading the accessor returned from the component at a time where it has already been unmounted. We recommend cleaning up any stale timers or async, or reading from the initial condition.` ;
@@ -1553,7 +1558,7 @@ function resetErrorBoundaries() {
1553
1558
  }
1554
1559
  function ErrorBoundary(props) {
1555
1560
  let err;
1556
- if (sharedConfig.context && sharedConfig.load) err = sharedConfig.load(sharedConfig.context.id + sharedConfig.context.count);
1561
+ if (sharedConfig.context && sharedConfig.load) err = sharedConfig.load(sharedConfig.getContextId());
1557
1562
  const [errored, setErrored] = createSignal(err, {
1558
1563
  name: "errored"
1559
1564
  } );
@@ -1574,7 +1579,7 @@ function ErrorBoundary(props) {
1574
1579
  }
1575
1580
 
1576
1581
  const suspenseListEquals = (a, b) => a.showContent === b.showContent && a.showFallback === b.showFallback;
1577
- const SuspenseListContext = createContext();
1582
+ const SuspenseListContext = /* #__PURE__ */createContext();
1578
1583
  function SuspenseList(props) {
1579
1584
  let [wrapper, setWrapper] = createSignal(() => ({
1580
1585
  inFallback: false
@@ -1671,7 +1676,7 @@ function Suspense(props) {
1671
1676
  },
1672
1677
  owner = getOwner();
1673
1678
  if (sharedConfig.context && sharedConfig.load) {
1674
- const key = sharedConfig.context.id + sharedConfig.context.count;
1679
+ const key = sharedConfig.getContextId();
1675
1680
  let ref = sharedConfig.load(key);
1676
1681
  if (ref) {
1677
1682
  if (typeof ref !== "object" || ref.status !== "success") p = ref;else sharedConfig.gather(key);
@@ -1728,7 +1733,7 @@ function Suspense(props) {
1728
1733
  dispose = disposer;
1729
1734
  if (ctx) {
1730
1735
  setHydrateContext({
1731
- id: ctx.id + "f",
1736
+ id: ctx.id + "F",
1732
1737
  count: 0
1733
1738
  });
1734
1739
  ctx = undefined;