@datagouv/components-next 0.0.27 → 0.0.29

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.
@@ -1,4 +1,4 @@
1
- import { g as Ke } from "./main-CZXf5f3h.js";
1
+ import { g as Ke } from "./main-DIQDGjO4.js";
2
2
  import We from "vue";
3
3
  function Fe(I, K) {
4
4
  for (var V = 0; V < K.length; V++) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datagouv/components-next",
3
- "version": "0.0.27",
3
+ "version": "0.0.29",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./src/main.ts",
package/src/config.ts CHANGED
@@ -6,7 +6,6 @@ export type PluginConfig = {
6
6
  baseUrl: string
7
7
  apiBase: string
8
8
  devApiKey?: string | null
9
- staticUrl: string
10
9
  datasetQualityGuideUrl?: string
11
10
  schemaValidataUrl?: string
12
11
  schemaDocumentationUrl?: string
@@ -21,11 +20,6 @@ export type PluginConfig = {
21
20
  maxJsonPreviewSize?: number // Maximum size of JSON to preview in characters
22
21
  maxPdfPreviewSize?: number // Maximum size of PDF to preview in bytes
23
22
  maxXmlPreviewSize?: number // Maximum size of XML to preview in characters
24
- i18n?: {
25
- global: {
26
- mergeLocaleMessage: (locale: string, messages: unknown) => void
27
- }
28
- }
29
23
  }
30
24
 
31
25
  export const configKey = Symbol() as InjectionKey<PluginConfig>
@@ -11,7 +11,7 @@ function constructUrl(baseUrl: string, path: string): string {
11
11
  export default function getDatasetOEmbedHtml(type: string, id: string): string {
12
12
  const config = useComponentsConfig()
13
13
 
14
- const staticUrl = constructUrl(config.staticUrl, 'oembed.js')
14
+ const staticUrl = constructUrl(config.baseUrl, 'oembed.js')
15
15
  return `<div data-udata-${type}="${id}"></div><script data-udata="${config.baseUrl}" src="${staticUrl}" async defer></script>`
16
16
  }
17
17
 
package/src/main.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { App, Plugin } from 'vue'
2
- import { createI18n } from 'vue-i18n'
2
+ import { createI18n, useI18n } from 'vue-i18n'
3
3
  import type { ContactPoint, ContactPointRole } from './types/contact_point.js'
4
4
  import type { Badge, Badges } from './types/badges'
5
5
  import type { Dataset, DatasetV2, DatasetV2WithFullObject, NewDataset, Quality, Rel } from './types/datasets'
@@ -119,7 +119,11 @@ const datagouv: Plugin<PluginConfig> = {
119
119
  const textClamp = await import('vue3-text-clamp')
120
120
  options.textClamp = textClamp.default
121
121
  }
122
- if (!options.i18n) {
122
+ try {
123
+ // There is no condition to check if vue-i18n is instancied, only an error...
124
+ useI18n()
125
+ }
126
+ catch {
123
127
  const i18n = createI18n({
124
128
  legacy: false,
125
129
  globalInjection: true,
@@ -130,7 +134,6 @@ const datagouv: Plugin<PluginConfig> = {
130
134
  fallbackFormat: true,
131
135
  fallbackWarn: false,
132
136
  })
133
- options.i18n = i18n
134
137
  app.use(i18n)
135
138
  }
136
139
  },
@@ -1,4 +0,0 @@
1
- import { _ as f } from "./main-CZXf5f3h.js";
2
- export {
3
- f as default
4
- };
@@ -1,12 +0,0 @@
1
- import { ref } from 'vue'
2
-
3
- export type ComponentsConfig = {
4
- staticUrl: string
5
- baseApiUrl: string
6
- }
7
-
8
- export const config = ref<ComponentsConfig | null>(null)
9
-
10
- export function setConfig(newConfig: ComponentsConfig) {
11
- config.value = newConfig
12
- }