@pie-element/passage 7.1.2-next.5 → 7.1.2-next.7
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/author/common.js +6 -5
- package/dist/author/design.js +2 -2
- package/dist/author/index.js +2 -2
- package/dist/author/passage.js +1 -1
- package/dist/browser/author/index.js +16247 -19432
- package/dist/browser/author/index.js.map +1 -1
- package/dist/browser/controller/index.js +1 -1
- package/dist/browser/controller/index.js.map +1 -1
- package/dist/browser/delivery/index.js +3 -3
- package/dist/browser/delivery/index.js.map +1 -1
- package/dist/browser/{dist-CeIdmqCq.js → dist-CiWlBjsz.js} +2 -2
- package/dist/browser/dist-CiWlBjsz.js.map +1 -0
- package/dist/browser/{dist-ByX3voUB.js → dist-CufhtHcn.js} +2679 -2741
- package/dist/browser/dist-CufhtHcn.js.map +1 -0
- package/dist/browser/print/index.js +4 -3
- package/dist/browser/print/index.js.map +1 -1
- package/dist/browser/rolldown-runtime-CWhphoD1.js +32 -0
- package/dist/browser/{stimulus-tabs-CxiQ79gz.js → stimulus-tabs-cEUGjTUU.js} +81 -43
- package/dist/browser/stimulus-tabs-cEUGjTUU.js.map +1 -0
- package/dist/delivery/index.js +1 -1
- package/dist/delivery/stimulus-tabs.d.ts +7 -0
- package/dist/delivery/stimulus-tabs.js +69 -32
- package/dist/index.iife.js +29 -29
- package/package.json +14 -6
- package/dist/browser/dist-ByX3voUB.js.map +0 -1
- package/dist/browser/dist-CeIdmqCq.js.map +0 -1
- package/dist/browser/stimulus-tabs-CxiQ79gz.js.map +0 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { i as e } from "../rolldown-runtime-CWhphoD1.js";
|
|
2
|
+
import { S as t } from "../dist-CufhtHcn.js";
|
|
3
|
+
import { t as n } from "../stimulus-tabs-cEUGjTUU.js";
|
|
4
|
+
import { o as r } from "../dist-CiWlBjsz.js";
|
|
4
5
|
import i from "react";
|
|
5
6
|
import { createRoot as a } from "react-dom/client";
|
|
6
7
|
var o = (0, (/* @__PURE__ */ e(t(), 1)).default)("pie-element:passage:print"), s = (e) => e != null, c = (e, t) => s(e) ? e : t, l = (e, t) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/print/index.tsx"],"sourcesContent":["// @ts-nocheck\n/**\n * @synced-from pie-elements/packages/passage/src/print.js\n * @auto-generated\n *\n * This file is automatically synced from pie-elements and converted to TypeScript.\n * Manual edits will be overwritten on next sync.\n * To make changes, edit the upstream JavaScript file and run sync again.\n */\n\nimport React from 'react';\nimport { createRoot } from 'react-dom/client';\nimport { debounce } from '@pie-element/shared-lodash';\nimport debug from 'debug';\n\nimport StimulusTabs from '../delivery/stimulus-tabs.js';\n\nconst log = debug('pie-element:passage:print');\n\nconst checkNullish = (value) => value !== null && value !== undefined;\n\nconst isEnabled = (value, defaultValue) => (checkNullish(value) ? value : defaultValue);\n\nconst preparePrintPassage = (model, opts) => {\n const isInstructor = opts.role === 'instructor';\n\n // TODO: also update '../../configure/src/defaults.js' and '../../controller/src/defaults.js' when updating defaultValue\n const teacherInstructionsEnabled = isEnabled(model.teacherInstructionsEnabled, true);\n const titleEnabled = isEnabled(model.titleEnabled, true);\n const authorEnabled = isEnabled(model.authorEnabled, false);\n const subtitleEnabled = isEnabled(model.subtitleEnabled, true);\n const textEnabled = isEnabled(model.textEnabled, true);\n\n return model.passages.map((passage, index) => ({\n id: index,\n teacherInstructions: isEnabled(passage.teacherInstructionsEnabled, teacherInstructionsEnabled)\n ? (isInstructor && passage.teacherInstructions) || ''\n : '',\n label: passage.title || `Passage ${index + 1}`,\n title: isEnabled(passage.titleEnabled, titleEnabled) ? passage.title || '' : '',\n author: isEnabled(passage.authorEnabled, authorEnabled) ? passage.author || '' : '',\n subtitle: isEnabled(passage.subtitleEnabled, subtitleEnabled) ? passage.subtitle || '' : '',\n text: isEnabled(passage.textEnabled, textEnabled) ? passage.text || '' : '',\n }));\n};\n\nexport default class PassagePrint extends HTMLElement {\n constructor() {\n super();\n this._model = null;\n this._options = null;\n this._session = [];\n this._root = null;\n\n this._rerender = debounce(\n () => {\n if (this._model && this._session) {\n if (this._model.passages && this._model.passages.length > 0) {\n const printPassage = preparePrintPassage(this._model, this._options);\n\n const element = React.createElement(StimulusTabs, {\n disabledTabs: true,\n tabs: printPassage,\n });\n\n if (!this._root) {\n this._root = createRoot(this);\n }\n this._root.render(element);\n }\n } else {\n log('skip');\n }\n },\n 50,\n { leading: false, trailing: true },\n );\n }\n\n set model(s) {\n this._model = s;\n this._rerender();\n }\n\n set options(o) {\n this._options = o;\n }\n\n connectedCallback() {}\n\n disconnectedCallback() {\n if (this._root) {\n this._root.unmount();\n }\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/print/index.tsx"],"sourcesContent":["// @ts-nocheck\n/**\n * @synced-from pie-elements/packages/passage/src/print.js\n * @auto-generated\n *\n * This file is automatically synced from pie-elements and converted to TypeScript.\n * Manual edits will be overwritten on next sync.\n * To make changes, edit the upstream JavaScript file and run sync again.\n */\n\nimport React from 'react';\nimport { createRoot } from 'react-dom/client';\nimport { debounce } from '@pie-element/shared-lodash';\nimport debug from 'debug';\n\nimport StimulusTabs from '../delivery/stimulus-tabs.js';\n\nconst log = debug('pie-element:passage:print');\n\nconst checkNullish = (value) => value !== null && value !== undefined;\n\nconst isEnabled = (value, defaultValue) => (checkNullish(value) ? value : defaultValue);\n\nconst preparePrintPassage = (model, opts) => {\n const isInstructor = opts.role === 'instructor';\n\n // TODO: also update '../../configure/src/defaults.js' and '../../controller/src/defaults.js' when updating defaultValue\n const teacherInstructionsEnabled = isEnabled(model.teacherInstructionsEnabled, true);\n const titleEnabled = isEnabled(model.titleEnabled, true);\n const authorEnabled = isEnabled(model.authorEnabled, false);\n const subtitleEnabled = isEnabled(model.subtitleEnabled, true);\n const textEnabled = isEnabled(model.textEnabled, true);\n\n return model.passages.map((passage, index) => ({\n id: index,\n teacherInstructions: isEnabled(passage.teacherInstructionsEnabled, teacherInstructionsEnabled)\n ? (isInstructor && passage.teacherInstructions) || ''\n : '',\n label: passage.title || `Passage ${index + 1}`,\n title: isEnabled(passage.titleEnabled, titleEnabled) ? passage.title || '' : '',\n author: isEnabled(passage.authorEnabled, authorEnabled) ? passage.author || '' : '',\n subtitle: isEnabled(passage.subtitleEnabled, subtitleEnabled) ? passage.subtitle || '' : '',\n text: isEnabled(passage.textEnabled, textEnabled) ? passage.text || '' : '',\n }));\n};\n\nexport default class PassagePrint extends HTMLElement {\n constructor() {\n super();\n this._model = null;\n this._options = null;\n this._session = [];\n this._root = null;\n\n this._rerender = debounce(\n () => {\n if (this._model && this._session) {\n if (this._model.passages && this._model.passages.length > 0) {\n const printPassage = preparePrintPassage(this._model, this._options);\n\n const element = React.createElement(StimulusTabs, {\n disabledTabs: true,\n tabs: printPassage,\n });\n\n if (!this._root) {\n this._root = createRoot(this);\n }\n this._root.render(element);\n }\n } else {\n log('skip');\n }\n },\n 50,\n { leading: false, trailing: true },\n );\n }\n\n set model(s) {\n this._model = s;\n this._rerender();\n }\n\n set options(o) {\n this._options = o;\n }\n\n connectedCallback() {}\n\n disconnectedCallback() {\n if (this._root) {\n this._root.unmount();\n }\n }\n}\n"],"mappings":";;;;;;AAiBA,IAAM,KAAA,IAAA,wBAAA,EAAA,CAAA,QAAA,CAAY,2BAA2B,GAEvC,KAAgB,MAAU,KAAU,MAEpC,KAAa,GAAO,MAAkB,EAAa,CAAK,IAAI,IAAQ,GAEpE,KAAuB,GAAO,MAAS;CAC3C,IAAM,IAAe,EAAK,SAAS,cAG7B,IAA6B,EAAU,EAAM,4BAA4B,EAAI,GAC7E,IAAe,EAAU,EAAM,cAAc,EAAI,GACjD,IAAgB,EAAU,EAAM,eAAe,EAAK,GACpD,IAAkB,EAAU,EAAM,iBAAiB,EAAI,GACvD,IAAc,EAAU,EAAM,aAAa,E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serCjsRequire = (specifier) => {
|
|
3
|
+
switch (specifier) {
|
|
4
|
+
case "react": return __pieBrowserCjsReactRequire;
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
default:
|
|
10
|
+
throw new Error(`Unsupported browser CJS require: ${specifier}`);
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
//#region \0rolldown/runtime.js
|
|
14
|
+
var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescriptor, r = Object.getOwnPropertyNames, i = Object.getPrototypeOf, a = Object.prototype.hasOwnProperty, o = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), s = (e, n) => {
|
|
15
|
+
let r = {};
|
|
16
|
+
for (var i in e) t(r, i, {
|
|
17
|
+
get: e[i],
|
|
18
|
+
enumerable: !0
|
|
19
|
+
});
|
|
20
|
+
return n || t(r, Symbol.toStringTag, { value: "Module" }), r;
|
|
21
|
+
}, c = (e, i, o, s) => {
|
|
22
|
+
if (i && typeof i == "object" || typeof i == "function") for (var c = r(i), l = 0, u = c.length, d; l < u; l++) d = c[l], !a.call(e, d) && d !== o && t(e, d, {
|
|
23
|
+
get: ((e) => i[e]).bind(null, d),
|
|
24
|
+
enumerable: !(s = n(i, d)) || s.enumerable
|
|
25
|
+
});
|
|
26
|
+
return e;
|
|
27
|
+
}, l = (n, r, a) => (a = n == null ? {} : e(i(n)), c(r || !n || !n.__esModule ? t(a, "default", {
|
|
28
|
+
value: n,
|
|
29
|
+
enumerable: !0
|
|
30
|
+
}) : a, n)), u = __pieBrowserCjsRequire;
|
|
31
|
+
//#endregion
|
|
32
|
+
export { l as i, s as n, u as r, o as t };
|
|
@@ -1,40 +1,45 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i as e } from "./rolldown-runtime-CWhphoD1.js";
|
|
2
|
+
import { A as t, M as n, N as r, Q as i, a, b as o, h as s, o as c, s as l, t as u, wt as d } from "./dist-CufhtHcn.js";
|
|
2
3
|
import f from "react";
|
|
3
4
|
import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
4
5
|
//#region src/delivery/stimulus-tabs.tsx
|
|
5
|
-
var g = /* @__PURE__ */
|
|
6
|
+
var g = /* @__PURE__ */ e(d(), 1);
|
|
6
7
|
function _(e) {
|
|
7
8
|
return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
|
|
8
9
|
}
|
|
9
10
|
function v(e, t) {
|
|
10
11
|
return !e || _(e) ? e : _(e.default) ? e.default : t && _(e[t]) ? e[t] : t && _(e[t]?.default) ? e[t].default : e;
|
|
11
12
|
}
|
|
12
|
-
var y = v(s, "UiLayout") || v(T.UiLayout, "UiLayout"), b = v(c, "Purpose") || v(T.Purpose, "Purpose"), x = v(l, "PreviewPrompt") || v(T.PreviewPrompt, "PreviewPrompt"), S = v(
|
|
13
|
+
var y = v(s, "UiLayout") || v(T.UiLayout, "UiLayout"), b = v(c, "Purpose") || v(T.Purpose, "Purpose"), x = v(l, "PreviewPrompt") || v(T.PreviewPrompt, "PreviewPrompt"), S = v(o, "Collapsible") || v(T.Collapsible, "Collapsible"), C = u, w = C.default, T = w && typeof w == "object" ? w : C, E = 2, D = .4, O = 170, k = () => {
|
|
14
|
+
if (typeof window > "u") return 1;
|
|
15
|
+
let e = window.outerWidth / window.innerWidth;
|
|
16
|
+
return Math.max(D, Math.min(1, E / (Number.isFinite(e) && e > 0 ? e : 1)));
|
|
17
|
+
}, A = i("div")({
|
|
13
18
|
flexGrow: 1,
|
|
14
|
-
backgroundColor:
|
|
15
|
-
color:
|
|
19
|
+
backgroundColor: t.background(),
|
|
20
|
+
color: t.text(),
|
|
16
21
|
"&:not(.MathJax) table": { borderCollapse: "collapse" },
|
|
17
22
|
"&:not(.MathJax) table td, &:not(.MathJax) table th": {
|
|
18
23
|
padding: ".6em 1em",
|
|
19
24
|
textAlign: "left"
|
|
20
25
|
}
|
|
21
|
-
}),
|
|
22
|
-
backgroundColor:
|
|
23
|
-
color:
|
|
24
|
-
padding:
|
|
26
|
+
}), j = i("div")(({ theme: e }) => ({
|
|
27
|
+
backgroundColor: t.background(),
|
|
28
|
+
color: t.text(),
|
|
29
|
+
padding: e.spacing(2),
|
|
25
30
|
"& blockquote": {
|
|
26
31
|
background: "#f9f9f9",
|
|
27
32
|
borderLeft: "5px solid #ccc",
|
|
28
33
|
margin: "1.5em 10px",
|
|
29
34
|
padding: ".5em 10px"
|
|
30
35
|
}
|
|
31
|
-
})),
|
|
32
|
-
background:
|
|
36
|
+
})), M = i("div")({ fontSize: "1.75rem" }), N = i("div")({ fontSize: "1.5rem" }), P = i("div")({ fontSize: "1.25rem" }), F = i(n)(({ theme: e }) => ({
|
|
37
|
+
background: t.background(),
|
|
33
38
|
fontSize: "inherit",
|
|
34
39
|
fontFamily: "Roboto, sans-serif",
|
|
35
|
-
color:
|
|
40
|
+
color: t.text(),
|
|
36
41
|
borderRadius: `${e.spacing(2)} ${e.spacing(2)} 0 0`,
|
|
37
|
-
border:
|
|
42
|
+
border: `1px solid ${t.borderGray()}`,
|
|
38
43
|
borderBottomWidth: 0,
|
|
39
44
|
minHeight: "56px",
|
|
40
45
|
padding: "8px 10px",
|
|
@@ -54,19 +59,39 @@ var y = v(s, "UiLayout") || v(T.UiLayout, "UiLayout"), b = v(c, "Purpose") || v(
|
|
|
54
59
|
opacity: .7
|
|
55
60
|
},
|
|
56
61
|
"&.Mui-selected": {
|
|
57
|
-
color:
|
|
62
|
+
color: t.text(),
|
|
58
63
|
".passage-label": { opacity: 1 },
|
|
59
|
-
".passage-label-underline": { backgroundColor:
|
|
64
|
+
".passage-label-underline": { backgroundColor: t.tertiary() }
|
|
60
65
|
},
|
|
61
|
-
"&:hover": { ".passage-label-underline": { backgroundColor:
|
|
66
|
+
"&:hover": { ".passage-label-underline": { backgroundColor: t.tertiaryLight() } },
|
|
62
67
|
"& .MuiTouchRipple-root": { opacity: .7 }
|
|
63
|
-
})),
|
|
68
|
+
})), I = i("div")(() => ({
|
|
64
69
|
height: "2px",
|
|
65
70
|
width: "100%",
|
|
66
71
|
marginTop: "6px",
|
|
67
|
-
background:
|
|
68
|
-
})),
|
|
69
|
-
state = {
|
|
72
|
+
background: t.background()
|
|
73
|
+
})), L = class extends f.Component {
|
|
74
|
+
state = {
|
|
75
|
+
activeTab: 0,
|
|
76
|
+
zoomCompensation: k(),
|
|
77
|
+
containerWidth: 0
|
|
78
|
+
};
|
|
79
|
+
containerRef = f.createRef();
|
|
80
|
+
componentDidMount() {
|
|
81
|
+
typeof window > "u" || (window.addEventListener("resize", this.updateZoomCompensation), this.containerRef.current && typeof ResizeObserver < "u" && (this.resizeObserver = new ResizeObserver(this.updateContainerWidth), this.resizeObserver.observe(this.containerRef.current)), this.updateContainerWidth());
|
|
82
|
+
}
|
|
83
|
+
componentWillUnmount() {
|
|
84
|
+
typeof window > "u" || (window.removeEventListener("resize", this.updateZoomCompensation), this.resizeObserver &&= (this.resizeObserver.disconnect(), null));
|
|
85
|
+
}
|
|
86
|
+
updateZoomCompensation = () => {
|
|
87
|
+
this.setState({ zoomCompensation: k() });
|
|
88
|
+
};
|
|
89
|
+
updateContainerWidth = () => {
|
|
90
|
+
let e = this.containerRef.current;
|
|
91
|
+
if (!e) return;
|
|
92
|
+
let t = e.clientWidth;
|
|
93
|
+
t !== this.state.containerWidth && this.setState({ containerWidth: t });
|
|
94
|
+
};
|
|
70
95
|
handleChange = (e, t) => {
|
|
71
96
|
this.setState(() => ({ activeTab: t })), setTimeout(() => {
|
|
72
97
|
let e = new CustomEvent("pie-ui-passage-tabChanged", { detail: { tab: t } });
|
|
@@ -123,8 +148,8 @@ var y = v(s, "UiLayout") || v(T.UiLayout, "UiLayout"), b = v(c, "Purpose") || v(
|
|
|
123
148
|
});
|
|
124
149
|
}
|
|
125
150
|
renderTab(e, t) {
|
|
126
|
-
let { baseHeadingLevel: n } = this.props, r = n ? Math.min(6, Math.max(1, n)) : void 0,
|
|
127
|
-
return /* @__PURE__ */ h(
|
|
151
|
+
let { baseHeadingLevel: n } = this.props, r = n ? Math.min(6, Math.max(1, n)) : void 0, i = n ? `h${r}` : "h2", o = n ? Math.min(6, Math.max(1, r + 1)) : void 0;
|
|
152
|
+
return /* @__PURE__ */ h(j, {
|
|
128
153
|
id: `tabpanel-${e.id}`,
|
|
129
154
|
role: "tabpanel",
|
|
130
155
|
"aria-labelledby": `button-${e.id}`,
|
|
@@ -132,15 +157,15 @@ var y = v(s, "UiLayout") || v(T.UiLayout, "UiLayout"), b = v(c, "Purpose") || v(
|
|
|
132
157
|
this.renderInstructions(e.teacherInstructions, t),
|
|
133
158
|
e.title && /* @__PURE__ */ m(b, {
|
|
134
159
|
purpose: "passage-title",
|
|
135
|
-
children: /* @__PURE__ */ m(
|
|
160
|
+
children: /* @__PURE__ */ m(i, { children: /* @__PURE__ */ m(M, { dangerouslySetInnerHTML: { __html: this.parsedText(e.title) } }) })
|
|
136
161
|
}),
|
|
137
162
|
e.subtitle && /* @__PURE__ */ m(b, {
|
|
138
163
|
purpose: "passage-subtitle",
|
|
139
|
-
children: /* @__PURE__ */ m(
|
|
164
|
+
children: /* @__PURE__ */ m(N, { dangerouslySetInnerHTML: { __html: this.parsedText(e.subtitle) } })
|
|
140
165
|
}),
|
|
141
166
|
e.author && /* @__PURE__ */ m(b, {
|
|
142
167
|
purpose: "passage-author",
|
|
143
|
-
children: /* @__PURE__ */ m(
|
|
168
|
+
children: /* @__PURE__ */ m(P, {
|
|
144
169
|
className: "author",
|
|
145
170
|
dangerouslySetInnerHTML: { __html: this.parsedText(e.author) }
|
|
146
171
|
})
|
|
@@ -149,56 +174,69 @@ var y = v(s, "UiLayout") || v(T.UiLayout, "UiLayout"), b = v(c, "Purpose") || v(
|
|
|
149
174
|
purpose: "passage-text",
|
|
150
175
|
children: /* @__PURE__ */ m("div", {
|
|
151
176
|
className: "text",
|
|
152
|
-
dangerouslySetInnerHTML: { __html: n ?
|
|
177
|
+
dangerouslySetInnerHTML: { __html: n ? a(e.text, o) : e.text }
|
|
153
178
|
}, e.id)
|
|
154
179
|
})
|
|
155
180
|
]
|
|
156
181
|
}, e.id);
|
|
157
182
|
}
|
|
158
183
|
render() {
|
|
159
|
-
let { model:
|
|
184
|
+
let { model: e, tabs: n, disabledTabs: i } = this.props, { activeTab: a, zoomCompensation: o, containerWidth: s } = this.state;
|
|
160
185
|
if (!n?.length) return;
|
|
161
|
-
let { extraCSSRules:
|
|
186
|
+
let { extraCSSRules: c } = e || {}, l = (n || []).find((e) => e.id === a), u = s > 0 ? s / n.length : null, d = s > 0 && s <= n.length * O;
|
|
162
187
|
return /* @__PURE__ */ m(y, {
|
|
163
|
-
extraCSSRules:
|
|
164
|
-
children: /* @__PURE__ */ m(
|
|
188
|
+
extraCSSRules: c,
|
|
189
|
+
children: /* @__PURE__ */ m(A, {
|
|
165
190
|
className: "passages",
|
|
191
|
+
ref: this.containerRef,
|
|
166
192
|
children: i || n.length === 1 ? n.map((e) => this.renderTab(e, i)) : /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m(r, {
|
|
167
193
|
sx: {
|
|
168
|
-
position: "
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
194
|
+
position: "static",
|
|
195
|
+
"@media (min-width: 841px)": {
|
|
196
|
+
position: "sticky",
|
|
197
|
+
top: 0,
|
|
198
|
+
zIndex: 1
|
|
199
|
+
},
|
|
200
|
+
background: "var(--pie-passage-header-background, rgba(255,255,255,0))",
|
|
201
|
+
color: t.text(),
|
|
172
202
|
fontFamily: "Roboto, sans-serif",
|
|
173
|
-
|
|
203
|
+
zoom: o,
|
|
204
|
+
"& .MuiTabs-list": {
|
|
205
|
+
backgroundColor: `var(--pie-passage-header-background, ${t.backgroundDark()})`,
|
|
206
|
+
borderBottom: `1px solid ${t.borderGray()}`
|
|
207
|
+
},
|
|
174
208
|
"& .MuiTabs-indicator": {
|
|
175
|
-
backgroundColor:
|
|
209
|
+
backgroundColor: t.white(),
|
|
176
210
|
marginBottom: "-1px"
|
|
177
211
|
}
|
|
178
212
|
},
|
|
179
213
|
value: a,
|
|
180
214
|
onChange: this.handleChange,
|
|
181
|
-
children: n.map((e) => /* @__PURE__ */ m(
|
|
215
|
+
children: n.map((e, t) => /* @__PURE__ */ m(F, {
|
|
182
216
|
id: `button-${e.id}`,
|
|
217
|
+
sx: u ? { maxWidth: `${u}px` } : void 0,
|
|
183
218
|
label: /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m(b, {
|
|
184
219
|
purpose: "passage-label",
|
|
185
|
-
children: /* @__PURE__ */ m("span", {
|
|
220
|
+
children: d ? /* @__PURE__ */ m("span", {
|
|
221
|
+
className: "passage-label",
|
|
222
|
+
children: `Passage ${t + 1}`
|
|
223
|
+
}) : /* @__PURE__ */ m("span", {
|
|
186
224
|
className: "passage-label",
|
|
187
225
|
dangerouslySetInnerHTML: { __html: this.parsedText(e.label) }
|
|
188
226
|
})
|
|
189
|
-
}), /* @__PURE__ */ m(
|
|
227
|
+
}), /* @__PURE__ */ m(I, { className: "passage-label-underline" })] }),
|
|
190
228
|
value: e.id,
|
|
191
229
|
tabIndex: a === e.id ? 0 : -1,
|
|
192
230
|
"aria-controls": `tabpanel-${e.id}`,
|
|
193
231
|
"aria-selected": a === e.id,
|
|
194
232
|
onKeyDown: (t) => this.handleKeyDown(t, e.id)
|
|
195
233
|
}, e.id))
|
|
196
|
-
}),
|
|
234
|
+
}), l ? this.renderTab(l, i) : null] })
|
|
197
235
|
})
|
|
198
236
|
});
|
|
199
237
|
}
|
|
200
238
|
};
|
|
201
|
-
|
|
239
|
+
L.propTypes = {
|
|
202
240
|
tabs: g.default.arrayOf(g.default.shape({
|
|
203
241
|
id: g.default.number.isRequired,
|
|
204
242
|
label: g.default.string.isRequired,
|
|
@@ -213,6 +251,6 @@ N.propTypes = {
|
|
|
213
251
|
baseHeadingLevel: g.default.number
|
|
214
252
|
};
|
|
215
253
|
//#endregion
|
|
216
|
-
export {
|
|
254
|
+
export { L as t };
|
|
217
255
|
|
|
218
|
-
//# sourceMappingURL=stimulus-tabs-
|
|
256
|
+
//# sourceMappingURL=stimulus-tabs-cEUGjTUU.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stimulus-tabs-cEUGjTUU.js","names":[],"sources":["../../src/delivery/stimulus-tabs.tsx"],"sourcesContent":["// @ts-nocheck\n/**\n * @synced-from pie-elements/packages/passage/src/stimulus-tabs.jsx\n * @auto-generated\n *\n * This file is automatically synced from pie-elements and converted to TypeScript.\n * Manual edits will be overwritten on next sync.\n * To make changes, edit the upstream JavaScript file and run sync again.\n */\n\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport Tabs from '@mui/material/Tabs';\nimport Tab from '@mui/material/Tab';\nimport { styled } from '@mui/material/styles';\nimport { Collapsible as CollapsibleImport, color, PreviewPrompt as PreviewPromptImport, Purpose as PurposeImport, UiLayout as UiLayoutImport, transformDataHeadings } from '@pie-lib/render-ui';\n\nfunction isRenderableReactInteropType(value: any) {\n return (\n typeof value === 'function' ||\n (typeof value === 'object' && value !== null && typeof value.$$typeof === 'symbol')\n );\n}\n\nfunction unwrapReactInteropSymbol(maybeSymbol: any, namedExport?: string) {\n if (!maybeSymbol) return maybeSymbol;\n if (isRenderableReactInteropType(maybeSymbol)) return maybeSymbol;\n if (isRenderableReactInteropType(maybeSymbol.default)) return maybeSymbol.default;\n if (namedExport && isRenderableReactInteropType(maybeSymbol[namedExport])) {\n return maybeSymbol[namedExport];\n }\n if (namedExport && isRenderableReactInteropType(maybeSymbol[namedExport]?.default)) {\n return maybeSymbol[namedExport].default;\n }\n return maybeSymbol;\n}\nconst UiLayout = unwrapReactInteropSymbol(UiLayoutImport, 'UiLayout') || unwrapReactInteropSymbol(renderUi.UiLayout, 'UiLayout');\nconst Purpose = unwrapReactInteropSymbol(PurposeImport, 'Purpose') || unwrapReactInteropSymbol(renderUi.Purpose, 'Purpose');\nconst PreviewPrompt = unwrapReactInteropSymbol(PreviewPromptImport, 'PreviewPrompt') || unwrapReactInteropSymbol(renderUi.PreviewPrompt, 'PreviewPrompt');\nconst Collapsible = unwrapReactInteropSymbol(CollapsibleImport, 'Collapsible') || unwrapReactInteropSymbol(renderUi.Collapsible, 'Collapsible');\nimport * as RenderUiNamespace from '@pie-lib/render-ui';\nconst renderUiNamespaceAny = RenderUiNamespace as any;\nconst renderUiDefaultMaybe = renderUiNamespaceAny['default'];\nconst renderUi =\n renderUiDefaultMaybe && typeof renderUiDefaultMaybe === 'object'\n ? renderUiDefaultMaybe\n : renderUiNamespaceAny;\n// Must match the breakpoint Quiz Engine passes to the PIE section player for\n// switching from the side-by-side passage/question layout to the tabbed layout.\n// Below (and at) this width the passage tabs scroll with the passage content\n// instead of being locked to the top of the panel, so that they do not lock up\n// space needed for the passage text (WCAG 1.4.10 Reflow, 400% zoom / 320px).\nconst STICKY_TABS_BREAKPOINT = 840;\n\n/**\n * Zoom compensation for the passage selection tabs.\n *\n * The tabs scale naturally with browser zoom up to 200%. Beyond 200%,\n * we shrink their CSS size proportionally so their physical on-screen size\n * freezes at the 200% appearance, leaving more room for passage content\n * in high-zoom / small-window situations.\n * The factor is min(1, 2 / zoom): exactly 1 at zoom <= 200% (component\n * behavior unchanged), shrinking proportionally above that. A lower clamp\n * of 0.4 guards against inflated ratios (docked devtools, browser side\n * panels, window chrome) ever making the tabs unusably small.\n */\nconst MAX_TABS_ZOOM = 2;\nconst MIN_ZOOM_COMPENSATION = 0.4;\n\n// Per-tab horizontal-space floor in CSS pixels. When the passage container is\n// narrow enough that each tab would have at most this much room\n// (containerWidth <= tabs.length * NUMERIC_LABEL_MIN_WIDTH_PER_TAB), tab labels\n// fall back to \"Passage 1\", \"Passage 2\", ... so navigation stays usable instead\n// of being dominated by aggressively truncated titles.\nconst NUMERIC_LABEL_MIN_WIDTH_PER_TAB = 170;\n\nconst computeZoomCompensation = () => {\n if (typeof window === 'undefined') return 1;\n const ratio = window.outerWidth / window.innerWidth;\n const zoom = Number.isFinite(ratio) && ratio > 0 ? ratio : 1;\n return Math.max(MIN_ZOOM_COMPENSATION, Math.min(1, MAX_TABS_ZOOM / zoom));\n};\n\nconst PassagesContainer: any = styled('div')({\n flexGrow: 1,\n backgroundColor: color.background(),\n color: color.text(),\n '&:not(.MathJax) table': {\n borderCollapse: 'collapse',\n },\n '&:not(.MathJax) table td, &:not(.MathJax) table th': {\n padding: '.6em 1em',\n textAlign: 'left',\n },\n});\n\nconst Passage: any = styled('div')(({ theme }) => ({\n backgroundColor: color.background(),\n color: color.text(),\n padding: theme.spacing(2),\n '& blockquote': {\n background: '#f9f9f9',\n borderLeft: '5px solid #ccc',\n margin: '1.5em 10px',\n padding: '.5em 10px',\n },\n}));\n\nconst PassageTitle: any = styled('div')({\n fontSize: '1.75rem',\n});\n\nconst PassageSubtitle: any = styled('div')({\n fontSize: '1.5rem',\n});\n\nconst PassageAuthor: any = styled('div')({\n fontSize: '1.25rem',\n});\n\nconst TabStyled: any = styled(Tab)(({ theme }) => ({\n /*\n * The tab carries the colour of the panel it opens, which is what makes it read as a\n * tab rather than a button, and it has to be the themed panel colour: MUI's palette\n * does not follow `--pie-*`, so `common.white` here left the tab white on every color\n * scheme while the passage body beneath it went dark. The comment this replaces gated\n * the change on PD-2801, which is about OT's `color-contrast` class -- the mechanism\n * pie-theme superseded, and blocked since 2023.\n */\n background: color.background(),\n fontSize: 'inherit',\n fontFamily: 'Roboto, sans-serif',\n color: color.text(),\n borderRadius: `${theme.spacing(2)} ${theme.spacing(2)} 0 0`,\n /*\n * `--pie-border-gray` is stepped to the 3:1 non-text minimum in every scheme. The\n * literal it replaces measured about 1.2:1 against the dark schemes' surfaces, so the\n * tab outline -- the only thing separating an unselected tab from the strip -- was\n * invisible there.\n */\n border: `1px solid ${color.borderGray()}`,\n borderBottomWidth: 0,\n minHeight: '56px',\n padding: '8px 10px',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n margin: `0 ${theme.spacing(1)}`,\n textTransform: 'none',\n\n '.passage-label': {\n display: '-webkit-box',\n WebkitLineClamp: 2,\n WebkitBoxOrient: 'vertical',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'normal',\n margin: 'auto 0',\n opacity: 0.7,\n },\n\n '&.Mui-selected': {\n color: color.text(),\n '.passage-label': {\n opacity: 1,\n },\n '.passage-label-underline': {\n backgroundColor: color.tertiary(),\n },\n },\n\n '&:hover': {\n '.passage-label-underline': {\n backgroundColor: color.tertiaryLight(),\n },\n },\n\n '& .MuiTouchRipple-root': {\n opacity: 0.7,\n },\n}));\n\n/*\n * The selection indicator, one per tab. Unselected it has to disappear into the tab, so it\n * paints the tab's own background rather than a fixed white; selected it becomes\n * `--pie-tertiary`, which every scheme sets.\n */\nconst Underline: any = styled('div')(() => ({\n height: '2px',\n width: '100%',\n marginTop: '6px',\n background: color.background(),\n}));\n\nclass StimulusTabs extends React.Component {\n state = {\n activeTab: 0,\n zoomCompensation: computeZoomCompensation(),\n containerWidth: 0,\n };\n\n containerRef = React.createRef();\n\n componentDidMount() {\n if (typeof window === 'undefined') return;\n window.addEventListener('resize', this.updateZoomCompensation);\n\n if (this.containerRef.current && typeof ResizeObserver !== 'undefined') {\n this.resizeObserver = new ResizeObserver(this.updateContainerWidth);\n this.resizeObserver.observe(this.containerRef.current);\n }\n\n this.updateContainerWidth();\n }\n\n componentWillUnmount() {\n if (typeof window === 'undefined') return;\n window.removeEventListener('resize', this.updateZoomCompensation);\n\n if (this.resizeObserver) {\n this.resizeObserver.disconnect();\n this.resizeObserver = null;\n }\n }\n\n updateZoomCompensation: any = () => {\n this.setState({ zoomCompensation: computeZoomCompensation() });\n };\n\n updateContainerWidth: any = () => {\n const node = this.containerRef.current;\n if (!node) return;\n const width = node.clientWidth;\n if (width !== this.state.containerWidth) {\n this.setState({ containerWidth: width });\n }\n };\n\n handleChange: any = (event, activeTab) => {\n this.setState(() => ({ activeTab }));\n\n setTimeout(() => {\n const tabChangeEvent = new CustomEvent('pie-ui-passage-tabChanged', {\n detail: { tab: activeTab },\n });\n\n window.dispatchEvent(tabChangeEvent);\n });\n };\n\n handleKeyDown: any = (event, currentTabId) => {\n const { key } = event;\n const { tabs } = this.props;\n\n let newTabIndex = -1;\n const currentIndex = tabs.findIndex((tab) => tab.id === currentTabId);\n\n switch (key) {\n case 'ArrowRight':\n // Move to the next tab\n newTabIndex = (currentIndex + 1) % tabs.length;\n break;\n case 'ArrowLeft':\n // Move to the previous tab\n newTabIndex = (currentIndex - 1 + tabs.length) % tabs.length;\n break;\n // Commented out ArrowDown and ArrowUp for future vertical tab navigation\n // case 'ArrowDown':\n // // Move to the next tab (for vertical alignment)\n // newTabIndex = (currentIndex + 1) % tabs.length;\n // break;\n // case 'ArrowUp':\n // // Move to the previous tab (for vertical alignment)\n // newTabIndex = (currentIndex - 1 + tabs.length) % tabs.length;\n // break;\n case 'Home':\n // Move to the first tab\n newTabIndex = 0;\n break;\n case 'End':\n // Move to the last tab\n newTabIndex = tabs.length - 1;\n break;\n case 'Enter':\n case ' ':\n // Activate the current tab\n newTabIndex = currentIndex;\n break;\n default:\n break;\n }\n\n if (newTabIndex !== -1) {\n event.preventDefault();\n event.stopPropagation();\n this.handleChange(event, tabs[newTabIndex].id);\n document.getElementById(`button-${tabs[newTabIndex].id}`).focus();\n }\n };\n\n parsedText: any = (text = '') => {\n // fix imported audio content for Safari PD-1391\n const div = document.createElement('div');\n div.innerHTML = text.replace(/(<br\\/>\\n)/g, '<br/>');\n\n const audio = div.querySelector('audio');\n\n if (audio) {\n const source = document.createElement('source');\n\n source.setAttribute('type', 'audio/mp3');\n source.setAttribute('src', audio.getAttribute('src'));\n\n audio.removeAttribute('src');\n audio.appendChild(source);\n }\n\n return div.innerHTML;\n };\n\n renderInstructions(teacherInstructions, disabledTabs = false) {\n if (!teacherInstructions) {\n return;\n }\n\n const teacherInstructionsDiv = (\n <PreviewPrompt\n tagName=\"div\"\n className=\"prompt\"\n defaultClassName=\"teacher-instructions\"\n prompt={teacherInstructions}\n />\n );\n\n if (disabledTabs) {\n return teacherInstructionsDiv;\n }\n\n return (\n <Collapsible\n labels={{\n hidden: 'Show Teacher Instructions',\n visible: 'Hide Teacher Instructions',\n }}\n >\n {teacherInstructionsDiv}\n </Collapsible>\n );\n }\n\n renderTab(tab, disabledTabs) {\n const { baseHeadingLevel } = this.props;\n const clampedLevel = baseHeadingLevel ? Math.min(6, Math.max(1, baseHeadingLevel)) : undefined;\n const TitleTag = baseHeadingLevel ? `h${clampedLevel}` : 'h2'; // default to h2 if no base level is provided - this was the previous behavior\n const textLevel = baseHeadingLevel ? Math.min(6, Math.max(1, clampedLevel + 1)) : undefined; // promote text headings one level above title\n\n return (\n <Passage key={tab.id} id={`tabpanel-${tab.id}`} role=\"tabpanel\" aria-labelledby={`button-${tab.id}`}>\n {this.renderInstructions(tab.teacherInstructions, disabledTabs)}\n\n {tab.title && (\n <Purpose purpose=\"passage-title\">\n <TitleTag>\n <PassageTitle dangerouslySetInnerHTML={{ __html: this.parsedText(tab.title) }} />\n </TitleTag>\n </Purpose>\n )}\n\n {tab.subtitle && (\n <Purpose purpose=\"passage-subtitle\">\n <PassageSubtitle dangerouslySetInnerHTML={{ __html: this.parsedText(tab.subtitle) }} />\n </Purpose>\n )}\n\n {tab.author && (\n <Purpose purpose=\"passage-author\">\n <PassageAuthor className=\"author\" dangerouslySetInnerHTML={{ __html: this.parsedText(tab.author) }} />\n </Purpose>\n )}\n\n {tab.text && (\n <Purpose purpose=\"passage-text\">\n <div key={tab.id} className=\"text\" dangerouslySetInnerHTML={{ __html: baseHeadingLevel ? transformDataHeadings(tab.text, textLevel) : tab.text }} />\n </Purpose>\n )}\n </Passage>\n );\n }\n\n render() {\n const { model, tabs, disabledTabs } = this.props;\n const { activeTab, zoomCompensation, containerWidth } = this.state;\n\n if (!tabs?.length) {\n return;\n }\n\n const { extraCSSRules } = model || {};\n const selectedTab = (tabs || []).find((tab) => tab.id === activeTab);\n\n // cap each tab at 1/n of the passage container width so a single long\n // title can't push other tabs off-screen. Existing two-line wrap + ellipsis\n // on .passage-label still trims anything that doesn't fit.\n const tabMaxWidth = containerWidth > 0 ? containerWidth / tabs.length : null;\n // When per-tab horizontal space drops to NUMERIC_LABEL_MIN_WIDTH_PER_TAB or\n // less, titles become unreadably truncated; swap to \"Passage N\" so users\n // can still navigate. Container width is read once layout has settled\n // (>0), so initial render uses real labels.\n const useNumericLabels =\n containerWidth > 0 && containerWidth <= tabs.length * NUMERIC_LABEL_MIN_WIDTH_PER_TAB;\n\n return (\n <UiLayout extraCSSRules={extraCSSRules}>\n <PassagesContainer className=\"passages\" ref={this.containerRef}>\n {disabledTabs || tabs.length === 1 ? (\n tabs.map((tab) => this.renderTab(tab, disabledTabs))\n ) : (\n <>\n <Tabs\n sx={{\n // Below the breakpoint (e.g. WCAG 400% zoom, ~320px viewport)\n // the tabs are in normal flow and scroll with the passage text,\n // so they don't lock up space needed to display the passage.\n position: 'static',\n // Above the breakpoint there is adequate screen space, so the\n // tabs stay locked to the top of the panel while the passage\n // text scrolls beneath them.\n [`@media (min-width: ${STICKY_TABS_BREAKPOINT + 1}px)`]: {\n position: 'sticky',\n top: 0,\n zIndex: 1,\n },\n background: 'var(--pie-passage-header-background, rgba(255,255,255,0))',\n color: color.text(),\n fontFamily: 'Roboto, sans-serif',\n // Freeze the tabs' physical size at their 200%-zoom appearance\n // when browser zoom exceeds 200%. The factor is 1 at zoom <= 200%,\n // so behavior below that threshold is unchanged. Using `zoom`\n // (rather than transform: scale) shrinks the layout box itself,\n // so the reclaimed space flows to the passage content below.\n zoom: zoomCompensation,\n '& .MuiTabs-list': {\n /*\n * The strip behind the tabs. A host that has opted into\n * `--pie-passage-header-background` keeps its own colour on every\n * scheme -- Knowledge Checks' pale green-blue is deliberate and is not\n * a scheme's business to override. With no host colour the fallback has\n * to be a theme token rather than a white literal, or the strip stays\n * white over a dark passage body.\n */\n backgroundColor: `var(--pie-passage-header-background, ${color.backgroundDark()})`,\n borderBottom: `1px solid ${color.borderGray()}`,\n },\n '& .MuiTabs-indicator': {\n backgroundColor: color.white(),\n marginBottom: '-1px',\n },\n }}\n value={activeTab}\n onChange={this.handleChange}\n >\n {tabs.map((tab, index) => (\n <TabStyled\n key={tab.id}\n id={`button-${tab.id}`}\n sx={tabMaxWidth ? { maxWidth: `${tabMaxWidth}px` } : undefined}\n label={\n <>\n <Purpose purpose=\"passage-label\">\n {useNumericLabels ? (\n <span className=\"passage-label\">{`Passage ${index + 1}`}</span>\n ) : (\n <span\n className=\"passage-label\"\n dangerouslySetInnerHTML={{ __html: this.parsedText(tab.label) }}\n />\n )}\n </Purpose>\n <Underline className=\"passage-label-underline\" />\n </>\n }\n value={tab.id}\n tabIndex={activeTab === tab.id ? 0 : -1}\n aria-controls={`tabpanel-${tab.id}`}\n aria-selected={activeTab === tab.id}\n onKeyDown={(event) => this.handleKeyDown(event, tab.id)}\n />\n ))}\n </Tabs>\n {selectedTab ? this.renderTab(selectedTab, disabledTabs) : null}\n </>\n )}\n </PassagesContainer>\n </UiLayout>\n );\n }\n}\n\nStimulusTabs.propTypes = {\n tabs: PropTypes.arrayOf(\n PropTypes.shape({\n id: PropTypes.number.isRequired,\n label: PropTypes.string.isRequired,\n title: PropTypes.string.isRequired,\n subtitle: PropTypes.string,\n author: PropTypes.string,\n text: PropTypes.string.isRequired,\n teacherInstructions: PropTypes.string,\n }).isRequired,\n ).isRequired,\n disabledTabs: PropTypes.bool,\n model: PropTypes.object,\n baseHeadingLevel: PropTypes.number,\n};\n\nexport default StimulusTabs;\n"],"mappings":";;;;;;AAiBA,SAAS,EAA6B,GAAY;CAChD,OACE,OAAO,KAAU,cAChB,OAAO,KAAU,cAAY,KAAkB,OAAO,EAAM,YAAa;AAE9E;AAEA,SAAS,EAAyB,GAAkB,GAAsB;CAUxE,OATI,CAAC,KACD,EAA6B,CAAW,IAAU,IAClD,EAA6B,EAAY,OAAO,IAAU,EAAY,UACtE,KAAe,EAA6B,EAAY,EAAY,IAC/D,EAAY,KAEjB,KAAe,EAA6B,EAAY,EAAY,EAAE,OAAO,IACxE,EAA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AAI;MAClB,IAAI,IAAc,EAAE,UAAU,GAAG,EAAY,IAAI,IAAI,KAAA;MACrD,OACE,kBAAA,GAAA,EAAA,UAAA,CACE,kBAAC,GAAD;OAAS,SAAQ;iBACd,IACC,kBAAC,QAAD;QAAM,WAAU;kBAAiB,WAAW,IAAQ;OAAU,CAAA,IAE9D,kBAAC,QAAD;QACE,WAAU;QACV,yBAAyB,EAAE,QAAQ,KAAK,WAAW,EAAI,KAAK,EAAE;OAC/D,CAAA;MAEI,CAAA,GACT,kBAAC,GAAD,EAAW,WAAU,0BAA2B,CAAA,CAChD,EAAA,CAAA;MAEJ,OAAO,EAAI;MACX,UAAU,MAAc,EAAI,KAAK,IAAI;MACrC,iBAAe,YAAY,EAAI;MAC/B,iBAAe,MAAc,EAAI;MACjC,YAAY,MAAU,KAAK,cAAc,GAAO,EAAI,EAAE;KACvD,GAvBM,EAAI,EAuBV,CACF;IACG,CAAA,GACL,IAAc,KAAK,UAAU,GAAa,CAAY,IAAI,IAC3D,EAAA,CAAA;GAEa,CAAA;EACX,CAAA;CAEd;AACF;AAEA,EAAa,YAAY;CACvB,MAAM,EAAA,QAAU,QACd,EAAA,QAAU,MAAM;EACd,IAAI,EAAA,QAAU,OAAO;EACrB,OAAO,EAAA,QAAU,OAAO;EACxB,OAAO,EAAA,QAAU,OAAO;EACxB,UAAU,EAAA,QAAU;EACpB,QAAQ,EAAA,QAAU;EAClB,MAAM,EAAA,QAAU,OAAO;EACvB,qBAAqB,EAAA,QAAU;CACjC,CAAC,CAAC,CAAC,UACL,CAAC,CAAC;CACF,cAAc,EAAA,QAAU;CACxB,OAAO,EAAA,QAAU;CACjB,kBAAkB,EAAA,QAAU;AAC9B"}
|
package/dist/delivery/index.js
CHANGED
|
@@ -76,7 +76,7 @@ var o = class extends HTMLElement {
|
|
|
76
76
|
this._playerObserver &&= (this._playerObserver.disconnect(), null);
|
|
77
77
|
}
|
|
78
78
|
disconnectedCallback() {
|
|
79
|
-
this._disconnectMathObserver(), this._disconnectPlayerObserver(), this._root
|
|
79
|
+
this._disconnectMathObserver(), this._disconnectPlayerObserver(), this._root &&= (this._root.unmount(), null);
|
|
80
80
|
}
|
|
81
81
|
};
|
|
82
82
|
//#endregion
|
|
@@ -10,7 +10,14 @@ import React from 'react';
|
|
|
10
10
|
declare class StimulusTabs extends React.Component {
|
|
11
11
|
state: {
|
|
12
12
|
activeTab: number;
|
|
13
|
+
zoomCompensation: number;
|
|
14
|
+
containerWidth: number;
|
|
13
15
|
};
|
|
16
|
+
containerRef: React.RefObject<unknown>;
|
|
17
|
+
componentDidMount(): void;
|
|
18
|
+
componentWillUnmount(): void;
|
|
19
|
+
updateZoomCompensation: any;
|
|
20
|
+
updateContainerWidth: any;
|
|
14
21
|
handleChange: any;
|
|
15
22
|
handleKeyDown: any;
|
|
16
23
|
parsedText: any;
|
|
@@ -13,7 +13,11 @@ function h(e) {
|
|
|
13
13
|
function g(e, t) {
|
|
14
14
|
return !e || h(e) ? e : h(e.default) ? e.default : t && h(e[t]) ? e[t] : t && h(e[t]?.default) ? e[t].default : e;
|
|
15
15
|
}
|
|
16
|
-
var _ = g(l, "UiLayout") || g(C.UiLayout, "UiLayout"), v = g(c, "Purpose") || g(C.Purpose, "Purpose"), y = g(s, "PreviewPrompt") || g(C.PreviewPrompt, "PreviewPrompt"), b = g(o, "Collapsible") || g(C.Collapsible, "Collapsible"), x = a, S = x.default, C = S && typeof S == "object" ? S : x, w =
|
|
16
|
+
var _ = g(l, "UiLayout") || g(C.UiLayout, "UiLayout"), v = g(c, "Purpose") || g(C.Purpose, "Purpose"), y = g(s, "PreviewPrompt") || g(C.PreviewPrompt, "PreviewPrompt"), b = g(o, "Collapsible") || g(C.Collapsible, "Collapsible"), x = a, S = x.default, C = S && typeof S == "object" ? S : x, w = 2, T = .4, E = 170, D = () => {
|
|
17
|
+
if (typeof window > "u") return 1;
|
|
18
|
+
let e = window.outerWidth / window.innerWidth;
|
|
19
|
+
return Math.max(T, Math.min(1, w / (Number.isFinite(e) && e > 0 ? e : 1)));
|
|
20
|
+
}, O = i("div")({
|
|
17
21
|
flexGrow: 1,
|
|
18
22
|
backgroundColor: u.background(),
|
|
19
23
|
color: u.text(),
|
|
@@ -22,7 +26,7 @@ var _ = g(l, "UiLayout") || g(C.UiLayout, "UiLayout"), v = g(c, "Purpose") || g(
|
|
|
22
26
|
padding: ".6em 1em",
|
|
23
27
|
textAlign: "left"
|
|
24
28
|
}
|
|
25
|
-
}),
|
|
29
|
+
}), k = i("div")(({ theme: e }) => ({
|
|
26
30
|
backgroundColor: u.background(),
|
|
27
31
|
color: u.text(),
|
|
28
32
|
padding: e.spacing(2),
|
|
@@ -32,13 +36,13 @@ var _ = g(l, "UiLayout") || g(C.UiLayout, "UiLayout"), v = g(c, "Purpose") || g(
|
|
|
32
36
|
margin: "1.5em 10px",
|
|
33
37
|
padding: ".5em 10px"
|
|
34
38
|
}
|
|
35
|
-
})),
|
|
36
|
-
background:
|
|
39
|
+
})), A = i("div")({ fontSize: "1.75rem" }), j = i("div")({ fontSize: "1.5rem" }), M = i("div")({ fontSize: "1.25rem" }), N = i(r)(({ theme: e }) => ({
|
|
40
|
+
background: u.background(),
|
|
37
41
|
fontSize: "inherit",
|
|
38
42
|
fontFamily: "Roboto, sans-serif",
|
|
39
|
-
color:
|
|
43
|
+
color: u.text(),
|
|
40
44
|
borderRadius: `${e.spacing(2)} ${e.spacing(2)} 0 0`,
|
|
41
|
-
border:
|
|
45
|
+
border: `1px solid ${u.borderGray()}`,
|
|
42
46
|
borderBottomWidth: 0,
|
|
43
47
|
minHeight: "56px",
|
|
44
48
|
padding: "8px 10px",
|
|
@@ -58,19 +62,39 @@ var _ = g(l, "UiLayout") || g(C.UiLayout, "UiLayout"), v = g(c, "Purpose") || g(
|
|
|
58
62
|
opacity: .7
|
|
59
63
|
},
|
|
60
64
|
"&.Mui-selected": {
|
|
61
|
-
color:
|
|
65
|
+
color: u.text(),
|
|
62
66
|
".passage-label": { opacity: 1 },
|
|
63
|
-
".passage-label-underline": { backgroundColor:
|
|
67
|
+
".passage-label-underline": { backgroundColor: u.tertiary() }
|
|
64
68
|
},
|
|
65
|
-
"&:hover": { ".passage-label-underline": { backgroundColor:
|
|
69
|
+
"&:hover": { ".passage-label-underline": { backgroundColor: u.tertiaryLight() } },
|
|
66
70
|
"& .MuiTouchRipple-root": { opacity: .7 }
|
|
67
|
-
})),
|
|
71
|
+
})), P = i("div")(() => ({
|
|
68
72
|
height: "2px",
|
|
69
73
|
width: "100%",
|
|
70
74
|
marginTop: "6px",
|
|
71
|
-
background:
|
|
72
|
-
})),
|
|
73
|
-
state = {
|
|
75
|
+
background: u.background()
|
|
76
|
+
})), F = class extends e.Component {
|
|
77
|
+
state = {
|
|
78
|
+
activeTab: 0,
|
|
79
|
+
zoomCompensation: D(),
|
|
80
|
+
containerWidth: 0
|
|
81
|
+
};
|
|
82
|
+
containerRef = e.createRef();
|
|
83
|
+
componentDidMount() {
|
|
84
|
+
typeof window > "u" || (window.addEventListener("resize", this.updateZoomCompensation), this.containerRef.current && typeof ResizeObserver < "u" && (this.resizeObserver = new ResizeObserver(this.updateContainerWidth), this.resizeObserver.observe(this.containerRef.current)), this.updateContainerWidth());
|
|
85
|
+
}
|
|
86
|
+
componentWillUnmount() {
|
|
87
|
+
typeof window > "u" || (window.removeEventListener("resize", this.updateZoomCompensation), this.resizeObserver &&= (this.resizeObserver.disconnect(), null));
|
|
88
|
+
}
|
|
89
|
+
updateZoomCompensation = () => {
|
|
90
|
+
this.setState({ zoomCompensation: D() });
|
|
91
|
+
};
|
|
92
|
+
updateContainerWidth = () => {
|
|
93
|
+
let e = this.containerRef.current;
|
|
94
|
+
if (!e) return;
|
|
95
|
+
let t = e.clientWidth;
|
|
96
|
+
t !== this.state.containerWidth && this.setState({ containerWidth: t });
|
|
97
|
+
};
|
|
74
98
|
handleChange = (e, t) => {
|
|
75
99
|
this.setState(() => ({ activeTab: t })), setTimeout(() => {
|
|
76
100
|
let e = new CustomEvent("pie-ui-passage-tabChanged", { detail: { tab: t } });
|
|
@@ -128,7 +152,7 @@ var _ = g(l, "UiLayout") || g(C.UiLayout, "UiLayout"), v = g(c, "Purpose") || g(
|
|
|
128
152
|
}
|
|
129
153
|
renderTab(e, t) {
|
|
130
154
|
let { baseHeadingLevel: n } = this.props, r = n ? Math.min(6, Math.max(1, n)) : void 0, i = n ? `h${r}` : "h2", a = n ? Math.min(6, Math.max(1, r + 1)) : void 0;
|
|
131
|
-
return /* @__PURE__ */ m(
|
|
155
|
+
return /* @__PURE__ */ m(k, {
|
|
132
156
|
id: `tabpanel-${e.id}`,
|
|
133
157
|
role: "tabpanel",
|
|
134
158
|
"aria-labelledby": `button-${e.id}`,
|
|
@@ -136,15 +160,15 @@ var _ = g(l, "UiLayout") || g(C.UiLayout, "UiLayout"), v = g(c, "Purpose") || g(
|
|
|
136
160
|
this.renderInstructions(e.teacherInstructions, t),
|
|
137
161
|
e.title && /* @__PURE__ */ p(v, {
|
|
138
162
|
purpose: "passage-title",
|
|
139
|
-
children: /* @__PURE__ */ p(i, { children: /* @__PURE__ */ p(
|
|
163
|
+
children: /* @__PURE__ */ p(i, { children: /* @__PURE__ */ p(A, { dangerouslySetInnerHTML: { __html: this.parsedText(e.title) } }) })
|
|
140
164
|
}),
|
|
141
165
|
e.subtitle && /* @__PURE__ */ p(v, {
|
|
142
166
|
purpose: "passage-subtitle",
|
|
143
|
-
children: /* @__PURE__ */ p(
|
|
167
|
+
children: /* @__PURE__ */ p(j, { dangerouslySetInnerHTML: { __html: this.parsedText(e.subtitle) } })
|
|
144
168
|
}),
|
|
145
169
|
e.author && /* @__PURE__ */ p(v, {
|
|
146
170
|
purpose: "passage-author",
|
|
147
|
-
children: /* @__PURE__ */ p(
|
|
171
|
+
children: /* @__PURE__ */ p(M, {
|
|
148
172
|
className: "author",
|
|
149
173
|
dangerouslySetInnerHTML: { __html: this.parsedText(e.author) }
|
|
150
174
|
})
|
|
@@ -160,49 +184,62 @@ var _ = g(l, "UiLayout") || g(C.UiLayout, "UiLayout"), v = g(c, "Purpose") || g(
|
|
|
160
184
|
}, e.id);
|
|
161
185
|
}
|
|
162
186
|
render() {
|
|
163
|
-
let { model: e, tabs: t, disabledTabs: r } = this.props, { activeTab: i } = this.state;
|
|
187
|
+
let { model: e, tabs: t, disabledTabs: r } = this.props, { activeTab: i, zoomCompensation: a, containerWidth: o } = this.state;
|
|
164
188
|
if (!t?.length) return;
|
|
165
|
-
let { extraCSSRules:
|
|
189
|
+
let { extraCSSRules: s } = e || {}, c = (t || []).find((e) => e.id === i), l = o > 0 ? o / t.length : null, d = o > 0 && o <= t.length * E;
|
|
166
190
|
return /* @__PURE__ */ p(_, {
|
|
167
|
-
extraCSSRules:
|
|
168
|
-
children: /* @__PURE__ */ p(
|
|
191
|
+
extraCSSRules: s,
|
|
192
|
+
children: /* @__PURE__ */ p(O, {
|
|
169
193
|
className: "passages",
|
|
194
|
+
ref: this.containerRef,
|
|
170
195
|
children: r || t.length === 1 ? t.map((e) => this.renderTab(e, r)) : /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p(n, {
|
|
171
196
|
sx: {
|
|
172
|
-
position: "
|
|
173
|
-
|
|
174
|
-
|
|
197
|
+
position: "static",
|
|
198
|
+
"@media (min-width: 841px)": {
|
|
199
|
+
position: "sticky",
|
|
200
|
+
top: 0,
|
|
201
|
+
zIndex: 1
|
|
202
|
+
},
|
|
203
|
+
background: "var(--pie-passage-header-background, rgba(255,255,255,0))",
|
|
175
204
|
color: u.text(),
|
|
176
205
|
fontFamily: "Roboto, sans-serif",
|
|
177
|
-
|
|
206
|
+
zoom: a,
|
|
207
|
+
"& .MuiTabs-list": {
|
|
208
|
+
backgroundColor: `var(--pie-passage-header-background, ${u.backgroundDark()})`,
|
|
209
|
+
borderBottom: `1px solid ${u.borderGray()}`
|
|
210
|
+
},
|
|
178
211
|
"& .MuiTabs-indicator": {
|
|
179
|
-
backgroundColor:
|
|
212
|
+
backgroundColor: u.white(),
|
|
180
213
|
marginBottom: "-1px"
|
|
181
214
|
}
|
|
182
215
|
},
|
|
183
216
|
value: i,
|
|
184
217
|
onChange: this.handleChange,
|
|
185
|
-
children: t.map((e) => /* @__PURE__ */ p(
|
|
218
|
+
children: t.map((e, t) => /* @__PURE__ */ p(N, {
|
|
186
219
|
id: `button-${e.id}`,
|
|
220
|
+
sx: l ? { maxWidth: `${l}px` } : void 0,
|
|
187
221
|
label: /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p(v, {
|
|
188
222
|
purpose: "passage-label",
|
|
189
|
-
children: /* @__PURE__ */ p("span", {
|
|
223
|
+
children: d ? /* @__PURE__ */ p("span", {
|
|
224
|
+
className: "passage-label",
|
|
225
|
+
children: `Passage ${t + 1}`
|
|
226
|
+
}) : /* @__PURE__ */ p("span", {
|
|
190
227
|
className: "passage-label",
|
|
191
228
|
dangerouslySetInnerHTML: { __html: this.parsedText(e.label) }
|
|
192
229
|
})
|
|
193
|
-
}), /* @__PURE__ */ p(
|
|
230
|
+
}), /* @__PURE__ */ p(P, { className: "passage-label-underline" })] }),
|
|
194
231
|
value: e.id,
|
|
195
232
|
tabIndex: i === e.id ? 0 : -1,
|
|
196
233
|
"aria-controls": `tabpanel-${e.id}`,
|
|
197
234
|
"aria-selected": i === e.id,
|
|
198
235
|
onKeyDown: (t) => this.handleKeyDown(t, e.id)
|
|
199
236
|
}, e.id))
|
|
200
|
-
}),
|
|
237
|
+
}), c ? this.renderTab(c, r) : null] })
|
|
201
238
|
})
|
|
202
239
|
});
|
|
203
240
|
}
|
|
204
241
|
};
|
|
205
|
-
|
|
242
|
+
F.propTypes = {
|
|
206
243
|
tabs: t.arrayOf(t.shape({
|
|
207
244
|
id: t.number.isRequired,
|
|
208
245
|
label: t.string.isRequired,
|
|
@@ -217,4 +254,4 @@ j.propTypes = {
|
|
|
217
254
|
baseHeadingLevel: t.number
|
|
218
255
|
};
|
|
219
256
|
//#endregion
|
|
220
|
-
export {
|
|
257
|
+
export { F as default };
|