@acta-dev/web 1.0.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 (66) hide show
  1. package/LICENSE +21 -0
  2. package/astro.config.mjs +31 -0
  3. package/package.json +62 -0
  4. package/public/favicon.png +0 -0
  5. package/src/components/DocumentSearchList.astro +150 -0
  6. package/src/components/DocumentView.astro +198 -0
  7. package/src/components/LanguageSwitcher.tsx +115 -0
  8. package/src/components/SidebarToggle.tsx +42 -0
  9. package/src/components/ThemeToggle.tsx +129 -0
  10. package/src/components/graph/DocumentGraphIsland.tsx +226 -0
  11. package/src/components/graph/GraphContext.ts +15 -0
  12. package/src/components/graph/graph.css +330 -0
  13. package/src/components/graph/layout.ts +48 -0
  14. package/src/components/graph/nodes.tsx +80 -0
  15. package/src/components/ui/Button.astro +105 -0
  16. package/src/components/ui/Chip.astro +147 -0
  17. package/src/components/ui/Field.astro +29 -0
  18. package/src/components/ui/Input.astro +34 -0
  19. package/src/components/ui/Pill.astro +71 -0
  20. package/src/components/ui/SegmentedControl.astro +105 -0
  21. package/src/components/ui/Select.astro +41 -0
  22. package/src/components/ui/Tooltip.astro +94 -0
  23. package/src/layouts/BaseLayout.astro +147 -0
  24. package/src/lib/documents.test.ts +175 -0
  25. package/src/lib/documents.ts +156 -0
  26. package/src/lib/i18n-client.ts +32 -0
  27. package/src/lib/i18n.ts +92 -0
  28. package/src/lib/project.test.ts +24 -0
  29. package/src/lib/project.ts +120 -0
  30. package/src/lib/search-client.ts +192 -0
  31. package/src/lib/search.test.ts +94 -0
  32. package/src/lib/search.ts +153 -0
  33. package/src/locales/en/common.json +6 -0
  34. package/src/locales/en/dashboard.json +8 -0
  35. package/src/locales/en/documents.json +63 -0
  36. package/src/locales/en/graph.json +19 -0
  37. package/src/locales/en/search.json +7 -0
  38. package/src/locales/en/sidebar.json +25 -0
  39. package/src/locales/en/validation.json +13 -0
  40. package/src/locales/ru/common.json +6 -0
  41. package/src/locales/ru/dashboard.json +8 -0
  42. package/src/locales/ru/documents.json +63 -0
  43. package/src/locales/ru/graph.json +19 -0
  44. package/src/locales/ru/search.json +7 -0
  45. package/src/locales/ru/sidebar.json +25 -0
  46. package/src/locales/ru/validation.json +13 -0
  47. package/src/pages/documents/[id]/index.astro +39 -0
  48. package/src/pages/graph.astro +54 -0
  49. package/src/pages/index.astro +41 -0
  50. package/src/pages/ru/documents/[id]/index.astro +39 -0
  51. package/src/pages/ru/graph.astro +54 -0
  52. package/src/pages/ru/index.astro +41 -0
  53. package/src/pages/ru/search-index-full.json.ts +1 -0
  54. package/src/pages/ru/search.astro +27 -0
  55. package/src/pages/ru/validation.astro +63 -0
  56. package/src/pages/search-index-full.json.ts +12 -0
  57. package/src/pages/search-index.json.ts +12 -0
  58. package/src/pages/search.astro +27 -0
  59. package/src/pages/validation.astro +63 -0
  60. package/src/styles/global.css +1391 -0
  61. package/src/styles/themes/dark.css +61 -0
  62. package/src/styles/themes/light.css +63 -0
  63. package/src/styles/tokens/primitives.css +32 -0
  64. package/src/styles/tokens/semantic.css +34 -0
  65. package/src/styles/tokens/typography.css +28 -0
  66. package/tsconfig.json +11 -0
@@ -0,0 +1,63 @@
1
+ ---
2
+ import BaseLayout from "../layouts/BaseLayout.astro";
3
+ import Pill from "../components/ui/Pill.astro";
4
+ import { buildDocumentHref } from "@lib/documents.js";
5
+ import { loadActaWebData } from "@lib/project.js";
6
+ import { defaultLocale, getT, isLocale, localizedHref, type Locale } from "@lib/i18n.js";
7
+
8
+ const { project, validation } = await loadActaWebData();
9
+ const documentsById = new Map(project.documents.map((document) => [document.id, document]));
10
+
11
+ const rawLocale = Astro.currentLocale ?? defaultLocale;
12
+ const locale: Locale = isLocale(rawLocale) ? rawLocale : defaultLocale;
13
+ const t = await getT(locale);
14
+ const severityLabel = (sev: string) => t(`validation:severity.${sev}`);
15
+ ---
16
+
17
+ <BaseLayout title={t("validation:tab")} description={t("validation:meta")}>
18
+ <section class="page-header">
19
+ <div class="crumbs">
20
+ <span>{t("validation:eyebrow")}</span>
21
+ <span class="grow"></span>
22
+ <Pill
23
+ as="a"
24
+ href={localizedHref(locale, "/validation/")}
25
+ tone={validation.valid ? "success" : "danger"}
26
+ >
27
+ {validation.valid ? t("common:valid") : t("common:needsAttention")}
28
+ </Pill>
29
+ </div>
30
+ <h1>{t("validation:header")}<span class="accent-period">.</span></h1>
31
+ <p class="page-sub">
32
+ {t("validation:counts", { errors: validation.errorCount, warnings: validation.warningCount })}
33
+ </p>
34
+ </section>
35
+
36
+ {
37
+ validation.issues.length === 0 ? (
38
+ <p class="empty-state">{t("validation:empty")}</p>
39
+ ) : (
40
+ <section class="issue-list">
41
+ {validation.issues.map((issue) => {
42
+ const document = issue.documentId ? documentsById.get(issue.documentId) : undefined;
43
+ return (
44
+ <article class={`issue severity-${issue.severity}`}>
45
+ <div>
46
+ <strong>{severityLabel(issue.severity)}</strong>
47
+ <span>{issue.ruleId}</span>
48
+ </div>
49
+ <p>{issue.message}</p>
50
+ {document ? (
51
+ <a href={localizedHref(locale, buildDocumentHref(document.id))}>
52
+ {document.id} · {document.title}
53
+ </a>
54
+ ) : (
55
+ issue.path && <span class="muted">{issue.path}</span>
56
+ )}
57
+ </article>
58
+ );
59
+ })}
60
+ </section>
61
+ )
62
+ }
63
+ </BaseLayout>