@gsa-tts/graymatter-ui 0.6.2 → 0.6.3

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.6.2",
3
+ "version": "0.6.3",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -42,7 +42,7 @@
42
42
  "static"
43
43
  ],
44
44
  "devDependencies": {
45
- "@astrojs/svelte": "^7.0.13",
45
+ "@astrojs/svelte": "^8.0.5",
46
46
  "@sveltejs/vite-plugin-svelte": "^5.1.0",
47
47
  "@testing-library/jest-dom": "^6.6.3",
48
48
  "@testing-library/svelte": "^5.2.8",
@@ -53,24 +53,24 @@
53
53
  "@types/unist": "^3.0.3",
54
54
  "@uswds/compile": "1.2.2",
55
55
  "@vitest/coverage-istanbul": "^3.2.4",
56
- "astro": "^5.15.9",
57
- "astro-purgecss": "^5.2.2",
56
+ "astro": "6.1.9",
57
+ "astro-purgecss": "^6.0.1",
58
58
  "eslint": "^9.21.0",
59
59
  "gulp": "^5.0.0",
60
60
  "svelte": "^5.53.5",
61
61
  "typescript": "5.7.3",
62
- "vite": "^6.4.1",
63
- "vitest": "^3.0.7",
62
+ "vite": "^7.3.2",
63
+ "vitest": "^3.2.4",
64
64
  "@gsa-tts/graymatter-eslint": "0.0.2",
65
- "@gsa-tts/graymatter-typescript-config": "0.0.2",
66
- "@gsa-tts/graymatter-vitest-config": "0.0.1"
65
+ "@gsa-tts/graymatter-typescript-config": "0.0.3",
66
+ "@gsa-tts/graymatter-vitest-config": "0.0.2"
67
67
  },
68
68
  "dependencies": {
69
- "@fontsource-variable/archivo": "^5.2.6",
69
+ "@fontsource/archivo": "^5.2.8",
70
70
  "@fontsource/space-mono": "^5.2.8",
71
71
  "@uswds/uswds": "3.12.0",
72
72
  "unist-util-visit": "^5.0.0",
73
- "@gsa-tts/graymatter-style-tokens": "0.3.17"
73
+ "@gsa-tts/graymatter-style-tokens": "0.6.3"
74
74
  },
