@pie-element/passage 7.4.4 → 8.0.0-next.20261002094057

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 (109) hide show
  1. package/author.js +2 -0
  2. package/configure.js +2 -0
  3. package/controller.js +1 -0
  4. package/dist/author/common.d.ts +36 -0
  5. package/dist/author/common.js +57 -0
  6. package/dist/author/defaults.d.ts +175 -0
  7. package/dist/author/defaults.js +113 -0
  8. package/dist/author/design.d.ts +28 -0
  9. package/dist/author/design.js +120 -0
  10. package/dist/author/index.d.ts +36 -0
  11. package/dist/author/index.js +66 -0
  12. package/dist/author/passage.d.ts +27 -0
  13. package/dist/author/passage.js +127 -0
  14. package/dist/browser/assets/Symbola-4c507403.woff2 +0 -0
  15. package/dist/browser/author/index.js +34161 -0
  16. package/dist/browser/author/index.js.map +1 -0
  17. package/dist/browser/controller/index.js +64 -0
  18. package/dist/browser/controller/index.js.map +1 -0
  19. package/dist/browser/delivery/index.js +117 -0
  20. package/dist/browser/delivery/index.js.map +1 -0
  21. package/dist/browser/dist-BtyOUh0E.js +9737 -0
  22. package/dist/browser/dist-BtyOUh0E.js.map +1 -0
  23. package/dist/browser/dist-CiWlBjsz.js +92 -0
  24. package/dist/browser/dist-CiWlBjsz.js.map +1 -0
  25. package/dist/browser/editor-runtime/assets/Symbola-4c507403.woff2 +0 -0
  26. package/dist/browser/editor-runtime/author/index.js +17752 -0
  27. package/dist/browser/editor-runtime/author/index.js.map +1 -0
  28. package/dist/browser/editor-runtime/controller/index.js +64 -0
  29. package/dist/browser/editor-runtime/controller/index.js.map +1 -0
  30. package/dist/browser/editor-runtime/delivery/index.js +117 -0
  31. package/dist/browser/editor-runtime/delivery/index.js.map +1 -0
  32. package/dist/browser/editor-runtime/dist-Ba_6pEHz.js +9737 -0
  33. package/dist/browser/editor-runtime/dist-Ba_6pEHz.js.map +1 -0
  34. package/dist/browser/editor-runtime/dist-CiWlBjsz.js +92 -0
  35. package/dist/browser/editor-runtime/dist-CiWlBjsz.js.map +1 -0
  36. package/dist/browser/editor-runtime/print/index.js +51 -0
  37. package/dist/browser/editor-runtime/print/index.js.map +1 -0
  38. package/dist/browser/editor-runtime/rolldown-runtime-CHQKHQ89.js +32 -0
  39. package/dist/browser/editor-runtime/stimulus-tabs-41Y6tEn5.js +256 -0
  40. package/dist/browser/editor-runtime/stimulus-tabs-41Y6tEn5.js.map +1 -0
  41. package/dist/browser/print/index.js +51 -0
  42. package/dist/browser/print/index.js.map +1 -0
  43. package/dist/browser/rolldown-runtime-CWhphoD1.js +32 -0
  44. package/dist/browser/stimulus-tabs-DVM_5xjR.js +256 -0
  45. package/dist/browser/stimulus-tabs-DVM_5xjR.js.map +1 -0
  46. package/dist/controller/defaults.d.ts +23 -0
  47. package/dist/controller/defaults.js +17 -0
  48. package/dist/controller/index.d.ts +18 -0
  49. package/dist/controller/index.js +50 -0
  50. package/dist/delivery/index.d.ts +22 -0
  51. package/dist/delivery/index.js +83 -0
  52. package/dist/delivery/stimulus-tabs.d.ts +28 -0
  53. package/dist/delivery/stimulus-tabs.js +257 -0
  54. package/dist/index.d.ts +1 -0
  55. package/dist/index.iife.d.ts +8 -0
  56. package/dist/index.iife.js +145 -0
  57. package/dist/index.js +2 -0
  58. package/dist/print/index.d.ts +15 -0
  59. package/dist/print/index.js +49 -0
  60. package/dist/runtime-support.d.ts +12 -0
  61. package/dist/runtime-support.js +12 -0
  62. package/module/print.js +15919 -1
  63. package/module/print.js.map +1 -0
  64. package/package.json +104 -20
  65. package/print.js +2 -0
  66. package/CHANGELOG.json +0 -227
  67. package/CHANGELOG.md +0 -1552
  68. package/LICENSE.md +0 -5
  69. package/README.md +0 -3
  70. package/configure/CHANGELOG.md +0 -756
  71. package/configure/lib/common.js +0 -74
  72. package/configure/lib/common.js.map +0 -1
  73. package/configure/lib/defaults.js +0 -174
  74. package/configure/lib/defaults.js.map +0 -1
  75. package/configure/lib/design.js +0 -185
  76. package/configure/lib/design.js.map +0 -1
  77. package/configure/lib/index.js +0 -87
  78. package/configure/lib/index.js.map +0 -1
  79. package/configure/lib/passage.js +0 -194
  80. package/configure/lib/passage.js.map +0 -1
  81. package/configure/package.json +0 -23
  82. package/controller/CHANGELOG.json +0 -1
  83. package/controller/CHANGELOG.md +0 -121
  84. package/controller/lib/defaults.js +0 -23
  85. package/controller/lib/defaults.js.map +0 -1
  86. package/controller/lib/index.js +0 -80
  87. package/controller/lib/index.js.map +0 -1
  88. package/controller/package.json +0 -13
  89. package/docs/config-schema.json +0 -1325
  90. package/docs/config-schema.json.md +0 -974
  91. package/docs/demo/config.js +0 -8
  92. package/docs/demo/generate.js +0 -32
  93. package/docs/demo/index.html +0 -1
  94. package/docs/pie-schema.json +0 -775
  95. package/docs/pie-schema.json.md +0 -561
  96. package/lib/index.js +0 -144
  97. package/lib/index.js.map +0 -1
  98. package/lib/print.js +0 -78
  99. package/lib/print.js.map +0 -1
  100. package/lib/stimulus-tabs.js +0 -451
  101. package/lib/stimulus-tabs.js.map +0 -1
  102. package/module/configure.js +0 -1
  103. package/module/controller.js +0 -920
  104. package/module/demo.js +0 -57
  105. package/module/element.js +0 -1
  106. package/module/index.html +0 -21
  107. package/module/manifest.json +0 -14
  108. package/module/print-demo.js +0 -95
  109. package/module/print.html +0 -18
