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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@shabalinmax/tiptap-scout

v0.3.0

Published

Search and replace extension for Tiptap

Readme

@shabalinmax/tiptap-scout

Расширение поиска и замены для Tiptap 3.

Существующие аналоги устарели и написаны под Tiptap 2. Этот пакет разработан для Tiptap 3 с нуля.

README in English

Возможности

  • Поиск текста без учёта регистра
  • Поиск корректно работает через inline-форматирование (жирный, курсив, ссылки и т.д.)
  • Подсветка совпадений через ProseMirror Decorations
  • findNext / findPrevious с циклической навигацией
  • replace / replaceAll с корректным undo/redo
  • Опциональный scroll к текущему совпадению
  • Live update — автоматический пересчёт поиска при изменении документа
  • Счётчик "N из M" через editor.storage.scout
  • Настраиваемые CSS-классы — стили не навязываются
  • React hook useScout для реактивного состояния
  • Полная типизация TypeScript с автокомплитом команд

Установка

npm install @shabalinmax/tiptap-scout

Peer-зависимости

npm install @tiptap/core @tiptap/pm

Использование

import { Editor } from '@tiptap/core'
import StarterKit from '@tiptap/starter-kit'
import { Scout } from '@shabalinmax/tiptap-scout'

const editor = new Editor({
  extensions: [
    StarterKit,
    Scout.configure({
      searchResultClass: 'search-highlight',
      currentResultClass: 'search-highlight-current',
      scrollIntoView: true,
      liveUpdate: true,
    }),
  ],
})

// Поиск
editor.commands.find('привет')

// Навигация между совпадениями
editor.commands.findNext()
editor.commands.findPrevious()

// Замена
editor.commands.replace('мир')
editor.commands.replaceAll('мир')

// Сброс поиска
editor.commands.clearSearch()

// Доступ к состоянию (например, для отображения "2 из 5")
const { searchTerm, results, currentIndex } = editor.storage.scout
console.log(`${currentIndex + 1} из ${results.length}`)

CSS

Расширение не включает стили. Добавьте свои:

.search-highlight {
  background-color: yellow;
}

.search-highlight-current {
  background-color: orange;
}

React

import { Scout } from '@shabalinmax/tiptap-scout'
import { useScout } from '@shabalinmax/tiptap-scout/react'

function SearchBar({ editor }) {
  const {
    results,
    currentIndex,
    totalCount,
    find,
    findNext,
    findPrevious,
    replace,
    replaceAll,
    clearSearch,
  } = useScout(editor)

  return (
    <div>
      <input onChange={(e) => find(e.target.value)} />
      <span>{totalCount > 0 ? `${currentIndex + 1} из ${totalCount}` : 'Нет результатов'}</span>
      <button onClick={findPrevious}>Назад</button>
      <button onClick={findNext}>Далее</button>
      <input id="replace" />
      <button onClick={() => replace(document.getElementById('replace').value)}>Заменить</button>
      <button onClick={() => replaceAll(document.getElementById('replace').value)}>Заменить все</button>
      <button onClick={clearSearch}>Сбросить</button>
    </div>
  )
}

React — опциональная peer-зависимость, не требуется для проектов без React.

Опции

| Опция | Тип | По умолчанию | Описание | | --- | --- | --- | --- | | searchResultClass | string | 'scout-result' | CSS-класс для всех совпадений | | currentResultClass | string | 'scout-result-current' | CSS-класс для текущего совпадения | | scrollIntoView | boolean | false | Прокрутка к текущему совпадению при навигации | | liveUpdate | boolean | false | Автоматический пересчёт поиска при изменении документа |

Команды

| Команда | Параметры | Описание | | --- | --- | --- | | find | searchTerm: string | Поиск текста (без учёта регистра) | | findNext | — | Перейти к следующему совпадению (циклически) | | findPrevious | — | Перейти к предыдущему совпадению (циклически) | | replace | replaceWith: string | Заменить текущее совпадение | | replaceAll | replaceWith: string | Заменить все совпадения (один шаг undo) | | clearSearch | — | Сброс результатов и декораций |

Storage (editor.storage.scout)

| Поле | Тип | Описание | | --- | --- | --- | | searchTerm | string | Текущий поисковый запрос | | results | SearchResult[] | Массив позиций { from, to } | | currentIndex | number | Индекс текущего совпадения (с нуля) |

Планы

  • Режимы поиска: с учётом регистра, целые слова, регулярные выражения
  • Capture groups ($1, $2) в строке замены
  • Поиск/замена внутри выделения
  • Preserve case при замене (Foo→Bar, foo→bar, FOO→BAR)

Лицензия

MIT