open-index/open-npm huggingface dataset:
npm package: @kuyoonjo/objectid
Description: ## Rust
Author: kuyoonjo
Latest version: 0.1.0

# Usage

## Rust

```rust
use bson_objectid::oid;

let id = oid();
println!("id: {}", id);
```

## TypeScript

```ts
import { oid } from '@kuyoonjo/objectid';

const id = oid();
console.log(id);
```
npm package: @kuyoonjo/tauri-plugin-mqtt
Description: This plugin only works with Tauri 2.x only.
Author: kuyoonjo
Latest version: 0.1.0

# tauri-plugin-mqtt

This plugin only works with Tauri 2.x only.

## Install

```bash
cargo add tauri-plugin-mqtt
```
```bash
npm i @kuyoonjo/tauri-plugin-mqtt
```

## Usage

### rust
```rust

tauri::Builder::default()
    .plugin(tauri_plugin_tcp::init())
    ...
```

### javascript
```javascript
import { connect, disconnect, publish, subscribe, unsubscribe } from "@kuyoonjo/tauri-plugin-mqtt";

// Server side
const id = 'unique-id';
await connect(id, 'mqtt://test.mosquitto.org');
await disconnect(id);
let topic = '/tauri-plugin-mqtt';
await subscribe(id, topic, 0);
await publish(id, topic, 0, false, 'hello');
await listen((x) => {
  console.log(x.payload);
});
await unsubscribe(id, topic);
await disconnect(id);
```
#### Functions
```typescript
export async function publish(
  id: string,
  topic: String,
  qos: number,
  retain: boolean,
  payload: string | number[],
);

export async function subscribe(
  id: string,
  topic: String,
  qos: number,
);

export async function unsubscribe(
  id: string,
  topic: String,
);

export async function connect(id: string, uri: string, tlsOptions?: TlsOptions);

export async function disconnect(id: string);

export function listen(handler: EventCallback<Payload>, options?: Options);
```

#### Interfaces

```typescript
export interface TlsOptions {
  skipVerification?: boolean;
  ca?: number[];
  alpn?: number[][];
  client_cert?: number[];
  client_key?: number[];
}

export interface Payload {
  id: string;
  event: {
    connect?: [];
    disconnect?: [];
    message?: {
      dup: boolean;
      qos: 0 | 1 | 2;
      retain: boolean;
      topic: string;
      pkid: number;
      payload: number[];
    };
  };
}
```

### permissions

add `"mqtt:default"` into `"permissions"` list of `src-tauri\capabilities\default.json`

```json
{
  "$schema": "../gen/schemas/desktop-schema.json",
  ...
  "permissions": [
    "core:default",
    ...
    "mqtt:default"
  ]
}
```

## Support

| MacOS | Linux | Windows |
| ----- | ----- | ------- |
| ✅    | ✅    | ✅      |
npm package: @kuyoonjo/tauri-plugin-serialport-api
Description: A tauri plugin developed based on Serialport.
Author: lzhida
Latest version: 0.1.3

# Tauri Plugin serialport

A tauri plugin developed based on Serialport.

# Installation

## RUST

`src-tauri/Cargo.toml`

```toml
tauri-plugin-serialport-v1 = "0.1.0"
```

Use in `src-tauri/src/main.rs`:

```RUST
use tauri_plugin_serialport_v1;

fn main() {
    tauri::Builder::default()
        .plugin(tauri_plugin_serialport_v1::init())
        .build()
        .run();
}
```

## WEBVIEW

npm install @kuyoonjo/tauri-plugin-serialport-api@0.1.0

Use within your JS/TS:

```JS
import { Serialport } from 'tauri-plugin-serialport-api';
```

# API
## SerialportInfo
```ts
export interface SerialportInfo {
  path: string;
  info?: {
    /** Vendor ID */
    vid: number;
    /** Product ID */
    pid: number;
    /** Serial number (arbitrary string) */
    serialNumber?: string;
    /** Manufacturer (arbitrary string) */
    manufacturer?: string;
    /** Product name (arbitrary string) */
    product?: string;
  };
}
```

## SerialportOptions
```ts
export interface SerialportOptions {
    path: string;
    baudRate: number;
    encoding?: string;
    dataBits?: 5 | 6 | 7 | 8;
    flowControl?: null | 'Software' | 'Hardware';
    parity?: null | 'Odd' | 'Even';
    stopBits?: 1 | 2;
    timeout?: number;
    size?: number;
    [key: string]: any;
}
```

## Serialport
```ts
declare class Serialport {
  isOpen: boolean;
  encoding: string;
  size: number;
  constructor(options: SerialportOptions);
  static available_ports(): Promise<SerialportInfo[]>;
  static forceClose(path: string): Promise<void>;
  static closeAll(): Promise<void>;
  open(): Promise<void>;
  close(): Promise<void>;
  write(value: string): Promise<number>;
  writeBinary(value: Uint8Array | number[]): Promise<number>;
  read(options?: ReadOptions): Promise<void>;
  cancelRead(): Promise<void>;
  listen(fn: (data: string) => void, decodeAsString?: true): Promise<void>;
  listen(fn: (data: number[]) => void, decodeAsString: false): Promise<void>;
  cancelListen(): Promise<void>;
  setBaudRate(value: number, maxReopenTries?: number, tryItv?: number): Promise<void>;
  setPath(value: string, maxReopenTries?: number, tryItv?: number): Promise<void>;
  change(options: {
    path?: string;
    baudRate?: number;
}, maxReopenTries?: number, tryItv?: number): Promise<void>;
}
```
npm package: @kuyoonjo/tauri-plugin-tcp
Description: This plugin only works with Tauri 2.x only.
Author: kuyoonjo
Latest version: 0.1.2

