Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ An immutable, reactive data store with framework adapters that powers the core o

- Fine‑grained updates for performant state management
- Flexible primitives for building custom state logic
- Works across frameworks like React, Solid, Vue, Angular & Svelte
- Works across frameworks like React, Solid, Vue, Angular, Svelte & Lit
- Lightweight and standalone — use it in any app or as a library foundation

### <a href="https://tanstack.com/store">Read the docs →</b></a>
Expand Down
14 changes: 7 additions & 7 deletions docs/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"label": "react",
"children": [
{
"label": "Quick Start",
"label": "Quick Start - React",
"to": "framework/react/quick-start"
}
]
Expand All @@ -36,7 +36,7 @@
"label": "vue",
"children": [
{
"label": "Quick Start",
"label": "Quick Start - Vue",
"to": "framework/vue/quick-start"
}
]
Expand All @@ -45,7 +45,7 @@
"label": "solid",
"children": [
{
"label": "Quick Start",
"label": "Quick Start - Solid",
"to": "framework/solid/quick-start"
}
]
Expand All @@ -54,7 +54,7 @@
"label": "angular",
"children": [
{
"label": "Quick Start",
"label": "Quick Start - Angular",
"to": "framework/angular/quick-start"
}
]
Expand All @@ -63,7 +63,7 @@
"label": "svelte",
"children": [
{
"label": "Quick Start",
"label": "Quick Start - Svelte",
"to": "framework/svelte/quick-start"
}
]
Expand All @@ -72,7 +72,7 @@
"label": "preact",
"children": [
{
"label": "Quick Start",
"label": "Quick Start - Preact",
"to": "framework/preact/quick-start"
}
]
Expand All @@ -81,7 +81,7 @@
"label": "lit",
"children": [
{
"label": "Quick Start",
"label": "Quick Start - Lit",
"to": "framework/lit/quick-start"
}
]
Expand Down
124 changes: 124 additions & 0 deletions docs/framework/lit/reference/classes/TanStackStoreAtom.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
---
id: TanStackStoreAtom
title: TanStackStoreAtom
---

# Class: TanStackStoreAtom\<TValue\>

