open-index/open-npm huggingface dataset:
npm package: @nichoth/atproto-repo
Description: atproto repo and MST implementation
Author: nichoth
Latest version: 0.8.13

# @atproto/repo: Repository and MST

TypeScript library for atproto repositories, and in particular the Merkle Search Tree (MST) data structure.

[![NPM](https://img.shields.io/npm/v/@atproto/repo)](https://www.npmjs.com/package/@atproto/repo)
[![Github CI Status](https://github.com/bluesky-social/atproto/actions/workflows/repo.yaml/badge.svg)](https://github.com/bluesky-social/atproto/actions/workflows/repo.yaml)

Repositories in atproto are signed key/value stores containing CBOR-encoded data records. The structure and implementation details are described in [the specification](https://atproto.com/specs/repository). This includes MST node format, serialization, structural constraints, and more.

## License

This project is dual-licensed under MIT and Apache 2.0 terms:

- MIT license ([LICENSE-MIT.txt](https://github.com/bluesky-social/atproto/blob/main/LICENSE-MIT.txt) or http://opensource.org/licenses/MIT)
- Apache License, Version 2.0, ([LICENSE-APACHE.txt](https://github.com/bluesky-social/atproto/blob/main/LICENSE-APACHE.txt) or http://www.apache.org/licenses/LICENSE-2.0)

Downstream projects and end users may chose either license individually, or both together, at their discretion. The motivation for this dual-licensing is the additional software patent assurance provided by Apache 2.0.
npm package: @nichoth/catch-links
Description: Intercept local link clicks
Author: nichoth
Latest version: 0.2.4

# catch links
[![dependencies](https://img.shields.io/badge/dependencies-zero-brightgreen.svg?style=flat-square)](package.json)
[![types](https://img.shields.io/npm/types/@nichoth/catch-links?style=flat-square)](README.md)
[![module](https://img.shields.io/badge/module-ESM%2FCJS-blue?style=flat-square)](README.md)
[![license](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE)

Like the classic [@substack module](https://www.npmjs.com/package/catch-links), but updated.

Intercept local link clicks on a page, for client-side pushState UIs.

## install
```
npm i -S @nichoth/catch-links
```

## use

### common JS
```js
const catchLinks = require('@nichoth/catch-links').default
```

### ESM
```js
import CatchLinks from '@nichoth/catch-links'
```

## example
Given this HTML,
```html
<body>
    <a id="local-link" href="/foo">local</a>
    <a href="https://www.npmjs.com/" id="remote-link">remote</a>
</body>
```

Use this JS:
```js
import CatchLinks from '@nichoth/catch-links'

// given a click on `#local-link`
CatchLinks(document.body, function onLinkClick (href) {
    // this will not be called on click to #remote-link

    console.log('href', href)
    // => '/foo'
})
```
npm package: @nichoth/common
Description: Shared web-platform-friendly code for atproto libraries
Latest version: 0.4.12

# @atproto/common

Shared TypeScript code for other `@atproto/*` packages. This package is oriented towards writing servers, and is not designed to be browser-compatible.

[![NPM](https://img.shields.io/npm/v/@atproto/common)](https://www.npmjs.com/package/@atproto/common)
[![Github CI Status](https://github.com/bluesky-social/atproto/actions/workflows/repo.yaml/badge.svg)](https://github.com/bluesky-social/atproto/actions/workflows/repo.yaml)

## License

This project is dual-licensed under MIT and Apache 2.0 terms:

- MIT license ([LICENSE-MIT.txt](https://github.com/bluesky-social/atproto/blob/main/LICENSE-MIT.txt) or http://opensource.org/licenses/MIT)
- Apache License, Version 2.0, ([LICENSE-APACHE.txt](https://github.com/bluesky-social/atproto/blob/main/LICENSE-APACHE.txt) or http://www.apache.org/licenses/LICENSE-2.0)

Downstream projects and end users may chose either license individually, or both together, at their discretion. The motivation for this dual-licensing is the additional software patent assurance provided by Apache 2.0.
npm package: @nichoth/copy-button
Description: Copy button made with web components
Author: nichoth
Latest version: 0.0.7

# copy button
![tests](https://github.com/nichoth/copy-button/actions/workflows/nodejs.yml/badge.svg)
[![module](https://img.shields.io/badge/module-ESM-blue?style=flat-square)](README.md)
[![semantic versioning](https://img.shields.io/badge/semver-2.0.0-blue?logo=semver&style=flat-square)](https://semver.org/)
[![license](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE)

A button to copy some text to the system clipboard, made with webcomponents.

## install
```sh
npm i -S @nichoth/copy-button
```

## use

## globals
This looks at a css variable `--success-color`, which is used to color the checkmark that is displayed after you copy something.

### index.js
Import this file. It depends on [tonic](https://github.com/nichoth/tonic) and [clipboard-copy](https://github.com/feross/clipboard-copy), so you will need to provide them somehow, either through a bundler or `importmap`.

```js
import { CopyButton } from '@nichoth/copy-button'
```

### index.bundle.js
Import this file, including all its dependencies.

```js
import { CopyButton } from '@nichoth/copy-button/bundle'
```

### index.min.js
Use a minified version of this file. It includes all dependencies.

```js
import { CopyButton } from '@nichoth/copy-button/min'
```

## example
Include the CSS.

```js
import { CopyButton } from '@nichoth/copy-button'
import '@nichoth/copy-button/style.css'

document.body.innerHTML = `
  <${copy-button} payload="example text">
  </${copy-button}>
`
```

Create a button like this

![screenshot of the button, pre-click](image.png)

-------

![screenshot of the button, post-click](image-1.png)
npm package: @nichoth/dom
Description: Helpers for working with the DOM
Author: nichoth
Latest version: 0.0.20

# dom
![tests](https://github.com/nichoth/dom/actions/workflows/nodejs.yml/badge.svg)
[![Socket Badge](https://socket.dev/api/badge/npm/package/@nichoth/dom)](https://socket.dev/npm/package/@nichoth/dom)
[![types](https://img.shields.io/npm/types/@nichoth/dom)](README.md)
[![module](https://img.shields.io/badge/module-ESM%2FCJS-blue)](README.md)
[![license](https://img.shields.io/badge/license-MIT-brightgreen)](LICENSE)

Helpers for working with the DOM, useful for tests.

## install
```sh
npm i -D @nichoth/dom
```

## use

### import
```js
import { dom } from '@nichoth/dom'

// or import individual functions
import { waitFor } from '@nichoth/dom'
```

### require
```js
const dom = require('@nichoth/dom').dom
```

## API

### convenient shortcuts

__`dom.qs`__ points to `document.querySelector`

__`dom.qsa`__ is equal to `document.querySelectorAll`

-------

### dom.waitFor
Look for a DOM element by slector. Default timeout is 5 seconds. Throws if the element is not found.

```ts
function waitFor (args:{
    selector?:string,
    visible?:boolean,
    timeout?:number
}|string, lambda?:() => Element|null):Promise<Element>
```

#### example
```js
import { waitFor } from '@nichoth/dom'

const foundElement = await waitFor({
    selector: 'p'
})

// or pass in a string to use as a query selector
const el = await waitFor('#my-element')
```

### dom.waitForText
Look for an element containing the given text, or that matches a given regex. Return the element if found. Default timeout is 5 seconds. Throws if the element is not found.

```ts
function waitForText (args:{
    text?:string,
    timeout?:number,
    element:Element,
    multipleTags?:boolean,
    regex?:RegExp
}):Promise<Element>
```

#### example
```js
import { waitForText } from '@nichoth/dom'

const el = await waitForText({
    element: document.body,
    regex: /bar/
})
```

Pass in a parent element and timeout.
```js
const found = await waitForText({
    element: dom.qs('#test-two'),
    multipleTags: true,
    text: 'bbb',
    timeout: 10000  // 10 seconds
})
```

### click
Dispatch a click event from the given element.

```js
import { dom } from '@nichoth/dom'
// or import { click } from '@nichoth/dom'

dom.click(dom.qs('#my-element'))
```

### event
Dispatch an event from an element.

```ts
function event (args:{
    event:string|Event;
    element?:HTMLElement|Element|typeof window
}):void
```

#### event example
```js
import { dom } from '@nichoth/dom'

dom.event({ event: 'hello', element: dom.qs('#example') })
```

### sleep
Wait for the given milliseconds.

```ts
async function sleep (ms:number):Promise<void>
```

#### sleep example
```js
import { sleep } from '@nichoth/dom'

await sleep(3000)  // wait 3 seconds
```

## credits

Thanks Jake Verbaten for writing this originally.
npm package: @nichoth/dom-utils
Description: Helpers for working with the DOM in tests
Author: nichoth
Latest version: 0.0.3

# dom utils
![tests](https://github.com/nichoth/dom-utils/actions/workflows/nodejs.yml/badge.svg)
[![Socket Badge](https://socket.dev/api/badge/npm/package/@nichoth/dom-utils)](https://socket.dev/npm/package/@nichoth/dom-utils)
[![module](https://img.shields.io/badge/module-ESM-blue)](README.md)
[![types](https://img.shields.io/npm/types/@nichoth/dom-utils)](README.md)
[![license](https://img.shields.io/badge/license-MIT-brightgreen)](LICENSE)

## install
```sh
npm i -D @nichoth/dom-utils
```

## examples
Use this in tests to help with DOM manipulation.

### waitFor
Wait for an element that matches a given selector. Default timeout is 5 seconds.

```ts
export function waitFor (args:{
    selector?:string,
    visible?:boolean,
    timeout?:number
}, lambda?:()=>Element|null): Promise<Element|HTMLElement|void>
```

```js
import { test } from '@nichoth/tapzero'
import * as dom from '@nichoth/dom-utils'

test('dom.waitFor', async t => {
    const el = await dom.waitFor({
        selector: '#foo'
    })

    t.equal(el!.textContent, 'bar', 'should find the element')
})
```

### waitForText
Search for some text content. Default timeout is 5 seconds.

```ts
export function waitForText (args:{
    timeout?:number,
    element?:Element,
    text?:string,
    regex?:RegExp,
    multipleTags?:boolean
}): Promise<Element|HTMLElement|void>
```

```js
import { test } from '@nichoth/tapzero'
import * as dom from '@nichoth/dom-utils'

test('dom.waitForText', async t => {
    // use the element we created previously
    const el = await dom.waitForText({
        element: document.body,
        regex: /bar/
    })

    t.ok(el, 'should find by text content')
})
```
npm package: @nichoth/example-webcomponent
Description: ![tests](https://github.com/nichoth/modal/actions/workflows/nodejs.yml/badge.svg) [![types](https://img.shields.io/npm/types/@nichoth/modal?style=flat-square)](README.md) [![module](https://img.shields.io/badge/module-ESM%2FCJS-blue?style=flat-square)](RE
Author: nichoth
Latest version: 0.0.0

# modal
![tests](https://github.com/nichoth/modal/actions/workflows/nodejs.yml/badge.svg)
[![types](https://img.shields.io/npm/types/@nichoth/modal?style=flat-square)](README.md)
[![module](https://img.shields.io/badge/module-ESM%2FCJS-blue?style=flat-square)](README.md)
[![semantic versioning](https://img.shields.io/badge/semver-2.0.0-blue?logo=semver&style=flat-square)](https://semver.org/)
[![license](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE)

Modal dialog window

See [smashingmagazine.com article](https://www.smashingmagazine.com/2022/04/cta-modal-build-web-component/) and [nathansmith/cta-modal](https://github.com/nathansmith/cta-modal/tree/main).

## install

```sh
npm i -S @nichoth/modal
```

## use

### bundler

Just import; this calls the global function `window.customElements.define`.

```js
import '@nichoth/modal'
```

Then use the tag in HTML:

```html
<modal-window>
    <div slot="button">
        <p>
            <button class="cta-modal-toggle" type="button">
                Open modal
            </button>
        </p>
    </div>

    <div slot="modal">modal content?</div>
    <div slot="modal">more modal content</div>
</modal-window>
```

### HTML only

First copy the file to a location accessible to your web server.

```sh
cp ./node_modules/@nichoth/modal/dist/index.min.js ./public/modal.js
```

Then link to the file in HTML
```html
<body>
    <p>...content...</p>
    <script type="module" src="./index.ts"></script>
</body>
```

## API

### attributes

See [nathansmith/cta-modal](https://github.com/nathansmith/cta-modal/tree/main?tab=readme-ov-file#how-to-use-extras)

#### Plus

##### closable

Take an attribute `closable`. If you pass in `closable="false"`, then it will
render without a 'close' button, and escape key and clicks will not close the
modal. You would need to open/close it via your application state.

```html
<modal-window closable="false">
    <div slot="button">
        <p>
            <button
            class="cta-modal-toggle"
            type="button"
            >Open modal two</button>
        </p>
    </div>
    <div slot="modal">modal content?</div>
    <div slot="modal">more modal content</div>
</modal-window>
```

## example

[See `./example`](./example/).

## credits

Thanks [@nathansmith](https://github.com/nathansmith) and [Smashing Magazine](https://www.smashingmagazine.com/2022/04/cta-modal-build-web-component/) for publishing this originally.
npm package: @nichoth/image-crop-element
Description: Select area for cropping an image. This does not actually crop.
Latest version: 5.0.5

# &lt;image-crop-element&gt;

This loads an image and creates a crop area that user can modify. An event is fired with x, y, width, and height as the crop area changes.

## Installation

```sh
npm i --S @nichoth/image-crop-element
```

## fork

This is a fork of [@github/image-crop-element](https://github.com/github/image-crop-element).

### aspect ratio
You can pass in an aspect ratio attribute:

```html
<image-crop
    aspectratio="4 / 5"
    src="100.jpg"
></image-crop>
```

This will constrain the image crop border to the given ratio.

## Usage

### Plain

```html
<image-crop src="/avatar.jpg"></image-crop>
```

### Rounded crop area

```html
<image-crop src="/avatar.jpg" rounded></image-crop>
```

### With loading state

```html
<image-crop src="/avatar.jpg">
  <img src="spinner.gif" alt="" data-loading-slot />
</image-crop>
```

### With autoupdate inputs

```html
<image-crop src="/avatar.jpg">
  <input type="hidden" data-image-crop-input="x" name="x">
  <input type="hidden" data-image-crop-input="y" name="y">
  <input type="hidden" data-image-crop-input="width" name="width">
  <input type="hidden" data-image-crop-input="height" name="height">
</image-crop>
```

### Listen to the change event

```javascript
document.addEventListener('image-crop-change', function (event){
  console.log(
    'Crop area changed.',
    event.detail.x,
    event.detail.y,
    event.detail.width,
    event.detail.height
  )
})
```

## CSS encapsulation
The elements HTML structure is initialized in a [Shadow DOM](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_shadow_DOM), so it is impossible to apply CSS to it. If you need to change the element's default style for any reason, you should open up a new issue (or a pull request!), describing your use case, and we'll work with you on solving the problem.

## Browser support

Browsers without native [custom element support][support] require a [polyfill][]. Legacy browsers require various other polyfills. See [`examples/index.html`][example] for details.

[example]: https://github.com/github/image-crop-element/blob/57080ad88d26e05b42fa10a95470da8035f53967/examples/polyfill.html#L17-L22

- Chrome
- Firefox
- Safari
- Microsoft Edge

[support]: https://caniuse.com/#feat=custom-elementsv1
[polyfill]: https://github.com/webcomponents/custom-elements
npm package: @nichoth/kysely-d1
Description: Kysely dialect for Cloudflare D1
Author: Aiden
Latest version: 0.4.7

# kysely-d1

[![ci](https://github.com/aidenwallis/kysely-d1/actions/workflows/ci.yaml/badge.svg)](https://github.com/aidenwallis/kysely-d1/actions/workflows/ci.yaml)
[![npm](https://img.shields.io/npm/v/kysely-d1.svg)](https://www.npmjs.com/package/kysely-d1)

[Kysely](https://github.com/koskimas/kysely) adapter for
[Cloudflare D1](https://developers.cloudflare.com/d1/).

```sh
npm i -S @nichoth/kysely-d1
```

<details><summary><h2>Contents</h2></summary>

<!-- toc -->

- [Fork](#fork)
- [Usage](#usage)

<!-- tocstop -->

</details>

## Fork

This is a fork of [aidenwallis/kysely-d1](https://github.com/aidenwallis/kysely-d1).

-------

This project was largely adapted from [kysely-planetscale](https://github.com/depot/kysely-planetscale).

## Usage

Pass your D1 binding into the dialect in order to configure the Kysely client. Follow [these docs](https://developers.cloudflare.com/d1/get-started/#4-bind-your-worker-to-your-d1-database) for instructions on how to do so.

```typescript
import { Kysely } from 'kysely';
import { D1Dialect } from 'kysely-d1';

export interface Env {
  DB: D1Database;
}

interface KvTable {
  key: string;
  value: string;
}

interface Database {
  kv: KvTable;
}

export default {
  async fetch(request: Request, env: Env): Promise<Response> {
    const { searchParams } = new URL(request.url);
    const key = searchParams.get('key');
    if (!key) {
      return new Response('No key defined.', { status: 400 });
    }

    // Create Kysely instance with kysely-d1
    const db = new Kysely<Database>({ dialect: new D1Dialect({ database: env.DB }) });
    
    // Read row from D1 table
    const result = await db.selectFrom('kv').selectAll().where('key', '=', key).executeTakeFirst();
    if (!result) {
      return new Response('No value found', { status: 404 });
    }

    return new Response(result.value);
  },
};
```

There is a working [example](example) also included, which implements a K/V style store using D1.
npm package: @nichoth/modal
Description: ![tests](https://github.com/nichoth/modal/actions/workflows/nodejs.yml/badge.svg) [![types](https://img.shields.io/npm/types/@nichoth/modal?style=flat-square)](README.md) [![module](https://img.shields.io/badge/module-ESM%2FCJS-blue?style=flat-square)](RE
Author: nichoth
Latest version: 0.0.2

# modal
![tests](https://github.com/nichoth/modal/actions/workflows/nodejs.yml/badge.svg)
[![types](https://img.shields.io/npm/types/@nichoth/modal?style=flat-square)](README.md)
[![module](https://img.shields.io/badge/module-ESM%2FCJS-blue?style=flat-square)](README.md)
[![semantic versioning](https://img.shields.io/badge/semver-2.0.0-blue?logo=semver&style=flat-square)](https://semver.org/)
[![dependencies](https://img.shields.io/badge/dependencies-zero-brightgreen.svg?style=flat-square)](package.json)
[![license](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE)

Modal dialog window

See [smashingmagazine.com article](https://www.smashingmagazine.com/2022/04/cta-modal-build-web-component/) and [nathansmith/cta-modal](https://github.com/nathansmith/cta-modal/tree/main).

## install

```sh
npm i -S @nichoth/modal
```

## use

### bundler

Just import; this calls the global function `window.customElements.define`.

```js
import '@nichoth/modal'
```

Then use the tag in HTML:

```html
<modal-window>
    <div slot="button">
        <p>
            <button class="cta-modal-toggle" type="button">
                Open modal
            </button>
        </p>
    </div>

    <div slot="modal">modal content?</div>
    <div slot="modal">more modal content</div>
</modal-window>
```

### HTML only

First copy the file to a location accessible to your web server.

```sh
cp ./node_modules/@nichoth/modal/dist/index.min.js ./public/modal.js
```

Then link to the file in HTML
```html
<body>
    <p>...content...</p>
    <script type="module" src="/modal.js"></script>
</body>
```

## API

### attributes

See [nathansmith/cta-modal](https://github.com/nathansmith/cta-modal/tree/main?tab=readme-ov-file#how-to-use-extras)

#### Plus

##### closable

Take an attribute `closable`. If you pass in `closable="false"`, then it will
render without a 'close' button, and escape key and clicks will not close the
modal. You would need to open/close it via your application state.

```html
<modal-window closable="false">
    <div slot="button">
        <p>
            <button
            class="cta-modal-toggle"
            type="button"
            >Open modal two</button>
        </p>
    </div>
    <div slot="modal">modal content?</div>
    <div slot="modal">more modal content</div>
</modal-window>
```

## example

[See `./example`](./example/).

## credits

Thanks [@nathansmith](https://github.com/nathansmith) and [Smashing Magazine](https://www.smashingmagazine.com/2022/04/cta-modal-build-web-component/) for publishing this originally.
npm package: @nichoth/modern-normalize
Description: Normalize browsers' default style
Author: Sindre Sorhus
Latest version: 1.1.0

<div align="center">
	<img src="media/logo.svg" alt="modern-normalize">
	<br>
	<br>
	<div align="center">
		<p>
			<p>
				<sup>
					<a href="https://github.com/sponsors/sindresorhus">My open source work is supported by the community</a>
				</sup>
			</p>
			<sup>Special thanks to:</sup>
			<br>
			<br>
			<a href="https://standardresume.co/tech">
				<img src="https://sindresorhus.com/assets/thanks/standard-resume-logo.svg" width="200"/>
			</a>
		</p>
	</div>
	<br>
	<br>
	<br>
	<br>
</div>

## Differences from [`normalize.css`](https://github.com/necolas/normalize.css)

- Smaller
- Includes only normalizations for the latest Chrome, Firefox, and Safari
- [Sets `box-sizing: border-box`](https://www.paulirish.com/2012/box-sizing-border-box-ftw/)
- [Improves consistency of default fonts](https://github.com/sindresorhus/modern-normalize/issues/3)
- [Sets a more readable tab size](https://github.com/sindresorhus/modern-normalize/issues/17)
- Fully tested

All credit should go to `normalize.css`. I just removed some cruft and added some improvements. If you have questions about the source, check out the [original source](https://github.com/necolas/normalize.css/blame/master/normalize.css) and [this](https://github.com/necolas/normalize.css#extended-details-and-known-issues) for details.

[**The goal of this project is to make itself obsolete.**](https://github.com/sindresorhus/modern-normalize/issues/2)

## Browser support

- Latest Chrome
- Latest Firefox
- Latest Safari

## Install

```
$ npm install modern-normalize
```

###### Download

- [Normal](https://cdn.jsdelivr.net/npm/modern-normalize/modern-normalize.css)
- [Minified](https://cdn.jsdelivr.net/npm/modern-normalize/modern-normalize.min.css)

###### CDN

- [jsdelivr](https://www.jsdelivr.com/package/npm/modern-normalize)
- [unpkg](https://unpkg.com/modern-normalize)
- [cdnjs](https://cdnjs.com/libraries/modern-normalize)

## Usage

```css
@import 'node_modules/modern-normalize/modern-normalize.css';
```

or

```html
<link rel="stylesheet" href="node_modules/modern-normalize/modern-normalize.css">
```

## FAQ

### Can you provide Sass, Less, etc, ports?

There's absolutely no reason to have separate ports for these. They are just CSS supersets and can import CSS directly.

## Related

- [sass-extras](https://github.com/sindresorhus/sass-extras) - Useful utilities for working with Sass
npm package: @nichoth/nanoid-dictionary
Description: Predefined character sets to use with nanoid
Author: Stanislav Lashmanov
Latest version: 5.0.7

# nanoid-dictionary
Predefined character sets to use with [nanoid](https://github.com/ai/nanoid). Used by [nanoid-generate](https://github.com/CyberAP/nanoid-generate).

[![npm](https://img.shields.io/npm/v/nanoid-dictionary)](https://www.npmjs.com/package/nanoid-dictionary)

A fork of [CyberAP/nanoid-dictionary](https://github.com/CyberAP/nanoid-dictionary).


## Install
Install nanoid and dictionary

`npm i @nichoth/nanoid @nichoth/nanoid-dictionary`

## Usage

Require a `customAlphabet` from `nanoid` and pass a string from the dictionary:

```js
import { customAlphabet } from '@nichoth/nanoid';
import { lowercase } from '@nichoth/nanoid-dictionary';

const lowercaseRandomString = customAlphabet(lowercase, 10);
```


## Character sets

### `numbers`

Numbers from 0 to 9

```javascript
import { numbers } from '@nichoth/nanoid-dictionary';
```

### `hexadecimalLowercase`

Lowercase English hexadecimal lowercase characters: `0123456789abcdef`

```javascript
import { hexadecimalLowercase } from '@nichoth/nanoid-dictionary';
```

### `hexadecimalUppercase`

Lowercase English hexadecimal uppercase characters: `0123456789ABCDEF`

```javascript
import { hexadecimalUppercase } from '@nichoth/nanoid-dictionary';
```

### `lowercase`

Lowercase English letters: `abcdefghijklmnopqrstuvwxyz`

```javascript
import { lowercase } from '@nichoth/nanoid-dictionary';
```

### `uppercase`

Uppercase English letters: `ABCDEFGHIJKLMNOPQRSTUVWXYZ`

```javascript
import { uppercase } from '@nichoth/nanoid-dictionary';
```

### `alphanumeric`

Combination of all the lowercase, uppercase characters and numbers from 0 to 9

Does not include any symbols or special characters

```javascript
import { alphanumeric } from '@nichoth/nanoid-dictionary';
```

### `nolookalikes`

Numbers and english alphabet without lookalikes: `1`, `l`, `I`, `0`, `O`, `o`, `u`, `v`, `5`, `S`, `s`, `2`, `Z`.

Complete set: `346789ABCDEFGHJKLMNPQRTUVWXYabcdefghijkmnpqrtwxyz`

```javascript
import { nolookalikes } from '@nichoth/nanoid-dictionary';
```

### `nolookalikesSafe`

Same as `nolookalikes` but with removed vowels and following letters: `3`, `4`, `x`, `X`, `V`.

This list should protect you from accidentally getting obscene words in generated strings.

Complete set: `6789BCDFGHJKLMNPQRTWbcdfghjkmnpqrtwz`

```javascript
import { nolookalikesSafe } from '@nichoth/nanoid-dictionary';
```
npm package: @nichoth/pull-files
Description: Read and write directories of files with pull-stream
Author: nichoth
Latest version: 0.0.1

# pull-files

--------------------------
I don't know what I'm doing. This fork fixes something in ssb for me
----------------------------

> Read and write directories of files with pull-stream

```js
var pull = require('pull-stream')
var { read, write } = require('pull-files')

pull(
  // Read js files out of `node_modules`
  read('node_modules/**/*.js'),

  // Compile files' contents
  pull.through(file => {
    file.data = compile(file.data)
  }),

  // Write them to `out` directory
  write('out', err => {
    console.log('finished')
  })
)
```

The file objects are a minimal take on [`Vinyl`](https://github.com/gulpjs/vinyl) containing only properties that are necessary:

```
{ base: '/home/jamen/jamen/pull-files/test',
  path: 'bar/pluto.txt',
  data: <Buffer 68 65 6c 6c 6f 20 69 20 61 6d 20 70 6c 75 74 6f 0a> }
```

This lets you create them without any dependencies, and you may also add custom properties not concerned with this module

## Installation

```shell
npm install --save pull-files
```

## Usage

### `read(glob, options?)`

Read files from a glob or path (or arrays of either) using [`micromatch`](https://github.com/micromatch/micromatch) patterns.  Supply `cwd` if your paths are relative and will change depending on where you execute `node` (most likely want `__dirname`)

Options can contain:

 - `cwd`: Used to resolve relative paths (commonly set as `__dirname`)
 - `stream`: Enable stream mode, where `file.data` is a source stream

```js
pull(
  // Read js files from node_modules, excluding pull-files directory
  read([ 'node_modules/**/*.js', '!node_modules/pull-files' ], { cwd: __dirname }),
  drain(file => console.log(file))
)
```

### `write(dest, done?)`

Write files to `dest` and calls `done(err?)` when finished

```js
pull(
  values([
    { path: 'earth.js', data: 'hello earth' },
    { path: 'mars.js', data: 'hello mars' },
    { path: 'pluto.js', data: 'hello pluto' },
  ]),

  write('example', err => {
    // wrote all 3 files to `example/...`
  })
)
```

Here you can see that files don't have to be created from `read` either, but can be from anywhere.  Nor do you have to provide `base` for unglobbed files.

### `{ base, path, data }`

These Represent files, where:

 - `base` is an optional property present if `path` is relative.  It allows you to retain directory structure and move the base (e.g. to an `out/` folder if you're compiling)
 - `path`: The path of the data.  Either absolute or relative.  If absolute, `base` will be `null`.
 - `data`: A buffer or stream of the file's data.

For a simple way to get a file's full path, regardless of relativity, do:

```js
var full = base ? join(base, path) : path
```

---

_Maintained by [Jamen Marz](https://git.io/jamen) (See on [Twitter](https://twitter.com/jamenmarz) and [GitHub](https://github.com/jamen) for questions & updates)_
npm package: @nichoth/replicache-supabase
Description: Use replicache with supabase
Author: nichoth
Latest version: 0.0.9

# replicache supabase
![tests](https://github.com/nichoth/replicache-supabase/actions/workflows/nodejs.yml/badge.svg)
[![Socket Badge](https://socket.dev/api/badge/npm/package/@nichoth/replicache-supabase)](https://socket.dev/npm/package/@nichoth/replicache-supabase)
[![types](https://img.shields.io/npm/types/@nichoth/replicache-supabase)](README.md)
[![module](https://img.shields.io/badge/module-ESM-blue)](README.md)
[![license](https://img.shields.io/badge/license-MIT-brightgreen)](LICENSE)

Use [replicache](https://replicache.dev/) with [supabase](https://supabase.com/).

This is some glue code for [replicache](https://replicache.dev/) and [supabase](https://supabase.com/). Use it in your lambda functions.

This is using the [global version strategy](https://doc.replicache.dev/strategies/global-version).

## install
```sh
npm i -S @nichoth/replicache-supabase
```

## globals

### env vars
We need several environment variables for the DB:

```sh
SUPABASE_ANON_KEY="eyJhbGc..."
SUPABASE_DATABASE_PASSWORD="123abc"
SUPABASE_URL="https://my-url.supabase.co"
```

## example

### push
Use this in a lambda function.

```js
// netlify/functions/replicache-push/replicache-push.ts
import 'dotenv/config'
import { Handler, HandlerEvent } from '@netlify/functions'
import { processPush, PushRequestSchema } from '@nichoth/replicache-supabase/push'
// mutators are specific to your application
import { Mutators } from '../../../example/mutators.js'

export const handler:Handler = async function (ev:HandlerEvent) {
    if (!ev.body) return { statusCode: 400 }

    const userID = (ev.headers.cookie && ev.headers.cookie['userID']) || 'anon'
    const body = JSON.parse(ev.body)
    const push = PushRequestSchema.parse(body)

    try {
        await processPush(push, userID, Mutators())
    } catch (err) {
        return { statusCode: 500 }
    }

    return { statusCode: 200, body: 'OK' }
}
```

### pull
Use this in a lambda function.

```js
// netlify/functions/replicache-pull/replicache-pull.ts
import { Handler, HandlerEvent } from '@netlify/functions'
import {
    authError,
    processPull,
    PullRequestSchema
} from '@nichoth/replicache-supabase/pull'

export const handler:Handler = async function (ev:HandlerEvent) {
    if (!ev.body) return { statusCode: 400 }
    const userID = (ev.headers.cookie && ev.headers.cookie['userID']) || 'anon'
    const body = JSON.parse(ev.body)

    const pullRequest = PullRequestSchema.parse(body)

    try {
        const pullResponse = await processPull(pullRequest, userID)
        return { statusCode: 200, body: JSON.stringify(pullResponse) }
    } catch (err) {
        if (err === authError) {
            return { statusCode: 401, body: 'Unauthorized' }
        } else {
            return {
                statusCode: 500,
                body: 'Error processing pull: ' + err.toString()
            }
        }
    }
}
```

## test

Run the test like this
```sh
npx esbuild test/index.ts --format=cjs --platform=node --bundle | node
```
npm package: @nichoth/repo
Description: atproto repo and MST implementation
Latest version: 0.8.11

# @atproto/repo: Repository and MST

TypeScript library for atproto repositories, and in particular the Merkle Search Tree (MST) data structure.

[![NPM](https://img.shields.io/npm/v/@atproto/repo)](https://www.npmjs.com/package/@atproto/repo)
[![Github CI Status](https://github.com/bluesky-social/atproto/actions/workflows/repo.yaml/badge.svg)](https://github.com/bluesky-social/atproto/actions/workflows/repo.yaml)

Repositories in atproto are signed key/value stores containing CBOR-encoded data records. The structure and implementation details are described in [the specification](https://atproto.com/specs/repository). This includes MST node format, serialization, structural constraints, and more.

## License

This project is dual-licensed under MIT and Apache 2.0 terms:

- MIT license ([LICENSE-MIT.txt](https://github.com/bluesky-social/atproto/blob/main/LICENSE-MIT.txt) or http://opensource.org/licenses/MIT)
- Apache License, Version 2.0, ([LICENSE-APACHE.txt](https://github.com/bluesky-social/atproto/blob/main/LICENSE-APACHE.txt) or http://www.apache.org/licenses/LICENSE-2.0)

Downstream projects and end users may chose either license individually, or both together, at their discretion. The motivation for this dual-licensing is the additional software patent assurance provided by Apache 2.0.
npm package: @nichoth/routes
Description: Route matcher devised for shared rendering JavaScript applications
Author: nichoth
Latest version: 4.0.7

# routes
![tests](https://github.com/nichoth/routes/actions/workflows/nodejs.yml/badge.svg)
[![dependencies](https://img.shields.io/badge/dependencies-zero-brightgreen.svg?style=flat-square)](package.json)
[![types](https://img.shields.io/npm/types/msgpackr?style=flat-square)](README.md)
[![module](https://img.shields.io/badge/module-ESM%2FCJS-blue?style=flat-square)](README.md)
[![semantic versioning](https://img.shields.io/badge/semver-2.0.0-brightgreen?logo=semver&style=flat-square)](https://semver.org/)
[![license](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE)

Route matcher devised for shared rendering JavaScript applications

## install
```sh
npm install -S @nichoth/routes
```

## ESM vs CJS
Featuring ESM or CJS versions via `package.json` `exports` field.

```js
// esm
import Router from '@nichoth/routes'
```

```js
// cjs
const Router = require('@nichoth/routes').default
```

## example
Get a router instance

```js
import Router from '@nichoth/routes'
var router = new Router()
```

### Add some routes
```js
router.addRoute('/articles', getArticles);
router.addRoute('/articles/:slug', getArticleBySlug);
router.addRoute('/articles/search/*', searchForArticles);

// can also chain the method calls
router
    .addRoute('/foo', () => {/* ... */})
    .addRoute('/bar', () => {/* ... */})
```

### Find a match

```js
const match = router.match('/articles');
// => RouteMatch
```

#### The match object
```ts
interface RouteMatch {
    params:Record<string, string>;  // <-- e.g. { slug: 'article-title' }
    splats:string[];
    route:string;
    next?:((...any)=>any)|null;
    action?:(...any)=>any;
    index?:number;
}
```

You'll get `null` back if no route matches the provided URL. Otherwise, the
route match will provide all the useful information you need inside an object.

Key               | Description
------------------|---------------------------------------------------------------------------------------
`action`          | The action passed to `addRoute` as a second argument. Using a function is recommended
`next`            | Fall through to the next route, or `null` if no other routes match
`route`           | The route passed to `addRoute` as the first argument
`params`          | An object containing the values for named parameters in the route
`splats`          | An object filled with the values for wildcard parameters

## License

MIT

## fork
This is a fork of [ruta3](https://www.npmjs.com/package/ruta3), just adding types.
npm package: @nichoth/script-demo
Description: testing
Author: nichoth
Latest version: 0.0.5

# template ts browser

A template for typescript *dependency* modules that run in a browser environment.
Uses `tape-run` for tests in a browser. See [template-ts](https://github.com/nichoth/template-ts) for the same thing but targeting Node.

## use
1. Use the template button in github. Or clone this then
`rm -rf .git && git init`. Then `npm i && npm init`.

2. Edit the source code in `src/index.ts`.

3. Delete either `.github/workflows/gh-pages-docs.yml` or `.github/workflows/gh-pages.yml`, depending on whether you want to deploy an example or docs to github pages.

4. __Edit things__
    * Use `./README.example.md` as a starter for docs:
    ```sh
    cp ./README.example.md ./README.md
    ```
    * edit the [build-example](https://github.com/nichoth/template-web-component/blob/c580636f1c912fe2633f7c2478f28b11729c9b80/package.json#L20) command in `package.json` so that it has the right
    namespace for github pages

## featuring

* compile the source to both ESM and CJS format, and put compiled files in `dist`.
* ignore `dist` and `*.js` in git, but don't ignore them in npm. That way we
  don't commit any compiled code to git, but it is available to consumers.
* use npm's `prepublishOnly` hook to compile the code before publishing to npm.
* use [exports](./package.json#L41) field in `package.json` to make sure the right format is used
  by consumers.
* `preversion` npm hook -- lint
* `postversion` npm hook -- `git push --follow-tags && npm publish`
* eslint -- `npm run lint`
* tests run in a browser environment via `tape-run` -- see [`npm test`](./package.json#L12).
  Includes `tap` testing tools -- [tapzero](https://github.com/bicycle-codes/tapzero)
  and [tap-spec](https://www.npmjs.com/package/tap-spec)
* CI via github actions
npm package: @nichoth/sleep
Description: Wait for some given milliseconds
Author: nichoth
Latest version: 0.0.0

# sleep
![tests](https://github.com/nichoth/sleep/actions/workflows/nodejs.yml/badge.svg)
[![dependencies](https://img.shields.io/badge/dependencies-zero-brightgreen.svg?style=flat-square)](package.json)
[![types](https://img.shields.io/npm/types/@nichoth/sleep?style=flat-square)](README.md)
[![module](https://img.shields.io/badge/module-ESM%2FCJS-blue?style=flat-square)](README.md)
[![license](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE)

Wait for a given number of milliseconds, with promises.

## install
```sh
npm i -S @nichoth/sleep
```

## example
```js
import { sleep } from '@nichoth/sleep'
await sleep(1000)  // wait 1 second
```
npm package: @nichoth/tap-ssc
Description: Run tests in a browser environment from the command line
Author: nichoth
Latest version: 0.6.8

# tap ssc
![tests](https://github.com/nichoth/tap-ssc/actions/workflows/nodejs.yml/badge.svg)
[![Socket Badge](https://socket.dev/api/badge/npm/package/@nichoth/tap-ssc)](https://socket.dev/npm/package/@nichoth/tap-ssc)
[![semantic versioning](https://img.shields.io/badge/semver-2.0.0-blue?logo=semver&style=flat-square)](https://semver.org/)
[![license](https://img.shields.io/badge/license-MIT-brightgreen)](LICENSE)


Run tests in a browser environment from the command line.

The interface is inspired by [tape-run](https://www.npmjs.com/package/tape-run). Just pipe some JS into the `tap-ssc` command, and your tests will run in a browser environment.

Instead of [electron](https://www.electronjs.org/), a dependency of `tape-run`, this uses [@socketsupply/socket](https://socketsupply.co/) to create a browser-like environment.

## install
```sh
npm i -D @nichoth/tap-ssc
```

## use
Bundle your client side JS, then pipe it into this tool, which is installed as the `tap-ssc` command.

Your tests will be running in a browser environment, but all tap output will go to the terminal.

Use it as a part of `package.json` scripts:
```js
"scripts": {
    "test": "esbuild --bundle test/index.js | tap-ssc"
},
```

Or on the command line:
```sh
npx esbuild --bundle test/index.js | npx tap-ssc
```

## example
```js
// example/test/index.js
import { test } from '@nichoth/tapzero'

test('browser environment', t => {
    t.ok(window, 'window should exist')
})
```

Then in the terminal:
```sh
npx esbuild --bundle test/index.js | npx tap-ssc
```

see [this example](https://github.com/nichoth/tap-ssc/blob/main/example/package.json#L2)

### pass in your own html file
> [!NOTE]  
> This is in progress.

Use command line argument `--html=filename.html`

```sh
esbuild --bundle --platform=browser --format=esm test/html.js | tap-ssc --html=test.html | tap-arc
```

In your html, be sure to include a script tag pointing at `bundle.js`:
```html
<script charset="utf-8" src="bundle.js" type="module"></script>
```

This is useful if your application code depends on another file that you are linking to via HTML, eg

```html
<head>
    <meta charset="UTF-8">
    <title>tests</title>
    <script src="https://example.com/my-js-dependency/dist/index.umd.min.js"></script>
</head>
<body>
    <script src="bundle.js"></script>
</body>
```

## how does this work?
We build an `ssc` binary [once after you install this package](./package.json#L16)

The package binary, `./cli.js`, takes javascript that is piped to `stdin`, and writes it to a file at the right location -- `target + /bundle.js`. Then it runs the ssc binary and pipes the output to `stdout`.

## test this module
This will use the `example` directory to install this as a dependency, then run a given test.

### A passing test
```sh
npm test | npx tap-arc
```

### A failing test
```sh
npm run test-fail
```

### A test that throws an error
```sh
npm run test-err
```
npm package: @nichoth/tonic
Description: A component framework.
Latest version: 15.3.4

<picture>
  <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/socketsupply/tonic/master/readme-tonic-dark.png">
  <source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/socketsupply/tonic/master/readme-tonic.png">
  <img alt="tonic" src="https://raw.githubusercontent.com/socketsupply/tonic/master/readme-tonic.png">
</picture>

<p align="center">
  https://tonicframework.dev
</p>
<br/>
<br/>

A fork of [@socketsupply/tonic](https://github.com/socketsupply/tonic)

![tests](https://github.com/nichoth/tonic/actions/workflows/nodejs.yml/badge.svg)
[![Socket Badge](https://socket.dev/api/badge/npm/package/@nichoth/tonic)](https://socket.dev/npm/package/@nichoth/tonic)
[![module](https://img.shields.io/badge/module-ESM-blue)](README.md)
[![license](https://img.shields.io/badge/license-MIT-brightgreen)](LICENSE.txt)


Tonic is a low profile component framework for the web. It's one file, less than 3kb gzipped and has no dependencies. It's designed to be used with modern Javascript and is compatible with all modern browsers and built on top of Web Components.

## Install

```sh
npm install @nichoth/tonic
```

## Use

```js
import Tonic from '@nichoth/tonic'

class MyGreeting extends Tonic {
  render () {
    return this.html`<div>Hello, World.</div>`
  }
}

Tonic.add(MyGreeting, 'my-greeting')
```

After adding your Javascript to your HTML, you can use your component anywhere.

```html
<html>
  <head>
    <script src="my-greeting.js"></script>
  </head>
  <body>
    <my-greeting></my-greeting>
  </body>
</html>
```

## Useful links
- [Tonic components](https://github.com/socketsupply/components)
- [Migration from the early versions of Tonic](./MIGRATION.md)
- [API](./API.md)
- [Troubleshooting](./HELP.md)

MIT License
npm package: @nichoth/tree-kill
Description: kill trees of processes
Author: Peteris Krumins
Latest version: 1.2.3

Tree Kill
=========
![tests](https://github.com/nichoth/tree-kill/actions/workflows/nodejs.yml/badge.svg)
[![Socket Badge](https://socket.dev/api/badge/npm/package/@nichoth/tree-kill)](https://socket.dev/npm/package/@nichoth/tree-kill)
[![types](https://img.shields.io/npm/types/@nichoth/tree-kill)](README.md)
[![dependencies](https://img.shields.io/badge/dependencies-zero-brightgreen)](package.json)
[![license](https://img.shields.io/badge/license-MIT-brightgreen)](LICENSE)

Kill all processes in the process tree, including the root process.

fork
====
A fork of [pkrumins/node-tree-kill](https://github.com/pkrumins/node-tree-kill)

Install
=======
```sh
npm install @nichoth/tree-kill
```

Examples
=======

Kill all the descendent processes of the process with pid `1`, including the process with pid `1` itself:
```js
var kill = require('tree-kill');
kill(1);
```

Send a signal other than SIGTERM.:
```js
var kill = require('tree-kill');
kill(1, 'SIGKILL');
```

Run a callback when done killing the processes. Passes an error argument if there was an error.
```js
var kill = require('tree-kill');
kill(1, 'SIGKILL', function(err) {
    // Do things
});
```

You can also install tree-kill globally and use it as a command:
```sh
tree-kill 1          # sends SIGTERM to process 1 and its descendents
tree-kill 1 SIGTERM  # same
tree-kill 1 SIGKILL  # sends KILL instead of TERMINATE
```

Methods
=======

## require('tree-kill')(pid, [signal], [callback]);

Sends signal `signal` to all children processes of the process with pid `pid`, including `pid`. Signal defaults to `SIGTERM`.

For Linux, this uses `ps -o pid --no-headers --ppid PID` to find the parent pids of `PID`.

For Darwin/OSX, this uses `pgrep -P PID` to find the parent pids of `PID`.

For Windows, this uses `'taskkill /pid PID /T /F'` to kill the process tree. Note that on Windows, sending the different kinds of POSIX signals is not possible.

License
=======

MIT

Changelog
=========


## [1.2.2] - 2019-12-11
### Changed
- security fix: sanitize `pid` parameter to fix arbitrary code execution vulnerability

## [1.2.1] - 2018-11-05
### Changed
- added missing LICENSE file
- updated TypeScript definitions

## [1.2.0] - 2017-09-19
### Added
- TypeScript definitions
### Changed
- `kill(pid, callback)` works. Before you had to use `kill(pid, signal, callback)`

## [1.1.0] - 2016-05-13
### Added
- A `tree-kill` CLI

## [1.0.0] - 2015-09-17
### Added
- optional callback
- Darwin support