# tauri-plugin-tcp

This plugin only works with Tauri 2.x only.

## Install

```bash
cargo add tauri-plugin-tcp
```
```bash
npm i @kuyoonjo/tauri-plugin-tcp
```

## Usage

### rust
```rust

tauri::Builder::default()
    .plugin(tauri_plugin_tcp::init())
    ...
```

### javascript
```javascript
import { connect, disconnect, send, listen } from "@kuyoonjo/tauri-plugin-tcp";

// Server side
const sid = 'unique-server-id';
await bind(sid, '0.0.0.0:8080');
await send(sid, '192.168.1.2:9090', 'hello');
let clientAddr = '';
await listen((x) => {
  console.log(x.payload);
  if (x.payload.id === sid && x.payload.event.connect) {
    clientAddr = x.payload.event.connect;
    await send(sid, 'hello', clientAddr);
  }
});
await unbind(sid);

// Client side
const cid = 'unique-client-id';
await connect(cid, '192.168.0.100:8080');
// Alternatively
// await connectWithBind(cid, '0.0.0.0:9090', '192.168.0.100:8080');
await listen((x) => {
  console.log(x.payload);
  if (x.payload.id === cid && x.payload.event.message) {
    // npm i buffer
    // import { Buffer } from 'buffer';
    let str = Buffer.from(x.payload.event.message.data).toString();
    if (str === 'hello')
      await send(cid, 'world');
  }
});
await disconnect(cid);
```

#### Event Payload Interface
```typescript
export interface Payload {
  id: string;
  event: {
    bind?: string;
    unbind?: [];
    connect?: string;
    disconnect?: string;
    message?: {
      addr: string;
      data: number[];
    };
  };
}
```

### permissions

add `"tcp:default"` into `"permissions"` list of `src-tauri\capabilities\default.json`

```json
{
  "$schema": "../gen/schemas/desktop-schema.json",
  ...
  "permissions": [
    "core:default",
    ...
    "tcp:default"
  ]
}
```

## Support

| MacOS | Linux | Windows | Android |
| ----- | ----- | ------- | ------- |
| ✅    | ✅    | ✅      | ✅     |

## Changelog

### v0.1.2
- Add function `connectWithBind`
- Add Android support
npm package: @kuyoonjo/tauri-plugin-theme-api
Description: Dynamically change Tauri App theme
Latest version: 0.2.0

# tauri-plugin-theme-v1

Dynamically change Tauri App theme

## Install

```bash
cargo add tauri-plugin-theme-v1
```

```rust
use tauri_plugin_theme_v1::ThemePlugin;

let mut ctx = tauri::generate_context!();
tauri::Builder::default()
    // Init plugin and auto restore window theme !!!
    .plugin(ThemePlugin::init(ctx.config_mut()))
    ...
```

## Usage

```javascript
import { getTheme, setTheme, Theme } from "@kuyoonjo/tauri-plugin-theme-api";

await setTheme(Theme.Auto);
await setTheme(Theme.Light);
await setTheme(Theme.Dark);

const theme = await getTheme();

```

```rust
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]

use tauri_plugin_theme_v1::{ThemePlugin, get_theme, set_theme, Theme};
use tauri::{CustomMenuItem, Manager, Menu, Submenu};

fn main() {
    let mut menu = Menu::new();    
    let theme_auto = CustomMenuItem::new("theme_auto".to_string(), "Auto");
    let theme_light = CustomMenuItem::new("theme_light".to_string(), "Light");
    let theme_dark = CustomMenuItem::new("theme_dark".to_string(), "Dark");
    let theme_get = CustomMenuItem::new("theme_get".to_string(), "Get");
    menu = menu
    .add_submenu(Submenu::new(
        "Theme",
        Menu::new()
            .add_item(theme_auto)
            .add_item(theme_light)
            .add_item(theme_dark)
            .add_item(theme_get),
    ));
    let mut ctx = tauri::generate_context!();
    tauri::Builder::default()
        .menu(menu)
        .on_menu_event(|event| match event.menu_item_id() {
            "theme_auto" => {
                let _ = set_theme(event.window().app_handle(), Theme::Auto);
            }
            "theme_light" => {
                let _ = set_theme(event.window().app_handle(), Theme::Light);
            }
            "theme_dark" => {
                let _ = set_theme(event.window().app_handle(), Theme::Dark);
            }
            "theme_get" => {
                let theme = get_theme(event.window().app_handle());
                println!("{:#?}", theme);
            }
            _ => {}
        })
        .plugin(ThemePlugin::init(ctx.config_mut()))
        .run(ctx)
        .expect("error while running tauri application");
}

```

## Support

| MacOS | Linux | Windows |
| ----- | ----- | ------- |
| ✅    | ✅    | ✅      |

## Note
- On `Linux` platform, it has not been extensively tested. If you encounter any issues, please submit an issue.
npm package: @kuyoonjo/tauri-plugin-udp
Description: ## Install
Author: You
Latest version: 0.1.1

# tauri-plugin-udp

## Install

```bash
cargo add tauri-plugin-udp
```

```rust

tauri::Builder::default()
    .plugin(tauri_plugin_udp::init())
    ...
```

## Usage

```javascript
import { bind, send } from "@kuyoonjo/tauri-plugin-udp";
import { listen } from "@tauri-apps/api/event";

const id = 'unique-id';
await bind(id, '0.0.0.0:8080');
await send(id, '192.168.1.2:9090', 'hello');
await unbind(id);

await listen("plugin://udp", (x) => console.log(x.payload));

```

## Support

| MacOS | Linux | Windows |
| ----- | ----- | ------- |
| ✅    | ✅    | ✅      |