@datagouv/components-next 0.0.31 → 0.1.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.
Files changed (86) hide show
  1. package/README.md +36 -15
  2. package/assets/labels/hvd.svg +15 -0
  3. package/assets/labels/inspire.svg +20 -0
  4. package/assets/labels/sl.svg +5 -0
  5. package/assets/labels/spd.svg +5 -0
  6. package/assets/labels/sr.svg +5 -0
  7. package/dist/JsonPreview.client-NQ9byxF5.js +92 -0
  8. package/dist/{MapContainer.client-DXVDyZYz.js → MapContainer.client-D7Y0OXMU.js} +17587 -6826
  9. package/dist/{PdfPreview.client-XwjUHnmx.js → PdfPreview.client-DU6FbUh0.js} +47 -48
  10. package/dist/{Pmtiles.client-DfnKDlpg.js → Pmtiles.client-DCOxft6M.js} +7609 -7503
  11. package/dist/Swagger.client-DTHhEAFT.js +4 -0
  12. package/dist/XmlPreview.client-BEOCeCP8.js +84 -0
  13. package/dist/components-next.css +6 -6
  14. package/dist/components-next.js +96 -68
  15. package/dist/components.css +2 -2
  16. package/dist/en-CuSmdvir.js +30 -0
  17. package/dist/hvd-DYeke1vM.js +4 -0
  18. package/dist/inspire-BLXeJvob.js +4 -0
  19. package/dist/{main-Qu3kUOIH.js → main-DFEQrdg5.js} +54440 -56951
  20. package/dist/{pdf-vue3-Dm2ZCc3P.js → pdf-vue3-IkJO65RH.js} +2 -2
  21. package/dist/{pdf.min-f72cfa08-DAetWL3M.js → pdf.min-f72cfa08-CdgJTooZ.js} +78 -78
  22. package/dist/sl-VR8Tb1_u.js +4 -0
  23. package/dist/spd-BJ-Omhgt.js +4 -0
  24. package/dist/sr-DjSF-8xW.js +4 -0
  25. package/dist/{text-clamp.esm-Mb7Qdtu9.js → text-clamp.esm-B5kW_XMt.js} +54 -55
  26. package/dist/{vue3-json-viewer-B1fiyuLU.js → vue3-json-viewer-BXwup7nO.js} +88 -93
  27. package/dist/{vue3-xml-viewer.common-NQY1dx9T.js → vue3-xml-viewer.common-RC76oYFu.js} +54 -54
  28. package/package.json +12 -11
  29. package/src/components/ActivityList/ActivityList.vue +159 -0
  30. package/src/components/ActivityList/UserActivityList.vue +30 -0
  31. package/src/components/AppLink.vue +3 -3
  32. package/src/components/Avatar.vue +1 -0
  33. package/src/components/DataserviceCard.vue +3 -3
  34. package/src/components/DatasetCard.vue +19 -18
  35. package/src/components/DatasetInformationPanel.vue +17 -17
  36. package/src/components/DatasetLabelTag.vue +40 -0
  37. package/src/components/DatasetQuality.vue +13 -11
  38. package/src/components/DatasetQualityInline.vue +7 -2
  39. package/src/components/DatasetQualityScore.vue +3 -3
  40. package/src/components/DatasetQualityTooltipContent.vue +2 -2
  41. package/src/components/DateRangeDetails.vue +7 -3
  42. package/src/components/ExtraAccordion.vue +4 -5
  43. package/src/components/OrganizationNameWithCertificate.vue +2 -2
  44. package/src/components/PaddedContainer.vue +28 -0
  45. package/src/components/Pagination.vue +2 -2
  46. package/src/components/Placeholder.vue +9 -3
  47. package/src/components/ReadMore.vue +17 -17
  48. package/src/components/ResourceAccordion/DataStructure.vue +8 -3
  49. package/src/components/ResourceAccordion/EditButton.vue +2 -2
  50. package/src/components/ResourceAccordion/JsonPreview.client.vue +7 -5
  51. package/src/components/ResourceAccordion/MapContainer.client.vue +2 -2
  52. package/src/components/ResourceAccordion/Metadata.vue +10 -10
  53. package/src/components/ResourceAccordion/PdfPreview.client.vue +7 -5
  54. package/src/components/ResourceAccordion/Pmtiles.client.vue +2 -2
  55. package/src/components/ResourceAccordion/Preview.vue +2 -2
  56. package/src/components/ResourceAccordion/ResourceAccordion.vue +23 -15
  57. package/src/components/ResourceAccordion/SchemaBadge.vue +6 -4
  58. package/src/components/ResourceAccordion/XmlPreview.client.vue +7 -5
  59. package/src/components/ReuseCard.vue +3 -3
  60. package/src/components/ReuseDetails.vue +2 -2
  61. package/src/components/SmallChart.vue +33 -30
  62. package/src/components/StatBox.vue +6 -6
  63. package/src/components/Toggletip.vue +15 -20
  64. package/src/components/TranslationT.vue +51 -0
  65. package/src/composables/useActiveDescendant.ts +1 -1
  66. package/src/composables/useTranslation.ts +169 -0
  67. package/src/functions/activities.ts +36 -0
  68. package/src/functions/api.ts +4 -4
  69. package/src/functions/datasets.ts +29 -1
  70. package/src/functions/dates.ts +4 -4
  71. package/src/functions/helpers.ts +3 -3
  72. package/src/functions/organizations.ts +3 -3
  73. package/src/functions/pagination.ts +9 -0
  74. package/src/functions/resources.ts +2 -2
  75. package/src/functions/reuses.ts +3 -3
  76. package/src/main.ts +46 -26
  77. package/src/types/activity.ts +24 -0
  78. package/src/types/api.ts +8 -0
  79. package/src/types/badges.ts +4 -0
  80. package/src/types/dataservices.ts +6 -8
  81. package/src/types/datasets.ts +3 -1
  82. package/src/types/site.ts +1 -0
  83. package/src/types/topics.ts +17 -2
  84. package/dist/JsonPreview.client-B5cv59th.js +0 -93
  85. package/dist/Swagger.client-BisHyZkP.js +0 -4
  86. package/dist/XmlPreview.client-BSjMew4d.js +0 -85
