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

letro

v0.1.0

Published

<p align="center"> <a href="" rel="noopener"> <img width=200px height=200px src="./src/images/logoLetrus.svg" alt="Letrus logo"></a> </p>

Downloads

5

Readme


📝 Table of Contents

🧐 About

This is an own rich text editor made by letrus! The goal here is to replace the needs of external rich text libraries (such as Draft.js), and also implement it with a better API, features and maintainability.

🏁 Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites

We use Yarn as package manager and, as specified in package.json, the app requires node >= v16.14.x.

We suggest to use VSCode as the main editor, to take advantage of code completion and other useful extensions. This template is provided with a complete VSCode configuration, including recommended extensions to install in your editor.

Installing

To provisioning all the dependencies of the project, simply run

yarn

To use all the project features, don't forget to install all recommended VSCode extensions. You can see the list of recommended extensions using

{cmd|ctrl} + shift + p -> Show Recommended Extensions

which sets the @recommended filter. The extension recommendations for the project are labeled as Workspace Recommendations.

🔧 Running the tests

To start the tests suite in watching mode, run

yarn test

To get the complete coverage run

yarn test:coverage

Once the coverage is complete, you can open the results in your browser, starting from /coverage/lcov-report/index.html

🎈 Usage

To start the system with the hot reloading feature run

yarn start

and then navigate to localhost:3000

Supported Language Features

This project supports a superset of the latest JavaScript standard. In addition to ES6 syntax features, it also supports:

Exponentiation Operator (ES2016). Async/await (ES2017). Object Rest/Spread Properties (ES2018). Dynamic import (stage 4 proposal) Nullish Coalescing (stage 4 proposal) Optional Chaining

The Typescript version used is 4.1+ and supports all these features out of the box

The formatting is managed by Prettier, configured with two plugins to order imports and also format package.json file. When files are staged, Eslint runs with the fix option, also running Prettier in the while.

Absolute Imports

The project is configured with the src folder as baseUrl, so it is possible to import a file located in src/types/text.ts using:

import {TextState} from 'types/text';

📄 Paragraphs

This editor works by separating blocks of contents, know as paragraphs, a paragraphs contains a text and also markers over the text, the data structure of a paragraph is like this:

paragraphs: {
  0: {
    text: 's-senpai 😳',
    markers: [],
  },
}

as you can see, it's a dictionary which uses the paragraph id as a key.

Editing a paragraph

When trying to add a paragraph or writing over it, different browsers will perform different behaviors, to avoid that, the editor remove this behavior and add the following standard over it:

  • When a new or empty paragraph is created, the editor will put a br tag inside to ensure that the browsers will jump to the next line even if there is no content in the paragraph
  • If the paragraph already contains text, it will remove the br tag to not jump lines where it shouldn't (note: that br tags can't be used to separate lines)
  • Remove all divs and br tags (for br tags it'll remove only the ones that doesn't belong to an empty paragraph), different browsers try to use different separators, so we need to ensure that the separator is the same (currently it's a p tag)

📑 Markers

Markers can be added over a paragraph and is a way to mark part of a text inside it.

To define a marker, you need use a pointer over parts of the text, example:

paragraphs: {
  0: {
    text: 'pai tá on, chama 😎',
    markers: [
      {id: 1, start: 0, end: 3}, // mark the "pai" word
    ],
  },
}

Child Markers

There is case when a marker contains another one inside it, for an example, when you have a mark over pai ta on and another one over ta, when this happens, we can say that the second one is a child of the first one.

Overlap In Markers

A overlap between markers happens when there is a intersection between two markers, for an example, there is a marker pai ta and a marker ta on, when this happens, it means that both markers are "disputing" ta, currently the first marker (in ascending order) will always have a bigger priority over the other ones, so the second marker will mark only on, givening the the disputed word to the first marker.

Limitations

  • Currently the editor doesn't support overlap in child markers
  • If there is a overlap of more than one marker in the same part of the text, it'll not support it
  • More levels of child markers supported partially, if you try to add a child marker that also has a child marker, it should work, but weird behaviors could happen depending on how you're structuring it and if there is an overlap between markers

🚀 Deployment

Work In Progress

⛏️ Built Using