@xwiki/cristal-uiextension-api 0.23.0 → 0.23.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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @xwiki/cristal-uiextension-api
2
2
 
3
+ ## 0.23.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Cristal 0.23.1 Release
8
+
3
9
  ## 0.23.0
4
10
 
5
11
  ### Minor Changes
@@ -0,0 +1,69 @@
1
+ import { Component } from 'vue';
2
+ import { ComposerTranslation } from 'vue-i18n';
3
+ /**
4
+ * Define the information held by a UI Extension (UIX).
5
+ *
6
+ * @since 0.11
7
+ * @beta
8
+ */
9
+ interface UIExtension {
10
+ /**
11
+ * The unique id of an UI Extension
12
+ */
13
+ id: string;
14
+ /**
15
+ * The id of the extension point where this UIX should be injected.
16
+ */
17
+ uixpName: string;
18
+ /**
19
+ * The order of the UIX. The lowest values are expected to be presented
20
+ * first.
21
+ */
22
+ order: number;
23
+ /**
24
+ * A free set of parameters.
25
+ */
26
+ parameters: {
27
+ [key: string]: unknown;
28
+ };
29
+ /**
30
+ * Compute if the UIX should be displayed.
31
+ */
32
+ enabled(): Promise<boolean>;
33
+ /**
34
+ * The UI component of the UIX.
35
+ */
36
+ component(): Promise<Component>;
37
+ }
38
+ /**
39
+ * @since 0.11
40
+ * @beta
41
+ */
42
+ interface UIExtensionsManager {
43
+ /**
44
+ *
45
+ * @param name - the name of the UIXP
46
+ * @returns a list of UIExtension components, sorted by ascending order. disabled UIExtensions are excluded
47
+ */
48
+ list(name: string): Promise<UIExtension[]>;
49
+ }
50
+ /**
51
+ * Abstract class helping with localization of UI extensions.
52
+ *
53
+ * @since 0.23
54
+ * @beta
55
+ */
56
+ declare abstract class AbstractUIExtension implements UIExtension {
57
+ protected t: ComposerTranslation;
58
+ constructor(messages: Record<string, Record<string, string>>);
59
+ abstract id: string;
60
+ abstract uixpName: string;
61
+ abstract order: number;
62
+ abstract parameters: {
63
+ [key: string]: unknown;
64
+ };
65
+ abstract enabled(): Promise<boolean>;
66
+ abstract component(): Promise<Component>;
67
+ }
68
+ export { AbstractUIExtension };
69
+ export type { UIExtension, UIExtensionsManager };
package/dist/index.d.ts CHANGED
@@ -1,24 +1,5 @@
1
- /**
2
- * See the LICENSE file distributed with this work for additional
3
- * information regarding copyright ownership.
4
- *
5
- * This is free software; you can redistribute it and/or modify it
6
- * under the terms of the GNU Lesser General Public License as
7
- * published by the Free Software Foundation; either version 2.1 of
8
- * the License, or (at your option) any later version.
9
- *
10
- * This software is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
- * Lesser General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU Lesser General Public
16
- * License along with this software; if not, write to the Free
17
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19
- */
20
- import type { Component } from "vue";
21
- import type { ComposerTranslation } from "vue-i18n";
1
+ import { Component } from 'vue';
2
+ import { ComposerTranslation } from 'vue-i18n';
22
3
  /**
23
4
  * Define the information held by a UI Extension (UIX).
24
5
  *
@@ -86,4 +67,3 @@ declare abstract class AbstractUIExtension implements UIExtension {
86
67
  }
87
68
  export { AbstractUIExtension };
88
69
  export type { UIExtension, UIExtensionsManager };
89
- //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,24 @@
1
+ import { injectable as l, unmanaged as m } from "inversify";
2
+ import { useI18n as i } from "vue-i18n";
3
+ var p = Object.getOwnPropertyDescriptor, v = (e, t, o, r) => {
4
+ for (var s = r > 1 ? void 0 : r ? p(t, o) : t, a = e.length - 1, n; a >= 0; a--)
5
+ (n = e[a]) && (s = n(s) || s);
6
+ return s;
7
+ }, _ = (e, t) => (o, r) => t(o, r, e);
8
+ let c = class {
9
+ t;
10
+ constructor(e) {
11
+ const { t, mergeLocaleMessage: o } = i();
12
+ for (const r in e)
13
+ o(r, e[r]);
14
+ this.t = t;
15
+ }
16
+ };
17
+ c = v([
18
+ l(),
19
+ _(0, m())
20
+ ], c);
21
+ export {
22
+ c as AbstractUIExtension
23
+ };
24
+ //# sourceMappingURL=index.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.es.js","sources":["../src/index.ts"],"sourcesContent":["/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport { injectable, unmanaged } from \"inversify\";\nimport { useI18n } from \"vue-i18n\";\nimport type { Component } from \"vue\";\nimport type { ComposerTranslation } from \"vue-i18n\";\n\n/**\n * Define the information held by a UI Extension (UIX).\n *\n * @since 0.11\n * @beta\n */\ninterface UIExtension {\n /**\n * The unique id of an UI Extension\n */\n id: string;\n\n /**\n * The id of the extension point where this UIX should be injected.\n */\n uixpName: string;\n\n /**\n * The order of the UIX. The lowest values are expected to be presented\n * first.\n */\n order: number;\n\n /**\n * A free set of parameters.\n */\n parameters: { [key: string]: unknown };\n\n /**\n * Compute if the UIX should be displayed.\n */\n enabled(): Promise<boolean>;\n\n /**\n * The UI component of the UIX.\n */\n component(): Promise<Component>;\n}\n\n/**\n * @since 0.11\n * @beta\n */\ninterface UIExtensionsManager {\n /**\n *\n * @param name - the name of the UIXP\n * @returns a list of UIExtension components, sorted by ascending order. disabled UIExtensions are excluded\n */\n list(name: string): Promise<UIExtension[]>;\n}\n\n/**\n * Abstract class helping with localization of UI extensions.\n *\n * @since 0.23\n * @beta\n */\n@injectable()\nabstract class AbstractUIExtension implements UIExtension {\n protected t: ComposerTranslation;\n\n constructor(@unmanaged() messages: Record<string, Record<string, string>>) {\n const { t, mergeLocaleMessage } = useI18n();\n for (const messagesKey in messages) {\n mergeLocaleMessage(messagesKey, messages[messagesKey]);\n }\n this.t = t;\n }\n\n abstract id: string;\n abstract uixpName: string;\n abstract order: number;\n abstract parameters: { [key: string]: unknown };\n\n abstract enabled(): Promise<boolean>;\n abstract component(): Promise<Component>;\n}\n\nexport { AbstractUIExtension };\nexport type { UIExtension, UIExtensionsManager };\n"],"names":["AbstractUIExtension","messages","mergeLocaleMessage","useI18n","messagesKey","__decorateClass","injectable","__decorateParam","unmanaged"],"mappings":";;;;;;;AAoFA,IAAeA,IAAf,MAA0D;AAAA,EAC9C;AAAA,EAEV,YAAyBC,GAAkD;AACzE,UAAM,EAAE,GAAG,oBAAAC,EAAA,IAAuBC,EAAA;AAClC,eAAWC,KAAeH;AACxB,MAAAC,EAAmBE,GAAaH,EAASG,CAAW,CAAC;AAEvD,SAAK,IAAI;AAAA,EACX;AASF;AAlBeJ,IAAfK,EAAA;AAAA,EADCC,EAAA;AAAA,EAIcC,EAAA,GAAAC,EAAA,CAAU;AAAA,GAHVR,CAAA;"}
@@ -0,0 +1,2 @@
1
+ (function(e,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("inversify"),require("vue-i18n")):typeof define=="function"&&define.amd?define(["exports","inversify","vue-i18n"],i):(e=typeof globalThis<"u"?globalThis:e||self,i(e["cristal_uiextension-api"]={},e.inversify,e.vueI18n))})(this,(function(e,i,a){"use strict";var f=Object.getOwnPropertyDescriptor,d=(r,t,o,s)=>{for(var n=s>1?void 0:s?f(t,o):t,u=r.length-1,c;u>=0;u--)(c=r[u])&&(n=c(n)||n);return n},v=(r,t)=>(o,s)=>t(o,s,r);e.AbstractUIExtension=class{t;constructor(t){const{t:o,mergeLocaleMessage:s}=a.useI18n();for(const n in t)s(n,t[n]);this.t=o}},e.AbstractUIExtension=d([i.injectable(),v(0,i.unmanaged())],e.AbstractUIExtension),Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}));
2
+ //# sourceMappingURL=index.umd.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.umd.js","sources":["../src/index.ts"],"sourcesContent":["/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport { injectable, unmanaged } from \"inversify\";\nimport { useI18n } from \"vue-i18n\";\nimport type { Component } from \"vue\";\nimport type { ComposerTranslation } from \"vue-i18n\";\n\n/**\n * Define the information held by a UI Extension (UIX).\n *\n * @since 0.11\n * @beta\n */\ninterface UIExtension {\n /**\n * The unique id of an UI Extension\n */\n id: string;\n\n /**\n * The id of the extension point where this UIX should be injected.\n */\n uixpName: string;\n\n /**\n * The order of the UIX. The lowest values are expected to be presented\n * first.\n */\n order: number;\n\n /**\n * A free set of parameters.\n */\n parameters: { [key: string]: unknown };\n\n /**\n * Compute if the UIX should be displayed.\n */\n enabled(): Promise<boolean>;\n\n /**\n * The UI component of the UIX.\n */\n component(): Promise<Component>;\n}\n\n/**\n * @since 0.11\n * @beta\n */\ninterface UIExtensionsManager {\n /**\n *\n * @param name - the name of the UIXP\n * @returns a list of UIExtension components, sorted by ascending order. disabled UIExtensions are excluded\n */\n list(name: string): Promise<UIExtension[]>;\n}\n\n/**\n * Abstract class helping with localization of UI extensions.\n *\n * @since 0.23\n * @beta\n */\n@injectable()\nabstract class AbstractUIExtension implements UIExtension {\n protected t: ComposerTranslation;\n\n constructor(@unmanaged() messages: Record<string, Record<string, string>>) {\n const { t, mergeLocaleMessage } = useI18n();\n for (const messagesKey in messages) {\n mergeLocaleMessage(messagesKey, messages[messagesKey]);\n }\n this.t = t;\n }\n\n abstract id: string;\n abstract uixpName: string;\n abstract order: number;\n abstract parameters: { [key: string]: unknown };\n\n abstract enabled(): Promise<boolean>;\n abstract component(): Promise<Component>;\n}\n\nexport { AbstractUIExtension };\nexport type { UIExtension, UIExtensionsManager };\n"],"names":["AbstractUIExtension","messages","t","mergeLocaleMessage","useI18n","messagesKey","__decorateClass","injectable","__decorateParam","unmanaged"],"mappings":"kfAoFeA,EAAAA,oBAAf,KAA0D,CAC9C,EAEV,YAAyBC,EAAkD,CACzE,KAAM,CAAE,EAAAC,EAAG,mBAAAC,CAAA,EAAuBC,UAAA,EAClC,UAAWC,KAAeJ,EACxBE,EAAmBE,EAAaJ,EAASI,CAAW,CAAC,EAEvD,KAAK,EAAIH,CACX,CASF,EAlBeF,EAAAA,oBAAfM,EAAA,CADCC,aAAA,EAIcC,EAAA,EAAAC,YAAA,CAAU,CAAA,EAHVT,qBAAA"}
@@ -4,8 +4,8 @@
4
4
 
