@lincyaw/aegis-ui 0.8.0 → 0.9.1

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 (118) hide show
  1. package/dist/components/ui/AgentHud.cjs +2 -0
  2. package/dist/components/ui/AgentHud.cjs.map +1 -0
  3. package/dist/components/ui/AgentHud.d.ts +23 -0
  4. package/dist/components/ui/AgentHud.js +45 -0
  5. package/dist/components/ui/AgentHud.js.map +1 -0
  6. package/dist/components/ui/ChartLegend.cjs +1 -1
  7. package/dist/components/ui/ChartLegend.cjs.map +1 -1
  8. package/dist/components/ui/ChartLegend.d.ts +2 -0
  9. package/dist/components/ui/ChartLegend.js +11 -10
  10. package/dist/components/ui/ChartLegend.js.map +1 -1
  11. package/dist/components/ui/ColumnChart.cjs +2 -0
  12. package/dist/components/ui/ColumnChart.cjs.map +1 -0
  13. package/dist/components/ui/ColumnChart.d.ts +46 -0
  14. package/dist/components/ui/ColumnChart.js +154 -0
  15. package/dist/components/ui/ColumnChart.js.map +1 -0
  16. package/dist/components/ui/DotRangeChart.cjs +2 -0
  17. package/dist/components/ui/DotRangeChart.cjs.map +1 -0
  18. package/dist/components/ui/DotRangeChart.d.ts +44 -0
  19. package/dist/components/ui/DotRangeChart.js +80 -0
  20. package/dist/components/ui/DotRangeChart.js.map +1 -0
  21. package/dist/components/ui/HeadlineStat.cjs +2 -0
  22. package/dist/components/ui/HeadlineStat.cjs.map +1 -0
  23. package/dist/components/ui/HeadlineStat.d.ts +10 -0
  24. package/dist/components/ui/HeadlineStat.js +22 -0
  25. package/dist/components/ui/HeadlineStat.js.map +1 -0
  26. package/dist/components/ui/Heatmap.cjs +2 -0
  27. package/dist/components/ui/Heatmap.cjs.map +1 -0
  28. package/dist/components/ui/Heatmap.d.ts +52 -0
  29. package/dist/components/ui/Heatmap.js +82 -0
  30. package/dist/components/ui/Heatmap.js.map +1 -0
  31. package/dist/components/ui/KeyMomentCard.cjs +2 -0
  32. package/dist/components/ui/KeyMomentCard.cjs.map +1 -0
  33. package/dist/components/ui/KeyMomentCard.d.ts +19 -0
  34. package/dist/components/ui/KeyMomentCard.js +45 -0
  35. package/dist/components/ui/KeyMomentCard.js.map +1 -0
  36. package/dist/components/ui/LineChart.cjs +2 -0
  37. package/dist/components/ui/LineChart.cjs.map +1 -0
  38. package/dist/components/ui/LineChart.d.ts +48 -0
  39. package/dist/components/ui/LineChart.js +199 -0
  40. package/dist/components/ui/LineChart.js.map +1 -0
  41. package/dist/components/ui/ParetoChart.cjs +1 -1
  42. package/dist/components/ui/ParetoChart.cjs.map +1 -1
  43. package/dist/components/ui/ParetoChart.d.ts +34 -2
  44. package/dist/components/ui/ParetoChart.js +250 -173
  45. package/dist/components/ui/ParetoChart.js.map +1 -1
  46. package/dist/components/ui/RankBar.cjs +1 -1
  47. package/dist/components/ui/RankBar.cjs.map +1 -1
  48. package/dist/components/ui/RankBar.d.ts +7 -3
  49. package/dist/components/ui/RankBar.js +64 -45
  50. package/dist/components/ui/RankBar.js.map +1 -1
  51. package/dist/components/ui/ReplayStepStrip.cjs +1 -1
  52. package/dist/components/ui/ReplayStepStrip.cjs.map +1 -1
  53. package/dist/components/ui/ReplayStepStrip.d.ts +13 -1
  54. package/dist/components/ui/ReplayStepStrip.js +99 -76
  55. package/dist/components/ui/ReplayStepStrip.js.map +1 -1
  56. package/dist/components/ui/ResultMatrix.cjs +2 -0
  57. package/dist/components/ui/ResultMatrix.cjs.map +1 -0
  58. package/dist/components/ui/ResultMatrix.d.ts +23 -0
  59. package/dist/components/ui/ResultMatrix.js +53 -0
  60. package/dist/components/ui/ResultMatrix.js.map +1 -0
  61. package/dist/components/ui/ScrollStory.cjs +2 -2
  62. package/dist/components/ui/ScrollStory.cjs.map +1 -1
  63. package/dist/components/ui/ScrollStory.d.ts +3 -1
  64. package/dist/components/ui/ScrollStory.js +34 -32
  65. package/dist/components/ui/ScrollStory.js.map +1 -1
  66. package/dist/components/ui/SeriesLabel.cjs +2 -0
  67. package/dist/components/ui/SeriesLabel.cjs.map +1 -0
  68. package/dist/components/ui/SeriesLabel.d.ts +21 -0
  69. package/dist/components/ui/SeriesLabel.js +38 -0
  70. package/dist/components/ui/SeriesLabel.js.map +1 -0
  71. package/dist/components/ui/StackedBar.cjs +1 -1
  72. package/dist/components/ui/StackedBar.cjs.map +1 -1
  73. package/dist/components/ui/StackedBar.d.ts +13 -1
  74. package/dist/components/ui/StackedBar.js +95 -74
  75. package/dist/components/ui/StackedBar.js.map +1 -1
  76. package/dist/components/ui/TableOfContents.cjs +1 -1
  77. package/dist/components/ui/TableOfContents.cjs.map +1 -1
  78. package/dist/components/ui/TableOfContents.js +31 -89
  79. package/dist/components/ui/TableOfContents.js.map +1 -1
  80. package/dist/components/ui/ThoughtCard.cjs +2 -0
  81. package/dist/components/ui/ThoughtCard.cjs.map +1 -0
  82. package/dist/components/ui/ThoughtCard.d.ts +23 -0
  83. package/dist/components/ui/ThoughtCard.js +55 -0
  84. package/dist/components/ui/ThoughtCard.js.map +1 -0
  85. package/dist/components/ui/index.d.ts +20 -0
  86. package/dist/hooks/index.d.ts +1 -0
  87. package/dist/hooks/useSectionSpy.cjs +2 -0
  88. package/dist/hooks/useSectionSpy.cjs.map +1 -0
  89. package/dist/hooks/useSectionSpy.d.ts +23 -0
  90. package/dist/hooks/useSectionSpy.js +78 -0
  91. package/dist/hooks/useSectionSpy.js.map +1 -0
  92. package/dist/index.cjs +1 -1
  93. package/dist/index.d.ts +4 -4
  94. package/dist/index.js +337 -310
  95. package/dist/index.js.map +1 -1
  96. package/dist/layouts/site/SiteAnchorNav.cjs +2 -0
  97. package/dist/layouts/site/SiteAnchorNav.cjs.map +1 -0
  98. package/dist/layouts/site/SiteAnchorNav.d.ts +22 -0
  99. package/dist/layouts/site/SiteAnchorNav.js +51 -0
  100. package/dist/layouts/site/SiteAnchorNav.js.map +1 -0
  101. package/dist/layouts/site/SiteSectionHeader.cjs +2 -0
  102. package/dist/layouts/site/SiteSectionHeader.cjs.map +1 -0
  103. package/dist/layouts/site/SiteSectionHeader.d.ts +20 -0
  104. package/dist/layouts/site/SiteSectionHeader.js +30 -0
  105. package/dist/layouts/site/SiteSectionHeader.js.map +1 -0
  106. package/dist/layouts/site/index.d.ts +4 -0
  107. package/dist/lib/chart.cjs +1 -1
  108. package/dist/lib/chart.cjs.map +1 -1
  109. package/dist/lib/chart.d.ts +8 -2
  110. package/dist/lib/chart.js +20 -16
  111. package/dist/lib/chart.js.map +1 -1
  112. package/dist/locale/strings.cjs +1 -1
  113. package/dist/locale/strings.cjs.map +1 -1
  114. package/dist/locale/strings.d.ts +2 -0
  115. package/dist/locale/strings.js +2 -0
  116. package/dist/locale/strings.js.map +1 -1
  117. package/dist/style.css +1 -1
  118. package/package.json +1 -1
@@ -1,119 +1,142 @@
1
- import { jsxs as S, jsx as l } from "react/jsx-runtime";
2
- import { useRef as j, useState as R } from "react";
3
- import { chartColorValue as A } from "../../lib/chart.js";
1
+ import { jsxs as b, jsx as p } from "react/jsx-runtime";
2
+ import { useRef as R, useState as A } from "react";
3
+ import { chartColorValue as B } from "../../lib/chart.js";
4
4
  /* empty css */
