@gsa-tts/graymatter-ui 0.4.3 → 0.4.5
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": "@gsa-tts/graymatter-ui",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -69,7 +69,6 @@
|
|
|
69
69
|
"@fontsource-variable/archivo": "^5.2.6",
|
|
70
70
|
"@fontsource/space-mono": "^5.2.8",
|
|
71
71
|
"@uswds/uswds": "3.12.0",
|
|
72
|
-
"slugify": "^1.6.6",
|
|
73
72
|
"unist-util-visit": "^5.0.0",
|
|
74
73
|
"@gsa-tts/graymatter-style-tokens": "0.3.17"
|
|
75
74
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { createEventDispatcher, onMount } from 'svelte';
|
|
3
|
-
import { subNavReady } from '
|
|
3
|
+
import { subNavReady } from '../stores/subNavReadyStore';
|
|
4
4
|
import type { SubNavData, SubNavItem } from '../types/subnav.ts';
|
|
5
5
|
import ApiDocSubNavList from './ApiDocSubNavList.svelte';
|
|
6
6
|
|
|
@@ -5,8 +5,6 @@
|
|
|
5
5
|
import ChatIcon from './icons/ChatIcon.svelte';
|
|
6
6
|
import ConsoleIcon from './icons/ConsoleIcon.svelte';
|
|
7
7
|
import ApiIcon from './icons/ApiIcon.svelte';
|
|
8
|
-
import * as slugifyModule from 'slugify';
|
|
9
|
-
const slugify = slugifyModule.default || slugifyModule;
|
|
10
8
|
|
|
11
9
|
let {
|
|
12
10
|
onNavItemClick,
|
|
@@ -131,10 +129,10 @@
|
|
|
131
129
|
{#each navItems as navItem}
|
|
132
130
|
<a
|
|
133
131
|
href={navItem.href}
|
|
134
|
-
class={`nav-item ${
|
|
132
|
+
class={`nav-item ${navItem.id}-item`}
|
|
135
133
|
class:active={$selectedItem === navItem.id}
|
|
136
134
|
onclick={() => handleNavItemClick(navItem.id)}
|
|
137
|
-
part={`${
|
|
135
|
+
part={`${navItem.id}-item`}
|
|
138
136
|
>
|
|
139
137
|
<div class="icon">
|
|
140
138
|
<navItem.icon isSelected={$selectedItem === navItem.id} />
|
|
@@ -129,9 +129,24 @@ const subNavData = generateApiDocumentationNavData(apiDocsMetadata);
|
|
|
129
129
|
.replace(/'/g, ''');
|
|
130
130
|
}
|
|
131
131
|
function linkify(input) {
|
|
132
|
+
// Handle array input - convert to paragraphs
|
|
133
|
+
if (Array.isArray(input)) {
|
|
134
|
+
return input
|
|
135
|
+
.map(paragraph => {
|
|
136
|
+
const processed = linkifySingle(String(paragraph));
|
|
137
|
+
return `<p>${processed}</p>`;
|
|
138
|
+
})
|
|
139
|
+
.join('');
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// Handle string input
|
|
143
|
+
return linkifySingle(String(input));
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function linkifySingle(input) {
|
|
132
147
|
// Preserve markdown links [label](url) using placeholders
|
|
133
148
|
const placeholders = [];
|
|
134
|
-
const withPlaceholders =
|
|
149
|
+
const withPlaceholders = input.replace(
|
|
135
150
|
/\[([^\]]+)\]\(((https?:\/\/|www\.)[^\s)]+)\)/gi,
|
|
136
151
|
(m, label, href) => {
|
|
137
152
|
const safeLabel = escapeHtml(label);
|
package/src/utils/setupMocks.ts
CHANGED
|
@@ -28,16 +28,6 @@ export function setupCommonMocks() {
|
|
|
28
28
|
};
|
|
29
29
|
});
|
|
30
30
|
|
|
31
|
-
vi.mock('slugify', () => {
|
|
32
|
-
const mockSlugify = (x: string) => x.toLowerCase().replace(/ /g, '-');
|
|
33
|
-
return {
|
|
34
|
-
__esModule: true,
|
|
35
|
-
default: mockSlugify,
|
|
36
|
-
// Support both named and default exports
|
|
37
|
-
slugify: mockSlugify,
|
|
38
|
-
};
|
|
39
|
-
});
|
|
40
|
-
|
|
41
31
|
vi.stubGlobal(
|
|
42
32
|
'window',
|
|
43
33
|
Object.create(window, {
|