Defined in: [tan-stack-store-atom.ts:29](https://github.com/TanStack/store/blob/main/packages/lit-store/src/tan-stack-store-atom.ts#L29)

Subscribes a Lit host to a writable atom and exposes its current value
along with a stable setter.

Use this when an element needs to both read and update the same writable
atom. The host will only re-render when the atom's value actually changes
(according to the configured `compare` function).

## Example

```ts
class CounterEl extends LitElement {
`#count` = new TanStackStoreAtom(this, () => countAtom)

render() {
return html`
<button @click=${() => this.#count.set((prev) => prev + 1)}>
${this.#count.value}
</button>
`
}
}
```

## Type Parameters

### TValue

`TValue`

## Constructors

### Constructor

```ts
new TanStackStoreAtom<TValue>(
host,
getAtom,
options?): TanStackStoreAtom<TValue>;
```

Defined in: [tan-stack-store-atom.ts:32](https://github.com/TanStack/store/blob/main/packages/lit-store/src/tan-stack-store-atom.ts#L32)

#### Parameters

##### host

`ReactiveControllerHost`

##### getAtom

() => `Atom`\<`TValue`\> \| `undefined`

##### options?

[`UseSelectorOptions`](../interfaces/UseSelectorOptions.md)\<`TValue`\>

#### Returns

`TanStackStoreAtom`\<`TValue`\>

## Accessors

### value

#### Get Signature

```ts
get value(): TValue | undefined;
```

Defined in: [tan-stack-store-atom.ts:43](https://github.com/TanStack/store/blob/main/packages/lit-store/src/tan-stack-store-atom.ts#L43)

##### Returns

`TValue` \| `undefined`

## Methods

### set()

#### Call Signature

```ts
set(value): void;
```

Defined in: [tan-stack-store-atom.ts:47](https://github.com/TanStack/store/blob/main/packages/lit-store/src/tan-stack-store-atom.ts#L47)

##### Parameters

###### value

`TValue`

##### Returns

`void`

#### Call Signature

```ts
set(updater): void;
```

Defined in: [tan-stack-store-atom.ts:48](https://github.com/TanStack/store/blob/main/packages/lit-store/src/tan-stack-store-atom.ts#L48)

##### Parameters

###### updater

(`prev`) => `TValue`

##### Returns

`void`
109 changes: 109 additions & 0 deletions docs/framework/lit/reference/classes/TanStackStoreSelector.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
---
id: TanStackStoreSelector
title: TanStackStoreSelector
---

# Class: TanStackStoreSelector\<TSource, TSelected\>

Defined in: [tan-stack-store-selector.ts:22](https://github.com/TanStack/store/blob/main/packages/lit-store/src/tan-stack-store-selector.ts#L22)

## Type Parameters

### TSource

`TSource`

### TSelected

`TSelected` = `NoInfer`\<`TSource`\>

## Implements

- `ReactiveController`

## Constructors

### Constructor

```ts
new TanStackStoreSelector<TSource, TSelected>(
host,
getStore,
selector,
options?): TanStackStoreSelector<TSource, TSelected>;
```

Defined in: [tan-stack-store-selector.ts:35](https://github.com/TanStack/store/blob/main/packages/lit-store/src/tan-stack-store-selector.ts#L35)

#### Parameters

##### host

`ReactiveControllerHost`

##### getStore

() => `SelectionSource`\<`TSource`\> \| `undefined`

##### selector

(`snapshot`) => `TSelected`

##### options?

[`UseSelectorOptions`](../interfaces/UseSelectorOptions.md)\<`TSelected`\>

#### Returns

`TanStackStoreSelector`\<`TSource`, `TSelected`\>

## Methods

### hostDisconnected()

```ts
hostDisconnected(): void;
```

Defined in: [tan-stack-store-selector.ts:72](https://github.com/TanStack/store/blob/main/packages/lit-store/src/tan-stack-store-selector.ts#L72)

Called when the host is disconnected from the component tree. For custom
element hosts, this corresponds to the `disconnectedCallback()` lifecycle,
which is called the host or an ancestor component is disconnected from the
document.

#### Returns

`void`

#### Implementation of

```ts
ReactiveController.hostDisconnected
```

***

### hostUpdate()

```ts
hostUpdate(): void;
```

Defined in: [tan-stack-store-selector.ts:48](https://github.com/TanStack/store/blob/main/packages/lit-store/src/tan-stack-store-selector.ts#L48)

Called during the client-side host update, just before the host calls
its own update.

Code in `update()` can depend on the DOM as it is not called in
server-side rendering.

#### Returns

`void`

#### Implementation of

```ts
ReactiveController.hostUpdate
```
15 changes: 15 additions & 0 deletions docs/framework/lit/reference/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
id: "@tanstack/lit-store"
title: "@tanstack/lit-store"
---

# @tanstack/lit-store

## Classes

- [TanStackStoreAtom](classes/TanStackStoreAtom.md)
- [TanStackStoreSelector](classes/TanStackStoreSelector.md)

## Interfaces

- [UseSelectorOptions](interfaces/UseSelectorOptions.md)
38 changes: 38 additions & 0 deletions docs/framework/lit/reference/interfaces/UseSelectorOptions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
id: UseSelectorOptions
title: UseSelectorOptions
---

# Interface: UseSelectorOptions\<TSelected\>

Defined in: [tan-stack-store-selector.ts:3](https://github.com/TanStack/store/blob/main/packages/lit-store/src/tan-stack-store-selector.ts#L3)

## Type Parameters

### TSelected

`TSelected`

## Properties

### compare()?

```ts
optional compare: (a, b) => boolean;
```

Defined in: [tan-stack-store-selector.ts:4](https://github.com/TanStack/store/blob/main/packages/lit-store/src/tan-stack-store-selector.ts#L4)

#### Parameters

##### a

`TSelected`

##### b

`TSelected`

#### Returns

`boolean`
8 changes: 8 additions & 0 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,11 @@ npm install @tanstack/svelte-store
```

TanStack Store is compatible with Svelte 5.

## Lit

```sh
npm install @tanstack/lit-store
```

TanStack Store is compatible with Lit 3.
4 changes: 2 additions & 2 deletions docs/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ title: Overview
id: overview
---

TanStack Store is a framework agnostic data store that ships with framework specific adapters for major frameworks like React, Solid, Vue, Angular, and Svelte.
TanStack Store is a framework agnostic data store that ships with framework specific adapters for major frameworks like React, Solid, Vue, Angular, Svelte and Lit.

TanStack Store is primarily used for state management internally for most framework agnostic TanStack libraries. It can also be used as a standalone library for any framework or application.
TanStack Store is primarily used for state management internally for most framework agnostic TanStack libraries. It can also be used as a standalone library for any framework or application.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@
"@tanstack/solid-store": "workspace:*",
"@tanstack/store": "workspace:*",
"@tanstack/svelte-store": "workspace:*",
"@tanstack/vue-store": "workspace:*"
"@tanstack/vue-store": "workspace:*",
"@tanstack/lit-store": "workspace:*"
},
"pnpm": {
"packageExtensions": {
Expand Down