open-index/open-npm huggingface dataset:
npm package: @feminab/cqa-ui
Description: UI Kit library for Angular 13.4
Latest version: 0.0.6

# CQA UI

Component library for Angular 13+, built with Tailwind CSS tokens and Storybook-driven documentation.

---

## 📦 Installation

```bash
npm install cqa-ui
```

### Peer dependencies

```bash
npm install @angular/common@^13.4.0 @angular/core@^13.4.0 @angular/forms@^13.4.0 @angular/material@^13.3.9 rxjs@^7.5.0
```

---

## 🚀 Quick Start

```ts
// app.module.ts
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { UiKitModule } from 'cqa-ui';

import { AppComponent } from './app.component';

@NgModule({
  declarations: [AppComponent],
  imports: [
    BrowserModule,
    UiKitModule
  ],
  bootstrap: [AppComponent]
})
export class AppModule {}
```

---

## 💡 Usage Examples

### Button

```html
<cqa-button variant="filled" icon="save" (clicked)="onSave()">
  Save changes
</cqa-button>

<cqa-button variant="outlined" [disabled]="isSubmitting">
  Cancel
</cqa-button>
```

### Search bar

```html
<cqa-search-bar
  placeholder="Search components"
  [value]="query"
  [showClear]="true"
  (valueChange)="query = $event"
  (search)="onSearch($event)"
></cqa-search-bar>
```

### Segment control

```html
<cqa-segment-control
  [segments]="[
    { label: 'Overview', value: 'overview' },
    { label: 'Analytics', value: 'analytics' },
    { label: 'Settings', value: 'settings', disabled: true }
  ]"
  [value]="currentTab"
  (valueChange)="currentTab = $event"
></cqa-segment-control>
```

### Dialog

```ts
import { DialogService } from 'cqa-ui';

constructor(private readonly dialog: DialogService) {}

openDialog(): void {
  this.dialog.open({
    title: 'Delete dashboard',
    description: 'Deleting this dashboard will remove it for all collaborators.',
    warning: 'This action cannot be undone.',
    content: {
      type: 'text',
      text: 'Are you sure you want to continue?'
    },
    buttons: [
      { label: 'Cancel', role: 'secondary' },
      { label: 'Delete', role: 'warn', handler: () => 'delete' }
    ]
  });
}
```

---

## 📚 Storybook

```bash
npm run storybook
```

View component documentation and interactive examples at `http://localhost:6006`.

---

## 🛠 Development

```bash
npm install
npm run build:cqa-ui      # build the library bundle
npm run storybook         # start Storybook
npm run build-storybook   # static Storybook build
```

### Publish workflow

1. Update version in `package.json`
2. `npm run build:cqa-ui`
3. `npm publish dist/cqa-ui`

---

## 📄 License

MIT — contributions and issues welcome!
npm package: @femm/prettier
Description: prettier config used by maomao
Author: maomao
Latest version: 1.1.0

# @femm/prettier

prettier config used by maomao

## 安装

```sh
pnpm add -D @femm/prettier
# OR
npm i -D @femm/prettier
```

## 使用