5
- import { useStrings as B } from "../../locale/useStrings.js";
6
- function $(o, s) {
7
- const a = o - 1, n = new Set(o > 0 ? [0, a] : []);
8
- for (let p = s - 1; p < a; p += s)
9
- a - p >= s / 2 && n.add(p);
5
+ import { useStrings as C } from "../../locale/useStrings.js";
6
+ function D(l, a) {
7
+ const r = l - 1, n = new Set(l > 0 ? [0, r] : []);
8
+ for (let o = a - 1; o < r; o += a)
9
+ r - o >= a / 2 && n.add(o);
10
10
  return n;
11
11
  }
12
- function E({
13
- steps: o,
14
- currentIndex: s,
15
- onSelect: a,
12
+ function L({
13
+ steps: l,
14
+ currentIndex: a,
15
+ onSelect: r,
16
16
  keyMoments: n = [],
17
- formatStep: p = (c) => `#${String(c + 1)}`,
18
- tickEvery: k,
19
- className: b
17
+ formatStep: o = (m) => `#${String(m + 1)}`,
18
+ tickEvery: N,
19
+ size: h = "md",
20
+ playhead: c,
21
+ className: v
20
22
  }) {
21
- const c = B(), u = j(null), r = o.length, d = k ?? Math.max(1, Math.ceil(r / 20) * 5), M = $(r, d), _ = new Map(n.map((e, t) => [e, t + 1])), [N, g] = R(0), y = Math.min(s ?? N, Math.max(r - 1, 0)), w = (e) => {
22
- if (!a || r === 0)
23
+ const m = C(), u = R(null), s = l.length, w = N ?? Math.max(1, Math.ceil(s / 20) * 5), M = D(s, w), _ = new Map(n.map((t, e) => [t, e + 1])), [S, d] = A(0), y = Math.min(a ?? S, Math.max(s - 1, 0)), j = (t) => {
24
+ if (!r || s === 0)
23
25
  return;
24
- const t = {
26
+ const e = {
25
27
  ArrowLeft: y - 1,
26
28
  ArrowRight: y + 1,
27
29
  Home: 0,
28
- End: r - 1
30
+ End: s - 1
29
31
  };
30
- if (!(e.key in t))
32
+ if (!(t.key in e))
31
33
  return;
32
- e.preventDefault();
33
- const i = Math.min(Math.max(t[e.key], 0), r - 1);
34
- g(i), a(i), u.current?.querySelectorAll(".aegis-replay-step-strip__step").item(i).focus();
35
- }, v = {
36
- "--aegis-replay-step-strip-count": Math.max(r, 1)
34
+ t.preventDefault();
35
+ const i = Math.min(Math.max(e[t.key], 0), s - 1);
36
+ d(i), r(i), u.current?.querySelectorAll(".aegis-replay-step-strip__step").item(i).focus();
37
+ }, $ = {
38
+ "--aegis-replay-step-strip-count": Math.max(s, 1),
39
+ ...c === void 0 ? {} : {
40
+ "--aegis-replay-step-strip-head": c,
41
+ "--aegis-replay-step-strip-head-step": c * s
42
+ }
37
43
  };
38
- return /* @__PURE__ */ S(
44
+ return /* @__PURE__ */ b(
39
45
  "div",
40
46
  {
41
- className: ["aegis-replay-step-strip", b ?? ""].filter(Boolean).join(" "),
42
- style: v,
47
+ className: [
48
+ "aegis-replay-step-strip",
49
+ `aegis-replay-step-strip--${h}`,
50
+ c === void 0 ? "" : "aegis-replay-step-strip--playhead",
51
+ v ?? ""
52
+ ].filter(Boolean).join(" "),
53
+ style: $,
43
54
  children: [
44
- /* @__PURE__ */ l("div", { className: "aegis-replay-step-strip__moments", "aria-hidden": "true", children: o.map((e, t) => {
45
- const i = _.get(t);
46
- return i === void 0 ? /* @__PURE__ */ l("span", {}, e.key) : /* @__PURE__ */ l(
55
+ n.length > 0 && /* @__PURE__ */ p("div", { className: "aegis-replay-step-strip__moments", "aria-hidden": "true", children: l.map((t, e) => {
56
+ const i = _.get(e);
57
+ return i === void 0 ? /* @__PURE__ */ p("span", {}, t.key) : /* @__PURE__ */ p(
47
58
  "span",
48
59
  {
49
60
  className: [
50
61
  "aegis-replay-step-strip__moment",
51
- t === s ? "aegis-replay-step-strip__moment--current" : ""
62
+ e === a ? "aegis-replay-step-strip__moment--current" : ""
52
63
  ].filter(Boolean).join(" "),
53
64
  children: i
54
65
  },
55
- e.key
66
+ t.key
56
67
  );
57
68
  }) }),
58
- /* @__PURE__ */ l(
69
+ /* @__PURE__ */ b(
59
70
  "div",
60
71
  {
61
72
  ref: u,
62
73
  className: "aegis-replay-step-strip__bars",
63
- role: a ? "toolbar" : "list",
64
- "aria-label": c.replaySteps,
65
- onKeyDown: w,
66
- children: o.map((e, t) => {
67
- const i = _.get(t), m = i === void 0 ? e.label : `${e.label} · ${c.replayKeyMoment(i)}`, h = {
68
- "--aegis-replay-step-strip-color": A(e.color)
69
- }, f = [
70
- "aegis-replay-step-strip__step",
71
- e.emphasis ? "aegis-replay-step-strip__step--emphasis" : "",
72
- t === s ? "aegis-replay-step-strip__step--current" : ""
73
- ].filter(Boolean).join(" ");
74
- return a ? /* @__PURE__ */ l(
75
- "button",
76
- {
77
- type: "button",
78
- className: f,
79
- style: h,
80
- title: m,
81
- "aria-label": m,
82
- "aria-current": t === s ? "step" : void 0,
83
- tabIndex: t === y ? 0 : -1,
84
- onClick: () => {
85
- g(t), a(t);
86
- }
87
- },
88
- e.key
89
- ) : /* @__PURE__ */ l(
74
+ role: r ? "toolbar" : "list",
75
+ "aria-label": m.replaySteps,
76
+ onKeyDown: j,
77
+ children: [
78
+ l.map((t, e) => {
79
+ const i = _.get(e), g = i === void 0 ? t.label : `${t.label} · ${m.replayKeyMoment(i)}`, f = {
80
+ "--aegis-replay-step-strip-color": B(t.color),
81
+ "--aegis-replay-step-strip-index": e,
82
+ ...t.weight === void 0 ? {} : { height: `${(t.weight * 100).toString()}%` }
83
+ }, k = [
84
+ "aegis-replay-step-strip__step",
85
+ t.emphasis ? "aegis-replay-step-strip__step--emphasis" : "",
86
+ e === a ? "aegis-replay-step-strip__step--current" : ""
87
+ ].filter(Boolean).join(" ");
88
+ return r ? /* @__PURE__ */ p(
89
+ "button",
90
+ {
91
+ type: "button",
92
+ className: k,
93
+ style: f,
94
+ title: g,
95
+ "aria-label": g,
96
+ "aria-current": e === a ? "step" : void 0,
97
+ tabIndex: e === y ? 0 : -1,
98
+ onClick: () => {
99
+ d(e), r(e);
100
+ }
101
+ },
102
+ t.key
103
+ ) : /* @__PURE__ */ p(
104
+ "span",
105
+ {
106
+ role: "listitem",
107
+ className: k,
108
+ style: f,
109
+ title: g,
110
+ "aria-label": g,
111
+ "aria-current": e === a ? "step" : void 0
112
+ },
113
+ t.key
114
+ );
115
+ }),
116
+ c !== void 0 && /* @__PURE__ */ p(
90
117
  "span",
91
118
  {
92
- role: "listitem",
93
- className: f,
94
- style: h,
95
- title: m,
96
- "aria-label": m,
97
- "aria-current": t === s ? "step" : void 0
98
- },
99
- e.key
100
- );
101
- })
119
+ className: "aegis-replay-step-strip__head-track",
120
+ "aria-hidden": "true",
121
+ children: /* @__PURE__ */ p("span", { className: "aegis-replay-step-strip__head" })
122
+ }
123
+ )
124
+ ]
102
125
  }
103
126
  ),
104
- /* @__PURE__ */ l("div", { className: "aegis-replay-step-strip__ticks", "aria-hidden": "true", children: o.map((e, t) => /* @__PURE__ */ l(
127
+ h === "md" && /* @__PURE__ */ p("div", { className: "aegis-replay-step-strip__ticks", "aria-hidden": "true", children: l.map((t, e) => /* @__PURE__ */ p(
105
128
  "span",
106
129
  {
107
- className: t === r - 1 && r > 1 ? "aegis-replay-step-strip__tick aegis-replay-step-strip__tick--last" : "aegis-replay-step-strip__tick",
108
- children: M.has(t) ? p(t) : null
130
+ className: e === s - 1 && s > 1 ? "aegis-replay-step-strip__tick aegis-replay-step-strip__tick--last" : "aegis-replay-step-strip__tick",
131
+ children: M.has(e) ? o(e) : null
109
132
  },
110
- e.key
133
+ t.key
111
134
  )) })
112
135
  ]
113
136
  }
114
137
  );
115
138
  }
116
139
  export {
117
- E as ReplayStepStrip
140
+ L as ReplayStepStrip
118
141
  };
119
142
  //# sourceMappingURL=ReplayStepStrip.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ReplayStepStrip.js","sources":["../../../src/components/ui/ReplayStepStrip.tsx"],"sourcesContent":["import {\n type CSSProperties,\n type KeyboardEvent,\n type ReactElement,\n type ReactNode,\n useRef,\n useState,\n} from 'react';\n\nimport { type ChartColor, chartColorValue } from '../../lib/chart';\nimport { useStrings } from '../../locale';\nimport './ReplayStepStrip.css';\n\nexport interface ReplayStepStripItem {\n key: string;\n /** The step kind's colour, e.g. thinking, tool call, failure. */\n color: ChartColor;\n /** Names the step for screen readers and its tooltip, e.g. \"#12 · 验证\". */\n label: string;\n /** A step that changes the course (a check, a failure, the goal): taller. */\n emphasis?: boolean;\n}\n\nexport interface ReplayStepStripProps {\n steps: ReplayStepStripItem[];\n /** The step shown elsewhere on the page; outlined. */\n currentIndex?: number;\n /** Makes each step a button that selects it. */\n onSelect?: (index: number) => void;\n /** Step indices of the key moments, numbered above the strip in order. */\n keyMoments?: number[];\n /** The tick label of a step under the strip. Defaults to `#n`. */\n formatStep?: (index: number) => ReactNode;\n /** A tick every this many steps; defaults to about five ticks. */\n tickEvery?: number;\n className?: string;\n}\n\n/**\n * The steps that get a tick: the first, the last, and every `every`\n * steps between, leaving out one that would crowd the last.\n */\nfunction tickedSteps(count: number, every: number): Set<number> {\n const last = count - 1;\n const ticks = new Set<number>(count > 0 ? [0, last] : []);\n for (let index = every - 1; index < last; index += every) {\n if (last - index >= every / 2) {\n ticks.add(index);\n }\n }\n return ticks;\n}\n\n/**\n * Every step of a run as a bar coloured by its kind, with the key\n * moments numbered above it and step ticks below. With `onSelect`, a bar\n * selects its step; arrow keys move between steps with one tab stop.\n * The gap between bars narrows as steps are added, so a long run still\n * draws every step.\n */\nexport function ReplayStepStrip({\n steps,\n currentIndex,\n onSelect,\n keyMoments = [],\n formatStep = (index) => `#${String(index + 1)}`,\n tickEvery,\n className,\n}: ReplayStepStripProps): ReactElement {\n const strings = useStrings();\n const barsRef = useRef<HTMLDivElement>(null);\n const count = steps.length;\n const every = tickEvery ?? Math.max(1, Math.ceil(count / 20) * 5);\n const ticks = tickedSteps(count, every);\n const momentNumber = new Map(keyMoments.map((step, n) => [step, n + 1]));\n\n // The roving tab stop follows the current step, or the last step the\n // keyboard reached when the host does not mark one.\n const [ownFocus, setOwnFocus] = useState(0);\n const focusIndex = Math.min(currentIndex ?? ownFocus, Math.max(count - 1, 0));\n\n const onKeyDown = (event: KeyboardEvent<HTMLDivElement>): void => {\n if (!onSelect || count === 0) {\n return;\n }\n const target: Record<string, number> = {\n ArrowLeft: focusIndex - 1,\n ArrowRight: focusIndex + 1,\n Home: 0,\n End: count - 1,\n };\n if (!(event.key in target)) {\n return;\n }\n event.preventDefault();\n const next = Math.min(Math.max(target[event.key], 0), count - 1);\n setOwnFocus(next);\n onSelect(next);\n barsRef.current\n ?.querySelectorAll<HTMLButtonElement>('.aegis-replay-step-strip__step')\n .item(next)\n .focus();\n };\n\n const style = {\n '--aegis-replay-step-strip-count': Math.max(count, 1),\n } as CSSProperties;\n return (\n <div\n className={['aegis-replay-step-strip', className ?? '']\n .filter(Boolean)\n .join(' ')}\n style={style}\n >\n <div className=\"aegis-replay-step-strip__moments\" aria-hidden=\"true\">\n {steps.map((step, index) => {\n const n = momentNumber.get(index);\n return n === undefined ? (\n <span key={step.key} />\n ) : (\n <span\n key={step.key}\n className={[\n 'aegis-replay-step-strip__moment',\n index === currentIndex\n ? 'aegis-replay-step-strip__moment--current'\n : '',\n ]\n .filter(Boolean)\n .join(' ')}\n >\n {n}\n </span>\n );\n })}\n </div>\n <div\n ref={barsRef}\n className=\"aegis-replay-step-strip__bars\"\n role={onSelect ? 'toolbar' : 'list'}\n aria-label={strings.replaySteps}\n onKeyDown={onKeyDown}\n >\n {steps.map((step, index) => {\n const n = momentNumber.get(index);\n const label =\n n === undefined\n ? step.label\n : `${step.label} · ${strings.replayKeyMoment(n)}`;\n const barStyle = {\n '--aegis-replay-step-strip-color': chartColorValue(step.color),\n } as CSSProperties;\n const cls = [\n 'aegis-replay-step-strip__step',\n step.emphasis ? 'aegis-replay-step-strip__step--emphasis' : '',\n index === currentIndex\n ? 'aegis-replay-step-strip__step--current'\n : '',\n ]\n .filter(Boolean)\n .join(' ');\n return onSelect ? (\n <button\n key={step.key}\n type=\"button\"\n className={cls}\n style={barStyle}\n title={label}\n aria-label={label}\n aria-current={index === currentIndex ? 'step' : undefined}\n tabIndex={index === focusIndex ? 0 : -1}\n onClick={() => {\n setOwnFocus(index);\n onSelect(index);\n }}\n />\n ) : (\n <span\n key={step.key}\n role=\"listitem\"\n className={cls}\n style={barStyle}\n title={label}\n aria-label={label}\n aria-current={index === currentIndex ? 'step' : undefined}\n />\n );\n })}\n </div>\n <div className=\"aegis-replay-step-strip__ticks\" aria-hidden=\"true\">\n {steps.map((step, index) => (\n <span\n key={step.key}\n className={\n index === count - 1 && count > 1\n ? 'aegis-replay-step-strip__tick aegis-replay-step-strip__tick--last'\n : 'aegis-replay-step-strip__tick'\n }\n >\n {ticks.has(index) ? formatStep(index) : null}\n </span>\n ))}\n </div>\n </div>\n );\n}\n"],"names":["tickedSteps","count","every","last","ticks","index","ReplayStepStrip","steps","currentIndex","onSelect","keyMoments","formatStep","tickEvery","className","strings","useStrings","barsRef","useRef","momentNumber","step","n","ownFocus","setOwnFocus","useState","focusIndex","onKeyDown","event","target","next","style","jsxs","jsx","label","barStyle","chartColorValue","cls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ui/ReplayStepStrip.tsx"],"sourcesContent":["import {\n type CSSProperties,\n type KeyboardEvent,\n type ReactElement,\n type ReactNode,\n useRef,\n useState,\n} from 'react';\n\nimport { type ChartColor, chartColorValue } from '../../lib/chart';\nimport { useStrings } from '../../locale';\nimport './ReplayStepStrip.css';\n\nexport interface ReplayStepStripItem {\n key: string;\n /** The step kind's colour, e.g. thinking, tool call, failure. */\n color: ChartColor;\n /** Names the step for screen readers and its tooltip, e.g. \"#12 · 验证\". */\n label: string;\n /** A step that changes the course (a check, a failure, the goal): taller. */\n emphasis?: boolean;\n /**\n * The bar's height as a share of the strip, 0 to 1, for a host that\n * grades its kinds more finely than `emphasis`; it wins over `emphasis`.\n */\n weight?: number;\n}\n\nexport interface ReplayStepStripProps {\n steps: ReplayStepStripItem[];\n /** The step shown elsewhere on the page; outlined. */\n currentIndex?: number;\n /** Makes each step a button that selects it. */\n onSelect?: (index: number) => void;\n /** Step indices of the key moments, numbered above the strip in order. */\n keyMoments?: number[];\n /** The tick label of a step under the strip. Defaults to `#n`. */\n formatStep?: (index: number) => ReactNode;\n /** A tick every this many steps; defaults to about five ticks. */\n tickEvery?: number;\n /** `sm` is a shorter strip without ticks, for a card or a list row. Defaults to `md`. */\n size?: 'md' | 'sm';\n /**\n * Draws a playhead this share of the way along the strip, 0 to 1, and\n * dims the steps past it, e.g. for a strip that plays as the page scrolls.\n */\n playhead?: number;\n className?: string;\n}\n\n/**\n * The steps that get a tick: the first, the last, and every `every`\n * steps between, leaving out one that would crowd the last.\n */\nfunction tickedSteps(count: number, every: number): Set<number> {\n const last = count - 1;\n const ticks = new Set<number>(count > 0 ? [0, last] : []);\n for (let index = every - 1; index < last; index += every) {\n if (last - index >= every / 2) {\n ticks.add(index);\n }\n }\n return ticks;\n}\n\n/**\n * Every step of a run as a bar coloured by its kind, with the key\n * moments numbered above it and step ticks below. With `onSelect`, a bar\n * selects its step; arrow keys move between steps with one tab stop.\n * The gap between bars narrows as steps are added, so a long run still\n * draws every step.\n */\nexport function ReplayStepStrip({\n steps,\n currentIndex,\n onSelect,\n keyMoments = [],\n formatStep = (index) => `#${String(index + 1)}`,\n tickEvery,\n size = 'md',\n playhead,\n className,\n}: ReplayStepStripProps): ReactElement {\n const strings = useStrings();\n const barsRef = useRef<HTMLDivElement>(null);\n const count = steps.length;\n const every = tickEvery ?? Math.max(1, Math.ceil(count / 20) * 5);\n const ticks = tickedSteps(count, every);\n const momentNumber = new Map(keyMoments.map((step, n) => [step, n + 1]));\n\n // The roving tab stop follows the current step, or the last step the\n // keyboard reached when the host does not mark one.\n const [ownFocus, setOwnFocus] = useState(0);\n const focusIndex = Math.min(currentIndex ?? ownFocus, Math.max(count - 1, 0));\n\n const onKeyDown = (event: KeyboardEvent<HTMLDivElement>): void => {\n if (!onSelect || count === 0) {\n return;\n }\n const target: Record<string, number> = {\n ArrowLeft: focusIndex - 1,\n ArrowRight: focusIndex + 1,\n Home: 0,\n End: count - 1,\n };\n if (!(event.key in target)) {\n return;\n }\n event.preventDefault();\n const next = Math.min(Math.max(target[event.key], 0), count - 1);\n setOwnFocus(next);\n onSelect(next);\n barsRef.current\n ?.querySelectorAll<HTMLButtonElement>('.aegis-replay-step-strip__step')\n .item(next)\n .focus();\n };\n\n const style = {\n '--aegis-replay-step-strip-count': Math.max(count, 1),\n ...(playhead === undefined\n ? {}\n : {\n '--aegis-replay-step-strip-head': playhead,\n '--aegis-replay-step-strip-head-step': playhead * count,\n }),\n } as CSSProperties;\n return (\n <div\n className={[\n 'aegis-replay-step-strip',\n `aegis-replay-step-strip--${size}`,\n playhead === undefined ? '' : 'aegis-replay-step-strip--playhead',\n className ?? '',\n ]\n .filter(Boolean)\n .join(' ')}\n style={style}\n >\n {keyMoments.length > 0 && (\n <div className=\"aegis-replay-step-strip__moments\" aria-hidden=\"true\">\n {steps.map((step, index) => {\n const n = momentNumber.get(index);\n return n === undefined ? (\n <span key={step.key} />\n ) : (\n <span\n key={step.key}\n className={[\n 'aegis-replay-step-strip__moment',\n index === currentIndex\n ? 'aegis-replay-step-strip__moment--current'\n : '',\n ]\n .filter(Boolean)\n .join(' ')}\n >\n {n}\n </span>\n );\n })}\n </div>\n )}\n <div\n ref={barsRef}\n className=\"aegis-replay-step-strip__bars\"\n role={onSelect ? 'toolbar' : 'list'}\n aria-label={strings.replaySteps}\n onKeyDown={onKeyDown}\n >\n {steps.map((step, index) => {\n const n = momentNumber.get(index);\n const label =\n n === undefined\n ? step.label\n : `${step.label} · ${strings.replayKeyMoment(n)}`;\n const barStyle = {\n '--aegis-replay-step-strip-color': chartColorValue(step.color),\n '--aegis-replay-step-strip-index': index,\n ...(step.weight === undefined\n ? {}\n : { height: `${(step.weight * 100).toString()}%` }),\n } as CSSProperties;\n const cls = [\n 'aegis-replay-step-strip__step',\n step.emphasis ? 'aegis-replay-step-strip__step--emphasis' : '',\n index === currentIndex\n ? 'aegis-replay-step-strip__step--current'\n : '',\n ]\n .filter(Boolean)\n .join(' ');\n return onSelect ? (\n <button\n key={step.key}\n type=\"button\"\n className={cls}\n style={barStyle}\n title={label}\n aria-label={label}\n aria-current={index === currentIndex ? 'step' : undefined}\n tabIndex={index === focusIndex ? 0 : -1}\n onClick={() => {\n setOwnFocus(index);\n onSelect(index);\n }}\n />\n ) : (\n <span\n key={step.key}\n role=\"listitem\"\n className={cls}\n style={barStyle}\n title={label}\n aria-label={label}\n aria-current={index === currentIndex ? 'step' : undefined}\n />\n );\n })}\n {playhead !== undefined && (\n <span\n className=\"aegis-replay-step-strip__head-track\"\n aria-hidden=\"true\"\n >\n <span className=\"aegis-replay-step-strip__head\" />\n </span>\n )}\n </div>\n {size === 'md' && (\n <div className=\"aegis-replay-step-strip__ticks\" aria-hidden=\"true\">\n {steps.map((step, index) => (\n <span\n key={step.key}\n className={\n index === count - 1 && count > 1\n ? 'aegis-replay-step-strip__tick aegis-replay-step-strip__tick--last'\n : 'aegis-replay-step-strip__tick'\n }\n >\n {ticks.has(index) ? formatStep(index) : null}\n </span>\n ))}\n </div>\n )}\n </div>\n );\n}\n"],"names":["tickedSteps","count","every","last","ticks","index","ReplayStepStrip","steps","currentIndex","onSelect","keyMoments","formatStep","tickEvery","size","playhead","className","strings","useStrings","barsRef","useRef","momentNumber","step","n","ownFocus","setOwnFocus","useState","focusIndex","onKeyDown","event","target","next","style","jsxs","jsx","label","barStyle","chartColorValue","cls"],"mappings":";;;;;AAsDA,SAASA,EAAYC,GAAeC,GAA4B;AAC9D,QAAMC,IAAOF,IAAQ,GACfG,IAAQ,IAAI,IAAYH,IAAQ,IAAI,CAAC,GAAGE,CAAI,IAAI,EAAE;AACxD,WAASE,IAAQH,IAAQ,GAAGG,IAAQF,GAAME,KAASH;AACjD,IAAIC,IAAOE,KAASH,IAAQ,KAC1BE,EAAM,IAAIC,CAAK;AAGnB,SAAOD;AACT;AASO,SAASE,EAAgB;AAAA,EAC9B,OAAAC;AAAA,EACA,cAAAC;AAAA,EACA,UAAAC;AAAA,EACA,YAAAC,IAAa,CAAA;AAAA,EACb,YAAAC,IAAa,CAACN,MAAU,IAAI,OAAOA,IAAQ,CAAC,CAAC;AAAA,EAC7C,WAAAO;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,UAAAC;AAAA,EACA,WAAAC;AACF,GAAuC;AACrC,QAAMC,IAAUC,EAAA,GACVC,IAAUC,EAAuB,IAAI,GACrClB,IAAQM,EAAM,QACdL,IAAQU,KAAa,KAAK,IAAI,GAAG,KAAK,KAAKX,IAAQ,EAAE,IAAI,CAAC,GAC1DG,IAAQJ,EAAYC,GAAOC,CAAK,GAChCkB,IAAe,IAAI,IAAIV,EAAW,IAAI,CAACW,GAAMC,MAAM,CAACD,GAAMC,IAAI,CAAC,CAAC,CAAC,GAIjE,CAACC,GAAUC,CAAW,IAAIC,EAAS,CAAC,GACpCC,IAAa,KAAK,IAAIlB,KAAgBe,GAAU,KAAK,IAAItB,IAAQ,GAAG,CAAC,CAAC,GAEtE0B,IAAY,CAACC,MAA+C;AAChE,QAAI,CAACnB,KAAYR,MAAU;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;AAAA,oBACX,OAAOF;AAAA,oBACP,OAAOD;AAAA,oBACP,cAAYA;AAAA,oBACZ,gBAAc7B,MAAUG,IAAe,SAAS;AAAA,kBAAA;AAAA,kBAN3Ca,EAAK;AAAA,gBAAA;AAAA,cAShB,CAAC;AAAA,cACAP,MAAa,UACZ,gBAAAmB;AAAA,gBAAC;AAAA,gBAAA;AAAA,kBACC,WAAU;AAAA,kBACV,eAAY;AAAA,kBAEZ,UAAA,gBAAAA,EAAC,QAAA,EAAK,WAAU,gCAAA,CAAgC;AAAA,gBAAA;AAAA,cAAA;AAAA,YAClD;AAAA,UAAA;AAAA,QAAA;AAAA,QAGHpB,MAAS,QACR,gBAAAoB,EAAC,OAAA,EAAI,WAAU,kCAAiC,eAAY,QACzD,UAAA1B,EAAM,IAAI,CAACc,GAAMhB,MAChB,gBAAA4B;AAAA,UAAC;AAAA,UAAA;AAAA,YAEC,WACE5B,MAAUJ,IAAQ,KAAKA,IAAQ,IAC3B,sEACA;AAAA,YAGL,YAAM,IAAII,CAAK,IAAIM,EAAWN,CAAK,IAAI;AAAA,UAAA;AAAA,UAPnCgB,EAAK;AAAA,QAAA,CASb,EAAA,CACH;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAIR;"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),i=require("../../lib/chart.cjs");;/* empty css */function x({rows:e,color:u,shape:m="square",label:g,progress:s,className:n}){const o=Math.max(0,...e.map(t=>t.length));return r.jsx("div",{role:"img","aria-label":g,className:["aegis-result-matrix",`aegis-result-matrix--${m}`,n??""].filter(Boolean).join(" "),style:{"--aegis-result-matrix-color":i.chartColorValue(u),"--aegis-result-matrix-columns":Math.max(o,1)},children:e.map((t,l)=>r.jsx("div",{className:"aegis-result-matrix__row",style:{"--aegis-result-matrix-progress":s===void 0?1:i.staggeredProgress(s,l,e.length)},children:t.map((a,c)=>r.jsx("span",{className:a===null||a===0?"aegis-result-matrix__cell aegis-result-matrix__cell--empty":"aegis-result-matrix__cell",style:{"--aegis-result-matrix-level":a??0}},c))},l))})}exports.ResultMatrix=x;
2
+ //# sourceMappingURL=ResultMatrix.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ResultMatrix.cjs","sources":["../../../src/components/ui/ResultMatrix.tsx"],"sourcesContent":["import type { CSSProperties, ReactElement } from 'react';\n\nimport {\n type ChartColor,\n chartColorValue,\n staggeredProgress,\n} from '../../lib/chart';\nimport './ResultMatrix.css';\n\nexport interface ResultMatrixProps {\n /**\n * The rows of cells, e.g. one row per task and one cell per run. A cell\n * is its strength from 0 to 1; 0 and null are an empty cell.\n */\n rows: Array<Array<number | null>>;\n /** The filled cells' colour. */\n color: ChartColor;\n /** `square` cells for a pattern, thin `bar` cells for many rows. Defaults to `square`. */\n shape?: 'square' | 'bar';\n /** Reads the matrix to a screen reader, e.g. \"46 of 55 runs passed\". */\n label: string;\n /**\n * How far the matrix is filled, 0 to 1, row after row, for one that\n * fills as its section scrolls in (`useScrollProgress`).\n */\n progress?: number;\n className?: string;\n}\n\n/** A small matrix of results in which the pattern itself shows how they fall. */\nexport function ResultMatrix({\n rows,\n color,\n shape = 'square',\n label,\n progress,\n className,\n}: ResultMatrixProps): ReactElement {\n const columns = Math.max(0, ...rows.map((row) => row.length));\n return (\n <div\n role=\"img\"\n aria-label={label}\n className={[\n 'aegis-result-matrix',\n `aegis-result-matrix--${shape}`,\n className ?? '',\n ]\n .filter(Boolean)\n .join(' ')}\n style={\n {\n '--aegis-result-matrix-color': chartColorValue(color),\n '--aegis-result-matrix-columns': Math.max(columns, 1),\n } as CSSProperties\n }\n >\n {rows.map((row, rowIndex) => (\n <div\n key={rowIndex}\n className=\"aegis-result-matrix__row\"\n style={\n {\n '--aegis-result-matrix-progress':\n progress === undefined\n ? 1\n : staggeredProgress(progress, rowIndex, rows.length),\n } as CSSProperties\n }\n >\n {row.map((cell, cellIndex) => (\n <span\n key={cellIndex}\n className={\n cell === null || cell === 0\n ? 'aegis-result-matrix__cell aegis-result-matrix__cell--empty'\n : 'aegis-result-matrix__cell'\n }\n style={\n {\n '--aegis-result-matrix-level': cell ?? 0,\n } as CSSProperties\n }\n />\n ))}\n </div>\n ))}\n </div>\n );\n}\n"],"names":["ResultMatrix","rows","color","shape","label","progress","className","columns","row","jsx","chartColorValue","rowIndex","staggeredProgress","cell","cellIndex"],"mappings":"wLA8BO,SAASA,EAAa,CAC3B,KAAAC,EACA,MAAAC,EACA,MAAAC,EAAQ,SACR,MAAAC,EACA,SAAAC,EACA,UAAAC,CACF,EAAoC,CAClC,MAAMC,EAAU,KAAK,IAAI,EAAG,GAAGN,EAAK,IAAKO,GAAQA,EAAI,MAAM,CAAC,EAC5D,OACEC,EAAAA,IAAC,MAAA,CACC,KAAK,MACL,aAAYL,EACZ,UAAW,CACT,sBACA,wBAAwBD,CAAK,GAC7BG,GAAa,EAAA,EAEZ,OAAO,OAAO,EACd,KAAK,GAAG,EACX,MACE,CACE,8BAA+BI,EAAAA,gBAAgBR,CAAK,EACpD,gCAAiC,KAAK,IAAIK,EAAS,CAAC,CAAA,EAIvD,SAAAN,EAAK,IAAI,CAACO,EAAKG,IACdF,EAAAA,IAAC,MAAA,CAEC,UAAU,2BACV,MACE,CACE,iCACEJ,IAAa,OACT,EACAO,EAAAA,kBAAkBP,EAAUM,EAAUV,EAAK,MAAM,CAAA,EAI1D,SAAAO,EAAI,IAAI,CAACK,EAAMC,IACdL,EAAAA,IAAC,OAAA,CAEC,UACEI,IAAS,MAAQA,IAAS,EACtB,6DACA,4BAEN,MACE,CACE,8BAA+BA,GAAQ,CAAA,CACzC,EATGC,CAAA,CAYR,CAAA,EAzBIH,CAAA,CA2BR,CAAA,CAAA,CAGP"}
@@ -0,0 +1,23 @@
1
+ import { ReactElement } from 'react';
2
+ import { ChartColor } from '../../lib/chart';
3
+ export interface ResultMatrixProps {
4
+ /**
5
+ * The rows of cells, e.g. one row per task and one cell per run. A cell
6
+ * is its strength from 0 to 1; 0 and null are an empty cell.
7
+ */
8
+ rows: Array<Array<number | null>>;
9
+ /** The filled cells' colour. */
10
+ color: ChartColor;
11
+ /** `square` cells for a pattern, thin `bar` cells for many rows. Defaults to `square`. */
12
+ shape?: 'square' | 'bar';
13
+ /** Reads the matrix to a screen reader, e.g. "46 of 55 runs passed". */
14
+ label: string;
15
+ /**
16
+ * How far the matrix is filled, 0 to 1, row after row, for one that
17
+ * fills as its section scrolls in (`useScrollProgress`).
18
+ */
19
+ progress?: number;
20
+ className?: string;
21
+ }
22
+ /** A small matrix of results in which the pattern itself shows how they fall. */
23
+ export declare function ResultMatrix({ rows, color, shape, label, progress, className, }: ResultMatrixProps): ReactElement;
@@ -0,0 +1,53 @@
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ import { staggeredProgress as n, chartColorValue as c } from "../../lib/chart.js";
3
+ /* empty css */
4
+ function d({
5
+ rows: e,
6
+ color: i,
7
+ shape: m = "square",
8
+ label: o,
9
+ progress: l,
10
+ className: u
11
+ }) {
12
+ const g = Math.max(0, ...e.map((a) => a.length));
13
+ return /* @__PURE__ */ r(
14
+ "div",
15
+ {
16
+ role: "img",
17
+ "aria-label": o,
18
+ className: [
19
+ "aegis-result-matrix",
20
+ `aegis-result-matrix--${m}`,
21
+ u ?? ""
22
+ ].filter(Boolean).join(" "),
23
+ style: {
24
+ "--aegis-result-matrix-color": c(i),
25
+ "--aegis-result-matrix-columns": Math.max(g, 1)
26
+ },
27
+ children: e.map((a, s) => /* @__PURE__ */ r(
28
+ "div",
29
+ {
30
+ className: "aegis-result-matrix__row",
31
+ style: {
32
+ "--aegis-result-matrix-progress": l === void 0 ? 1 : n(l, s, e.length)
33
+ },
34
+ children: a.map((t, x) => /* @__PURE__ */ r(
35
+ "span",
36
+ {
37
+ className: t === null || t === 0 ? "aegis-result-matrix__cell aegis-result-matrix__cell--empty" : "aegis-result-matrix__cell",
38
+ style: {
39
+ "--aegis-result-matrix-level": t ?? 0
40
+ }
41
+ },
42
+ x
43
+ ))
44
+ },
45
+ s
46
+ ))
47
+ }
48
+ );
49
+ }
50
+ export {
51
+ d as ResultMatrix
52
+ };
53
+ //# sourceMappingURL=ResultMatrix.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ResultMatrix.js","sources":["../../../src/components/ui/ResultMatrix.tsx"],"sourcesContent":["import type { CSSProperties, ReactElement } from 'react';\n\nimport {\n type ChartColor,\n chartColorValue,\n staggeredProgress,\n} from '../../lib/chart';\nimport './ResultMatrix.css';\n\nexport interface ResultMatrixProps {\n /**\n * The rows of cells, e.g. one row per task and one cell per run. A cell\n * is its strength from 0 to 1; 0 and null are an empty cell.\n */\n rows: Array<Array<number | null>>;\n /** The filled cells' colour. */\n color: ChartColor;\n /** `square` cells for a pattern, thin `bar` cells for many rows. Defaults to `square`. */\n shape?: 'square' | 'bar';\n /** Reads the matrix to a screen reader, e.g. \"46 of 55 runs passed\". */\n label: string;\n /**\n * How far the matrix is filled, 0 to 1, row after row, for one that\n * fills as its section scrolls in (`useScrollProgress`).\n */\n progress?: number;\n className?: string;\n}\n\n/** A small matrix of results in which the pattern itself shows how they fall. */\nexport function ResultMatrix({\n rows,\n color,\n shape = 'square',\n label,\n progress,\n className,\n}: ResultMatrixProps): ReactElement {\n const columns = Math.max(0, ...rows.map((row) => row.length));\n return (\n <div\n role=\"img\"\n aria-label={label}\n className={[\n 'aegis-result-matrix',\n `aegis-result-matrix--${shape}`,\n className ?? '',\n ]\n .filter(Boolean)\n .join(' ')}\n style={\n {\n '--aegis-result-matrix-color': chartColorValue(color),\n '--aegis-result-matrix-columns': Math.max(columns, 1),\n } as CSSProperties\n }\n >\n {rows.map((row, rowIndex) => (\n <div\n key={rowIndex}\n className=\"aegis-result-matrix__row\"\n style={\n {\n '--aegis-result-matrix-progress':\n progress === undefined\n ? 1\n : staggeredProgress(progress, rowIndex, rows.length),\n } as CSSProperties\n }\n >\n {row.map((cell, cellIndex) => (\n <span\n key={cellIndex}\n className={\n cell === null || cell === 0\n ? 'aegis-result-matrix__cell aegis-result-matrix__cell--empty'\n : 'aegis-result-matrix__cell'\n }\n style={\n {\n '--aegis-result-matrix-level': cell ?? 0,\n } as CSSProperties\n }\n />\n ))}\n </div>\n ))}\n </div>\n );\n}\n"],"names":["ResultMatrix","rows","color","shape","label","progress","className","columns","row","jsx","chartColorValue","rowIndex","staggeredProgress","cell","cellIndex"],"mappings":";;;AA8BO,SAASA,EAAa;AAAA,EAC3B,MAAAC;AAAA,EACA,OAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AACF,GAAoC;AAClC,QAAMC,IAAU,KAAK,IAAI,GAAG,GAAGN,EAAK,IAAI,CAACO,MAAQA,EAAI,MAAM,CAAC;AAC5D,SACE,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,MAAK;AAAA,MACL,cAAYL;AAAA,MACZ,WAAW;AAAA,QACT;AAAA,QACA,wBAAwBD,CAAK;AAAA,QAC7BG,KAAa;AAAA,MAAA,EAEZ,OAAO,OAAO,EACd,KAAK,GAAG;AAAA,MACX,OACE;AAAA,QACE,+BAA+BI,EAAgBR,CAAK;AAAA,QACpD,iCAAiC,KAAK,IAAIK,GAAS,CAAC;AAAA,MAAA;AAAA,MAIvD,UAAAN,EAAK,IAAI,CAACO,GAAKG,MACd,gBAAAF;AAAA,QAAC;AAAA,QAAA;AAAA,UAEC,WAAU;AAAA,UACV,OACE;AAAA,YACE,kCACEJ,MAAa,SACT,IACAO,EAAkBP,GAAUM,GAAUV,EAAK,MAAM;AAAA,UAAA;AAAA,UAI1D,UAAAO,EAAI,IAAI,CAACK,GAAMC,MACd,gBAAAL;AAAA,YAAC;AAAA,YAAA;AAAA,cAEC,WACEI,MAAS,QAAQA,MAAS,IACtB,+DACA;AAAA,cAEN,OACE;AAAA,gBACE,+BAA+BA,KAAQ;AAAA,cAAA;AAAA,YACzC;AAAA,YATGC;AAAA,UAAA,CAYR;AAAA,QAAA;AAAA,QAzBIH;AAAA,MAAA,CA2BR;AAAA,IAAA;AAAA,EAAA;AAGP;"}
@@ -1,3 +1,3 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),l=require("react"),k=require("../../hooks/useMediaQuery.cjs"),m=require("../../lib/scrollView.cjs"),h=require("./Panel.cjs");;/* empty css */const q=require("../../locale/useStrings.cjs"),j=50,P="(max-width: 768px)";function p({steps:t,currentIndex:x,onCurrentChange:d,scrollContainer:n=null,className:N}){const S=q.useStrings(),_=l.useId(),o=k.useMediaQuery(P),[b,I]=l.useState(0),g=l.useRef(0),y=l.useRef(d),f=l.useRef([]),i=x??b,R=t.map(e=>e.id).join(`
2
- `);l.useEffect(()=>{y.current=d},[d]);const v=l.useCallback(e=>{e!==g.current&&(g.current=e,I(e),y.current?.(e))},[]);l.useEffect(()=>{if(o)return;const e=f.current.slice(0,t.length).filter(u=>u!==null);if(e.length===0)return;const s=()=>{v(m.findCurrentIndex(e,n,j))};s();const c=new IntersectionObserver(s,{root:n,rootMargin:m.activationRootMargin(j)});for(const u of e)c.observe(u);const a=n??document;return a.addEventListener("scrollend",s),()=>{c.disconnect(),a.removeEventListener("scrollend",s)}},[o,R,t.length,n,v]);const E=["aegis-scroll-story",o?"aegis-scroll-story--stacked":"",N??""].filter(Boolean).join(" ");return r.jsxs("div",{className:E,children:[r.jsx("ol",{className:"aegis-scroll-story__steps",children:t.map((e,s)=>{const c=!o&&s===i;return r.jsxs("li",{ref:a=>{f.current[s]=a},className:["aegis-scroll-story__step",c?"aegis-scroll-story__step--current":""].filter(Boolean).join(" "),"aria-current":c?"step":void 0,children:[r.jsx("span",{className:"aegis-scroll-story__index","aria-hidden":"true",children:String(s+1).padStart(2,"0")}),r.jsx("h3",{id:`${_}-${s}`,className:"aegis-scroll-story__title",children:e.title}),e.body!==void 0&&r.jsx("div",{className:"aegis-scroll-story__body",children:e.body}),o&&r.jsx(h.Panel,{children:e.visual})]},e.id)})}),!o&&t.length>0&&r.jsx("div",{className:"aegis-scroll-story__aside",children:r.jsx(h.Panel,{className:"aegis-scroll-story__panel",title:S.scrollStoryPosition(i+1,t.length),extra:r.jsx("span",{className:"aegis-scroll-story__dots","aria-hidden":"true",children:t.map((e,s)=>r.jsx("span",{className:["aegis-scroll-story__dot",s===i?"aegis-scroll-story__dot--current":""].filter(Boolean).join(" ")},e.id))}),children:r.jsx("div",{className:"aegis-scroll-story__visuals",children:t.map((e,s)=>r.jsx("div",{role:"group","aria-labelledby":`${_}-${s}`,className:["aegis-scroll-story__visual",s===i?"aegis-scroll-story__visual--current":""].filter(Boolean).join(" "),children:e.visual},e.id))})})})]})}exports.ScrollStory=p;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),l=require("react"),p=require("../../hooks/useMediaQuery.cjs"),m=require("../../lib/scrollView.cjs"),h=require("./Panel.cjs");;/* empty css */const q=require("../../locale/useStrings.cjs"),j=50,P="(max-width: 768px)";function T({steps:t,currentIndex:x,onCurrentChange:d,scrollContainer:n=null,panelSide:N="end",className:S}){const b=q.useStrings(),g=l.useId(),o=p.useMediaQuery(P),[I,R]=l.useState(0),y=l.useRef(0),_=l.useRef(d),f=l.useRef([]),i=x??I,E=t.map(e=>e.id).join(`
2
+ `);l.useEffect(()=>{_.current=d},[d]);const v=l.useCallback(e=>{e!==y.current&&(y.current=e,R(e),_.current?.(e))},[]);l.useEffect(()=>{if(o)return;const e=f.current.slice(0,t.length).filter(u=>u!==null);if(e.length===0)return;const s=()=>{v(m.findCurrentIndex(e,n,j))};s();const c=new IntersectionObserver(s,{root:n,rootMargin:m.activationRootMargin(j)});for(const u of e)c.observe(u);const a=n??document;return a.addEventListener("scrollend",s),()=>{c.disconnect(),a.removeEventListener("scrollend",s)}},[o,E,t.length,n,v]);const k=["aegis-scroll-story",o?"aegis-scroll-story--stacked":"",N==="start"?"aegis-scroll-story--panel-start":"",S??""].filter(Boolean).join(" ");return r.jsxs("div",{className:k,children:[r.jsx("ol",{className:"aegis-scroll-story__steps",children:t.map((e,s)=>{const c=!o&&s===i;return r.jsxs("li",{ref:a=>{f.current[s]=a},className:["aegis-scroll-story__step",c?"aegis-scroll-story__step--current":""].filter(Boolean).join(" "),"aria-current":c?"step":void 0,children:[r.jsx("span",{className:"aegis-scroll-story__index","aria-hidden":"true",children:String(s+1).padStart(2,"0")}),r.jsx("h3",{id:`${g}-${s}`,className:"aegis-scroll-story__title",children:e.title}),e.body!==void 0&&r.jsx("div",{className:"aegis-scroll-story__body",children:e.body}),o&&r.jsx(h.Panel,{children:e.visual})]},e.id)})}),!o&&t.length>0&&r.jsx("div",{className:"aegis-scroll-story__aside",children:r.jsx(h.Panel,{className:"aegis-scroll-story__panel",title:b.scrollStoryPosition(i+1,t.length),extra:r.jsx("span",{className:"aegis-scroll-story__dots","aria-hidden":"true",children:t.map((e,s)=>r.jsx("span",{className:["aegis-scroll-story__dot",s===i?"aegis-scroll-story__dot--current":""].filter(Boolean).join(" ")},e.id))}),children:r.jsx("div",{className:"aegis-scroll-story__visuals",children:t.map((e,s)=>r.jsx("div",{role:"group","aria-labelledby":`${g}-${s}`,className:["aegis-scroll-story__visual",s===i?"aegis-scroll-story__visual--current":""].filter(Boolean).join(" "),children:e.visual},e.id))})})})]})}exports.ScrollStory=T;
3
3
  //# sourceMappingURL=ScrollStory.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"ScrollStory.cjs","sources":["../../../src/components/ui/ScrollStory.tsx"],"sourcesContent":["import {\n type ReactElement,\n type ReactNode,\n useCallback,\n useEffect,\n useId,\n useRef,\n useState,\n} from 'react';\n\nimport { useMediaQuery } from '../../hooks/useMediaQuery';\nimport { activationRootMargin, findCurrentIndex } from '../../lib/scrollView';\nimport { useStrings } from '../../locale';\nimport { Panel } from './Panel';\nimport './ScrollStory.css';\n\nexport interface ScrollStoryStep {\n /** Stable key for the step. */\n id: string;\n /** Rendered as an `h3`, so place the story under an `h2`. */\n title: ReactNode;\n body?: ReactNode;\n /**\n * Shown in the pinned panel while the step is current; on narrow\n * screens it sits under the step's text instead. Screen readers and the\n * keyboard reach only the current step's visual, so anything a reader\n * must not miss belongs in `title` or `body`.\n */\n visual: ReactNode;\n}\n\nexport interface ScrollStoryProps {\n /** The steps in reading order. */\n steps: ScrollStoryStep[];\n /** Controls the current step; omit it to follow the scroll position. */\n currentIndex?: number;\n /** Called with the index that scrolling makes current. */\n onCurrentChange?: (index: number) => void;\n /** The element that scrolls the story; omitted or null means the viewport. */\n scrollContainer?: HTMLElement | null;\n className?: string;\n}\n\n/** A step becomes current once its top passes this share of the view. */\nconst ACTIVATION_PERCENT = 50;\nconst STACKED_QUERY = '(max-width: 768px)';\n\n/**\n * A story told in steps: the steps scroll as ordinary text on the left\n * while a panel on the right stays pinned in the view and shows the\n * current step's visual. At 768px and narrower the panel is dropped and\n * each visual follows its own step.\n */\nexport function ScrollStory({\n steps,\n currentIndex,\n onCurrentChange,\n scrollContainer = null,\n className,\n}: ScrollStoryProps): ReactElement {\n const strings = useStrings();\n const titleIdPrefix = useId();\n const stacked = useMediaQuery(STACKED_QUERY);\n const [trackedIndex, setTrackedIndex] = useState(0);\n const trackedIndexRef = useRef(0);\n const onCurrentChangeRef = useRef(onCurrentChange);\n const stepRefs = useRef<Array<HTMLLIElement | null>>([]);\n const activeIndex = currentIndex ?? trackedIndex;\n /* Changes when steps are swapped or reordered, which replaces their\n * elements even if the count stays the same. */\n const stepKey = steps.map((step) => step.id).join('\\n');\n\n useEffect(() => {\n onCurrentChangeRef.current = onCurrentChange;\n }, [onCurrentChange]);\n\n const track = useCallback((index: number): void => {\n if (index === trackedIndexRef.current) {\n return;\n }\n trackedIndexRef.current = index;\n setTrackedIndex(index);\n onCurrentChangeRef.current?.(index);\n }, []);\n\n useEffect(() => {\n if (stacked) {\n return undefined;\n }\n const elements = stepRefs.current\n .slice(0, steps.length)\n .filter((el): el is HTMLLIElement => el !== null);\n if (elements.length === 0) {\n return undefined;\n }\n const sync = (): void => {\n track(findCurrentIndex(elements, scrollContainer, ACTIVATION_PERCENT));\n };\n sync();\n const observer = new IntersectionObserver(sync, {\n root: scrollContainer,\n rootMargin: activationRootMargin(ACTIVATION_PERCENT),\n });\n for (const el of elements) {\n observer.observe(el);\n }\n /* A jump can skip the activation band without an intersection change,\n * and the end-of-scroll rule needs the settled position. */\n const scrollEvents: EventTarget = scrollContainer ?? document;\n scrollEvents.addEventListener('scrollend', sync);\n return () => {\n observer.disconnect();\n scrollEvents.removeEventListener('scrollend', sync);\n };\n }, [stacked, stepKey, steps.length, scrollContainer, track]);\n\n const rootClass = [\n 'aegis-scroll-story',\n stacked ? 'aegis-scroll-story--stacked' : '',\n className ?? '',\n ]\n .filter(Boolean)\n .join(' ');\n\n return (\n <div className={rootClass}>\n <ol className=\"aegis-scroll-story__steps\">\n {steps.map((step, index) => {\n const current = !stacked && index === activeIndex;\n return (\n <li\n key={step.id}\n ref={(node) => {\n stepRefs.current[index] = node;\n }}\n className={[\n 'aegis-scroll-story__step',\n current ? 'aegis-scroll-story__step--current' : '',\n ]\n .filter(Boolean)\n .join(' ')}\n aria-current={current ? 'step' : undefined}\n >\n <span className=\"aegis-scroll-story__index\" aria-hidden=\"true\">\n {String(index + 1).padStart(2, '0')}\n </span>\n <h3\n id={`${titleIdPrefix}-${index}`}\n className=\"aegis-scroll-story__title\"\n >\n {step.title}\n </h3>\n {step.body !== undefined && (\n <div className=\"aegis-scroll-story__body\">{step.body}</div>\n )}\n {stacked && <Panel>{step.visual}</Panel>}\n </li>\n );\n })}\n </ol>\n {!stacked && steps.length > 0 && (\n <div className=\"aegis-scroll-story__aside\">\n <Panel\n className=\"aegis-scroll-story__panel\"\n title={strings.scrollStoryPosition(activeIndex + 1, steps.length)}\n extra={\n <span className=\"aegis-scroll-story__dots\" aria-hidden=\"true\">\n {steps.map((step, index) => (\n <span\n key={step.id}\n className={[\n 'aegis-scroll-story__dot',\n index === activeIndex\n ? 'aegis-scroll-story__dot--current'\n : '',\n ]\n .filter(Boolean)\n .join(' ')}\n />\n ))}\n </span>\n }\n >\n <div className=\"aegis-scroll-story__visuals\">\n {steps.map((step, index) => (\n <div\n key={step.id}\n role=\"group\"\n aria-labelledby={`${titleIdPrefix}-${index}`}\n className={[\n 'aegis-scroll-story__visual',\n index === activeIndex\n ? 'aegis-scroll-story__visual--current'\n : '',\n ]\n .filter(Boolean)\n .join(' ')}\n >\n {step.visual}\n </div>\n ))}\n </div>\n </Panel>\n </div>\n )}\n </div>\n );\n}\n"],"names":["ACTIVATION_PERCENT","STACKED_QUERY","ScrollStory","steps","currentIndex","onCurrentChange","scrollContainer","className","strings","useStrings","titleIdPrefix","useId","stacked","useMediaQuery","trackedIndex","setTrackedIndex","useState","trackedIndexRef","useRef","onCurrentChangeRef","stepRefs","activeIndex","stepKey","step","useEffect","track","useCallback","index","elements","el","sync","findCurrentIndex","observer","activationRootMargin","scrollEvents","rootClass","jsxs","jsx","current","node","Panel"],"mappings":"kUA4CMA,EAAqB,GACrBC,EAAgB,qBAQf,SAASC,EAAY,CAC1B,MAAAC,EACA,aAAAC,EACA,gBAAAC,EACA,gBAAAC,EAAkB,KAClB,UAAAC,CACF,EAAmC,CACjC,MAAMC,EAAUC,EAAAA,WAAA,EACVC,EAAgBC,EAAAA,MAAA,EAChBC,EAAUC,EAAAA,cAAcZ,CAAa,EACrC,CAACa,EAAcC,CAAe,EAAIC,EAAAA,SAAS,CAAC,EAC5CC,EAAkBC,EAAAA,OAAO,CAAC,EAC1BC,EAAqBD,EAAAA,OAAOb,CAAe,EAC3Ce,EAAWF,EAAAA,OAAoC,EAAE,EACjDG,EAAcjB,GAAgBU,EAG9BQ,EAAUnB,EAAM,IAAKoB,GAASA,EAAK,EAAE,EAAE,KAAK;AAAA,CAAI,EAEtDC,EAAAA,UAAU,IAAM,CACdL,EAAmB,QAAUd,CAC/B,EAAG,CAACA,CAAe,CAAC,EAEpB,MAAMoB,EAAQC,cAAaC,GA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rollStory.cjs","sources":["../../../src/components/ui/ScrollStory.tsx"],"sourcesContent":["import {\n type ReactElement,\n type ReactNode,\n useCallback,\n useEffect,\n useId,\n useRef,\n useState,\n} from 'react';\n\nimport { useMediaQuery } from '../../hooks/useMediaQuery';\nimport { activationRootMargin, findCurrentIndex } from '../../lib/scrollView';\nimport { useStrings } from '../../locale';\nimport { Panel } from './Panel';\nimport './ScrollStory.css';\n\nexport interface ScrollStoryStep {\n /** Stable key for the step. */\n id: string;\n /** Rendered as an `h3`, so place the story under an `h2`. */\n title: ReactNode;\n body?: ReactNode;\n /**\n * Shown in the pinned panel while the step is current; on narrow\n * screens it sits under the step's text instead. Screen readers and the\n * keyboard reach only the current step's visual, so anything a reader\n * must not miss belongs in `title` or `body`.\n */\n visual: ReactNode;\n}\n\nexport interface ScrollStoryProps {\n /** The steps in reading order. */\n steps: ScrollStoryStep[];\n /** Controls the current step; omit it to follow the scroll position. */\n currentIndex?: number;\n /** Called with the index that scrolling makes current. */\n onCurrentChange?: (index: number) => void;\n /** The element that scrolls the story; omitted or null means the viewport. */\n scrollContainer?: HTMLElement | null;\n /** Which side the pinned panel stands on. Defaults to `end`. */\n panelSide?: 'start' | 'end';\n className?: string;\n}\n\n/** A step becomes current once its top passes this share of the view. */\nconst ACTIVATION_PERCENT = 50;\nconst STACKED_QUERY = '(max-width: 768px)';\n\n/**\n * A story told in steps: the steps scroll as ordinary text on the left\n * while a panel on the right stays pinned in the view and shows the\n * current step's visual. At 768px and narrower the panel is dropped and\n * each visual follows its own step.\n */\nexport function ScrollStory({\n steps,\n currentIndex,\n onCurrentChange,\n scrollContainer = null,\n panelSide = 'end',\n className,\n}: ScrollStoryProps): ReactElement {\n const strings = useStrings();\n const titleIdPrefix = useId();\n const stacked = useMediaQuery(STACKED_QUERY);\n const [trackedIndex, setTrackedIndex] = useState(0);\n const trackedIndexRef = useRef(0);\n const onCurrentChangeRef = useRef(onCurrentChange);\n const stepRefs = useRef<Array<HTMLLIElement | null>>([]);\n const activeIndex = currentIndex ?? trackedIndex;\n /* Changes when steps are swapped or reordered, which replaces their\n * elements even if the count stays the same. */\n const stepKey = steps.map((step) => step.id).join('\\n');\n\n useEffect(() => {\n onCurrentChangeRef.current = onCurrentChange;\n }, [onCurrentChange]);\n\n const track = useCallback((index: number): void => {\n if (index === trackedIndexRef.current) {\n return;\n }\n trackedIndexRef.current = index;\n setTrackedIndex(index);\n onCurrentChangeRef.current?.(index);\n }, []);\n\n useEffect(() => {\n if (stacked) {\n return undefined;\n }\n const elements = stepRefs.current\n .slice(0, steps.length)\n .filter((el): el is HTMLLIElement => el !== null);\n if (elements.length === 0) {\n return undefined;\n }\n const sync = (): void => {\n track(findCurrentIndex(elements, scrollContainer, ACTIVATION_PERCENT));\n };\n sync();\n const observer = new IntersectionObserver(sync, {\n root: scrollContainer,\n rootMargin: activationRootMargin(ACTIVATION_PERCENT),\n });\n for (const el of elements) {\n observer.observe(el);\n }\n /* A jump can skip the activation band without an intersection change,\n * and the end-of-scroll rule needs the settled position. */\n const scrollEvents: EventTarget = scrollContainer ?? document;\n scrollEvents.addEventListener('scrollend', sync);\n return () => {\n observer.disconnect();\n scrollEvents.removeEventListener('scrollend', sync);\n };\n }, [stacked, stepKey, steps.length, scrollContainer, track]);\n\n const rootClass = [\n 'aegis-scroll-story',\n stacked ? 'aegis-scroll-story--stacked' : '',\n panelSide === 'start' ? 'aegis-scroll-story--panel-start' : '',\n className ?? '',\n ]\n .filter(Boolean)\n .join(' ');\n\n return (\n <div className={rootClass}>\n <ol className=\"aegis-scroll-story__steps\">\n {steps.map((step, index) => {\n const current = !stacked && index === activeIndex;\n return (\n <li\n key={step.id}\n ref={(node) => {\n stepRefs.current[index] = node;\n }}\n className={[\n 'aegis-scroll-story__step',\n current ? 'aegis-scroll-story__step--current' : '',\n ]\n .filter(Boolean)\n .join(' ')}\n aria-current={current ? 'step' : undefined}\n >\n <span className=\"aegis-scroll-story__index\" aria-hidden=\"true\">\n {String(index + 1).padStart(2, '0')}\n </span>\n <h3\n id={`${titleIdPrefix}-${index}`}\n className=\"aegis-scroll-story__title\"\n >\n {step.title}\n </h3>\n {step.body !== undefined && (\n <div className=\"aegis-scroll-story__body\">{step.body}</div>\n )}\n {stacked && <Panel>{step.visual}</Panel>}\n </li>\n );\n })}\n </ol>\n {!stacked && steps.length > 0 && (\n <div className=\"aegis-scroll-story__aside\">\n <Panel\n className=\"aegis-scroll-story__panel\"\n title={strings.scrollStoryPosition(activeIndex + 1, steps.length)}\n extra={\n <span className=\"aegis-scroll-story__dots\" aria-hidden=\"true\">\n {steps.map((step, index) => (\n <span\n key={step.id}\n className={[\n 'aegis-scroll-story__dot',\n index === activeIndex\n ? 'aegis-scroll-story__dot--current'\n : '',\n ]\n .filter(Boolean)\n .join(' ')}\n />\n ))}\n </span>\n }\n >\n <div className=\"aegis-scroll-story__visuals\">\n {steps.map((step, index) => (\n <div\n key={step.id}\n role=\"group\"\n aria-labelledby={`${titleIdPrefix}-${index}`}\n className={[\n 'aegis-scroll-story__visual',\n index === activeIndex\n ? 'aegis-scroll-story__visual--current'\n : '',\n ]\n .filter(Boolean)\n .join(' ')}\n >\n {step.visual}\n </div>\n ))}\n </div>\n </Panel>\n </div>\n )}\n </div>\n );\n}\n"],"names":["ACTIVATION_PERCENT","STACKED_QUERY","ScrollStory","steps","currentIndex","onCurrentChange","scrollContainer","panelSide","className","strings","useStrings","titleIdPrefix","useId","stacked","useMediaQuery","trackedIndex","setTrackedIndex","useState","trackedIndexRef","useRef","onCurrentChangeRef","stepRefs","activeIndex","stepKey","step","useEffect","track","useCallback","index","elements","el","sync","findCurrentIndex","observer","activationRootMargin","scrollEvents","rootClass","jsxs","jsx","current","node","Panel"],"mappings":"kUA8CMA,EAAqB,GACrBC,EAAgB,qBAQf,SAASC,EAAY,CAC1B,MAAAC,EACA,aAAAC,EACA,gBAAAC,EACA,gBAAAC,EAAkB,KAClB,UAAAC,EAAY,MACZ,UAAAC,CACF,EAAmC,CACjC,MAAMC,EAAUC,E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C,UAAW,CACT,0BACAV,IAAUN,EACN,mCACA,EAAA,EAEH,OAAO,OAAO,EACd,KAAK,GAAG,CAAA,EARNE,EAAK,EAAA,CAUb,EACH,EAGF,SAAAc,EAAAA,IAAC,OAAI,UAAU,8BACZ,WAAM,IAAI,CAACd,EAAMI,IAChBU,EAAAA,IAAC,MAAA,CAEC,KAAK,QACL,kBAAiB,GAAG3B,CAAa,IAAIiB,CAAK,GAC1C,UAAW,CACT,6BACAA,IAAUN,EACN,sCACA,EAAA,EAEH,OAAO,OAAO,EACd,KAAK,GAAG,EAEV,SAAAE,EAAK,MAAA,EAZDA,EAAK,EAAA,CAcb,CAAA,CACH,CAAA,CAAA,CACF,CACF,CAAA,EAEJ,CAEJ"}
@@ -22,6 +22,8 @@ export interface ScrollStoryProps {
22
22
  onCurrentChange?: (index: number) => void;
23
23
  /** The element that scrolls the story; omitted or null means the viewport. */
24
24
  scrollContainer?: HTMLElement | null;
25
+ /** Which side the pinned panel stands on. Defaults to `end`. */
26
+ panelSide?: 'start' | 'end';
25
27
  className?: string;
26
28
  }
27
29
  /**
@@ -30,4 +32,4 @@ export interface ScrollStoryProps {
30
32
  * current step's visual. At 768px and narrower the panel is dropped and
31
33
  * each visual follows its own step.
32
34
  */
33
- export declare function ScrollStory({ steps, currentIndex, onCurrentChange, scrollContainer, className, }: ScrollStoryProps): ReactElement;
35
+ export declare function ScrollStory({ steps, currentIndex, onCurrentChange, scrollContainer, panelSide, className, }: ScrollStoryProps): ReactElement;
@@ -1,39 +1,40 @@
1
1
  import { jsxs as v, jsx as s } from "react/jsx-runtime";
2
- import { useId as x, useState as T, useRef as u, useEffect as h, useCallback as B } from "react";
3
- import { useMediaQuery as P } from "../../hooks/useMediaQuery.js";
4
- import { activationRootMargin as $, findCurrentIndex as A } from "../../lib/scrollView.js";
5
- import { Panel as N } from "./Panel.js";
2
+ import { useId as T, useState as B, useRef as u, useEffect as h, useCallback as P } from "react";
3
+ import { useMediaQuery as $ } from "../../hooks/useMediaQuery.js";
4
+ import { activationRootMargin as A, findCurrentIndex as M } from "../../lib/scrollView.js";
5
+ import { Panel as p } from "./Panel.js";
6
6
  /* empty css */
7
- import { useStrings as M } from "../../locale/useStrings.js";
8
- const p = 50, w = "(max-width: 768px)";
9
- function V({
10
- steps: o,
7
+ import { useStrings as w } from "../../locale/useStrings.js";
8
+ const N = 50, K = "(max-width: 768px)";
9
+ function Y({
10
+ steps: t,
11
11
  currentIndex: I,
12
12
  onCurrentChange: a,
13
13
  scrollContainer: i = null,
14
- className: b
14
+ panelSide: b = "end",
15
+ className: E
15
16
  }) {
16
- const E = M(), m = x(), t = P(w), [S, j] = T(0), _ = u(0), f = u(a), g = u([]), c = I ?? S, k = o.map((r) => r.id).join(`
17
+ const S = w(), m = T(), o = $(K), [j, k] = B(0), _ = u(0), g = u(a), f = u([]), c = I ?? j, R = t.map((r) => r.id).join(`
17
18
  `);
18
19
  h(() => {
19
- f.current = a;
20
+ g.current = a;
20
21
  }, [a]);
21
- const y = B((r) => {
22
- r !== _.current && (_.current = r, j(r), f.current?.(r));
22
+ const y = P((r) => {
23
+ r !== _.current && (_.current = r, k(r), g.current?.(r));
23
24
  }, []);
24
25
  h(() => {
25
- if (t)
26
+ if (o)
26
27
  return;
27
- const r = g.current.slice(0, o.length).filter((d) => d !== null);
28
+ const r = f.current.slice(0, t.length).filter((d) => d !== null);
28
29
  if (r.length === 0)
29
30
  return;
30
31
  const e = () => {
31
- y(A(r, i, p));
32
+ y(M(r, i, N));
32
33
  };
33
34
  e();
34
35
  const l = new IntersectionObserver(e, {
35
36
  root: i,
36
- rootMargin: $(p)
37
+ rootMargin: A(N)
37
38
  });
38
39
  for (const d of r)
39
40
  l.observe(d);
@@ -41,20 +42,21 @@ function V({
41
42
  return n.addEventListener("scrollend", e), () => {
42
43
  l.disconnect(), n.removeEventListener("scrollend", e);
43
44
  };
44
- }, [t, k, o.length, i, y]);
45
- const R = [
45
+ }, [o, R, t.length, i, y]);
46
+ const x = [
46
47
  "aegis-scroll-story",
47
- t ? "aegis-scroll-story--stacked" : "",
48
- b ?? ""
48
+ o ? "aegis-scroll-story--stacked" : "",
49
+ b === "start" ? "aegis-scroll-story--panel-start" : "",
50
+ E ?? ""
49
51
  ].filter(Boolean).join(" ");
50
- return /* @__PURE__ */ v("div", { className: R, children: [
51
- /* @__PURE__ */ s("ol", { className: "aegis-scroll-story__steps", children: o.map((r, e) => {
52
- const l = !t && e === c;
52
+ return /* @__PURE__ */ v("div", { className: x, children: [
53
+ /* @__PURE__ */ s("ol", { className: "aegis-scroll-story__steps", children: t.map((r, e) => {
54
+ const l = !o && e === c;
53
55
  return /* @__PURE__ */ v(
54
56
  "li",
55
57
  {
56
58
  ref: (n) => {
57
- g.current[e] = n;
59
+ f.current[e] = n;
58
60
  },
59
61
  className: [
60
62
  "aegis-scroll-story__step",
@@ -72,18 +74,18 @@ function V({
72
74
  }
73
75
  ),
74
76
  r.body !== void 0 && /* @__PURE__ */ s("div", { className: "aegis-scroll-story__body", children: r.body }),
75
- t && /* @__PURE__ */ s(N, { children: r.visual })
77
+ o && /* @__PURE__ */ s(p, { children: r.visual })
76
78
  ]
77
79
  },
78
80
  r.id
79
81
  );
80
82
  }) }),
81
- !t && o.length > 0 && /* @__PURE__ */ s("div", { className: "aegis-scroll-story__aside", children: /* @__PURE__ */ s(
82
- N,
83
+ !o && t.length > 0 && /* @__PURE__ */ s("div", { className: "aegis-scroll-story__aside", children: /* @__PURE__ */ s(
84
+ p,
83
85
  {
84
86
  className: "aegis-scroll-story__panel",
85
- title: E.scrollStoryPosition(c + 1, o.length),
86
- extra: /* @__PURE__ */ s("span", { className: "aegis-scroll-story__dots", "aria-hidden": "true", children: o.map((r, e) => /* @__PURE__ */ s(
87
+ title: S.scrollStoryPosition(c + 1, t.length),
88
+ extra: /* @__PURE__ */ s("span", { className: "aegis-scroll-story__dots", "aria-hidden": "true", children: t.map((r, e) => /* @__PURE__ */ s(
87
89
  "span",
88
90
  {
89
91
  className: [
@@ -93,7 +95,7 @@ function V({
93
95
  },
94
96
  r.id
95
97
  )) }),
96
- children: /* @__PURE__ */ s("div", { className: "aegis-scroll-story__visuals", children: o.map((r, e) => /* @__PURE__ */ s(
98
+ children: /* @__PURE__ */ s("div", { className: "aegis-scroll-story__visuals", children: t.map((r, e) => /* @__PURE__ */ s(
97
99
  "div",
98
100
  {
99
101
  role: "group",
@@ -111,6 +113,6 @@ function V({
111
113
  ] });
112
114
  }
113
115
  export {
114
- V as ScrollStory
116
+ Y as ScrollStory
115
117
  };
116
118
  //# sourceMappingURL=ScrollStory.js.map