open-index/open-npm huggingface dataset:
npm package: @sanity-labs/logo-soup
Description: A tiny framework-agnostic library that makes logos look good together
Latest version: 1.2.2

# 🍜 Logo Soup

[![npm version](https://img.shields.io/npm/v/@sanity-labs/logo-soup.svg?style=flat-square)](https://www.npmjs.com/package/@sanity-labs/logo-soup)

A tiny framework-agnostic library that makes logos look good together.

### Before

![Logos without normalization — different sizes, weights, and aspect ratios create visual chaos](static/docs/before.png)

### After

![After normalization — the same logos appear balanced and harmonious](static/docs/after.png)

## Install

```bash
npm install @sanity-labs/logo-soup
```

## Quick Start

```tsx
import { LogoSoup } from "@sanity-labs/logo-soup/react";

function LogoStrip() {
  return (
    <LogoSoup
      logos={[
        { src: "/logos/acme.svg", alt: "Acme Corp" },
        { src: "/logos/globex.svg", alt: "Globex" },
        { src: "/logos/initech.svg", alt: "Initech" },
      ]}
    />
  );
}
```

Works with React, Vue, Svelte, Solid, Angular, jQuery, and vanilla JavaScript.

## Resources

- 📖 [Documentation](https://logo-soup.sanity.dev/docs) — Full API reference, framework guides, and options
- 🎨 [Storybook](https://logo-soup.sanity.dev/?path=/story/logosoup--default) — Interactive playground with real logos and tunable parameters
- 📝 [The Logo Soup Problem](https://www.sanity.io/blog/the-logo-soup-problem) — Deep-dive blog post on the problem and the math behind the solution

## Development

```bash
bun install
bun test
bun run build
bun run storybook
```

## License

MIT
npm package: @sanity-labs/prettier-plugin-groq
Description: Prettier plugin for formatting GROQ queries
Author: Sanity.io
Latest version: 0.1.0

# @sanity-labs/prettier-plugin-groq

Prettier plugin for formatting GROQ (Graph-Relational Object Queries) queries.

## Installation

```bash
npm install --save-dev @sanity-labs/prettier-plugin-groq prettier
# or
pnpm add -D @sanity-labs/prettier-plugin-groq prettier
```

## Usage

### Formatting `.groq` Files

The plugin automatically formats `.groq` files when loaded:

```bash
npx prettier --write "**/*.groq"
```

Configure in `.prettierrc`:

```json
{
  "plugins": ["@sanity-labs/prettier-plugin-groq"],
  "printWidth": 80
}
```

### Formatting Embedded GROQ in JavaScript/TypeScript

To format GROQ queries embedded in JavaScript/TypeScript files, add the embed plugin:

```json
{
  "plugins": ["@sanity-labs/prettier-plugin-groq", "@sanity-labs/prettier-plugin-groq/embed"]
}
```

This formats GROQ in:

- **Tagged template literals**: `groq`...``, `defineQuery`...``
- **Function calls**: `defineQuery("...")`, `defineQuery(`...`)`

```typescript
// Before formatting
const query = groq`*[_type=="post"]{title,body,"author":author->name}`

// After formatting
const query = groq`*[_type == "post"] { title, body, "author": author->name }`
```

## Examples

### Input

```groq
*[_type=="article"&&author._ref==$authorId]{title,"authorName":author->name,publishedAt,categories[]->{title,slug}}
```

### Output

```groq
*[_type == "article" && author._ref == $authorId] {
  title,
  "authorName": author->name,
  publishedAt,
  categories[]->{ title, slug }
}
```

## GROQ Syntax Notes

The formatter follows GROQ syntax rules:

- **Object keys must be quoted** for computed values: `{ "slug": slug.current }`
- **Shorthand is valid** when key matches the attribute: `{ title }` (equivalent to `{ "title": title }`)
- **Projections after dereference** use shorthand: `author->{ name }`
- **Array traversals** use implicit dereference: `categories[]->{ title }`

## WASM Acceleration

For better performance, this plugin can use WASM-compiled Rust for formatting. Initialize WASM at application startup:

```typescript
import { initWasmFormatter, isWasmFormatterAvailable } from '@sanity-labs/prettier-plugin-groq'

// Optional: Initialize WASM for better performance
await initWasmFormatter()

if (isWasmFormatterAvailable()) {
  console.log('Using WASM formatter')
}
```

When WASM is available, formatting is ~5-10x faster. The plugin automatically falls back to TypeScript formatting if WASM is not available.

## Options

This plugin respects standard Prettier options:

| Option       | Default | Description                |
| ------------ | ------- | -------------------------- |
| `printWidth` | 80      | Line width for wrapping    |
| `tabWidth`   | 2       | Indentation size           |
| `useTabs`    | false   | Use tabs instead of spaces |

## License

MIT
npm package: @sanity-labs/sdk-addon-dataset-runtime
Description: Shared addon dataset runtime context for Sanity Labs SDK feature packages.
Latest version: 1.0.0

# `@sanity-labs/sdk-addon-dataset-runtime`

This package provides the narrow runtime values that `@sanity-labs/sdk-comments` and
`@sanity-labs/sdk-tasks` both need:

- `addonDataset`
- `contentDataset?`
- `projectId`
- `workspaceId?`
- `workspaceTitle?`

## Installation

```bash
pnpm add @sanity-labs/sdk-addon-dataset-runtime react react-dom
```

## Usage

```tsx
import { AddonDatasetRuntimeProvider } from "@sanity-labs/sdk-addon-dataset-runtime";

<AddonDatasetRuntimeProvider
  addonDataset="production-comments"
  contentDataset="production"
  projectId="myProjectId"
  workspaceId="news_and_media"
  workspaceTitle="News and Media"
>
  <App />
</AddonDatasetRuntimeProvider>;
```

Use this provider when multiple components should share the same addon runtime
identity. Feature hooks in `@sanity-labs/sdk-comments` and `@sanity-labs/sdk-tasks`
also support direct configuration, so this package is recommended shared
infrastructure rather than a mandatory prerequisite for every integration.

## Primary Exports

- `AddonDatasetRuntimeProvider`
- `useAddonDatasetRuntime()`
- `useOptionalAddonDatasetRuntime()`
- `AddonDatasetRuntimeValue`

## What Is Not Included

This package intentionally does not ship:

- task caches
- optimistic feature state
- task mutation helpers
- comment mutation helpers

Feature behavior lives in `@sanity-labs/sdk-comments` and `@sanity-labs/sdk-tasks`.
npm package: @sanity-typed/preview-kit
Description: @sanity/preview-kit with typed GROQ Results
Latest version: 6.0.0

# @sanity-typed/preview-kit

[![NPM Downloads](https://img.shields.io/npm/dw/@sanity-typed/preview-kit?style=flat&logo=npm)](https://www.npmjs.com/package/@sanity-typed/preview-kit)
[![GitHub commit activity (branch)](https://img.shields.io/github/commit-activity/m/saiichihashimoto/sanity-typed?style=flat&logo=github)](https://github.com/saiichihashimoto/sanity-typed/pulls?q=is%3Apr+is%3Aclosed)
[![GitHub Repo stars](https://img.shields.io/github/stars/saiichihashimoto/sanity-typed?style=flat&logo=github)](https://github.com/saiichihashimoto/sanity-typed/stargazers)
[![GitHub contributors](https://img.shields.io/github/contributors/saiichihashimoto/sanity-typed?style=flat&logo=github)](https://github.com/saiichihashimoto/sanity-typed/graphs/contributors)
[![GitHub issues by-label](https://img.shields.io/github/issues/saiichihashimoto/sanity-typed/help%20wanted?style=flat&logo=github&color=007286)](https://github.com/saiichihashimoto/sanity-typed/labels/help%20wanted)
[![Minified Size](https://img.shields.io/bundlephobia/min/@sanity-typed/preview-kit?style=flat)](https://www.npmjs.com/package/@sanity-typed/preview-kit?activeTab=code)
[![License](https://img.shields.io/github/license/saiichihashimoto/sanity-typed?style=flat)](LICENSE)

[![GitHub Sponsors](https://img.shields.io/github/sponsors/saiichihashimoto?style=flat&logo=githubsponsors)](https://github.com/sponsors/saiichihashimoto)

[@sanity/preview-kit](https://github.com/sanity-io/preview-kit) with typed GROQ Results

> [!IMPORTANT]  
> This package is not actively maintained, currently. Sanity has [subsumed their toolkit into other packages](https://www.npmjs.com/package/@sanity/preview-kit/v/6.0.0), so it isn't meaningful to re-export the client here. The last version of `@sanity-typed/preview-kit` before they subsumed it is `v4.0.0`, [the documentation is there](https://github.com/saiichihashimoto/sanity-typed/blob/%40sanity-typed/preview-kit%404.0.0/packages/preview-kit/README.md).
npm package: @sanity-visx/studio
Description: > This is a **Sanity Studio v3** plugin.
Author: dvmonroe
Latest version: 0.1.2

# sanity-plugin-visx

> This is a **Sanity Studio v3** plugin.

## Installation

```sh
npm install sanity-plugin-visx
```

## Usage

Add it as a plugin in `sanity.config.ts` (or .js):

```ts
import {defineConfig} from 'sanity'
import {visxCharts} from 'sanity-plugin-visx'

export default defineConfig({
  //...
  plugins: [visxCharts({})],
})
```

## License

[MIT](LICENSE) © dvmonroe

## Develop & test

This plugin uses [@sanity/plugin-kit](https://github.com/sanity-io/plugin-kit)
with default configuration for build & watch scripts.

See [Testing a plugin in Sanity Studio](https://github.com/sanity-io/plugin-kit#testing-a-plugin-in-sanity-studio)
on how to run this plugin with hotreload in the studio.
npm package: @sanity/agent-context
Description: Tools for building AI agents with structured access to Sanity content
Author: Sanity.io
Latest version: 0.3.5

# @sanity/agent-context

## Installation

```bash
npm install @sanity/agent-context
```

## Studio Plugin

Registers a document type for configuring AI agent access to your Sanity content. Each document defines a content filter that scopes what an agent can query.

```ts
// sanity.config.ts
import {defineConfig} from 'sanity'
import {agentContextPlugin} from '@sanity/agent-context/studio'

export default defineConfig({
  // ...
  plugins: [agentContextPlugin()],
})
```

The plugin also exports `AGENT_CONTEXT_SCHEMA_TYPE_NAME` which can be used to configure where the document type appears in the Studio structure. Example:

```ts
import {defineConfig} from 'sanity'
import {structureTool} from 'sanity/structure'
import {agentContextPlugin, AGENT_CONTEXT_SCHEMA_TYPE_NAME} from '@sanity/agent-context/studio'

export default defineConfig({
  // ...
  plugins: [
    structureTool({
      structure: (S) =>
        S.list()
          .title('Content')
          .items([
            // Filter out agent context document from the default list
            ...S.documentTypeListItems().filter(
              (item) => item.getId() !== AGENT_CONTEXT_SCHEMA_TYPE_NAME,
            ),
            // Add it elsewhere, e.g. after a divider
            S.divider(),
            S.documentTypeListItem(AGENT_CONTEXT_SCHEMA_TYPE_NAME),
          ]),
    }),
    agentContextPlugin(),
  ],
})
```
npm package: @sanity/agent-types
Description: Type definitions for Sanity Agent
Latest version: 0.0.95

# @sanity/agent-types

> Type definitions for Sanity Agent

## Installation

```bash
npm install @sanity/agent-types
```

## Usage

This package provides TypeScript type definitions and Zod schemas for the Sanity Agent API.

```typescript
import { Context, DocumentBase, IntentType } from '@sanity/agent-types';

// Use types in your application
```

## Available Types

The package includes the following categories of types:

- **Context**: Types for agent context and persistent context
- **Document**: Types for Sanity documents and document previews
- **Intent**: Types for agent intents and parameters
- **Messages**: Types for WebSocket communication messages

## License

MIT
npm package: @sanity/bifur-client
Description: A WebSocket client for Sanity's Bifur real-time service. Communicates over JSON-RPC 2.0 and returns RxJS Observables.
Author: Sanity.io
Latest version: 1.0.0

# @sanity/bifur-client

A WebSocket client for Sanity's Bifur real-time service. Communicates over JSON-RPC 2.0 and returns RxJS Observables.

## Installation

```sh
npm install @sanity/bifur-client
```

## Usage

### From a `@sanity/client` instance

The simplest way to get started if you already use `@sanity/client`:

```ts
import {fromSanityClient} from '@sanity/bifur-client'
import {createClient} from '@sanity/client'

const sanityClient = createClient({
  projectId: 'your-project-id',
  dataset: 'production',
  token: 'your-token',
})

const bifur = fromSanityClient(sanityClient)
```

### From a WebSocket URL

Connect directly to a Bifur WebSocket endpoint:

```ts
import {fromUrl} from '@sanity/bifur-client'
import {of} from 'rxjs'

const bifur = fromUrl('wss://example.sanity.io/socket/production', {
  timeout: 10_000,
  token$: of('your-token'),
})
```

#### Options

| Option | Type | Description |
|--------|------|-------------|
| `timeout` | `number` | Milliseconds to wait before timing out the initial connection |
| `token$` | `Observable<string \| null>` | Observable of auth tokens. Emitting a new value re-authenticates the connection |

### Presence example

Subscribe to presence events with `listen()`, and send requests with `request()`:

```ts
// Subscribe to presence events
bifur.listen('presence').subscribe((event) => {
  console.log(event.type, event) // 'rollCall', 'state', or 'disconnect'
})

// Respond to roll calls
bifur.request('presence_rollcall', {session: sessionId})

// Announce your location
bifur.request('presence_announce', {
  data: {sessionId, locations: [{documentId: 'my-doc', path: 'title'}]},
})

// Disconnect
bifur.request('presence_disconnect', {session: sessionId})
```

### Heartbeats

`heartbeats` is an Observable that emits a `Date` each time a message (including heartbeat pings) is received. Subscribing to it keeps the connection alive between requests:

```ts
bifur.heartbeats.subscribe((timestamp) => {
  console.log('Last activity:', timestamp)
})
```

### Request and subscribe methods

**Request methods:** `presence_rollcall`, `presence_announce`, `presence_disconnect`, `authorization`

**Subscribe methods:** `presence`, `authorization`

### Error codes

```ts
import {ERROR_CODES} from '@sanity/bifur-client'

// Connection-level
ERROR_CODES.BAD_REQUEST     // 4000
ERROR_CODES.UNAUTHORIZED    // 4001
ERROR_CODES.NOT_FOUND       // 4004

// Application-level (JSON-RPC)
ERROR_CODES.INVALID_REQUEST        // -32600
ERROR_CODES.METHOD_NOT_FOUND       // -32601
ERROR_CODES.INVALID_PARAMS         // -32602
ERROR_CODES.SUBSCRIPTION_NOT_FOUND // -32602
ERROR_CODES.PARSE_ERROR            // -32700
```

## License

MIT - See LICENSE
npm package: @sanity/block-content-to-markdown
Description: [Deprecated] Transforming Sanity block content to markdown
Author: Sanity
Latest version: 1.0.1
Deprecated: Unmaintained - use `@portabletext/markdown` instead

# block-content-to-markdown

> [!CAUTION]
> This module is deprecated and no longer maintained - see [@portabletext/markdown](https://www.npmjs.com/package/@portabletext/markdown) for a modern replacement.

Render an array of [block text](https://www.sanity.io/docs/schema-types/block-type) from Sanity to markdown.

## Installing

```
npm install --save @sanity/block-content-to-markdown
```

## Usage

````js
const toMarkdown = require('@sanity/block-content-to-markdown')
const client = require('@sanity/client')({
  projectId: '<your project id>',
  dataset: '<some dataset>',
  useCdn: true
})

const serializers = {
  types: {
    code: props => '```' + props.node.language + '\n' + props.node.code + '\n```'
  }
}

client.fetch('*[_type == "article"][0]').then(article => {
  console.log(toMarkdown(article.body, {serializers}))
})
````

## Options

- `serializers` - Specifies the functions used for rendering content. Merged with default serializers.
- `serializers.types` - Serializers for block types, see example above
- `serializers.marks` - Serializers for marks - data that annotates a text child of a block. See example usage below.
- `serializers.list` - Function to use when rendering a list node
- `serializers.listItem` - Function to use when rendering a list item node
- `serializers.hardBreak` - Function to use when transforming newline characters to a hard break
- `imageOptions` - When encountering image blocks, this defines which query parameters to apply in order to control size/crop mode etc.

In addition, in order to render images without materializing the asset documents, you should also specify:

- `projectId` - The ID of your Sanity project.
- `dataset` - Name of the Sanity dataset containing the document that is being rendered.

## Examples

### Rendering custom marks

```js
const input = [
  {
    _type: 'block',
    children: [
      {
        _key: 'a1ph4',
        _type: 'span',
        marks: ['s0m3k3y'],
        text: 'Sanity'
      }
    ],
    markDefs: [
      {
        _key: 's0m3k3y',
        _type: 'highlight',
        color: '#E4FC5B'
      }
    ]
  }
]

const highlight = props => {
  const content = Array.isArray(props.children) ? props.children.join('') : props.children
  return `<span style="background-color: ${props.mark.color};">${content}</span>`
}

toMarkdown(input, {serializers: {marks: {highlight}}})
```

### Specifying image options

```js
toMarkdown(input, {
  imageOptions: {w: 320, h: 240, fit: 'max'},
  projectId: 'myprojectid',
  dataset: 'mydataset'
})
```

## License

MIT-licensed. See LICENSE.
npm package: @sanity/block-content-to-tree
Description: Converts the flat Sanity block content structure into a generic tree structure for easier transformation into other formats.
Author: Sanity
Latest version: 0.3.0
Deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

# block-content-to-tree-js

Converts the flat Sanity block content structure into a generic tree structure for easier transformation into other formats (HTML, React etc).

## Installation

``npm install --save @sanity/block-content-to-tree``

## Quick example

```js

// The flat block content structure
const data = {
  "_type": "block",
  "style": "normal",
  "spans": [
    {
      "_type": "span",
      "text": "String with an ",
      "marks": []
    },
    {
      "_type": "span",
      "text": "italicized",
      "marks": [
        "em"
      ]
    },
    {
      "_type": "span",
      "text": " word.",
      "marks": []
    }
  ]
}


// Now convert it with block-content-to-tree
const BlockContentToTree = require('@sanity/block-content-to-tree')
const blockContentToTree = new BlockContentToTree()

const tree = blockContentToTree.convert(data)
```

This will result in the variable ``tree`` being:

```js
{
    type: 'block',
    style: 'normal',
    content: [
      'String with an ',
      {
        type: 'span',
        attributes: {},
        mark: 'em',
        content: [
          'italicized'
        ]
      },
      ' word.'
    ]
  }
```

## Entities

### Block (text)

```js
{
  type: 'block',
  style: 'normal' // Text style
  mark: 'em', // Mark indicating all content is wrapped in bold.
  content: [
    'Hello world! ', // Span with no marks or attributes (plain text).
    {
      type: 'span',
      // Data attributes for this span
      attributes: {link: {href: 'http://...'}},
      mark: 'strong',
      // The  text content for the span
      // Always an array with a single plain text.
      // An array to keep format consistent with block.content.
      content: [
        'I am a link!'
      ]
    }
  ]
}

```

### List

Root element

```js
{
  type: 'list',
  itemStyle: 'bullet' // The list style
  // Items are blocks (see above)
  items: [
    {block},
    {block}
  ]
}

```

### Custom blocks

```js
{
  type: 'author' // Whatever, but never 'block' (built in type)
  attributes: { // Custom attributes for the type
    name: 'John Ronald Reuel Tolkien',
  }
}
```

## More information / examples

Please see the tests.


## License

MIT-licensed
npm package: @sanity/blueprints
Description: Helper methods and type definitions for Sanity Blueprints
Author: Sanity.io
Latest version: 0.15.1

# `@sanity/blueprints`

> [!IMPORTANT]
> This package is currently in beta and may change. Refer to the [CHANGELOG](./CHANGELOG.md) for details.

TypeScript helpers for defining and validating [Sanity Blueprints](https://www.sanity.io/docs/blueprints) — declarative infrastructure-as-code for your Sanity project.

## Installation

```bash
npm install @sanity/blueprints
```

## Usage

A blueprint is a module that declares the Sanity resources your project needs. Export it as the default from your blueprint file:

```ts
import {
  defineBlueprint,
  defineCorsOrigin,
  defineDocumentFunction,
  defineDocumentWebhook,
  defineRobotToken,
  defineRole,
} from '@sanity/blueprints'

export default defineBlueprint({
  resources: [
    defineCorsOrigin({
      name: 'localhost-origin',
      origin: 'http://localhost:3333',
      allowCredentials: true,
    }),

    defineDocumentFunction({
      name: 'on-publish',
      event: {
        on: ['create', 'update'],
        filter: "_type == 'product'",
        projection: '{_id, title, slug}',
      },
    }),

    defineDocumentWebhook({
      name: 'server-webhook',
      url: 'https://api.example.com/webhooks/sanity',
      on: ['create', 'update'],
      dataset: 'production',
      apiVersion: 'v2026-01-01',
    }),

    defineRobotToken({
      name: 'ci-robot',
      memberships: [{
        resourceType: 'project',
        resourceId: 'your-project-id',
        roleNames: ['developer'],
      }],
    }),
  ],
})
```

## Available resources

| Definer | Description |
|---|---|
| `defineBlueprint` | Top-level blueprint module containing resources |
| `defineDocumentFunction` | Function triggered by document events |
| `defineMediaLibraryAssetFunction` | Function triggered by media library events |
| `defineCorsOrigin` β | CORS origin allowing browser requests to your project |
| `defineDocumentWebhook` β | Webhook triggered by document changes |
| `defineRole` β | Custom role with permissions |
| `defineRobotToken` β | Robot token for automated access |

Each definer validates its input at call time and returns a typed resource object. See the [reference docs](https://reference.sanity.io/_sanity/blueprints) for full configuration details and additional resource types.
npm package: @sanity/blueprints-jsonschemas
Description: JSON schemas for Sanity Blueprints configuration files
Latest version: 0.1.1

# @sanity/blueprints-jsonschemas

JSON schemas for Sanity Blueprints configuration files.

## Installation

```bash
npm install @sanity/blueprints-jsonschemas
```

## Usage

```javascript
import schemas from '@sanity/blueprints-jsonschemas'

// Access individual schemas
const blueprintSchema = schemas.sanity.blueprint
const projectSchema = schemas.sanity.project
const httpsFunction = schemas.sanity.function.https

// Available schemas
console.log(schemas.sanity.blueprint)     // Blueprint schema
console.log(schemas.sanity.project)      // Project schema
console.log(schemas.sanity.app)          // App schema

// Function schemas
console.log(schemas.sanity.function.cron)     // Cron function
console.log(schemas.sanity.function.document) // Document function
console.log(schemas.sanity.function.event)    // Event function
console.log(schemas.sanity.function.https)    // HTTPS function
console.log(schemas.sanity.function.queue)    // Queue function
console.log(schemas.sanity.function.wss)      // WebSocket function

// Project sub-schemas (also available on project schema)
console.log(schemas.sanity.project.dataset)   // Dataset schema
console.log(schemas.sanity.project.origin)    // Origin schema
console.log(schemas.sanity.project.studio)    // Studio schema
console.log(schemas.sanity.project.webhook)   // Webhook schema
```

## Schema Validation

You can use these schemas with any JSON Schema validator:

```javascript
import Ajv from 'ajv'
import schemas from '@sanity/blueprints-jsonschemas'

const ajv = new Ajv()
const validate = ajv.compile(schemas.sanity.blueprint)

const isValid = validate({
  blueprintVersion: '2024-10-01',
  resources: [
    {
      name: 'my-project',
      type: 'sanity.project'
    }
  ]
})

if (!isValid) {
  console.log(validate.errors)
}
```

## Schema Versions

Current schema version: `2024-10-01`

All schemas follow the JSON Schema Draft 2020-12 specification.

## License

MIT
npm package: @sanity/blueprints-parser
Description: A parser and validator for Sanity Blueprint documents.
Author: Sanity.io
Latest version: 0.4.0

# @sanity/blueprints-parser

Parser and validator for Sanity Blueprints.

## Usage

```ts
import blueprintParserValidator from '@sanity/blueprints-parser'

const {blueprint, errors} = blueprintParserValidator(`{
  "resources": [
    {
      "name": "a-function",
      "type": "cloud-function",
      "project": "$.params.project"
    }
  ]
}`, {
  parameters: {
    project: "a-project"
  }
})
if (errors?.length) {
  for (const err of errors) {
    console.error(`${err.type}: ${err.message}`)
  }
}

console.log(blueprint.resources[0].name) // a-function
console.log(blueprint.resources[0].type) // cloud-function
console.log(blueprint.resources[0].project) // a-project
```
npm package: @sanity/browserslist-config
Description: Sanity.io Browserslist shared configuration
Author: Sanity.io
Latest version: 1.0.5

# @sanity/browserslist-config

[![npm stat](https://img.shields.io/npm/dm/@sanity/browserslist-config.svg?style=flat-square)](https://npm-stat.com/charts.html?package=@sanity/browserslist-config)
[![npm version](https://img.shields.io/npm/v/@sanity/browserslist-config.svg?style=flat-square)](https://www.npmjs.com/package/@sanity/browserslist-config)

```sh
npm install --save-dev @sanity/browserslist-config
```

This package is used together with [`@sanity/pkg-utils`], and any other packages that supports [`browserslist`]. Add the `browserslist` key to your `package.json`.

```diff
   "author": "Sanity.io <hello@sanity.io>",
+  "browserslist": "extends @sanity/browserslist-config",
   "files": {
```

[`@sanity/pkg-utils`]: https://github.com/sanity-io/pkg-utils#readme
[`browserslist`]: https://github.com/browserslist/browserslist#shareable-configs
npm package: @sanity/color
Description: The Sanity color palette.
Author: Sanity.io
Latest version: 3.0.6

# @sanity/color

The Sanity color palette.

```sh
npm install @sanity/color
```

[![npm version](https://img.shields.io/npm/v/@sanity/color.svg?style=flat-square)](https://www.npmjs.com/package/@sanity/color)

## Usage

```js
import {black, hues, COLOR_HUES, COLOR_TINTS} from '@sanity/color'

console.log(black.title)
// "Black"
console.log(black.hex)
// "#101112"

console.log(hues.red['500'].title)
// "Red 500"
console.log(hues.red['500'].hex)
// "#f03e2f"

console.log(COLOR_HUES)
// ["gray", "blue", "purple", "magenta", "red", "orange", "yellow", "green", "cyan"]

console.log(COLOR_TINTS)
// ["50", "100", "200", "300", "400", "500", "600", "700", "800", "900", "950"]
```

## License

MIT-licensed. See LICENSE.
npm package: @sanity/color-input
Description: Color input
Author: Sanity.io
Latest version: 6.0.4

# @sanity/color-input

## What is it?

Color input plugin for [Sanity](https://sanity.io/) that stores selected colors in hex, hsl, hsv and rgb format.

![Color input in the Studio](https://github.com/user-attachments/assets/070a3718-33fc-47f7-94fb-93988902e81e)

## Installation

```
npm install --save @sanity/color-input
```

or

```
yarn add @sanity/color-input
```

## Usage

Add it as a plugin in sanity.config.ts (or .js):

```js
import {colorInput} from '@sanity/color-input'

export default defineConfig({
  // ...
  plugins: [colorInput()],
})
```

Now you can use the `color` type in your schema types:

```js
// [...]
{
  fields: [
    // [...]
    {
      name: 'favoriteColor',
      title: 'Favorite color',
      type: 'color',
    },
  ]
}
```

## Options

### Disable alpha

To disable the alpha option, set `disableAlpha` to `true`:

```js
// ...fields...
{
  name: 'favoriteColor',
  title: 'Color no-alpha',
  type: 'color',
  options: {
    disableAlpha: true
  }
}
```

Which will render accordingly:

![This is an image](https://github.com/user-attachments/assets/f7095cbb-8014-4aef-bb95-58f6aa25672b)

### Color list

To add list of predefined selectable color swatches for the user to choose from use `colorList`.
This uses the `react-color` under the hood https://casesandberg.github.io/react-color/#api-color

```js
// ...fields...
{
  name: 'favoriteColor',
  title: 'Color with list',
  type: 'color',
  options: {
    colorList: [
      '#FF6900',
      { hex: '#FCB900' },
      { r: 123, g: 220, b: 181 },
      { r: 0, g: 208, b: 132, a: 0.5 },
      { h: 203, s: 95, l: 77, a: 1 },
      { h: 202, s: 95, l: 46, a: 0.5 },
      { h: 345, s: 43, v: 97 },
      { h: 344, s: 91, v: 92, a: 0.5 },
    ]
  }
}
```

Which will render accordingly:

![This is an image](https://github.com/user-attachments/assets/f2a35da3-8944-46b3-a626-9aa870800b65)

## Data model

```js
{
  _type: 'color',
  hex: '#29158a',
  alpha: 0.9,
  hsl: {
    _type: 'hslaColor',
    h: 249.99999999999994,
    s: 0.7328000000000001,
    l: 0.313,
    a: 0.9
  },
  hsv: {
    _type: 'hsvaColor',
    h: 249.99999999999994,
    s: 0.8457987072945522,
    v: 0.5423664,
    a: 0.9
  },
  rgb: {
    _type: 'rgbaColor',
    r: 41
    g: 21,
    b: 138,
    a: 0.9
  }
}
```

## License

MIT-licensed. See LICENSE.
npm package: @sanity/core-loader
Description: [![npm stat](https://img.shields.io/npm/dm/@sanity/core-loader.svg?style=flat-square)](https://npm-stat.com/charts.html?package=@sanity/core-loader) [![npm version](https://img.shields.io/npm/v/@sanity/core-loader.svg?style=flat-square)](https://www.npmjs
Author: Sanity.io
Latest version: 2.0.7

# @sanity/core-loader

[![npm stat](https://img.shields.io/npm/dm/@sanity/core-loader.svg?style=flat-square)](https://npm-stat.com/charts.html?package=@sanity/core-loader)
[![npm version](https://img.shields.io/npm/v/@sanity/core-loader.svg?style=flat-square)](https://www.npmjs.com/package/@sanity/core-loader)
[![gzip size][gzip-badge]][bundlephobia]
[![size][size-badge]][bundlephobia]

```sh
npm install @sanity/core-loader @sanity/client
```

[gzip-badge]: https://img.shields.io/bundlephobia/minzip/@sanity/core-loader?label=gzip%20size&style=flat-square
[size-badge]: https://img.shields.io/bundlephobia/min/@sanity/core-loader?label=size&style=flat-square
[bundlephobia]: https://bundlephobia.com/package/@sanity/core-loader
npm package: @sanity/css-in-js
Description: A fork of styled-components that supports React 19 streaming ssr without ServerStyleSheet or sheet.collectStyles techniques
Author: Sanity.io
Latest version: 6.2.1

# @sanity/css-in-js

# ⚠️ Performance-focused styled-components forks

> **Important**: [Sanity](https://www.sanity.io) is not actively maintaining these packages long-term. We're transitioning away from CSS-in-JS solutions to [vanilla-extract](https://vanilla-extract.style/). These forks exist to help the community during the transition period after styled-components [ceased active maintenance](https://opencollective.com/styled-components/updates/thank-you).

[See the README for more information.](https://github.com/sanity-io/styled-components-last-resort#readme)
npm package: @sanity/debug-live-sync-tags
Description: ```bash npm install --save @sanity/debug-live-sync-tags ```
Author: Sanity.io
Latest version: 1.0.2

# @sanity/debug-live-sync-tags

## Installation

```bash
npm install --save @sanity/debug-live-sync-tags
```

or

```bash
pnpm add @sanity/debug-live-sync-tags
```

or

```
yarn add @sanity/debug-live-sync-tags
```

## Usage

Add it as a plugin in sanity.config.ts:

```js
import {defineConfig} from 'sanity'
import {debugLiveSyncTags} from '@sanity/debug-live-sync-tags'

export default defineConfig({
  // ...
  plugins: [debugLiveSyncTags()],
})
```
npm package: @sanity/debug-preview-url-secret-plugin
Description: [![npm stat](https://img.shields.io/npm/dm/@sanity/debug-preview-url-secret-plugin.svg?style=flat-square)](https://npm-stat.com/charts.html?package=@sanity/debug-preview-url-secret-plugin) [![npm version](https://img.shields.io/npm/v/@sanity/debug-preview
Author: Sanity.io
Latest version: 2.0.8

# @sanity/debug-preview-url-secret-plugin

[![npm stat](https://img.shields.io/npm/dm/@sanity/debug-preview-url-secret-plugin.svg?style=flat-square)](https://npm-stat.com/charts.html?package=@sanity/debug-preview-url-secret-plugin)
[![npm version](https://img.shields.io/npm/v/@sanity/debug-preview-url-secret-plugin.svg?style=flat-square)](https://www.npmjs.com/package/@sanity/debug-preview-url-secret-plugin)

```sh
npm install @sanity/debug-preview-url-secret-plugin
```

This package is used together with [`sanity/presentation`] to debug URL preview secrets and their status.

Add the plugin to your `sanity.config.ts`:

```ts
// ./sanity.config.ts
import {debugSecrets} from '@sanity/debug-preview-url-secret-plugin'
import {defineConfig} from 'sanity'
import {structureTool} from 'sanity/structure'
import {presentationTool} from 'sanity/presentation'

export default defineConfig({
  // ... other options
  plugins: [
    // ... other plugins
    structureTool(),
    presentationTool({
      previewUrl: {
        // @TODO change to the URL of the application, or `location.origin` if it's an embedded Studio
        origin: 'http://localhost:3000',
        previewMode: {
          enable: '/api/draft',
        },
      },
    }),
    debugSecrets(),
  ],
})
```

You should see a new `@sanity/preview-url-secret` type in Structure Tool, which lists out secrets with metadata about when they were created and in what context.

[`sanity/presentation`]: https://www.sanity.io/docs/visual-editing/configuring-the-presentation-tool
npm package: @sanity/demo
Description: Design tokens for implementing demos and templates at Sanity.io.
Author: Sanity.io
Latest version: 2.0.0

# @sanity/demo

Design tokens and guidelines for implementing demos and templates at Sanity.io.

## Installation

```sh
npm install @sanity/demo
```

## Local development

```sh
git clone git@github.com:sanity-io/demo.git
cd demo
pnpm install
pnpm dev
# Open Vite development server
```

## Usage

Follow these steps to configure your demo:

### Installing fonts

Sanity demos use Inter, PT Serif, and IBM Plex Mono. Add this snippet inside the `<head>` tag of your application:

```html
<!-- Google fonts -->
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
  href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@500;700&family=Inter:wght@500;700;800&family=PT+Serif:ital,wght@0,400;0,700;1,400;1,700&display=swap"
  rel="stylesheet"
/>
```

### Usage with Tailwind

```js
// tailwind.config.js

const {theme} = require('@sanity/demo/tailwind')

/** @type {import('tailwindcss').Config} */
module.exports = {
  content: [...],
  theme,
  plugins: [require('@tailwindcss/typography')],
}
```

## License

MIT © [Sanity.io](LICENSE)
npm package: @sanity/descriptors
Description: _Descriptors_ is a way of serializing definitions (e.g. schema types) so they can be easily shared across Content Lake. It has the following characteristics:
Author: Magnus Holm
Latest version: 1.3.0

# Descriptors

_Descriptors_ is a way of serializing definitions (e.g. schema types) so they can be easily shared across Content Lake.
It has the following characteristics:

- **JSON native:**
  A descriptor is encoded using JSON with support for the typical JSON values: Objects, arrays, strings, booleans, floats.
- **Content-addressable:** Each descriptor has an `id` which is the SHA-256 hash of the contents.
  The same descriptor will always end up with the same `id`.
- **Recursively defined:**
  It's common for descriptors to refer to _other_ descriptors by their `id`.
  That way you can refer to a whole graph of interconnected descriptors by a single root `id`.
  This is very similar to how a blockchain works, but without the utter waste of energy.
- **Efficient synchronization:**
  The format is designed so that it's possible to efficiently synchronize when there's only been a few changes on the client-side.
  This is possible without the client storing any additional information about the state of the server.

Here's an example of two descriptors: One named schema type, and then one schema registry which ties it together (so that recursively defined types can be represented).

```ts
{
  "id": "uEiA4r6C4bPFx1dMadoWeZ4ZJxLLXGzeNojZIsnGxp6g0rw",
  "type": "sanity.schema.registry"
  "content": [
    "uEiDPWicraeaSOVaZEUlyrF6RFDRURU4XCLsNR7zCLoNAcg",
    "uEiChs9ZdIsaYe7KLKSVk3b1yApMvlHIO8UvebgjJYTUMAQ"
  ]
}

{
  "id": "uEiChs9ZdIsaYe7KLKSVk3b1yApMvlHIO8UvebgjJYTUMAQ",
  "type": "sanity.schema.namedType",
  "name": "username",
  "typeDef": {
    "subtypeOf": "string",
    "title": "Username"
  }
}
```

## Usage

Once a client has built a descriptor it can **send it into Content Lake** and then start using the ID towards other services.
It's important to realize that "sending it into Content Lake" doesn't make it visible anywhere.
Studio can upload the schema into Content Lake and the _only_ thing that happens is that now it can use the `schemaId` towards e.g. Agent Action.
The concept of for instance saying "dataset X has schema Y" is **not** solved here.
What we're dealing with here is how to _represent_ that schema on the server-side and being able to _refer_ to it.

## Further documentation

To learn more:

- [docs/format.md](docs/format.md) describes the overall structure of the format.
- [docs/sync.md](docs/sync.md) describes the efficient synchronization protocol.
- [playground/](playground) is a demo application which shows the synchronization protocol.
npm package: @sanity/document-store
Description: Sanity / gradient document store
Author: Sanity.io
Latest version: 1.148.1

# Document store

Sanity / gradient document store

## Example
```js
// If you are interested in everything that happens with document `lol42`
const subscription = documents.byId("lol42").subscribe(event => {
  console.log('Something happened with document lol42!', event)
})

// After a while, when you are no longer interested in updates fom document `lol42`:
subscription.unsubscribe()
```

## How it works
When you add a subscriber to a document the first thing that happens is that the subscriber function is called with a snapshot of the document's current state. This happens as soon as the snapshot is retrieved. If there is a cached version of it on the client, the snapshot is received immediately (synchronously).

From that moment on, you will receive a new event every time something happens to the document, until you unsubscribe again.

## API

- `createDocumentStore({serverConnection: ServerConnection}) : DocumentStore`

ServerConnection must be an object with the following api:
- `byId(id : string) : Observable<DocumentEvent>`
- `query(query : string) : Observable<QueryResultEvent>`
(todo, add more)

### DocumentStore

### Query methods
- `byId(id : string) : Observable<DocumentEvent>`
- `byIds(ids : Array<string>) : Observable<QueryResultEvent>`
- `query(query : string) : Observable<QueryResultEvent>`

### Mutation methods
- `update(id : string, spec : UpdateSpec) : Observable<OperationEvent>`
- `create(document : Document) : Observable<OperationEvent>`
- `replace(documentId : string, document : Document) : Observable<OperationEvent>`
- `createOrReplace(document : Document) : Observable<OperationEvent>`
- `delete(documentId : string) :  : Observable<OperationEvent>`

### Document
- `_id : string`
- `_type : string`

### DocumentEventType

### DocumentEvent
- `type : string` either one of `snapshot`, `update`
- `snapshot : Document`
npm package: @sanity/embeddings-index-cli
Description: CLI for creating and managing embeddings indexes
Author: Sanity.io
Latest version: 1.0.12
Deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

# Sanity Embeddings Index CLI

> Using this feature requires Sanity to send data to OpenAI.com, and Pinecone.io for storing vector interpretations of documents.

CLI for the Sanity Embeddings Index API.

The Embeddings Index API enables creating named embeddings vector indexes.

An embeddings index contains embeddings for all Sanity documents matching a configured [GROQ filter](https://www.sanity.io/docs/how-queries-work) in a dataset.
A [GROQ projection](https://www.sanity.io/docs/query-cheat-sheet) is applied to matching documents before vectorization.

You can query indexes using semantic text search to obtain a list of matching document IDs sorted by relevance.

When an index is first created, all documents matching the configured filter are synced into the index.
Creating an index can take time, depending on the number of existing documents and the indexer load.

## Installation

```sh
npm i -D @sanity/embeddings-index-cli
```
## Usage

```bash
 $ embeddings-index --help
 
 Usage
    $ embeddings-index [--help] [--debug] <command> [<args>]

   These are common commands for CRUD operations on embeddings indexes:

     create          Create a new embeddings index
     delete          Delete an existing embeddings index
     list            List all embedding indexes
     get             Get a specific embeddings index
     query           Query an embeddings index
     version         Show the currently installed version of Embeddings Index CLI

   Run the commands in a Sanity project directory with a 'sanity.cli.(ts|js)' file.

   Options
     --verbose       Log everything. This option conflicts with --silent
     --silent        Do not print info and warning messages. This option conflicts with --verbose
     --debug         Print stack trace on errors
     --version       Output the version number
     --help          Output usage information
```

See the individual commands for more, ie `embeddings-index create --help`.

### Using with `npx`

Use `npx @sanity/embeddings-index-cli` in place of `embeddings-index` in the commands.

Example:
```bash
npx @sanity/embeddings-index-cli --help
```

## License

[MIT](LICENSE) © Sanity.io



## Develop & test

This plugin uses [@sanity/plugin-kit](https://github.com/sanity-io/plugin-kit)
with default configuration for build & watch scripts.

See [Testing a plugin in Sanity Studio](https://github.com/sanity-io/plugin-kit#testing-a-plugin-in-sanity-studio)
on how to run this plugin with hotreload in the studio.

### Release new version

Run ["CI & Release" workflow](https://github.com/sanity-io/embeddings-index-cli/actions/workflows/main.yml).
Make sure to select the main branch and check "Release new version".

Semantic release will only release on configured branches, so it is safe to run release on any branch.
npm package: @sanity/eslint-config-cli
Description: Shared ESLint configuration for Sanity CLI packages
Author: Sanity.io
Latest version: 1.1.0

# @sanity/eslint-config-cli

Shared ESLint configuration for Sanity CLI packages.

## Requirements

- **ESLint** `^9.0.0` or `^10.0.0`
- **Node.js** `^18.18.0` (ESLint 9) or `^20.19.0 || ^22.13.0 || >=24` (ESLint 10)

## Installation

```bash
npm install --save-dev @sanity/eslint-config-cli eslint
```

or with pnpm:

```bash
pnpm add --save-dev @sanity/eslint-config-cli eslint
```

## Usage

Create an `eslint.config.mjs` file in your project root:

```javascript
import eslintConfig from '@sanity/eslint-config-cli'

export default [
  ...eslintConfig,
  // Add your custom rules here
]
```

You can also extend or override specific rules:

```javascript
import eslintConfig from '@sanity/eslint-config-cli'

export default [
  ...eslintConfig,
  {
    rules: {
      // Override or add custom rules
      '@typescript-eslint/no-explicit-any': 'warn',
    },
  },
]
```

## What's Included

This configuration includes:

- **ESLint recommended rules** - Core ESLint best practices
- **TypeScript ESLint** - TypeScript-specific linting rules
- **Import plugin** - Validates proper imports and prevents cycles
- **Node.js plugin** - Node.js best practices
- **Unicorn plugin** - Additional best practices and modern patterns
- **Perfectionist plugin** - Automatic sorting of imports, objects, and interfaces
- **TSDoc plugin** - Validates TSDoc comments
- **Unused imports** - Automatically detects and reports unused imports
- **Prettier compatibility** - Works seamlessly with Prettier

## Configuration Details

The configuration enforces:

- Natural sorting of imports with proper grouping
- Consistent code formatting
- TypeScript best practices
- Import validation and cycle detection
- Unused import detection
- Proper TSDoc syntax

## License

MIT © Sanity.io
npm package: @sanity/eslint-config-i18n
Description: An ESLint configuration to help with localizing Sanity Studios
Author: Sanity.io
Latest version: 2.0.0

# @sanity/eslint-config-i18n

An ESLint configuration to help with localizing Sanity Studios.

This ESLint config provides rules to enforce specific code standards in internationalization practices, particularly focusing on strings literals in JSX. It aims to improve code quality and maintainability in projects with internationalization concerns.

Depends on:

- [`@sanity/eslint-plugin-i18n`](https://github.com/sanity-io/eslint-plugin-i18n)
  - Rule [`no-attribute-string-literals`](https://github.com/sanity-io/eslint-plugin-i18n#no-attribute-string-literals)
  - Rule [`no-attribute-template-literals`](https://github.com/sanity-io/eslint-plugin-i18n#no-attribute-template-literals)
- [`eslint-plugin-i18next`](https://github.com/edvardchen/eslint-plugin-i18next)
  - Rule [`no-literal-string`](https://github.com/edvardchen/eslint-plugin-i18next#rule-no-literal-string)

## Installation

### Install

```
pnpm add eslint @sanity/eslint-config-i18n --save-dev
```

or

```
npm install eslint @sanity/eslint-config-i18n --save-dev
```

### Update the configuration

Update your `eslint.config.mjs` to include `"@sanity/eslint-config-i18n"`

```diff
 import studio from '@sanity/eslint-config-studio'
+import i18n from '@sanity/eslint-config-i18n'

export default [
   ...studio,
+  ...i18n,
]
```

### Version compatibility

This package is designed to work with ESLint >= 9, which supports/uses the new ["flat configuration"](https://eslint.org/blog/2022/08/new-config-system-part-2/) format.

If you are using ESLint <= 8, you should install and use [`@sanity/eslint-config-i18n@1`](https://github.com/sanity-io/eslint-config-i18n/tree/v1.1.0).

## Release new version

Run ["CI & Release" workflow](https://github.com/sanity-io/eslint-config-i18n/actions).
Make sure to select the main branch and check "Release new version".

Semantic release will only release on configured branches, so it is safe to run release on any branch.
npm package: @sanity/eslint-config-no-v2-imports
Description: ESLint ruleset for marking Studio V2 imports as errors
Author: Sanity.io
Latest version: 0.0.1-studio-v3.3

# @sanity/eslint-config-no-v2-imports

ESLint ruleset for marking Studio V2 imports as errors.

Helpful when migration a V2 studio or plugin to V3. Errors link to migration guide and reference docs.

## Installing

```bash
npm install --save-dev @sanity/eslint-config-no-v2-imports
```

## Usage

Create an `.eslintrc` in the root of your project (or an `eslintConfig` entry in `package.json`) and extend the `no-v2-imports` config:

```json
{
  "env": {"node": true, "browser": true},
  "extends": ["@sanity/no-v2-imports"]
}
```

Adjust `env` according to your use case.

## License

MIT © [Sanity.io](https://www.sanity.io/)