@sigma-file-manager/api 1.6.0 → 1.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +59 -59
- package/index.d.ts +681 -632
- package/manifest.schema.json +694 -586
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
# @sigma-file-manager/api
|
|
2
|
-
|
|
3
|
-
Type definitions and the extension manifest JSON schema for [Sigma File Manager](https://github.com/aleksey-hoffman/sigma-file-manager) extensions.
|
|
4
|
-
|
|
5
|
-
## Install
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm install -D @sigma-file-manager/api
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
Add a `devDependency` only; the host does not run `npm install` for installed extensions.
|
|
12
|
-
|
|
13
|
-
## TypeScript
|
|
14
|
-
|
|
15
|
-
Import types for entrypoints and helpers. The global `sigma` object is declared in this package.
|
|
16
|
-
|
|
17
|
-
```ts
|
|
18
|
-
import type { ExtensionActivationContext, ExtensionContextEntry, UIElement } from '@sigma-file-manager/api';
|
|
19
|
-
|
|
20
|
-
export async function activate(context: ExtensionActivationContext): Promise<void> {
|
|
21
|
-
await sigma.i18n.mergeFromPath('locales');
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export async function deactivate(): Promise<void> {}
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
## i18n
|
|
30
|
-
|
|
31
|
-
Keep strings in `locales/*.json`, merge every locale from the extension root, and alias `sigma.i18n.extensionT` for extension-local keys:
|
|
32
|
-
|
|
33
|
-
```ts
|
|
34
|
-
const t = sigma.i18n.extensionT;
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
Call `await sigma.i18n.mergeFromPath('locales')` in `activate` before registering UI that uses `t`.
|
|
38
|
-
|
|
39
|
-
`sigma.i18n.formatMessage` is available when you need `{placeholder}` formatting outside the translator.
|
|
40
|
-
|
|
41
|
-
## Manifest schema
|
|
42
|
-
|
|
43
|
-
In extension `package.json`:
|
|
44
|
-
|
|
45
|
-
```json
|
|
46
|
-
{
|
|
47
|
-
"$schema": "./node_modules/@sigma-file-manager/api/manifest.schema.json"
|
|
48
|
-
}
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
Run `npm install` first so the local schema file exists.
|
|
52
|
-
|
|
53
|
-
## Release
|
|
54
|
-
|
|
55
|
-
API package versions are independent from app releases and are published to npm as `@sigma-file-manager/api`.
|
|
56
|
-
|
|
57
|
-
## Resources
|
|
58
|
-
|
|
59
|
-
**[Docs](https://github.com/sigma-hub/sfm-
|
|
1
|
+
# @sigma-file-manager/api
|
|
2
|
+
|
|
3
|
+
Type definitions and the extension manifest JSON schema for [Sigma File Manager](https://github.com/aleksey-hoffman/sigma-file-manager) extensions.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -D @sigma-file-manager/api
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Add a `devDependency` only; the host does not run `npm install` for installed extensions.
|
|
12
|
+
|
|
13
|
+
## TypeScript
|
|
14
|
+
|
|
15
|
+
Import types for entrypoints and helpers. The global `sigma` object is declared in this package.
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import type { ExtensionActivationContext, ExtensionContextEntry, UIElement } from '@sigma-file-manager/api';
|
|
19
|
+
|
|
20
|
+
export async function activate(context: ExtensionActivationContext): Promise<void> {
|
|
21
|
+
await sigma.i18n.mergeFromPath('locales');
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export async function deactivate(): Promise<void> {}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
When the extension runs code, point `package.json` `"main"` at your compiled file (for example `dist/index.js`), set `"type": "module"`, and build with `tsc` or your bundler. Manifest-only API extensions that only contribute themes can omit `"main"`. Commit build output if installs come from a Git tag archive without running a build on the client.
|
|
28
|
+
|
|
29
|
+
## i18n
|
|
30
|
+
|
|
31
|
+
Keep strings in `locales/*.json`, merge every locale from the extension root, and alias `sigma.i18n.extensionT` for extension-local keys:
|
|
32
|
+
|
|
33
|
+
```ts
|
|
34
|
+
const t = sigma.i18n.extensionT;
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Call `await sigma.i18n.mergeFromPath('locales')` in `activate` before registering UI that uses `t`.
|
|
38
|
+
|
|
39
|
+
`sigma.i18n.formatMessage` is available when you need `{placeholder}` formatting outside the translator.
|
|
40
|
+
|
|
41
|
+
## Manifest schema
|
|
42
|
+
|
|
43
|
+
In extension `package.json`:
|
|
44
|
+
|
|
45
|
+
```json
|
|
46
|
+
{
|
|
47
|
+
"$schema": "./node_modules/@sigma-file-manager/api/manifest.schema.json"
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Run `npm install` first so the local schema file exists.
|
|
52
|
+
|
|
53
|
+
## Release
|
|
54
|
+
|
|
55
|
+
API package versions are independent from app releases and are published to npm as `@sigma-file-manager/api`.
|
|
56
|
+
|
|
57
|
+
## Resources
|
|
58
|
+
|
|
59
|
+
**[Docs](https://github.com/sigma-hub/sfm-marketplace/wiki)** - documentation for extension development
|