# cloudstudio-lite

> ## API ##

Latest version **1.1.9** (published 2019-08-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install cloudstudio-lite
pnpm add cloudstudio-lite
yarn add cloudstudio-lite
bun add cloudstudio-lite
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.9 |
| Published | 2019-08-29 |
| First published | 2019-03-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 8 |
| Unpacked size | 7.7 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | codingide |

## Links

- npm: https://www.npmjs.com/package/cloudstudio-lite
- Repository: git@e.coding.net:codingcorp/cloud-studio-lite
- npm.io page: https://npm.io/package/cloudstudio-lite

## Dependencies (8)

- [url-loader](https://npm.io/package/url-loader.md) ^1.1.2
- [file-loader](https://npm.io/package/file-loader.md) ^4.0.0
- [monaco-editor](https://npm.io/package/monaco-editor.md) ^0.17.0
- [babel-polyfill](https://npm.io/package/babel-polyfill.md) ^6.26.0
- [mini-css-extract-plugin](https://npm.io/package/mini-css-extract-plugin.md) ^0.7.0
- [uglifyjs-webpack-plugin](https://npm.io/package/uglifyjs-webpack-plugin.md) ^2.1.2
- [webpack-bundle-analyzer](https://npm.io/package/webpack-bundle-analyzer.md) ^3.3.2
- [optimize-css-assets-webpack-plugin](https://npm.io/package/optimize-css-assets-webpack-plugin.md) ^5.0.3

## Recent versions

- 1.1.9 (latest) — 2019-08-29
- 1.1.8 — 2019-07-30
- 1.1.7 — 2019-06-27
- 1.1.6 — 2019-06-26
- 1.1.5 — 2019-06-26
- 1.1.4 — 2019-06-24
- 1.1.3 — 2019-06-21
- 1.1.2 — 2019-06-15
- 1.1.1 — 2019-04-08
- 1.1.0 — 2019-04-08
- 1.0.22 — 2019-04-04
- 1.0.21 — 2019-04-04
- 1.0.20 — 2019-04-03
- 1.0.19 — 2019-04-02
- 1.0.18 — 2019-04-01
- … 17 more at https://npm.io/package/cloudstudio-lite/versions

## README

# Cloud-Studio-Lite SDK文档

## API ##

#### ISDKOptions ####


| 参数 | 说明 | 类型 | 是否必填 |
| ------ | ------ | ------ | ------ |
| rootNode | 宿主根节点 | HTMLElement | true |
| funcName | 函数名 | String | false |
| applyStatistics | 申请数据统计 | IStatisticsParams | false |
| helpDocLink | 帮助文档链接 | String | false |

如：

```JavaScript
const CSLite = new CloudStudioLiteSDK({
    rootNode: document.querySelector('#root'),
    funcName: 'workspace',
    helpDocLink: 'https://studio.dev.tencent.com/',
    applyStatistics: {
        appId: 'appId-1',
        appKey: 'appKey-1',
        channel: 'channel-1',
        uid: 'uid-1'
    } as IStatisticsParams
});
```


#### IStatisticsParams ####

| 参数 | 说明 | 类型 | 是否必填 |
| ------ | ------ | ------ | ------ |
| appId | appId | String | true |
| appKey | appKey | String | true |
| channel | channel | String | true |
| uid | uid | String | true |



#### FileTreeModel ####

| 参数 | 说明 | 类型 | 是否必填
| ------ | ------ | ------ | ------ |
| isFile | 是否是文件类型 | Boolean | true |
| path | 文件路径(唯一) | String | true |
| fileName | 文件名称 | String | true |
| parentPath | 父级文件路径(唯一) | String | true |



## 方法 ##

| 参数 | 说明 | 参数类型 | 返回值类型
| ------ | ------ | ------ | ------ |
| getFileList | 获取所有文件列表(未保存文件返回原始内容) | - | IFileValue[] |
| onOpenFileListen | 监听要读取的某文件文本内容的方法 | (data: { path: string }) => Promise&lt;{ content: string }&gt; | void |
| onSaveFileListen | 监听要保存的某文件文本内容的方法 | (data: { path: string, content: string }) => Promise&lt;boolean&gt; | void |
| onAddFileListen | 监听要新增的文件的方法 | (data: { path: string, content: string }) => Promise&lt;boolean&gt; | void |
| onAddFolderListen | 监听要新增的文件夹的方法 | (data: { path: string }) => Promise&lt;boolean&gt; | void |
| onDelFileListen | 监听要删除的文件的方法 | (data: { path: string }) => Promise&lt;boolean&gt; | void |
| onDelFolderListen | 监听要删除的文件夹的方法 | (data: { path: string }) => Promise&lt;boolean&gt; | void |
| onRenameFileOrFolderListen | 监听要重命名的文件或文件夹的方法 | (data: { newPath: string, oldPath: string }) => Promise&lt;boolean&gt; | void |
| onExpandFolderListen | 监听要展开的某文件夹的方法 | (data: { path: string }) => Promise&lt;FileTreeModel[]&gt; | void |

如：

```JavaScript
CSLite.onOpenFileListen((data: { path: string }) => {
    const { path } = data;
    return new Promise((res, rej) => {
        // ...TUDO
        res( {content} )
    })
})

CSLite.getFileList() // 返回 IFileValue 类型数组
```

## 接口 ##

#### IFileValue ####
| 参数 | 说明 | 类型 | 默认值
| ------ | ------ | ------ | ------ |
| fileName | 文件名称 | String | '' |
| isFile | 是否是文件类型 | Boolean | false |
| level | 层级 | Number | 0 |
| content | 文件内容 | String | '' |
| path | 文件路径 | String | '' |
| parentPath | 父级文件路径 | String | '' |

---
_Source: https://npm.io/package/cloudstudio-lite · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