package/src/main.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  import type { App, Plugin } from 'vue'
2
- import { createI18n, useI18n } from 'vue-i18n'
2
+ import type { Activity, ActivityKey } from './types/activity.js'
3
+ import type { PaginatedArray } from './types/api.js'
3
4
  import type { ContactPoint, ContactPointRole } from './types/contact_point.js'
4
- import type { Badge, Badges } from './types/badges'
5
+ import type { Badge, Badges, TranslatedBadge } from './types/badges'
5
6
  import type { Dataset, DatasetV2, DatasetV2WithFullObject, NewDataset, Quality, Rel } from './types/datasets'
6
7
  import type { NewDataservice, Dataservice, DataserviceAccessAudience, DataserviceAccessAudienceCondition, DataserviceAccessAudienceType } from './types/dataservices'
7
8
  import type { Frequency, Frequencies } from './types/frequency'
@@ -11,12 +12,14 @@ import type { License } from './types/licenses'
11
12
  import type { Member, MemberRole, NewOrganization, Organization } from './types/organizations'
12
13
  import type { Owned, OwnedWithId } from './types/owned'
13
14
  import type { NewReuse, Reuse, ReuseTopic, ReuseType } from './types/reuses'
14
- import type { TopicV2 } from './types/topics'
15
+ import type { TopicV2, TopicElement, TopicElementClass, TopicElementRel } from './types/topics'
15
16
  import type { CommunityResource, FileResourceFileType, RemoteResourceFileType, ResourceFileType, ResourceType, Resource } from './types/resources'
16
17
  import type { Site } from './types/site'
17
18
  import type { Weight, WellType } from './types/ui'
18
19
  import type { User } from './types/users'
19
20
 
