@stoa-dev/kit 0.1.3 → 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 (104) hide show
  1. package/CHANGELOG.md +64 -0
  2. package/README.md +23 -2
  3. package/dist/display/BarChart/index.js +70 -0
  4. package/dist/display/BarChart/index.js.map +1 -0
  5. package/dist/display/Marginalia/index.js +16 -0
  6. package/dist/display/Marginalia/index.js.map +1 -0
  7. package/dist/display/MarginaliaFramed/index.js +19 -0
  8. package/dist/display/MarginaliaFramed/index.js.map +1 -0
  9. package/dist/display/MarginaliaPair/index.js +32 -0
  10. package/dist/display/MarginaliaPair/index.js.map +1 -0
  11. package/dist/display/ProgressBar/index.js +72 -0
  12. package/dist/display/ProgressBar/index.js.map +1 -0
  13. package/dist/display/TimeMeasured/index.js +38 -0
  14. package/dist/display/TimeMeasured/index.js.map +1 -0
  15. package/dist/display/index.js +16 -0
  16. package/dist/display/index.js.map +1 -0
  17. package/dist/i18n/locales/at.json.js +8 -4
  18. package/dist/i18n/locales/at.json.js.map +1 -1
  19. package/dist/i18n/locales/de.json.js +8 -4
  20. package/dist/i18n/locales/de.json.js.map +1 -1
  21. package/dist/i18n/locales/en.json.js +8 -4
  22. package/dist/i18n/locales/en.json.js.map +1 -1
  23. package/dist/i18n/locales/it.json.js +10 -6
  24. package/dist/i18n/locales/it.json.js.map +1 -1
  25. package/dist/shell/AnimatedSwap/index.js +61 -0
  26. package/dist/shell/AnimatedSwap/index.js.map +1 -0
  27. package/dist/shell/AppNavigation/index.js +62 -43
  28. package/dist/shell/AppNavigation/index.js.map +1 -1
  29. package/dist/shell/BrandLines/index.js +14 -12
  30. package/dist/shell/BrandLines/index.js.map +1 -1
  31. package/dist/shell/DatePicker/index.js +134 -127
  32. package/dist/shell/DatePicker/index.js.map +1 -1
  33. package/dist/shell/ExternalLink/index.js +30 -0
  34. package/dist/shell/ExternalLink/index.js.map +1 -0
  35. package/dist/shell/PageHeading/index.js +15 -8
  36. package/dist/shell/PageHeading/index.js.map +1 -1
  37. package/dist/shell/SaveStatus/index.js +61 -0
  38. package/dist/shell/SaveStatus/index.js.map +1 -0
  39. package/dist/shell/SectionNavigation/index.js +29 -27
  40. package/dist/shell/SectionNavigation/index.js.map +1 -1
  41. package/dist/shell/StartupAnimation/index.js +88 -0
  42. package/dist/shell/StartupAnimation/index.js.map +1 -0
  43. package/dist/shell/StartupProvider/index.js +37 -0
  44. package/dist/shell/StartupProvider/index.js.map +1 -0
  45. package/dist/shell/TagInput/index.js +93 -0
  46. package/dist/shell/TagInput/index.js.map +1 -0
  47. package/dist/shell/ValidatedInput/index.js +31 -0
  48. package/dist/shell/ValidatedInput/index.js.map +1 -0
  49. package/dist/shell/index.js +41 -24
  50. package/dist/shell/index.js.map +1 -1
  51. package/dist/types/display/BarChart/index.d.ts +25 -0
  52. package/dist/types/display/BarChart/index.d.ts.map +1 -0
  53. package/dist/types/display/Marginalia/index.d.ts +8 -0
  54. package/dist/types/display/Marginalia/index.d.ts.map +1 -0
  55. package/dist/types/display/MarginaliaFramed/index.d.ts +8 -0
  56. package/dist/types/display/MarginaliaFramed/index.d.ts.map +1 -0
  57. package/dist/types/display/MarginaliaPair/index.d.ts +9 -0
  58. package/dist/types/display/MarginaliaPair/index.d.ts.map +1 -0
  59. package/dist/types/display/ProgressBar/index.d.ts +19 -0
  60. package/dist/types/display/ProgressBar/index.d.ts.map +1 -0
  61. package/dist/types/display/TimeMeasured/index.d.ts +16 -0
  62. package/dist/types/display/TimeMeasured/index.d.ts.map +1 -0
  63. package/dist/types/display/index.d.ts +7 -0
  64. package/dist/types/display/index.d.ts.map +1 -0
  65. package/dist/types/i18n/index.d.ts +44 -0
  66. package/dist/types/i18n/index.d.ts.map +1 -1
  67. package/dist/types/shell/AnimatedSwap/index.d.ts +13 -0
  68. package/dist/types/shell/AnimatedSwap/index.d.ts.map +1 -0
  69. package/dist/types/shell/AppNavigation/index.d.ts.map +1 -1
  70. package/dist/types/shell/BrandLines/index.d.ts.map +1 -1
  71. package/dist/types/shell/DatePicker/index.d.ts +5 -1
  72. package/dist/types/shell/DatePicker/index.d.ts.map +1 -1
  73. package/dist/types/shell/ErrorBoundary/index.d.ts +1 -1
  74. package/dist/types/shell/ExternalLink/index.d.ts +10 -0
  75. package/dist/types/shell/ExternalLink/index.d.ts.map +1 -0
  76. package/dist/types/shell/PageHeading/index.d.ts.map +1 -1
  77. package/dist/types/shell/SaveStatus/index.d.ts +15 -0
  78. package/dist/types/shell/SaveStatus/index.d.ts.map +1 -0
  79. package/dist/types/shell/SectionNavigation/index.d.ts.map +1 -1
  80. package/dist/types/shell/StartupAnimation/index.d.ts +26 -0
  81. package/dist/types/shell/StartupAnimation/index.d.ts.map +1 -0
  82. package/dist/types/shell/StartupProvider/index.d.ts +22 -0
  83. package/dist/types/shell/StartupProvider/index.d.ts.map +1 -0
  84. package/dist/types/shell/TagInput/index.d.ts +20 -0
  85. package/dist/types/shell/TagInput/index.d.ts.map +1 -0
  86. package/dist/types/shell/ValidatedInput/index.d.ts +17 -0
  87. package/dist/types/shell/ValidatedInput/index.d.ts.map +1 -0
  88. package/dist/types/shell/index.d.ts +7 -0
  89. package/dist/types/shell/index.d.ts.map +1 -1
  90. package/dist/types/ui/field/index.d.ts +1 -1
  91. package/dist/types/ui/input-group/index.d.ts.map +1 -1
  92. package/dist/types/utils/index.d.ts +1 -0
  93. package/dist/types/utils/index.d.ts.map +1 -1
  94. package/dist/types/utils/saveFeedback.d.ts +35 -0
  95. package/dist/types/utils/saveFeedback.d.ts.map +1 -0
  96. package/dist/ui/input-group/index.js +25 -24
  97. package/dist/ui/input-group/index.js.map +1 -1
  98. package/dist/utils/index.js +5 -3
  99. package/dist/utils/index.js.map +1 -1
  100. package/dist/utils/saveFeedback.js +54 -0
  101. package/dist/utils/saveFeedback.js.map +1 -0
  102. package/package.json +8 -2
  103. package/styles/instrument.css +705 -0
  104. package/styles/theme.css +1 -0
@@ -6,23 +6,23 @@ import { useLocation as $, Link as j } from "react-router";
6
6
  import { STOA_NS as I } from "../../i18n/namespace.js";
7
7
  const q = 125, U = 75;