75
75
  "scripts": {
76
76
  "build": "gulp update && vite build",
@@ -1,5 +1,5 @@
1
1
  // @ts-check
2
- import { defineConfig, fontProviders } from 'astro/config';
2
+ import { defineConfig } from 'astro/config';
3
3
  import type { AstroIntegration } from 'astro';
4
4
  import svelte from '@astrojs/svelte';
5
5
  import purgecss from 'astro-purgecss';
@@ -31,7 +31,7 @@ export function createAstroConfig({
31
31
  svelte(),
32
32
  // purgecss should go last
33
33
  purgecss({
34
- fontFace: true, // Removes unused @font-face rules
34
+ fontFace: false, // Keep @font-face rules for packaged fonts
35
35
  keyframes: true, // Removes unused keyframes
36
36
  safelist: {
37
37
  standard: [
@@ -116,37 +116,13 @@ export function createAstroConfig({
116
116
 
117
117
  return defineConfig({
118
118
  base: normalizeTrailingSlash(process.env.BASEURL || ''),
119
+ output: 'static',
119
120
  integrations: process.env.VITEST
120
121
  ? []
121
122
  : overrides.integrations || baseIntegrations,
122
123
  // Markdown config with remark plugins (applies to all markdown/MDX processing)
123
124
  markdown: mergedMarkdownConfig as typeof baseMarkdownConfig &
124
125
  typeof overrides.markdown,
125
- experimental: {
126
- // Astro Experimental Fonts API for managing custom fonts
127
- fonts: [
128
- {
129
- name: 'Archivo',
130
- cssVariable: '--ai-font-family-sans', // Scoped variable name
131
- provider: fontProviders.fontsource(),
132
- weights: [400, 500, 600],
133
- fallbacks: ['sans-serif'],
134
- subsets: ['latin'],
135
- styles: ['normal'],
136
- optimizedFallbacks: true,
137
- },
138
- {
139
- name: 'Space Mono',
140
- cssVariable: '--ai-font-family-monospace', // Scoped variable name
141
- provider: fontProviders.fontsource(),
142
- weights: [400],
143
- fallbacks: ['monospace'],
144
- subsets: ['latin'],
145
- styles: ['normal'],
146
- optimizedFallbacks: true,
147
- },
148
- ],
149
- },
150
126
  image: {
151
127
  service: {
152
128
  entrypoint: 'astro/assets/services/noop',
@@ -82,6 +82,9 @@
82
82
 
83
83
  // Set default header from first submenu item after a short delay
84
84
  setTimeout(() => {
85
+ if (typeof document === 'undefined') {
86
+ return;
87
+ }
85
88
  const mainContent = document.getElementById('main-content');
86
89
  if (mainContent) {
87
90
  const firstSection = mainContent.querySelector(
@@ -1,8 +1,15 @@
1
1
  <script lang="ts">
2
2
  import Button from '@gsa-tts/graymatter-ui/components/Button.svelte';
3
3
 
4
- let { mainContentId = '#main-content', skipLinkTheme = 'inverted' } =
5
- $props();
4
+ type UsaSkipNavProps = {
5
+ mainContentId?: string;
6
+ skipLinkTheme?: 'inverted' | 'default';
7
+ };
8
+
9
+ let {
10
+ mainContentId = '#main-content',
11
+ skipLinkTheme = 'inverted',
12
+ }: UsaSkipNavProps = $props();
6
13
  </script>
7
14
 
8
15
  <Button
@@ -8,7 +8,6 @@ import MobileBottomNav from '../components/MobileBottomNav.svelte';
8
8
  import MobileSideMenu from '../components/MobileSideMenu.svelte';
9
9
  import Logo from '../components/Logo.svelte';
10
10
  import { siteName } from '../constants';
11
- import { getSecret } from 'astro:env/server';
12
11
 
13
12
  const {
14
13
  componentOptions = {},
@@ -26,13 +25,15 @@ const {
26
25
  className = '',
27
26
  } = Astro.props;
28
27
 
29
- // Use getSecret directly for better environment variable handling
30
- const chatUrl = getSecret('CHAT_URL') || getSecret('PUBLIC_CHAT_URL');
31
- const consoleUrl = getSecret('CONSOLE_URL') || getSecret('PUBLIC_CONSOLE_URL');
28
+ // Read at build time for static output; prefer PUBLIC_* for safe exposure
29
+ const chatUrl =
30
+ import.meta.env.PUBLIC_CHAT_URL || process.env.CHAT_URL || undefined;
31
+ const consoleUrl =
32
+ import.meta.env.PUBLIC_CONSOLE_URL || process.env.CONSOLE_URL || undefined;
32
33
  const apiDocsUrl =
33
- getSecret('API_DOCS_URL') || getSecret('PUBLIC_API_DOCS_URL');
34
+ import.meta.env.PUBLIC_API_DOCS_URL || process.env.API_DOCS_URL || undefined;
34
35
  const discoverUrl =
35
- getSecret('DISCOVER_URL') || getSecret('PUBLIC_DISCOVER_URL');
36
+ import.meta.env.PUBLIC_DISCOVER_URL || process.env.DISCOVER_URL || undefined;
36
37
 
37
38
  const chat = chatUrl || '#';
38
39
  const consoleApp = consoleUrl || '#';
@@ -1,9 +1,9 @@
1
1
  ---
2
2
  import { siteName } from '../constants';
3
3
  const { title, description, openGraphImage, gtmID } = Astro.props;
4
- import { Font } from 'astro:assets';
5
4
  import { getUrlFromBase } from '@gsa-tts/graymatter-ui/helpers';
6
5
  import GoogleTagManager from './GoogleTagManager.astro';
6
+ import { fontPreloads } from './fonts';
7
7
 
8
8
  // Default values for Open Graph
9
9
  const defaultDescription =
@@ -28,11 +28,21 @@ const canonicalUrl = new URL(Astro.url.pathname, siteUrl).href;
28
28
  }
29
29
  </script>
30
30
  {gtmIDValue && <GoogleTagManager gtmID={gtmIDValue} />}
31
- <script is:inline src=`${getUrlFromBase('uswds/js/uswds-init.min.js')}`
31
+ <script is:inline src={`${getUrlFromBase('uswds/js/uswds-init.min.js')}`}
32
32
  ></script>
33
- <Font cssVariable="--ai-font-family-sans" preload />
34
- <Font cssVariable="--ai-font-family-monospace" />
35
- <style>
33
+
34
+ {
35
+ fontPreloads.map(href => (
36
+ <link rel="preload" href={href} as="font" type="font/woff2" crossorigin />
37
+ ))
38
+ }
39
+
40
+ <style is:global>
41
+ :root {
42
+ --ai-font-family-sans: 'Archivo', sans-serif;
43
+ --ai-font-family-monospace: 'Space Mono', monospace;
44
+ }
45
+
36
46
  body {
37
47
  font-family: var(--ai-font-family-sans);
38
48
  }
@@ -0,0 +1,17 @@
1
+ // Centralized font imports and preload URLs.
2
+ import '@fontsource/archivo/400.css';
3
+ import '@fontsource/archivo/500.css';
4
+ import '@fontsource/archivo/600.css';
5
+ import '@fontsource/space-mono/400.css';
6
+
7
+ import archivo400Url from '@fontsource/archivo/files/archivo-latin-400-normal.woff2?url';
8
+ import archivo500Url from '@fontsource/archivo/files/archivo-latin-500-normal.woff2?url';
9
+ import archivo600Url from '@fontsource/archivo/files/archivo-latin-600-normal.woff2?url';
10
+ import spaceMono400Url from '@fontsource/space-mono/files/space-mono-latin-400-normal.woff2?url';
11
+
12
+ export const fontPreloads = [
13
+ archivo400Url,
14
+ archivo500Url,
15
+ archivo600Url,
16
+ spaceMono400Url,
17
+ ];
File without changes