@datagouv/components-next 0.0.12 → 0.0.14

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datagouv/components-next",
3
- "version": "0.0.12",
3
+ "version": "0.0.14",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./src/main.ts",
@@ -45,7 +45,7 @@
45
45
  "remark-parse": "^11.0.0",
46
46
  "remark-rehype": "^11.1.2",
47
47
  "strip-markdown": "^6.0.0",
48
- "swagger-ui": "^5.20.1",
48
+ "swagger-ui-dist": "^5.27.1",
49
49
  "unified": "^11.0.5",
50
50
  "unist-util-visit": "^5.0.0",
51
51
  "vue": "^3.5.13",
@@ -63,7 +63,6 @@
63
63
  "@tsconfig/node22": "^22.0.0",
64
64
  "@types/geojson": "^7946.0.16",
65
65
  "@types/node": "^22.13.1",
66
- "@types/swagger-ui": "^3.52.4",
67
66
  "@vitejs/plugin-vue": "^5.2.1",
68
67
  "@vue/eslint-config-prettier": "^10.2.0",
69
68
  "@vue/eslint-config-typescript": "^14.3.0",
@@ -79,6 +78,9 @@
79
78
  "vite-plugin-vue-devtools": "^7.7.1",
80
79
  "vue-tsc": "^2.2.0"
81
80
  },
81
+ "scarfSettings": {
82
+ "enabled": false
83
+ },
82
84
  "author": {
83
85
  "name": "DINUM"
84
86
  },
@@ -4,8 +4,8 @@
4
4
 
5
5
  <script setup lang="ts">
6
6
  import { onMounted } from 'vue'
7
- import SwaggerUI from 'swagger-ui'
8
- import 'swagger-ui/dist/swagger-ui.css'
7
+ import { SwaggerUIBundle } from 'swagger-ui-dist'
8
+ import 'swagger-ui-dist/swagger-ui.css'
9
9
  import '../../../assets/swagger-themes/newspaper.css'
10
10
 
11
11
  const props = defineProps<{
@@ -13,7 +13,7 @@ const props = defineProps<{
13
13
  }>()
14
14
 
15
15
  onMounted(async () => {
16
- SwaggerUI({
16
+ SwaggerUIBundle({
17
17
  dom_id: '#swagger-ui',
18
18
  url: props.url,
19
19
  })
@@ -4,6 +4,7 @@ import remarkBreaks from 'remark-breaks'
4
4
  import rehypeHighlight from 'rehype-highlight'
5
5
  import remarkParse from 'remark-parse'
6
6
  import remarkRehype from 'remark-rehype'
7
+ import remarkStringify from 'remark-stringify'
7
8
  import rehypeRaw from 'rehype-raw'
8
9
  import rehypeSanitize from 'rehype-sanitize'
9
10
  import rehypeSlug from 'rehype-slug'
@@ -63,8 +64,11 @@ export function formatMarkdown(md: string, minDepth = 3) {
63
64
 
64
65
  export async function removeMarkdown(text: string) {
65
66
  const file = await unified()
67
+ // Take Markdown as input and turn it into MD syntax tree
68
+ .use(remarkParse, { fragment: true })
66
69
  .use(remarkGfm)
67
70
  .use(strip)
71
+ .use(remarkStringify)
68
72
  .process(text)
69
73
  return String(file)
70
74
  }
@@ -1,4 +1,3 @@
1
- import type { AxiosResponse } from 'axios'
2
1
  import { ofetch } from 'ofetch'
3
2
  import type { Resource } from '../types/resources'
4
3
  import { useComponentsConfig } from '../config'
@@ -43,7 +42,6 @@ export interface ValidataError {
43
42
  tags: Array<string>
44
43
  }
45
44
  export type SchemaResponseData = Array<RegisteredSchema>
46
- export type SchemaResponse = AxiosResponse<SchemaResponseData>
47
45
 
48
46
  type SchemaPath = { schema_name: string } | { schema_url: string }
49
47
 
@@ -1,4 +1,4 @@
1
- import axios from 'axios'
1
+ import { ofetch } from 'ofetch'
2
2
  import { useComponentsConfig, type PluginConfig } from '../config'
3
3
 
4
4
  export type SortConfig = {
@@ -9,19 +9,19 @@ export type SortConfig = {
9
9
  /**
10
10
  * Call Tabular-api to get table content
11
11
  */
12
- export function getData(config: PluginConfig, id: string, page: number, sortConfig?: SortConfig) {
12
+ export async function getData(config: PluginConfig, id: string, page: number, sortConfig?: SortConfig) {
13
13
  let url = `${config.tabularApiUrl}/api/resources/${id}/data/?page=${page}&page_size=${config.tabularApiPageSize || 15}`
14
14
  if (sortConfig) {
15
15
  url = url + `&${sortConfig.column}__sort=${sortConfig.type}`
16
16
  }
17
- return axios.get(url)
17
+ return await ofetch(url)
18
18
  }
19
19
 
20
20
  /**
21
21
  * Call Tabular-api to get table profile
22
22
  */
23
- export function getProfile(id: string) {
23
+ export async function getProfile(id: string) {
24
24
  const config = useComponentsConfig()
25
25
 
26
- return axios.get(`${config.tabularApiUrl}/api/resources/${id}/profile/`)
26
+ return await ofetch(`${config.tabularApiUrl}/api/resources/${id}/profile/`)
27
27
  }
@@ -1,4 +0,0 @@
1
- import { _ as f } from "./main-D4D0CyPW.js";
2
- export {
3
- f as default
4
- };