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

widget-iccandle

v0.0.42

Published

React scanner overlay for TradingView Charting Library — ICCandle pattern search, remote theming, and plugin iframe integration.

Readme

widget-iccandle

React component that wraps an existing TradingView Charting Library widget and adds ICCandle’s scanner UI: a draggable popup to run pattern search over a user-selected bar range, with theming loaded from ICCandle’s API.

Published as ESM and CommonJS; component styles are bundled and injected at runtime (no separate CSS import).

Install

npm install widget-iccandle

Peer dependencies: react and react-dom ≥ 18.

You must obtain the TradingView Charting Library under your own license and load it in your app. This package does not ship the charting library assets.

Quick start

import { useState } from "react";
import type { IChartingLibraryWidget } from "charting_library/charting_library";
import { SelectorWidget } from "widget-iccandle";

function App() {
  const [chartWidget, setChartWidget] = useState<IChartingLibraryWidget | null>(
    null,
  );
  const widgetKey = "icc_search_..."; // ICCandle-issued key (48 hex chars after prefix)

  return (
    <SelectorWidget
      chartWidget={chartWidget}
      widgetKey={widgetKey}
      theme="system"
      submitCallback={(iframeSrc) => {
        // Full URL for the ICCandle plugin iframe (open in modal, new window, etc.)
        console.log(iframeSrc);
      }}
    >
      {/* Your chart container + TradingView bootstrap; call setChartWidget when ready */}
      <div id="tv_chart_container" style={{ height: "100%" }} />
    </SelectorWidget>
  );
}

Replace the chart placeholder with your TradingView initialization and pass the IChartingLibraryWidget instance when onChartReady (or equivalent) fires.

API

Exports

| Name | Kind | Description | | -------------------- | ------ | -------------------------------------------- | | SelectorWidget | Component | Scanner overlay around your chart subtree | | SelectorWidgetProps| Type | Props for SelectorWidget |

SelectorWidget props

| Prop | Type | Required | Description | | ----------------- | --------------------------------------- | -------- | ----------- | | chartWidget | IChartingLibraryWidget \| null | Yes | Live TradingView widget instance (null until ready). | | children | ReactNode | Yes | Your chart UI (e.g. container + library bootstrap). | | widgetKey | string | Yes | ICCandle API key (icc_search_ + 48 hex chars). Used for theme fetch, candle cache, and scanner validation. | | submitCallback | (iframeSrc: string) => void | Yes | Called after a successful scan setup with the plugin iframe URL (query string includes window size, timestamps, symbol, candle_id, apiKey, theme, optional filters). | | theme | "light" \| "dark" \| "system" | No | Defaults to sensible behavior; "system" follows prefers-color-scheme. Affects resolved theme tokens and the plugin URL. |

Widget key and remote theming

On mount, the component loads branding colors from ICCandle:

  • URL: https://api.iccandle.ai/corporate-client/v1/widgetStyle/search/user/?service_type=search
  • Header: api-key: <widgetKey>

CSS custom properties (--iccandle-primary, --iccandle-border, etc.) are applied on the widget root so the scanner matches your configured light/dark tokens.

Behavior summary

  • Subscribes to chart readiness, resolution, symbol changes, and drawing events.
  • Manages a date_range multipoint drawing so the user can adjust the bar window; window size and exported candles drive the scanner.
  • Posts candles to ICCandle’s cache endpoint before opening the plugin URL (see scanner implementation for details).
  • Listens for window message events for chart/news integration and can clear persisted news mark selections (localStorage key tv:selected-news-events) when starting a scan.

Optional: timescale marks (news/events)

If your data feed implements getTimescaleMarks, you can surface stored events (e.g. from localStorage under tv:selected-news-events) as marks on the time axis. Example shape:

getTimescaleMarks: async (
  symbolInfo: LibrarySymbolInfo,
  from: number,
  to: number,
  onResult: GetMarksCallback<TimescaleMark>,
) => {
  const marks: TimescaleMark[] = [];
  try {
    const allNewsEvents = JSON.parse(
      localStorage.getItem("tv:selected-news-events") || "[]",
    ) as NewsEventType[];

    allNewsEvents?.forEach(({ id, timestamp, event_name, currency }) => {
      if (!id || !Number.isFinite(timestamp) || timestamp <= 0) return;
      if (marks.some((m) => String(m.id) === String(id))) return;

      marks.push({
        id,
        time: timestamp / 1000,
        color: "green",
        label: event_name.slice(0, 1) || "N",
        tooltip: [event_name],
        ...(currency ? { imageUrl: `/images/symbols/${currency}.svg` } : {}),
        showLabelWhenImageLoaded: true,
      });
    });
  } catch {
    /* ignore */
  }
  onResult(marks);
};

Adjust paths and types to match your app and TradingView typings.

Development (this repo)

| Script | Command | Purpose | | ------------- | ------------ | ------- | | Dev demo | npm run dev | Vite app with local charting library (see vite.config.ts). | | Library build | npm run build | Emits dist/ (JS, CJS, bundled CSS injection, declarations). | | Lint | npm run lint | ESLint. |

prepublishOnly runs build before publish.

License

MIT. TradingView Charting Library is subject to its own license from TradingView.