21
+ import ActivityList from './components/ActivityList/ActivityList.vue'
22
+ import UserActivityList from './components/ActivityList/UserActivityList.vue'
20
23
  import AnimatedLoader from './components/AnimatedLoader.vue'
21
24
  import AppLink from './components/AppLink.vue'
22
25
  import Avatar from './components/Avatar.vue'
@@ -33,10 +36,13 @@ import DatasetQualityInline from './components/DatasetQualityInline.vue'
33
36
  import DatasetQualityItem from './components/DatasetQualityItem.vue'
34
37
  import DatasetQualityScore from './components/DatasetQualityScore.vue'
35
38
  import DatasetQualityTooltipContent from './components/DatasetQualityTooltipContent.vue'
39
+ import ExtraAccordion from './components/ExtraAccordion.vue'
40
+ import LabelTag from './components/DatasetLabelTag.vue'
36
41
  import OrganizationCard from './components/OrganizationCard.vue'
37
42
  import OrganizationNameWithCertificate from './components/OrganizationNameWithCertificate.vue'
38
43
  import OwnerType from './components/OwnerType.vue'
39
44
  import OwnerTypeIcon from './components/OwnerTypeIcon.vue'
45
+ import PaddedContainer from './components/PaddedContainer.vue'
40
46
  import Pagination from './components/Pagination.vue'
41
47
  import Placeholder from './components/Placeholder.vue'
42
48
  import ReadMore from './components/ReadMore.vue'
@@ -44,29 +50,43 @@ import ResourceAccordion from './components/ResourceAccordion/ResourceAccordion.
44
50
  import ResourceIcon from './components/ResourceAccordion/ResourceIcon.vue'
45
51
  import Swagger from './components/ResourceAccordion/Swagger.client.vue'
46
52
  import ReuseCard from './components/ReuseCard.vue'
53
+ import ReuseDetails from './components/ReuseDetails.vue'
47
54
  import SimpleBanner from './components/SimpleBanner.vue'
48
55
  import StatBox from './components/StatBox.vue'
56
+ import Tab from './components/Tabs/Tab.vue'
57
+ import TabGroup from './components/Tabs/TabGroup.vue'
58
+ import TabList from './components/Tabs/TabList.vue'
59
+ import TabPanel from './components/Tabs/TabPanel.vue'
60
+ import TabPanels from './components/Tabs/TabPanels.vue'
49
61
  import Tooltip from './components/Tooltip.vue'
50
62
  import Toggletip from './components/Toggletip.vue'
63
+ import TranslationT from './components/TranslationT.vue'
51
64
  import type { UseFetchFunction } from './functions/api.types'
52
65
  import { configKey, useComponentsConfig, type PluginConfig } from './config.js'
53
66
 
67
+ export * from './composables/useActiveDescendant'
54
68
  export * from './composables/useReuseType'
69
+ export * from './composables/useTranslation'
55
70
 
56
- export * from './functions/dates'
57
- export * from './functions/organizations'
58
- export * from './functions/resources'
59
- export * from './functions/users'
71
+ export * from './functions/activities'
60
72
  export * from './functions/datasets'
61
- export * from './functions/owned'
73
+ export * from './functions/dates'
62
74
  export * from './functions/helpers'
75
+ export * from './functions/markdown'
63
76
  export * from './functions/matomo'
64
77
  export * from './functions/never'
78
+ export * from './functions/organizations'
79
+ export * from './functions/owned'
80
+ export * from './functions/pagination'
81
+ export * from './functions/resources'
82
+ export * from './functions/reuses'
65
83
  export * from './functions/schemas'
66
- export * from './functions/markdown'
84
+ export * from './functions/users'
67
85
 
