@grove-dev/astro 0.7.0 → 0.9.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 (110) hide show
  1. package/dist/index.d.ts +3 -3
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +22 -33
  4. package/dist/index.js.map +1 -1
  5. package/dist/lib/display.d.ts +1 -1
  6. package/dist/lib/display.js +1 -1
  7. package/dist/lib/format.d.ts +1 -1
  8. package/dist/lib/format.js +1 -1
  9. package/dist/lib/icon-kinds.d.ts +1 -1
  10. package/dist/lib/icon-kinds.js +43 -43
  11. package/dist/lib/icon-registry.d.ts +2 -2
  12. package/dist/lib/icon-registry.js +23 -23
  13. package/dist/lib/index.d.ts +9 -9
  14. package/dist/lib/index.d.ts.map +1 -1
  15. package/dist/lib/index.js +9 -9
  16. package/dist/lib/index.js.map +1 -1
  17. package/dist/lib/lenses.d.ts +1 -1
  18. package/dist/lib/lenses.js +1 -1
  19. package/dist/lib/packaged-icons.d.ts +1 -1
  20. package/dist/lib/packaged-icons.js +4 -4
  21. package/dist/lib/repo.d.ts +1 -1
  22. package/dist/lib/repo.js +1 -1
  23. package/dist/lib/search.d.ts +1 -1
  24. package/dist/lib/search.js +1 -1
  25. package/dist/lib/taxonomy-counts.d.ts +1 -1
  26. package/dist/lib/taxonomy-counts.js +1 -1
  27. package/package.json +7 -17
  28. package/src/index.ts +23 -38
  29. package/src/lib/display.ts +1 -1
  30. package/src/lib/format.ts +1 -1
  31. package/src/lib/icon-kinds.ts +44 -44
  32. package/src/lib/icon-registry.ts +25 -25
  33. package/src/lib/index.ts +9 -9
  34. package/src/lib/lenses.ts +1 -1
  35. package/src/lib/packaged-icons.ts +8 -8
  36. package/src/lib/repo.ts +1 -1
  37. package/src/lib/search.ts +1 -1
  38. package/src/lib/taxonomy-counts.ts +1 -1
  39. package/src/server/collections.ts +53 -42
  40. package/src/server/contrast.ts +14 -9
  41. package/src/server/directory.ts +22 -17
  42. package/src/server/index.ts +3 -2
  43. package/src/server/models.ts +425 -218
  44. package/src/server/seo.ts +34 -31
  45. package/src/styles.css +235 -91
  46. package/dist/layouts/index.d.ts +0 -25
  47. package/dist/layouts/index.d.ts.map +0 -1
  48. package/dist/layouts/index.js +0 -25
  49. package/dist/layouts/index.js.map +0 -1
  50. package/dist/ui/button.d.ts +0 -53
  51. package/dist/ui/button.d.ts.map +0 -1
  52. package/dist/ui/button.js +0 -90
  53. package/dist/ui/button.js.map +0 -1
  54. package/src/components/CardGrid.astro +0 -41
  55. package/src/components/CardIcon.astro +0 -67
  56. package/src/components/CategoryGrid.astro +0 -114
  57. package/src/components/CollectionCard.astro +0 -56
  58. package/src/components/CollectionIndex.astro +0 -102
  59. package/src/components/CollectionPage.astro +0 -128
  60. package/src/components/CollectionRow.astro +0 -81
  61. package/src/components/CollectionTeaser.astro +0 -47
  62. package/src/components/ContributorsGrid.astro +0 -143
  63. package/src/components/DirectoryIndexClient.astro +0 -510
  64. package/src/components/EditorialSummary.astro +0 -58
  65. package/src/components/FilterGroupMenu.astro +0 -69
  66. package/src/components/FilterOptions.astro +0 -49
  67. package/src/components/FinalCta.astro +0 -43
  68. package/src/components/Hero.astro +0 -243
  69. package/src/components/Icon.astro +0 -191
  70. package/src/components/IndexRow.astro +0 -37
  71. package/src/components/LanguageBreakdown.astro +0 -67
  72. package/src/components/MarkdownBody.astro +0 -37
  73. package/src/components/OriginalCollection.astro +0 -117
  74. package/src/components/Pagination.astro +0 -50
  75. package/src/components/PoweredBy.astro +0 -60
  76. package/src/components/ProjectCard.astro +0 -321
  77. package/src/components/RecordHeader.astro +0 -221
  78. package/src/components/RecordSection.astro +0 -128
  79. package/src/components/RecordSidebar.astro +0 -387
  80. package/src/components/RefinePanel.astro +0 -168
  81. package/src/components/SmartLensTabs.astro +0 -81
  82. package/src/components/StackGrid.astro +0 -151
  83. package/src/components/StackPlatformChips.astro +0 -73
  84. package/src/components/SubmissionClient.astro +0 -254
  85. package/src/components/TableOfContents.astro +0 -140
  86. package/src/components/WhyThisExists.astro +0 -116
  87. package/src/layouts/BaseLayout.astro +0 -415
  88. package/src/layouts/Container.astro +0 -18
  89. package/src/layouts/Footer.astro +0 -231
  90. package/src/layouts/Header.astro +0 -214
  91. package/src/layouts/SectionHeader.astro +0 -43
  92. package/src/layouts/Seo.astro +0 -171
  93. package/src/layouts/ThemeToggle.astro +0 -118
  94. package/src/layouts/astro-shim.d.ts +0 -29
  95. package/src/layouts/index.ts +0 -24
  96. package/src/server/collections.test.ts +0 -212
  97. package/src/server/contrast.test.ts +0 -82
  98. package/src/server/directory.test.ts +0 -177
  99. package/src/server/github-repo.test.ts +0 -88
  100. package/src/server/models-home.test.ts +0 -101
  101. package/src/server/models.test.ts +0 -135
  102. package/src/server/seo.test.ts +0 -123
  103. package/src/ui/Badge.astro +0 -38
  104. package/src/ui/Button.astro +0 -42
  105. package/src/ui/EmptyState.astro +0 -38
  106. package/src/ui/FilterDrawer.astro +0 -124
  107. package/src/ui/PageHeader.astro +0 -39
  108. package/src/ui/SearchField.astro +0 -106
  109. package/src/ui/button.test.ts +0 -54
  110. package/src/ui/button.ts +0 -107
