open-index/open-npm huggingface dataset:
npm package: @stateloom/svelte
Description: Svelte adapter for StateLoom -- bridges `Subscribable<T>` and `Signal<T>` to Svelte's store contract (`Readable`/`Writable`) with scope management for SSR.
Latest version: 1.0.0-alpha.0

# @stateloom/svelte

Svelte adapter for StateLoom -- bridges `Subscribable<T>` and `Signal<T>` to Svelte's store contract (`Readable`/`Writable`) with scope management for SSR.

## Install

```bash
pnpm add @stateloom/svelte @stateloom/core
```

## Quick Start

```svelte
<script>
  import { signal } from '@stateloom/core';
  import { toWritable } from '@stateloom/svelte';

  const count = signal(0);
  const count$ = toWritable(count);
</script>

<button on:click={() => $count$++}>
  Count: {$count$}
</button>
```

## API

| Export                           | Purpose                                               |
| -------------------------------- | ----------------------------------------------------- |
| `toReadable(subscribable)`       | Bridge any `Subscribable<T>` to Svelte `Readable<T>`  |
| `toWritable(signal)`             | Bridge a writable `Signal<T>` to Svelte `Writable<T>` |
| `setScope(scope)` / `getScope()` | SSR scope management via Svelte context               |
| `SCOPE_KEY`                      | Context key symbol for advanced usage                 |

## Requirements

- Svelte 4 or 5
- `@stateloom/core` (required peer dependency)
- `@stateloom/store` (optional peer dependency)

## Documentation

Full documentation with examples, API reference, patterns, and migration guides: [docs/api/svelte](../../docs/api/svelte/)

## License

MIT
npm package: @stateloom/tab-sync
Description: Cross-tab state synchronization middleware via `BroadcastChannel`.
Latest version: 1.0.0-alpha.0

# @stateloom/tab-sync

Cross-tab state synchronization middleware via `BroadcastChannel`.

## Install

```bash
pnpm add @stateloom/tab-sync
```

## Quick Start

```typescript
import { broadcast } from '@stateloom/tab-sync';
import { createStore } from '@stateloom/store';

const store = createStore(
  (set) => ({
    theme: 'light' as 'light' | 'dark',
    toggle: () => set((s) => ({ theme: s.theme === 'light' ? 'dark' : 'light' })),
  }),
  { middleware: [broadcast({ channel: 'theme-sync' })] },
);
```

## Exports

| Export               | Description                                                 |
| -------------------- | ----------------------------------------------------------- |
| `broadcast(options)` | Create a cross-tab sync middleware using `BroadcastChannel` |

## Documentation

Full documentation with API reference, conflict resolution, and multi-store patterns:
**[docs/api/tab-sync](../../docs/api/tab-sync/README.md)**

## License

MIT
npm package: @stateloom/telemetry
Description: Analytics hooks for state change tracking in StateLoom stores.
Latest version: 1.0.0-alpha.0

# @stateloom/telemetry

Analytics hooks for state change tracking in StateLoom stores.

## Install

```bash
pnpm add @stateloom/telemetry
```

## Quick Start

```typescript
import { telemetry } from '@stateloom/telemetry';
import { createStore } from '@stateloom/store';

const tm = telemetry<{ count: number }>({
  onStateChange: (meta) => {
    analytics.track('state_change', {
      changedKeys: meta.changedKeys,
      duration: meta.duration,
    });
  },
});

const store = createStore(
  (set) => ({
    count: 0,
    inc: () => set((s) => ({ count: s.count + 1 })),
  }),
  { middleware: [tm] },
);
```

## Exports

| Export                | Description                                            |
| --------------------- | ------------------------------------------------------ |
| `telemetry(options?)` | Create a telemetry middleware with lifecycle callbacks |

## Documentation

Full documentation with API reference, callback patterns, and analytics integration:
**[docs/api/telemetry](../../docs/api/telemetry/README.md)**

## License

MIT
npm package: @stateloom/testing
Description: Test utilities for `@stateloom/*` packages. Provides mock implementations, scope helpers, and async utilities for testing reactive state.
Latest version: 1.0.0-alpha.0

# @stateloom/testing

Test utilities for `@stateloom/*` packages. Provides mock implementations, scope helpers, and async utilities for testing reactive state.

## Install

```bash
pnpm add -D @stateloom/testing
```

## Quick Start

```typescript
import { createTestScope, mockSubscribable, collectValues } from '@stateloom/testing';
import { signal, computed } from '@stateloom/core';

// Isolated test scope
const scope = createTestScope();
const count = scope.run(() => signal(0));

// Collect reactive values over time
const values = collectValues(count);
count.set(1);
count.set(2);
expect(values()).toEqual([0, 1, 2]);

// Mock subscribable for unit tests
const mock = mockSubscribable(42);
expect(mock.get()).toBe(42);
mock.set(99);
```

## Exports

| Export                                  | Description                                |
| --------------------------------------- | ------------------------------------------ |
| `createTestScope()`                     | Create an isolated scope for testing       |
| `mockSubscribable(initial)`             | Create a mock `Subscribable<T>`            |
| `mockStore(state)`                      | Create a mock store matching `StoreApi<T>` |
| `collectValues(subscribable)`           | Record all emitted values into an array    |
| `flushEffects()`                        | Synchronously flush pending effects        |
| `waitForUpdate(subscribable, options?)` | Await the next value change                |

## Documentation

Full documentation with API reference, patterns, and framework testing examples:
**[docs/api/testing](../../docs/api/testing/README.md)**

## License

MIT