68
86
  export type {
69
87
  UseFetchFunction,
88
+ Activity,
89
+ ActivityKey,
70
90
  Badge,
71
91
  Badges,
72
92
  CommunityResource,
@@ -95,6 +115,7 @@ export type {
95
115
  Organization,
96
116
  Owned,
97
117
  OwnedWithId,
118
+ PaginatedArray,
98
119
  Quality,
99
120
  Rel,
100
121
  RemoteResourceFileType,
@@ -106,7 +127,11 @@ export type {
106
127
  ReuseType,
107
128
  Site,
108
129
  SpatialZone,
130
+ TranslatedBadge,
109
131
  TopicV2,
132
+ TopicElement,
133
+ TopicElementClass,
134
+ TopicElementRel,
110
135
  User,
111
136
  Weight,
112
137
  WellType,
@@ -120,29 +145,13 @@ const datagouv: Plugin<PluginConfig> = {
120
145
  const textClamp = await import('vue3-text-clamp')
121
146
  options.textClamp = textClamp.default
122
147
  }
123
- try {
124
- // There is no condition to check if vue-i18n is instancied, only an error...
125
- useI18n()
126
- }
127
- catch {
128
- const i18n = createI18n({
129
- legacy: false,
130
- globalInjection: true,
131
- locale: 'fr',
132
- messages: {},
133
- formatFallbackMessages: true,
134
- missingWarn: false,
135
- fallbackFormat: true,
136
- fallbackWarn: false,
137
- })
138
- app.use(i18n)
139
- }
140
148
  },
141
149
  }
142
150
 
143
151
  export {
144
152
  datagouv,
145
153
  useComponentsConfig,
154
+ ActivityList,
146
155
  AnimatedLoader,
147
156
  AppLink,
148
157
  Avatar,
@@ -159,19 +168,30 @@ export {
159
168
  DatasetQualityScore,
160
169
  DatasetQualityTooltipContent,
161
170
  DateRangeDetails,
171
+ ExtraAccordion,
172
+ LabelTag,
162
173
  OrganizationCard,
163
174
  OrganizationNameWithCertificate,
164
175
  OwnerType,
165
176
  OwnerTypeIcon,
177
+ PaddedContainer,
166
178
  Pagination,
167
179
  Placeholder,
168
180
  ReadMore,
169
181
  ResourceAccordion,
170
182
  ResourceIcon,
171
183
  ReuseCard,
184
+ ReuseDetails,
172
185
  SimpleBanner,
173
186
  StatBox,
174
187
  Swagger,
188
+ Tab,
189
+ TabGroup,
190
+ TabList,
191
+ TabPanel,
192
+ TabPanels,
175
193
  Tooltip,
176
194
  Toggletip,
195
+ TranslationT,
196
+ UserActivityList,
177
197
  }
@@ -0,0 +1,24 @@
1
+ import type { Organization } from './organizations'
2
+ import type { User } from './users'
3
+
4
+ export type ActivityKey = 'dataset:created' | 'dataset:updated' | 'dataset:deleted' | 'dataset:discussed' | 'dataset:followed'
5
+ | 'dataset:resource:added' | 'dataset:resource:updated' | 'dataset:resource:deleted'
6
+ | 'dataservice:created' | 'dataservice:updated' | 'dataservice:deleted' | 'dataservice:discussed' | 'dataservice:followed'
7
+ | 'organization:created' | 'organization:updated' | 'organization:followed'
8
+ | 'reuse:created' | 'reuse:updated' | 'reuse:deleted' | 'reuse:discussed' | 'reuse:followed'
9
+ | 'user:followed' | 'topic:created' | 'topic:updated'
10
+
11
+ export type Activity = {
12
+ actor: User
13
+ organization: Organization | null
14
+ related_to: string
15
+ related_to_id: string
16
+ related_to_kind: string
17
+ related_to_url: string
18
+ created_at: string
19
+ label: string
20
+ key: ActivityKey
21
+ icon: string
22
+ extras: Record<string, unknown>
23
+ changes?: Array<string>
24
+ }
@@ -0,0 +1,8 @@
1
+ export type PaginatedArray<T> = {
2
+ data: Array<T>
3
+ next_page: string | null
4
+ page: number
5
+ page_size: number
6
+ previous_page: string | null
7
+ total: number
8
+ }
@@ -2,4 +2,8 @@ export type Badge = {
2
2
  kind: string
3
3
  }
4
4
 
5
+ export type TranslatedBadge = Badge & {
6
+ label: string
7
+ }
8
+
5
9
  export type Badges = Array<Badge>
@@ -43,14 +43,12 @@ export type Dataservice = Owned & {
43
43
  base_api_url: string | null
44
44
  contact_points: Array<ContactPoint>
45
45
  created_at: string
46
- datasets: Array<{
47
- class: string
48
- id: string
49
- acronym: string
50
- page: string
51
- title: string
52
- uri: string
53
- }>
46
+ datasets: {
47
+ href: string
48
+ rel: 'subsection'
49
+ total: number
50
+ type: 'GET'
51
+ }
54
52
  deleted_at: string | null
55
53
  description: string
56
54
  featured: boolean
@@ -27,6 +27,7 @@ export type BaseDataset = Owned & {
27
27
  acronym: string
28
28
  archived: boolean
29
29
  description: string
30
+ description_short: string
30
31
  tags: Array<string> | null
31
32
  license: string
32
33
  frequency: string
@@ -69,6 +70,7 @@ export type Dataset = BaseDataset & {
69
70
  slug: string
70
71
  quality: Quality
71
72
  metrics: {
73
+ dataservices: number
72
74
  discussions: number
73
75
  discussions_open: number
74
76
  followers: number
@@ -87,7 +89,7 @@ export type DatasetV2 = Owned & Omit<Dataset, 'resources' | 'community_resources
87
89
  community_resources: Rel
88
90
  }
89
91
 
90
- export type DatasetV2WithFullObject = Omit<DatasetV2, 'license' | 'frequency' | 'spatial'> & {
92
+ export type DatasetV2WithFullObject = Owned & Omit<DatasetV2, 'license' | 'frequency' | 'spatial'> & {
91
93
  license: License
92
94
  frequency: Frequency
93
95
  spatial: {
package/src/types/site.ts CHANGED
@@ -4,6 +4,7 @@ export type Site = {
4
4
  datasets_page: string | null
5
5
  reuses_page: string | null
6
6
  dataservices_page: string | null
7
+ version: string
7
8
  metrics: {
8
9
  'dataservices': number
9
10
  'datasets': number
@@ -1,14 +1,29 @@
1
1
  import type { Rel } from './datasets'
2
2
  import type { Owned } from './owned'
3
3
 
4
+ export type TopicElementClass = 'Dataset' | 'Reuse'
5
+
6
+ export type TopicElementRel = {
7
+ id: string
8
+ class: TopicElementClass
9
+ }
10
+
11
+ export type TopicElement = {
12
+ id: string
13
+ title?: string
14
+ description?: string
15
+ tags: Array<string>
16
+ extras: Record<string, unknown>
17
+ element: TopicElementRel
18
+ }
19
+
4
20
  export type TopicV2 = Owned & {
5
21
  id: string
6
22
  name: string
7
23
  slug: string
8
24
  description: string
9
25
  tags: Array<string>
10
- datasets: Rel
11
- reuses: Rel
26
+ elements: Rel
12
27
  featured: boolean
13
28
  private: boolean
14
29
  created_at: string
@@ -1,93 +0,0 @@
1
- import { defineComponent as b, defineAsyncComponent as C, ref as o, computed as x, onMounted as S, createElementBlock as p, openBlock as n, createBlock as f, createCommentVNode as N, createVNode as a, unref as u, toDisplayString as i, withCtx as d, createElementVNode as h } from "vue";
2
- import { d as P, a as m, F as v } from "./main-Qu3kUOIH.js";
3
- const T = { class: "fr-text--xs" }, $ = { key: 0 }, E = {
4
- key: 1,
5
- class: "text-gray-medium"
6
- }, O = /* @__PURE__ */ b({
7
- __name: "JsonPreview.client",
8
- props: {
9
- resource: {}
10
- },
11
- setup(k) {
12
- const z = C(
13
- () => import("./vue3-json-viewer-B1fiyuLU.js").then((e) => (Promise.resolve({ }), e.JsonViewer))
14
- ), s = k, g = P(), l = o(null), c = o(!1), r = o(null), y = o(!1), w = x(() => {
15
- var t;
16
- if (s.resource.filesize)
17
- return s.resource.filesize;
18
- const e = (t = s.resource.extras) == null ? void 0 : t["analysis:content-length"];
19
- return e && typeof e == "number" ? e : null;
20
- }), J = x(() => {
21
- const e = w.value;
22
- if (!e || !g.maxJsonPreviewCharSize)
23
- return !1;
24
- const t = g.maxJsonPreviewCharSize;
25
- return e <= t;
26
- }), _ = async () => {
27
- if (!J.value) {
28
- y.value = !0;
29
- return;
30
- }
31
- c.value = !0, r.value = null;
32
- try {
33
- const e = await fetch(s.resource.url);
34
- if (!e.ok)
35
- throw new Error(`HTTP error! status: ${e.status}`);
36
- const t = await e.json();
37
- l.value = t;
38
- } catch (e) {
39
- console.error("Error loading JSON:", e), e instanceof TypeError ? r.value = "network" : r.value = "generic", l.value = null;
40
- } finally {
41
- c.value = !1;
42
- }
43
- };
44
- return S(() => {
45
- _();
46
- }), (e, t) => (n(), p("div", T, [
47
- l.value ? (n(), p("div", $, [
48
- a(u(z), {
49
- value: l.value,
50
- boxed: "",
51
- sort: "",
52
- theme: "light",
53
- "max-depth": 3,
54
- "expand-depth": 2,
55
- "indent-width": 2
56
- }, null, 8, ["value"])
57
- ])) : c.value ? (n(), p("div", E, i(e.$t("Chargement de l'aperçu JSON...")), 1)) : y.value ? (n(), f(m, {
58
- key: 2,
59
- type: "warning",
60
- class: "flex items-center space-x-2"
61
- }, {
62
- default: d(() => [
63
- a(u(v), { class: "shink-0 size-6" }),
64
- h("span", null, i(w.value ? e.$t("Fichier JSON trop volumineux pour l'aperçu. Pour consulter le fichier complet, téléchargez-le en cliquant sur le bouton bleu ou depuis l'onglet Téléchargements.") : e.$t("L'aperçu n'est pas disponible car la taille du fichier est inconnue. Pour consulter le fichier complet, téléchargez-le en cliquant sur le bouton bleu ou depuis l'onglet Téléchargements.")), 1)
65
- ]),
66
- _: 1
67
- })) : r.value === "network" ? (n(), f(m, {
68
- key: 3,
69
- type: "warning",
70
- class: "flex items-center space-x-2"
71
- }, {
72
- default: d(() => [
73
- a(u(v), { class: "shink-0 size-6" }),
74
- h("span", null, i(e.$t("Ce fichier JSON ne peut pas être prévisualisé, peut-être parce qu'il est hébergé sur un autre site qui ne l'autorise pas. Pour le consulter, téléchargez-le en cliquant sur le bouton bleu ou depuis l'onglet Téléchargements.")), 1)
75
- ]),
76
- _: 1
77
- })) : r.value ? (n(), f(m, {
78
- key: 4,
79
- type: "warning",
80
- class: "flex items-center space-x-2"
81
- }, {
82
- default: d(() => [
83
- a(u(v), { class: "shink-0 size-6" }),
84
- h("span", null, i(e.$t("Erreur lors du chargement de l'aperçu JSON.")), 1)
85
- ]),
86
- _: 1
87
- })) : N("", !0)
88
- ]));
89
- }
90
- });
91
- export {
92
- O as default
93
- };
@@ -1,4 +0,0 @@
1
- import { _ as f } from "./main-Qu3kUOIH.js";
2
- export {
3
- f as default
4
- };
@@ -1,85 +0,0 @@
1
- import { defineComponent as C, defineAsyncComponent as b, ref as a, computed as w, onMounted as L, createElementBlock as p, openBlock as r, createBlock as f, createCommentVNode as P, createVNode as o, unref as u, toDisplayString as i, withCtx as m, createElementVNode as h } from "vue";
2
- import { d as T, a as d, F as v } from "./main-Qu3kUOIH.js";
3
- const $ = { class: "fr-text--xs" }, E = { key: 0 }, M = {
4
- key: 1,
5
- class: "text-gray-medium"
6
- }, S = /* @__PURE__ */ C({
7
- __name: "XmlPreview.client",
8
- props: {
9
- resource: {}
10
- },
11
- setup(k) {
12
- const z = b(
13
- () => import("./vue3-xml-viewer.common-NQY1dx9T.js").then((e) => e.v).then((e) => e.default || e.XmlViewer)
14
- ), n = k, g = T(), s = a(null), c = a(!1), l = a(null), y = a(!1), x = w(() => {
15
- var t;
16
- if (n.resource.filesize)
17
- return n.resource.filesize;
18
- const e = (t = n.resource.extras) == null ? void 0 : t["analysis:content-length"];
19
- return e && typeof e == "number" ? e : null;
20
- }), X = w(() => {
21
- const e = x.value;
22
- if (!e || !g.maxXmlPreviewCharSize)
23
- return !1;
24
- const t = g.maxXmlPreviewCharSize;
25
- return e <= t;
26
- }), _ = async () => {
27
- if (!X.value) {
28
- y.value = !0;
29
- return;
30
- }
31
- c.value = !0, l.value = null;
32
- try {
33
- const e = await fetch(n.resource.url);
34
- if (!e.ok)
35
- throw new Error(`HTTP error! status: ${e.status}`);
36
- const t = await e.text();
37
- s.value = t;
38
- } catch (e) {
39
- console.error("Error loading XML:", e), e instanceof TypeError ? l.value = "network" : l.value = "generic", s.value = null;
40
- } finally {
41
- c.value = !1;
42
- }
43
- };
44
- return L(() => {
45
- _();
46
- }), (e, t) => (r(), p("div", $, [
47
- s.value ? (r(), p("div", E, [
48
- o(u(z), { xml: s.value }, null, 8, ["xml"])
49
- ])) : c.value ? (r(), p("div", M, i(e.$t("Chargement de l'aperçu XML...")), 1)) : y.value ? (r(), f(d, {
50
- key: 2,
51
- type: "warning",
52
- class: "flex items-center space-x-2"
53
- }, {
54
- default: m(() => [
55
- o(u(v), { class: "shink-0 size-6" }),
56
- h("span", null, i(x.value ? e.$t("Fichier XML trop volumineux pour l'aperçu. Pour consulter le fichier complet, téléchargez-le en cliquant sur le bouton bleu ou depuis l'onglet Téléchargements.") : e.$t("L'aperçu n'est pas disponible car la taille du fichier est inconnue. Pour consulter le fichier complet, téléchargez-le en cliquant sur le bouton bleu ou depuis l'onglet Téléchargements.")), 1)
57
- ]),
58
- _: 1
59
- })) : l.value === "network" ? (r(), f(d, {
60
- key: 3,
61
- type: "warning",
62
- class: "flex items-center space-x-2"
63
- }, {
64
- default: m(() => [
65
- o(u(v), { class: "shink-0 size-6" }),
66
- h("span", null, i(e.$t("Ce fichier XML ne peut pas être prévisualisé, peut-être parce qu'il est hébergé sur un autre site qui ne l'autorise pas. Pour le consulter, téléchargez-le en cliquant sur le bouton bleu ou depuis l'onglet Téléchargements.")), 1)
67
- ]),
68
- _: 1
69
- })) : l.value ? (r(), f(d, {
70
- key: 4,
71
- type: "warning",
72
- class: "flex items-center space-x-2"
73
- }, {
74
- default: m(() => [
75
- o(u(v), { class: "shink-0 size-6" }),
76
- h("span", null, i(e.$t("Erreur lors du chargement de l'aperçu XML.")), 1)
77
- ]),
78
- _: 1
79
- })) : P("", !0)
80
- ]));
81
- }
82
- });
83
- export {
84
- S as default
85
- };