@@ -9,16 +9,22 @@
9
9
  * values are plain hex.
10
10
  */
11
11
 
12
- const INK_950 = "#0a0a0a";
13
- const WHITE = "#ffffff";
12
+ const INK_950 = '#0a0a0a';
13
+ const WHITE = '#ffffff';
14
14
  const AA_NORMAL = 4.5;
15
15
 
16
16
  export type Rgb = [number, number, number];
17
17
 
18
18
  /** Parse #rgb / #rrggbb (also tolerates #rrggbbaa, alpha ignored). */
19
19
  export function hexToRgb(hex: string): Rgb | null {
20
- const raw = hex.replace("#", "");
21
- const full = raw.length === 3 ? raw.split("").map((c) => c + c).join("") : raw;
20
+ const raw = hex.replace('#', '');
21
+ const full =
22
+ raw.length === 3
23
+ ? raw
24
+ .split('')
25
+ .map((c) => c + c)
26
+ .join('')
27
+ : raw;
22
28
  if (!/^[0-9a-fA-F]{6}([0-9a-fA-F]{2})?$/.test(full)) return null;
23
29
  const int = Number.parseInt(full.slice(0, 6), 16);
24
30
  return [(int >> 16) & 255, (int >> 8) & 255, int & 255];
@@ -26,7 +32,7 @@ export function hexToRgb(hex: string): Rgb | null {
26
32
 
27
33
  export function rgbToHex([r, g, b]: Rgb): string {
28
34
  const clamp = (v: number) => Math.max(0, Math.min(255, Math.round(v)));
29
- return `#${[r, g, b].map((v) => clamp(v).toString(16).padStart(2, "0")).join("")}`;
35
+ return `#${[r, g, b].map((v) => clamp(v).toString(16).padStart(2, '0')).join('')}`;
30
36
  }
31
37
 
32
38
  /** WCAG relative luminance (sRGB linearization, not the quick luma). */
@@ -104,14 +110,13 @@ export function derivePrimaryPalette(hex: string): PrimaryPalette | null {
104
110
  } else if (contrastRatio(hex, INK_950) >= AA_NORMAL) {
105
111
  solidForeground = INK_950;
106
112
  } else {
107
- solid = adjustUntilAA(hex, "#000000", WHITE);
113
+ solid = adjustUntilAA(hex, '#000000', WHITE);
108
114
  solidForeground = WHITE;
109
115
  }
110
116
 
111
117
  const lifted = rgbToHex(mix(rgb, hexToRgb(WHITE) as Rgb, 0.28));
112
- const dark = contrastRatio(lifted, INK_950) >= AA_NORMAL
113
- ? lifted
114
- : adjustUntilAA(lifted, WHITE, INK_950);
118
+ const dark =
119
+ contrastRatio(lifted, INK_950) >= AA_NORMAL ? lifted : adjustUntilAA(lifted, WHITE, INK_950);
115
120
 
116
121
  return { solid, solidForeground, dark, darkForeground: INK_950 };
117
122
  }
@@ -30,27 +30,28 @@
30
30
  * resolution error, which is the correct signal — a build that
31
31
  * silently renders an empty directory hides real config mistakes.
32
32
  */
33
+
34
+ import { existsSync, readFileSync } from 'node:fs';
35
+ import { dirname, resolve } from 'node:path';
36
+ import { fileURLToPath } from 'node:url';
33
37
  import fullPayload from '@grove/generated/records.full.json';
34
38
  import indexPayload from '@grove/generated/records.index.json';
35
39
  import siteConfigPayload from '@grove/generated/site-config.json';
36
- import { existsSync, readFileSync } from 'node:fs';
37
- import { fileURLToPath } from 'node:url';
38
- import { dirname, resolve } from 'node:path';
39
- import { marked } from 'marked';
40
- import sanitizeHtml from 'sanitize-html';
41
- import { getSingletonHighlighter } from 'shiki';
42
- import { prettySlug } from '../lib/display.js';
43
- import { headingSlug, readContentFile, stripFrontmatter, uniqueSlug } from '@grove-dev/core';
44
40
  import type {
45
- ProjectRecord,
46
- ResourceRecord,
47
41
  EntityRecord,
48
- Resource,
49
- IndexRecord,
42
+ IndexEntityRecord,
50
43
  IndexProjectRecord,
44
+ IndexRecord,
51
45
  IndexResourceRecord,
52
- IndexEntityRecord,
46
+ ProjectRecord,
47
+ Resource,
48
+ ResourceRecord,
53
49
  } from '@grove-dev/core';
50
+ import { headingSlug, readContentFile, stripFrontmatter, uniqueSlug } from '@grove-dev/core';
51
+ import { marked } from 'marked';
52
+ import sanitizeHtml from 'sanitize-html';
53
+ import { getSingletonHighlighter } from 'shiki';
54
+ import { prettySlug } from '../lib/display.js';
54
55
 
55
56
  interface FullPayload {
56
57
  schemaVersion?: number;
@@ -676,10 +677,14 @@ const SUPPORTED_LANGS = [
676
677
  'properties',
677
678
  ];
678
679
  const globalAny = globalThis as GlobalWithShiki;
679
- const highlighter = await (globalAny[SHIKI_HIGHLIGHTER] ??= getSingletonHighlighter({
680
- themes: ['github-light', 'github-dark-default'],
681
- langs: SUPPORTED_LANGS,
682
- }));
680
+ const pendingHighlighter =
681
+ globalAny[SHIKI_HIGHLIGHTER] ??
682
+ getSingletonHighlighter({
683
+ themes: ['github-light', 'github-dark-default'],
684
+ langs: SUPPORTED_LANGS,
685
+ });
686
+ globalAny[SHIKI_HIGHLIGHTER] = pendingHighlighter;
687
+ const highlighter = await pendingHighlighter;
683
688
 
684
689
  // Release the previous engine's WASM heap on HMR. Without this the
685
690
  // old engine is unreachable but not disposed, which is the leak
@@ -1,5 +1,6 @@
1
- export * from './directory.js';
2
- export * from './models.js';
3
1
  export * from './collections.js';
2
+ export * from './contrast.js';
3
+ export * from './directory.js';
4
4
  export * from './github-repo.js';
5
+ export * from './models.js';
5
6
  export * from './seo.js';