# @solid-primitives/context ## 2.0.0 ### Major Changes - bca95a8: Migrate to Solid.js v2.0 (beta.14) ## Breaking Changes **Peer dependencies**: `solid-js@^2.0.0-beta.14` and `@solidjs/web@^2.0.0-beta.14` are now required. - `Context` is now used directly as the provider component — `Context.Provider` no longer exists in Solid 2.0. `createContextProvider` and `MultiProvider` both reflect this change. - `ContextProviderComponent` is now a proper export from `solid-js`; the previous workaround importing from an internal `node_modules` path has been removed. - `JSX.Element` replaced with `Element` from `solid-js` throughout the public API types, matching Solid 2.0's renderer-neutral type model. - `MultiProvider` no longer falls back to accessing `.Provider` on non-function items — contexts passed in `values` must be functions (which all `Context` objects now are in Solid 2.0). ## New APIs - `createContextProvider` now returns `Exclude` from its `useContext` helper, matching Solid 2's throwing behavior for missing context values. - Added `createOptionalContextProvider` — uses an internal Symbol fallback and returns `undefined` when the context is missing or its value is `undefined`. Accepts an optional default value for missing providers. ### Minor Changes - 5a29dd6: `MultiProvider` now passes props to providers created by `createContextProvider`, `createOptionalContextProvider` and `createLayeredContext`: `[CounterProvider, { initial: 1 }]` behaves exactly like `` (closes #755). Raw contexts and other provider components still receive the second item as `value`, and entries are now type-checked against their provider's props. **Migration:** a `[Provider, value]` pair for one of these providers previously reached the factory as `props.value`; pass `[Provider, { value }]` to keep that shape. - dd43194: Add `ContextConsumer` ### Patch Changes - 50e36c9: Bump the `solid-js`/`@solidjs/web` peer and dev dependency range to `2.0.0-beta.20`. No API or behavior changes; beta.19/beta.20 introduced no breaking changes upstream (internal tree-shaking work, a new `solid-js/refresh` HMR entry point, and SSR/hydration/`lazy()` bug fixes). - c98cb2d: Bump the `solid-js`/`@solidjs/web`/`@solidjs/signals`/`babel-preset-solid` peer and dev dependency range to `2.0.0-rc.0`. No API or behavior changes on our end — this tracks upstream's move from the beta series into the release candidate. - 1b703e1: Bump the `solid-js`/`@solidjs/web`/`@solidjs/signals` peer and dev dependency range to `2.0.0-rc.14`. - 638c530: Bump the `solid-js`/`@solidjs/web`/`@solidjs/signals` peer and dev dependency range to `2.0.0-rc.9`, and `babel-preset-solid` to `2.0.0-rc.2`. Two behavior fixes were needed to keep up with upstream changes in this range: - `@solid-primitives/deep`: `captureStoreUpdates` no longer missed property changes. As of `2.0.0-rc.1` a store's `[$TRACK]` only fires for structural changes (key additions/removals), so leaf value changes stopped being reported. Each node's direct property values are now tracked individually. Updates are still reported at the shallowest node that actually changed. - `@solid-primitives/storage`: `makePersisted` no longer persists stale data. Signal writes stay pending until the next flush in `2.0.0-rc.1`+, so reading the value back inside the setter returned the _previous_ one — persisting stale data, or removing the stored entry entirely when the previous value was nullish. The value returned by the setter is now persisted directly. ## 2.0.0-next.5 ### Minor Changes - 5a29dd6: `MultiProvider` now passes props to providers created by `createContextProvider`, `createOptionalContextProvider` and `createLayeredContext`: `[CounterProvider, { initial: 1 }]` behaves exactly like `` (closes #755). Raw contexts and other provider components still receive the second item as `value`, and entries are now type-checked against their provider's props. **Migration:** a `[Provider, value]` pair for one of these providers previously reached the factory as `props.value`; pass `[Provider, { value }]` to keep that shape. - dd43194: Add `ContextConsumer` ## 2.0.0-next.4 ### Patch Changes - 1b703e1: Bump the `solid-js`/`@solidjs/web`/`@solidjs/signals` peer and dev dependency range to `2.0.0-rc.14`. ## 2.0.0-next.3 ### Patch Changes - 638c530: Bump the `solid-js`/`@solidjs/web`/`@solidjs/signals` peer and dev dependency range to `2.0.0-rc.9`, and `babel-preset-solid` to `2.0.0-rc.2`. Two behavior fixes were needed to keep up with upstream changes in this range: - `@solid-primitives/deep`: `captureStoreUpdates` no longer missed property changes. As of `2.0.0-rc.1` a store's `[$TRACK]` only fires for structural changes (key additions/removals), so leaf value changes stopped being reported. Each node's direct property values are now tracked individually. Updates are still reported at the shallowest node that actually changed. - `@solid-primitives/storage`: `makePersisted` no longer persists stale data. Signal writes stay pending until the next flush in `2.0.0-rc.1`+, so reading the value back inside the setter returned the _previous_ one — persisting stale data, or removing the stored entry entirely when the previous value was nullish. The value returned by the setter is now persisted directly. ## 2.0.0-next.2 ### Patch Changes - Bump the `solid-js`/`@solidjs/web`/`@solidjs/signals`/`babel-preset-solid` peer and dev dependency range to `2.0.0-rc.0`. No API or behavior changes on our end — this tracks upstream's move from the beta series into the release candidate. ## 2.0.0-next.1 ### Patch Changes - 50e36c9: Bump the `solid-js`/`@solidjs/web` peer and dev dependency range to `2.0.0-beta.20`. No API or behavior changes; beta.19/beta.20 introduced no breaking changes upstream (internal tree-shaking work, a new `solid-js/refresh` HMR entry point, and SSR/hydration/`lazy()` bug fixes). ## 2.0.0-next.0 ### Major Changes - bca95a8: Migrate to Solid.js v2.0 (beta.14) ## Breaking Changes **Peer dependencies**: `solid-js@^2.0.0-beta.14` and `@solidjs/web@^2.0.0-beta.14` are now required. - `Context` is now used directly as the provider component — `Context.Provider` no longer exists in Solid 2.0. `createContextProvider` and `MultiProvider` both reflect this change. - `ContextProviderComponent` is now a proper export from `solid-js`; the previous workaround importing from an internal `node_modules` path has been removed. - `JSX.Element` replaced with `Element` from `solid-js` throughout the public API types, matching Solid 2.0's renderer-neutral type model. - `MultiProvider` no longer falls back to accessing `.Provider` on non-function items — contexts passed in `values` must be functions (which all `Context` objects now are in Solid 2.0). ## New APIs - `createContextProvider` now returns `Exclude` from its `useContext` helper, matching Solid 2's throwing behavior for missing context values. - Added `createOptionalContextProvider` — uses an internal Symbol fallback and returns `undefined` when the context is missing or its value is `undefined`. Accepts an optional default value for missing providers. ## 1.0.0 ### Major Changes - Migrate to Solid.js v2.0 (beta.13) #### Breaking Changes - **Peer dependencies**: `solid-js@^2.0.0-beta.13` and `@solidjs/web@^2.0.0-beta.13` are now required. - `Context` is now used directly as the provider component — `Context.Provider` no longer exists in Solid 2.0. `createContextProvider` and `MultiProvider` both reflect this change. - `ContextProviderComponent` is now a proper export from `solid-js`; the previous workaround importing from an internal `node_modules` path has been removed. - `JSX.Element` replaced with `Element` from `solid-js` throughout the public API types. - `MultiProvider` no longer falls back to accessing `.Provider` on non-function items — contexts passed in `values` must be functions (which all `Context` objects are in Solid 2.0). #### New Exports - **`createStrictContextProvider`** — Like `createContextProvider` without defaults, but with the intent made explicit in types: the hook returns `T` (never `undefined`) and Solid throws `ContextNotFoundError` at runtime when used outside a provider. Accepts an optional `{ name }` option. - **`createLayeredContext`** — Like `createContextProvider`, but each provider in the tree extends the parent context value rather than replacing it. The factory receives both `props` and the nearest parent context value. Requires a `defaults` base value. - **`ContextProviderOptions`** — Exported type `{ name?: string }` for the third argument of `createContextProvider` and `createStrictContextProvider`/`createLayeredContext`'s second argument. ## 0.3.2 ### Patch Changes - 396812d: Enable verbatimModuleSyntax -> add `type` keyword to all type imports. ## 0.3.1 ### Patch Changes - 53f08cc: fix: Move `"@solid-primitives/source"` export condition under import in package.json (Fixes #774, Fixes #749) ## 0.3.0 ### Minor Changes - ea09f71: Remove CJS support. The package is ESM only now. ## 0.2.3 ### Patch Changes - 74db287: Correct the "homepage" field in package.json ## 0.2.2 ### Patch Changes - d23dd74: Add type exports for cjs ## 0.2.1 ### Patch Changes - 3fad3789: Revert from publishing separate server, development, and production builds that has to rely on export conditions to publishing a single build that can be used in any environment. Envs will be checked at with `isDev`and `isServer` consts exported by `"solid-js/web"` so it's still tree-shakeable. ## 0.2.0 ### Minor Changes - 4135c9bf: Add `MultiProvider` for providing multiple contexts at once. ## 0.1.4 ### Patch Changes - 865d5ee9: Fix build. (remove keepNames option) ## 0.1.3 ### Patch Changes - dd2d7d1c: Improve export conditions. ## 0.1.2 ### Patch Changes - b662fe9f: Improve package export contidions for SSR (node, workers, deno) ## 0.1.1 ### Patch Changes - 7ac41ed: Update to solid-js version 1.5 ## Changelog up to version 0.1.0 0.0.100 Initial release of the context package.