open-index/open-npm huggingface dataset:
npm package: @mothepro/amazons-engine
Description: Engine for the esoteric game of Amazons
Author: Maurice Prosper
Latest version: 0.0.10

# Amazons Engine

> Engine for the esoteric game of Amazons

## Install

`yarn add @mothepro/amazons-engine`

## How to Use

```typescript
import Game from '@mothepro/amazons-engine'

const g = new Game
g.start()
```

TODO...

+ Add more tests
npm package: @mothepro/ez-rtc
Description: Simplify the data Peer to Peer (RTC) connenctions in browser
Author: Maurice Prosper
Latest version: 0.1.0

# EZ RTC

> Simplify the data Peer to Peer (RTC) connenctions in browser

View the [Compatibility](https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/RTCPeerConnection#Browser_compatibility) to see which browsers support this.

## Install

`yarn add @mothepro/ez-rtc`

## How to Use

+ Create an offer on the first browser
+ Copy offer and send to the second browser
+ Paste offer in second browser and click Join
+ Create an answer on the second browser
+ Copy answer and send to the first browser
+ Paste answer in first browser and click Join
+ Messages can now be sent between browsers

See the demo for a simple how-to

Note: Browsers may not send empty messages

## Roadmap

Add a way to test RTC support in general (Connection with **a** STUN can be made)
Support a given timeout in the constructor?
Verify errors are thrown at the right time
Add support for video & audio calls
Possibly support unreliable mode
Support multiple data channels
Support [negotiated](https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/createDataChannel#negotiated) data channel creation
npm package: @mothepro/lit-amazons
Description: Game of Amazons made with web components
Author: Maurice Prosper
Latest version: 0.0.3

# [`<lit-amazons>`](//mothepro.github.io/lit-amazons)

> Game of Amazons made with web components

## Install

`yarn add @mothepro/lit-amazons`

## How to Use

`index.html`
```html
  <script type="module" src="//unpkg.com/@mothepro/amazons-engine@0.0.6/dist/esm/index.js"></script>
  <script type="module" src="//unpkg.com/@mothepro/lit-amazons/dist/esm/index.js"></script>
  <script type="module" src="index.js"></script>
  <lit-amazons .engine=${window.engine}></lit-amazons>
```

`index.js`
```javascript
  import Engine from '@mothepro/amazons-engine'
  window = new Engine
```

Take a look at the [demo](https://github.com/mothepro/lit-amazons/blob/master/demo/index.ts) for simple of usage.

TODO...
+ Support drag and drop on mobile
npm package: @mothepro/lit-clock
Description: Simple clock element
Author: Maurice Prosper
Latest version: 0.0.4

# [`<lit-clock>`](https://mothepro.github.io/clock/)

> Simple clock element

[![npm](https://img.shields.io/npm/v/@mothepro/lit-clock.svg)](https://www.npmjs.com/package/@mothepro/lit-clock)
[![Published on webcomponents.org](https://img.shields.io/badge/webcomponents.org-published-blue.svg)](https://www.webcomponents.org/element/owner/my-element)

## Install

`yarn add @mothepro/lit-clock`

## How to Use

| Attribute | Type | Description |
| --------- | ---- | ----------- |
| `pause` | `boolean` | Whether the clock should be incrementing |
| `pause-on-blur` | `boolean` | Whether the clock should continue incrementing when the document loses focus |
| `ticks` | `number` | The number of seconds the clock should start with. *Defaults to `0`* |

<!--
```
<custom-element-demo>
  <template>
    <script type="module" src="//unpkg.com/es-module-shims@0.4.6/dist/es-module-shims.min.js"></script>
    <script type="importmap-shim" src="https://mothepro.github.io/clock/import-map.json"></script>
    <script type="module-shim" src="//unpkg.com/@mothepro/lit-clock/dist/esm/index.js"></script>
 
    <next-code-block></next-code-block>
  </template>
</custom-element-demo>
```
-->
```html
Pause on blur clock
<lit-clock pause-on-blur ticks=0></lit-clock>
```
npm package: @mothepro/lit-sets
Description: Sets as a lit app
Author: Maurice Prosper
Latest version: 0.0.21

# `<lit-sets>`

> Sets as a lit app

## Install

`yarn add lit-sets`

## How to Use

*Material is so annoying...*

## TODO

+ Arrow key to choose card (assume 3xN grid)
+ Mini tutorial & tip can be more clear
  + log these
+ easy mode in multiplayer
  + show toggle disabled for now?
+ Extend signaling fallback duration
  + Why is p2p so unreliable :'( `lit-p2p[retries="-1"]`
+ censor bad words for viewer
+ Show loading when waiting for rematch
+ Add support for a bundled `nomodule` script (get `esbuild`)
+ Allow non-linear generators to be defined in attributes
+ duplicate `theme-toggle` event if localStorage != OS preference
+ *No release needed*
  + nicer shapes
  + better color scheme
  + add key shortcuts and change log to their own dialogs?
  + Fit feedback iframe for all sizes
npm package: @mothepro/loose-map
Description: ES6 Map with loose type checking
Author: Maurice Prosper
Latest version: 1.0.0

# Loose Map

> ES6 Map with loose type checking

## Install

`yarn add @mothepro/loose-map`

## How to Use

Just like a normal ES6 Map, however object identical literals will match each other.

```typescript
  const map = new LooseMap

  map
    .add({ hello: 'world' }, 123)
    .add({ hello: 'world' }, 321)

  map.size == 1
  map.has({ hello: 'world' }) == true
  map.get({ hello: 'world' }) == 321
```
npm package: @mothepro/loose-set
Description: ES6 Set with loose type checking
Author: Maurice Prosper
Latest version: 1.0.0

# Loose Set

> ES6 Set with loose type checking

## Install

`yarn add @mothepro/loose-set`

## How to Use

Just like a normal ES6 Set, however object identical literals will match each other.

```typescript
  const set = new LooseSet

  set
    .add({ hello: 'world' })
    .add({ hello: 'world' })

  set.size == 1
  set.has({ hello: 'world' }) == true
```
npm package: @mothepro/signaling-lobby
Description: A simple lobby system which is used as a signaling server for peer-to-peer connections.
Author: Maurice Prosper
Latest version: 0.3.3

# Signaling Lobby

> A simple lobby system which is used as a signaling server for peer-to-peer connections.

## How to Use

Run the server `npx @mothepro/signaling-lobby` and use the following options to control it.

Flag | Alias | Type | Default | Description
-----|-------|------|-------------|--------
`version` | | `boolean` | | Show the version number
`help` | | `boolean` | | Show help
`verbose` | `v` | `count` | None | Verbosity (`-vvvvv` is most verbose)
`hostname` | `h` | `string` | localhost | The hostname to this server is running on
`port` | `p` | `number` | A random free port | The port to host this server on
`max-length` | | `number` | `15` | The max length of a client's name
`max-connections` | | `number` | `65534` | The max number of connections the server supports. `65534` is the max supported
`idle-timeout` | `i` | `number` | `20` minutes | The number of milliseconds a client can be connected to the server without joining a group
`sync-timeout` | `s` | `number` | `30` seconds | The number of milliseconds a client will be connected to the server once syncing is complete
`key` | | `string` | None | Path to the public key to use (Only for a secure server)
`cert` | | `string` | None | Path to the certificate to use (Only for a secure server)

*By tweaking the `sync-timeout` flag this server could be used for non-p2p signaling (longstanding groups that send data through the server)*

## EC2

Create a hosted zone to point to EC2 server **public** IP.

First, to support a secure server, create a key & cert pair with `letsencrypt`

Install with the following commands

```shell
sudo yum-config-manager --enable rhui-REGION-rhel-server-extras rhui-REGION-rhel-server-optional
sudo yum install certbot python2-certbot-apache
sudo yum -y install yum-utils
sudo yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
```

Make a security group that makes the `port` to use available.

Finally, Run the server and set the `hostname` (`-h`) to the **private** IP.

```shell
npx @mothepro/signaling-lobby -vvvvv \
-h ... \
-p 9000 \
--key /etc/letsencrypt/live/<DOMAIN>/privkey.pem \
--cert /etc/letsencrypt/live/<DOMAIN>/fullchain.pem
```

If access to the `*.pem` files is restricted the server be run in `sudo` mode.
This can be enabled with the following command, because by default `sudo npx` doesn't work run, `npx` must be in the `/usr/bin` path.

```shell
sudo ln ~/.nvm/versions/node/<version>/bin/* -s /usr/bin
```

## Install

The Socket Server is exposed as an NPM module so it can be imported to allow for customizations.

`yarn add @mothepro/signaling-lobby`

## Roadmap

+ add DoS prevention (potenetially using 'headers' event)
+ Simplify / Remove redundant Group class
+ Improve system to determine who makes an offer
+ Export helpers for parsing buffers in util (Make `BrowserSocket` public)
npm package: @mothepro/theme-toggle
Description: Web Component to natively toggle site theme
Author: Maurice Prosper
Latest version: 0.0.2

# `<theme-toggle>`

> Web Component to natively change your site's theme

[![npm](https://img.shields.io/npm/v/@mothepro/theme-toggle.svg)](https://www.npmjs.com/package/@mothepro/theme-toggle)
[![Published on webcomponents.org](https://img.shields.io/badge/webcomponents.org-published-blue.svg)](https://www.webcomponents.org/element/@mothepro/theme-toggle)

## Install

`yarn add @mothepro/theme-toggle`

## How to Use

| Attribute | Type | Default | Description |
| --------- | ---- | ------- | ----------- |
| `persistent` | `boolean` | `false` | Whether the theme should be saved on reload |
| `theme` | `dark` or `light` | `light` | The theme to use, this attribute is added to the `<body>` too |

<!--
Inline demo for webcomponents.org
```
<custom-element-demo>
  <template>
    <next-code-block></next-code-block>
  </template>
</custom-element-demo>
```
-->
```html
<!-- 
  Import the element.

  The `module` query parameter expands "bare" imports to full unpkg.com urls.
  This means use of an import map isn't needed.
  @see https://unpkg.com#query-params
-->
<script type="module" src="//unpkg.com/@mothepro/theme-toggle/dist/esm/index.js?module"></script>

Click to change theme to
<theme-toggle persistent>
  <u slot="light">dark</u>
  <u slot="dark">light</u>
</theme-toggle>.
```
npm package: @mothepro/ts-module-shim
Description: Extends the 'es-module-shim' module to support TypeScript files
Author: Maurice Prosper
Latest version: 0.0.3

# TS Module Shim

> Extends the 'es-module-shim' module to support TypeScript files

This should really only be used for development purposes.

TypeScript compiler is **large (8 Mb)** and **performance expensive**.

## How to Use

```html
<!-- Include the usual es-module-shim. -->
<script type="module" src="//unpkg.com/es-module-shims@0.4.6/dist/es-module-shims.min.js"></script>

<!-- Include typescript and this module -->
<script src="//unpkg.com/typescript@3.7.4/lib/typescript.js"></script>
<script type="module" src="//unpkg.com/@mothepro/ts-module-shim/dist/esm/index.js"></script>

<!-- Then include your typescript file as a shim -->
<script dev-only type="module-shim" src="index.ts"></script>
```

## TODO

+ Properly handle [typescript file extnesions](https://github.com/Zoltu/typescript-transformer-append-js-extension)
  + May need to use the [`transpileOptions` field](https://github.com/microsoft/TypeScript/blob/4fe27222ca2d012dad541b43d791ae12f1cf6985/src/services/transpile.ts)
+ Conditionally load Typescript
  + Import Typescript compiler within this module.
  + Require only one module to be leaded in the HTML
+ Better source map suppoert
+ Support custom tsconfig files
  + Support the `extends` field used in some TSConfigs
+ Add tests