package/lib/print.js DELETED
@@ -1,78 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = void 0;
8
- var _react = _interopRequireDefault(require("react"));
9
- var _client = require("react-dom/client");
10
- var _lodashEs = require("lodash-es");
11
- var _debug = _interopRequireDefault(require("debug"));
12
- var _stimulusTabs = _interopRequireDefault(require("./stimulus-tabs"));
13
- const log = (0, _debug.default)('pie-element:passage:print');
14
- const checkNullish = value => value !== null && value !== undefined;
15
- const isEnabled = (value, defaultValue) => checkNullish(value) ? value : defaultValue;
16
- const preparePrintPassage = (model, opts) => {
17
- const isInstructor = opts.role === 'instructor';
18
-
19
- // TODO: also update '../../configure/src/defaults.js' and '../../controller/src/defaults.js' when updating defaultValue
20
- const teacherInstructionsEnabled = isEnabled(model.teacherInstructionsEnabled, true);
21
- const titleEnabled = isEnabled(model.titleEnabled, true);
22
- const authorEnabled = isEnabled(model.authorEnabled, false);
23
- const subtitleEnabled = isEnabled(model.subtitleEnabled, true);
24
- const textEnabled = isEnabled(model.textEnabled, true);
25
- return model.passages.map((passage, index) => ({
26
- id: index,
27
- teacherInstructions: isEnabled(passage.teacherInstructionsEnabled, teacherInstructionsEnabled) ? isInstructor && passage.teacherInstructions || '' : '',
28
- label: passage.title || `Passage ${index + 1}`,
29
- title: isEnabled(passage.titleEnabled, titleEnabled) ? passage.title || '' : '',
30
- author: isEnabled(passage.authorEnabled, authorEnabled) ? passage.author || '' : '',
31
- subtitle: isEnabled(passage.subtitleEnabled, subtitleEnabled) ? passage.subtitle || '' : '',
32
- text: isEnabled(passage.textEnabled, textEnabled) ? passage.text || '' : ''
33
- }));
34
- };
35
- class PassagePrint extends HTMLElement {
36
- constructor() {
37
- super();
38
- this._model = null;
39
- this._options = null;
40
- this._session = [];
41
- this._root = null;
42
- this._rerender = (0, _lodashEs.debounce)(() => {
43
- if (this._model && this._session) {
44
- if (this._model.passages && this._model.passages.length > 0) {
45
- const printPassage = preparePrintPassage(this._model, this._options);
46
- const element = /*#__PURE__*/_react.default.createElement(_stimulusTabs.default, {
47
- disabledTabs: true,
48
- tabs: printPassage
49
- });
50
- if (!this._root) {
51
- this._root = (0, _client.createRoot)(this);
52
- }
53
- this._root.render(element);
54
- }
55
- } else {
56
- log('skip');
57
- }
58
- }, 50, {
59
- leading: false,
60
- trailing: true
61
- });
62
- }
63
- set model(s) {
64
- this._model = s;
65
- this._rerender();
66
- }
67
- set options(o) {
68
- this._options = o;
69
- }
70
- connectedCallback() {}
71
- disconnectedCallback() {
72
- if (this._root) {
73
- this._root.unmount();
74
- }
75
- }
76
- }
77
- exports.default = PassagePrint;
78
- //# sourceMappingURL=print.js.map
package/lib/print.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"print.js","names":["_react","_interopRequireDefault","require","_client","_lodashEs","_debug","_stimulusTabs","log","debug","checkNullish","value","undefined","isEnabled","defaultValue","preparePrintPassage","model","opts","isInstructor","role","teacherInstructionsEnabled","titleEnabled","authorEnabled","subtitleEnabled","textEnabled","passages","map","passage","index","id","teacherInstructions","label","title","author","subtitle","text","PassagePrint","HTMLElement","constructor","_model","_options","_session","_root","_rerender","debounce","length","printPassage","element","React","createElement","StimulusTabs","disabledTabs","tabs","createRoot","render","leading","trailing","s","options","o","connectedCallback","disconnectedCallback","unmount","exports","default"],"sources":["../src/print.js"],"sourcesContent":["import React from 'react';\nimport { createRoot } from 'react-dom/client';\nimport { debounce } from 'lodash-es';\nimport debug from 'debug';\n\nimport StimulusTabs from './stimulus-tabs';\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":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAJ,sBAAA,CAAAC,OAAA;AAEA,IAAAI,aAAA,GAAAL,sBAAA,CAAAC,OAAA;AAEA,MAAMK,GAAG,GAAG,IAAAC,cAAK,EAAC,2BAA2B,CAAC;AAE9C,MAAMC,YAAY,GAAIC,KAAK,IAAKA,KAAK,KAAK,IAAI,IAAIA,KAAK,KAAKC,SAAS;AAErE,MAAMC,SAAS,GAAGA,CAACF,KAAK,EAAEG,YAAY,KAAMJ,YAAY,CAACC,KAAK,CAAC,GAAGA,KAAK,GAAGG,YAAa;AAEvF,MAAMC,mBAAmB,GAAGA,CAACC,KAAK,EAAEC,IAAI,KAAK;EAC3C,MAAMC,YAAY,GAAGD,IAAI,CAACE,IAAI,KAAK,YAAY;;EAE/C;EACA,MAAMC,0BAA0B,GAAGP,SAAS,CAACG,KAAK,CAACI,0BAA0B,EAAE,IAAI,CAAC;EACpF,MAAM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CAACA,KAAK,CAACoB,OAAO,CAAC,CAAC;IACtB;EACF;AACF;AAACC,OAAA,CAAAC,OAAA,GAAA5B,YAAA","ignoreList":[]}
@@ -1,451 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
- var _react = _interopRequireDefault(require("react"));
10
- var _propTypes = _interopRequireDefault(require("prop-types"));
11
- var _Tabs = _interopRequireDefault(require("@mui/material/Tabs"));
12
- var _Tab = _interopRequireDefault(require("@mui/material/Tab"));
13
- var _styles = require("@mui/material/styles");
14
- var _renderUi = require("@pie-lib/render-ui");
15
- // Must match the breakpoint Quiz Engine passes to the PIE section player for
16
- // switching from the side-by-side passage/question layout to the tabbed layout.
17
- // Below (and at) this width the passage tabs scroll with the passage content
18
- // instead of being locked to the top of the panel, so that they do not lock up
19
- // space needed for the passage text (WCAG 1.4.10 Reflow, 400% zoom / 320px).
20
- const STICKY_TABS_BREAKPOINT = 840;
21
-
22
- /**
23
- * Zoom compensation for the passage selection tabs.
24
- *
25
- * The tabs scale naturally with browser zoom up to 200%. Beyond 200%,
26
- * we shrink their CSS size proportionally so their physical on-screen size
27
- * freezes at the 200% appearance, leaving more room for passage content
28
- * in high-zoom / small-window situations.
29
- * The factor is min(1, 2 / zoom): exactly 1 at zoom <= 200% (component
30
- * behavior unchanged), shrinking proportionally above that. A lower clamp
31
- * of 0.4 guards against inflated ratios (docked devtools, browser side
32
- * panels, window chrome) ever making the tabs unusably small.
33
- */
34
- const MAX_TABS_ZOOM = 2;
35
- const MIN_ZOOM_COMPENSATION = 0.4;
36
-
37
- // Per-tab horizontal-space floor in CSS pixels. When the passage container is
38
- // narrow enough that each tab would have at most this much room
39
- // (containerWidth <= tabs.length * NUMERIC_LABEL_MIN_WIDTH_PER_TAB), tab labels
40
- // fall back to "Passage 1", "Passage 2", ... so navigation stays usable instead
41
- // of being dominated by aggressively truncated titles.
42
- const NUMERIC_LABEL_MIN_WIDTH_PER_TAB = 170;
43
- const computeZoomCompensation = () => {
44
- if (typeof window === 'undefined') return 1;
45
- const ratio = window.outerWidth / window.innerWidth;
46
- const zoom = Number.isFinite(ratio) && ratio > 0 ? ratio : 1;
47
- return Math.max(MIN_ZOOM_COMPENSATION, Math.min(1, MAX_TABS_ZOOM / zoom));
48
- };
49
- const PassagesContainer = (0, _styles.styled)('div')({
50
- flexGrow: 1,
51
- backgroundColor: _renderUi.color.background(),
52
- color: _renderUi.color.text(),
53
- '&:not(.MathJax) table': {
54
- borderCollapse: 'collapse'
55
- },
56
- '&:not(.MathJax) table td, &:not(.MathJax) table th': {
57
- padding: '.6em 1em',
58
- textAlign: 'left'
59
- }
60
- });
61
- const Passage = (0, _styles.styled)('div')(({
62
- theme
63
- }) => ({
64
- backgroundColor: _renderUi.color.background(),
65
- color: _renderUi.color.text(),
66
- padding: theme.spacing(2),
67
- '& blockquote': {
68
- background: '#f9f9f9',
69
- borderLeft: '5px solid #ccc',
70
- margin: '1.5em 10px',
71
- padding: '.5em 10px'
72
- }
73
- }));
74
- const PassageTitle = (0, _styles.styled)('div')({
75
- fontSize: '1.75rem'
76
- });
77
- const PassageSubtitle = (0, _styles.styled)('div')({
78
- fontSize: '1.5rem'
79
- });
80
- const PassageAuthor = (0, _styles.styled)('div')({
81
- fontSize: '1.25rem'
82
- });
83
- const TabStyled = (0, _styles.styled)(_Tab.default)(({
84
- theme
85
- }) => ({
86
- /*
87
- * The tab carries the colour of the panel it opens, which is what makes it read as a
88
- * tab rather than a button, and it has to be the themed panel colour: MUI's palette
89
- * does not follow `--pie-*`, so `common.white` here left the tab white on every color
90
- * scheme while the passage body beneath it went dark. The comment this replaces gated
91
- * the change on PD-2801, which is about OT's `color-contrast` class -- the mechanism
92
- * pie-theme superseded, and blocked since 2023.
93
- */
94
- background: _renderUi.color.background(),
95
- fontSize: 'inherit',
96
- fontFamily: 'Roboto, sans-serif',
97
- color: _renderUi.color.text(),
98
- borderRadius: `${theme.spacing(2)} ${theme.spacing(2)} 0 0`,
99
- /*
100
- * `--pie-border-gray` is stepped to the 3:1 non-text minimum in every scheme. The
101
- * literal it replaces measured about 1.2:1 against the dark schemes' surfaces, so the
102
- * tab outline -- the only thing separating an unselected tab from the strip -- was
103
- * invisible there.
104
- */
105
- border: `1px solid ${_renderUi.color.borderGray()}`,
106
- borderBottomWidth: 0,
107
- minHeight: '56px',
108
- padding: '8px 10px',
109
- display: 'flex',
110
- alignItems: 'center',
111
- justifyContent: 'center',
112
- margin: `0 ${theme.spacing(1)}`,
113
- textTransform: 'none',
114
- '.passage-label': {
115
- display: '-webkit-box',
116
- WebkitLineClamp: 2,
117
- WebkitBoxOrient: 'vertical',
118
- overflow: 'hidden',
119
- textOverflow: 'ellipsis',
120
- whiteSpace: 'normal',
121
- margin: 'auto 0',
122
- opacity: 0.7
123
- },
124
- '&.Mui-selected': {
125
- color: _renderUi.color.text(),
126
- '.passage-label': {
127
- opacity: 1
128
- },
129
- '.passage-label-underline': {
130
- backgroundColor: _renderUi.color.tertiary()
131
- }
132
- },
133
- '&:hover': {
134
- '.passage-label-underline': {
135
- backgroundColor: _renderUi.color.tertiaryLight()
136
- }
137
- },
138
- '& .MuiTouchRipple-root': {
139
- opacity: 0.7
140
- }
141
- }));
142
-
143
- /*
144
- * The selection indicator, one per tab. Unselected it has to disappear into the tab, so it
145
- * paints the tab's own background rather than a fixed white; selected it becomes
146
- * `--pie-tertiary`, which every scheme sets.
147
- */
148
- const Underline = (0, _styles.styled)('div')(() => ({
149
- height: '2px',
150
- width: '100%',
151
- marginTop: '6px',
152
- background: _renderUi.color.background()
153
- }));
154
- class StimulusTabs extends _react.default.Component {
155
- constructor(...args) {
156
- super(...args);
157
- (0, _defineProperty2.default)(this, "state", {
158
- activeTab: 0,
159
- zoomCompensation: computeZoomCompensation(),
160
- containerWidth: 0
161
- });
162
- (0, _defineProperty2.default)(this, "containerRef", /*#__PURE__*/_react.default.createRef());
163
- (0, _defineProperty2.default)(this, "updateZoomCompensation", () => {
164
- this.setState({
165
- zoomCompensation: computeZoomCompensation()
166
- });
167
- });
168
- (0, _defineProperty2.default)(this, "updateContainerWidth", () => {
169
- const node = this.containerRef.current;
170
- if (!node) return;
171
- const width = node.clientWidth;
172
- if (width !== this.state.containerWidth) {
173
- this.setState({
174
- containerWidth: width
175
- });
176
- }
177
- });
178
- (0, _defineProperty2.default)(this, "handleChange", (event, activeTab) => {
179
- this.setState(() => ({
180
- activeTab
181
- }));
182
- setTimeout(() => {
183
- const tabChangeEvent = new CustomEvent('pie-ui-passage-tabChanged', {
184
- detail: {
185
- tab: activeTab
186
- }
187
- });
188
- window.dispatchEvent(tabChangeEvent);
189
- });
190
- });
191
- (0, _defineProperty2.default)(this, "handleKeyDown", (event, currentTabId) => {
192
- const {
193
- key
194
- } = event;
195
- const {
196
- tabs
197
- } = this.props;
198
- let newTabIndex = -1;
199
- const currentIndex = tabs.findIndex(tab => tab.id === currentTabId);
200
- switch (key) {
201
- case 'ArrowRight':
202
- // Move to the next tab
203
- newTabIndex = (currentIndex + 1) % tabs.length;
204
- break;
205
- case 'ArrowLeft':
206
- // Move to the previous tab
207
- newTabIndex = (currentIndex - 1 + tabs.length) % tabs.length;
208
- break;
209
- // Commented out ArrowDown and ArrowUp for future vertical tab navigation
210
- // case 'ArrowDown':
211
- // // Move to the next tab (for vertical alignment)
212
- // newTabIndex = (currentIndex + 1) % tabs.length;
213
- // break;
214
- // case 'ArrowUp':
215
- // // Move to the previous tab (for vertical alignment)
216
- // newTabIndex = (currentIndex - 1 + tabs.length) % tabs.length;
217
- // break;
218
- case 'Home':
219
- // Move to the first tab
220
- newTabIndex = 0;
221
- break;
222
- case 'End':
223
- // Move to the last tab
224
- newTabIndex = tabs.length - 1;
225
- break;
226
- case 'Enter':
227
- case ' ':
228
- // Activate the current tab
229
- newTabIndex = currentIndex;
230
- break;
231
- default:
232
- break;
233
- }
234
- if (newTabIndex !== -1) {
235
- event.preventDefault();
236
- event.stopPropagation();
237
- this.handleChange(event, tabs[newTabIndex].id);
238
- document.getElementById(`button-${tabs[newTabIndex].id}`).focus();
239
- }
240
- });
241
- (0, _defineProperty2.default)(this, "parsedText", (text = '') => {
242
- // fix imported audio content for Safari PD-1391
243
- const div = document.createElement('div');
244
- div.innerHTML = text.replace(/(<br\/>\n)/g, '<br/>');
245
- const audio = div.querySelector('audio');
246
- if (audio) {
247
- const source = document.createElement('source');
248
- source.setAttribute('type', 'audio/mp3');
249
- source.setAttribute('src', audio.getAttribute('src'));
250
- audio.removeAttribute('src');
251
- audio.appendChild(source);
252
- }
253
- return div.innerHTML;
254
- });
255
- }
256
- componentDidMount() {
257
- if (typeof window === 'undefined') return;
258
- window.addEventListener('resize', this.updateZoomCompensation);
259
- if (this.containerRef.current && typeof ResizeObserver !== 'undefined') {
260
- this.resizeObserver = new ResizeObserver(this.updateContainerWidth);
261
- this.resizeObserver.observe(this.containerRef.current);
262
- }
263
- this.updateContainerWidth();
264
- }
265
- componentWillUnmount() {
266
- if (typeof window === 'undefined') return;
267
- window.removeEventListener('resize', this.updateZoomCompensation);
268
- if (this.resizeObserver) {
269
- this.resizeObserver.disconnect();
270
- this.resizeObserver = null;
271
- }
272
- }
273
- renderInstructions(teacherInstructions, disabledTabs = false) {
274
- if (!teacherInstructions) {
275
- return;
276
- }
277
- const teacherInstructionsDiv = /*#__PURE__*/_react.default.createElement(_renderUi.PreviewPrompt, {
278
- tagName: "div",
279
- className: "prompt",
280
- defaultClassName: "teacher-instructions",
281
- prompt: teacherInstructions
282
- });
283
- if (disabledTabs) {
284
- return teacherInstructionsDiv;
285
- }
286
- return /*#__PURE__*/_react.default.createElement(_renderUi.Collapsible, {
287
- labels: {
288
- hidden: 'Show Teacher Instructions',
289
- visible: 'Hide Teacher Instructions'
290
- }
291
- }, teacherInstructionsDiv);
292
- }
293
- renderTab(tab, disabledTabs) {
294
- const {
295
- baseHeadingLevel
296
- } = this.props;
297
- const clampedLevel = baseHeadingLevel ? Math.min(6, Math.max(1, baseHeadingLevel)) : undefined;
298
- const TitleTag = baseHeadingLevel ? `h${clampedLevel}` : 'h2'; // default to h2 if no base level is provided - this was the previous behavior
299
- const textLevel = baseHeadingLevel ? Math.min(6, Math.max(1, clampedLevel + 1)) : undefined; // promote text headings one level above title
300
-
301
- return /*#__PURE__*/_react.default.createElement(Passage, {
302
- key: tab.id,
303
- id: `tabpanel-${tab.id}`,
304
- role: "tabpanel",
305
- "aria-labelledby": `button-${tab.id}`
306
- }, this.renderInstructions(tab.teacherInstructions, disabledTabs), tab.title && /*#__PURE__*/_react.default.createElement(_renderUi.Purpose, {
307
- purpose: "passage-title"
308
- }, /*#__PURE__*/_react.default.createElement(TitleTag, null, /*#__PURE__*/_react.default.createElement(PassageTitle, {
309
- dangerouslySetInnerHTML: {
310
- __html: this.parsedText(tab.title)
311
- }
312
- }))), tab.subtitle && /*#__PURE__*/_react.default.createElement(_renderUi.Purpose, {
313
- purpose: "passage-subtitle"
314
- }, /*#__PURE__*/_react.default.createElement(PassageSubtitle, {
315
- dangerouslySetInnerHTML: {
316
- __html: this.parsedText(tab.subtitle)
317
- }
318
- })), tab.author && /*#__PURE__*/_react.default.createElement(_renderUi.Purpose, {
319
- purpose: "passage-author"
320
- }, /*#__PURE__*/_react.default.createElement(PassageAuthor, {
321
- className: "author",
322
- dangerouslySetInnerHTML: {
323
- __html: this.parsedText(tab.author)
324
- }
325
- })), tab.text && /*#__PURE__*/_react.default.createElement(_renderUi.Purpose, {
326
- purpose: "passage-text"
327
- }, /*#__PURE__*/_react.default.createElement("div", {
328
- key: tab.id,
329
- className: "text",
330
- dangerouslySetInnerHTML: {
331
- __html: baseHeadingLevel ? (0, _renderUi.transformDataHeadings)(tab.text, textLevel) : tab.text
332
- }
333
- })));
334
- }
335
- render() {
336
- const {
337
- model,
338
- tabs,
339
- disabledTabs
340
- } = this.props;
341
- const {
342
- activeTab,
343
- zoomCompensation,
344
- containerWidth
345
- } = this.state;
346
- if (!tabs?.length) {
347
- return;
348
- }
349
- const {
350
- extraCSSRules
351
- } = model || {};
352
- const selectedTab = (tabs || []).find(tab => tab.id === activeTab);
353
-
354
- // cap each tab at 1/n of the passage container width so a single long
355
- // title can't push other tabs off-screen. Existing two-line wrap + ellipsis
356
- // on .passage-label still trims anything that doesn't fit.
357
- const tabMaxWidth = containerWidth > 0 ? containerWidth / tabs.length : null;
358
- // When per-tab horizontal space drops to NUMERIC_LABEL_MIN_WIDTH_PER_TAB or
359
- // less, titles become unreadably truncated; swap to "Passage N" so users
360
- // can still navigate. Container width is read once layout has settled
361
- // (>0), so initial render uses real labels.
362
- const useNumericLabels = containerWidth > 0 && containerWidth <= tabs.length * NUMERIC_LABEL_MIN_WIDTH_PER_TAB;
363
- return /*#__PURE__*/_react.default.createElement(_renderUi.UiLayout, {
364
- extraCSSRules: extraCSSRules
365
- }, /*#__PURE__*/_react.default.createElement(PassagesContainer, {
366
- className: "passages",
367
- ref: this.containerRef
368
- }, disabledTabs || tabs.length === 1 ? tabs.map(tab => this.renderTab(tab, disabledTabs)) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_Tabs.default, {
369
- sx: {
370
- // Below the breakpoint (e.g. WCAG 400% zoom, ~320px viewport)
371
- // the tabs are in normal flow and scroll with the passage text,
372
- // so they don't lock up space needed to display the passage.
373
- position: 'static',
374
- // Above the breakpoint there is adequate screen space, so the
375
- // tabs stay locked to the top of the panel while the passage
376
- // text scrolls beneath them.
377
- [`@media (min-width: ${STICKY_TABS_BREAKPOINT + 1}px)`]: {
378
- position: 'sticky',
379
- top: 0,
380
- zIndex: 1
381
- },
382
- background: 'var(--pie-passage-header-background, rgba(255,255,255,0))',
383
- color: _renderUi.color.text(),
384
- fontFamily: 'Roboto, sans-serif',
385
- // Freeze the tabs' physical size at their 200%-zoom appearance
386
- // when browser zoom exceeds 200%. The factor is 1 at zoom <= 200%,
387
- // so behavior below that threshold is unchanged. Using `zoom`
388
- // (rather than transform: scale) shrinks the layout box itself,
389
- // so the reclaimed space flows to the passage content below.
390
- zoom: zoomCompensation,
391
- '& .MuiTabs-list': {
392
- /*
393
- * The strip behind the tabs. A host that has opted into
394
- * `--pie-passage-header-background` keeps its own colour on every
395
- * scheme -- Knowledge Checks' pale green-blue is deliberate and is not
396
- * a scheme's business to override. With no host colour the fallback has
397
- * to be a theme token rather than a white literal, or the strip stays
398
- * white over a dark passage body.
399
- */
400
- backgroundColor: `var(--pie-passage-header-background, ${_renderUi.color.backgroundDark()})`,
401
- borderBottom: `1px solid ${_renderUi.color.borderGray()}`
402
- },
403
- '& .MuiTabs-indicator': {
404
- backgroundColor: _renderUi.color.white(),
405
- marginBottom: '-1px'
406
- }
407
- },
408
- value: activeTab,
409
- onChange: this.handleChange
410
- }, tabs.map((tab, index) => /*#__PURE__*/_react.default.createElement(TabStyled, {
411
- key: tab.id,
412
- id: `button-${tab.id}`,
413
- sx: tabMaxWidth ? {
414
- maxWidth: `${tabMaxWidth}px`
415
- } : undefined,
416
- label: /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_renderUi.Purpose, {
417
- purpose: "passage-label"
418
- }, useNumericLabels ? /*#__PURE__*/_react.default.createElement("span", {
419
- className: "passage-label"
420
- }, `Passage ${index + 1}`) : /*#__PURE__*/_react.default.createElement("span", {
421
- className: "passage-label",
422
- dangerouslySetInnerHTML: {
423
- __html: this.parsedText(tab.label)
424
- }
425
- })), /*#__PURE__*/_react.default.createElement(Underline, {
426
- className: "passage-label-underline"
427
- })),
428
- value: tab.id,
429
- tabIndex: activeTab === tab.id ? 0 : -1,
430
- "aria-controls": `tabpanel-${tab.id}`,
431
- "aria-selected": activeTab === tab.id,
432
- onKeyDown: event => this.handleKeyDown(event, tab.id)
433
- }))), selectedTab ? this.renderTab(selectedTab, disabledTabs) : null)));
434
- }
435
- }
436
- StimulusTabs.propTypes = {
437
- tabs: _propTypes.default.arrayOf(_propTypes.default.shape({
438
- id: _propTypes.default.number.isRequired,
439
- label: _propTypes.default.string.isRequired,
440
- title: _propTypes.default.string.isRequired,
441
- subtitle: _propTypes.default.string,
442
- author: _propTypes.default.string,
443
- text: _propTypes.default.string.isRequired,
444
- teacherInstructions: _propTypes.default.string
445
- }).isRequired).isRequired,
446
- disabledTabs: _propTypes.default.bool,
447
- model: _propTypes.default.object,
448
- baseHeadingLevel: _propTypes.default.number
449
- };
450
- var _default = exports.default = StimulusTabs;
451
- //# sourceMappingURL=stimulus-tabs.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"stimulus-tabs.js","names":["_react","_interopRequireDefault","require","_propTypes","_Tabs","_Tab","_styles","_renderUi","STICKY_TABS_BREAKPOINT","MAX_TABS_ZOOM","MIN_ZOOM_COMPENSATION","NUMERIC_LABEL_MIN_WIDTH_PER_TAB","computeZoomCompensation","window","ratio","outerWidth","innerWidth","zoom","Number","isFinite","Math","max","min","PassagesContainer","styled","flexGrow","backgroundColor","color","background","text","borderCollapse","padding","textAlign","Passage","theme","spacing","borderLeft","margin","PassageTitle","fontSize","PassageSubtitle","PassageAuthor","TabStyled","Tab","fontFamily","borderRadius","border","borderGray","borderBottomWidth","minHeight","display","alignItems","justifyContent","textTransform","WebkitLineClamp","WebkitBoxOrient","overflow","textOverflow","whiteSpace","opacity","tertiary","tertiaryLight","Underline","height","width","marginTop","StimulusTabs","React","Component","constructor","args","_defineProperty2","default","activeTab","zoomCompensation","containerWidth","createRef","setState","node","containerRef","current","clientWidth","state","event","setTimeout","tabChangeEvent","CustomEvent","detail","tab","dispatchEvent","currentTabId","key","tabs","props","newTabIndex","currentIndex","findIndex","id","length","preventDefault","stopPropagation","handleChange","document","getElementById","focus","div","createElement","innerHTML","replace","audio","querySelector","source","setAttribute","getAttribute","removeAttribute","appendChild","componentDidMount","addEventListener","updateZoomCompensation","ResizeObserver","resizeObserver","updateContainerWidth","observe","componentWillUnmount","removeEventListener","disconnect","renderInstructions","teacherInstructions","disabledTabs","teacherInstructionsDiv","PreviewPrompt","tagName","className","defaultClassName","prompt","Collapsible","labels","hidden","visible","renderTab","baseHeadingLevel","clampedLevel","undefined","TitleTag","textLevel","role","title","Purpose","purpose","dangerouslySetInnerHTML","__html","parsedText","subtitle","author","transformDataHeadings","render","model","extraCSSRules","selectedTab","find","tabMaxWidth","useNumericLabels","UiLayout","ref","map","Fragment","sx","position","top","zIndex","backgroundDark","borderBottom","white","marginBottom","value","onChange","index","maxWidth","label","tabIndex","onKeyDown","handleKeyDown","propTypes","PropTypes","arrayOf","shape","number","isRequired","string","bool","object","_default","exports"],"sources":["../src/stimulus-tabs.jsx"],"sourcesContent":["import 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, color, PreviewPrompt, Purpose, UiLayout, transformDataHeadings } from '@pie-lib/render-ui';\n\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 = 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 = 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 = styled('div')({\n fontSize: '1.75rem',\n});\n\nconst PassageSubtitle = styled('div')({\n fontSize: '1.5rem',\n});\n\nconst PassageAuthor = styled('div')({\n fontSize: '1.25rem',\n});\n\nconst TabStyled = 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 = 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 = () => {\n this.setState({ zoomCompensation: computeZoomCompensation() });\n };\n\n updateContainerWidth = () => {\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 = (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 = (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 = (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":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;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CAACD,UAAU;IAClCzC,KAAK,EAAEqC,kBAAS,CAACK,MAAM,CAACD,UAAU;IAClCnC,QAAQ,EAAE+B,kBAAS,CAACK,MAAM;IAC1BnC,MAAM,EAAE8B,kBAAS,CAACK,MAAM;IACxB/J,IAAI,EAAE0J,kBAAS,CAACK,MAAM,CAACD,UAAU;IACjC5D,mBAAmB,EAAEwD,kBAAS,CAACK;EACjC,CAAC,CAAC,CAACD,UACL,CAAC,CAACA,UAAU;EACZ3D,YAAY,EAAEuD,kBAAS,CAACM,IAAI;EAC5BjC,KAAK,EAAE2B,kBAAS,CAACO,MAAM;EACvBlD,gBAAgB,EAAE2C,kBAAS,CAACG;AAC9B,CAAC;AAAC,IAAAK,QAAA,GAAAC,OAAA,CAAAxH,OAAA,GAEaN,YAAY","ignoreList":[]}
@@ -1 +0,0 @@
1
- import{_dll_prop_types as e,_dll_mui__material_styles as t,_dll_react as n,_dll_mui__material as a,_dll_mui__icons_material as i,_dll_react_dom_client as s}from"../../../@pie-lib/shared-module@6.0.0/module/index.js";import{_dll_pie_lib__config_ui as l}from"../../../@pie-lib/config-module@5.0.0/module/index.js";import{_dll_pie_lib__editable_html_tip_tap as o}from"../../../@pie-lib/editable-html-module@8.0.0/module/index.js";var r={};Object.defineProperty(r,"__esModule",{value:!0});class d extends CustomEvent{constructor(e,t=!1){super(d.TYPE,{bubbles:!0,detail:{update:e,reset:t}}),this.update=e,this.reset=t}}d.TYPE="model.updated";var u=r.ModelUpdatedEvent=d;class c extends CustomEvent{constructor(e,t){super(c.TYPE,{bubbles:!0,detail:{src:e,done:t}}),this.src=e,this.done=t}}c.TYPE="delete.image";var g=r.DeleteImageEvent=c;class p extends CustomEvent{constructor(e){super(p.TYPE,{bubbles:!0,detail:e}),this.handler=e}}p.TYPE="insert.image";var h=r.InsertImageEvent=p;class m extends CustomEvent{constructor(e,t){super(m.TYPE,{bubbles:!0,detail:{src:e,done:t}}),this.src=e,this.done=t}}m.TYPE="delete.sound";var b=r.DeleteSoundEvent=m;class _ extends CustomEvent{constructor(e){super(_.TYPE,{bubbles:!0,detail:e}),this.handler=e}}_.TYPE="insert.sound";var C=r.InsertSoundEvent=_;const E=n,f=e,{styled:x}=t,{Button:S}=a,{Dialog:I}=a,{DialogTitle:v}=a,{DialogContent:P}=a,{DialogContentText:y}=a,{DialogActions:T}=a,{RemoveCircle:R}=i,{AddCircle:q}=i,D=x(({label:e,type:t="add",onClick:n})=>{const a="add"===t?q:R;return E.createElement(S,{color:"primary",size:"small",onClick:n},E.createElement(a,{fontSize:"small",color:"primary",style:{marginRight:4}}),e)})({textDecoration:"underline","&:hover":{textDecoration:"underline",backgroundColor:"transparent"},display:"flex",alignItems:"center"}),k=({content:e,cancel:t,title:n,ok:a,open:i,onOk:s,onCancel:l})=>E.createElement(I,{open:i},E.createElement(v,null,n),E.createElement(P,null,E.createElement(y,null,e)),E.createElement(T,null,s&&E.createElement(S,{onClick:s,color:"primary"},a),l&&E.createElement(S,{onClick:l,color:"primary"},t)));k.propTypes={content:f.string.isRequired,title:f.string.isRequired,cancel:f.string.isRequired,ok:f.string.isRequired,open:f.bool.isRequired,onCancel:f.func.isRequired,onOk:f.func.isRequired};const A=n,M=e,{styled:w}=t,{InputContainer:j}=l,O=o,{ALL_PLUGINS:Y}=o;function L(e){let t,n=e[0],a=1;for(;a<e.length;){const i=e[a],s=e[a+1];if(a+=2,("optionalAccess"===i||"optionalCall"===i)&&null==n)return;"access"===i||"optionalAccess"===i?(t=n,n=s(n)):"call"!==i&&"optionalCall"!==i||(n=s((...e)=>n.call(t,...e)),t=void 0)}return n}const H=w(j)(({theme:e})=>({paddingTop:e.spacing(2),marginBottom:e.spacing(2),width:"100%"})),W=w("div")(({theme:e})=>({fontSize:e.typography.fontSize-2,color:e.palette.error.main,paddingTop:e.spacing(1)}));class z extends A.Component{static __initStatic(){this.propTypes={onModelChanged:M.func.isRequired,model:M.object.isRequired,configuration:M.object.isRequired,imageSupport:M.object.isRequired,passageIndex:M.number.isRequired,uploadSoundSupport:M.object.isRequired}}static __initStatic2(){this.defaultProps={passageIndex:0}}constructor(e){super(e),z.prototype.__init.call(this)}__init(){this.handleChange=(e,t)=>{const{model:n,onModelChanged:a,passageIndex:i}=this.props;if(!n.passages||i<0||i>=n.passages.length)return;const s=[...n.passages];s[i]={...s[i],[e]:t},a({...n,passages:s})}}render(){const{model:e,configuration:t,imageSupport:n,passageIndex:a,uploadSoundSupport:i}=this.props,{maxImageWidth:s={},maxImageHeight:l={},mathMlOptions:o={},baseInputConfiguration:r={},teacherInstructions:d={},title:u={},subtitle:c={},text:g={},author:p={}}=t||{},{errors:h={},passages:m=[],teacherInstructionsEnabled:b,titleEnabled:_,subtitleEnabled:C,authorEnabled:E,textEnabled:f}=e||{},{passages:x}=h||{},{teacherInstructions:S,title:I,subtitle:v,author:P,text:y}=x&&x[a]||{},T=s&&s.prompt,R=l&&l.prompt,q=e=>({...r,...e}),D=(Y||[]).filter(e=>!["math","table","bulleted-list","numbered-list"].includes(e));return A.createElement(A.Fragment,null,b&&A.createElement(H,{label:d.label},A.createElement(O,{activePlugins:Y,markup:m[a].teacherInstructions||"",onChange:e=>this.handleChange("teacherInstructions",e),nonEmpty:!1,error:S,maxImageWidth:s&&s.teacherInstructions||T,maxImageHeight:l&&l.teacherInstructions||R,mathMlOptions:o,languageCharactersProps:[{language:"spanish"},{language:"special"}],pluginProps:q(L([d,"optionalAccess",e=>e.inputConfiguration]))}),S&&A.createElement(W,null,S)),_&&A.createElement(H,{label:u.label},A.createElement(O,{activePlugins:D,markup:m[a].title||"",onChange:e=>this.handleChange("title",e),nonEmpty:!1,error:I,mathMlOptions:o,languageCharactersProps:[{language:"spanish"},{language:"special"}],pluginProps:q(L([u,"optionalAccess",e=>e.inputConfiguration]))}),I&&A.createElement(W,null,I)),C&&A.createElement(H,{label:c.label},A.createElement(O,{activePlugins:D,markup:m[a].subtitle||"",onChange:e=>this.handleChange("subtitle",e),nonEmpty:!1,error:v,mathMlOptions:o,languageCharactersProps:[{language:"spanish"},{language:"special"}],pluginProps:q(L([c,"optionalAccess",e=>e.inputConfiguration]))}),v&&A.createElement(W,null,v)),E&&A.createElement(H,{label:p.label},A.createElement(O,{activePlugins:D,markup:m[a].author||"",onChange:e=>this.handleChange("author",e),nonEmpty:!1,error:P,mathMlOptions:o,languageCharactersProps:[{language:"spanish"},{language:"special"}],pluginProps:q(L([p,"optionalAccess",e=>e.inputConfiguration]))}),P&&A.createElement(W,null,P)),f&&A.createElement(H,{label:g.label},A.createElement(O,{activePlugins:Y,markup:m[a].text||"",onChange:e=>this.handleChange("text",e),imageSupport:n,uploadSoundSupport:i,nonEmpty:!1,error:y,maxImageWidth:s&&s.text||T,maxImageHeight:l&&l.text||R,mathMlOptions:o,languageCharactersProps:[{language:"spanish"},{language:"special"}],pluginProps:q(L([g,"optionalAccess",e=>e.inputConfiguration]))}),y&&A.createElement(W,null,y)))}}z.__initStatic(),z.__initStatic2();const B=n,$=e,{styled:F}=t,{Typography:U}=a,{settings:G}=l,{layout:N}=l,{Panel:J,toggle:K,dropdown:Q}=G,V=F(U)(({theme:e})=>({paddingTop:e.spacing(2),marginBottom:e.spacing(2)}));class X extends B.Component{static __initStatic(){this.propTypes={onModelChanged:$.func.isRequired,onConfigurationChanged:$.func,model:$.object.isRequired,configuration:$.object.isRequired,imageSupport:$.object.isRequired,uploadSoundSupport:$.object.isRequired,classes:$.object.isRequired}}constructor(e){super(e),X.prototype.__init.call(this),X.prototype.__init2.call(this),X.prototype.__init3.call(this),X.prototype.__init4.call(this),this.state={showConfirmationDialog:!1,indexToRemove:-1}}__init(){this.getInnerText=e=>(e||"").replaceAll(/<[^>]*>/g,"")}__init2(){this.onDelete=(e,t,n)=>{let a=e.passages;a.splice(t,1),n({...e,passages:a}),this.setState({showConfirmationDialog:!1,indexToRemove:-1})}}__init3(){this.removeAdditionalPassage=e=>{const{model:t={},onModelChanged:n}=this.props,{passages:a=[]}=t,{teacherInstructions:i="",title:s="",subtitle:l="",author:o="",text:r=""}=a[e];this.getInnerText(i).trim()||this.getInnerText(s).trim()||this.getInnerText(l).trim()||this.getInnerText(o).trim()||this.getInnerText(r).trim()?this.setState({showConfirmationDialog:!0,indexToRemove:e}):this.onDelete(t,e,n)}}__init4(){this.addAdditionalPassage=()=>{const{model:e,onModelChanged:t}=this.props,n=[...e.passages,{teacherInstructions:"",title:"",subtitle:"",author:"",text:""}];t({...e,passages:n})}}render(){const{model:e,configuration:t,imageSupport:n,onConfigurationChanged:a,onModelChanged:i,uploadSoundSupport:s}=this.props,{settingsPanelDisabled:l,language:o={},languageChoices:r={},teacherInstructions:d={},title:u={},subtitle:c={},text:g={},author:p={},additionalPassage:h={}}=t||{},{extraCSSRules:m,passages:b}=e||{},_={titleEnabled:u&&u.settings&&K(u.label),subtitleEnabled:c&&c.settings&&K(c.label),authorEnabled:p&&p.settings&&K(p.label),textEnabled:g&&g.settings&&K(g.label),"additionalPassage.enabled":h&&h.settings&&K(h.label,!0)},C={teacherInstructionsEnabled:d&&d.settings&&K(d.label),"language.enabled":o&&o.settings&&K(o.label,!0),language:o&&o.settings&&o.enabled&&Q(r.label,r.options)},E=`${h.label} will be deleted`,{indexToRemove:f,showConfirmationDialog:x}=this.state;return B.createElement(N.ConfigLayout,{extraCSSRules:m,hideSettings:l,settings:B.createElement(J,{model:e,configuration:t,onChangeModel:e=>i(e),onChangeConfiguration:e=>a(e),groups:{Settings:_,Properties:C}})},b.map((a,l)=>B.createElement(B.Fragment,{key:l},l>0&&B.createElement(V,{variant:"h5"},h.label),B.createElement(z,{imageSupport:n,uploadSoundSupport:s,model:e,configuration:t,passageIndex:l,onModelChanged:i}),l>0&&h.enabled&&B.createElement(D,{type:"remove",label:`Remove ${h.label}`,onClick:()=>this.removeAdditionalPassage(l)}),0===l&&h.enabled&&b.length<2&&B.createElement(D,{label:`Add ${h.label}`,onClick:this.addAdditionalPassage}))),B.createElement(k,{open:x,title:"Warning",content:E,cancel:"Cancel",ok:"Ok",onCancel:()=>this.setState({showConfirmationDialog:!1}),onOk:()=>this.onDelete(e,f,i)}))}}X.__initStatic();var Z={authorEnabled:!0,passages:[{teacherInstructions:"",title:"",subtitle:"",author:"",text:""}],subtitleEnabled:!0,teacherInstructionsEnabled:!0,textEnabled:!0,titleEnabled:!0},ee={baseInputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1},h3:{disabled:!0},blockquote:{disabled:!0},textAlign:{disabled:!0},showParagraphs:{disabled:!1},separateParagraphs:{disabled:!0}},settingsPanelDisabled:!1,title:{settings:!0,label:"Title",inputConfiguration:{audio:{disabled:!0},video:{disabled:!0},image:{disabled:!0},textAlign:{disabled:!1}},required:!0},subtitle:{settings:!0,label:"Subtitle",inputConfiguration:{audio:{disabled:!0},video:{disabled:!0},image:{disabled:!0},textAlign:{disabled:!1}},required:!1},author:{settings:!0,label:"Author",inputConfiguration:{audio:{disabled:!0},video:{disabled:!0},image:{disabled:!0}},required:!1},text:{settings:!0,label:"Text",inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1},h3:{disabled:!1},blockquote:{disabled:!1},textAlign:{disabled:!1}},required:!0},teacherInstructions:{settings:!0,label:"Teacher Instructions",inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}},required:!1},maxImageWidth:{teacherInstructions:300,text:300},maxImageHeight:{teacherInstructions:300,text:300},mathMlOptions:{mmlOutput:!1,mmlEditing:!1},language:{settings:!1,label:"Specify Language",enabled:!1},languageChoices:{label:"Language Choices",options:[]},additionalPassage:{settings:!0,label:"Additional Passage",enabled:!1}};const te=n,{createRoot:ne}=s;class ae extends HTMLElement{static __initStatic(){this.createDefaultModel=(e={})=>({...Z,...e})}constructor(){super(),this._root=null,this._model=ae.createDefaultModel(),this._configuration=ee}set model(e){this._model=ae.createDefaultModel(e),this.render()}set configuration(e){this._configuration=e,this.render()}connectedCallback(){this.render()}modelChanged(e){this._model=e,this.dispatchEvent(new u(this._model),!0),this.render()}onConfigurationChanged(e){this._configuration=e,this.render()}insertImage(e){this.dispatchEvent(new h(e))}onDeleteImage(e,t){this.dispatchEvent(new g(e,t))}insertSound(e){this.dispatchEvent(new C(e))}onDeleteSound(e,t){this.dispatchEvent(new b(e,t))}render(){if(this._model){const e=te.createElement(X,{model:this._model,configuration:this._configuration,onModelChanged:this.modelChanged.bind(this),onConfigurationChanged:this.onConfigurationChanged.bind(this),imageSupport:{add:this.insertImage.bind(this),delete:this.onDeleteImage.bind(this)},uploadSoundSupport:{add:this.insertSound.bind(this),delete:this.onDeleteSound.bind(this)}});this._root||(this._root=ne(this)),this._root.render(e)}}disconnectedCallback(){this._root&&(this._root.unmount(),this._root=null)}}ae.__initStatic();export{ae as default};