npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@limitless-angular/sanity

v18.3.1

Published

A powerful Angular library for Sanity.io integration, featuring Portable Text rendering and optimized image loading.

Downloads

323

Readme

Limitless Angular

Twitter Follow npm version npm downloads

Limitless Angular is a powerful collection of Angular libraries focused on Sanity.io integration, designed to enhance your development experience with features like Portable Text rendering, image optimization, real-time previews, and visual editing.

Quick Links

Features

  • Portable Text: Complete implementation for rendering Sanity's Portable Text
  • 🖼️ Image Optimization: Built-in image loader and directives for Sanity images
  • 🔄 Real-time Preview: Live content updates with Preview Kit
  • ✏️ Visual Editing: Seamless content management integration
  • 🎯 Angular-First: Built specifically for Angular 18+

Installation

npm install --save @limitless-angular/sanity

Version Compatibility

| Angular version | Package version | | --------------- | --------------- | | ≥18.0.0 | 18.x |

Quick Start

Basic Configuration

For image optimization features:

import { ApplicationConfig } from '@angular/core';
import { provideSanity } from '@limitless-angular/sanity';

export const appConfig: ApplicationConfig = {
  providers: [
    provideSanity({
      projectId: 'your-project-id',
      dataset: 'your-dataset',
    }),
  ],
};

Preview Kit & Visual Editing Configuration

For preview and visual editing features, use the client factory approach:

import { provideSanity, withLivePreview } from '@limitless-angular/sanity';
import { createClient } from '@sanity/client';

const client = createClient({
  projectId: 'your-project-id',
  dataset: 'your-dataset',
  apiVersion: 'YYYY-MM-DD',
  useCdn: true,
});

const getClientFactory = (preview?: { token: string }) =>
  preview?.token
    ? client.withConfig({
        token: preview.token,
        useCdn: false,
        ignoreBrowserTokenWarning: true,
        perspective: 'previewDrafts',
        stega: {
          enabled: true,
          studioUrl: 'your-studio-url',
        },
      })
    : client;

export const appConfig: ApplicationConfig = {
  providers: [provideSanity(getClientFactory, withLivePreview())],
};

Features

Portable Text

Render Portable Text with Angular.

@Component({
  standalone: true,
  imports: [PortableTextComponent],
  template: `<div portable-text [value]="content" [components]="components"></div>`,
})
export class ContentComponent {
  content = [
    /* your portable text content */
  ];
  components: PortableTextComponents = {
    // Custom components configuration
  };
}

📚 Portable Text Documentation

Image Handling

Powerful features for working with Sanity images in Angular applications:

@Component({
  standalone: true,
  imports: [SanityImage],
  template: `
    <img
      [sanityImage]="imageRef"
      width="800"
      height="600"
      [alt]="imageRef.alt"
    />
  `,
})

📚 Image Loader Documentation

Preview Kit

The Preview Kit provides real-time preview capabilities for Sanity content in Angular applications, enabling live updates of content as it's being edited in the Sanity Studio:

import { LiveQueryProviderComponent } from '@limitless-angular/sanity/preview-kit';

@Component({
  standalone: true,
  imports: [LiveQueryProviderComponent],
  template: `
    @if (draftMode()) {
      <live-query-provider [token]="token">
        <router-outlet />
      </live-query-provider>
    } @else {
      <router-outlet />
    }
  `,
})
export class AppComponent {
  draftMode = signal(false);
  token = signal('your-preview-token');
}

📚 Preview Kit Documentation

Visual Editing

The Visual Editing feature allows editors to click elements in your preview to navigate directly to the corresponding document and field in Sanity Studio.

@Component({
  standalone: true,
  imports: [VisualEditingComponent],
  template: `
    <main>
      <router-outlet />
      @if (draftMode()) {
        <visual-editing />
      }
    </main>
  `,
})
export class AppComponent {}

📚 Visual Editing Documentation

Roadmap

  • 🎯 Performance optimizations
  • 📚 Enhanced documentation and examples
  • ✅ Comprehensive test coverage
  • 🔄 Lazy loading for Portable Text components

Contributing

We welcome contributions! Check our Contributing Guide for details.

Support

Credits

Adapted from @portabletext/react which provided the vast majority of node rendering logic.

License

This project is licensed under the MIT License. See our LICENSE file for details.