@xwiki/cristal-history-ui 0.17.0 → 0.18.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 CHANGED
@@ -1,5 +1,20 @@
1
1
  # @xwiki/cristal-history-ui
2
2
 
3
+ ## 0.18.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Cristal 0.18 Release
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies
12
+ - @xwiki/cristal-api@0.18.0
13
+ - @xwiki/cristal-document-api@0.18.0
14
+ - @xwiki/cristal-extra-tabs-api@0.18.0
15
+ - @xwiki/cristal-history-api@0.18.0
16
+ - @xwiki/cristal-user-ui@0.18.0
17
+
3
18
  ## 0.17.0
4
19
 
5
20
  ### Minor Changes
package/dist/index.es.js CHANGED
@@ -1,49 +1,49 @@
1
1
  (function(){"use strict";try{if(typeof document<"u"){var a=document.createElement("style");a.appendChild(document.createTextNode("p[data-v-4a4df957]{font-size:var(--cr-font-size-medium)}table[data-v-4a4df957]{border-collapse:collapse}table tr[data-v-4a4df957]:hover{background-color:var(--cr-color-neutral-200)}table td[data-v-4a4df957]{vertical-align:top;padding:var(--cr-spacing-small)}table td[data-v-4a4df957]:first-child{border-radius:var(--cr-border-radius-medium) 0 0 var(--cr-border-radius-medium)}table td[data-v-4a4df957]:last-child{border-radius:0 var(--cr-border-radius-medium) var(--cr-border-radius-medium) 0}table .history-revision-cell[data-v-4a4df957]{text-align:center}table .history-revision[data-v-4a4df957]{background-color:var(--cr-color-neutral-300);border-radius:var(--cr-border-radius-pill);padding:var(--cr-spacing-2x-small);font-size:var(--cr-font-size-x-small)}")),document.head.appendChild(a)}}catch(r){console.error("vite-plugin-css-injected-by-js",r)}})();