5
5
  ```ts
6
6
 
7
- import type { Component } from 'vue';
8
- import type { ComposerTranslation } from 'vue-i18n';
7
+ import { Component } from 'vue';
8
+ import { ComposerTranslation } from 'vue-i18n';
9
9
 
10
10
  // @beta
11
11
  export abstract class AbstractUIExtension implements UIExtension {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xwiki/cristal-uiextension-api",
3
- "version": "0.23.0",
3
+ "version": "0.23.1",
4
4
  "license": "LGPL 2.1",
5
5
  "author": "XWiki Org Community <contact@xwiki.org>",
6
6
  "homepage": "https://cristal.xwiki.org/",
@@ -15,11 +15,17 @@
15
15
  "type": "module",
16
16
  "exports": {
17
17
  ".": {
18
- "types": "./dist/index.d.ts",
19
- "import": "./src/index.ts"
18
+ "import": {
19
+ "types": "./dist/index.d.ts",
20
+ "default": "./dist/index.es.js"
21
+ },
22
+ "require": {
23
+ "types": "./dist/index.d.cts",
24
+ "default": "./dist/index.umd.js"
25
+ }
20
26
  }
21
27
  },
22
- "main": "./src/index.ts",
28
+ "main": "./dist/index.es.js",
23
29
  "types": "./dist/index.d.ts",
24
30
  "dependencies": {
25
31
  "vue-i18n": "11.1.12"
@@ -30,14 +36,19 @@
30
36
  "vue": "3.x"
31
37
  },
32
38
  "devDependencies": {
39
+ "inversify": "7.10.2",
40
+ "reflect-metadata": "0.2.2",
33
41
  "typescript": "5.9.3",
42
+ "vite": "7.1.9",
34
43
  "vue": "3.5.22",
35
- "@xwiki/cristal-dev-config": "0.23.0"
44
+ "@xwiki/cristal-dev-config": "0.23.1"
36
45
  },
37
46
  "scripts": {
38
47
  "api-extractor:local": "api-extractor run --local",
39
- "build": "rimraf dist && tsc",
48
+ "build": "vite build",
40
49
  "clean": "rimraf dist",
41
- "lint": "eslint \"./src/**/*.{ts,tsx,vue}\" --max-warnings=0"
50
+ "lint": "eslint \"./src/**/*.{ts,tsx,vue}\" --max-warnings=0",
51
+ "test": "vitest --run",
52
+ "typecheck": "tsc"
42
53
  }
43
54
  }
package/tsconfig.json CHANGED
@@ -2,10 +2,7 @@
2
2
  "compilerOptions": {
3
3
  "rootDir": "src",
4
4
  "outDir": "dist",
5
- "resolveJsonModule": true,
6
- "emitDeclarationOnly": true,
7
- "noEmit": false,
8
- "declarationMap": true
5
+ "resolveJsonModule": true
9
6
  },
10
7
  "extends": "../../../tsconfig.json",
11
8
  "include": [
package/vite.config.ts ADDED
@@ -0,0 +1,23 @@
1
+ /**
2
+ * See the LICENSE file distributed with this work for additional
3
+ * information regarding copyright ownership.
4
+ *
5
+ * This is free software; you can redistribute it and/or modify it
6
+ * under the terms of the GNU Lesser General Public License as
7
+ * published by the Free Software Foundation; either version 2.1 of
8
+ * the License, or (at your option) any later version.
9
+ *
10
+ * This software is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ * Lesser General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Lesser General Public
16
+ * License along with this software; if not, write to the Free
17
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19
+ */
20
+
21
+ import { generateConfig } from "../../../vite.config";
22
+
23
+ export default generateConfig(import.meta.url);
@@ -0,0 +1,25 @@
1
+ /**
2
+ * See the LICENSE file distributed with this work for additional
3
+ * information regarding copyright ownership.
4
+ *
5
+ * This is free software; you can redistribute it and/or modify it
6
+ * under the terms of the GNU Lesser General Public License as
7
+ * published by the Free Software Foundation; either version 2.1 of
8
+ * the License, or (at your option) any later version.
9
+ *
10
+ * This software is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ * Lesser General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Lesser General Public
16
+ * License along with this software; if not, write to the Free
17
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19
+ */
20
+
21
+ import localConfig from "./vite.config";
22
+ import { vitestVue as defaultConfig } from "@xwiki/cristal-dev-config";
23
+ import { mergeConfig } from "vitest/config";
24
+
25
+ export default mergeConfig(defaultConfig, localConfig);
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,OAAO,KAAK,E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