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

anees-mathchem-editor

v1.0.23

Published

Standalone custom math and chemistry editor using MathLive

Readme

anees-mathchem-editor

A standalone custom Math and Chemistry editor package. It provides an intuitive UI for rendering Math and Chemistry formulas using MathLive.

Installation

npm install anees-mathchem-editor
npm install anees-mathchem-editor mathlive @fortawesome/fontawesome-svg-core @fortawesome/free-solid-svg-icons @fortawesome/react-fontawesome

Usage

import React, { useState } from 'react';
import { CustomMathEditor } from 'anees-mathchem-editor';
import 'anees-mathchem-editor/dist/style.css'; // Don't forget to import the styles!

function App() {
  const [isEditorOpen, setIsEditorOpen] = useState(false);
  const [mode, setMode] = useState('math'); // 'math' or 'chem'

  const handleInsert = (latex) => {
    console.log("Inserted LaTeX:", latex);
    // Handle the inserted latex formula...
  };

  return (
    <div>
      <button onClick={() => { setMode('math'); setIsEditorOpen(true); }}>
        Open Math Editor
      </button>
      <button onClick={() => { setMode('chem'); setIsEditorOpen(true); }}>
        Open Chemistry Editor
      </button>

      <CustomMathEditor
        isOpen={isEditorOpen}
        mode={mode}
        initialValue=""
        onInsert={handleInsert}
        onClose={() => setIsEditorOpen(false)}
      />
    </div>
  );
}

export default App;

Props

  • isOpen (boolean): Controls the visibility of the editor popup.
  • mode (string): Either 'math' or 'chem'.
  • initialValue (string): Optional initial LaTeX value for the editor.
  • onInsert (function): Callback function triggered when the user clicks the insert button. Receives the latex string as an argument.
  • onClose (function): Callback function triggered when the user closes the editor.

Using in Angular

Since anees-mathchem-editor is a React component, you can use it in Angular by rendering it dynamically into an Angular element using react and react-dom.

1. Install React dependencies:

npm install react react-dom
npm install anees-mathchem-editor react react-dom mathlive @fortawesome/fontawesome-svg-core @fortawesome/free-solid-svg-icons @fortawesome/react-fontawesome

2. Create an Angular wrapper component:

import { Component, ElementRef, OnInit, OnDestroy, ViewChild, ViewEncapsulation } from '@angular/core';
import * as React from 'react';
import { createRoot } from 'react-dom/client';
import { CustomMathEditor } from 'anees-mathchem-editor';
// Import the styles in your styles.scss or component
import 'anees-mathchem-editor/dist/style.css';

@Component({
  selector: 'app-math-editor-wrapper',
  template: \`<div #editorContainer></div>\`,
  encapsulation: ViewEncapsulation.None
})
export class MathEditorWrapperComponent implements OnInit, OnDestroy {
  @ViewChild('editorContainer', { static: true }) editorContainer!: ElementRef;
  private root: any;

  ngOnInit() {
    // Create a React root
    this.root = createRoot(this.editorContainer.nativeElement);
    this.renderReactComponent();
  }

  ngOnDestroy() {
    // Clean up React tree when Angular component is destroyed
    if (this.root) {
      this.root.unmount();
    }
  }

  renderReactComponent() {
    this.root.render(
      React.createElement(CustomMathEditor, {
        isOpen: true,
        mode: 'math',
        initialValue: '',
        onInsert: (latex: string) => {
          console.log("Formula inserted:", latex);
          // Handle logic...
        },
        onClose: () => {
          console.log("Editor closed");
        }
      })
    );
  }
}

This method mounts the React component securely inside your Angular view, allowing them to coexist and pass data smoothly.