open-index/open-npm huggingface dataset:
npm package: @masaue/jan-js-lib
Description: mahjong score library on JavaScript.
Author: masaue
Latest version: 2.0.0

[日本語版 README はこちら](README-ja.md)

# jan-js-lib - Mahjong Score Calculator Library
Rules supported by this library.

- Mahjong Competition Rules
- (work-in-progress)Zung Jung Mahjong

## Example
```
import {
  CompleteInfo,
  COMPLETE_TYPE,
  Hand,
  Janpai,
  JANPAI_ID,
  McrUtil,
  Mentsu,
  WIND,
} from '@masaue/jan-js-lib';

(() => {
  // concealed hand
  const janpaiList = [
    new Janpai(JANPAI_ID.MAN_01),
  ];
  // hand
  const hand = new Hand(janpaiList);
  // chow
  hand.fix(Mentsu.createChowMentsu(new Janpai(JANPAI_ID.PIN_01)));
  // pung
  hand.fix(Mentsu.createPungMentsu(new Janpai(JANPAI_ID.SOU_09)));
  // melded kong
  hand.fix(Mentsu.createKongMentsu(new Janpai(JANPAI_ID.TON)));
  // concealed kong
  hand.fix(Mentsu.createKongMentsu(new Janpai(JANPAI_ID.BAI), true));
  // complete tile, is last, prevalent, seat, complete type
  const completeInfo = new CompleteInfo(new Janpai(JANPAI_ID.MAN_01),
    false, WIND.TON, WIND.NAN, COMPLETE_TYPE.FINAL_DRAW_AND_WIN_ON_KONG);

  const complete = McrUtil.complete(hand, completeInfo);
  const yakuList = complete.yakuList.map((yaku) => {
    return {
      point: yaku.point,
      yaku: yaku.englishName,
    }
  });
  console.log({point: complete.point, yakuList});
})();
```

### Result
```
{
  point: 38,
  yakuList: [
    { point: 2, yaku: 'Prevalent Wind' },
    { point: 2, yaku: 'Dragon Pung' },
    { point: 1, yaku: 'Pung of Terminals or Honors' },
    { point: 4, yaku: 'Two Melded Kongs' },
    { point: 2, yaku: 'Concealed Kong' },
    { point: 4, yaku: 'Outside Hand' },
    { point: 1, yaku: 'Single Wait' },
    { point: 6, yaku: 'All Types' },
    { point: 8, yaku: 'Last Tile Draw' },
    { point: 8, yaku: 'Out with Replacement Tile' }
  ]
}
```

## Documents
- [The various kinds of MCR Yaku](./documents/McrYakuPattern.md)
- [how to publish](./documents/HowToPublish.md)

## License
[Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0)

&copy; 2021 [masaue](mailto:masayuki.uegaki@gmail.com)
npm package: @masayag-tests/plugin-notifications
Description: Frontend part of the notifications providing the Notifications API, Notifications page, left-side menu item and other REACT components.
Latest version: 0.0.1-demo

# Notifications

This Backstage front-end plugin provides:

- the `Notifications` page listing notifications from the logged-in user's perspective
- the NotificationsApi for accessing the notifications backend from front-end plugins
- an active item to the main left side menu to both notify the user about new messages and provide navigation to the Notifications page
- an alert about new system notifications

## Getting started

### Prerequisities

Have `@masayag-tests/plugin-notifications-backend` installed and running.

## Installing as a dynamic plugin

The sections below are relevant for static plugins. If the plugin is expected to be installed as a dynamic one:

- follow https://github.com/janus-idp/backstage-showcase/blob/main/showcase-docs/dynamic-plugins.md#installing-a-dynamic-plugin-package-in-the-showcase
- add content of `app-config.janus-idp.yaml` into `app-config.local.yaml`.
- customize configuration configure as needed

### Configuration

There is polling used to check for new notifications. It can be tuned via `pollingIntervalMs` config property (see `app-config.janus-idp.yaml`). When set to 0, the polling is turned off.

## Installing as a static plugin

### Add NPM dependency

```
cd packages/app
yarn add @masayag-tests/plugin-notifications
```

### Add left-side menu item

In the `packages/app/src/components/Root/Root.tsx`:

```
import { NotificationsSidebarItem } from '@masayag-tests/plugin-notifications';

...
export const Root = ({ children }: PropsWithChildren<{}>) => (
    ...
      {/* New code: */}
      <SidebarDivider />
      <SidebarItem icon={NotificationsActiveIcon} to="notifications" text="Notifications" />

      {/* Existing code for reference: */}
      <SidebarSpace />
      <SidebarSpace />
      <SidebarDivider />
      <SidebarDivider />
      <SidebarGroup
        <SidebarGroup label="Settings"
```

### Add to router

In the `packages/app/src/App.tsx`:

```
import { NotificationsPage } from '@masayag-tests/plugin-notifications';
...

export const AppBase = () => {
    ...
      {/* New code: */}
      <Route path="/notifications" element={<NotificationsPage />} />
```

## How to use the NotificationApi

Once installed as either static or dynamic plugin, a 3rd party frontend plugin can access the notifications via its frontend API:

```
import { notificationsApiRef, Notification } from '@masayag-tests/plugin-notifications';

...

const notificationsApi = useApi(notificationsApiRef);
const notifications: Notification[] = await notificationsApi.getNotifications(params);

```

See `src/api/notificationsApi.ts` for more details.