@xwiki/cristal-uiextension-api 0.21.1 → 0.23.0
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/CHANGELOG.md +9 -3
- package/api-extractor.json +4 -0
- package/dist/index.d.ts +23 -1
- package/dist/index.d.ts.map +1 -1
- package/etc/cristal-uiextension-api.api.md +51 -0
- package/package.json +14 -7
- package/src/index.ts +34 -1
package/CHANGELOG.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -17,11 +17,13 @@
|
|
|
17
17
|
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
|
18
18
|
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
|
|
19
19
|
*/
|
|
20
|
-
import { Component } from "vue";
|
|
20
|
+
import type { Component } from "vue";
|
|
21
|
+
import type { ComposerTranslation } from "vue-i18n";
|
|
21
22
|
/**
|
|
22
23
|
* Define the information held by a UI Extension (UIX).
|
|
23
24
|
*
|
|
24
25
|
* @since 0.11
|
|
26
|
+
* @beta
|
|
25
27
|
*/
|
|
26
28
|
interface UIExtension {
|
|
27
29
|
/**
|
|
@@ -54,6 +56,7 @@ interface UIExtension {
|
|
|
54
56
|
}
|
|
55
57
|
/**
|
|
56
58
|
* @since 0.11
|
|
59
|
+
* @beta
|
|
57
60
|
*/
|
|
58
61
|
interface UIExtensionsManager {
|
|
59
62
|
/**
|
|
@@ -63,5 +66,24 @@ interface UIExtensionsManager {
|
|
|
63
66
|
*/
|
|
64
67
|
list(name: string): Promise<UIExtension[]>;
|
|
65
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* Abstract class helping with localization of UI extensions.
|
|
71
|
+
*
|
|
72
|
+
* @since 0.23
|
|
73
|
+
* @beta
|
|
74
|
+
*/
|
|
75
|
+
declare abstract class AbstractUIExtension implements UIExtension {
|
|
76
|
+
protected t: ComposerTranslation;
|
|
77
|
+
constructor(messages: Record<string, Record<string, string>>);
|
|
78
|
+
abstract id: string;
|
|
79
|
+
abstract uixpName: string;
|
|
80
|
+
abstract order: number;
|
|
81
|
+
abstract parameters: {
|
|
82
|
+
[key: string]: unknown;
|
|
83
|
+
};
|
|
84
|
+
abstract enabled(): Promise<boolean>;
|
|
85
|
+
abstract component(): Promise<Component>;
|
|
86
|
+
}
|
|
87
|
+
export { AbstractUIExtension };
|
|
66
88
|
export type { UIExtension, UIExtensionsManager };
|
|
67
89
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AACrC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAEpD;;;;;GAKG;AACH,UAAU,WAAW;IACnB;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,UAAU,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;IAEvC;;OAEG;IACH,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAE5B;;OAEG;IACH,SAAS,IAAI,OAAO,CAAC,SAAS,CAAC,CAAC;CACjC;AAED;;;GAGG;AACH,UAAU,mBAAmB;IAC3B;;;;OAIG;IACH,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;CAC5C;AAED;;;;;GAKG;AACH,uBACe,mBAAoB,YAAW,WAAW;IACvD,SAAS,CAAC,CAAC,EAAE,mBAAmB,CAAC;gBAER,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAQzE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,UAAU,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;IAEhD,QAAQ,CAAC,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC;IACpC,QAAQ,CAAC,SAAS,IAAI,OAAO,CAAC,SAAS,CAAC;CACzC;AAED,OAAO,EAAE,mBAAmB,EAAE,CAAC;AAC/B,YAAY,EAAE,WAAW,EAAE,mBAAmB,EAAE,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
## API Report File for "@xwiki/cristal-uiextension-api"
|
|
2
|
+
|
|
3
|
+
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
|
|
7
|
+
import type { Component } from 'vue';
|
|
8
|
+
import type { ComposerTranslation } from 'vue-i18n';
|
|
9
|
+
|
|
10
|
+
// @beta
|
|
11
|
+
export abstract class AbstractUIExtension implements UIExtension {
|
|
12
|
+
constructor(messages: Record<string, Record<string, string>>);
|
|
13
|
+
// (undocumented)
|
|
14
|
+
abstract component(): Promise<Component>;
|
|
15
|
+
// (undocumented)
|
|
16
|
+
abstract enabled(): Promise<boolean>;
|
|
17
|
+
// (undocumented)
|
|
18
|
+
abstract id: string;
|
|
19
|
+
// (undocumented)
|
|
20
|
+
abstract order: number;
|
|
21
|
+
// (undocumented)
|
|
22
|
+
abstract parameters: {
|
|
23
|
+
[key: string]: unknown;
|
|
24
|
+
};
|
|
25
|
+
// (undocumented)
|
|
26
|
+
protected t: ComposerTranslation;
|
|
27
|
+
// (undocumented)
|
|
28
|
+
abstract uixpName: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// @beta
|
|
32
|
+
export interface UIExtension {
|
|
33
|
+
component(): Promise<Component>;
|
|
34
|
+
enabled(): Promise<boolean>;
|
|
35
|
+
id: string;
|
|
36
|
+
order: number;
|
|
37
|
+
parameters: {
|
|
38
|
+
[key: string]: unknown;
|
|
39
|
+
};
|
|
40
|
+
uixpName: string;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// @beta (undocumented)
|
|
44
|
+
export interface UIExtensionsManager {
|
|
45
|
+
// (undocumented)
|
|
46
|
+
list(name: string): Promise<UIExtension[]>;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// (No @packageDocumentation comment for this package)
|
|
50
|
+
|
|
51
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xwiki/cristal-uiextension-api",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.23.0",
|
|
4
4
|
"license": "LGPL 2.1",
|
|
5
5
|
"author": "XWiki Org Community <contact@xwiki.org>",
|
|
6
6
|
"homepage": "https://cristal.xwiki.org/",
|
|
@@ -15,21 +15,28 @@
|
|
|
15
15
|
"type": "module",
|
|
16
16
|
"exports": {
|
|
17
17
|
".": {
|
|
18
|
-
"types": "./dist/index.d.ts"
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"import": "./src/index.ts"
|
|
19
20
|
}
|
|
20
21
|
},
|
|
21
|
-
"
|
|
22
|
+
"main": "./src/index.ts",
|
|
23
|
+
"types": "./dist/index.d.ts",
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"vue-i18n": "11.1.12"
|
|
26
|
+
},
|
|
22
27
|
"peerDependencies": {
|
|
28
|
+
"inversify": "7.x",
|
|
23
29
|
"reflect-metadata": "0.x",
|
|
24
30
|
"vue": "3.x"
|
|
25
31
|
},
|
|
26
32
|
"devDependencies": {
|
|
27
|
-
"typescript": "5.9.
|
|
28
|
-
"vue": "3.5.
|
|
29
|
-
"@xwiki/cristal-dev-config": "0.
|
|
33
|
+
"typescript": "5.9.3",
|
|
34
|
+
"vue": "3.5.22",
|
|
35
|
+
"@xwiki/cristal-dev-config": "0.23.0"
|
|
30
36
|
},
|
|
31
37
|
"scripts": {
|
|
32
|
-
"
|
|
38
|
+
"api-extractor:local": "api-extractor run --local",
|
|
39
|
+
"build": "rimraf dist && tsc",
|
|
33
40
|
"clean": "rimraf dist",
|
|
34
41
|
"lint": "eslint \"./src/**/*.{ts,tsx,vue}\" --max-warnings=0"
|
|
35
42
|
}
|
package/src/index.ts
CHANGED
|
@@ -18,12 +18,16 @@
|
|
|
18
18
|
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
|
-
import {
|
|
21
|
+
import { injectable, unmanaged } from "inversify";
|
|
22
|
+
import { useI18n } from "vue-i18n";
|
|
23
|
+
import type { Component } from "vue";
|
|
24
|
+
import type { ComposerTranslation } from "vue-i18n";
|
|
22
25
|
|
|
23
26
|
/**
|
|
24
27
|
* Define the information held by a UI Extension (UIX).
|
|
25
28
|
*
|
|
26
29
|
* @since 0.11
|
|
30
|
+
* @beta
|
|
27
31
|
*/
|
|
28
32
|
interface UIExtension {
|
|
29
33
|
/**
|
|
@@ -60,6 +64,7 @@ interface UIExtension {
|
|
|
60
64
|
|
|
61
65
|
/**
|
|
62
66
|
* @since 0.11
|
|
67
|
+
* @beta
|
|
63
68
|
*/
|
|
64
69
|
interface UIExtensionsManager {
|
|
65
70
|
/**
|
|
@@ -70,4 +75,32 @@ interface UIExtensionsManager {
|
|
|
70
75
|
list(name: string): Promise<UIExtension[]>;
|
|
71
76
|
}
|
|
72
77
|
|
|
78
|
+
/**
|
|
79
|
+
* Abstract class helping with localization of UI extensions.
|
|
80
|
+
*
|
|
81
|
+
* @since 0.23
|
|
82
|
+
* @beta
|
|
83
|
+
*/
|
|
84
|
+
@injectable()
|
|
85
|
+
abstract class AbstractUIExtension implements UIExtension {
|
|
86
|
+
protected t: ComposerTranslation;
|
|
87
|
+
|
|
88
|
+
constructor(@unmanaged() messages: Record<string, Record<string, string>>) {
|
|
89
|
+
const { t, mergeLocaleMessage } = useI18n();
|
|
90
|
+
for (const messagesKey in messages) {
|
|
91
|
+
mergeLocaleMessage(messagesKey, messages[messagesKey]);
|
|
92
|
+
}
|
|
93
|
+
this.t = t;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
abstract id: string;
|
|
97
|
+
abstract uixpName: string;
|
|
98
|
+
abstract order: number;
|
|
99
|
+
abstract parameters: { [key: string]: unknown };
|
|
100
|
+
|
|
101
|
+
abstract enabled(): Promise<boolean>;
|
|
102
|
+
abstract component(): Promise<Component>;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export { AbstractUIExtension };
|
|
73
106
|
export type { UIExtension, UIExtensionsManager };
|