@graphlearning/shell 0.10.1 → 0.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ConceptApp.d.ts +1 -1
- package/dist/CourseIndex.d.ts +2 -2
- package/dist/SectionView.d.ts +11 -11
- package/dist/ThemeToggle.d.ts +1 -0
- package/dist/index.js +233 -313
- package/dist/index.js.map +1 -1
- package/dist/styles.css +70 -233
- package/dist/types.d.ts +4 -3
- package/dist/useTheme.d.ts +0 -12
- package/package.json +1 -1
- package/scripts/_paths.mjs +106 -38
- package/scripts/capture-shots.mjs +1 -14
- package/scripts/gen-audio-manifest.mjs +2 -30
- package/scripts/gen-descriptions.mjs +5 -73
- package/scripts/record-all.mjs +1 -53
- package/scripts/record-course.mjs +6 -168
- package/scripts/record-reels.mjs +5 -139
- package/scripts/shots-4k.mjs +6 -7
- package/scripts/thumb-template.html +4 -11
- package/scripts/thumb.mjs +10 -105
package/dist/index.js
CHANGED
|
@@ -1,60 +1,52 @@
|
|
|
1
|
-
import { jsx as t, jsxs as
|
|
2
|
-
import { useRef as
|
|
3
|
-
import { SceneView as
|
|
4
|
-
import { Home as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
return e.sections.map((a) => ({ section: a, slug: X(e, a) }));
|
|
12
|
-
}
|
|
13
|
-
const G = 806;
|
|
14
|
-
function re() {
|
|
15
|
-
const e = T(null), [a, s] = b(1);
|
|
16
|
-
return O(() => {
|
|
1
|
+
import { jsx as t, jsxs as d, Fragment as R } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as S, useState as x, useLayoutEffect as J, useEffect as k, useCallback as I, useMemo as C } from "react";
|
|
3
|
+
import { SceneView as V } from "@graphlearning/flow";
|
|
4
|
+
import { Home as Q, Volume2 as U, VolumeX as ee, Moon as te, Sun as ne, ChevronLeft as ae, ChevronRight as re } from "lucide-react";
|
|
5
|
+
import se from "react-markdown";
|
|
6
|
+
import oe from "remark-gfm";
|
|
7
|
+
const X = (e, a) => `${e.id}-${a.id}`, z = (e) => e.sections.map((a) => ({ section: a, slug: X(e, a) })), G = 806;
|
|
8
|
+
function ie() {
|
|
9
|
+
const e = S(null), [a, r] = x(1);
|
|
10
|
+
return J(() => {
|
|
17
11
|
const o = e.current;
|
|
18
12
|
if (!o) return;
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
const g = new ResizeObserver(
|
|
13
|
+
const c = () => r(o.clientWidth / G);
|
|
14
|
+
c();
|
|
15
|
+
const g = new ResizeObserver(c);
|
|
22
16
|
return g.observe(o), () => g.disconnect();
|
|
23
17
|
}, []), { ref: e, zoom: a };
|
|
24
18
|
}
|
|
25
|
-
function
|
|
26
|
-
const { ref:
|
|
27
|
-
return /* @__PURE__ */ t("aside", { ref:
|
|
19
|
+
function ce({ slide: e, open: a }) {
|
|
20
|
+
const { ref: r, zoom: o } = ie();
|
|
21
|
+
return /* @__PURE__ */ t("aside", { ref: r, className: `slide-panel${a ? " slide-panel--open" : ""}`, children: /* @__PURE__ */ t("div", { className: "slide-panel__scaler", style: { width: G, zoom: o }, children: /* @__PURE__ */ t(se, { remarkPlugins: [oe], children: e }) }) });
|
|
28
22
|
}
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
23
|
+
const j = 10, H = ["loadedmetadata", "durationchange", "timeupdate", "seeked", "ended", "emptied", "error"], A = (e) => {
|
|
24
|
+
const a = Number.isFinite(e) && e > 0 ? e : 0;
|
|
25
|
+
return `${Math.floor(a / 60)}:${String(Math.floor(a % 60)).padStart(2, "0")}`;
|
|
26
|
+
};
|
|
27
|
+
function le({ audio: e }) {
|
|
28
|
+
const [a, r] = x(0), [o, c] = x(0);
|
|
32
29
|
if (k(() => {
|
|
33
30
|
if (!e) return;
|
|
34
31
|
const n = () => {
|
|
35
|
-
|
|
32
|
+
r(e.currentTime), c(Number.isFinite(e.duration) ? e.duration : 0);
|
|
36
33
|
};
|
|
37
|
-
n();
|
|
38
|
-
const u = ["loadedmetadata", "durationchange", "timeupdate", "seeked", "ended", "emptied", "error"];
|
|
39
|
-
return u.forEach((r) => e.addEventListener(r, n)), () => u.forEach((r) => e.removeEventListener(r, n));
|
|
34
|
+
return n(), H.forEach((u) => e.addEventListener(u, n)), () => H.forEach((u) => e.removeEventListener(u, n));
|
|
40
35
|
}, [e]), !e || !o) return null;
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
const
|
|
45
|
-
|
|
36
|
+
const g = (n) => {
|
|
37
|
+
e.currentTime = Math.min(o, Math.max(0, n)), r(e.currentTime);
|
|
38
|
+
}, h = (n, u) => {
|
|
39
|
+
const { left: s, width: m } = n.getBoundingClientRect();
|
|
40
|
+
g((u - s) / m * o);
|
|
46
41
|
}, l = (n) => {
|
|
47
|
-
const u =
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}, p = `${Math.min(100, a / o * 100)}%`;
|
|
52
|
-
return /* @__PURE__ */ h("span", { className: "reel-foot__audio", children: [
|
|
42
|
+
const u = { ArrowLeft: -j, ArrowRight: j, Home: -o, End: o }[n.key];
|
|
43
|
+
u !== void 0 && (n.preventDefault(), n.stopPropagation(), g(e.currentTime + u));
|
|
44
|
+
}, _ = `${Math.min(100, a / o * 100)}%`;
|
|
45
|
+
return /* @__PURE__ */ d("span", { className: "reel-foot__audio", children: [
|
|
53
46
|
/* @__PURE__ */ t("span", { className: "reel-foot__count reel-foot__time", children: A(a) }),
|
|
54
|
-
/* @__PURE__ */
|
|
47
|
+
/* @__PURE__ */ d(
|
|
55
48
|
"div",
|
|
56
49
|
{
|
|
57
|
-
ref: g,
|
|
58
50
|
className: "reel-foot__track",
|
|
59
51
|
role: "slider",
|
|
60
52
|
tabIndex: 0,
|
|
@@ -65,388 +57,316 @@ function ie({ audio: e }) {
|
|
|
65
57
|
"aria-valuetext": `${A(a)} of ${A(o)}`,
|
|
66
58
|
onKeyDown: l,
|
|
67
59
|
onPointerDown: (n) => {
|
|
68
|
-
n.currentTarget.setPointerCapture(n.pointerId),
|
|
60
|
+
n.currentTarget.setPointerCapture(n.pointerId), h(n.currentTarget, n.clientX);
|
|
69
61
|
},
|
|
70
62
|
onPointerMove: (n) => {
|
|
71
|
-
n.currentTarget.hasPointerCapture(n.pointerId) &&
|
|
63
|
+
n.currentTarget.hasPointerCapture(n.pointerId) && h(n.currentTarget, n.clientX);
|
|
72
64
|
},
|
|
73
65
|
children: [
|
|
74
|
-
/* @__PURE__ */ t("span", { className: "reel-foot__fill", style: { width:
|
|
75
|
-
/* @__PURE__ */ t("span", { className: "reel-foot__thumb", style: { left:
|
|
66
|
+
/* @__PURE__ */ t("span", { className: "reel-foot__fill", style: { width: _ } }),
|
|
67
|
+
/* @__PURE__ */ t("span", { className: "reel-foot__thumb", style: { left: _ } })
|
|
76
68
|
]
|
|
77
69
|
}
|
|
78
70
|
),
|
|
79
71
|
/* @__PURE__ */ t("span", { className: "reel-foot__count reel-foot__time", children: A(o) })
|
|
80
72
|
] });
|
|
81
73
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
74
|
+
const D = {
|
|
75
|
+
dark: { glyph: "☾", label: "Dark theme" },
|
|
76
|
+
light: { glyph: "☀", label: "Light theme" }
|
|
77
|
+
}, q = (e) => {
|
|
78
|
+
const a = e === "dark" ? "light" : "dark";
|
|
79
|
+
return `${D[e].label}. Switch to ${D[a].label.toLowerCase()}.`;
|
|
80
|
+
};
|
|
81
|
+
function de({ theme: e, onToggle: a }) {
|
|
82
|
+
const r = q(e);
|
|
83
|
+
return /* @__PURE__ */ t("button", { className: "site__icon", type: "button", onClick: a, "aria-label": r, title: r, children: D[e].glyph });
|
|
85
84
|
}
|
|
86
|
-
|
|
85
|
+
const E = (e) => ({ "aria-label": e, title: e });
|
|
86
|
+
function he({
|
|
87
87
|
section: e,
|
|
88
88
|
getScene: a,
|
|
89
|
-
capture:
|
|
89
|
+
capture: r,
|
|
90
90
|
eyebrow: o,
|
|
91
|
-
index:
|
|
92
|
-
total: g
|
|
93
|
-
onHome:
|
|
91
|
+
index: c,
|
|
92
|
+
total: g,
|
|
93
|
+
onHome: h,
|
|
94
94
|
onPrev: l,
|
|
95
|
-
onNext:
|
|
96
|
-
narrating: n
|
|
95
|
+
onNext: _,
|
|
96
|
+
narrating: n,
|
|
97
97
|
onToggleNarration: u,
|
|
98
|
-
narrationAudio:
|
|
99
|
-
theme: m
|
|
100
|
-
onToggleTheme:
|
|
98
|
+
narrationAudio: s,
|
|
99
|
+
theme: m,
|
|
100
|
+
onToggleTheme: N
|
|
101
101
|
}) {
|
|
102
|
-
const [
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
102
|
+
const [p, w] = x(!1), $ = a(e.scene);
|
|
103
|
+
if (!$) return /* @__PURE__ */ d("div", { className: "stage stage--missing", children: [
|
|
104
|
+
"no scene: ",
|
|
105
|
+
e.scene
|
|
106
|
+
] });
|
|
107
|
+
const T = m === "dark";
|
|
108
|
+
return /* @__PURE__ */ d("div", { className: "stage stage--section", children: [
|
|
109
|
+
/* @__PURE__ */ d("header", { className: "reel-head", children: [
|
|
110
|
+
/* @__PURE__ */ t("button", { className: "reel-head__eyebrow", onClick: h, ...E("Back to catalog (Esc)"), children: o }),
|
|
106
111
|
/* @__PURE__ */ t("h1", { className: "reel-head__title", children: e.title })
|
|
107
112
|
] }),
|
|
108
|
-
!
|
|
109
|
-
/* @__PURE__ */
|
|
110
|
-
/* @__PURE__ */ t("button", { className: "reel-foot__ctrl", onClick:
|
|
113
|
+
!r && /* @__PURE__ */ d("footer", { className: "reel-foot reel-foot--controls", children: [
|
|
114
|
+
/* @__PURE__ */ d("span", { className: "reel-foot__grp", children: [
|
|
115
|
+
/* @__PURE__ */ t("button", { className: "reel-foot__ctrl", onClick: h, ...E("Back to catalog (Esc)"), children: /* @__PURE__ */ t(Q, { size: 17 }) }),
|
|
111
116
|
/* @__PURE__ */ t(
|
|
112
117
|
"button",
|
|
113
118
|
{
|
|
114
119
|
className: "reel-foot__ctrl",
|
|
115
120
|
onClick: u,
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
children: n ? /* @__PURE__ */ t(Z, { size: 18 }) : /* @__PURE__ */ t(J, { size: 18 })
|
|
121
|
+
...E(n ? "Pause narration (Space)" : "Play narration (Space)"),
|
|
122
|
+
children: n ? /* @__PURE__ */ t(U, { size: 18 }) : /* @__PURE__ */ t(ee, { size: 18 })
|
|
119
123
|
}
|
|
120
124
|
),
|
|
121
|
-
|
|
122
|
-
"button",
|
|
123
|
-
{
|
|
124
|
-
className: "reel-foot__ctrl",
|
|
125
|
-
onClick: v,
|
|
126
|
-
"aria-label": m === "dark" ? "Dark theme. Switch to light theme." : "Light theme. Switch to dark theme.",
|
|
127
|
-
title: m === "dark" ? "Dark theme. Switch to light theme." : "Light theme. Switch to dark theme.",
|
|
128
|
-
children: m === "dark" ? /* @__PURE__ */ t(Q, { size: 17 }) : /* @__PURE__ */ t(U, { size: 17 })
|
|
129
|
-
}
|
|
130
|
-
)
|
|
125
|
+
N && /* @__PURE__ */ t("button", { className: "reel-foot__ctrl", onClick: N, ...E(q(m)), children: T ? /* @__PURE__ */ t(te, { size: 17 }) : /* @__PURE__ */ t(ne, { size: 17 }) })
|
|
131
126
|
] }),
|
|
132
|
-
/* @__PURE__ */ t(
|
|
133
|
-
/* @__PURE__ */
|
|
134
|
-
/* @__PURE__ */ t("button", { className: "reel-foot__ctrl", onClick: l, "
|
|
135
|
-
/* @__PURE__ */
|
|
136
|
-
|
|
127
|
+
/* @__PURE__ */ t(le, { audio: s }),
|
|
128
|
+
/* @__PURE__ */ d("span", { className: "reel-foot__nav", children: [
|
|
129
|
+
/* @__PURE__ */ t("button", { className: "reel-foot__ctrl", onClick: l, ...E("Previous section (Shift+←)"), children: /* @__PURE__ */ t(ae, { size: 19 }) }),
|
|
130
|
+
/* @__PURE__ */ d("span", { className: "reel-foot__count reel-foot__count--live", children: [
|
|
131
|
+
c + 1,
|
|
137
132
|
" / ",
|
|
138
133
|
g
|
|
139
134
|
] }),
|
|
140
|
-
/* @__PURE__ */ t("button", { className: "reel-foot__ctrl", onClick:
|
|
135
|
+
/* @__PURE__ */ t("button", { className: "reel-foot__ctrl", onClick: _, ...E("Next section (Shift+→)"), children: /* @__PURE__ */ t(re, { size: 19 }) })
|
|
141
136
|
] })
|
|
142
137
|
] }),
|
|
143
|
-
/* @__PURE__ */ t("div", { className: "scene-area", children: /* @__PURE__ */ t(
|
|
144
|
-
!
|
|
145
|
-
|
|
146
|
-
{
|
|
147
|
-
className: "slide-toggle",
|
|
148
|
-
onClick: () => w((S) => !S),
|
|
149
|
-
"aria-label": _ ? "Hide slide" : "Show slide",
|
|
150
|
-
children: _ ? "›" : "‹"
|
|
151
|
-
}
|
|
152
|
-
),
|
|
153
|
-
/* @__PURE__ */ t(se, { slide: e.slide, open: _ })
|
|
154
|
-
] }) : /* @__PURE__ */ h("div", { className: "stage stage--missing", children: [
|
|
155
|
-
"no scene: ",
|
|
156
|
-
e.scene
|
|
138
|
+
/* @__PURE__ */ t("div", { className: "scene-area", children: /* @__PURE__ */ t(V, { scene: $, focusId: e.focus, theme: m }) }),
|
|
139
|
+
!r && /* @__PURE__ */ t("button", { className: "slide-toggle", onClick: () => w((y) => !y), "aria-label": p ? "Hide slide" : "Show slide", children: p ? "›" : "‹" }),
|
|
140
|
+
/* @__PURE__ */ t(ce, { slide: e.slide, open: p })
|
|
157
141
|
] });
|
|
158
142
|
}
|
|
159
|
-
const
|
|
143
|
+
const ue = [
|
|
160
144
|
{ id: "courses", label: "Courses" },
|
|
161
145
|
{ id: "labs", label: "Labs" },
|
|
162
146
|
{ id: "coach", label: "Coach" }
|
|
163
147
|
];
|
|
164
|
-
function
|
|
165
|
-
return /* @__PURE__ */
|
|
148
|
+
function me() {
|
|
149
|
+
return /* @__PURE__ */ d("svg", { className: "site__logo", width: "28", height: "28", viewBox: "0 0 512 512", "aria-hidden": "true", children: [
|
|
166
150
|
/* @__PURE__ */ t("rect", { width: "512", height: "512", rx: "80", fill: "#e8804f" }),
|
|
167
|
-
/* @__PURE__ */
|
|
151
|
+
/* @__PURE__ */ d("g", { fill: "none", stroke: "#ffffff", strokeWidth: "58", strokeLinecap: "butt", strokeLinejoin: "miter", children: [
|
|
168
152
|
/* @__PURE__ */ t("path", { d: "M 373 200 A 130 130 0 1 0 373 312" }),
|
|
169
153
|
/* @__PURE__ */ t("path", { d: "M 283 312 L 373 312 L 373 410" })
|
|
170
154
|
] })
|
|
171
155
|
] });
|
|
172
156
|
}
|
|
173
|
-
function
|
|
157
|
+
function fe({
|
|
174
158
|
kind: e = "courses",
|
|
175
|
-
nav: a =
|
|
176
|
-
home:
|
|
159
|
+
nav: a = ue,
|
|
160
|
+
home: r = "/",
|
|
177
161
|
actions: o
|
|
178
162
|
}) {
|
|
179
|
-
return /* @__PURE__ */ t("header", { className: "site", children: /* @__PURE__ */
|
|
180
|
-
/* @__PURE__ */
|
|
181
|
-
/* @__PURE__ */ t(
|
|
163
|
+
return /* @__PURE__ */ t("header", { className: "site", children: /* @__PURE__ */ d("div", { className: "site__inner", children: [
|
|
164
|
+
/* @__PURE__ */ d("a", { className: "site__brand", href: r, children: [
|
|
165
|
+
/* @__PURE__ */ t(me, {}),
|
|
182
166
|
/* @__PURE__ */ t("span", { className: "site__name", children: "GraphL" })
|
|
183
167
|
] }),
|
|
184
|
-
/* @__PURE__ */ t("nav", { className: "site__nav", "aria-label": "Sections", children: a.map((
|
|
185
|
-
"a",
|
|
186
|
-
{
|
|
187
|
-
className: "site__link",
|
|
188
|
-
href: `${s}#${d.id}`,
|
|
189
|
-
...d.id === e ? { "aria-current": "page" } : {},
|
|
190
|
-
children: d.label
|
|
191
|
-
},
|
|
192
|
-
d.id
|
|
193
|
-
)) }),
|
|
168
|
+
/* @__PURE__ */ t("nav", { className: "site__nav", "aria-label": "Sections", children: a.map((c) => /* @__PURE__ */ t("a", { className: "site__link", href: `${r}#${c.id}`, "aria-current": c.id === e ? "page" : void 0, children: c.label }, c.id)) }),
|
|
194
169
|
/* @__PURE__ */ t("div", { className: "site__actions", children: o })
|
|
195
170
|
] }) });
|
|
196
171
|
}
|
|
197
|
-
function
|
|
172
|
+
function ge({
|
|
198
173
|
courses: e,
|
|
199
174
|
subject: a,
|
|
200
|
-
kind:
|
|
175
|
+
kind: r,
|
|
201
176
|
actions: o
|
|
202
177
|
}) {
|
|
203
|
-
const [
|
|
204
|
-
const n = new Set(
|
|
205
|
-
return n.
|
|
178
|
+
const [c, g] = x(/* @__PURE__ */ new Set()), h = (l) => g((_) => {
|
|
179
|
+
const n = new Set(_);
|
|
180
|
+
return n.delete(l) || n.add(l), n;
|
|
206
181
|
});
|
|
207
|
-
return (
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
"
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
] }) }, m)) })
|
|
240
|
-
] }, l.id);
|
|
241
|
-
}) }),
|
|
242
|
-
/* @__PURE__ */ t("footer", { className: "idx__foot", children: /* @__PURE__ */ h("span", { className: "idx__hint", children: [
|
|
243
|
-
/* @__PURE__ */ t("kbd", { children: "→" }),
|
|
244
|
-
" next · ",
|
|
245
|
-
/* @__PURE__ */ t("kbd", { children: "←" }),
|
|
246
|
-
" prev · ",
|
|
247
|
-
/* @__PURE__ */ t("kbd", { children: "Space" }),
|
|
248
|
-
" narration"
|
|
249
|
-
] }) })
|
|
250
|
-
] })
|
|
182
|
+
return /* @__PURE__ */ d(R, { children: [
|
|
183
|
+
/* @__PURE__ */ t(fe, { kind: r, actions: o }),
|
|
184
|
+
/* @__PURE__ */ d("div", { className: "idx", children: [
|
|
185
|
+
/* @__PURE__ */ t("header", { className: "idx__head", children: /* @__PURE__ */ t("h1", { className: "idx__subject", children: a }) }),
|
|
186
|
+
e.length === 0 ? /* @__PURE__ */ t("p", { className: "idx__empty", children: "No courses authored yet — the app shell is ready." }) : /* @__PURE__ */ t("ol", { className: "idx__grid", children: e.map((l, _) => {
|
|
187
|
+
const n = z(l), u = c.has(l.id);
|
|
188
|
+
return /* @__PURE__ */ d("li", { className: `idx-card${u ? " idx-card--open" : ""}`, children: [
|
|
189
|
+
/* @__PURE__ */ d("button", { className: "idx-card__head", onClick: () => h(l.id), "aria-expanded": u, children: [
|
|
190
|
+
/* @__PURE__ */ t("span", { className: "idx-card__num", children: String(_ + 1).padStart(2, "0") }),
|
|
191
|
+
/* @__PURE__ */ t("span", { className: "idx-card__title", children: l.title }),
|
|
192
|
+
/* @__PURE__ */ d("span", { className: "idx-card__count", children: [
|
|
193
|
+
n.length,
|
|
194
|
+
" ",
|
|
195
|
+
n.length === 1 ? "section" : "sections"
|
|
196
|
+
] }),
|
|
197
|
+
/* @__PURE__ */ t("span", { className: "idx-card__toggle", "aria-hidden": "true", children: "⌄" })
|
|
198
|
+
] }),
|
|
199
|
+
u && /* @__PURE__ */ t("ol", { className: "idx-sec", children: n.map(({ section: s, slug: m }, N) => /* @__PURE__ */ t("li", { className: "idx-sec__row", children: /* @__PURE__ */ d("a", { href: `#/${m}`, children: [
|
|
200
|
+
/* @__PURE__ */ t("span", { className: "idx-sec__num", children: N + 1 }),
|
|
201
|
+
/* @__PURE__ */ t("span", { className: "idx-sec__title", children: s.title }),
|
|
202
|
+
/* @__PURE__ */ t("span", { className: "idx-sec__chev", "aria-hidden": "true", children: "›" })
|
|
203
|
+
] }) }, m)) })
|
|
204
|
+
] }, l.id);
|
|
205
|
+
}) }),
|
|
206
|
+
/* @__PURE__ */ t("footer", { className: "idx__foot", children: /* @__PURE__ */ d("span", { className: "idx__hint", children: [
|
|
207
|
+
/* @__PURE__ */ t("kbd", { children: "→" }),
|
|
208
|
+
" next · ",
|
|
209
|
+
/* @__PURE__ */ t("kbd", { children: "←" }),
|
|
210
|
+
" prev · ",
|
|
211
|
+
/* @__PURE__ */ t("kbd", { children: "Space" }),
|
|
212
|
+
" narration"
|
|
213
|
+
] }) })
|
|
251
214
|
] })
|
|
252
|
-
);
|
|
215
|
+
] });
|
|
253
216
|
}
|
|
254
|
-
function
|
|
255
|
-
const
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
const r = new Audio();
|
|
260
|
-
return r.addEventListener("ended", () => g.current()), r.addEventListener("error", () => l(!1)), s.current = r, d(r), () => r.pause();
|
|
217
|
+
function pe(e, a) {
|
|
218
|
+
const r = S(null), [o, c] = x(null), [g, h] = x(!1), l = S(a), _ = S(g);
|
|
219
|
+
return l.current = a, _.current = g, k(() => {
|
|
220
|
+
const s = new Audio();
|
|
221
|
+
return s.addEventListener("ended", () => l.current()), s.addEventListener("error", () => h(!1)), r.current = s, c(s), () => s.pause();
|
|
261
222
|
}, []), k(() => {
|
|
262
|
-
const
|
|
263
|
-
|
|
264
|
-
})) : (
|
|
265
|
-
}, [e]), { playing:
|
|
266
|
-
const
|
|
267
|
-
|
|
268
|
-
}),
|
|
223
|
+
const s = r.current;
|
|
224
|
+
s && (s.pause(), e ? (s.src = e, s.currentTime = 0, _.current && s.play().catch(() => {
|
|
225
|
+
})) : (s.removeAttribute("src"), s.load(), h(!1)));
|
|
226
|
+
}, [e]), { playing: g, toggle: () => {
|
|
227
|
+
const s = r.current;
|
|
228
|
+
s != null && s.getAttribute("src") && (_.current ? s.pause() : s.play().catch(() => {
|
|
229
|
+
}), h(!_.current));
|
|
269
230
|
}, stop: () => {
|
|
270
|
-
var
|
|
271
|
-
(
|
|
231
|
+
var s;
|
|
232
|
+
(s = r.current) == null || s.pause(), h(!1);
|
|
272
233
|
}, audio: o };
|
|
273
234
|
}
|
|
274
|
-
const
|
|
275
|
-
function F() {
|
|
235
|
+
const K = "graphl:theme", O = () => {
|
|
276
236
|
try {
|
|
277
|
-
const e = localStorage.getItem(
|
|
237
|
+
const e = localStorage.getItem(K);
|
|
278
238
|
return e === "light" || e === "dark" ? e : null;
|
|
279
239
|
} catch {
|
|
280
240
|
return null;
|
|
281
241
|
}
|
|
282
|
-
}
|
|
283
|
-
function
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
} catch {
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
const fe = (e, a, s) => s || !a ? e : a;
|
|
290
|
-
function ge(e, a) {
|
|
291
|
-
const [s, o] = b(() => a ? null : F()), d = fe(e, s, a);
|
|
292
|
-
k(() => (document.documentElement.setAttribute("data-theme", d), () => document.documentElement.removeAttribute("data-theme")), [d]), k(() => {
|
|
242
|
+
};
|
|
243
|
+
function _e(e, a) {
|
|
244
|
+
const [r, o] = x(O), c = !a && r || e;
|
|
245
|
+
k(() => (document.documentElement.setAttribute("data-theme", c), () => document.documentElement.removeAttribute("data-theme")), [c]), k(() => {
|
|
293
246
|
if (a) return;
|
|
294
|
-
const
|
|
295
|
-
(l.key ===
|
|
247
|
+
const h = (l) => {
|
|
248
|
+
(l.key === K || l.key === null) && o(O());
|
|
296
249
|
};
|
|
297
|
-
return window.addEventListener("storage",
|
|
250
|
+
return window.addEventListener("storage", h), () => window.removeEventListener("storage", h);
|
|
298
251
|
}, [a]);
|
|
299
252
|
const g = I(() => {
|
|
300
|
-
const
|
|
301
|
-
|
|
253
|
+
const h = c === "dark" ? "light" : "dark";
|
|
254
|
+
try {
|
|
255
|
+
localStorage.setItem(K, h);
|
|
256
|
+
} catch {
|
|
257
|
+
}
|
|
302
258
|
const l = document.documentElement;
|
|
303
|
-
l.classList.add("theme-swap"), o(
|
|
304
|
-
}, [
|
|
305
|
-
return { theme:
|
|
306
|
-
}
|
|
307
|
-
const P = {
|
|
308
|
-
dark: { glyph: "☾", label: "Dark theme" },
|
|
309
|
-
light: { glyph: "☀", label: "Light theme" }
|
|
310
|
-
};
|
|
311
|
-
function pe({ theme: e, onToggle: a }) {
|
|
312
|
-
const s = e === "dark" ? "light" : "dark", o = `${P[e].label}. Switch to ${P[s].label.toLowerCase()}.`;
|
|
313
|
-
return /* @__PURE__ */ t("button", { className: "site__icon", type: "button", onClick: a, "aria-label": o, title: o, children: P[e].glyph });
|
|
259
|
+
l.classList.add("theme-swap"), o(h), requestAnimationFrame(() => requestAnimationFrame(() => l.classList.remove("theme-swap")));
|
|
260
|
+
}, [c]);
|
|
261
|
+
return { theme: c, toggle: g };
|
|
314
262
|
}
|
|
263
|
+
const P = (e) => e.replace(/^#\/?/, "");
|
|
315
264
|
function ye({
|
|
316
265
|
subject: e,
|
|
317
266
|
eyebrow: a,
|
|
318
|
-
courses:
|
|
267
|
+
courses: r,
|
|
319
268
|
getScene: o,
|
|
320
|
-
audioBase:
|
|
269
|
+
audioBase: c = "/",
|
|
321
270
|
kind: g = "courses",
|
|
322
|
-
theme:
|
|
271
|
+
theme: h = "dark"
|
|
323
272
|
}) {
|
|
324
|
-
const [l,
|
|
273
|
+
const [l, _] = x(() => location.hash);
|
|
325
274
|
k(() => {
|
|
326
|
-
const
|
|
327
|
-
return window.addEventListener("hashchange",
|
|
275
|
+
const f = () => _(location.hash);
|
|
276
|
+
return window.addEventListener("hashchange", f), () => window.removeEventListener("hashchange", f);
|
|
328
277
|
}, []);
|
|
329
|
-
const n = new URLSearchParams(location.search).get("capture") === "1", { theme: u, toggle:
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
return Object.values(s)[0];
|
|
334
|
-
}, [m, s]), _ = M(() => D(v), [v]), w = M(() => Object.values(s).flatMap(D), [s]);
|
|
278
|
+
const n = new URLSearchParams(location.search).get("capture") === "1", { theme: u, toggle: s } = _e(h, n), m = P(l), N = C(
|
|
279
|
+
() => Object.hasOwn(r, m) && r[m] || Object.values(r).find((f) => f.sections.some((i) => X(f, i) === m)) || Object.values(r)[0],
|
|
280
|
+
[m, r]
|
|
281
|
+
), p = C(() => N ? z(N) : [], [N]), w = C(() => Object.values(r).flatMap(z), [r]);
|
|
335
282
|
k(() => {
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
i && (history.replaceState(null, "", `${location.pathname}${location.search}#/${i.slug}`), p(`#/${i.slug}`));
|
|
339
|
-
}, [n, m, _]), k(() => {
|
|
283
|
+
n || !Object.hasOwn(r, m) || !p[0] || (history.replaceState(null, "", `${location.pathname}${location.search}#/${p[0].slug}`), _(`#/${p[0].slug}`));
|
|
284
|
+
}, [n, m, p]), k(() => {
|
|
340
285
|
n && (window.__scene = {
|
|
341
|
-
plan: () =>
|
|
342
|
-
slug:
|
|
343
|
-
course:
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
focus: c.focus ?? null
|
|
286
|
+
plan: () => p.map(({ slug: f, section: i }) => ({
|
|
287
|
+
slug: f,
|
|
288
|
+
course: N == null ? void 0 : N.id,
|
|
289
|
+
id: i.id,
|
|
290
|
+
scene: i.scene,
|
|
291
|
+
focus: i.focus ?? null
|
|
348
292
|
}))
|
|
349
293
|
});
|
|
350
|
-
}, [n,
|
|
351
|
-
const
|
|
352
|
-
(
|
|
353
|
-
const
|
|
354
|
-
if (
|
|
355
|
-
const
|
|
356
|
-
location.hash =
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
294
|
+
}, [n, p, N]);
|
|
295
|
+
const $ = I(
|
|
296
|
+
(f) => {
|
|
297
|
+
const i = P(location.hash), v = w.findIndex(({ slug: b }) => b === i);
|
|
298
|
+
if (v !== -1) {
|
|
299
|
+
const b = w[v + f];
|
|
300
|
+
location.hash = b ? `#/${b.slug}` : "";
|
|
301
|
+
} else if (i === "")
|
|
302
|
+
f === 1 && w[0] && (location.hash = `#/${w[0].slug}`);
|
|
303
|
+
else {
|
|
304
|
+
const b = f === 1 ? p[0] : p[p.length - 1];
|
|
305
|
+
b && (location.hash = `#/${b.slug}`);
|
|
362
306
|
}
|
|
363
|
-
const L = i === 1 ? _[0] : _[_.length - 1];
|
|
364
|
-
L && (location.hash = `#/${L.slug}`);
|
|
365
307
|
},
|
|
366
|
-
[
|
|
367
|
-
),
|
|
308
|
+
[p, w]
|
|
309
|
+
), T = I(() => {
|
|
368
310
|
location.hash ? location.hash = "" : location.pathname !== "/" && (location.href = "/");
|
|
369
|
-
}, [])
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
c.key === "Escape" && S();
|
|
373
|
-
};
|
|
374
|
-
return window.addEventListener("keydown", i), () => window.removeEventListener("keydown", i);
|
|
375
|
-
}, [S]);
|
|
376
|
-
const $ = _.find(({ slug: i }) => i === m), V = $ ? `${d}audio/${v.id}/${$.section.id}.wav` : void 0, { playing: q, toggle: K, stop: W, audio: y } = ue(V, () => {
|
|
377
|
-
const i = location.hash.replace(/^#\/?/, ""), c = w.findIndex(({ slug: L }) => L === i), N = w[c + 1];
|
|
378
|
-
N ? location.hash = `#/${N.slug}` : W();
|
|
311
|
+
}, []), y = p.find(({ slug: f }) => f === m), W = y && `${c}audio/${N.id}/${y.section.id}.wav`, { playing: Y, toggle: B, stop: Z, audio: L } = pe(W, () => {
|
|
312
|
+
const f = P(location.hash), i = w[w.findIndex(({ slug: v }) => v === f) + 1];
|
|
313
|
+
i ? location.hash = `#/${i.slug}` : Z();
|
|
379
314
|
});
|
|
380
315
|
if (k(() => {
|
|
381
|
-
const
|
|
382
|
-
if (
|
|
383
|
-
const
|
|
384
|
-
if (
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
return;
|
|
391
|
-
}
|
|
392
|
-
E(L);
|
|
316
|
+
const f = (i) => {
|
|
317
|
+
if (i.key === "Escape") return T();
|
|
318
|
+
const v = i.target;
|
|
319
|
+
if (!(i.ctrlKey || i.metaKey || i.altKey || (v == null ? void 0 : v.tagName) === "INPUT" || (v == null ? void 0 : v.tagName) === "TEXTAREA" || v != null && v.isContentEditable))
|
|
320
|
+
if (i.key === "ArrowRight" || i.key === "ArrowLeft") {
|
|
321
|
+
i.preventDefault();
|
|
322
|
+
const b = i.key === "ArrowRight" ? 1 : -1, M = (L == null ? void 0 : L.duration) ?? 0;
|
|
323
|
+
L && !i.shiftKey && Number.isFinite(M) && M > 0 ? L.currentTime = Math.min(M, Math.max(0, L.currentTime + b * j)) : $(b);
|
|
324
|
+
} else (i.key === " " || i.code === "Space") && (i.preventDefault(), B());
|
|
393
325
|
};
|
|
394
|
-
return window.addEventListener("keydown",
|
|
395
|
-
}, [E, y]), k(() => {
|
|
396
|
-
const i = (c) => {
|
|
397
|
-
if (c.key !== " " && c.code !== "Space") return;
|
|
398
|
-
const N = c.target;
|
|
399
|
-
N && (N.tagName === "INPUT" || N.tagName === "TEXTAREA" || N.isContentEditable) || (c.preventDefault(), K());
|
|
400
|
-
};
|
|
401
|
-
return window.addEventListener("keydown", i), () => window.removeEventListener("keydown", i);
|
|
326
|
+
return window.addEventListener("keydown", f), () => window.removeEventListener("keydown", f);
|
|
402
327
|
}), !m)
|
|
403
328
|
return /* @__PURE__ */ t(
|
|
404
|
-
|
|
329
|
+
ge,
|
|
405
330
|
{
|
|
406
|
-
courses: Object.values(
|
|
331
|
+
courses: Object.values(r),
|
|
407
332
|
subject: e,
|
|
408
333
|
kind: g,
|
|
409
|
-
actions: n ? null : /* @__PURE__ */ t(
|
|
334
|
+
actions: n ? null : /* @__PURE__ */ t(de, { theme: u, onToggle: s })
|
|
410
335
|
}
|
|
411
336
|
);
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
C = /* @__PURE__ */ t(
|
|
416
|
-
oe,
|
|
337
|
+
if (y)
|
|
338
|
+
return /* @__PURE__ */ t(
|
|
339
|
+
he,
|
|
417
340
|
{
|
|
418
|
-
section:
|
|
341
|
+
section: y.section,
|
|
419
342
|
getScene: o,
|
|
420
343
|
capture: n,
|
|
421
|
-
eyebrow: `${a ?? e.toUpperCase()} · ${
|
|
422
|
-
index:
|
|
423
|
-
total:
|
|
424
|
-
onHome:
|
|
425
|
-
onPrev: () =>
|
|
426
|
-
onNext: () =>
|
|
427
|
-
narrating:
|
|
428
|
-
onToggleNarration:
|
|
429
|
-
narrationAudio:
|
|
344
|
+
eyebrow: `${a ?? e.toUpperCase()} · ${N.id.toUpperCase()}`,
|
|
345
|
+
index: p.indexOf(y),
|
|
346
|
+
total: p.length,
|
|
347
|
+
onHome: T,
|
|
348
|
+
onPrev: () => $(-1),
|
|
349
|
+
onNext: () => $(1),
|
|
350
|
+
narrating: Y,
|
|
351
|
+
onToggleNarration: B,
|
|
352
|
+
narrationAudio: L,
|
|
430
353
|
theme: u,
|
|
431
|
-
onToggleTheme: n ? void 0 :
|
|
354
|
+
onToggleTheme: n ? void 0 : s
|
|
432
355
|
}
|
|
433
356
|
);
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
357
|
+
const F = o(m);
|
|
358
|
+
return /* @__PURE__ */ d(R, { children: [
|
|
359
|
+
!n && /* @__PURE__ */ t("button", { className: "brand-home", onClick: T, "aria-label": "Back to catalog (Esc)", title: "Back to catalog (Esc)", children: "GraphL" }),
|
|
360
|
+
F ? /* @__PURE__ */ t("div", { className: "stage", children: /* @__PURE__ */ t(V, { scene: F, theme: u }) }) : /* @__PURE__ */ d("div", { className: "stage stage--missing", children: [
|
|
437
361
|
"no scene or slug: ",
|
|
438
362
|
m
|
|
439
|
-
] })
|
|
440
|
-
}
|
|
441
|
-
return /* @__PURE__ */ h(H, { children: [
|
|
442
|
-
j,
|
|
443
|
-
C
|
|
363
|
+
] })
|
|
444
364
|
] });
|
|
445
365
|
}
|
|
446
366
|
export {
|
|
447
367
|
ye as ConceptApp,
|
|
448
|
-
|
|
449
|
-
|
|
368
|
+
fe as SiteHeader,
|
|
369
|
+
z as allSections,
|
|
450
370
|
X as slugOf
|
|
451
371
|
};
|
|
452
372
|
//# sourceMappingURL=index.js.map
|