[Sharing configurations · Prettier](https://prettier.io/docs/en/configuration.html#sharing-configurations)

### 添加配置项到 `package.json`

> 直接使用时推荐该方案

```sh
npm pkg set prettier='@femm/prettier'
```

### 使用单独的配置文件

> 为了兼容 `esm` 的项目，直接使用 `cjs`

先创建 `.prettierrc.cjs` 文件（内容如下）

```js
module.exports = require('@femm/prettier')
```

命令行一键创建

```sh
echo "module.exports = require('@femm/prettier')" > .prettierrc.cjs
```
npm package: @femm/verify-commit
Description: Simple commit message format verify
Author: maomao
Latest version: 1.0.1

# @femm/verify-commit

一个简单的 commit message 校验工具

## 安装与使用

### 使用 `simple-git-hooks` 运行

```sh
pnpm add -D @femm/verify-commit simple-git-hooks
# OR
npm i -D @femm/verify-commit simple-git-hooks
```

#### 添加配置项到 `package.json`

```sh
# 使用 npx + bin 运行
npm pkg set simple-git-hooks.commit-msg='npx femm-verify-commit $1'

# OR 使用 pnpm + bin 运行
npm pkg set simple-git-hooks.commit-msg='pnpm femm-verify-commit $1'

# OR 使用 node 运行
npm pkg set simple-git-hooks.commit-msg='node ./node_modules/@femm/verify-commit/index.js $1'
```

#### 注册 `git-hooks`

> 当 `simple-git-hooks` 有更新时，需要重新注册

```sh
npx simple-git-hooks
```

> 添加 `prepare` 脚本，可以在 `install` 时自动注册已经配置的 `git-hooks`，第一次使用时需要手动运行一次 `npm run prepare`

```sh
npm pkg set scripts.prepare="npx simple-git-hooks"
```

### 使用 `husky` 运行

```sh
pnpm dlx husky-init && pnpm add -D @femm/verify-commit
# OR
npx husky-init && npm i -D @femm/verify-commit
```

#### 注册 `git-hooks`

```sh
npx husky add .husky/commit-msg 'npx femm-verify-commit $1'
```

## 相关链接

- [vue — verify-commit-msg.js | GitHub](https://github.com/vuejs/vue/blob/main/scripts/verify-commit-msg.js)
- [Git 提交规范 | 茂茂物语](https://maomao.fe-mm.com/workflow/style-guide#git-%E6%8F%90%E4%BA%A4%E8%A7%84%E8%8C%83)
- [simple-git-hooks | GitHub](https://github.com/toplenboren/simple-git-hooks)
- [husky | GitHub](https://github.com/typicode/husky)
npm package: @femto-apps/authentication-consumer
Description: Library to ease the shift to becoming an authentication consumer
Author: Popey456963, aappleton8
Latest version: 1.0.2

# Authentication Consumer Middleware Library
## Description
Library code for an authentication consumer. This library is to be imported in to an euthentication consumer program. 

## Usage
This library is designed to be incorported in to an authentication consumer. A usage example is given below. 
```
app.use(authenticationConsumer({ options }))
```
`options` is an object with three parts: 
- `tokenService: { endpoint }` - The hostname of the token service to use. 
- `authenticationProvider: { endpoint, consumerId }` - The hostname of the provider to use and the consumer uuid used by the provider to identify the consumer. 
- `authenticationConsumer: { endpoint }` - The hostname of the consumer.
npm package: @femto-apps/config
Description: A simple utility programs that looks for and loads a config file.
Author: Femto Apps
Latest version: 4.0.0

# Config Loader

Looks for configuration file such as `config.js`, `config.json` and `config.hjson` in the top level directory, in the `config` directory, in the `configs` directory and in the `test-configs` directory.  It first attempts to load `config.default.js`, `config.default.json` and `config.default.hjson` in the aforementioned directories in case the non-default files cannot be found.  Usage:

```javascript
const config = require('@femto-host/config')

config.get('path.to.option[0]')
```
npm package: @femto-apps/errors
Description: A simple JavaScript library to handle errors in APIs
Latest version: 2.0.0

### Errors

An opinionated library to help you handle errors in APIs.

#### Usage

An example index file:

```javascript
// require the module
const Errors = require('@femto-host/errors')

// initialise errors
const errors = new Errors('path/to/errors.json')

// add the errors function to your express `res` object.
app.use('/api', (req, res, next) => {
    errors(res)
    next()
})

// register errors.
app.get('/api/test', (req, res) => {
    res.error('ERRNOTFOUND', { file: 'test.txt' })
})
```

An example error file:

```json
{
    "ERRNOTFOUND": {
        "msg": "File {file} was not found.",
        "code": 404
    }
}
```
npm package: @femto-apps/random-number
Description: A library to coordinate random number generation.
Author: Femto Apps
Latest version: 1.0.0

# Random Numbers

A library which allows the selection of a random number between a group of people that do not trust each other.  Uses the following algorithm (where `n` is the highest number to select, `0` is always the lowest):

1. All users select a random number between 0 and `2 ^ ceil(log2(n))`.  The results are hashed with a nonce using a secure hashing algorithm and shared with the group:

| User  | Generated Number | Nonce | Hash         |
|-------|------------------|-------|--------------|
| Alice | 2                | 5h4wh | 5663653j356j |
| Bob   | 7                | w45hh | 56j35j35j535 |
| Eve   | 5                | wzghk | zdfg34t4353y |

2. Once a user receives the hash of every other participant, they reveal their randomly generated number and their nonce.

3. All generated numbers are then xor'd together and normalised to 

### Usage:

```javascript
const { RandInt } = require('@femto-host/randomNumber')

// pick a random integer from 1 to 20 (inclusive)
const generator = new RandInt(1, 20)

const myPart = generator.gen()

/* implement some part sharing method

1. share `myPart.hash` with others
2. share `myPart` with others after everyone has shown you their hash
*/

generator.finalise(parts)
```
npm package: @femto-apps/verify
Description: > A simple verification library for validating the sanity of variable contents.
Latest version: 1.0.4

## lib-verify

> A simple verification library for validating the sanity of variable contents.

### Usage

```JavaScript
const { verify } = require('../index')

let result = verify('Name', 'Alexander', [
    verify.string.maxLength(6),
    verify.string.minLength(3)
])

console.log(result) // [ "Name field is too long: 'Alexander', maximum length is 6 but found length 9" ]
```
npm package: @femto-host/config
Description: Looks for configuration as `config.js`, `config.json` and `config.hjson`.  Usage:
Author: Codefined
Latest version: 1.0.0

# Config Loader

Looks for configuration as `config.js`, `config.json` and `config.hjson`.  Usage:

```javascript
const config = require('@femto-host/config')

config.get('path.to.option[0]')
```
npm package: @femtowin/webmcp
Description: Web-based Model Context Protocol (MCP) tools and utilities
Author: webmcp contributors
Latest version: 0.0.1

# webmcp

Web-based Model Context Protocol (MCP) tools and utilities.

## Overview

webmcp provides tools for building web-enabled MCP servers and clients, allowing AI agents to interact with web browsers and web content.

## Installation

```bash
npm install webmcp
```

## Status

This package is under active development. Stay tuned for updates.

## License

MIT
npm package: @fen89/prx
Description: Easier project management
Author: Tobias Görg
Latest version: 1.2.1
Deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

# prx

[![Build Status](https://travis-ci.org/fen89/prx.svg?branch=master)](https://travis-ci.org/fen89/prx)
[![renovate](https://img.shields.io/badge/renovate-enabled-brightgreen.svg)]()
[![commitizen](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=flat-square)]()
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=flat-square)](https://github.com/semantic-release/semantic-release)
[![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)

Simple command line tool for organizing local projects.

## Install

Install it via npm: 

`$ npm install -g @fen89/prx`

## Usage

```
$ prx --help

Usage: $ prx [options] [command]

Easier project management

Options:
  -V, --version  output the version number
  -h, --help     output usage information

Commands:
  list|ls        List all projects in workspace
  open|o         Open project
  add            Add a project to the workspace
  edit           Edit a project in workspace
  delete|del     Remove a project from the workspace
```
npm package: @fencyai/react
Description: > TODO: description
Author: staklau
Latest version: 0.1.162

# `@fencyai/react`

The official React SDK for [Fency.ai](https://fency.ai).

For more information, visit [docs.fency.ai](https://docs.fency.ai).

## Setup

```tsx
import { loadFency } from '@fencyai/js'
import { FencyProvider } from '@fencyai/react'

const fency = loadFency({ publishableKey: 'pk_your_publishable_key' })

export default function App() {
  return (
    <FencyProvider
      fency={fency}
      fetchCreateStreamClientToken={async () => {
        const res = await fetch('/api/fency-token')
        return res.json()
      }}
    >
      {/* your app */}
    </FencyProvider>
  )
}
```
npm package: @fendy3002/lang
Description: For the latest version:
Latest version: 0.0.9

Lang is a small library to handle language with key-value format. 

# Installing

For the latest version:

```bash
$ npm install @fendy3002/lang
```

Or using yarn:

```bash
$ yarn add @fendy3002/lang
```

# Usage

This library accept a javascript object / json. Example of a language dictionary that can be supplied:

``` javascript
let dictionary = {
    "en": {
        "sales": {
            "create": {
                "created": "Your order has been created with number {order_id}",
                "customer_blocked": "Customer {customer} is blocked"
            },
            "delete": {
                "confirm": "Are you sure to delete order {order_id}?",
                "deleted": "Order has been deleted"
            }
        },
        "parameterized": "Age: {age}"
    }
};
```

The nested content can have more than 2 levels deep. To use the dictionary variable above (with async/await):

``` javascript
import langCore from '@fendy3002/lang';
let langSource = await langCore(dictionary);
let langEn = langSource.use("en");

let createdDefaultMessage = "Created successfully, order no: {order_id}";
let createdMessage = langEn._(
    "sales.create.created", 
    createdDefaultMessage, {
        order_id: "ORD/XII/1241"
    });
```

If you want to shorten / simplify the nested path, `part` method can be used:

```javascript
let langSource = await langCore(dictionary);
let langEn = langSource.use("en");

let salesCreate = langEn.part("sales.create");
let createdDefaultMessage = "Created successfully, order no: {order_id}";
let createdMessage = langEn._(
    "created", 
    createdDefaultMessage, {
        order_id: "ORD/XII/1241"
    });
```

For the moment, to use parameter as replacement you can use `{key}` format, and supply the values as third parameter.

# Express middleware

To use this library under express, it can be passed using middleware. For example, to use specific language dictionary using first segment of url (ex: `http://example.com/en/sales/created`):

``` javascript
let langSource = await langCore(dictionary);

app.use(":lang", (req, res, next) => {
    req.lang = langSource.use(req.params.lang);
});
app.get(":lang/sales/created", (req, res, next) => {
    let pageLang = req.lang.part("sales.create");
    let createdDefaultMessage = "Created successfully, order no: {order_id}";
    let createdMessage = pageLang._("created", createdDefaultMessage, {
        order_id: "ORD/XII/1241"
    });
});
```
npm package: @fendy3002/qz-code-generator
Description: Simple code generator made by nodejs.
Latest version: 0.0.5

# @fendy3002/qz-code-generator

Simple code generator made by nodejs.

# Installation

Use `@fendy3002/qz-exec` to initialize a code-generator project easily, by running:

```
npx @fendy3002/qz-exec@latest create_codegen <project_name>
```

If the `project_name` is not supplied, it'll create one in a folder named `codegen`. If the target folder is not empty, the command will fail.

Afterwards, cd into the project folder (`codegen` by default). Then run `npm install` (or `yarn install` if you use yarn). Then you can try `npm run generate` and see the result at `output/myproject` folder.

# Schema

The first is schema files, located at `projects/myproject/schema` folder. There's one schema pre-generated named `myschema.json`. Schema is the business model, or one can say it's simply a sql table, or mongodb collection.

It is a json file, with unrestricted content except it must be an object and not an array. That means you can put any properties, sub-properties and data anyway you want it to be rendered.

# Template

Next is template folder, located at `projects/myproject/template`. Inside, you can put any folder and file to be compiled & filled with information from schema file. After you run `npm run generate`, the compilation result will be created at `output/myproject` folder.

# Extension

Extension is a bunch of `.ts` file that can help during generate. Run the command `npm run make:extension` to make one. The result from `data` property can be used in `Template`.

# option.json

`option.json` is a file, located at `projects/myproject/option.json`. It is a json file used to configure generation process, such as prettier configuration.
npm package: @fendy3002/string-tools
Description: A simple application to help converting some text with specific format to desired format using configurable commands.
Author: Fendy Heryanto
Latest version: 0.1.2

# QzStringTools

A simple application to help converting some text with specific format to desired format using configurable commands.

## Running app

This repo comes with app server, run in http://localhost:3000.

```
git clone https://github.com/fendy3002/QzStringTools.git;

cd QzStringTools;

npm install;

npm start;
```

## Installing

When you want to use this library in your own node project, you can install it via npm install.

```
npm install --save @fendy3002/string-tools
```

## Basic usage

```js
var StringTools = require('@fendy3002/string-tools');
var Config = StringTools.defaultConfig;

var input = 'Hello, world \n' +
        'how, are, you?';

var selectedCommand = null;
for(var i = 0; i < Config.command.length; i++){
    selectedCommand = Config.command[i];
    if(selectedCommand.code == 'sql-single-quote'){ break; }
}

var result = StringTools.convert(input, selectedCommand, Config);
console.log('result', result);
```

## Use cases

### From excel spreadsheet to sql select

<img src="https://cloud.githubusercontent.com/assets/5449185/26616356/10c2f24a-45f8-11e7-9fd7-da96b968b828.gif" 
	alt="From excel spreadsheet (tab delimited) to mysql select union all"
	title="From excel spreadsheet (tab delimited) to mysql select union all"
	style="width: 800px;"/>

### From newline delimited to be part of select in

<img src="https://cloud.githubusercontent.com/assets/5449185/26631554/bf48530e-4635-11e7-8ee6-fb0ec1caef12.gif" 
	alt="From newline delimited to be part of select in"
	title="From newline delimited to be part of select in"
	style="width: 800px;"/>

### From PHP Array to Object syntax

<img src="https://cloud.githubusercontent.com/assets/5449185/26616058/ffc041d4-45f5-11e7-9709-e211e0b59a69.gif"
	alt="From php array syntax to object syntax"
	title="From php array syntax to object syntax"
	style="width: 800px;"/>
npm package: @fenelabs/sdk
Description: 🛠 An SDK for building applications on top of TukarV2Swap.
Latest version: 3.0.4

# TukarV2 SDK

Install dependencies

```sh
yarn install
```

Run tests

```sh
yarn test
```

You should see output like the following:

```sh
yarn run v1.22.4
$ tsdx test
 PASS  test/constants.test.ts
 PASS  test/pair.test.ts
 PASS  test/fraction.test.ts
 PASS  test/miscellaneous.test.ts
 PASS  test/entities.test.ts
 PASS  test/trade.test.ts

Test Suites: 1 skipped, 6 passed, 6 of 7 total
Tests:       3 skipped, 82 passed, 85 total
Snapshots:   0 total
Time:        5.091s
Ran all test suites.
✨  Done in 6.61s.
```
npm package: @feng-j/image-factory
Description: 浏览器中的图片处理器, 内置滤镜, 支持自定义滤镜.
Author: feng
Latest version: 1.2.1

## 图片处理器

只能用于浏览器环境下, 因为底层使用了 canvas 暂时未对 Node 环境进行适配

### 安装

```bash
$ npm install @feng-j/image-factory
```
或者使用你习惯的其他包管理工具

你也可以直接在 HTML 中引入
```HTML
<script src="https://cdn.jsdelivr.net/npm/@feng-j/image-factory/dist/index.umd.min.js"></script>

```
通过 window.ImageFactory 来获取所有的构造函数.

再或者你想使用其他的模块化方案,只需要把 CDN 中的 umd 替换成目标方案即可, 现有四种规范的模块化产物可用(CommonJS, ESM, AMD, UMD, 分别对应 cjs, esm, amd, umd)

### 使用

1. 首先引入构造函数 ImageFactory, 可以在实例化时传入原始文件或者稍后使用 setImage 方法设置文件(支持 File 和 HTMLImageElement两种类型);
2. 使用 parse 方法解析图片文件, 方法返回一个当前实例的 Promise 对象, 如果传入的是一个 Image 实例, 可以省略这一步, 如果执行了也不会有任何问题, 会直接返回 Promise.resolve;
3. 使用 addFilter 方法为图片添加滤镜, 支持自定义滤镜, 下面有详细描述;
4. 使用 generate 方法导出 base64 的图片, 接收两个参数, 均为可选. 第一个参数用户与设置图片格式(mime), 默认为 `'image/png'`, 第二个参数用于设置导出图片的质量范围 1-100.
5. factory 实例可以持续使用, 但是 generate 之后要重新 setImage, 因为会重置实例内部的数据.

代码描述如下

```typescript
import { ImageFactory, GrayscaleFilter } from '@feng-j/image-factory'

function handler(e: Event) {
  const file = (<HTMLInputElement>e.target).files[0];
  const image = new ImageFactory(file)
  image.parse().then(i => {
    const src = i.addFilter(new GrayscaleFilter()).generate()
    const img = document.createElement("img");
    img.src = src;
    document.body.appendChild(img);
  })
}

window.onload = () => {
  const fileSelector = document.getElementById('file')
  // HTML 文件中有一个 input 标签, type="file" id="file"
  fileSelector.onchange = handler
}
```

### 滤镜

目前内置了下列滤镜, 后续会继续完善内置滤镜的种类
+ GrayscaleFilter: 灰度滤镜;
+ InverseColorFilter: 反色滤镜;
+ BrightnessFilter: 亮度调节(大于 0 变亮, 小于 0 变暗), 范围-255 到 255(纯黑和纯白),参数直接传入滤镜构造函数;
+ OldPhotoFilter: 老照片滤镜;
+ EmbossFilter: 浮雕滤镜;


支持自定义滤镜处理方式, 需要自定义滤镜需要实现 IFilter 接口
```typescript
interface IFilter {
  exec(imageData: ImageData): ImageData;
}
```

在给图片添加滤镜时会将 [ImageData](https://developer.mozilla.org/zh-CN/docs/Web/API/ImageData) 数据作为参数传给 exec 方法, 你可以直接操作这个 ImageData 并返回, 也可以返回一个新的 ImageData 对象.

例如自定义一个CustomFilter 需要像下面这样
```typescript
class CustomFilter implements IFilter {
  exec(imageData) {
    const data = imageData.data

    // 没四位是一个像素点, 分别是 R G B A(透明度)
    for (let i = 0; i < data.length; i += 4) {
      data[i] = 255
      data[i + 1] = 0
      data[i + 2] = 0
    }

    return imageData
  }
}
```
上面这个滤镜会将图片转为纯红色
npm package: @feng-j/midwayjs-mailer
Description: 用于发送邮件的MidwayJS的组件
Author: feng
Latest version: 2.0.1

### MidwayJS-Mailer

用于在MidwayJS项目中快捷使用邮件发送功能。

#### 安装使用

```bash
$ npm install nodemailer @types/nodemailer @feng-j/midwayjs-mailer
```
在configuration中引入mailer

```ts
import * as mailer from '@feng-j/midwayjs-mailer';
// ......

@Configuration({
  imports: [
    // ......
    malier,
  ],
  importConfigs: [join(__dirname, './config')],
})
export class MainConfiguration {
  @App('koa')
  app: koa.Application;

  async onReady() {
    this.app.useMiddleware([ReportMiddleware]);
  }
}

```

在配置文件中添加mailer相关的配置, 配置项直接传给nodemailer, 所以配置与nodemailer createTransport参数一致。

```ts
export default {
  // ......
  mailer: {
    host: 'smtp.qq.com',
    secure: true,
    auth: {
        user: 'xxx@xx.com',
        pass: 'xxx'
    }
  },
} as MidwayConfig;

```

然后就可以通过Inject来注入MailerService了

```ts
import { Inject, Controller, Get, Query } from '@midwayjs/core';
import { Context } from '@midwayjs/koa';
import { MailerService } from '@feng-j/midwayjs-mailer';

@Controller('/api')
export class APIController {
  @Inject()
  ctx: Context;

  @Inject()
  mailerService: MailerService;

  @Get('/send')
  async sendEmail() {
    await this.mailerService.send({
      subject: 'custom prefix render',
      to: 'xxxx@qq.com',
      text: 'Hello!',
    })
  }
}

```

更多使用方法可以见[nodemailer 文档](https://www.nodemailer.com/)

#### 模板渲染

除了基本文本内容邮件的发送，还可以在邮件中嵌入HTML内容，通过模板引擎渲染，目前支持`ejs`、`pug`和`nunjucks`模板引擎的渲染。(如果要是用其他的模板引擎，可以将渲染完成的htmlStr手动传入, 后期可以支持自定义渲染）

以ejs模板引擎为例，在配置文件中开启模板渲染的支持

```ts
export default {
  // ......
  mailer: {
    host: 'smtp.qq.com',
    secure: true,
    auth: {
        user: 'xxx@xx.com',
        pass: 'xxx'
    },
    template: 'ejs', // 指定模板引擎
  },
} as MidwayConfig;

```

需要额外安装ejs的依赖库

```bash
$ pnpm i ejs
```
然后准备一个模板文件，例如：

```ejs
<!doctype html>
<html lang="zh">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Order</title>
</head>
<body>
<h3>
  感谢您订购我们的服务，当前订单（<%= orderId %>）已经生效。
</h3>
祝您使用愉快
</body>
</html>

```

然后在发送邮件的时候传入模板文件路径，以及模板数据，例如：
```ts
import { Inject, Controller, Get, Query } from '@midwayjs/core';
import { Context } from '@midwayjs/koa';
import { MailerService } from '@feng-j/midwayjs-mailer';
import { join } from 'path';

@Controller('/api')
export class APIController {
  @Inject()
  ctx: Context;

  @Inject()
  mailerService: MailerService;

  @Get('/send')
  async sendEmail() {
    await mailerService.send(
      {
        subject: 'templateMail',
        from: '小枫 <youremail@xx.com>',
        to: 'xxxx@qq.com',
      },
      {
        path: join(__dirname, './fixtures/templateMail/src/template/order.ejs'),
        record: { orderId: 'BL20241208160753' },
      }
    );
  }
}

```

发送邮件效果如下：

![img.png](static/img.png)
npm package: @feng-j/midwayjs-minio
Description: 用于连接MinIO的MidwayJS的组件
Author: feng
Latest version: 1.0.2

### MidwayJS-MinIO

用于在MidwayJS项目中快捷访问MinIO，支持多客户端连接。

#### 安装使用

```bash
$ npm install minio @feng-j/midwayjs-minio
```

在configuration中引入minIO

```ts
import * as minIO from '@feng-j/midwayjs-minio';
// ......

@Configuration({
  imports: [
    // ......
    minIO,
  ],
  importConfigs: [join(__dirname, './config')],
})
export class MainConfiguration {
  @App('koa')
  app: koa.Application;

  async onReady() {
    this.app.useMiddleware([ReportMiddleware]);
  }
}
```

在配置文件中添加minIO相关的配置

```ts
export default {
  // ......
  minIO: {
    client: {
      endPoint: 'play.min.io',
      port: 9000,
      useSSL: true,
      accessKey: 'Q3AM3UQ867SPQQA43P2F',
      secretKey: 'zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG',
    },
  },
} as MidwayConfig;
```

然后就可以通过Inject来注入MinIOService了

```ts
import { Inject, Controller, Get, Query } from '@midwayjs/core';
import { Context } from '@midwayjs/koa';
import { UserService } from '../service/user.service';
import { MinIOService } from '@feng-j/midwayjs-minio';

@Controller('/api')
export class APIController {
  @Inject()
  ctx: Context;

  @Inject()
  userService: UserService;

  @Inject()
  minIOService: MinIOService;

  @Get('/get_user')
  async getUser(@Query('uid') uid) {
    const user = await this.userService.getUser({ uid });
    return { success: true, message: 'OK', data: user };
  }

  @Get('/buckets')
  async getBuckets() {
    return {
      success: true,
      message: 'OK',
      data: await this.minIOService.listBuckets(),
    };
  }
}
```

启动开发服务器`npm run dev`，使用浏览器访问http://127.0.0.1:7001/api/buckets查看效果。

更多方法可以见[MinIO SDK文档](https://minio.org.cn/docs/minio/linux/developers/javascript/API.html)



#### 多客户端连接

在配置中配置多个client即可

```ts
export default {
  // ......
	minIO: {
    clients: {
      bucket1: {
        endPoint: 'play.min.io',
        port: 9000,
        useSSL: true,
        accessKey: 'Q3AM3UQ867SPQQA43P2F',
        secretKey: 'zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG',
      },
      bucket2: {
        endPoint: 'play.min.io',
        port: 9000,
        useSSL: true,
        accessKey: 'Q3AM3UQ867SPQQA43P2F',
        secretKey: 'zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG',
      },
    },
  },
} as MidwayConfig; 
```

通过工厂类获取具体的client

```ts
import { Inject, Controller, Get, Param } from '@midwayjs/core';
import { Context } from '@midwayjs/koa';
import { MinIOServiceFactory } from '@feng-j/midwayjs-minio';

@Controller('/api')
export class APIController {
  @Inject()
  ctx: Context;


  @Inject()
  minIOServiceFactory: MinIOServiceFactory;

  @Get('/buckets/:bucketName')
  async getBucket(@Param('bucketName') bucketName: string) {
    const bucket = this.minIOServiceFactory.get(bucketName);
    return {
      success: true,
      message: 'OK',
      data: await bucket.listBuckets(),
    };
  }
}
```
npm package: @feng3d/bezier
Description: 解决n次Bézier曲线拟合与求解问题
Author: feng
Latest version: 0.8.2

### Bézier曲线
https://wardenfeng.github.io/bezier

创建该库的原始目的是为了解决feng3d引擎粒子中时间与常量的变化曲线问题。

制作Bézier曲线这个库忙了整整3天了，感觉要跳进高等代数的坑了，得赶紧爬出这个坑，这坑太深了，以后再来跳。

说了不陷入，结果又制作了 EquationSolving.ts 提供了方程求解功能。

#### 核心文件
1. Bezier.ts  Bézier曲线

##### Bezier.ts
解决任意Bézier曲线的求值求导获取极值等问题。
1. 1次Bézier曲线 
    * 求值 ``` bezier.linear ```
    * 导数 ``` bezier.linearDerivative ```
    * 二阶导数 ``` bezier.linearSecondDerivative ```
1. 2次Bézier曲线 
    * 求值 ``` bezier.quadratic ```
    * 导数 ``` bezier.quadraticDerivative ```
    * 二阶导数 ``` bezier.quadraticSecondDerivative ```
1. 3次Bézier曲线 
    * 求值 ``` bezier.cubic ```
    * 导数 ``` bezier.cubicDerivative ```
    * 二阶导数 ``` bezier.cubicSecondDerivative ```
1. n次Bézier曲线的值  n > 0
    * 求值 ``` bezier.getValue ```
    * 导数 ``` bezier.getDerivative ```
    * 二阶导数 ``` bezier.getSecondDerivative ```
    * N阶导数 ``` bezier.bnND ```
1. n次Bézier曲线的极值列表 ``` bezier.getExtremums ```
1. n次Bézier曲线的区间列表 ``` bezier.getMonotoneIntervals ```
1. 查找区间内极值列表 ```  bezier.getExtremums ```
1. 获取目标值所在的插值度T ```  bezier.getTFromValue ```
1. 分割曲线，在曲线插值度t位置分割为两条连接起来与原曲线完全重合的曲线 ``` bezier.split ```
1. 合并曲线，合并两条连接的曲线为一条曲线并且可以还原为分割前的曲线 ``` bezier.merge ```

##### EquationSolving.ts
解决任意一元函数求导以及方程求解等问题。
1. 获取近似导函数 f'(x) ``` equationSolving.getDerivative ```
1. 二分法 求解 f(x) == 0 ``` equationSolving.binary ```
1. 连线法 求解 f(x) == 0 ``` equationSolving.line ```
1. 切线法 求解 f(x) == 0 ``` equationSolving.tangent ```
1. 割线法（弦截法） 求解 f(x) == 0 ``` equationSolving.secant ```

#### 示例
##### 使用BezierCurve进行模拟canvas提供的 bezierCurveTo方法

[quickstart website](examples/BezierCurveTo.html ':include :type=iframe width=100% height=400px')

##### 随机生成n阶Bézier曲线并且播放插值动画

[quickstart website](examples/BezierCurveAnimation.html ':include :type=iframe width=100% height=400px')

##### Bézier曲线编辑器

[quickstart website](examples/BezierEditor.html ':include :type=iframe width=100% height=400px')

##### 连续三阶Bézier曲线编辑

[quickstart website](examples/CubicBezierSequenceEditor.html ':include :type=iframe width=100% height=400px')

##### 基于时间轴的连续三阶Bézier曲线编辑

该示例已经满足feng3d中曲线编辑器的需求。

[quickstart website](examples/TimeLineCubicBezierSequenceEditor.html ':include :type=iframe width=100% height=400px')

#### 单元测试

[quickstart website](tests/index.html ':include :type=iframe width=100% height=400px')

#### 参考资料
1. https://en.wikipedia.org/wiki/B%C3%A9zier_curve
1. https://baike.baidu.com/item/%E8%B4%9D%E5%A1%9E%E5%B0%94%E6%9B%B2%E7%BA%BF/1091769
1. https://blog.csdn.net/venshine/article/details/51750906
1. https://github.com/venshine/BezierMaker
1. https://github.com/gre/bezier-easing
1. https://github.com/vrk/beziertool
1. https://github.com/gre/bezier-easing-editor
1. 高等数学 第七版上册 第三章第八节 方程的近似解

#### 关于作者

网站：http://feng3d.com/

github：https://github.com/wardenfeng

github：https://github.com/feng3d-labs

getee：https://gitee.com/feng3d

feng3d交流QQ群:519732759
npm package: @feng3d/bezier-test
Description: 解决n次Bézier曲线拟合与求解问题
Author: feng
Latest version: 0.0.3

### Bézier曲线
https://wardenfeng.github.io/bezier

创建该库的原始目的是为了解决feng3d引擎粒子中时间与常量的变化曲线问题。

制作Bézier曲线这个库忙了整整3天了，感觉要跳进高等代数的坑了，得赶紧爬出这个坑，这坑太深了，以后再来跳。

说了不陷入，结果又制作了 EquationSolving.ts 提供了方程求解功能。

#### 核心文件
1. Bezier.ts  Bézier曲线

##### Bezier.ts
解决任意Bézier曲线的求值求导获取极值等问题。
1. 1次Bézier曲线 
    * 求值 ``` bezier.linear ```
    * 导数 ``` bezier.linearDerivative ```
    * 二阶导数 ``` bezier.linearSecondDerivative ```
1. 2次Bézier曲线 
    * 求值 ``` bezier.quadratic ```
    * 导数 ``` bezier.quadraticDerivative ```
    * 二阶导数 ``` bezier.quadraticSecondDerivative ```
1. 3次Bézier曲线 
    * 求值 ``` bezier.cubic ```
    * 导数 ``` bezier.cubicDerivative ```
    * 二阶导数 ``` bezier.cubicSecondDerivative ```
1. n次Bézier曲线的值  n > 0
    * 求值 ``` bezier.getValue ```
    * 导数 ``` bezier.getDerivative ```
    * 二阶导数 ``` bezier.getSecondDerivative ```
    * N阶导数 ``` bezier.bnND ```
1. n次Bézier曲线的极值列表 ``` bezier.getExtremums ```
1. n次Bézier曲线的区间列表 ``` bezier.getMonotoneIntervals ```
1. 查找区间内极值列表 ```  bezier.getExtremums ```
1. 获取目标值所在的插值度T ```  bezier.getTFromValue ```
1. 分割曲线，在曲线插值度t位置分割为两条连接起来与原曲线完全重合的曲线 ``` bezier.split ```
1. 合并曲线，合并两条连接的曲线为一条曲线并且可以还原为分割前的曲线 ``` bezier.merge ```

##### EquationSolving.ts
解决任意一元函数求导以及方程求解等问题。
1. 获取近似导函数 f'(x) ``` equationSolving.getDerivative ```
1. 二分法 求解 f(x) == 0 ``` equationSolving.binary ```
1. 连线法 求解 f(x) == 0 ``` equationSolving.line ```
1. 切线法 求解 f(x) == 0 ``` equationSolving.tangent ```
1. 割线法（弦截法） 求解 f(x) == 0 ``` equationSolving.secant ```

#### 示例
##### 使用BezierCurve进行模拟canvas提供的 bezierCurveTo方法

[quickstart website](examples/BezierCurveTo.html ':include :type=iframe width=100% height=400px')

##### 随机生成n阶Bézier曲线并且播放插值动画

[quickstart website](examples/BezierCurveAnimation.html ':include :type=iframe width=100% height=400px')

##### Bézier曲线编辑器

[quickstart website](examples/BezierEditor.html ':include :type=iframe width=100% height=400px')

##### 连续三阶Bézier曲线编辑

[quickstart website](examples/CubicBezierSequenceEditor.html ':include :type=iframe width=100% height=400px')

##### 基于时间轴的连续三阶Bézier曲线编辑

该示例已经满足feng3d中曲线编辑器的需求。

[quickstart website](examples/TimeLineCubicBezierSequenceEditor.html ':include :type=iframe width=100% height=400px')

#### 单元测试

[quickstart website](tests/index.html ':include :type=iframe width=100% height=400px')

#### 参考资料
1. https://en.wikipedia.org/wiki/B%C3%A9zier_curve
1. https://baike.baidu.com/item/%E8%B4%9D%E5%A1%9E%E5%B0%94%E6%9B%B2%E7%BA%BF/1091769
1. https://blog.csdn.net/venshine/article/details/51750906
1. https://github.com/venshine/BezierMaker
1. https://github.com/gre/bezier-easing
1. https://github.com/vrk/beziertool
1. https://github.com/gre/bezier-easing-editor
1. 高等数学 第七版上册 第三章第八节 方程的近似解

#### 关于作者

网站：http://feng3d.com/

github：https://github.com/wardenfeng

github：https://github.com/feng3d-labs

getee：https://gitee.com/feng3d

feng3d交流QQ群:519732759