2
- import { defineComponent as x, inject as T, ref as m, onMounted as P, resolveComponent as C, openBlock as c, createElementBlock as l, Fragment as v, toDisplayString as d, unref as p, createElementVNode as u, renderList as R, createVNode as _, withCtx as g, createTextVNode as S, createCommentVNode as j } from "vue";
3
- import { name as E } from "@xwiki/cristal-document-api";
4
- import { User as H } from "@xwiki/cristal-user-ui";
5
- import { useI18n as M } from "vue-i18n";
6
- import { AbstractExtraTab as O } from "@xwiki/cristal-extra-tabs-api";
7
- import { injectable as k, inject as w } from "inversify";
8
- const D = {
2
+ import { defineComponent as f, inject as T, ref as m, onMounted as C, resolveComponent as P, createElementBlock as c, openBlock as l, Fragment as p, createElementVNode as u, createCommentVNode as k, toDisplayString as d, unref as y, renderList as R, createVNode as g, createTextVNode as S, withCtx as _ } from "vue";
3
+ import { name as j } from "@xwiki/cristal-document-api";
4
+ import { User as E } from "@xwiki/cristal-user-ui";
5
+ import { useI18n as H } from "vue-i18n";
6
+ import { AbstractExtraTab as M } from "@xwiki/cristal-extra-tabs-api";
7
+ import { injectable as w, inject as D } from "inversify";
8
+ const L = {
9
9
  "history.extraTabs.title": "History",
10
10
  "history.extraTabs.loading": "Loading...",
11
11
  "history.extraTabs.header": "This page has {nRevisions} versions stored.",
12
12
  "history.extraTabs.entry": "{date} by {user}"
13
- }, L = {
13
+ }, N = {
14
14
  "history.extraTabs.title": "Historique",
15
15
  "history.extraTabs.loading": "Chargement en cours ...",
16
16
  "history.extraTabs.header": "Ce document a {nRevisions} versions stockées.",
17
17
  "history.extraTabs.entry": "{date} par {user}"
18
18
  }, b = {
19
- en: D,
20
- fr: L
21
- }, N = { key: 0 }, V = { key: 1 }, I = { key: 2 }, B = { class: "history-revision-cell" }, q = { class: "history-revision" }, A = ["href"], F = /* @__PURE__ */ x({
19
+ en: L,
20
+ fr: N
21
+ }, O = { key: 0 }, V = { key: 1 }, I = { key: 2 }, B = { class: "history-revision-cell" }, q = { class: "history-revision" }, A = ["href"], F = /* @__PURE__ */ f({
22
22
  __name: "HistoryTab",
23
- setup(r) {
24
- const { t: e } = M({
23
+ setup(e) {
24
+ const { t } = H({
25
25
  messages: b
26
- }), s = T("cristal"), t = s.getContainer().get(E).getCurrentDocument(), n = m([]), a = m(!0);
27
- return P(async () => {
28
- t.value && (n.value = await s.getContainer().get("PageRevisionManagerProvider").get().getRevisions(t.value)), a.value = !1;
29
- }), (Q, h) => {
30
- const f = C("i18n-t");
31
- return c(), l(v, null, [
32
- a.value ? (c(), l("p", N, d(p(e)("history.extraTabs.loading")), 1)) : (c(), l("p", V, d(p(e)("history.extraTabs.header", { nRevisions: n.value.length })), 1)),
26
+ }), r = T("cristal"), s = r.getContainer().get(j).getCurrentDocument(), n = m([]), a = m(!0);
27
+ return C(async () => {
28
+ s.value && (n.value = await r.getContainer().get("PageRevisionManagerProvider").get().getRevisions(s.value)), a.value = !1;
29
+ }), (K, h) => {
30
+ const x = P("i18n-t");
31
+ return l(), c(p, null, [
32
+ a.value ? (l(), c("p", O, d(y(t)("history.extraTabs.loading")), 1)) : (l(), c("p", V, d(y(t)("history.extraTabs.header", { nRevisions: n.value.length })), 1)),
33
33
  h[1] || (h[1] = u("br", null, null, -1)),
34
- a.value ? j("", !0) : (c(), l("table", I, [
35
- (c(!0), l(v, null, R(n.value, (i) => (c(), l("tr", {
34
+ a.value ? k("", !0) : (l(), c("table", I, [
35
+ (l(!0), c(p, null, R(n.value, (i) => (l(), c("tr", {
36
36
  key: i.version
37
37
  }, [
38
38
  u("td", B, [
39
39
  u("span", q, d(i.version), 1)
40
40
  ]),
41
41
  u("td", null, [
42
- _(f, {
42
+ g(x, {
43
43
  keypath: "history.extraTabs.entry",
44
44
  tag: "span"
45
45
  }, {
46
- date: g(() => [
46
+ date: _(() => [
47
47
  u("a", {
48
48
  href: i.url
49
49
  }, d(i.date.toLocaleString(void 0, {
@@ -51,8 +51,8 @@ const D = {
51
51
  timeStyle: "short"
52
52
  })), 9, A)
53
53
  ]),
54
- user: g(() => [
55
- _(p(H), {
54
+ user: _(() => [
55
+ g(y(E), {
56
56
  user: i.user
57
57
  }, null, 8, ["user"])
58
58
  ]),
@@ -66,20 +66,20 @@ const D = {
66
66
  ], 64);
67
67
  };
68
68
  }
69
- }), U = (r, e) => {
70
- const s = r.__vccOpts || r;
71
- for (const [o, t] of e)
72
- s[o] = t;
73
- return s;
69
+ }), U = (e, t) => {
70
+ const r = e.__vccOpts || e;
71
+ for (const [o, s] of t)
72
+ r[o] = s;
73
+ return r;
74
74
  }, $ = /* @__PURE__ */ U(F, [["__scopeId", "data-v-4a4df957"]]);
75
- var z = Object.defineProperty, G = Object.getOwnPropertyDescriptor, J = (r, e, s, o) => {
76
- for (var t = o > 1 ? void 0 : o ? G(e, s) : e, n = r.length - 1, a; n >= 0; n--)
77
- (a = r[n]) && (t = (o ? a(e, s, t) : a(t)) || t);
78
- return o && t && z(e, s, t), t;
79
- }, K = (r, e) => (s, o) => e(s, o, r);
80
- let y = class extends O {
81
- constructor(r) {
82
- super(b), this.pageRevisionManagerProvider = r, this.order = 3e3, this.id = "history", this.title = this.t("history.extraTabs.title");
75
+ var z = Object.getOwnPropertyDescriptor, G = (e, t, r, o) => {
76
+ for (var s = o > 1 ? void 0 : o ? z(t, r) : t, n = e.length - 1, a; n >= 0; n--)
77
+ (a = e[n]) && (s = a(s) || s);
78
+ return s;
79
+ }, J = (e, t) => (r, o) => t(r, o, e);
80
+ let v = class extends M {
81
+ constructor(e) {
82
+ super(b), this.pageRevisionManagerProvider = e, this.order = 3e3, this.id = "history", this.title = this.t("history.extraTabs.title");
83
83
  }
84
84
  async panel() {
85
85
  return $;
@@ -88,16 +88,16 @@ let y = class extends O {
88
88
  return this.pageRevisionManagerProvider.has();
89
89
  }
90
90
  };
91
- y = J([
92
- k(),
93
- K(0, w("PageRevisionManagerProvider"))
94
- ], y);
95
- class re {
96
- constructor(e) {
97
- e.bind("ExtraTab").to(y).inSingletonScope();
91
+ v = G([
92
+ w(),
93
+ J(0, D("PageRevisionManagerProvider"))
94
+ ], v);
95
+ class te {
96
+ constructor(t) {
97
+ t.bind("ExtraTab").to(v).inSingletonScope();
98
98
  }
99
99
  }
100
100
  export {
101
- re as ComponentInit
101
+ te as ComponentInit
102
102
  };
103
103
  //# sourceMappingURL=index.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.es.js","sources":["../src/translations.ts","../src/vue/HistoryTab.vue","../src/HistoryExtraTab.ts","../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 en from \"../langs/translation-en.json\";\nimport fr from \"../langs/translation-fr.json\";\n\nconst translations: Record<string, Record<string, string>> = {\n en,\n fr,\n};\nexport default translations;\n","<!--\nSee the LICENSE file distributed with this work for additional\ninformation regarding copyright ownership.\n\nThis is free software; you can redistribute it and/or modify it\nunder the terms of the GNU Lesser General Public License as\npublished by the Free Software Foundation; either version 2.1 of\nthe License, or (at your option) any later version.\n\nThis software is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\nLesser General Public License for more details.\n\nYou should have received a copy of the GNU Lesser General Public\nLicense along with this software; if not, write to the Free\nSoftware Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n02110-1301 USA, or see the FSF site: http://www.fsf.org.\n-->\n<script setup lang=\"ts\">\nimport messages from \"../translations\";\nimport { name as documentServiceName } from \"@xwiki/cristal-document-api\";\nimport { User } from \"@xwiki/cristal-user-ui\";\nimport { inject, onMounted, ref } from \"vue\";\nimport { useI18n } from \"vue-i18n\";\nimport type { CristalApp, PageData } from \"@xwiki/cristal-api\";\nimport type { DocumentService } from \"@xwiki/cristal-document-api\";\nimport type {\n PageRevision,\n PageRevisionManagerProvider,\n} from \"@xwiki/cristal-history-api\";\nimport type { Ref } from \"vue\";\n\nconst { t } = useI18n({\n messages,\n});\nconst cristal: CristalApp = inject<CristalApp>(\"cristal\")!;\nconst documentService = cristal\n .getContainer()\n .get<DocumentService>(documentServiceName);\nconst currentPage: Ref<PageData | undefined> =\n documentService.getCurrentDocument();\nconst revisions: Ref<Array<PageRevision>> = ref([]);\nconst isLoading: Ref<boolean> = ref(true);\n\nonMounted(async () => {\n if (currentPage.value) {\n revisions.value = await cristal\n .getContainer()\n .get<PageRevisionManagerProvider>(\"PageRevisionManagerProvider\")\n .get()\n .getRevisions(currentPage.value);\n }\n isLoading.value = false;\n});\n</script>\n\n<template>\n <p v-if=\"isLoading\">{{ t(\"history.extraTabs.loading\") }}</p>\n <p v-else>\n {{ t(\"history.extraTabs.header\", { nRevisions: revisions.length }) }}\n </p>\n <br />\n <table v-if=\"!isLoading\">\n <tr v-for=\"revision of revisions\" :key=\"revision.version\">\n <td class=\"history-revision-cell\">\n <span class=\"history-revision\">{{ revision.version }}</span>\n </td>\n <td>\n <i18n-t keypath=\"history.extraTabs.entry\" tag=\"span\">\n <template #date>\n <a :href=\"revision.url\">{{\n revision.date.toLocaleString(undefined, {\n dateStyle: \"short\",\n timeStyle: \"short\",\n })\n }}</a>\n </template>\n <template #user>\n <user :user=\"revision.user\" />\n </template>\n </i18n-t>\n <br />\n {{ revision.comment }}\n </td>\n </tr>\n </table>\n</template>\n\n<style scoped>\np {\n font-size: var(--cr-font-size-medium);\n}\ntable {\n border-collapse: collapse;\n}\ntable tr:hover {\n background-color: var(--cr-color-neutral-200);\n}\ntable td {\n vertical-align: top;\n padding: var(--cr-spacing-small);\n}\ntable td:first-child {\n border-radius: var(--cr-border-radius-medium) 0 0\n var(--cr-border-radius-medium);\n}\ntable td:last-child {\n border-radius: 0 var(--cr-border-radius-medium) var(--cr-border-radius-medium)\n 0;\n}\ntable .history-revision-cell {\n text-align: center;\n}\ntable .history-revision {\n background-color: var(--cr-color-neutral-300);\n border-radius: var(--cr-border-radius-pill);\n padding: var(--cr-spacing-2x-small);\n font-size: var(--cr-font-size-x-small);\n}\n</style>\n","/*\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 messages from \"./translations\";\nimport HistoryTab from \"./vue/HistoryTab.vue\";\nimport { AbstractExtraTab } from \"@xwiki/cristal-extra-tabs-api\";\nimport { inject, injectable } from \"inversify\";\nimport { Component } from \"vue\";\nimport type { PageRevisionManagerProvider } from \"@xwiki/cristal-history-api\";\n\n@injectable()\nexport class HistoryExtraTab extends AbstractExtraTab {\n title: string;\n\n constructor(\n @inject(\"PageRevisionManagerProvider\")\n private readonly pageRevisionManagerProvider: PageRevisionManagerProvider,\n ) {\n super(messages);\n this.title = this.t(\"history.extraTabs.title\");\n }\n\n order = 3000;\n id = \"history\";\n\n async panel(): Promise<Component> {\n return HistoryTab;\n }\n\n override async enabled(): Promise<boolean> {\n return this.pageRevisionManagerProvider.has();\n }\n}\n","/*\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 { HistoryExtraTab } from \"./HistoryExtraTab\";\nimport type { ExtraTab } from \"@xwiki/cristal-extra-tabs-api\";\nimport type { Container } from \"inversify\";\n\nexport class ComponentInit {\n constructor(container: Container) {\n container.bind<ExtraTab>(\"ExtraTab\").to(HistoryExtraTab).inSingletonScope();\n }\n}\n"],"names":["translations","en","fr","t","useI18n","messages","cristal","inject","currentPage","documentServiceName","revisions","ref","isLoading","onMounted","HistoryExtraTab","AbstractExtraTab","pageRevisionManagerProvider","HistoryTab","__decorateClass","injectable","__decorateParam","ComponentInit","container"],"mappings":";;;;;;;;;;;;;;;;GAuBMA,IAAuD;AAAA,EAC3D,IAAAC;AAAA,EACA,IAAAC;AACF;;;ACOM,UAAA,EAAE,GAAAC,EAAE,IAAIC,EAAQ;AAAA,MACpBC,UAAAA;AAAAA,IAAA,CACD,GACKC,IAAsBC,EAAmB,SAAS,GAIlDC,IAHkBF,EACrB,aAAa,EACb,IAAqBG,CAAmB,EAEzB,mBAAmB,GAC/BC,IAAsCC,EAAI,EAAE,GAC5CC,IAA0BD,EAAI,EAAI;AAExC,WAAAE,EAAU,YAAY;AACpB,MAAIL,EAAY,UACdE,EAAU,QAAQ,MAAMJ,EACrB,aAAA,EACA,IAAiC,6BAA6B,EAC9D,IAAI,EACJ,aAAaE,EAAY,KAAK,IAEnCI,EAAU,QAAQ;AAAA,IAAA,CACnB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC1BY,IAAAE,IAAN,cAA8BC,EAAiB;AAAA,EAGpD,YAEmBC,GACjB;AACA,UAAMX,CAAQ,GAFG,KAAA,8BAAAW,GAMX,KAAA,QAAA,KACH,KAAA,KAAA,WAJE,KAAA,QAAQ,KAAK,EAAE,yBAAyB;AAAA,EAAA;AAAA,EAM/C,MAAM,QAA4B;AACzB,WAAAC;AAAA,EAAA;AAAA,EAGT,MAAe,UAA4B;AAClC,WAAA,KAAK,4BAA4B,IAAI;AAAA,EAAA;AAEhD;AArBaH,IAANI,EAAA;AAAA,EADNC,EAAW;AAAA,EAKPC,OAAO,6BAA6B,CAAA;AAAA,GAJ5BN,CAAA;ACJN,MAAMO,GAAc;AAAA,EACzB,YAAYC,GAAsB;AAChC,IAAAA,EAAU,KAAe,UAAU,EAAE,GAAGR,CAAe,EAAE,iBAAiB;AAAA,EAAA;AAE9E;"}
1
+ {"version":3,"file":"index.es.js","sources":["../src/translations.ts","../src/vue/HistoryTab.vue","../src/HistoryExtraTab.ts","../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 en from \"../langs/translation-en.json\";\nimport fr from \"../langs/translation-fr.json\";\n\nconst translations: Record<string, Record<string, string>> = {\n en,\n fr,\n};\nexport default translations;\n","<!--\nSee the LICENSE file distributed with this work for additional\ninformation regarding copyright ownership.\n\nThis is free software; you can redistribute it and/or modify it\nunder the terms of the GNU Lesser General Public License as\npublished by the Free Software Foundation; either version 2.1 of\nthe License, or (at your option) any later version.\n\nThis software is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\nLesser General Public License for more details.\n\nYou should have received a copy of the GNU Lesser General Public\nLicense along with this software; if not, write to the Free\nSoftware Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n02110-1301 USA, or see the FSF site: http://www.fsf.org.\n-->\n<script setup lang=\"ts\">\nimport messages from \"../translations\";\nimport { name as documentServiceName } from \"@xwiki/cristal-document-api\";\nimport { User } from \"@xwiki/cristal-user-ui\";\nimport { inject, onMounted, ref } from \"vue\";\nimport { useI18n } from \"vue-i18n\";\nimport type { CristalApp, PageData } from \"@xwiki/cristal-api\";\nimport type { DocumentService } from \"@xwiki/cristal-document-api\";\nimport type {\n PageRevision,\n PageRevisionManagerProvider,\n} from \"@xwiki/cristal-history-api\";\nimport type { Ref } from \"vue\";\n\nconst { t } = useI18n({\n messages,\n});\nconst cristal: CristalApp = inject<CristalApp>(\"cristal\")!;\nconst documentService = cristal\n .getContainer()\n .get<DocumentService>(documentServiceName);\nconst currentPage: Ref<PageData | undefined> =\n documentService.getCurrentDocument();\nconst revisions: Ref<Array<PageRevision>> = ref([]);\nconst isLoading: Ref<boolean> = ref(true);\n\nonMounted(async () => {\n if (currentPage.value) {\n revisions.value = await cristal\n .getContainer()\n .get<PageRevisionManagerProvider>(\"PageRevisionManagerProvider\")\n .get()\n .getRevisions(currentPage.value);\n }\n isLoading.value = false;\n});\n</script>\n\n<template>\n <p v-if=\"isLoading\">{{ t(\"history.extraTabs.loading\") }}</p>\n <p v-else>\n {{ t(\"history.extraTabs.header\", { nRevisions: revisions.length }) }}\n </p>\n <br />\n <table v-if=\"!isLoading\">\n <tr v-for=\"revision of revisions\" :key=\"revision.version\">\n <td class=\"history-revision-cell\">\n <span class=\"history-revision\">{{ revision.version }}</span>\n </td>\n <td>\n <i18n-t keypath=\"history.extraTabs.entry\" tag=\"span\">\n <template #date>\n <a :href=\"revision.url\">{{\n revision.date.toLocaleString(undefined, {\n dateStyle: \"short\",\n timeStyle: \"short\",\n })\n }}</a>\n </template>\n <template #user>\n <user :user=\"revision.user\" />\n </template>\n </i18n-t>\n <br />\n {{ revision.comment }}\n </td>\n </tr>\n </table>\n</template>\n\n<style scoped>\np {\n font-size: var(--cr-font-size-medium);\n}\ntable {\n border-collapse: collapse;\n}\ntable tr:hover {\n background-color: var(--cr-color-neutral-200);\n}\ntable td {\n vertical-align: top;\n padding: var(--cr-spacing-small);\n}\ntable td:first-child {\n border-radius: var(--cr-border-radius-medium) 0 0\n var(--cr-border-radius-medium);\n}\ntable td:last-child {\n border-radius: 0 var(--cr-border-radius-medium) var(--cr-border-radius-medium)\n 0;\n}\ntable .history-revision-cell {\n text-align: center;\n}\ntable .history-revision {\n background-color: var(--cr-color-neutral-300);\n border-radius: var(--cr-border-radius-pill);\n padding: var(--cr-spacing-2x-small);\n font-size: var(--cr-font-size-x-small);\n}\n</style>\n","/*\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 messages from \"./translations\";\nimport HistoryTab from \"./vue/HistoryTab.vue\";\nimport { AbstractExtraTab } from \"@xwiki/cristal-extra-tabs-api\";\nimport { inject, injectable } from \"inversify\";\nimport { Component } from \"vue\";\nimport type { PageRevisionManagerProvider } from \"@xwiki/cristal-history-api\";\n\n@injectable()\nexport class HistoryExtraTab extends AbstractExtraTab {\n title: string;\n\n constructor(\n @inject(\"PageRevisionManagerProvider\")\n private readonly pageRevisionManagerProvider: PageRevisionManagerProvider,\n ) {\n super(messages);\n this.title = this.t(\"history.extraTabs.title\");\n }\n\n order = 3000;\n id = \"history\";\n\n async panel(): Promise<Component> {\n return HistoryTab;\n }\n\n override async enabled(): Promise<boolean> {\n return this.pageRevisionManagerProvider.has();\n }\n}\n","/*\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 { HistoryExtraTab } from \"./HistoryExtraTab\";\nimport type { ExtraTab } from \"@xwiki/cristal-extra-tabs-api\";\nimport type { Container } from \"inversify\";\n\nexport class ComponentInit {\n constructor(container: Container) {\n container.bind<ExtraTab>(\"ExtraTab\").to(HistoryExtraTab).inSingletonScope();\n }\n}\n"],"names":["translations","en","fr","useI18n","messages","cristal","inject","currentPage","documentServiceName","revisions","ref","isLoading","onMounted","HistoryExtraTab","AbstractExtraTab","pageRevisionManagerProvider","HistoryTab","__decorateClass","injectable","__decorateParam","ComponentInit","container"],"mappings":";;;;;;;;;;;;;;;;GAuBMA,IAAuD;AAAA,EAC3D,IAAAC;AAAA,EACA,IAAAC;AACF;;;ACOM,UAAA,EAAE,EAAE,IAAIC,EAAQ;AAAA,MACpBC,UAAAA;AAAAA,IAAA,CACD,GACKC,IAAsBC,EAAmB,SAAS,GAIlDC,IAHkBF,EACrB,aAAa,EACb,IAAqBG,CAAmB,EAEzB,mBAAmB,GAC/BC,IAAsCC,EAAI,EAAE,GAC5CC,IAA0BD,EAAI,EAAI;AAExC,WAAAE,EAAU,YAAY;AACpB,MAAIL,EAAY,UACdE,EAAU,QAAQ,MAAMJ,EACrB,aAAA,EACA,IAAiC,6BAA6B,EAC9D,IAAI,EACJ,aAAaE,EAAY,KAAK,IAEnCI,EAAU,QAAQ;AAAA,IAAA,CACnB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC1BY,IAAAE,IAAN,cAA8BC,EAAiB;AAAA,EAGpD,YAEmBC,GACjB;AACA,UAAMX,CAAQ,GAFG,KAAA,8BAAAW,GAMX,KAAA,QAAA,KACH,KAAA,KAAA,WAJE,KAAA,QAAQ,KAAK,EAAE,yBAAyB;AAAA,EAAA;AAAA,EAM/C,MAAM,QAA4B;AACzB,WAAAC;AAAA,EAAA;AAAA,EAGT,MAAe,UAA4B;AAClC,WAAA,KAAK,4BAA4B,IAAI;AAAA,EAAA;AAEhD;AArBaH,IAANI,EAAA;AAAA,EADNC,EAAW;AAAA,EAKPC,OAAO,6BAA6B,CAAA;AAAA,GAJ5BN,CAAA;ACJN,MAAMO,GAAc;AAAA,EACzB,YAAYC,GAAsB;AAChC,IAAAA,EAAU,KAAe,UAAU,EAAE,GAAGR,CAAe,EAAE,iBAAiB;AAAA,EAAA;AAE9E;"}
package/dist/index.umd.js CHANGED
@@ -1,4 +1,4 @@
1
1
  (function(){"use strict";try{if(typeof document<"u"){var a=document.createElement("style");a.appendChild(document.createTextNode("p[data-v-4a4df957]{font-size:var(--cr-font-size-medium)}table[data-v-4a4df957]{border-collapse:collapse}table tr[data-v-4a4df957]:hover{background-color:var(--cr-color-neutral-200)}table td[data-v-4a4df957]{vertical-align:top;padding:var(--cr-spacing-small)}table td[data-v-4a4df957]:first-child{border-radius:var(--cr-border-radius-medium) 0 0 var(--cr-border-radius-medium)}table td[data-v-4a4df957]:last-child{border-radius:0 var(--cr-border-radius-medium) var(--cr-border-radius-medium) 0}table .history-revision-cell[data-v-4a4df957]{text-align:center}table .history-revision[data-v-4a4df957]{background-color:var(--cr-color-neutral-300);border-radius:var(--cr-border-radius-pill);padding:var(--cr-spacing-2x-small);font-size:var(--cr-font-size-x-small)}")),document.head.appendChild(a)}}catch(r){console.error("vite-plugin-css-injected-by-js",r)}})();
2
- (function(r,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("@xwiki/cristal-document-api"),require("@xwiki/cristal-user-ui"),require("vue-i18n"),require("@xwiki/cristal-extra-tabs-api"),require("inversify")):typeof define=="function"&&define.amd?define(["exports","vue","@xwiki/cristal-document-api","@xwiki/cristal-user-ui","vue-i18n","@xwiki/cristal-extra-tabs-api","inversify"],e):(r=typeof globalThis<"u"?globalThis:r||self,e(r["cristal_history-ui"]={},r.Vue,r.cristalDocumentApi,r.cristalUserUi,r.vueI18n,r.cristalExtraTabsApi,r.inversify))})(this,function(r,e,h,y,b,_,u){"use strict";var m=document.createElement("style");m.textContent=`p[data-v-4a4df957]{font-size:var(--cr-font-size-medium)}table[data-v-4a4df957]{border-collapse:collapse}table tr[data-v-4a4df957]:hover{background-color:var(--cr-color-neutral-200)}table td[data-v-4a4df957]{vertical-align:top;padding:var(--cr-spacing-small)}table td[data-v-4a4df957]:first-child{border-radius:var(--cr-border-radius-medium) 0 0 var(--cr-border-radius-medium)}table td[data-v-4a4df957]:last-child{border-radius:0 var(--cr-border-radius-medium) var(--cr-border-radius-medium) 0}table .history-revision-cell[data-v-4a4df957]{text-align:center}table .history-revision[data-v-4a4df957]{background-color:var(--cr-color-neutral-300);border-radius:var(--cr-border-radius-pill);padding:var(--cr-spacing-2x-small);font-size:var(--cr-font-size-x-small)}
3
- /*$vite$:1*/`,document.head.appendChild(m);const f={en:{"history.extraTabs.title":"History","history.extraTabs.loading":"Loading...","history.extraTabs.header":"This page has {nRevisions} versions stored.","history.extraTabs.entry":"{date} by {user}"},fr:{"history.extraTabs.title":"Historique","history.extraTabs.loading":"Chargement en cours ...","history.extraTabs.header":"Ce document a {nRevisions} versions stockées.","history.extraTabs.entry":"{date} par {user}"}},g={key:0},x={key:1},v={key:2},T={class:"history-revision-cell"},k={class:"history-revision"},E=["href"],C=((n,t)=>{const i=n.__vccOpts||n;for(const[s,a]of t)i[s]=a;return i})(e.defineComponent({__name:"HistoryTab",setup(n){const{t}=b.useI18n({messages:f}),i=e.inject("cristal"),a=i.getContainer().get(h.name).getCurrentDocument(),o=e.ref([]),c=e.ref(!0);return e.onMounted(async()=>{a.value&&(o.value=await i.getContainer().get("PageRevisionManagerProvider").get().getRevisions(a.value)),c.value=!1}),(M,d)=>{const N=e.resolveComponent("i18n-t");return e.openBlock(),e.createElementBlock(e.Fragment,null,[c.value?(e.openBlock(),e.createElementBlock("p",g,e.toDisplayString(e.unref(t)("history.extraTabs.loading")),1)):(e.openBlock(),e.createElementBlock("p",x,e.toDisplayString(e.unref(t)("history.extraTabs.header",{nRevisions:o.value.length})),1)),d[1]||(d[1]=e.createElementVNode("br",null,null,-1)),c.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("table",v,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,l=>(e.openBlock(),e.createElementBlock("tr",{key:l.version},[e.createElementVNode("td",T,[e.createElementVNode("span",k,e.toDisplayString(l.version),1)]),e.createElementVNode("td",null,[e.createVNode(N,{keypath:"history.extraTabs.entry",tag:"span"},{date:e.withCtx(()=>[e.createElementVNode("a",{href:l.url},e.toDisplayString(l.date.toLocaleString(void 0,{dateStyle:"short",timeStyle:"short"})),9,E)]),user:e.withCtx(()=>[e.createVNode(e.unref(y.User),{user:l.user},null,8,["user"])]),_:2},1024),d[0]||(d[0]=e.createElementVNode("br",null,null,-1)),e.createTextVNode(" "+e.toDisplayString(l.comment),1)])]))),128))]))],64)}}}),[["__scopeId","data-v-4a4df957"]]);var S=Object.defineProperty,P=Object.getOwnPropertyDescriptor,B=(n,t,i,s)=>{for(var a=s>1?void 0:s?P(t,i):t,o=n.length-1,c;o>=0;o--)(c=n[o])&&(a=(s?c(t,i,a):c(a))||a);return s&&a&&S(t,i,a),a},w=(n,t)=>(i,s)=>t(i,s,n);let p=class extends _.AbstractExtraTab{constructor(n){super(f),this.pageRevisionManagerProvider=n,this.order=3e3,this.id="history",this.title=this.t("history.extraTabs.title")}async panel(){return C}async enabled(){return this.pageRevisionManagerProvider.has()}};p=B([u.injectable(),w(0,u.inject("PageRevisionManagerProvider"))],p);class V{constructor(t){t.bind("ExtraTab").to(p).inSingletonScope()}}r.ComponentInit=V,Object.defineProperty(r,Symbol.toStringTag,{value:"Module"})});
2
+ (function(t,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("@xwiki/cristal-document-api"),require("@xwiki/cristal-user-ui"),require("vue-i18n"),require("@xwiki/cristal-extra-tabs-api"),require("inversify")):typeof define=="function"&&define.amd?define(["exports","vue","@xwiki/cristal-document-api","@xwiki/cristal-user-ui","vue-i18n","@xwiki/cristal-extra-tabs-api","inversify"],e):(t=typeof globalThis<"u"?globalThis:t||self,e(t["cristal_history-ui"]={},t.Vue,t.cristalDocumentApi,t.cristalUserUi,t.vueI18n,t.cristalExtraTabsApi,t.inversify))})(this,function(t,e,y,f,b,g,u){"use strict";var m=document.createElement("style");m.textContent=`p[data-v-4a4df957]{font-size:var(--cr-font-size-medium)}table[data-v-4a4df957]{border-collapse:collapse}table tr[data-v-4a4df957]:hover{background-color:var(--cr-color-neutral-200)}table td[data-v-4a4df957]{vertical-align:top;padding:var(--cr-spacing-small)}table td[data-v-4a4df957]:first-child{border-radius:var(--cr-border-radius-medium) 0 0 var(--cr-border-radius-medium)}table td[data-v-4a4df957]:last-child{border-radius:0 var(--cr-border-radius-medium) var(--cr-border-radius-medium) 0}table .history-revision-cell[data-v-4a4df957]{text-align:center}table .history-revision[data-v-4a4df957]{background-color:var(--cr-color-neutral-300);border-radius:var(--cr-border-radius-pill);padding:var(--cr-spacing-2x-small);font-size:var(--cr-font-size-x-small)}
3
+ /*$vite$:1*/`,document.head.appendChild(m);const h={en:{"history.extraTabs.title":"History","history.extraTabs.loading":"Loading...","history.extraTabs.header":"This page has {nRevisions} versions stored.","history.extraTabs.entry":"{date} by {user}"},fr:{"history.extraTabs.title":"Historique","history.extraTabs.loading":"Chargement en cours ...","history.extraTabs.header":"Ce document a {nRevisions} versions stockées.","history.extraTabs.entry":"{date} par {user}"}},_={key:0},x={key:1},v={key:2},k={class:"history-revision-cell"},T={class:"history-revision"},E=["href"],C=((r,a)=>{const i=r.__vccOpts||r;for(const[s,n]of a)i[s]=n;return i})(e.defineComponent({__name:"HistoryTab",setup(r){const{t:a}=b.useI18n({messages:h}),i=e.inject("cristal"),n=i.getContainer().get(y.name).getCurrentDocument(),o=e.ref([]),c=e.ref(!0);return e.onMounted(async()=>{n.value&&(o.value=await i.getContainer().get("PageRevisionManagerProvider").get().getRevisions(n.value)),c.value=!1}),(j,d)=>{const V=e.resolveComponent("i18n-t");return e.openBlock(),e.createElementBlock(e.Fragment,null,[c.value?(e.openBlock(),e.createElementBlock("p",_,e.toDisplayString(e.unref(a)("history.extraTabs.loading")),1)):(e.openBlock(),e.createElementBlock("p",x,e.toDisplayString(e.unref(a)("history.extraTabs.header",{nRevisions:o.value.length})),1)),d[1]||(d[1]=e.createElementVNode("br",null,null,-1)),c.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("table",v,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,l=>(e.openBlock(),e.createElementBlock("tr",{key:l.version},[e.createElementVNode("td",k,[e.createElementVNode("span",T,e.toDisplayString(l.version),1)]),e.createElementVNode("td",null,[e.createVNode(V,{keypath:"history.extraTabs.entry",tag:"span"},{date:e.withCtx(()=>[e.createElementVNode("a",{href:l.url},e.toDisplayString(l.date.toLocaleString(void 0,{dateStyle:"short",timeStyle:"short"})),9,E)]),user:e.withCtx(()=>[e.createVNode(e.unref(f.User),{user:l.user},null,8,["user"])]),_:2},1024),d[0]||(d[0]=e.createElementVNode("br",null,null,-1)),e.createTextVNode(" "+e.toDisplayString(l.comment),1)])]))),128))]))],64)}}}),[["__scopeId","data-v-4a4df957"]]);var S=Object.getOwnPropertyDescriptor,B=(r,a,i,s)=>{for(var n=s>1?void 0:s?S(a,i):a,o=r.length-1,c;o>=0;o--)(c=r[o])&&(n=c(n)||n);return n},w=(r,a)=>(i,s)=>a(i,s,r);let p=class extends g.AbstractExtraTab{constructor(r){super(h),this.pageRevisionManagerProvider=r,this.order=3e3,this.id="history",this.title=this.t("history.extraTabs.title")}async panel(){return C}async enabled(){return this.pageRevisionManagerProvider.has()}};p=B([u.injectable(),w(0,u.inject("PageRevisionManagerProvider"))],p);class P{constructor(a){a.bind("ExtraTab").to(p).inSingletonScope()}}t.ComponentInit=P,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})});
4
4
  //# sourceMappingURL=index.umd.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.umd.js","sources":["../src/translations.ts","../src/vue/HistoryTab.vue","../src/HistoryExtraTab.ts","../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 en from \"../langs/translation-en.json\";\nimport fr from \"../langs/translation-fr.json\";\n\nconst translations: Record<string, Record<string, string>> = {\n en,\n fr,\n};\nexport default translations;\n","<!--\nSee the LICENSE file distributed with this work for additional\ninformation regarding copyright ownership.\n\nThis is free software; you can redistribute it and/or modify it\nunder the terms of the GNU Lesser General Public License as\npublished by the Free Software Foundation; either version 2.1 of\nthe License, or (at your option) any later version.\n\nThis software is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\nLesser General Public License for more details.\n\nYou should have received a copy of the GNU Lesser General Public\nLicense along with this software; if not, write to the Free\nSoftware Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n02110-1301 USA, or see the FSF site: http://www.fsf.org.\n-->\n<script setup lang=\"ts\">\nimport messages from \"../translations\";\nimport { name as documentServiceName } from \"@xwiki/cristal-document-api\";\nimport { User } from \"@xwiki/cristal-user-ui\";\nimport { inject, onMounted, ref } from \"vue\";\nimport { useI18n } from \"vue-i18n\";\nimport type { CristalApp, PageData } from \"@xwiki/cristal-api\";\nimport type { DocumentService } from \"@xwiki/cristal-document-api\";\nimport type {\n PageRevision,\n PageRevisionManagerProvider,\n} from \"@xwiki/cristal-history-api\";\nimport type { Ref } from \"vue\";\n\nconst { t } = useI18n({\n messages,\n});\nconst cristal: CristalApp = inject<CristalApp>(\"cristal\")!;\nconst documentService = cristal\n .getContainer()\n .get<DocumentService>(documentServiceName);\nconst currentPage: Ref<PageData | undefined> =\n documentService.getCurrentDocument();\nconst revisions: Ref<Array<PageRevision>> = ref([]);\nconst isLoading: Ref<boolean> = ref(true);\n\nonMounted(async () => {\n if (currentPage.value) {\n revisions.value = await cristal\n .getContainer()\n .get<PageRevisionManagerProvider>(\"PageRevisionManagerProvider\")\n .get()\n .getRevisions(currentPage.value);\n }\n isLoading.value = false;\n});\n</script>\n\n<template>\n <p v-if=\"isLoading\">{{ t(\"history.extraTabs.loading\") }}</p>\n <p v-else>\n {{ t(\"history.extraTabs.header\", { nRevisions: revisions.length }) }}\n </p>\n <br />\n <table v-if=\"!isLoading\">\n <tr v-for=\"revision of revisions\" :key=\"revision.version\">\n <td class=\"history-revision-cell\">\n <span class=\"history-revision\">{{ revision.version }}</span>\n </td>\n <td>\n <i18n-t keypath=\"history.extraTabs.entry\" tag=\"span\">\n <template #date>\n <a :href=\"revision.url\">{{\n revision.date.toLocaleString(undefined, {\n dateStyle: \"short\",\n timeStyle: \"short\",\n })\n }}</a>\n </template>\n <template #user>\n <user :user=\"revision.user\" />\n </template>\n </i18n-t>\n <br />\n {{ revision.comment }}\n </td>\n </tr>\n </table>\n</template>\n\n<style scoped>\np {\n font-size: var(--cr-font-size-medium);\n}\ntable {\n border-collapse: collapse;\n}\ntable tr:hover {\n background-color: var(--cr-color-neutral-200);\n}\ntable td {\n vertical-align: top;\n padding: var(--cr-spacing-small);\n}\ntable td:first-child {\n border-radius: var(--cr-border-radius-medium) 0 0\n var(--cr-border-radius-medium);\n}\ntable td:last-child {\n border-radius: 0 var(--cr-border-radius-medium) var(--cr-border-radius-medium)\n 0;\n}\ntable .history-revision-cell {\n text-align: center;\n}\ntable .history-revision {\n background-color: var(--cr-color-neutral-300);\n border-radius: var(--cr-border-radius-pill);\n padding: var(--cr-spacing-2x-small);\n font-size: var(--cr-font-size-x-small);\n}\n</style>\n","/*\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 messages from \"./translations\";\nimport HistoryTab from \"./vue/HistoryTab.vue\";\nimport { AbstractExtraTab } from \"@xwiki/cristal-extra-tabs-api\";\nimport { inject, injectable } from \"inversify\";\nimport { Component } from \"vue\";\nimport type { PageRevisionManagerProvider } from \"@xwiki/cristal-history-api\";\n\n@injectable()\nexport class HistoryExtraTab extends AbstractExtraTab {\n title: string;\n\n constructor(\n @inject(\"PageRevisionManagerProvider\")\n private readonly pageRevisionManagerProvider: PageRevisionManagerProvider,\n ) {\n super(messages);\n this.title = this.t(\"history.extraTabs.title\");\n }\n\n order = 3000;\n id = \"history\";\n\n async panel(): Promise<Component> {\n return HistoryTab;\n }\n\n override async enabled(): Promise<boolean> {\n return this.pageRevisionManagerProvider.has();\n }\n}\n","/*\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 { HistoryExtraTab } from \"./HistoryExtraTab\";\nimport type { ExtraTab } from \"@xwiki/cristal-extra-tabs-api\";\nimport type { Container } from \"inversify\";\n\nexport class ComponentInit {\n constructor(container: Container) {\n container.bind<ExtraTab>(\"ExtraTab\").to(HistoryExtraTab).inSingletonScope();\n }\n}\n"],"names":["translations","useI18n","messages","cristal","inject","currentPage","documentServiceName","revisions","ref","isLoading","onMounted","HistoryExtraTab","AbstractExtraTab","pageRevisionManagerProvider","HistoryTab","__decorateClass","injectable","__decorateParam","ComponentInit","container"],"mappings":";2CAuBA,MAAMA,EAAuD,CAC3D,wMACA,0NACF,iOCOM,KAAA,CAAE,CAAE,EAAIC,UAAQ,CACpBC,SAAAA,CAAA,CACD,EACKC,EAAsBC,SAAmB,SAAS,EAIlDC,EAHkBF,EACrB,aAAa,EACb,IAAqBG,EAAAA,IAAmB,EAEzB,mBAAmB,EAC/BC,EAAsCC,EAAI,IAAA,EAAE,EAC5CC,EAA0BD,MAAI,EAAI,EAExCE,OAAAA,EAAAA,UAAU,SAAY,CAChBL,EAAY,QACdE,EAAU,MAAQ,MAAMJ,EACrB,aAAA,EACA,IAAiC,6BAA6B,EAC9D,IAAI,EACJ,aAAaE,EAAY,KAAK,GAEnCI,EAAU,MAAQ,EAAA,CACnB,i6CC1BY,IAAAE,EAAN,cAA8BC,EAAAA,gBAAiB,CAGpD,YAEmBC,EACjB,CACA,MAAMX,CAAQ,EAFG,KAAA,4BAAAW,EAMX,KAAA,MAAA,IACH,KAAA,GAAA,UAJE,KAAA,MAAQ,KAAK,EAAE,yBAAyB,CAAA,CAM/C,MAAM,OAA4B,CACzB,OAAAC,CAAA,CAGT,MAAe,SAA4B,CAClC,OAAA,KAAK,4BAA4B,IAAI,CAAA,CAEhD,EArBaH,EAANI,EAAA,CADNC,aAAW,EAKPC,aAAO,6BAA6B,CAAA,CAAA,EAJ5BN,CAAA,ECJN,MAAMO,CAAc,CACzB,YAAYC,EAAsB,CAChCA,EAAU,KAAe,UAAU,EAAE,GAAGR,CAAe,EAAE,iBAAiB,CAAA,CAE9E"}
1
+ {"version":3,"file":"index.umd.js","sources":["../src/translations.ts","../src/vue/HistoryTab.vue","../src/HistoryExtraTab.ts","../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 en from \"../langs/translation-en.json\";\nimport fr from \"../langs/translation-fr.json\";\n\nconst translations: Record<string, Record<string, string>> = {\n en,\n fr,\n};\nexport default translations;\n","<!--\nSee the LICENSE file distributed with this work for additional\ninformation regarding copyright ownership.\n\nThis is free software; you can redistribute it and/or modify it\nunder the terms of the GNU Lesser General Public License as\npublished by the Free Software Foundation; either version 2.1 of\nthe License, or (at your option) any later version.\n\nThis software is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\nLesser General Public License for more details.\n\nYou should have received a copy of the GNU Lesser General Public\nLicense along with this software; if not, write to the Free\nSoftware Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n02110-1301 USA, or see the FSF site: http://www.fsf.org.\n-->\n<script setup lang=\"ts\">\nimport messages from \"../translations\";\nimport { name as documentServiceName } from \"@xwiki/cristal-document-api\";\nimport { User } from \"@xwiki/cristal-user-ui\";\nimport { inject, onMounted, ref } from \"vue\";\nimport { useI18n } from \"vue-i18n\";\nimport type { CristalApp, PageData } from \"@xwiki/cristal-api\";\nimport type { DocumentService } from \"@xwiki/cristal-document-api\";\nimport type {\n PageRevision,\n PageRevisionManagerProvider,\n} from \"@xwiki/cristal-history-api\";\nimport type { Ref } from \"vue\";\n\nconst { t } = useI18n({\n messages,\n});\nconst cristal: CristalApp = inject<CristalApp>(\"cristal\")!;\nconst documentService = cristal\n .getContainer()\n .get<DocumentService>(documentServiceName);\nconst currentPage: Ref<PageData | undefined> =\n documentService.getCurrentDocument();\nconst revisions: Ref<Array<PageRevision>> = ref([]);\nconst isLoading: Ref<boolean> = ref(true);\n\nonMounted(async () => {\n if (currentPage.value) {\n revisions.value = await cristal\n .getContainer()\n .get<PageRevisionManagerProvider>(\"PageRevisionManagerProvider\")\n .get()\n .getRevisions(currentPage.value);\n }\n isLoading.value = false;\n});\n</script>\n\n<template>\n <p v-if=\"isLoading\">{{ t(\"history.extraTabs.loading\") }}</p>\n <p v-else>\n {{ t(\"history.extraTabs.header\", { nRevisions: revisions.length }) }}\n </p>\n <br />\n <table v-if=\"!isLoading\">\n <tr v-for=\"revision of revisions\" :key=\"revision.version\">\n <td class=\"history-revision-cell\">\n <span class=\"history-revision\">{{ revision.version }}</span>\n </td>\n <td>\n <i18n-t keypath=\"history.extraTabs.entry\" tag=\"span\">\n <template #date>\n <a :href=\"revision.url\">{{\n revision.date.toLocaleString(undefined, {\n dateStyle: \"short\",\n timeStyle: \"short\",\n })\n }}</a>\n </template>\n <template #user>\n <user :user=\"revision.user\" />\n </template>\n </i18n-t>\n <br />\n {{ revision.comment }}\n </td>\n </tr>\n </table>\n</template>\n\n<style scoped>\np {\n font-size: var(--cr-font-size-medium);\n}\ntable {\n border-collapse: collapse;\n}\ntable tr:hover {\n background-color: var(--cr-color-neutral-200);\n}\ntable td {\n vertical-align: top;\n padding: var(--cr-spacing-small);\n}\ntable td:first-child {\n border-radius: var(--cr-border-radius-medium) 0 0\n var(--cr-border-radius-medium);\n}\ntable td:last-child {\n border-radius: 0 var(--cr-border-radius-medium) var(--cr-border-radius-medium)\n 0;\n}\ntable .history-revision-cell {\n text-align: center;\n}\ntable .history-revision {\n background-color: var(--cr-color-neutral-300);\n border-radius: var(--cr-border-radius-pill);\n padding: var(--cr-spacing-2x-small);\n font-size: var(--cr-font-size-x-small);\n}\n</style>\n","/*\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 messages from \"./translations\";\nimport HistoryTab from \"./vue/HistoryTab.vue\";\nimport { AbstractExtraTab } from \"@xwiki/cristal-extra-tabs-api\";\nimport { inject, injectable } from \"inversify\";\nimport { Component } from \"vue\";\nimport type { PageRevisionManagerProvider } from \"@xwiki/cristal-history-api\";\n\n@injectable()\nexport class HistoryExtraTab extends AbstractExtraTab {\n title: string;\n\n constructor(\n @inject(\"PageRevisionManagerProvider\")\n private readonly pageRevisionManagerProvider: PageRevisionManagerProvider,\n ) {\n super(messages);\n this.title = this.t(\"history.extraTabs.title\");\n }\n\n order = 3000;\n id = \"history\";\n\n async panel(): Promise<Component> {\n return HistoryTab;\n }\n\n override async enabled(): Promise<boolean> {\n return this.pageRevisionManagerProvider.has();\n }\n}\n","/*\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 { HistoryExtraTab } from \"./HistoryExtraTab\";\nimport type { ExtraTab } from \"@xwiki/cristal-extra-tabs-api\";\nimport type { Container } from \"inversify\";\n\nexport class ComponentInit {\n constructor(container: Container) {\n container.bind<ExtraTab>(\"ExtraTab\").to(HistoryExtraTab).inSingletonScope();\n }\n}\n"],"names":["translations","t","useI18n","messages","cristal","inject","currentPage","documentServiceName","revisions","ref","isLoading","onMounted","HistoryExtraTab","AbstractExtraTab","pageRevisionManagerProvider","HistoryTab","__decorateClass","injectable","__decorateParam","ComponentInit","container"],"mappings":";2CAuBA,MAAMA,EAAuD,CAC3D,wMACA,0NACF,iOCOM,KAAA,CAAE,EAAAC,CAAE,EAAIC,UAAQ,CACpBC,SAAAA,CAAA,CACD,EACKC,EAAsBC,SAAmB,SAAS,EAIlDC,EAHkBF,EACrB,aAAa,EACb,IAAqBG,EAAAA,IAAmB,EAEzB,mBAAmB,EAC/BC,EAAsCC,EAAI,IAAA,EAAE,EAC5CC,EAA0BD,MAAI,EAAI,EAExCE,OAAAA,EAAAA,UAAU,SAAY,CAChBL,EAAY,QACdE,EAAU,MAAQ,MAAMJ,EACrB,aAAA,EACA,IAAiC,6BAA6B,EAC9D,IAAI,EACJ,aAAaE,EAAY,KAAK,GAEnCI,EAAU,MAAQ,EAAA,CACnB,62CC1BY,IAAAE,EAAN,cAA8BC,EAAAA,gBAAiB,CAGpD,YAEmBC,EACjB,CACA,MAAMX,CAAQ,EAFG,KAAA,4BAAAW,EAMX,KAAA,MAAA,IACH,KAAA,GAAA,UAJE,KAAA,MAAQ,KAAK,EAAE,yBAAyB,CAAA,CAM/C,MAAM,OAA4B,CACzB,OAAAC,CAAA,CAGT,MAAe,SAA4B,CAClC,OAAA,KAAK,4BAA4B,IAAI,CAAA,CAEhD,EArBaH,EAANI,EAAA,CADNC,aAAW,EAKPC,aAAO,6BAA6B,CAAA,CAAA,EAJ5BN,CAAA,ECJN,MAAMO,CAAc,CACzB,YAAYC,EAAsB,CAChCA,EAAU,KAAe,UAAU,EAAE,GAAGR,CAAe,EAAE,iBAAiB,CAAA,CAE9E"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xwiki/cristal-history-ui",
3
- "version": "0.17.0",
3
+ "version": "0.18.0",
4
4
  "license": "LGPL 2.1",
5
5
  "author": "XWiki Org Community <contact@xwiki.org>",
6
6
  "homepage": "https://cristal.xwiki.org/",
@@ -22,26 +22,26 @@
22
22
  },
23
23
  "main": "./dist/index.es.js",
24
24
  "dependencies": {
25
- "inversify": "7.5.0",
25
+ "inversify": "7.5.1",
26
26
  "vue": "3.5.13",
27
- "vue-i18n": "11.1.2",
28
- "vue-router": "4.5.0",
29
- "@xwiki/cristal-api": "0.17.0",
30
- "@xwiki/cristal-document-api": "0.17.0",
31
- "@xwiki/cristal-extra-tabs-api": "0.17.0",
32
- "@xwiki/cristal-user-ui": "0.17.0",
33
- "@xwiki/cristal-history-api": "0.17.0"
27
+ "vue-i18n": "11.1.3",
28
+ "vue-router": "4.5.1",
29
+ "@xwiki/cristal-api": "0.18.0",
30
+ "@xwiki/cristal-document-api": "0.18.0",
31
+ "@xwiki/cristal-extra-tabs-api": "0.18.0",
32
+ "@xwiki/cristal-user-ui": "0.18.0",
33
+ "@xwiki/cristal-history-api": "0.18.0"
34
34
  },
35
35
  "peerDependencies": {
36
36
  "reflect-metadata": "0.2.2"
37
37
  },
38
38
  "devDependencies": {
39
39
  "reflect-metadata": "0.2.2",
40
- "typescript": "5.8.2",
41
- "vite": "6.2.6",
42
- "vue-tsc": "2.2.8",
43
- "@xwiki/cristal-dev-config": "0.17.0",
44
- "@xwiki/cristal-dsapi": "0.17.0"
40
+ "typescript": "5.8.3",
41
+ "vite": "6.3.5",
42
+ "vue-tsc": "2.2.10",
43
+ "@xwiki/cristal-dev-config": "0.18.0",
44
+ "@xwiki/cristal-dsapi": "0.18.0"
45
45
  },
46
46
  "scripts": {
47
47
  "build": "vue-tsc --project tsconfig.json && vite build",