open-index/open-npm huggingface dataset:
npm package: @ns8/magento2-rest-client
Description: REST client for accessing Magento 2 functionality.
Author: NS8, Inc
Latest version: 0.2.29

# Magento2 REST client

This Node.js library enables JavaScript applications to communicate with Magento2 sites using their REST API.
This module based on [magento2-rest-client](https://github.com/DivanteLtd/magento2-rest-client), which is in turn based on the `magento2-rest-client` module created by Marko Novak (2016).

This module is used by the NS8 Protect Magento extension. It is safe for production use, but **NOTE: the library is not finished yet! Only a subset of Magento2 API is currently implemented. Not all methods are fully documented, and not all return types are fully typed.**

## Installation

The library can be installed using the Npm package manager:

```shell
yarn add @ns8/magento2-rest-client
```

## Usage

The code sample below shows the usage of the library:

```typescript
import { RestClient } from '@ns8/magento2-rest-client';

const options = {
  url: 'http://www.test.com/index.php/rest',
  consumerKey: '<OAuth 1.0a consumer key>',
  consumerSecret: '<OAuth 1.0a consumer secret>',
  accessToken: '<OAuth 1.0a access token>',
  accessTokenSecret: '<OAuth 1.0a access token secret>'
};
const client = new RestClient(options);
client.categories.list().then( (categories) => {
  assert.equal(categories.parentId, 1);
});
```

TODO: Allow extending the API by adding your own modules or adding methods to the existing modules!

## Contributing

Create issues or submit PRs to extend existing API support or add new functionality. All contributions are welcome.

### usefull resources

* Magento API with Swagger: https://devdocs.magento.com/swagger/
* Admin API Documentation of Magento: https://devdocs.magento.com/redoc/2.3/admin-rest-api.html
* Filtered responses: https://devdocs.magento.com/guides/v2.3/rest/retrieve-filtered-responses.html
npm package: @ns8/ns8-switchboard-operator
Description: Operator project contains switchboard interfaces and orchestration code
Author: ns8inc
Latest version: 1.0.152

# ns8-switchboard-operator #
Contains all switchboard orchestration and interfaces.  All other switchboard repos require this project as a dependency.

## Install ##
- `yarn`

## Create a linked working build ##
Running `yarn build:dev` will automatically build and link a local working copy of the operators.  You can 
then use them in another project by running `yarn link @ns8/ns8-switchboard-operator` from the root of the other project.
npm package: @ns8/switchboard-project-support
Description: Local Development Support NS8 Switchboard Projects
Author: Adam Rogas
Latest version: 3.0.193

# NS8 SwitchBoard<sup>tm</sup> Project Support Tools

[![CircleCI](https://circleci.com/gh/ns8inc/ns8-switchboard-project-support/tree/master.svg?style=svg&circle-token=c58989a64bfe4294b62465a0d7eea4f0629b9a3e)](https://circleci.com/gh/ns8inc/ns8-switchboard-project-support/tree/master)

This project contains the helper pieces for the development of switchboard projects.
npm package: @ns84/dotenv
Description: Loads environment variables from a file
Author: Jordan Tucker
Latest version: 1.0.0

# @ns84/dotenv

Loads the environment variables from a .env file into `process.env`.

By default, it loads a file named `.env` in the current working directory. To
load a specific .env file, specify its path.

This function works exactly like `process.loadEnvFile` except that it does not
throw an error if the file doesn't exist.

For information on the format for .env files, see
[DotEnv](https://nodejs.org/docs/latest-v25.x/api/environment_variables.html#dotenv).

## Installation

```bash
npm install @ns84/dotenv
```

## Usage

```js
import { dotenv } from "@ns84/dotenv";

// Load environment variables from a file named `.env` (the default filename).
dotenv();

// Load environment variables from a file named `dev.env`.
dotenv("dev.env");

// Unlike `process.loadEnvFile` if the file doesn't exist, no error is thrown.
dotenv("fake.env");
```
npm package: @nsaichandra/oe-common-utils
Description: A well defined useful set of utils on oe-apps packed as a pluggable app-module.
Author: Sai Chandra Nandana
Latest version: 0.0.28

# oe-common-utils
A well defined useful set of customizations on oe-apps packed as a pluggable module.

# Gcloud logging
To enable/disable streaming of logs to google cloud logging service when app depoyed in Google App Engine.
set environment variables as below:
ENABLE_GCLOUD_LOGGING=true
ENABLE_GCLOUD_LOGGING_LVL=info

# CachingMixinNSC
A mixin to enable caching on any model connected to mongodb via oe-connector-mongodb. Supports caching by node-cache module as of today (Read through cache).

```
 "mixins": {
    "CachingMixinNSC": {
      "cacheModule": "node-cache", //default is node-cache
      "stdTTL": 300,
      "checkperiod": 300,
      "useClones": false,
      "deleteOnExpire": true,
      "maxKeys": 100
    }
  }
```
npm package: @nsalaun/ng2-logger
Description: Angular 2 logger service
Author: Noémi Salaün
Latest version: 1.0.2-deprecated

# Deprecated Angular 2 logger

With the release of Angular 4, I chose to rename this package [**@nsalaun/ng-logger**](https://www.npmjs.com/package/@nsalaun/ng2-logger).

This package will no longer be updated.

The GitHub repository has been rename to [**noemi-salaun/ng-logger**](https://github.com/noemi-salaun/ng-logger).
npm package: @nsc-earth-2/common
Description: - `Widget` is a base class that you can extend to create your own widgets. You can import it into your project: - `DomUtil` is a utility class that provides some DOM manipulation methods.   [中文 Readme](./README_CN.md)
Latest version: 1.0.8

# @nsc-earth-2/common

- `Widget` is a base class that you can extend to create your own widgets. You can import it into your project:
- `DomUtil` is a utility class that provides some DOM manipulation methods.
  [中文 Readme](./README_CN.md)

## Installation

```bash
npm install --save @nsc-earth-2/common
```

## Usage

```javascript
import { Widget, DomUtil } from "@nsc-earth-2/common";
```

## Widget

`Widget` is a base class for widgets based on Cesium applications. It provides some common widget manipulation methods and properties.

### API

#### `constructor(viewer: Cesium.Viewer, wrapper: HTMLElement)`

Creates a new instance of the `Widget` class and attaches it to the specified Cesium Viewer.

##### Parameters

- `viewer`: The Cesium Viewer instance to attach the widget to.
- `wrapper`: The DOM element to mount the widget to.

#### `enabled`

A boolean property that controls whether the widget is enabled or not.

#### `ready`

A boolean property indicating whether the widget is ready or not.

#### `setContent(content: string | Element): Widget`

A method for setting the content of the widget.

##### Parameters

- `content`: A string or DOM element representing the content to set.

#### `hide()`

A method for hiding the widget.

#### `show()`

A method for showing the widget.

#### `destroy()`

A method for destroying the widget.

## DomUtil

`DomUtil` is a utility class that provides some DOM manipulation methods.

### API

#### `create(tagName: string, className: string, container: Element | null = null): HTMLElement`

Creates an HTML element with the specified `tagName`, sets its class to `className`, and optionally appends it to the `container` element.

##### Parameters

- `tagName`: The HTML tag name to create.
- `className`: The class name to set on the HTML element.
- `container` (optional): The container element to append the new element to.

#### `parseDom(domStr: string, className: string): HTMLDivElement`

Parses a string into a DOM element and returns a DIV element containing the element.

##### Parameters

- `domStr`: The string to parse.
- `className`: The class name to set on the DIV element.
npm package: @nsc-earth-2/compass
Description: A compass widget for [Cesium](https://cesium.com/) based on [@nsc-earth-2/common](https://www.npmjs.com/package/@nsc-earth-2/common) library. [中文 Readme](./README_CN.md)
Latest version: 1.1.8

# @nsc-earth-2/compass

A compass widget for [Cesium](https://cesium.com/) based on [@nsc-earth-2/common](https://www.npmjs.com/package/@nsc-earth-2/common) library.
[中文 Readme](./README_CN.md)

## Installation

```bash
npm install @nsc-earth-2/compass
```

## Usage

The `Compass` widget can be used in a Cesium app to display a compass. To use the widget, first import it into your project:

```javascript
import Compass from "@nsc-earth-2/compass";
```

Next, create a new instance of the widget and pass it your Cesium Viewer instance:

```javascript
const viewer = new Cesium.Viewer("cesiumContainer");
const compass = new Compass(viewer);
```

You can also customize the widget by passing an options object when creating a new instance:

```javascript
const compass = new Compass(viewer, {
  container: document.getElementById("compass-container"),
  tips: {
    inner: "North",
    outer: "Rotate",
  },
});
```

## API

### `constructor(viewer: Cesium.Viewer, options?: CompassOptions)`

Creates a new instance of the `Compass` widget attached to the specified Cesium Viewer.

#### Parameters

- `viewer`: The Cesium Viewer instance to attach the widget to.
- `options` (optional): An object containing optional parameters for the widget.

#### `enabled`

A boolean property that controls whether the widget is enabled or not.

#### `ready`

A boolean property indicating whether the widget is ready or not.

### `hide()`

A method for hiding the widget.

### `show()`

A method for showing the widget.

### `destroy(): void`

Mounts the content of the widget.

## Options

The following options can be passed when creating a new instance of the `Compass` widget:

- `container` (optional): The DOM element to mount the widget to. Defaults to `viewer.container`.
- `tips` (optional): An object containing strings for the inner and outer tips of the compass. Defaults to `{ inner: '', outer: 'Drag outer ring: rotate view.\nDrag inner gyroscope: free orbit.\nDouble-click: reset view.\nTIP: You can also free orbit by holding the CTRL key and dragging the map.' }`.
npm package: @nsc-earth-2/geojson-render
Description: Load geojson on cesium with deep custom style
Latest version: 1.0.15

# GeoJSON Render

A Cesium plugin for rendering GeoJSON data.

## Installation

```bash
npm install @nsc-earth-2/geojson-render
```

## Usage

Please read the documentation website for more information.

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
npm package: @nsc-earth-2/gim
Description: - `Widget` is a base class that you can extend to create your own widgets. You can import it into your project: - `DomUtil` is a utility class that provides some DOM manipulation methods.   [中文 Readme](./README_CN.md)
Latest version: 1.0.24

# @nsc-earth-2/common

- `Widget` is a base class that you can extend to create your own widgets. You can import it into your project:
- `DomUtil` is a utility class that provides some DOM manipulation methods.
  [中文 Readme](./README_CN.md)

## Installation

```bash
npm install --save @nsc-earth-2/common
```

## Usage

```javascript
import { Widget, DomUtil } from "@nsc-earth-2/common";
```

## Widget

`Widget` is a base class for widgets based on Cesium applications. It provides some common widget manipulation methods and properties.

### API

#### `constructor(viewer: Cesium.Viewer, wrapper: HTMLElement)`

Creates a new instance of the `Widget` class and attaches it to the specified Cesium Viewer.

##### Parameters

- `viewer`: The Cesium Viewer instance to attach the widget to.
- `wrapper`: The DOM element to mount the widget to.

#### `enabled`

A boolean property that controls whether the widget is enabled or not.

#### `ready`

A boolean property indicating whether the widget is ready or not.

#### `setContent(content: string | Element): Widget`

A method for setting the content of the widget.

##### Parameters

- `content`: A string or DOM element representing the content to set.

#### `hide()`

A method for hiding the widget.

#### `show()`

A method for showing the widget.

#### `destroy()`

A method for destroying the widget.

## DomUtil

`DomUtil` is a utility class that provides some DOM manipulation methods.

### API

#### `create(tagName: string, className: string, container: Element | null = null): HTMLElement`

Creates an HTML element with the specified `tagName`, sets its class to `className`, and optionally appends it to the `container` element.

##### Parameters

- `tagName`: The HTML tag name to create.
- `className`: The class name to set on the HTML element.
- `container` (optional): The container element to append the new element to.

#### `parseDom(domStr: string, className: string): HTMLDivElement`

Parses a string into a DOM element and returns a DIV element containing the element.

##### Parameters

- `domStr`: The string to parse.
- `className`: The class name to set on the DIV element.
npm package: @nsc-earth-2/nsc-model
Description: - `Widget` is a base class that you can extend to create your own widgets. You can import it into your project: - `DomUtil` is a utility class that provides some DOM manipulation methods.   [中文 Readme](./README_CN.md)
Latest version: 1.0.10

# @nsc-earth-2/common

- `Widget` is a base class that you can extend to create your own widgets. You can import it into your project:
- `DomUtil` is a utility class that provides some DOM manipulation methods.
  [中文 Readme](./README_CN.md)

## Installation

```bash
npm install --save @nsc-earth-2/common
```

## Usage

```javascript
import { Widget, DomUtil } from "@nsc-earth-2/common";
```

## Widget

`Widget` is a base class for widgets based on Cesium applications. It provides some common widget manipulation methods and properties.

### API

#### `constructor(viewer: Cesium.Viewer, wrapper: HTMLElement)`

Creates a new instance of the `Widget` class and attaches it to the specified Cesium Viewer.

##### Parameters

- `viewer`: The Cesium Viewer instance to attach the widget to.
- `wrapper`: The DOM element to mount the widget to.

#### `enabled`

A boolean property that controls whether the widget is enabled or not.

#### `ready`

A boolean property indicating whether the widget is ready or not.

#### `setContent(content: string | Element): Widget`

A method for setting the content of the widget.

##### Parameters

- `content`: A string or DOM element representing the content to set.

#### `hide()`

A method for hiding the widget.

#### `show()`

A method for showing the widget.

#### `destroy()`

A method for destroying the widget.

## DomUtil

`DomUtil` is a utility class that provides some DOM manipulation methods.

### API

#### `create(tagName: string, className: string, container: Element | null = null): HTMLElement`

Creates an HTML element with the specified `tagName`, sets its class to `className`, and optionally appends it to the `container` element.

##### Parameters

- `tagName`: The HTML tag name to create.
- `className`: The class name to set on the HTML element.
- `container` (optional): The container element to append the new element to.

#### `parseDom(domStr: string, className: string): HTMLDivElement`

Parses a string into a DOM element and returns a DIV element containing the element.

##### Parameters

- `domStr`: The string to parse.
- `className`: The class name to set on the DIV element.
npm package: @nsc-earth-2/popup
Description: A lightweight and easy-to-use popup component for CesiumJS. [中文 Readme](./README_CN.md)
Latest version: 1.0.4

# @nsc-earth-2/popup

A lightweight and easy-to-use popup component for CesiumJS.
[中文 Readme](./README_CN.md)

## Installation

To install `@nsc-earth-2/popup`, run:

```bash
npm install @nsc-earth-2/popup
```

## Usage

Here's an example of how to use `@nsc-earth-2/popup`:

```javascript
import Popup from "@nsc-earth-2/popup";
import { Viewer } from "cesium";

const viewer = new Viewer("cesiumContainer");

const options = {
  position: [120, 30, 0],
  element: document.getElementById("popup"),
  offset: [10, 10],
};

const popup = new Popup(viewer, options);

// Update the popup's position
popup.position = [121, 31, 0];

// Destroy the popup
popup.destroy();
```

### PopupOptions

The `PopupOptions` interface has the following properties:

- `position`: The position of the popup, specified as an array of `[longitude, latitude, height]`. If `null`, the popup will be hidden.
- `element`: The HTML element that represents the popup.
- `offset` (optional): An array of `[xOffset, yOffset]` that specifies the offset of the popup from its position.

### Properties

- `position`: Gets or sets the position of the popup.
- `destroyed`: Indicates whether the popup has been destroyed.

### Methods

- `switchElementShow(val: boolean)`: Shows or hides the popup.
- `setPosition()`: Updates the position of the popup.
- `destroy()`: Destroys the popup, removing any event listeners and cleaning up resources.
npm package: @nsc-earth-2/primitive-geojson
Description: A faster method to load geojson on cesium by primitive
Latest version: 1.0.11

## @nsc-earth-2/primitive-geojson

@nsc-earth-2/primitive-geojson is a JavaScript library based on Cesium that parses GeoJSON and TopoJSON data into visualizable Cesium entities, including points, lines, polygons, labels, etc. It can be installed as an npm package and used directly in Cesium projects.
[中文 Readme](./README_CN.md)

### Installation

Install using npm:

```
npm install @nsc-earth-2/primitive-geojson
```

### Usage

To use @nsc-earth-2/primitive-geojson in your project, simply import it like any other module:

```javascript
import { GeoJsonPrimitiveLayer } from "@nsc-earth-2/primitive-geojson";
```

Then create a new instance of the `GeoJsonPrimitiveLayer` class and load your GeoJSON data:

```javascript
const layer = new GeoJsonPrimitiveLayer();
layer.load("path/to/data.json").then(() => {
  // Do something when the data is loaded
});
```

See the API documentation for more details on usage and available options.
npm package: @nsc-earth-2/primitive-layer
Description: A faster method to load geojson on cesium by primitive
Latest version: 1.0.18

## @nsc-earth-2/primitive-geojson

@nsc-earth-2/primitive-layer is a JavaScript library based on Cesium that parses GeoJSON and TopoJSON data into visualizable Cesium entities, including points, lines, polygons, labels, etc. It can be installed as an npm package and used directly in Cesium projects.
[中文 Readme](./README_CN.md)

### Installation

Install using npm:

```
npm install @nsc-earth-2/primitive-geojson
```

### Usage

To use @nsc-earth-2/primitive-geojson in your project, simply import it like any other module:

```javascript
import { GroundPrimitiveLayer,PrimitiveLayer } from "@nsc-earth-2/primitive-layer";
```

Then create a new instance of the `GeoJsonPrimitiveLayer` class and load your GeoJSON data:

```javascript
const layer = new GroundPrimitiveLayer();
layer.load("path/to/data.json").then(() => {
  // Do something when the data is loaded
});
```

See the API documentation for more details on usage and available options.
npm package: @nsc-earth-2/sync-viewer
Description: `@nsc-earth-2/sync-viewer` is an npm package for synchronizing two Cesium Viewer instances. [中文 Readme](./README_CN.md)
Latest version: 1.0.4

# @nsc-earth-2/sync-viewer

`@nsc-earth-2/sync-viewer` is an npm package for synchronizing two Cesium Viewer instances.
[中文 Readme](./README_CN.md)

## Installation

```bash
npm install @nsc-earth-2/sync-viewer
```

## Usage

```js
import { Viewer } from "cesium";
import SyncViewer from "@nsc-earth-2/sync-viewer";

const leftViewer = new Viewer("left-container");
const rightViewer = new Viewer("right-container");

const syncViewer = new SyncViewer(leftViewer, rightViewer);

// Destroy
syncViewer.destroy();
```

## API

### `SyncViewProps`

| Property Name     | Type     | Description                                                  |
| ----------------- | -------- | ------------------------------------------------------------ |
| percentageChanged | `number` | The percentage of distance changed when the camera zooms in. |

### `SyncViewer`

#### Constructor

```ts
constructor(leftViewer: Viewer, rightViewer: Viewer, options?: SyncViewProps)
```

- `leftViewer`: A Cesium Viewer instance on the left.
- `rightViewer`: A Cesium Viewer instance on the right.
- `options` (optional): An object containing options:
  - `percentageChanged`: The percentage of distance changed when the camera zooms in, default to `0.01`.

#### Methods

##### `start()`

Start synchronizing the views of the left and right viewers.

```ts
start(): void
```

##### `destroy()`

Destroy the instance and unsynchronize the views of the left and right viewers.

```ts
destroy(): void
```

#### Properties

##### `synchronous`

Get or set whether to synchronize the views.

```ts
synchronous: boolean;
```

##### `isDestory`

Get whether the instance has been destroyed.

```ts
get isDestory(): boolean
```

#### Events

##### `leftChangeEvent()`

Triggered when the view of the left viewer changes, used to synchronize the view of the right viewer.

##### `rightChangeEvent()`

Triggered when the view of the right viewer changes, used to synchronize the view of the left viewer.
npm package: @nsc-earth-2/tooltip
Description: `@nsc-earth-2/tooltip` 是一个基于 [Cesium](https://cesium.com/) 对象实现的 tooltip 组件，支持自定义内容。包含两个类：`Tooltip` 和 `MouseTooltip`。
Latest version: 1.2.10

# @nsc-earth-2/tooltip

`@nsc-earth-2/tooltip` 是一个基于 [Cesium](https://cesium.com/) 对象实现的 tooltip 组件，支持自定义内容。包含两个类：`Tooltip` 和 `MouseTooltip`。

`MouseTooltip` 会创建一个跟随鼠标移动的 tooltip.

## 安装

```bash
npm install @nsc-earth-2/tooltip
```

## 使用

### Tooltip

用法示例：

```javascript
import { Cartesian2, Viewer } from "cesium";
import { Tooltip } from "@nsc-earth-2/tooltip";

const viewer = new Viewer("cesiumContainer");
const tooltip = new Tooltip(viewer, {
  offset: [10, -10],
  content: "Hello, World!",
});

tooltip.content = "Philadelphia";

// 显示（添加content后默认显示）
tooltip.show();
// 隐藏
tooltip.hide();

// 销毁 Tooltip
tooltip.destroy();
```

#### Options

`Tooltip` 类接受以下 options：

| 名称    | 类型                  | 默认值   | 描述                                   |
| ------- | --------------------- | -------- | -------------------------------------- |
| offset  | Tuple `[x, y]`        | `[0, 0]` | Tooltip 相对于鼠标或实体的位置偏移量   |
| content | `string` 或 `Element` | `''`     | Tooltip 的内容，可以是文本或 HTML 元素 |

#### 方法

##### showAt(windowPosition: Cartesian2, content: string | Element): Tooltip

显示 Tooltip。接受两个参数：

- `windowPosition`：`Cartesian2` 类型，tooltip 在屏幕上的位置
- `content`：`string` 或 `Element` 类型，tooltip 的内容

返回值为 `Tooltip` 实例。

##### hide(): Tooltip

隐藏 Tooltip。

返回值为 `Tooltip` 实例。

### MouseTooltip

用法示例：

```javascript
import { Viewer } from "cesium";
import { MouseTooltip } from "@nsc-earth-2/tooltip";

const viewer = new Viewer("cesiumContainer");
const mouseTooltip = new MouseTooltip(viewer, {
  offset: [10, -10],
});

mouseTooltip.content = "Philadelphia";

// 显示（添加content后默认显示）
mouseTooltip.show();
// 隐藏
mouseTooltip.hide();

// 销毁 MouseTooltip
mouseTooltip.destroy();
```

#### Options

`MouseTooltip` 类继承自 `Tooltip`，接受相同的 options。

#### 方法

##### show(): void

显示 MouseTooltip。

##### hide(): void

隐藏 MouseTooltip。

##### destroy(): void

销毁 MouseTooltip。
npm package: @nsc-earth-2/zoom-control
Description: A zoom controller widget for Cesium, which is an npm package that can be used with [Cesium](https://cesium.com/). [中文 Readme](./README_CN.md)
Latest version: 1.1.8

# @nsc-earth-2/zoom-control

A zoom controller widget for Cesium, which is an npm package that can be used with [Cesium](https://cesium.com/).
[中文 Readme](./README_CN.md)

## Features

- Zoom in, Zoom out and Reset zoom functionality.

## Installation

Install it via npm:

```bash
npm install @nsc-earth-2/zoom-control
```

## Usage

### Importing the module

```javascript
import ZoomController from "@nsc-earth-2/zoom-control";
```

### Creating an instance of the widget

```javascript
const viewer = new Cesium.Viewer("cesiumContainer");
const zoomController = new ZoomController(viewer, {
  container: document.getElementById("myContainer"),
  home: new Cesium.Cartesian3.fromDegrees(-98.57, 39.82, 5000000),
});
```

The constructor of `ZoomController` takes two arguments:

- `viewer`: A required parameter representing the instance of the Cesium Viewer.
- `options`: An optional object containing following properties:
  - `container`: An optional property representing the HTML element where the widget needs to be added to.
  - `home`: An optional property representing the Cartesian3 position to which the camera should fly back when reset zoom button is clicked.
  - `tips`: An optional property representing an object containing text messages to display as tooltip for the buttons.Defaults to `{ zoomIn: 'Zoom In', zoomOut: 'Zoom Out', refresh: 'Reset Zoom' }`

### Using the widget methods

Once you have created an instance of `ZoomController`, you can access the following methods:

- `show()`: To show the widget.
- `hide()`: To hide the widget.
- `destroy()`: To destroy the widget.
npm package: @nsc-earth-v2/common
Description: - `Widget` is a base class that you can extend to create your own widgets. You can import it into your project: - `DomUtil` is a utility class that provides some DOM manipulation methods.   [中文 Readme](./README_CN.md)
Author: hongfaqiu
Latest version: 1.0.1
Deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

# @nsc-earth-v2/common

- `Widget` is a base class that you can extend to create your own widgets. You can import it into your project:
- `DomUtil` is a utility class that provides some DOM manipulation methods.
  [中文 Readme](./README_CN.md)

## Installation

```bash
npm install --save @nsc-earth-v2/common
```

## Usage

```javascript
import { Widget, DomUtil } from "@nsc-earth-v2/common";
```

## Widget

`Widget` is a base class for widgets based on Cesium applications. It provides some common widget manipulation methods and properties.

### API

#### `constructor(viewer: Cesium.Viewer, wrapper: HTMLElement)`

Creates a new instance of the `Widget` class and attaches it to the specified Cesium Viewer.

##### Parameters

- `viewer`: The Cesium Viewer instance to attach the widget to.
- `wrapper`: The DOM element to mount the widget to.

#### `enabled`

A boolean property that controls whether the widget is enabled or not.

#### `ready`

A boolean property indicating whether the widget is ready or not.

#### `setContent(content: string | Element): Widget`

A method for setting the content of the widget.

##### Parameters

- `content`: A string or DOM element representing the content to set.

#### `hide()`

A method for hiding the widget.

#### `show()`

A method for showing the widget.

#### `destroy()`

A method for destroying the widget.

## DomUtil

`DomUtil` is a utility class that provides some DOM manipulation methods.

### API

#### `create(tagName: string, className: string, container: Element | null = null): HTMLElement`

Creates an HTML element with the specified `tagName`, sets its class to `className`, and optionally appends it to the `container` element.

##### Parameters

- `tagName`: The HTML tag name to create.
- `className`: The class name to set on the HTML element.
- `container` (optional): The container element to append the new element to.

#### `parseDom(domStr: string, className: string): HTMLDivElement`

Parses a string into a DOM element and returns a DIV element containing the element.

##### Parameters

- `domStr`: The string to parse.
- `className`: The class name to set on the DIV element.
npm package: @nsc-earth-v2/compass
Description: A compass widget for [Cesium](https://cesium.com/) based on [@nsc-earth-v2/common](https://www.npmjs.com/package/@nsc-earth-v2/common) library. [中文 Readme](./README_CN.md)
Author: hongfaqiu
Latest version: 1.1.1
Deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

# @nsc-earth-v2/compass

A compass widget for [Cesium](https://cesium.com/) based on [@nsc-earth-v2/common](https://www.npmjs.com/package/@nsc-earth-v2/common) library.
[中文 Readme](./README_CN.md)

## Installation

```bash
npm install @nsc-earth-v2/compass
```

## Usage

The `Compass` widget can be used in a Cesium app to display a compass. To use the widget, first import it into your project:

```javascript
import Compass from "@nsc-earth-v2/compass";
```

Next, create a new instance of the widget and pass it your Cesium Viewer instance:

```javascript
const viewer = new Cesium.Viewer("cesiumContainer");
const compass = new Compass(viewer);
```

You can also customize the widget by passing an options object when creating a new instance:

```javascript
const compass = new Compass(viewer, {
  container: document.getElementById("compass-container"),
  tips: {
    inner: "North",
    outer: "Rotate",
  },
});
```

## API

### `constructor(viewer: Cesium.Viewer, options?: CompassOptions)`

Creates a new instance of the `Compass` widget attached to the specified Cesium Viewer.

#### Parameters

- `viewer`: The Cesium Viewer instance to attach the widget to.
- `options` (optional): An object containing optional parameters for the widget.

#### `enabled`

A boolean property that controls whether the widget is enabled or not.

#### `ready`

A boolean property indicating whether the widget is ready or not.

### `hide()`

A method for hiding the widget.

### `show()`

A method for showing the widget.

### `destroy(): void`

Mounts the content of the widget.

## Options

The following options can be passed when creating a new instance of the `Compass` widget:

- `container` (optional): The DOM element to mount the widget to. Defaults to `viewer.container`.
- `tips` (optional): An object containing strings for the inner and outer tips of the compass. Defaults to `{ inner: '', outer: 'Drag outer ring: rotate view.\nDrag inner gyroscope: free orbit.\nDouble-click: reset view.\nTIP: You can also free orbit by holding the CTRL key and dragging the map.' }`.
npm package: @nsc-earth-v2/geojson-render
Description: Load geojson on cesium with deep custom style
Author: hongfaqiu
Latest version: 1.0.3
Deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

# GeoJSON Render

A Cesium plugin for rendering GeoJSON data.

## Installation

```bash
npm install @nsc-earth-v2/geojson-render
```

## Usage

Please read the documentation website for more information.

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
npm package: @nsc-earth-v2/popup
Description: A lightweight and easy-to-use popup component for CesiumJS. [中文 Readme](./README_CN.md)
Author: hongfaqiu
Latest version: 1.0.0
Deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

# @nsc-earth-v2/popup

A lightweight and easy-to-use popup component for CesiumJS.
[中文 Readme](./README_CN.md)

## Installation

To install `@nsc-earth-v2/popup`, run:

```bash
npm install @nsc-earth-v2/popup
```

## Usage

Here's an example of how to use `@nsc-earth-v2/popup`:

```javascript
import Popup from "@nsc-earth-v2/popup";
import { Viewer } from "cesium";

const viewer = new Viewer("cesiumContainer");

const options = {
  position: [120, 30, 0],
  element: document.getElementById("popup"),
  offset: [10, 10],
};

const popup = new Popup(viewer, options);

// Update the popup's position
popup.position = [121, 31, 0];

// Destroy the popup
popup.destroy();
```

### PopupOptions

The `PopupOptions` interface has the following properties:

- `position`: The position of the popup, specified as an array of `[longitude, latitude, height]`. If `null`, the popup will be hidden.
- `element`: The HTML element that represents the popup.
- `offset` (optional): An array of `[xOffset, yOffset]` that specifies the offset of the popup from its position.

### Properties

- `position`: Gets or sets the position of the popup.
- `destroyed`: Indicates whether the popup has been destroyed.

### Methods

- `switchElementShow(val: boolean)`: Shows or hides the popup.
- `setPosition()`: Updates the position of the popup.
- `destroy()`: Destroys the popup, removing any event listeners and cleaning up resources.
npm package: @nsc-earth-v2/primitive-geojson
Description: A faster method to load geojson on cesium by primitive
Author: hongfaqiu
Latest version: 1.0.3

## @nsc-earth-v2/primitive-geojson

@nsc-earth-v2/primitive-geojson is a JavaScript library based on Cesium that parses GeoJSON and TopoJSON data into visualizable Cesium entities, including points, lines, polygons, labels, etc. It can be installed as an npm package and used directly in Cesium projects.
[中文 Readme](./README_CN.md)

### Installation

Install using npm:

```
npm install @nsc-earth-v2/primitive-geojson
```

### Usage

To use @nsc-earth-v2/primitive-geojson in your project, simply import it like any other module:

```javascript
import { GeoJsonPrimitiveLayer } from "@nsc-earth-v2/primitive-geojson";
```

Then create a new instance of the `GeoJsonPrimitiveLayer` class and load your GeoJSON data:

```javascript
const layer = new GeoJsonPrimitiveLayer();
layer.load("path/to/data.json").then(() => {
  // Do something when the data is loaded
});
```

See the API documentation for more details on usage and available options.
npm package: @nsc-earth-v2/primitive-layer
Description: A faster method to load geojson on cesium by primitive
Author: hongfaqiu
Latest version: 1.0.3

## @nsc-earth-v2/primitive-geojson

@nsc-earth-v2/primitive-layer is a JavaScript library based on Cesium that parses GeoJSON and TopoJSON data into visualizable Cesium entities, including points, lines, polygons, labels, etc. It can be installed as an npm package and used directly in Cesium projects.
[中文 Readme](./README_CN.md)

### Installation

Install using npm:

```
npm install @nsc-earth-v2/primitive-geojson
```

### Usage

To use @nsc-earth-v2/primitive-geojson in your project, simply import it like any other module:

```javascript
import { GroundPrimitiveLayer,PrimitiveLayer } from "@nsc-earth-v2/primitive-layer";
```

Then create a new instance of the `GeoJsonPrimitiveLayer` class and load your GeoJSON data:

```javascript
const layer = new GroundPrimitiveLayer();
layer.load("path/to/data.json").then(() => {
  // Do something when the data is loaded
});
```

See the API documentation for more details on usage and available options.
npm package: @nsc-earth-v2/sync-viewer
Description: `@nsc-earth-v2/sync-viewer` is an npm package for synchronizing two Cesium Viewer instances. [中文 Readme](./README_CN.md)
Author: hongfaqiu
Latest version: 1.0.0

# @nsc-earth-v2/sync-viewer

`@nsc-earth-v2/sync-viewer` is an npm package for synchronizing two Cesium Viewer instances.
[中文 Readme](./README_CN.md)

## Installation

```bash
npm install @nsc-earth-v2/sync-viewer
```

## Usage

```js
import { Viewer } from "cesium";
import SyncViewer from "@nsc-earth-v2/sync-viewer";

const leftViewer = new Viewer("left-container");
const rightViewer = new Viewer("right-container");

const syncViewer = new SyncViewer(leftViewer, rightViewer);

// Destroy
syncViewer.destroy();
```

## API

### `SyncViewProps`

| Property Name     | Type     | Description                                                  |
| ----------------- | -------- | ------------------------------------------------------------ |
| percentageChanged | `number` | The percentage of distance changed when the camera zooms in. |

### `SyncViewer`

#### Constructor

```ts
constructor(leftViewer: Viewer, rightViewer: Viewer, options?: SyncViewProps)
```

- `leftViewer`: A Cesium Viewer instance on the left.
- `rightViewer`: A Cesium Viewer instance on the right.
- `options` (optional): An object containing options:
  - `percentageChanged`: The percentage of distance changed when the camera zooms in, default to `0.01`.

#### Methods

##### `start()`

Start synchronizing the views of the left and right viewers.

```ts
start(): void
```

##### `destroy()`

Destroy the instance and unsynchronize the views of the left and right viewers.

```ts
destroy(): void
```

#### Properties

##### `synchronous`

Get or set whether to synchronize the views.

```ts
synchronous: boolean;
```

##### `isDestory`

Get whether the instance has been destroyed.

```ts
get isDestory(): boolean
```

#### Events

##### `leftChangeEvent()`

Triggered when the view of the left viewer changes, used to synchronize the view of the right viewer.

##### `rightChangeEvent()`

Triggered when the view of the right viewer changes, used to synchronize the view of the left viewer.
npm package: @nsc-earth-v2/tooltip
Description: `@nsc-earth-v2/tooltip` 是一个基于 [Cesium](https://cesium.com/) 对象实现的 tooltip 组件，支持自定义内容。包含两个类：`Tooltip` 和 `MouseTooltip`。
Author: hongfaqiu
Latest version: 1.2.2

# @nsc-earth-v2/tooltip

`@nsc-earth-v2/tooltip` 是一个基于 [Cesium](https://cesium.com/) 对象实现的 tooltip 组件，支持自定义内容。包含两个类：`Tooltip` 和 `MouseTooltip`。

`MouseTooltip` 会创建一个跟随鼠标移动的 tooltip.

## 安装

```bash
npm install @nsc-earth-v2/tooltip
```

## 使用

### Tooltip

用法示例：

```javascript
import { Cartesian2, Viewer } from "cesium";
import { Tooltip } from "@nsc-earth-v2/tooltip";

const viewer = new Viewer("cesiumContainer");
const tooltip = new Tooltip(viewer, {
  offset: [10, -10],
  content: "Hello, World!",
});

tooltip.content = "Philadelphia";

// 显示（添加content后默认显示）
tooltip.show();
// 隐藏
tooltip.hide();

// 销毁 Tooltip
tooltip.destroy();
```

#### Options

`Tooltip` 类接受以下 options：

| 名称    | 类型                  | 默认值   | 描述                                   |
| ------- | --------------------- | -------- | -------------------------------------- |
| offset  | Tuple `[x, y]`        | `[0, 0]` | Tooltip 相对于鼠标或实体的位置偏移量   |
| content | `string` 或 `Element` | `''`     | Tooltip 的内容，可以是文本或 HTML 元素 |

#### 方法

##### showAt(windowPosition: Cartesian2, content: string | Element): Tooltip

显示 Tooltip。接受两个参数：

- `windowPosition`：`Cartesian2` 类型，tooltip 在屏幕上的位置
- `content`：`string` 或 `Element` 类型，tooltip 的内容

返回值为 `Tooltip` 实例。

##### hide(): Tooltip

隐藏 Tooltip。

返回值为 `Tooltip` 实例。

### MouseTooltip

用法示例：

```javascript
import { Viewer } from "cesium";
import { MouseTooltip } from "@nsc-earth-v2/tooltip";

const viewer = new Viewer("cesiumContainer");
const mouseTooltip = new MouseTooltip(viewer, {
  offset: [10, -10],
});

mouseTooltip.content = "Philadelphia";

// 显示（添加content后默认显示）
mouseTooltip.show();
// 隐藏
mouseTooltip.hide();

// 销毁 MouseTooltip
mouseTooltip.destroy();
```

#### Options

`MouseTooltip` 类继承自 `Tooltip`，接受相同的 options。

#### 方法

##### show(): void

显示 MouseTooltip。

##### hide(): void

隐藏 MouseTooltip。

##### destroy(): void

销毁 MouseTooltip。
npm package: @nsc-earth-v2/zoom-control
Description: A zoom controller widget for Cesium, which is an npm package that can be used with [Cesium](https://cesium.com/). [中文 Readme](./README_CN.md)
Author: hongfaqiu
Latest version: 1.1.1

# @nsc-earth-v2/zoom-control

A zoom controller widget for Cesium, which is an npm package that can be used with [Cesium](https://cesium.com/).
[中文 Readme](./README_CN.md)

## Features

- Zoom in, Zoom out and Reset zoom functionality.

## Installation

Install it via npm:

```bash
npm install @nsc-earth-v2/zoom-control
```

## Usage

### Importing the module

```javascript
import ZoomController from "@nsc-earth-v2/zoom-control";
```

### Creating an instance of the widget

```javascript
const viewer = new Cesium.Viewer("cesiumContainer");
const zoomController = new ZoomController(viewer, {
  container: document.getElementById("myContainer"),
  home: new Cesium.Cartesian3.fromDegrees(-98.57, 39.82, 5000000),
});
```

The constructor of `ZoomController` takes two arguments:

- `viewer`: A required parameter representing the instance of the Cesium Viewer.
- `options`: An optional object containing following properties:
  - `container`: An optional property representing the HTML element where the widget needs to be added to.
  - `home`: An optional property representing the Cartesian3 position to which the camera should fly back when reset zoom button is clicked.
  - `tips`: An optional property representing an object containing text messages to display as tooltip for the buttons.Defaults to `{ zoomIn: 'Zoom In', zoomOut: 'Zoom Out', refresh: 'Reset Zoom' }`

### Using the widget methods

Once you have created an instance of `ZoomController`, you can access the following methods:

- `show()`: To show the widget.
- `hide()`: To hide the widget.
- `destroy()`: To destroy the widget.
npm package: @nsea/pilot
Description: 🚀 可扩展的前端项目开发体验增强平台 - 智能检测项目技术栈，自动配置开发环境
Author: NorthSeacoder
Latest version: 1.0.1

# Pilot - 前端项目增强工具

> 🚀 可扩展的前端项目开发体验增强平台

Pilot 是一个参考 Astro `astro add` 设计理念的命令行工具，为前端项目提供模块化的开发体验增强。通过智能检测项目技术栈和架构，自动安装相应依赖，生成最佳实践配置，让开发者快速获得高质量的开发环境。

## ✨ 核心特性

- **🔍 智能检测**：自动识别 React/Vue2/Vue3 技术栈和项目架构
- **🔧 模块化设计**：插件化架构，按需添加功能模块
- **⚡ 一键配置**：零配置体验，自动安装依赖和生成配置文件
- **🤖 AI 增强**：集成企业级 AI 开发规则和最佳实践
- **📦 渐进增强**：支持单项配置和完整配置，适应不同使用场景
- **🛡️ 安全可靠**：完整的错误处理和回滚机制

## 🏗️ 技术栈

- **核心**: TypeScript + Commander.js
- **测试**: Vitest + @testing-library
- **构建**: tsup (ESM + CJS)
- **用户体验**: Chalk + Ora + Boxen
- **文件操作**: fs-extra + glob + find-up
- **进程管理**: execa

## 🚀 快速开始

### 安装

```bash
npm install -g pilot
# 或
npx pilot@latest
```

### 基础使用

```bash
# 完整测试配置（推荐，自动检测项目类型）
pilot add testing

# 分步配置
pilot add testing --rules      # 仅添加 AI 测试规则
pilot add testing --config     # 仅添加 Vitest 配置  
pilot add testing --deps       # 仅安装测试依赖
```

### 高级用法

```bash
# 预览模式（查看将要生成的配置）
pilot add testing --dry-run

# 跳过依赖安装（仅生成配置文件）
pilot add testing --no-install

# 覆盖自动检测（仅在检测失败时使用）
pilot add testing --stack vue3 --arch pnpm
```

## 📋 支持的项目类型

### 技术栈支持
- **React**: Create React App, Vite, Next.js
- **Vue3**: Vite, Vue CLI, Nuxt3  
- **Vue2**: Vue CLI, 自定义 Webpack 配置

### 项目架构支持
- **单模块项目**: 标准的单个 package.json 项目结构
- **pnpm workspace**: 通过 `pnpm-workspace.yaml` 检测和配置
- **Yarn workspace**: 通过 `package.json` 的 workspaces 字段检测和配置

## 🛠️ 开发指南

### 项目结构
```
src/
├── cli/                  # CLI 入口和命令解析
├── core/                 # 核心功能模块
│   ├── detection/        # 项目检测逻辑
│   └── module-manager.ts # 模块管理器
├── modules/              # 功能模块
│   └── testing/          # 测试模块
│       ├── installer.ts  # 模块安装器
│       ├── config-generator.ts  # 配置生成器
│       └── templates/    # 配置模板
├── types/                # TypeScript 类型定义
└── utils.ts             # 工具函数
```

### 本地开发
```bash
# 克隆项目
git clone https://github.com/your-org/pilot
cd pilot

# 安装依赖
pnpm install

# 开发模式
pnpm dev

# 构建
pnpm build

# 测试
pnpm test
```

## 🎯 当前功能

### V1.0 MVP - Testing 模块
- ✅ 项目技术栈自动检测（React/Vue2/Vue3）
- ✅ 项目架构检测（单模块/pnpm workspace/yarn workspace）
- ✅ AI 测试规则文件生成（.cursorrules）
- ✅ Vitest 基础配置生成
- ✅ 测试依赖自动安装
- ✅ 配置文件验证和测试

### 🚧 规划中功能
- **Linting 模块**: ESLint + 企业规则
- **Formatting 模块**: Prettier + 统一配置
- **Git Hooks 模块**: Husky + lint-staged

## 🧪 示例用法

添加测试配置到 React 项目：
```bash
cd my-react-app
pilot add testing
```

输出示例：
```
🚀 Pilot
前端项目开发体验增强平台

版本: 0.1.0

✅ 检测完成: react + single
📦 开始配置测试环境...
✅ 生成 AI 测试规则文件
✅ 生成 Vitest 配置文件
✅ 安装测试依赖

🎉 测试环境配置完成!

📝 后续步骤:
  1. 运行 npm test 执行测试
  2. 查看 .cursorrules 了解 AI 测试规则
  3. 在 src 目录创建 *.test.ts 文件开始编写测试
```

## 🤝 贡献指南

我们欢迎所有形式的贡献！请查看 [贡献指南](CONTRIBUTING.md) 了解详细信息。

## 📜 许可证

MIT License - 详见 [LICENSE](./LICENSE) 文件

---

**⭐ 如果这个项目对你有帮助，请给我们一个 Star！**

**🐛 遇到问题？** [提交 Issue](https://github.com/your-org/pilot/issues)  
**💬 交流讨论？** [加入我们的讨论](https://github.com/your-org/pilot/discussions)
npm package: @nsea/xmind-handler
Description: A powerful Node.js library for processing XMind files, allowing you to filter, convert, and output XMind content in various formats.
Author: NorthSeacoder
Latest version: 0.0.5

# @nsea/xmind-handler

A powerful Node.js library for processing XMind files, allowing you to filter, convert, and output XMind content in various formats.

## Features

- Filter XMind topics based on markers
- Convert XMind content to JSON, Markdown, or filtered XMind files
- Command-line interface for easy usage
- Supports multiple output formats

## Installation

Install the package using npm:

```bash
npm install @nsea/xmind-handler
```

Or using yarn:

```bash
yarn add @nsea/xmind-handler
```

## Usage

### Command Line Interface

You can use the CLI to process XMind files:

```bash
xmind -i input.xmind -o output -t json,md,xmind -m priority-1,important
```

Options:
- `-i, --input <filePath>`: Input XMind file path (required)
- `-o, --output-dir <dir>`: Output directory (default: current directory)
- `-t, --output-types <types>`: Output types (comma-separated, default: xmind)
- `-m, --filter-markers <markers>`: Filter markers (comma-separated, default: priority-1)

### Programmatic Usage

You can also use the library in your Node.js projects:

```javascript
import processXMind from '@nsea/xmind-handler';

const options = {
  inputFile: 'path/to/input.xmind',
  outputTypes: ['json', 'md', 'xmind'],
  outputDir: 'path/to/output',
  filterMarkers: ['priority-1', 'important']
};

processXMind(options)
  .then(() => console.log('XMind processing complete'))
  .catch(error => console.error('Error processing XMind:', error));
```

## API

### `processXMind(options: XMindOptions): Promise<void>`

Process an XMind file based on the provided options.

#### XMindOptions

- `inputFile: string` - The path to the input XMind file
- `outputTypes?: ('json' | 'md' | 'xmind')[]` - The types of output to generate (default: ['xmind'])
- `outputDir?: string` - The directory to write output files to (default: '.')
- `filterMarkers: string[]` - An array of marker IDs to filter topics by

## License

This project is licensed under the MIT License.
npm package: @nsetyo/prettier-plugin-twig
Description: Twig Prettier Plugin 
Author: setyo@pm.me
Latest version: 0.1.4

## Prettier for Melody

![Prettier Banner](https://raw.githubusercontent.com/prettier/prettier-logo/master/images/prettier-banner-light.png)

---

This Plugin enables Prettier to format `.twig` files, as well as `.html.twig`.

## Install

```bash
npm i -D @nsetyo/prettier-plugin-twig
```

## Use

Add plugin in prettier config (e.g: .prettierrc)

```json
{
    "plugins": ["@nsetyo/prettier-plugin-twig"]
}
```

```bash
prettier --write "**/*.html.twig"
```

### Credit

Most of the code in this plugin is taken from https://github.com/trivago/prettier-plugin-twig-melody,
which seems not maintained anymore. This _fork_ try to fix the issue there and add support for new Twig feature