8
8
  function S(r) {
9
- let t = r?.parentElement;
10
- for (; t; ) {
11
- if (/(auto|scroll)/.test(getComputedStyle(t).overflowY)) return t;
12
- t = t.parentElement;
9
+ let e = r?.parentElement;
10
+ for (; e; ) {
11
+ if (/(auto|scroll)/.test(getComputedStyle(e).overflowY)) return e;
12
+ e = e.parentElement;
13
13
  }
14
14
  return null;
15
15
  }
16
16
  function K({
17
17
  scrollContainerRef: r,
18
- sections: t,
18
+ sections: e,
19
19
  label: k
20
20
  }) {
21
21
  const [E, T] = w(!1), H = z() ?? !1, { t: M } = F(I), { hash: d } = $(), m = N(null), [g, y] = w(
22
- t[0]?.id ?? ""
22
+ e[0]?.id ?? ""
23
23
  ), f = O(
24
- (e) => {
25
- const o = S(r.current), a = m.current, n = document.getElementById(e);
24
+ (t) => {
25
+ const o = S(r.current), a = m.current, n = document.getElementById(t);
26
26
  if (!o || !a || !n) return;
27
27
  const l = o.scrollTop + n.getBoundingClientRect().top - o.getBoundingClientRect().top - a.offsetHeight - 16;
28
28
  o.scrollTo({ top: Math.max(0, l) }), n.focus({ preventScroll: !0 });
@@ -30,17 +30,17 @@ function K({
30
30
  [r]
31
31
  );
32
32
  return B(() => {
33
- const e = S(r.current), o = m.current;
34
- if (!e || !o) return;
35
- const a = t.map(({ id: i }) => document.getElementById(i));
33
+ const t = S(r.current), o = m.current;
34
+ if (!t || !o) return;
35
+ const a = e.map(({ id: i }) => document.getElementById(i));
36
36
  let n;
37
37
  function l() {
38
- if (n = void 0, !e || !o) return;
38
+ if (n = void 0, !t || !o) return;
39
39
  T(
40
- (s) => s ? e.scrollTop > U : e.scrollTop >= q
40
+ (s) => s ? t.scrollTop > U : t.scrollTop >= q
41
41
  );
42
- let i = t[0]?.id ?? "", p = 0;
43
- const v = e.getBoundingClientRect(), C = Math.max(
42
+ let i = e[0]?.id ?? "", p = 0;
43
+ const v = t.getBoundingClientRect(), C = Math.max(
44
44
  v.top,
45
45
  o.getBoundingClientRect().bottom
46
46
  ), L = Math.min(v.bottom, window.innerHeight);
@@ -52,7 +52,7 @@ function K({
52
52
  );
53
53
  b > p && (p = b, i = s.id);
54
54
  }
55
- e.scrollHeight > e.clientHeight && e.scrollHeight - e.clientHeight - e.scrollTop <= 2 && (i = t[t.length - 1]?.id ?? ""), y(i);
55
+ t.scrollHeight > t.clientHeight && t.scrollHeight - t.clientHeight - t.scrollTop <= 2 && (i = e[e.length - 1]?.id ?? ""), y(i);
56
56
  }
57
57
  function c() {
58
58
  n === void 0 && (n = requestAnimationFrame(l));
@@ -62,18 +62,19 @@ function K({
62
62
  passive: !0
63
63
  }), window.addEventListener("resize", c);
64
64
  const u = new ResizeObserver(c);
65
- u.observe(e), u.observe(o);
65
+ u.observe(t), u.observe(o);
66
66
  for (const i of a) i && u.observe(i);
67
67
  return l(), () => {
68
68
  document.removeEventListener("scroll", c, !0), window.removeEventListener("resize", c), n !== void 0 && cancelAnimationFrame(n), u.disconnect();
69
69
  };
70
- }, [r, t]), B(() => {
71
- const e = d.slice(1);
72
- t.some((o) => o.id === e) && f(e);
73
- }, [d, f, t]), t.length === 0 ? null : /* @__PURE__ */ R(
70
+ }, [r, e]), B(() => {
71
+ const t = d.slice(1);
72
+ e.some((o) => o.id === t) && f(t);
73
+ }, [d, f, e]), e.length === 0 ? null : /* @__PURE__ */ R(
74
74
  "nav",
75
75
  {
76
76
  ref: m,
77
+ "data-slot": "section-navigation",
77
78
  "aria-label": k ?? M("app.navigation"),
78
79
  className: "sticky top-1 z-20 isolate m-1 mt-4 flex flex-wrap gap-1 rounded-xl p-2",
79
80
  children: [
@@ -87,24 +88,25 @@ function K({
87
88
  transition: { duration: H ? 0 : 0.2, ease: "easeOut" }
88
89
  }
89
90
  ),
90
- t.map(({ id: e, label: o }) => /* @__PURE__ */ x(
91
+ e.map(({ id: t, label: o }) => /* @__PURE__ */ x(
91
92
  j,
92
93
  {
93
- to: `#${e}`,
94
+ to: `#${t}`,
94
95
  replace: !0,
95
- "aria-current": g === e ? "location" : void 0,
96
+ "data-slot": "section-navigation-link",
97
+ "aria-current": g === t ? "location" : void 0,
96
98
  onClick: () => {
97
- d === `#${e}` && f(e);
99
+ d === `#${t}` && f(t);
98
100
  },
99
101
  className: `
100
102
  rounded-full px-3 py-2
101
103
  text-sm font-medium transition-colors
102
104
  outline-none focus-visible:ring-2 focus-visible:ring-ring
103
- ${g === e ? "bg-(--section-active) text-foreground" : "text-muted-foreground hover:bg-muted hover:text-foreground"}
105
+ ${g === t ? "bg-(--section-active) text-foreground" : "text-muted-foreground hover:bg-muted hover:text-foreground"}
104
106
  `,
105
107
  children: o
106
108
  },
107
- e
109
+ t
108
110
  ))
109
111
  ]
110
112
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/shell/SectionNavigation/index.tsx"],"sourcesContent":["import { motion, useReducedMotion } from 'motion/react'\nimport { type RefObject, useCallback, useEffect, useRef, useState } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport { Link, useLocation } from 'react-router'\nimport { STOA_NS } from '../../i18n/namespace'\n\nexport type NavigationSection = { id: string; label: string }\n\nconst showBackgroundOffset = 125\nconst hideBackgroundOffset = 75\n\nfunction getScrollContainer(content: HTMLElement | null) {\n\tlet parent = content?.parentElement\n\twhile (parent) {\n\t\tif (/(auto|scroll)/.test(getComputedStyle(parent).overflowY)) return parent\n\t\tparent = parent.parentElement\n\t}\n\treturn null\n}\n\nexport interface SectionNavigationProps {\n\tsections: readonly NavigationSection[]\n\tlabel?: string\n\tscrollContainerRef: RefObject<HTMLDivElement | null>\n}\n\nexport function SectionNavigation({\n\tscrollContainerRef,\n\tsections,\n\tlabel,\n}: SectionNavigationProps) {\n\tconst [showBackground, setShowBackground] = useState(false)\n\tconst reducedMotion = useReducedMotion() ?? false\n\tconst { t } = useTranslation(STOA_NS)\n\tconst { hash } = useLocation()\n\tconst navigationRef = useRef<HTMLElement>(null)\n\tconst [activeSection, setActiveSection] = useState<string>(\n\t\tsections[0]?.id ?? '',\n\t)\n\n\tconst scrollToSection = useCallback(\n\t\t(id: string) => {\n\t\t\tconst container = getScrollContainer(scrollContainerRef.current)\n\t\t\tconst navigation = navigationRef.current\n\t\t\tconst section = document.getElementById(id)\n\n\t\t\tif (!container || !navigation || !section) return\n\n\t\t\tconst top =\n\t\t\t\tcontainer.scrollTop +\n\t\t\t\tsection.getBoundingClientRect().top -\n\t\t\t\tcontainer.getBoundingClientRect().top -\n\t\t\t\tnavigation.offsetHeight -\n\t\t\t\t16\n\t\t\tcontainer.scrollTo({ top: Math.max(0, top) })\n\t\t\tsection.focus({ preventScroll: true })\n\t\t},\n\t\t[scrollContainerRef],\n\t)\n\n\tuseEffect(() => {\n\t\tconst container = getScrollContainer(scrollContainerRef.current)\n\t\tconst navigation = navigationRef.current\n\n\t\tif (!container || !navigation) return\n\n\t\tconst targets = sections.map(({ id }) => document.getElementById(id))\n\t\tlet animationFrame: number | undefined\n\n\t\tfunction updateActiveSection() {\n\t\t\tanimationFrame = undefined\n\n\t\t\tif (!container || !navigation) return\n\n\t\t\tsetShowBackground((visible) =>\n\t\t\t\tvisible\n\t\t\t\t\t? container.scrollTop > hideBackgroundOffset\n\t\t\t\t\t: container.scrollTop >= showBackgroundOffset,\n\t\t\t)\n\n\t\t\tlet active: string = sections[0]?.id ?? ''\n\t\t\tlet largestVisibleHeight = 0\n\t\t\tconst viewport = container.getBoundingClientRect()\n\t\t\tconst visibleTop = Math.max(\n\t\t\t\tviewport.top,\n\t\t\t\tnavigation.getBoundingClientRect().bottom,\n\t\t\t)\n\t\t\tconst visibleBottom = Math.min(viewport.bottom, window.innerHeight)\n\n\t\t\tfor (const section of targets) {\n\t\t\t\tif (!section) continue\n\t\t\t\tconst bounds = section.getBoundingClientRect()\n\t\t\t\tconst visibleHeight = Math.max(\n\t\t\t\t\t0,\n\t\t\t\t\tMath.min(bounds.bottom, visibleBottom) -\n\t\t\t\t\t\tMath.max(bounds.top, visibleTop),\n\t\t\t\t)\n\t\t\t\tif (visibleHeight > largestVisibleHeight) {\n\t\t\t\t\tlargestVisibleHeight = visibleHeight\n\t\t\t\t\tactive = section.id\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\tcontainer.scrollHeight > container.clientHeight &&\n\t\t\t\tcontainer.scrollHeight - container.clientHeight - container.scrollTop <=\n\t\t\t\t\t2\n\t\t\t) {\n\t\t\t\tactive = sections[sections.length - 1]?.id ?? ''\n\t\t\t}\n\t\t\tsetActiveSection(active)\n\t\t}\n\n\t\tfunction scheduleUpdate() {\n\t\t\tif (animationFrame === undefined)\n\t\t\t\tanimationFrame = requestAnimationFrame(updateActiveSection)\n\t\t}\n\n\t\t// Capture scrolls from the page and its ancestors, including native WebView scrolling.\n\t\tdocument.addEventListener('scroll', scheduleUpdate, {\n\t\t\tcapture: true,\n\t\t\tpassive: true,\n\t\t})\n\n\t\twindow.addEventListener('resize', scheduleUpdate)\n\t\tconst observer = new ResizeObserver(scheduleUpdate)\n\t\tobserver.observe(container)\n\t\tobserver.observe(navigation)\n\t\tfor (const target of targets) if (target) observer.observe(target)\n\t\tupdateActiveSection()\n\n\t\treturn () => {\n\t\t\tdocument.removeEventListener('scroll', scheduleUpdate, true)\n\t\t\twindow.removeEventListener('resize', scheduleUpdate)\n\t\t\tif (animationFrame !== undefined) cancelAnimationFrame(animationFrame)\n\t\t\tobserver.disconnect()\n\t\t}\n\t}, [scrollContainerRef, sections])\n\n\tuseEffect(() => {\n\t\tconst id = hash.slice(1)\n\t\tif (sections.some((section) => section.id === id)) scrollToSection(id)\n\t}, [hash, scrollToSection, sections])\n\n\tif (sections.length === 0) return null\n\n\treturn (\n\t\t<nav\n\t\t\tref={navigationRef}\n\t\t\taria-label={label ?? t('app.navigation')}\n\t\t\tclassName='sticky top-1 z-20 isolate m-1 mt-4 flex flex-wrap gap-1 rounded-xl p-2'\n\t\t>\n\t\t\t<motion.div\n\t\t\t\taria-hidden='true'\n\t\t\t\tclassName='pointer-events-none absolute inset-0 -z-10 rounded-xl bg-background/25 shadow-sm backdrop-blur-xs'\n\t\t\t\tinitial={false}\n\t\t\t\tanimate={{ opacity: showBackground ? 1 : 0 }}\n\t\t\t\ttransition={{ duration: reducedMotion ? 0 : 0.2, ease: 'easeOut' }}\n\t\t\t/>\n\t\t\t{sections.map(({ id, label }) => (\n\t\t\t\t<Link\n\t\t\t\t\tkey={id}\n\t\t\t\t\tto={`#${id}`}\n\t\t\t\t\treplace\n\t\t\t\t\taria-current={activeSection === id ? 'location' : undefined}\n\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\tif (hash === `#${id}`) scrollToSection(id)\n\t\t\t\t\t}}\n\t\t\t\t\tclassName={`\n\t\t\t\t\t\trounded-full px-3 py-2\n\t\t\t\t\t\ttext-sm font-medium transition-colors\n\t\t\t\t\t\toutline-none focus-visible:ring-2 focus-visible:ring-ring\n\t\t\t\t\t\t${\n\t\t\t\t\t\t\tactiveSection === id\n\t\t\t\t\t\t\t\t? 'bg-(--section-active) text-foreground'\n\t\t\t\t\t\t\t\t: 'text-muted-foreground hover:bg-muted hover:text-foreground'\n\t\t\t\t\t\t}\n\t\t\t\t\t`}\n\t\t\t\t>\n\t\t\t\t\t{label}\n\t\t\t\t</Link>\n\t\t\t))}\n\t\t</nav>\n\t)\n}\n"],"names":["showBackgroundOffset","hideBackgroundOffset","getScrollContainer","content","parent","SectionNavigation","scrollContainerRef","sections","label","showBackground","setShowBackground","useState","reducedMotion","useReducedMotion","t","useTranslation","STOA_NS","hash","useLocation","navigationRef","useRef","activeSection","setActiveSection","scrollToSection","useCallback","id","container","navigation","section","top","useEffect","targets","animationFrame","updateActiveSection","visible","active","largestVisibleHeight","viewport","visibleTop","visibleBottom","bounds","visibleHeight","scheduleUpdate","observer","target","jsxs","jsx","motion","Link"],"mappings":";;;;;;AAQA,MAAMA,IAAuB,KACvBC,IAAuB;AAE7B,SAASC,EAAmBC,GAA6B;AACxD,MAA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GJ;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/shell/SectionNavigation/index.tsx"],"sourcesContent":["import { motion, useReducedMotion } from 'motion/react'\nimport { type RefObject, useCallback, useEffect, useRef, useState } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport { Link, useLocation } from 'react-router'\nimport { STOA_NS } from '../../i18n/namespace'\n\nexport type NavigationSection = { id: string; label: string }\n\nconst showBackgroundOffset = 125\nconst hideBackgroundOffset = 75\n\nfunction getScrollContainer(content: HTMLElement | null) {\n\tlet parent = content?.parentElement\n\twhile (parent) {\n\t\tif (/(auto|scroll)/.test(getComputedStyle(parent).overflowY)) return parent\n\t\tparent = parent.parentElement\n\t}\n\treturn null\n}\n\nexport interface SectionNavigationProps {\n\tsections: readonly NavigationSection[]\n\tlabel?: string\n\tscrollContainerRef: RefObject<HTMLDivElement | null>\n}\n\nexport function SectionNavigation({\n\tscrollContainerRef,\n\tsections,\n\tlabel,\n}: SectionNavigationProps) {\n\tconst [showBackground, setShowBackground] = useState(false)\n\tconst reducedMotion = useReducedMotion() ?? false\n\tconst { t } = useTranslation(STOA_NS)\n\tconst { hash } = useLocation()\n\tconst navigationRef = useRef<HTMLElement>(null)\n\tconst [activeSection, setActiveSection] = useState<string>(\n\t\tsections[0]?.id ?? '',\n\t)\n\n\tconst scrollToSection = useCallback(\n\t\t(id: string) => {\n\t\t\tconst container = getScrollContainer(scrollContainerRef.current)\n\t\t\tconst navigation = navigationRef.current\n\t\t\tconst section = document.getElementById(id)\n\n\t\t\tif (!container || !navigation || !section) return\n\n\t\t\tconst top =\n\t\t\t\tcontainer.scrollTop +\n\t\t\t\tsection.getBoundingClientRect().top -\n\t\t\t\tcontainer.getBoundingClientRect().top -\n\t\t\t\tnavigation.offsetHeight -\n\t\t\t\t16\n\t\t\tcontainer.scrollTo({ top: Math.max(0, top) })\n\t\t\tsection.focus({ preventScroll: true })\n\t\t},\n\t\t[scrollContainerRef],\n\t)\n\n\tuseEffect(() => {\n\t\tconst container = getScrollContainer(scrollContainerRef.current)\n\t\tconst navigation = navigationRef.current\n\n\t\tif (!container || !navigation) return\n\n\t\tconst targets = sections.map(({ id }) => document.getElementById(id))\n\t\tlet animationFrame: number | undefined\n\n\t\tfunction updateActiveSection() {\n\t\t\tanimationFrame = undefined\n\n\t\t\tif (!container || !navigation) return\n\n\t\t\tsetShowBackground((visible) =>\n\t\t\t\tvisible\n\t\t\t\t\t? container.scrollTop > hideBackgroundOffset\n\t\t\t\t\t: container.scrollTop >= showBackgroundOffset,\n\t\t\t)\n\n\t\t\tlet active: string = sections[0]?.id ?? ''\n\t\t\tlet largestVisibleHeight = 0\n\t\t\tconst viewport = container.getBoundingClientRect()\n\t\t\tconst visibleTop = Math.max(\n\t\t\t\tviewport.top,\n\t\t\t\tnavigation.getBoundingClientRect().bottom,\n\t\t\t)\n\t\t\tconst visibleBottom = Math.min(viewport.bottom, window.innerHeight)\n\n\t\t\tfor (const section of targets) {\n\t\t\t\tif (!section) continue\n\t\t\t\tconst bounds = section.getBoundingClientRect()\n\t\t\t\tconst visibleHeight = Math.max(\n\t\t\t\t\t0,\n\t\t\t\t\tMath.min(bounds.bottom, visibleBottom) -\n\t\t\t\t\t\tMath.max(bounds.top, visibleTop),\n\t\t\t\t)\n\t\t\t\tif (visibleHeight > largestVisibleHeight) {\n\t\t\t\t\tlargestVisibleHeight = visibleHeight\n\t\t\t\t\tactive = section.id\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\tcontainer.scrollHeight > container.clientHeight &&\n\t\t\t\tcontainer.scrollHeight - container.clientHeight - container.scrollTop <=\n\t\t\t\t\t2\n\t\t\t) {\n\t\t\t\tactive = sections[sections.length - 1]?.id ?? ''\n\t\t\t}\n\t\t\tsetActiveSection(active)\n\t\t}\n\n\t\tfunction scheduleUpdate() {\n\t\t\tif (animationFrame === undefined)\n\t\t\t\tanimationFrame = requestAnimationFrame(updateActiveSection)\n\t\t}\n\n\t\t// Capture scrolls from the page and its ancestors, including native WebView scrolling.\n\t\tdocument.addEventListener('scroll', scheduleUpdate, {\n\t\t\tcapture: true,\n\t\t\tpassive: true,\n\t\t})\n\n\t\twindow.addEventListener('resize', scheduleUpdate)\n\t\tconst observer = new ResizeObserver(scheduleUpdate)\n\t\tobserver.observe(container)\n\t\tobserver.observe(navigation)\n\t\tfor (const target of targets) if (target) observer.observe(target)\n\t\tupdateActiveSection()\n\n\t\treturn () => {\n\t\t\tdocument.removeEventListener('scroll', scheduleUpdate, true)\n\t\t\twindow.removeEventListener('resize', scheduleUpdate)\n\t\t\tif (animationFrame !== undefined) cancelAnimationFrame(animationFrame)\n\t\t\tobserver.disconnect()\n\t\t}\n\t}, [scrollContainerRef, sections])\n\n\tuseEffect(() => {\n\t\tconst id = hash.slice(1)\n\t\tif (sections.some((section) => section.id === id)) scrollToSection(id)\n\t}, [hash, scrollToSection, sections])\n\n\tif (sections.length === 0) return null\n\n\treturn (\n\t\t<nav\n\t\t\tref={navigationRef}\n\t\t\tdata-slot='section-navigation'\n\t\t\taria-label={label ?? t('app.navigation')}\n\t\t\tclassName='sticky top-1 z-20 isolate m-1 mt-4 flex flex-wrap gap-1 rounded-xl p-2'\n\t\t>\n\t\t\t<motion.div\n\t\t\t\taria-hidden='true'\n\t\t\t\tclassName='pointer-events-none absolute inset-0 -z-10 rounded-xl bg-background/25 shadow-sm backdrop-blur-xs'\n\t\t\t\tinitial={false}\n\t\t\t\tanimate={{ opacity: showBackground ? 1 : 0 }}\n\t\t\t\ttransition={{ duration: reducedMotion ? 0 : 0.2, ease: 'easeOut' }}\n\t\t\t/>\n\t\t\t{sections.map(({ id, label }) => (\n\t\t\t\t<Link\n\t\t\t\t\tkey={id}\n\t\t\t\t\tto={`#${id}`}\n\t\t\t\t\treplace\n\t\t\t\t\tdata-slot='section-navigation-link'\n\t\t\t\t\taria-current={activeSection === id ? 'location' : undefined}\n\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\tif (hash === `#${id}`) scrollToSection(id)\n\t\t\t\t\t}}\n\t\t\t\t\tclassName={`\n\t\t\t\t\t\trounded-full px-3 py-2\n\t\t\t\t\t\ttext-sm font-medium transition-colors\n\t\t\t\t\t\toutline-none focus-visible:ring-2 focus-visible:ring-ring\n\t\t\t\t\t\t${\n\t\t\t\t\t\t\tactiveSection === id\n\t\t\t\t\t\t\t\t? 'bg-(--section-active) text-foreground'\n\t\t\t\t\t\t\t\t: 'text-muted-foreground hover:bg-muted hover:text-foreground'\n\t\t\t\t\t\t}\n\t\t\t\t\t`}\n\t\t\t\t>\n\t\t\t\t\t{label}\n\t\t\t\t</Link>\n\t\t\t))}\n\t\t</nav>\n\t)\n}\n"],"names":["showBackgroundOffset","hideBackgroundOffset","getScrollContainer","content","parent","SectionNavigation","scrollContainerRef","sections","label","showBackground","setShowBackground","useState","reducedMotion","useReducedMotion","t","useTranslation","STOA_NS","hash","useLocation","navigationRef","useRef","activeSection","setActiveSection","scrollToSection","useCallback","id","container","navigation","section","top","useEffect","targets","animationFrame","updateActiveSection","visible","active","largestVisibleHeight","viewport","visibleTop","visibleBottom","bounds","visibleHeight","scheduleUpdate","observer","target","jsxs","jsx","motion","Link"],"mappings":";;;;;;AAQA,MAAMA,IAAuB,KACvBC,IAAuB;AAE7B,SAASC,EAAmBC,GAA6B;AACxD,MAAIC,IAASD,GAAS;AACtB,SAAOC,KAAQ;AACd,QAAI,gBAAgB,KAAK,iBAAiBA,CAAM,EAAE,SAAS,EAAG,QAAOA;AACrE,IAAAA,IAASA,EAAO;AAAA,EACjB;AACA,SAAO;AACR;AAQO,SAASC,EAAkB;AAAA,EACjC,oBAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC;AACD,GAA2B;AAC1B,QAAM,CAACC,GAAgBC,CAAiB,IAAIC,EAAS,EAAK,GACpDC,IAAgBC,OAAsB,IACtC,EAAE,GAAAC,EAAA,IAAMC,EAAeC,CAAO,GAC9B,EAAE,MAAAC,EAAA,IAASC,EAAA,GACXC,IAAgBC,EAAoB,IAAI,GACxC,C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,MACA,KAAK1B;AAAA,MACL,aAAU;AAAA,MACV,cAAYX,KAASM,EAAE,gBAAgB;AAAA,MACvC,WAAU;AAAA,MAEV,UAAA;AAAA,QAAA,gBAAAgC;AAAA,UAACC,EAAO;AAAA,UAAP;AAAA,YACA,eAAY;AAAA,YACZ,WAAU;AAAA,YACV,SAAS;AAAA,YACT,SAAS,EAAE,SAAStC,IAAiB,IAAI,EAAA;AAAA,YACzC,YAAY,EAAE,UAAUG,IAAgB,IAAI,KAAK,MAAM,UAAA;AAAA,UAAU;AAAA,QAAA;AAAA,QAEjEL,EAAS,IAAI,CAAC,EAAE,IAAAkB,GAAI,OAAAjB,QACpB,gBAAAsC;AAAA,UAACE;AAAA,UAAA;AAAA,YAEA,IAAI,IAAIvB,CAAE;AAAA,YACV,SAAO;AAAA,YACP,aAAU;AAAA,YACV,gBAAcJ,MAAkBI,IAAK,aAAa;AAAA,YAClD,SAAS,MAAM;AACd,cAAIR,MAAS,IAAIQ,CAAE,QAAoBA,CAAE;AAAA,YAC1C;AAAA,YACA,WAAW;AAAA;AAAA;AAAA;AAAA,QAKTJ,MAAkBI,IACf,0CACA,4DACJ;AAAA;AAAA,YAGA,UAAAjB;AAAAA,UAAA;AAAA,UAnBIiB;AAAA,QAAA,CAqBN;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGJ;"}
@@ -0,0 +1,88 @@
1
+ import { jsx as i, jsxs as z } from "react/jsx-runtime";
2
+ import { useReducedMotion as B, motion as h } from "motion/react";
3
+ import { useState as o, useEffect as c } from "react";
4
+ import { useTranslation as C } from "react-i18next";
5
+ import { STOA_NS as E } from "../../i18n/namespace.js";
6
+ import { cn as M } from "../../utils/cn.js";
7
+ import { BrandLines as O } from "../BrandLines/index.js";
8
+ function J({
9
+ ready: x,
10
+ phase: l,
11
+ onComplete: S,
12
+ name: N,
13
+ logo: s,
14
+ settingsPaths: r = [],
15
+ settingsInterval: d = 150,
16
+ finalMessageDelay: m = 0,
17
+ messages: v,
18
+ className: y
19
+ }) {
20
+ const { t: T } = C(E), e = B() ?? !1, [j, A] = o(!1), [u, p] = o(!1), [I, F] = o(!1), [f, k] = o(0), a = l === "license", n = a ? "license" : u ? l : "settings", w = x && (e || j && u && I);
21
+ c(() => {
22
+ const t = window.setTimeout(
23
+ () => A(!0),
24
+ e ? 0 : 2e3
25
+ );
26
+ return () => window.clearTimeout(t);
27
+ }, [e]), c(() => {
28
+ if (a) return;
29
+ if (e || r.length === 0) {
30
+ p(!0);
31
+ return;
32
+ }
33
+ let t = 0;
34
+ const g = window.setInterval(() => {
35
+ t += 1, t < r.length ? k(t) : (p(!0), window.clearInterval(g));
36
+ }, d);
37
+ return () => window.clearInterval(g);
38
+ }, [a, e, r.length, d]), c(() => {
39
+ if (n !== "app") return;
40
+ const t = window.setTimeout(
41
+ () => F(!0),
42
+ e ? 0 : m
43
+ );
44
+ return () => window.clearTimeout(t);
45
+ }, [n, e, m]);
46
+ const L = v?.[n] ?? T(
47
+ n === "license" ? "licensing.gate.loading" : n === "settings" ? "app.loadingSettings" : "app.loadingApp"
48
+ );
49
+ return /* @__PURE__ */ i(
50
+ h.main,
51
+ {
52
+ role: "status",
53
+ "data-slot": "startup-animation",
54
+ className: M(
55
+ "app-shell relative flex h-screen items-center justify-center overflow-hidden p-6",
56
+ y
57
+ ),
58
+ initial: !1,
59
+ animate: { opacity: w ? 0 : 1 },
60
+ transition: { duration: e ? 0 : 0.18 },
61
+ onAnimationComplete: () => {
62
+ w && S();
63
+ },
64
+ children: /* @__PURE__ */ z("div", { className: "relative grid justify-items-center gap-5", children: [
65
+ typeof s == "string" ? /* @__PURE__ */ i(
66
+ h.img,
67
+ {
68
+ src: s,
69
+ alt: "",
70
+ "aria-hidden": "true",
71
+ className: "size-28 rounded-3xl",
72
+ initial: { opacity: e ? 1 : 0 },
73
+ animate: { opacity: 1 },
74
+ transition: { duration: e ? 0 : 0.5 }
75
+ }
76
+ ) : s,
77
+ /* @__PURE__ */ i("p", { className: "text-lg font-medium tracking-[0.18em]", children: N }),
78
+ /* @__PURE__ */ i(O, { loading: !e }),
79
+ /* @__PURE__ */ i("p", { className: "text-sm text-muted-foreground", children: L }),
80
+ /* @__PURE__ */ i("span", { "aria-hidden": "true", className: "h-5 text-xs text-muted-foreground", children: n === "settings" && !e && r[f] ? `/${r[f]}` : "" })
81
+ ] })
82
+ }
83
+ );
84
+ }
85
+ export {
86
+ J as StartupAnimation
87
+ };
88
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../src/shell/StartupAnimation/index.tsx"],"sourcesContent":["import { motion, useReducedMotion } from 'motion/react'\nimport { type ReactNode, useEffect, useState } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport { STOA_NS } from '../../i18n/namespace'\nimport { cn } from '../../utils/cn'\nimport { BrandLines } from '../BrandLines'\n\nexport type StartupPhase = 'license' | 'settings' | 'app'\n\nexport interface StartupAnimationProps {\n\tready: boolean\n\tphase: StartupPhase\n\tonComplete: () => void\n\t/** App name shown under the logo. */\n\tname: string\n\t/** Image URL or a custom (e.g. animated inline SVG) logo. */\n\tlogo?: string | ReactNode\n\t/**\n\t * Already translated setting names that flicker by while settings load,\n\t * e.g. `['Sprache', 'Darstellung']` or deeper paths like `'Einstellungen/E-Mail/Server'`.\n\t */\n\tsettingsPaths?: readonly string[]\n\t/** Milliseconds per setting name. */\n\tsettingsInterval?: number\n\t/** Keeps the final message visible a moment before the overlay fades. */\n\tfinalMessageDelay?: number\n\t/** Per-phase status text; defaults come from the kit locales. */\n\tmessages?: Partial<Record<StartupPhase, string>>\n\tclassName?: string\n}\n\n/** Startup overlay: logo, app name, brand lines and the current loading step. */\nexport function StartupAnimation({\n\tready,\n\tphase,\n\tonComplete,\n\tname,\n\tlogo,\n\tsettingsPaths = [],\n\tsettingsInterval = 150,\n\tfinalMessageDelay = 0,\n\tmessages,\n\tclassName,\n}: StartupAnimationProps) {\n\tconst { t } = useTranslation(STOA_NS)\n\tconst reducedMotion = useReducedMotion() ?? false\n\tconst [introFinished, setIntroFinished] = useState(false)\n\tconst [settingsShown, setSettingsShown] = useState(false)\n\tconst [finalShown, setFinalShown] = useState(false)\n\tconst [index, setIndex] = useState(0)\n\tconst checkingLicense = phase === 'license'\n\tconst display: StartupPhase = checkingLicense\n\t\t? 'license'\n\t\t: settingsShown\n\t\t\t? phase\n\t\t\t: 'settings'\n\tconst exiting =\n\t\tready && (reducedMotion || (introFinished && settingsShown && finalShown))\n\n\tuseEffect(() => {\n\t\tconst timer = window.setTimeout(\n\t\t\t() => setIntroFinished(true),\n\t\t\treducedMotion ? 0 : 2000,\n\t\t)\n\t\treturn () => window.clearTimeout(timer)\n\t}, [reducedMotion])\n\n\tuseEffect(() => {\n\t\tif (checkingLicense) return\n\t\tif (reducedMotion || settingsPaths.length === 0) {\n\t\t\tsetSettingsShown(true)\n\t\t\treturn\n\t\t}\n\t\tlet current = 0\n\t\tconst timer = window.setInterval(() => {\n\t\t\tcurrent += 1\n\t\t\tif (current < settingsPaths.length) setIndex(current)\n\t\t\telse {\n\t\t\t\tsetSettingsShown(true)\n\t\t\t\twindow.clearInterval(timer)\n\t\t\t}\n\t\t}, settingsInterval)\n\t\treturn () => window.clearInterval(timer)\n\t}, [checkingLicense, reducedMotion, settingsPaths.length, settingsInterval])\n\n\tuseEffect(() => {\n\t\tif (display !== 'app') return\n\t\tconst timer = window.setTimeout(\n\t\t\t() => setFinalShown(true),\n\t\t\treducedMotion ? 0 : finalMessageDelay,\n\t\t)\n\t\treturn () => window.clearTimeout(timer)\n\t}, [display, reducedMotion, finalMessageDelay])\n\n\tconst text =\n\t\tmessages?.[display] ??\n\t\tt(\n\t\t\tdisplay === 'license'\n\t\t\t\t? 'licensing.gate.loading'\n\t\t\t\t: display === 'settings'\n\t\t\t\t\t? 'app.loadingSettings'\n\t\t\t\t\t: 'app.loadingApp',\n\t\t)\n\n\treturn (\n\t\t<motion.main\n\t\t\trole='status'\n\t\t\tdata-slot='startup-animation'\n\t\t\tclassName={cn(\n\t\t\t\t'app-shell relative flex h-screen items-center justify-center overflow-hidden p-6',\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\tinitial={false}\n\t\t\tanimate={{ opacity: exiting ? 0 : 1 }}\n\t\t\ttransition={{ duration: reducedMotion ? 0 : 0.18 }}\n\t\t\tonAnimationComplete={() => {\n\t\t\t\tif (exiting) onComplete()\n\t\t\t}}\n\t\t>\n\t\t\t<div className='relative grid justify-items-center gap-5'>\n\t\t\t\t{typeof logo === 'string' ? (\n\t\t\t\t\t<motion.img\n\t\t\t\t\t\tsrc={logo}\n\t\t\t\t\t\talt=''\n\t\t\t\t\t\taria-hidden='true'\n\t\t\t\t\t\tclassName='size-28 rounded-3xl'\n\t\t\t\t\t\tinitial={{ opacity: reducedMotion ? 1 : 0 }}\n\t\t\t\t\t\tanimate={{ opacity: 1 }}\n\t\t\t\t\t\ttransition={{ duration: reducedMotion ? 0 : 0.5 }}\n\t\t\t\t\t/>\n\t\t\t\t) : (\n\t\t\t\t\tlogo\n\t\t\t\t)}\n\t\t\t\t<p className='text-lg font-medium tracking-[0.18em]'>{name}</p>\n\t\t\t\t<BrandLines loading={!reducedMotion} />\n\t\t\t\t<p className='text-sm text-muted-foreground'>{text}</p>\n\t\t\t\t<span aria-hidden='true' className='h-5 text-xs text-muted-foreground'>\n\t\t\t\t\t{display === 'settings' && !reducedMotion && settingsPaths[index]\n\t\t\t\t\t\t? `/${settingsPaths[index]}`\n\t\t\t\t\t\t: ''}\n\t\t\t\t</span>\n\t\t\t</div>\n\t\t</motion.main>\n\t)\n}\n"],"names":["StartupAnimation","ready","phase","onComplete","name","logo","settingsPaths","settingsInterval","finalMessageDelay","messages","className","t","useTranslation","STOA_NS","reducedMotion","useReducedMotion","introFinished","setIntroFinished","useState","settingsShown","setSettingsShown","finalShown","setFinalShown","index","setIndex","checkingLicense","display","exiting","useEffect","timer","current","text","jsx","motion","cn","jsxs","BrandLines"],"mappings":";;;;;;;AAgCO,SAASA,EA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ClD,QAAA,EAAK,eAAY,QAAO,WAAU,qCACjC,gBAAY,cAAc,CAACjB,KAAiBR,EAAciB,CAAK,IAC7D,IAAIjB,EAAciB,CAAK,CAAC,KACxB,GAAA,CACJ;AAAA,MAAA,EAAA,CACD;AAAA,IAAA;AAAA,EAAA;AAGH;"}
@@ -0,0 +1,37 @@
1
+ import { jsxs as m, jsx as a } from "react/jsx-runtime";
2
+ import { useState as e, useCallback as c, useContext as h, createContext as x } from "react";
3
+ import { StartupAnimation as S } from "../StartupAnimation/index.js";
4
+ const u = x(null);
5
+ function P({ children: t, animation: l }) {
6
+ const [f, s] = e("license"), [d, n] = e(!1), [r, i] = e(!1), o = c(() => i(!0), []), p = c(() => {
7
+ s("settings"), n(!1), i(!1);
8
+ }, []);
9
+ return /* @__PURE__ */ m(
10
+ u.Provider,
11
+ {
12
+ value: { finished: r, setPhase: s, setReady: n, finish: o, beginDataLoading: p },
13
+ children: [
14
+ t,
15
+ !r && /* @__PURE__ */ a("div", { className: "fixed inset-0 z-100", children: /* @__PURE__ */ a(
16
+ S,
17
+ {
18
+ ...l,
19
+ ready: d,
20
+ phase: f,
21
+ onComplete: o
22
+ }
23
+ ) })
24
+ ]
25
+ }
26
+ );
27
+ }
28
+ function b() {
29
+ const t = h(u);
30
+ if (!t) throw new Error("StartupProvider is missing");
31
+ return t;
32
+ }
33
+ export {
34
+ P as StartupProvider,
35
+ b as useStartup
36
+ };
37
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../src/shell/StartupProvider/index.tsx"],"sourcesContent":["import {\n\tcreateContext,\n\ttype Dispatch,\n\ttype ReactNode,\n\ttype SetStateAction,\n\tuseCallback,\n\tuseContext,\n\tuseState,\n} from 'react'\nimport {\n\tStartupAnimation,\n\ttype StartupAnimationProps,\n\ttype StartupPhase,\n} from '../StartupAnimation'\n\ntype StartupContextValue = {\n\tfinished: boolean\n\tsetPhase: Dispatch<SetStateAction<StartupPhase>>\n\tsetReady: Dispatch<SetStateAction<boolean>>\n\tfinish: () => void\n\tbeginDataLoading: () => void\n}\n\nconst StartupContext = createContext<StartupContextValue | null>(null)\n\nexport interface StartupProviderProps {\n\tchildren: ReactNode\n\t/** Everything the overlay shows: name, logo, setting names, messages. */\n\tanimation: Omit<StartupAnimationProps, 'ready' | 'phase' | 'onComplete'>\n}\n\n/**\n * Shows the startup overlay above the app until `finish()` is called or the\n * data reports ready. Phases: license → settings → app.\n */\nexport function StartupProvider({ children, animation }: StartupProviderProps) {\n\tconst [phase, setPhase] = useState<StartupPhase>('license')\n\tconst [ready, setReady] = useState(false)\n\tconst [finished, setFinished] = useState(false)\n\tconst finish = useCallback(() => setFinished(true), [])\n\tconst beginDataLoading = useCallback(() => {\n\t\tsetPhase('settings')\n\t\tsetReady(false)\n\t\tsetFinished(false)\n\t}, [])\n\n\treturn (\n\t\t<StartupContext.Provider\n\t\t\tvalue={{ finished, setPhase, setReady, finish, beginDataLoading }}\n\t\t>\n\t\t\t{children}\n\t\t\t{!finished && (\n\t\t\t\t<div className='fixed inset-0 z-100'>\n\t\t\t\t\t<StartupAnimation\n\t\t\t\t\t\t{...animation}\n\t\t\t\t\t\tready={ready}\n\t\t\t\t\t\tphase={phase}\n\t\t\t\t\t\tonComplete={finish}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</StartupContext.Provider>\n\t)\n}\n\nexport function useStartup() {\n\tconst context = useContext(StartupContext)\n\tif (!context) throw new Error('StartupProvider is missing')\n\treturn context\n}\n"],"names":["StartupContext","createContext","StartupProvider","children","animation","phase","setPhase","useState","ready","setReady","finished","setFinished","finish","useCallback","beginDataLoading","jsxs","jsx","StartupAnimation","useStartup","context","useContext"],"mappings":";;;AAuBA,MAAMA,IAAiBC,EAA0C,IAAI;AAY9D,SAASC,EAAgB,EAAE,UAAAC,GAAU,WAAAC,KAAmC;AAC9E,QAAM,CAACC,GAAOC,CAAQ,IAAIC,EAAuB,SAAS,GACpD,CAACC,GAAOC,CAAQ,IAAIF,EAAS,EAAK,GAClC,CAACG,GAAUC,CAAW,IAAIJ,EAAS,EAAK,GACxCK,IAASC,EAAY,MAAMF,EAAY,EAAI,GAAG,CAAA,CAAE,GAChDG,IAAmBD,EAAY,MAAM;AAC1C,IAAAP,EAAS,UAAU,GACnBG,EAAS,EAAK,GACdE,EAAY,EAAK;AAAA,EAClB,GAAG,CAAA,CAAE;AAEL,SACC,gBAAAI;AAAA,IAACf,EAAe;AAAA,IAAf;AAAA,MACA,OAAO,EAAE,UAAAU,GAAU,UAAAJ,GAAU,UAAAG,GAAU,QAAAG,GAAQ,kBAAAE,EAAA;AAAA,MAE9C,UAAA;AAAA,QAAAX;AAAA,QACA,CAACO,KACD,gBAAAM,EAAC,OAAA,EAAI,WAAU,uBACd,UAAA,gBAAAA;AAAA,UAACC;AAAA,UAAA;AAAA,YACC,GAAGb;AAAA,YACJ,OAAAI;AAAA,YACA,OAAAH;AAAA,YACA,YAAYO;AAAA,UAAA;AAAA,QAAA,EACb,CACD;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAIJ;AAEO,SAASM,IAAa;AAC5B,QAAMC,IAAUC,EAAWpB,CAAc;AACzC,MAAI,CAACmB,EAAS,OAAM,IAAI,MAAM,4BAA4B;AAC1D,SAAOA;AACR;"}
@@ -0,0 +1,93 @@
1
+ import { jsxs as g, jsx as s } from "react/jsx-runtime";
2
+ import { X as y } from "lucide-react";
3
+ import { useId as w, useState as k } from "react";
4
+ import { useTranslation as L } from "react-i18next";
5
+ import { STOA_NS as N } from "../../i18n/namespace.js";
6
+ import { cn as T } from "../../utils/cn.js";
7
+ function S(c) {
8
+ const t = /* @__PURE__ */ new Set(), n = [];
9
+ for (const p of c) {
10
+ const o = p.trim().replace(/\s+/g, " "), a = o.toLocaleLowerCase();
11
+ !o || t.has(a) || (t.add(a), n.push(o));
12
+ }
13
+ return n;
14
+ }
15
+ function E({
16
+ id: c,
17
+ value: t,
18
+ onChange: n,
19
+ suggestions: p = [],
20
+ disabled: o,
21
+ placeholder: a,
22
+ prefix: h = "#",
23
+ className: x
24
+ }) {
25
+ const { t: f } = L(N), u = w(), [r, m] = k(""), d = (e) => {
26
+ const i = S([...t, ...e.split(",")]);
27
+ i.length !== t.length && n(i), m("");
28
+ };
29
+ function b(e) {
30
+ e.key === "Enter" && e.preventDefault(), (e.key === "Enter" || e.key === "," || e.key === "Tab") && r.trim() ? (e.preventDefault(), d(r)) : e.key === "Backspace" && !r && t.length && n(t.slice(0, -1));
31
+ }
32
+ const l = p.filter(
33
+ (e) => !t.some(
34
+ (i) => i.toLocaleLowerCase() === e.toLocaleLowerCase()
35
+ )
36
+ );
37
+ return /* @__PURE__ */ g(
38
+ "div",
39
+ {
40
+ "data-slot": "tag-input",
41
+ className: T(
42
+ "flex min-h-12 flex-wrap items-center gap-1.5 rounded-lg border border-input bg-background/70 px-2 py-1.5 focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50 has-disabled:opacity-60",
43
+ x
44
+ ),
45
+ children: [
46
+ t.map((e) => /* @__PURE__ */ g(
47
+ "span",
48
+ {
49
+ "data-slot": "tag-input-tag",
50
+ className: "inline-flex items-center gap-1 rounded-full bg-(--accent-wash) py-0.5 pr-1 pl-2.5 text-xs font-medium",
51
+ children: [
52
+ h,
53
+ e,
54
+ !o && /* @__PURE__ */ s(
55
+ "button",
56
+ {
57
+ type: "button",
58
+ className: "grid size-4 place-items-center rounded-full text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/50",
59
+ "aria-label": f("tags.remove", { tag: e }),
60
+ onClick: () => n(t.filter((i) => i !== e)),
61
+ children: /* @__PURE__ */ s(y, { className: "size-3" })
62
+ }
63
+ )
64
+ ]
65
+ },
66
+ e
67
+ )),
68
+ /* @__PURE__ */ s(
69
+ "input",
70
+ {
71
+ id: c,
72
+ list: l.length ? u : void 0,
73
+ className: "min-w-32 flex-1 bg-transparent px-1 py-1 text-sm outline-none placeholder:text-muted-foreground",
74
+ placeholder: t.length ? "" : a ?? f("tags.placeholder"),
75
+ value: r,
76
+ disabled: o,
77
+ onChange: (e) => {
78
+ l.includes(e.target.value) ? d(e.target.value) : m(e.target.value);
79
+ },
80
+ onKeyDown: b,
81
+ onBlur: () => r.trim() && d(r)
82
+ }
83
+ ),
84
+ l.length > 0 && /* @__PURE__ */ s("datalist", { id: u, children: l.map((e) => /* @__PURE__ */ s("option", { value: e }, e)) })
85
+ ]
86
+ }
87
+ );
88
+ }
89
+ export {
90
+ E as TagInput,
91
+ S as normalizeTags
92
+ };
93
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../src/shell/TagInput/index.tsx"],"sourcesContent":["import { X } from 'lucide-react'\nimport { type KeyboardEvent, useId, useState } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport { STOA_NS } from '../../i18n/namespace'\nimport { cn } from '../../utils/cn'\n\nexport interface TagInputProps {\n\tid?: string\n\tvalue: string[]\n\tonChange: (tags: string[]) => void\n\t/** Existing tags offered as suggestions. */\n\tsuggestions?: string[]\n\tdisabled?: boolean\n\tplaceholder?: string\n\t/** Shown before each tag, e.g. `#`. */\n\tprefix?: string\n\tclassName?: string\n}\n\n/** Trims, collapses whitespace and drops empty or case-insensitive duplicates. */\nexport function normalizeTags(value: readonly string[]) {\n\tconst seen = new Set<string>()\n\tconst tags: string[] = []\n\tfor (const item of value) {\n\t\tconst tag = item.trim().replace(/\\s+/g, ' ')\n\t\tconst key = tag.toLocaleLowerCase()\n\t\tif (!tag || seen.has(key)) continue\n\t\tseen.add(key)\n\t\ttags.push(tag)\n\t}\n\treturn tags\n}\n\n/**\n * Free-form tag list: Enter, comma or Tab adds the typed tag, Backspace in the\n * empty field removes the last one; suggestions come from a datalist.\n */\nexport function TagInput({\n\tid,\n\tvalue,\n\tonChange,\n\tsuggestions = [],\n\tdisabled,\n\tplaceholder,\n\tprefix = '#',\n\tclassName,\n}: TagInputProps) {\n\tconst { t } = useTranslation(STOA_NS)\n\tconst listId = useId()\n\tconst [text, setText] = useState('')\n\tconst add = (raw: string) => {\n\t\tconst next = normalizeTags([...value, ...raw.split(',')])\n\t\tif (next.length !== value.length) onChange(next)\n\t\tsetText('')\n\t}\n\tfunction onKeyDown(event: KeyboardEvent<HTMLInputElement>) {\n\t\t// Enter never submits the surrounding form from here.\n\t\tif (event.key === 'Enter') event.preventDefault()\n\t\tif (\n\t\t\t(event.key === 'Enter' || event.key === ',' || event.key === 'Tab') &&\n\t\t\ttext.trim()\n\t\t) {\n\t\t\tevent.preventDefault()\n\t\t\tadd(text)\n\t\t} else if (event.key === 'Backspace' && !text && value.length) {\n\t\t\tonChange(value.slice(0, -1))\n\t\t}\n\t}\n\tconst offered = suggestions.filter(\n\t\t(tag) =>\n\t\t\t!value.some(\n\t\t\t\t(item) => item.toLocaleLowerCase() === tag.toLocaleLowerCase(),\n\t\t\t),\n\t)\n\treturn (\n\t\t<div\n\t\t\tdata-slot='tag-input'\n\t\t\tclassName={cn(\n\t\t\t\t'flex min-h-12 flex-wrap items-center gap-1.5 rounded-lg border border-input bg-background/70 px-2 py-1.5 focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50 has-disabled:opacity-60',\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t>\n\t\t\t{value.map((tag) => (\n\t\t\t\t<span\n\t\t\t\t\tkey={tag}\n\t\t\t\t\tdata-slot='tag-input-tag'\n\t\t\t\t\tclassName='inline-flex items-center gap-1 rounded-full bg-(--accent-wash) py-0.5 pr-1 pl-2.5 text-xs font-medium'\n\t\t\t\t>\n\t\t\t\t\t{prefix}\n\t\t\t\t\t{tag}\n\t\t\t\t\t{!disabled && (\n\t\t\t\t\t\t<button\n\t\t\t\t\t\t\ttype='button'\n\t\t\t\t\t\t\tclassName='grid size-4 place-items-center rounded-full text-muted-foreground outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/50'\n\t\t\t\t\t\t\taria-label={t('tags.remove', { tag })}\n\t\t\t\t\t\t\tonClick={() => onChange(value.filter((item) => item !== tag))}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<X className='size-3' />\n\t\t\t\t\t\t</button>\n\t\t\t\t\t)}\n\t\t\t\t</span>\n\t\t\t))}\n\t\t\t<input\n\t\t\t\tid={id}\n\t\t\t\tlist={offered.length ? listId : undefined}\n\t\t\t\tclassName='min-w-32 flex-1 bg-transparent px-1 py-1 text-sm outline-none placeholder:text-muted-foreground'\n\t\t\t\tplaceholder={value.length ? '' : (placeholder ?? t('tags.placeholder'))}\n\t\t\t\tvalue={text}\n\t\t\t\tdisabled={disabled}\n\t\t\t\tonChange={(e) => {\n\t\t\t\t\t// Picking a suggestion from the datalist adds it right away.\n\t\t\t\t\tif (offered.includes(e.target.value)) add(e.target.value)\n\t\t\t\t\telse setText(e.target.value)\n\t\t\t\t}}\n\t\t\t\tonKeyDown={onKeyDown}\n\t\t\t\tonBlur={() => text.trim() && add(text)}\n\t\t\t/>\n\t\t\t{offered.length > 0 && (\n\t\t\t\t<datalist id={listId}>\n\t\t\t\t\t{offered.map((tag) => (\n\t\t\t\t\t\t<option key={tag} value={tag} />\n\t\t\t\t\t))}\n\t\t\t\t</datalist>\n\t\t\t)}\n\t\t</div>\n\t)\n}\n"],"names":["normalizeTags","value","seen","tags","item","tag","key","TagInput","id","onChange","suggestions","disabled","placeholder","prefix","className","t","useTranslation","STOA_NS","listId","useId","text","setText","useState","add","raw","next","onKeyDown","event","offered","jsxs","cn","jsx","X"],"mappings":";;;;;;AAoBO,SAASA,EAAcC,GAA0B;AACvD,QAAMC,wBAAW,IAAA,GACXC,IAAiB,CAAA;AACvB,aAAWC,KAAQH,GAAO;AACzB,UAAMI,IAAMD,EAAK,KAAA,EAAO,QAAQ,QAAQ,GAAG,GACrCE,IAAMD,EAAI,kBAAA;AAChB,IAAI,CAACA,KAAOH,EAAK,IAAII,CAAG,MACxBJ,EAAK,IAAII,CAAG,GACZH,EAAK,KAAKE,CAAG;AAAA,EACd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cAAAhB;AAAA,cACAR;AAAA,cACA,CAACM,KACD,gBAAAoB;AAAA,gBAAC;AAAA,gBAAA;AAAA,kBACA,MAAK;AAAA,kBACL,WAAU;AAAA,kBACV,cAAYhB,EAAE,eAAe,EAAE,KAAAV,GAAK;AAAA,kBACpC,SAAS,MAAMI,EAASR,EAAM,OAAO,CAACG,MAASA,MAASC,CAAG,CAAC;AAAA,kBAE5D,UAAA,gBAAA0B,EAACC,GAAA,EAAE,WAAU,SAAA,CAAS;AAAA,gBAAA;AAAA,cAAA;AAAA,YACvB;AAAA,UAAA;AAAA,UAdI3B;AAAA,QAAA,CAiBN;AAAA,QACD,gBAAA0B;AAAA,UAAC;AAAA,UAAA;AAAA,YACA,IAAAvB;AAAA,YACA,MAAMoB,EAAQ,SAASV,IAAS;AAAA,YAChC,WAAU;AAAA,YACV,aAAajB,EAAM,SAAS,KAAMW,KAAeG,EAAE,kBAAkB;AAAA,YACrE,OAAOK;AAAA,YACP,UAAAT;AAAA,YACA,UAAU,CAAC,MAAM;AAEhB,cAAIiB,EAAQ,SAAS,EAAE,OAAO,KAAK,IAAGL,EAAI,EAAE,OAAO,KAAK,IACnDF,EAAQ,EAAE,OAAO,KAAK;AAAA,YAC5B;AAAA,YACA,WAAAK;AAAA,YACA,QAAQ,MAAMN,EAAK,KAAA,KAAUG,EAAIH,CAAI;AAAA,UAAA;AAAA,QAAA;AAAA,QAErCQ,EAAQ,SAAS,KACjB,gBAAAG,EAAC,YAAA,EAAS,IAAIb,GACZ,UAAAU,EAAQ,IAAI,CAACvB,MACb,gBAAA0B,EAAC,UAAA,EAAiB,OAAO1B,EAAA,GAAZA,CAAiB,CAC9B,EAAA,CACF;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAIJ;"}
@@ -0,0 +1,31 @@
1
+ import { jsx as d } from "react/jsx-runtime";
2
+ import { useState as f } from "react";
3
+ import { Input as s } from "../../ui/input/index.js";
4
+ function c(r, t, e) {
5
+ if (r)
6
+ return e ? "error" : t ? "warning" : "required";
7
+ }
8
+ function g({
9
+ problem: r,
10
+ submitted: t = !1,
11
+ onBlur: e,
12
+ ...o
13
+ }) {
14
+ const [i, a] = f(!1), n = c(r, i, t);
15
+ return /* @__PURE__ */ d(
16
+ s,
17
+ {
18
+ ...o,
19
+ "data-field-state": n,
20
+ "aria-invalid": n === "warning" || n === "error",
21
+ onBlur: (u) => {
22
+ a(!0), e?.(u);
23
+ }
24
+ }
25
+ );
26
+ }
27
+ export {
28
+ g as ValidatedInput,
29
+ c as fieldFeedback
30
+ };
31
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../src/shell/ValidatedInput/index.tsx"],"sourcesContent":["import { type ComponentProps, useState } from 'react'\nimport { Input } from '../../ui/input'\n\nexport type FieldFeedback = 'required' | 'warning' | 'error' | undefined\n\n/**\n * How loudly a field problem is shown: quietly before the first blur,\n * as a warning once touched, as an error after a submit attempt.\n */\nexport function fieldFeedback(\n\tproblem: boolean,\n\ttouched: boolean,\n\tsubmitted: boolean,\n): FieldFeedback {\n\tif (!problem) return undefined\n\treturn submitted ? 'error' : touched ? 'warning' : 'required'\n}\n\nexport type ValidatedInputProps = ComponentProps<typeof Input> & {\n\t/** The current value is invalid or missing. */\n\tproblem: boolean\n\t/** A submit was attempted; problems are shown as errors. */\n\tsubmitted?: boolean\n}\n\n/** Input that only flags a problem once the user has left the field. */\nexport function ValidatedInput({\n\tproblem,\n\tsubmitted = false,\n\tonBlur,\n\t...props\n}: ValidatedInputProps) {\n\tconst [touched, setTouched] = useState(false)\n\tconst state = fieldFeedback(problem, touched, submitted)\n\treturn (\n\t\t<Input\n\t\t\t{...props}\n\t\t\tdata-field-state={state}\n\t\t\taria-invalid={state === 'warning' || state === 'error'}\n\t\t\tonBlur={(event) => {\n\t\t\t\tsetTouched(true)\n\t\t\t\tonBlur?.(event)\n\t\t\t}}\n\t\t/>\n\t)\n}\n"],"names":["fieldFeedback","problem","touched","submitted","ValidatedInput","onBlur","props","setTouched","useState","state","jsx","Input","event"],"mappings":";;;AASO,SAASA,EACfC,GACAC,GACAC,GACgB;AAChB,MAAKF;AACL,WAAOE,IAAY,UAAUD,IAAU,YAAY;AACpD;AAUO,SAASE,EAAe;AAAA,EAC9B,SAAAH;AAAA,EACA,WAAAE,IAAY;AAAA,EACZ,QAAAE;AAAA,EACA,GAAGC;AACJ,GAAwB;AACvB,QAAM,CAACJ,GAASK,CAAU,IAAIC,EAAS,EAAK,GACtCC,IAAQT,EAAcC,GAASC,GAASC,CAAS;AACvD,SACC,gBAAAO;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,GAAGL;AAAA,MACJ,oBAAkBG;AAAA,MAClB,gBAAcA,MAAU,aAAaA,MAAU;AAAA,MAC/C,QAAQ,CAACG,MAAU;AAClB,QAAAL,EAAW,EAAI,GACfF,IAASO,CAAK;AAAA,MACf;AAAA,IAAA;AAAA,EAAA;AAGH;"}
@@ -1,29 +1,46 @@
1
- import { AppNavigation as t, AppNavigationButton as e, AppNavigationDivider as p, AppNavigationItem as i, AppNavigationThemeToggle as a } from "./AppNavigation/index.js";
2
- import { BackHomeButton as m } from "./BackHomeButton/index.js";
3
- import { BrandLines as g } from "./BrandLines/index.js";
1
+ import { AnimatedSwap as t } from "./AnimatedSwap/index.js";
2
+ import { AppNavigation as p, AppNavigationButton as a, AppNavigationDivider as i, AppNavigationItem as n, AppNavigationThemeToggle as m } from "./AppNavigation/index.js";
3
+ import { BackHomeButton as x } from "./BackHomeButton/index.js";
4
+ import { BrandLines as u } from "./BrandLines/index.js";
4
5
  import { ConfirmDialog as v } from "./ConfirmDialog/index.js";
5
- import { DatePickerInput as B } from "./DatePicker/index.js";
6
- import { ErrorBoundary as u } from "./ErrorBoundary/index.js";
7
- import { NativeSelect as c } from "./NativeSelect/index.js";
8
- import { PageHeading as D } from "./PageHeading/index.js";
9
- import { SectionNavigation as k } from "./SectionNavigation/index.js";
10
- import { Spinner as I } from "./Spinner/index.js";
11
- import { UploadButton as T } from "./UploadButton/index.js";
6
+ import { DatePickerInput as l } from "./DatePicker/index.js";
7
+ import { ErrorBoundary as N } from "./ErrorBoundary/index.js";
8
+ import { ExternalLink as c } from "./ExternalLink/index.js";
9
+ import { NativeSelect as s } from "./NativeSelect/index.js";
10
+ import { PageHeading as T } from "./PageHeading/index.js";
11
+ import { SaveStatus as P } from "./SaveStatus/index.js";
12
+ import { SectionNavigation as H } from "./SectionNavigation/index.js";
13
+ import { Spinner as b } from "./Spinner/index.js";
14
+ import { StartupAnimation as w } from "./StartupAnimation/index.js";
15
+ import { StartupProvider as z, useStartup as C } from "./StartupProvider/index.js";
16
+ import { TagInput as U, normalizeTags as V } from "./TagInput/index.js";
17
+ import { UploadButton as q } from "./UploadButton/index.js";
18
+ import { ValidatedInput as J, fieldFeedback as K } from "./ValidatedInput/index.js";
12
19
  export {
13
- t as AppNavigation,
14
- e as AppNavigationButton,
15
- p as AppNavigationDivider,
16
- i as AppNavigationItem,
17
- a as AppNavigationThemeToggle,
18
- m as BackHomeButton,
19
- g as BrandLines,
20
+ t as AnimatedSwap,
21
+ p as AppNavigation,
22
+ a as AppNavigationButton,
23
+ i as AppNavigationDivider,
24
+ n as AppNavigationItem,
25
+ m as AppNavigationThemeToggle,
26
+ x as BackHomeButton,
27
+ u as BrandLines,
20
28
  v as ConfirmDialog,
21
- B as DatePickerInput,
22
- u as ErrorBoundary,
23
- c as NativeSelect,
24
- D as PageHeading,
25
- k as SectionNavigation,
26
- I as Spinner,
27
- T as UploadButton
29
+ l as DatePickerInput,
30
+ N as ErrorBoundary,
31
+ c as ExternalLink,
32
+ s as NativeSelect,
33
+ T as PageHeading,
34
+ P as SaveStatus,
35
+ H as SectionNavigation,
36
+ b as Spinner,
37
+ w as StartupAnimation,
38
+ z as StartupProvider,
39
+ U as TagInput,
40
+ q as UploadButton,
41
+ J as ValidatedInput,
42
+ K as fieldFeedback,
43
+ V as normalizeTags,
44
+ C as useStartup
28
45
  };
29
46
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,25 @@
1
+ import { type ReactNode } from 'react';
2
+ type Variant = 'vertical' | 'horizontal';
3
+ export interface BarChartItemProps {
4
+ label: ReactNode;
5
+ value: number;
6
+ /** Text for the figure; defaults to the value. */
7
+ display?: ReactNode;
8
+ }
9
+ export interface BarChartProps {
10
+ children: ReactNode;
11
+ variant?: Variant;
12
+ /** Scale maximum; defaults to the largest item value. */
13
+ max?: number;
14
+ /** Accessible name of the chart. */
15
+ label?: string;
16
+ className?: string;
17
+ }
18
+ /**
19
+ * Bars as firm rounded strokes. `vertical`: columns with figure and label
20
+ * below; `horizontal`: rows with label, bar and figure.
21
+ */
22
+ export declare function BarChart({ children, variant, max, label, className, }: BarChartProps): import("react").JSX.Element;
23
+ export declare function BarChartItem({ label, value, display }: BarChartItemProps): import("react").JSX.Element;
24
+ export {};
25
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/display/BarChart/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAKN,KAAK,SAAS,EAEd,MAAM,OAAO,CAAA;AAGd,KAAK,OAAO,GAAG,UAAU,GAAG,YAAY,CAAA;AAOxC,MAAM,WAAW,iBAAiB;IACjC,KAAK,EAAE,SAAS,CAAA;IAChB,KAAK,EAAE,MAAM,CAAA;IACb,kDAAkD;IAClD,OAAO,CAAC,EAAE,SAAS,CAAA;CACnB;AAED,MAAM,WAAW,aAAa;IAC7B,QAAQ,EAAE,SAAS,CAAA;IACnB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,yDAAyD;IACzD,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,oCAAoC;IACpC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,SAAS,CAAC,EAAE,MAAM,CAAA;CAClB;AAQD;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,EACxB,QAAQ,EACR,OAAoB,EACpB,GAAG,EACH,KAAK,EACL,SAAS,GACT,EAAE,aAAa,+BAoBf;AAED,wBAAgB,YAAY,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,iBAAiB,+BAwCxE"}
@@ -0,0 +1,8 @@
1
+ import type { ReactNode } from 'react';
2
+ export interface MarginaliaProps {
3
+ value: ReactNode;
4
+ className?: string;
5
+ }
6
+ /** A single margin note in the same type as MarginaliaPair, e.g. the year. */
7
+ export declare function Marginalia({ value, className }: MarginaliaProps): import("react").JSX.Element;
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/display/Marginalia/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAGtC,MAAM,WAAW,eAAe;IAC/B,KAAK,EAAE,SAAS,CAAA;IAChB,SAAS,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,8EAA8E;AAC9E,wBAAgB,UAAU,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,eAAe,+BAS/D"}
@@ -0,0 +1,8 @@
1
+ import type { ReactNode } from 'react';
2
+ export interface MarginaliaFramedProps {
3
+ value: ReactNode;
4
+ className?: string;
5
+ }
6
+ /** A short code or index in a thin frame, e.g. a page number like "013". */
7
+ export declare function MarginaliaFramed({ value, className }: MarginaliaFramedProps): import("react").JSX.Element;
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/display/MarginaliaFramed/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAGtC,MAAM,WAAW,qBAAqB;IACrC,KAAK,EAAE,SAAS,CAAA;IAChB,SAAS,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,4EAA4E;AAC5E,wBAAgB,gBAAgB,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,qBAAqB,+BAY3E"}
@@ -0,0 +1,9 @@
1
+ import type { ReactNode } from 'react';
2
+ export interface MarginaliaPairProps {
3
+ left: ReactNode;
4
+ right: ReactNode;
5
+ className?: string;
6
+ }
7
+ /** Margin note of two values joined by a long rule, e.g. weekday —— date. */
8
+ export declare function MarginaliaPair({ left, right, className, }: MarginaliaPairProps): import("react").JSX.Element;
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/display/MarginaliaPair/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAGtC,MAAM,WAAW,mBAAmB;IACnC,IAAI,EAAE,SAAS,CAAA;IACf,KAAK,EAAE,SAAS,CAAA;IAChB,SAAS,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,6EAA6E;AAC7E,wBAAgB,cAAc,CAAC,EAC9B,IAAI,EACJ,KAAK,EACL,SAAS,GACT,EAAE,mBAAmB,+BAgBrB"}