@pie-element/passage 7.3.4 → 7.3.5

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/CHANGELOG.md CHANGED
@@ -3,6 +3,13 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [7.3.5](https://github.com/pie-framework/pie-elements/compare/@pie-element/passage@7.3.4...@pie-element/passage@7.3.5) (2026-08-19)
7
+
8
+ ### Bug Fixes
9
+
10
+ - bump libs and shared modules PIE-681, PIE-708 ([08af8b5](https://github.com/pie-framework/pie-elements/commit/08af8b5802aecc8ee5454a1b6d60277d7ec94204))
11
+ - **passage:** let the stimulus tabs follow the theme PIE-818 ([5c499e1](https://github.com/pie-framework/pie-elements/commit/5c499e1e38e1e9e8948e0d23532f63bd316204f8)), closes [#D9](https://github.com/pie-framework/pie-elements/issues/D9)
12
+
6
13
  ## [7.3.4](https://github.com/pie-framework/pie-elements/compare/@pie-element/passage@7.3.2...@pie-element/passage@7.3.4) (2026-08-13)
7
14
 
8
15
  **Note:** Version bump only for package @pie-element/passage
@@ -3,6 +3,12 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [5.1.11](https://github.com/pie-framework/pie-elements/compare/@pie-element/passage-configure@5.1.10...@pie-element/passage-configure@5.1.11) (2026-08-19)
7
+
8
+ ### Bug Fixes
9
+
10
+ - bump libs and shared modules PIE-681, PIE-708 ([08af8b5](https://github.com/pie-framework/pie-elements/commit/08af8b5802aecc8ee5454a1b6d60277d7ec94204))
11
+
6
12
  ## [5.1.10](https://github.com/pie-framework/pie-elements/compare/@pie-element/passage-configure@5.1.8...@pie-element/passage-configure@5.1.10) (2026-08-13)
7
13
 
8
14
  **Note:** Version bump only for package @pie-element/passage-configure
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pie-element/passage-configure",
3
3
  "private": true,
4
- "version": "5.1.10",
4
+ "version": "5.1.11",
5
5
  "description": "",
6
6
  "main": "lib/index.js",
7
7
  "module": "src/index.js",
@@ -13,8 +13,8 @@
13
13
  "@mui/icons-material": "^7.3.4",
14
14
  "@mui/material": "^7.3.4",
15
15
  "@pie-framework/pie-configure-events": "^1.3.0",
16
- "@pie-lib/config-ui": "13.0.14",
17
- "@pie-lib/editable-html-tip-tap": "2.1.12",
16
+ "@pie-lib/config-ui": "13.0.15",
17
+ "@pie-lib/editable-html-tip-tap": "2.1.13",
18
18
  "lodash-es": "^4.17.23",
19
19
  "prop-types": "^15.8.1",
20
20
  "react": "18.3.1",
@@ -83,14 +83,26 @@ const PassageAuthor = (0, _styles.styled)('div')({
83
83
  const TabStyled = (0, _styles.styled)(_Tab.default)(({
84
84
  theme
85
85
  }) => ({
86
- background: theme.palette.common.white,
87
- // replace with color.background() once PD-2801 is DONE
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(),
88
95
  fontSize: 'inherit',
89
96
  fontFamily: 'Roboto, sans-serif',
90
- color: theme.palette.common.black,
91
- // remove when PD-2801 is DONE
97
+ color: _renderUi.color.text(),
92
98
  borderRadius: `${theme.spacing(2)} ${theme.spacing(2)} 0 0`,
93
- border: '1px solid #D9DADA',
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()}`,
94
106
  borderBottomWidth: 0,
95
107
  minHeight: '56px',
96
108
  padding: '8px 10px',
@@ -110,7 +122,7 @@ const TabStyled = (0, _styles.styled)(_Tab.default)(({
110
122
  opacity: 0.7
111
123
  },
112
124
  '&.Mui-selected': {
113
- color: theme.palette.common.black,
125
+ color: _renderUi.color.text(),
114
126
  '.passage-label': {
115
127
  opacity: 1
116
128
  },
@@ -127,13 +139,17 @@ const TabStyled = (0, _styles.styled)(_Tab.default)(({
127
139
  opacity: 0.7
128
140
  }
129
141
  }));
130
- const Underline = (0, _styles.styled)('div')(({
131
- theme
132
- }) => ({
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')(() => ({
133
149
  height: '2px',
134
150
  width: '100%',
135
151
  marginTop: '6px',
136
- background: theme.palette.common.white // replace with color.background() once PD-2801 is DONE
152
+ background: _renderUi.color.background()
137
153
  }));
138
154
  class StimulusTabs extends _react.default.Component {
139
155
  constructor(...args) {
@@ -373,8 +389,16 @@ class StimulusTabs extends _react.default.Component {
373
389
  // so the reclaimed space flows to the passage content below.
374
390
  zoom: zoomCompensation,
375
391
  '& .MuiTabs-list': {
376
- backgroundColor: 'var(--pie-passage-header-background, #ffffff)',
377
- borderBottom: '1px solid #D9DADA'
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()}`
378
402
  },
379
403
  '& .MuiTabs-indicator': {
380
404
  backgroundColor: _renderUi.color.white(),
@@ -1 +1 @@
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","palette","common","white","fontFamily","black","borderRadius","border","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","borderBottom","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 background: theme.palette.common.white, // replace with color.background() once PD-2801 is DONE\n fontSize: 'inherit',\n fontFamily: 'Roboto, sans-serif',\n color: theme.palette.common.black, // remove when PD-2801 is DONE\n borderRadius: `${theme.spacing(2)} ${theme.spacing(2)} 0 0`,\n border: '1px solid #D9DADA',\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: theme.palette.common.black,\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\nconst Underline = styled('div')(({ theme }) => ({\n height: '2px',\n width: '100%',\n marginTop: '6px',\n background: theme.palette.common.white, // replace with color.background() once PD-2801 is DONE\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 backgroundColor: 'var(--pie-passage-header-background, #ffffff)',\n borderBottom: '1px solid #D9DADA',\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;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,KAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,IAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA,MAAMM,sBAAsB,GAAG,GAAG;;AAElC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,aAAa,GAAG,CAAC;AACvB,MAAMC,qBAAqB,GAAG,GAAG;;AAEjC;AACA;AACA;AACA;AACA;AACA,MAAMC,+BAA+B,GAAG,GAAG;AAE3C,MAAMC,uBAAuB,GAAGA,CAAA,KAAM;EACpC,IAAI,OAAOC,MAAM,KAAK,WAAW,EAAE,OAAO,CAAC;EAC3C,MAAMC,KAAK,GAAGD,MAAM,CAACE,UAAU,GAAGF,MAAM,CAACG,UAAU;EACnD,MAAMC,IAAI,GAAGC,MAAM,CAACC,QAAQ,CAACL,KAAK,CAAC,IAAIA,KAAK,GAAG,CAAC,GAAGA,KAAK,GAAG,CAAC;EAC5D,OAAOM,IAAI,CAACC,GAAG,CAACX,qBAAqB,EAAEU,IAAI,CAACE,GAAG,CAAC,CAAC,EAAEb,aAAa,GAAGQ,IAAI,CAAC,CAAC;AAC3E,CAAC;AAED,MAAMM,iBAAiB,GAAG,IAAAC,cAAM,EAAC,KAAK,CAAC,CAAC;EACtCC,QAAQ,EAA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AAO,CACrBD,kBAAS,CAACE,KAAK,CAAC;IACdtF,EAAE,EAAEoF,kBAAS,CAACG,MAAM,CAACC,UAAU;IAC/BT,KAAK,EAAEK,kBAAS,CAACK,MAAM,CAACD,UAAU;IAClCvC,KAAK,EAAEmC,kBAAS,CAACK,MAAM,CAACD,UAAU;IAClCjC,QAAQ,EAAE6B,kBAAS,CAACK,MAAM;IAC1BjC,MAAM,EAAE4B,kBAAS,CAACK,MAAM;IACxBhK,IAAI,EAAE2J,kBAAS,CAACK,MAAM,CAACD,UAAU;IACjC1D,mBAAmB,EAAEsD,kBAAS,CAACK;EACjC,CAAC,CAAC,CAACD,UACL,CAAC,CAACA,UAAU;EACZzD,YAAY,EAAEqD,kBAAS,CAACM,IAAI;EAC5B/B,KAAK,EAAEyB,kBAAS,CAACO,MAAM;EACvBhD,gBAAgB,EAAEyC,kBAAS,CAACG;AAC9B,CAAC;AAAC,IAAAK,QAAA,GAAAC,OAAA,CAAAtH,OAAA,GAEaN,YAAY","ignoreList":[]}
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;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,KAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,IAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA,MAAMM,sBAAsB,GAAG,GAAG;;AAElC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,aAAa,GAAG,CAAC;AACvB,MAAMC,qBAAqB,GAAG,GAAG;;AAEjC;AACA;AACA;AACA;AACA;AACA,MAAMC,+BAA+B,GAAG,GAAG;AAE3C,MAAMC,uBAAuB,GAAGA,CAAA,KAAM;EACpC,IAAI,OAAOC,MAAM,KAAK,WAAW,EAAE,OAAO,CAAC;EAC3C,MAAMC,KAAK,GAAGD,MAAM,CAACE,UAAU,GAAGF,MAAM,CAACG,UAAU;EACnD,MAAMC,IAAI,GAAGC,MAAM,CAACC,QAAQ,CAACL,KAAK,CAAC,IAAIA,KAAK,GAAG,CAAC,GAAGA,KAAK,GAAG,CAAC;EAC5D,OAAOM,IAAI,CAACC,GAAG,CAACX,qBAAqB,EAAEU,IAAI,CAACE,GAAG,CAAC,CAAC,EAAEb,aAAa,GAAGQ,IAAI,CAAC,CAAC;AAC3E,CAAC;AAED,MAAMM,iBAAiB,GAAG,IAAAC,cAAM,EAAC,KAAK,CAAC,CAAC;EACtCC,QAAQ,EAAE,CAAC;EACXC,eAAe,EAAEC,eAAK,CAACC,UAAU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AAG,IAC3D,CAEa,CACX,CAAC;EAEf;AACF;AAEA9D,YAAY,CAACoH,SAAS,GAAG;EACvB1F,IAAI,EAAE2F,kBAAS,CAACC,OAAO,CACrBD,kBAAS,CAACE,KAAK,CAAC;IACdxF,EAAE,EAAEsF,kBAAS,CAACG,MAAM,CAACC,UAAU;IAC/BT,KAAK,EAAEK,kBAAS,CAACK,MAAM,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 +1 @@
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@^5.2.13/module/index.js";import{_dll_pie_lib__config_ui as l}from"../../../@pie-lib/config-module@^4.0.18/module/index.js";import{_dll_pie_lib__editable_html_tip_tap as o}from"../../../@pie-lib/editable-html-module@^7.1.15/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};
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@^5.2.14/module/index.js";import{_dll_pie_lib__config_ui as l}from"../../../@pie-lib/config-module@^4.0.19/module/index.js";import{_dll_pie_lib__editable_html_tip_tap as o}from"../../../@pie-lib/editable-html-module@^7.1.16/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};
package/module/element.js CHANGED
@@ -1 +1 @@
1
- import{_dll_pie_lib__math_rendering as e}from"../../../@pie-lib/math-rendering-module@^5.1.3/module/index.js";import{_dll_react as t,_dll_prop_types as s,_dll_mui__material as i,_dll_mui__material_styles as n,_dll_pie_lib__render_ui as r,_dll_react_dom_client as a}from"../../../@pie-lib/shared-module@^5.2.13/module/index.js";var o={};Object.defineProperty(o,"__esModule",{value:!0});class l extends CustomEvent{constructor(e,t,s){super(l.TYPE,{bubbles:!0,composed:!0,detail:{complete:t,component:e,hasModel:s}}),this.component=e,this.complete=t}}l.TYPE="model-set";var d=o.ModelSetEvent=l;class h extends CustomEvent{constructor(e,t){super(h.TYPE,{bubbles:!0,composed:!0,detail:{complete:t,component:e}}),this.component=e,this.complete=t}}h.TYPE="session-changed",o.SessionChangedEvent=h;const c=t,p=s,{Tabs:m}=i,{Tab:u}=i,{styled:b}=n,{Collapsible:g}=r,{color:_}=r,{PreviewPrompt:v}=r,{Purpose:f}=r,{UiLayout:y}=r,{transformDataHeadings:x}=r;const E=()=>{if("undefined"==typeof window)return 1;const e=window.outerWidth/window.innerWidth,t=Number.isFinite(e)&&e>0?e:1;return Math.max(.4,Math.min(1,2/t))},w=b("div")({flexGrow:1,backgroundColor:_.background(),color:_.text(),"&:not(.MathJax) table":{borderCollapse:"collapse"},"&:not(.MathJax) table td, &:not(.MathJax) table th":{padding:".6em 1em",textAlign:"left"}}),O=b("div")(({theme:e})=>({backgroundColor:_.background(),color:_.text(),padding:e.spacing(2),"& blockquote":{background:"#f9f9f9",borderLeft:"5px solid #ccc",margin:"1.5em 10px",padding:".5em 10px"}})),C=b("div")({fontSize:"1.75rem"}),T=b("div")({fontSize:"1.5rem"}),M=b("div")({fontSize:"1.25rem"}),k=b(u)(({theme:e})=>({background:e.palette.common.white,fontSize:"inherit",fontFamily:"Roboto, sans-serif",color:e.palette.common.black,borderRadius:`${e.spacing(2)} ${e.spacing(2)} 0 0`,border:"1px solid #D9DADA",borderBottomWidth:0,minHeight:"56px",padding:"8px 10px",display:"flex",alignItems:"center",justifyContent:"center",margin:`0 ${e.spacing(1)}`,textTransform:"none",".passage-label":{display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"normal",margin:"auto 0",opacity:.7},"&.Mui-selected":{color:e.palette.common.black,".passage-label":{opacity:1},".passage-label-underline":{backgroundColor:_.tertiary()}},"&:hover":{".passage-label-underline":{backgroundColor:_.tertiaryLight()}},"& .MuiTouchRipple-root":{opacity:.7}})),R=b("div")(({theme:e})=>({height:"2px",width:"100%",marginTop:"6px",background:e.palette.common.white}));class L extends c.Component{constructor(...e){super(...e),L.prototype.__init.call(this),L.prototype.__init2.call(this),L.prototype.__init3.call(this),L.prototype.__init4.call(this),L.prototype.__init5.call(this),L.prototype.__init6.call(this),L.prototype.__init7.call(this)}__init(){this.state={activeTab:0,zoomCompensation:E(),containerWidth:0}}__init2(){this.containerRef=c.createRef()}componentDidMount(){"undefined"!=typeof window&&(window.addEventListener("resize",this.updateZoomCompensation),this.containerRef.current&&"undefined"!=typeof ResizeObserver&&(this.resizeObserver=new ResizeObserver(this.updateContainerWidth),this.resizeObserver.observe(this.containerRef.current)),this.updateContainerWidth())}componentWillUnmount(){"undefined"!=typeof window&&(window.removeEventListener("resize",this.updateZoomCompensation),this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null))}__init3(){this.updateZoomCompensation=()=>{this.setState({zoomCompensation:E()})}}__init4(){this.updateContainerWidth=()=>{const e=this.containerRef.current;if(!e)return;const t=e.clientWidth;t!==this.state.containerWidth&&this.setState({containerWidth:t})}}__init5(){this.handleChange=(e,t)=>{this.setState(()=>({activeTab:t})),setTimeout(()=>{const e=new CustomEvent("pie-ui-passage-tabChanged",{detail:{tab:t}});window.dispatchEvent(e)})}}__init6(){this.handleKeyDown=(e,t)=>{const{key:s}=e,{tabs:i}=this.props;let n=-1;const r=i.findIndex(e=>e.id===t);switch(s){case"ArrowRight":n=(r+1)%i.length;break;case"ArrowLeft":n=(r-1+i.length)%i.length;break;case"Home":n=0;break;case"End":n=i.length-1;break;case"Enter":case" ":n=r}-1!==n&&(e.preventDefault(),e.stopPropagation(),this.handleChange(e,i[n].id),document.getElementById(`button-${i[n].id}`).focus())}}__init7(){this.parsedText=(e="")=>{const t=document.createElement("div");t.innerHTML=e.replace(/(<br\/>\n)/g,"<br/>");const s=t.querySelector("audio");if(s){const e=document.createElement("source");e.setAttribute("type","audio/mp3"),e.setAttribute("src",s.getAttribute("src")),s.removeAttribute("src"),s.appendChild(e)}return t.innerHTML}}renderInstructions(e,t=!1){if(!e)return;const s=c.createElement(v,{tagName:"div",className:"prompt",defaultClassName:"teacher-instructions",prompt:e});return t?s:c.createElement(g,{labels:{hidden:"Show Teacher Instructions",visible:"Hide Teacher Instructions"}},s)}renderTab(e,t){const{baseHeadingLevel:s}=this.props,i=s?Math.min(6,Math.max(1,s)):void 0,n=s?`h${i}`:"h2",r=s?Math.min(6,Math.max(1,i+1)):void 0;return c.createElement(O,{key:e.id,id:`tabpanel-${e.id}`,role:"tabpanel","aria-labelledby":`button-${e.id}`},this.renderInstructions(e.teacherInstructions,t),e.title&&c.createElement(f,{purpose:"passage-title"},c.createElement(n,null,c.createElement(C,{dangerouslySetInnerHTML:{__html:this.parsedText(e.title)}}))),e.subtitle&&c.createElement(f,{purpose:"passage-subtitle"},c.createElement(T,{dangerouslySetInnerHTML:{__html:this.parsedText(e.subtitle)}})),e.author&&c.createElement(f,{purpose:"passage-author"},c.createElement(M,{className:"author",dangerouslySetInnerHTML:{__html:this.parsedText(e.author)}})),e.text&&c.createElement(f,{purpose:"passage-text"},c.createElement("div",{key:e.id,className:"text",dangerouslySetInnerHTML:{__html:s?x(e.text,r):e.text}})))}render(){const{model:e,tabs:t,disabledTabs:s}=this.props,{activeTab:i,zoomCompensation:n,containerWidth:r}=this.state;if(!function(e){let t,s=e[0],i=1;for(;i<e.length;){const n=e[i],r=e[i+1];if(i+=2,("optionalAccess"===n||"optionalCall"===n)&&null==s)return;"access"===n||"optionalAccess"===n?(t=s,s=r(s)):"call"!==n&&"optionalCall"!==n||(s=r((...e)=>s.call(t,...e)),t=void 0)}return s}([t,"optionalAccess",e=>e.length]))return;const{extraCSSRules:a}=e||{},o=(t||[]).find(e=>e.id===i),l=r>0?r/t.length:null,d=r>0&&r<=170*t.length;return c.createElement(y,{extraCSSRules:a},c.createElement(w,{className:"passages",ref:this.containerRef},s||1===t.length?t.map(e=>this.renderTab(e,s)):c.createElement(c.Fragment,null,c.createElement(m,{sx:{position:"static","@media (min-width: 841px)":{position:"sticky",top:0,zIndex:1},background:"var(--pie-passage-header-background, rgba(255,255,255,0))",color:_.text(),fontFamily:"Roboto, sans-serif",zoom:n,"& .MuiTabs-list":{backgroundColor:"var(--pie-passage-header-background, #ffffff)",borderBottom:"1px solid #D9DADA"},"& .MuiTabs-indicator":{backgroundColor:_.white(),marginBottom:"-1px"}},value:i,onChange:this.handleChange},t.map((e,t)=>c.createElement(k,{key:e.id,id:`button-${e.id}`,sx:l?{maxWidth:`${l}px`}:void 0,label:c.createElement(c.Fragment,null,c.createElement(f,{purpose:"passage-label"},d?c.createElement("span",{className:"passage-label"},`Passage ${t+1}`):c.createElement("span",{className:"passage-label",dangerouslySetInnerHTML:{__html:this.parsedText(e.label)}})),c.createElement(R,{className:"passage-label-underline"})),value:e.id,tabIndex:i===e.id?0:-1,"aria-controls":`tabpanel-${e.id}`,"aria-selected":i===e.id,onKeyDown:t=>this.handleKeyDown(t,e.id)}))),o?this.renderTab(o,s):null)))}}L.propTypes={tabs:p.arrayOf(p.shape({id:p.number.isRequired,label:p.string.isRequired,title:p.string.isRequired,subtitle:p.string,author:p.string,text:p.string.isRequired,teacherInstructions:p.string}).isRequired).isRequired,disabledTabs:p.bool,model:p.object,baseHeadingLevel:p.number};const{renderMath:A}=e,S=t,{createRoot:P}=a;function z(e){const t=e.closest("pie-player")||e.closest("pie-item-player");if(t){let e=t.baseHeadingLevel;null==e&&(s=t.getAttribute("base-heading-level"),i=()=>t.getAttribute("baseheadinglevel"),e=null!=s?s:i());const n=parseInt(e,10);if(Number.isFinite(n)&&n>=1&&n<=6)return n}var s,i}class I extends HTMLElement{constructor(){super(),I.prototype.__init.call(this),this._model={passages:[]},this._session=null,this._root=null,this._mathObserver=null,this._mathRenderPending=!1,this._playerObserver=null}setLangAttribute(){const e=this._model&&(this._model.language,1)?this._model.language:"",t=e?e.slice(0,2):"en";this.setAttribute("lang",t)}__init(){this._scheduleMathRender=()=>{this._mathRenderPending||(this._mathRenderPending=!0,requestAnimationFrame(()=>{this._mathObserver&&this._mathObserver.disconnect(),A(this),this._mathRenderPending=!1,setTimeout(()=>{this._mathObserver&&this._mathObserver.observe(this,{childList:!0,subtree:!0})},50)}))}}_initMathObserver(){this._mathObserver||(this._mathObserver=new MutationObserver(this._scheduleMathRender),this._mathObserver.observe(this,{childList:!0,subtree:!0}))}_disconnectMathObserver(){this._mathObserver&&(this._mathObserver.disconnect(),this._mathObserver=null)}set model(e){this._model=e,this.dispatchEvent(new d(this.tagName.toLowerCase(),this._session,!!this._model)),this.setLangAttribute(),this._render()}set session(e){this._session=e}connectedCallback(){this.setAttribute("aria-label","Passage"),this.setAttribute("role","region"),this._initMathObserver(),this._initPlayerObserver(),this._render()}_render(){const{passages:e=[]}=this._model;if(this._model.passages.length>0){const t=e.map((e,t)=>({id:t,...e})),s=S.createElement(L,{tabs:t,model:this._model,baseHeadingLevel:z(this)});this._root||(this._root=P(this)),this._root.render(s),this._initMathObserver()}}_initPlayerObserver(){const e=this.closest("pie-player")||this.closest("pie-item-player");e&&(this._playerObserver=new MutationObserver(()=>{this._render()}),this._playerObserver.observe(e,{attributes:!0,attributeFilter:["base-heading-level"]}))}_disconnectPlayerObserver(){this._playerObserver&&(this._playerObserver.disconnect(),this._playerObserver=null)}disconnectedCallback(){this._disconnectMathObserver(),this._disconnectPlayerObserver(),this._root&&(this._root.unmount(),this._root=null)}}export{I as default};
1
+ import{_dll_pie_lib__math_rendering as e}from"../../../@pie-lib/math-rendering-module@^5.1.4/module/index.js";import{_dll_react as t,_dll_prop_types as s,_dll_mui__material as i,_dll_mui__material_styles as n,_dll_pie_lib__render_ui as r,_dll_react_dom_client as a}from"../../../@pie-lib/shared-module@^5.2.14/module/index.js";var o={};Object.defineProperty(o,"__esModule",{value:!0});class l extends CustomEvent{constructor(e,t,s){super(l.TYPE,{bubbles:!0,composed:!0,detail:{complete:t,component:e,hasModel:s}}),this.component=e,this.complete=t}}l.TYPE="model-set";var d=o.ModelSetEvent=l;class h extends CustomEvent{constructor(e,t){super(h.TYPE,{bubbles:!0,composed:!0,detail:{complete:t,component:e}}),this.component=e,this.complete=t}}h.TYPE="session-changed",o.SessionChangedEvent=h;const c=t,p=s,{Tabs:u}=i,{Tab:m}=i,{styled:b}=n,{Collapsible:g}=r,{color:_}=r,{PreviewPrompt:v}=r,{Purpose:y}=r,{UiLayout:f}=r,{transformDataHeadings:x}=r;const E=()=>{if("undefined"==typeof window)return 1;const e=window.outerWidth/window.innerWidth,t=Number.isFinite(e)&&e>0?e:1;return Math.max(.4,Math.min(1,2/t))},O=b("div")({flexGrow:1,backgroundColor:_.background(),color:_.text(),"&:not(.MathJax) table":{borderCollapse:"collapse"},"&:not(.MathJax) table td, &:not(.MathJax) table th":{padding:".6em 1em",textAlign:"left"}}),w=b("div")(({theme:e})=>({backgroundColor:_.background(),color:_.text(),padding:e.spacing(2),"& blockquote":{background:"#f9f9f9",borderLeft:"5px solid #ccc",margin:"1.5em 10px",padding:".5em 10px"}})),C=b("div")({fontSize:"1.75rem"}),T=b("div")({fontSize:"1.5rem"}),M=b("div")({fontSize:"1.25rem"}),k=b(m)(({theme:e})=>({background:_.background(),fontSize:"inherit",fontFamily:"Roboto, sans-serif",color:_.text(),borderRadius:`${e.spacing(2)} ${e.spacing(2)} 0 0`,border:`1px solid ${_.borderGray()}`,borderBottomWidth:0,minHeight:"56px",padding:"8px 10px",display:"flex",alignItems:"center",justifyContent:"center",margin:`0 ${e.spacing(1)}`,textTransform:"none",".passage-label":{display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"normal",margin:"auto 0",opacity:.7},"&.Mui-selected":{color:_.text(),".passage-label":{opacity:1},".passage-label-underline":{backgroundColor:_.tertiary()}},"&:hover":{".passage-label-underline":{backgroundColor:_.tertiaryLight()}},"& .MuiTouchRipple-root":{opacity:.7}})),R=b("div")(()=>({height:"2px",width:"100%",marginTop:"6px",background:_.background()}));class L extends c.Component{constructor(...e){super(...e),L.prototype.__init.call(this),L.prototype.__init2.call(this),L.prototype.__init3.call(this),L.prototype.__init4.call(this),L.prototype.__init5.call(this),L.prototype.__init6.call(this),L.prototype.__init7.call(this)}__init(){this.state={activeTab:0,zoomCompensation:E(),containerWidth:0}}__init2(){this.containerRef=c.createRef()}componentDidMount(){"undefined"!=typeof window&&(window.addEventListener("resize",this.updateZoomCompensation),this.containerRef.current&&"undefined"!=typeof ResizeObserver&&(this.resizeObserver=new ResizeObserver(this.updateContainerWidth),this.resizeObserver.observe(this.containerRef.current)),this.updateContainerWidth())}componentWillUnmount(){"undefined"!=typeof window&&(window.removeEventListener("resize",this.updateZoomCompensation),this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null))}__init3(){this.updateZoomCompensation=()=>{this.setState({zoomCompensation:E()})}}__init4(){this.updateContainerWidth=()=>{const e=this.containerRef.current;if(!e)return;const t=e.clientWidth;t!==this.state.containerWidth&&this.setState({containerWidth:t})}}__init5(){this.handleChange=(e,t)=>{this.setState(()=>({activeTab:t})),setTimeout(()=>{const e=new CustomEvent("pie-ui-passage-tabChanged",{detail:{tab:t}});window.dispatchEvent(e)})}}__init6(){this.handleKeyDown=(e,t)=>{const{key:s}=e,{tabs:i}=this.props;let n=-1;const r=i.findIndex(e=>e.id===t);switch(s){case"ArrowRight":n=(r+1)%i.length;break;case"ArrowLeft":n=(r-1+i.length)%i.length;break;case"Home":n=0;break;case"End":n=i.length-1;break;case"Enter":case" ":n=r}-1!==n&&(e.preventDefault(),e.stopPropagation(),this.handleChange(e,i[n].id),document.getElementById(`button-${i[n].id}`).focus())}}__init7(){this.parsedText=(e="")=>{const t=document.createElement("div");t.innerHTML=e.replace(/(<br\/>\n)/g,"<br/>");const s=t.querySelector("audio");if(s){const e=document.createElement("source");e.setAttribute("type","audio/mp3"),e.setAttribute("src",s.getAttribute("src")),s.removeAttribute("src"),s.appendChild(e)}return t.innerHTML}}renderInstructions(e,t=!1){if(!e)return;const s=c.createElement(v,{tagName:"div",className:"prompt",defaultClassName:"teacher-instructions",prompt:e});return t?s:c.createElement(g,{labels:{hidden:"Show Teacher Instructions",visible:"Hide Teacher Instructions"}},s)}renderTab(e,t){const{baseHeadingLevel:s}=this.props,i=s?Math.min(6,Math.max(1,s)):void 0,n=s?`h${i}`:"h2",r=s?Math.min(6,Math.max(1,i+1)):void 0;return c.createElement(w,{key:e.id,id:`tabpanel-${e.id}`,role:"tabpanel","aria-labelledby":`button-${e.id}`},this.renderInstructions(e.teacherInstructions,t),e.title&&c.createElement(y,{purpose:"passage-title"},c.createElement(n,null,c.createElement(C,{dangerouslySetInnerHTML:{__html:this.parsedText(e.title)}}))),e.subtitle&&c.createElement(y,{purpose:"passage-subtitle"},c.createElement(T,{dangerouslySetInnerHTML:{__html:this.parsedText(e.subtitle)}})),e.author&&c.createElement(y,{purpose:"passage-author"},c.createElement(M,{className:"author",dangerouslySetInnerHTML:{__html:this.parsedText(e.author)}})),e.text&&c.createElement(y,{purpose:"passage-text"},c.createElement("div",{key:e.id,className:"text",dangerouslySetInnerHTML:{__html:s?x(e.text,r):e.text}})))}render(){const{model:e,tabs:t,disabledTabs:s}=this.props,{activeTab:i,zoomCompensation:n,containerWidth:r}=this.state;if(!function(e){let t,s=e[0],i=1;for(;i<e.length;){const n=e[i],r=e[i+1];if(i+=2,("optionalAccess"===n||"optionalCall"===n)&&null==s)return;"access"===n||"optionalAccess"===n?(t=s,s=r(s)):"call"!==n&&"optionalCall"!==n||(s=r((...e)=>s.call(t,...e)),t=void 0)}return s}([t,"optionalAccess",e=>e.length]))return;const{extraCSSRules:a}=e||{},o=(t||[]).find(e=>e.id===i),l=r>0?r/t.length:null,d=r>0&&r<=170*t.length;return c.createElement(f,{extraCSSRules:a},c.createElement(O,{className:"passages",ref:this.containerRef},s||1===t.length?t.map(e=>this.renderTab(e,s)):c.createElement(c.Fragment,null,c.createElement(u,{sx:{position:"static","@media (min-width: 841px)":{position:"sticky",top:0,zIndex:1},background:"var(--pie-passage-header-background, rgba(255,255,255,0))",color:_.text(),fontFamily:"Roboto, sans-serif",zoom:n,"& .MuiTabs-list":{backgroundColor:`var(--pie-passage-header-background, ${_.backgroundDark()})`,borderBottom:`1px solid ${_.borderGray()}`},"& .MuiTabs-indicator":{backgroundColor:_.white(),marginBottom:"-1px"}},value:i,onChange:this.handleChange},t.map((e,t)=>c.createElement(k,{key:e.id,id:`button-${e.id}`,sx:l?{maxWidth:`${l}px`}:void 0,label:c.createElement(c.Fragment,null,c.createElement(y,{purpose:"passage-label"},d?c.createElement("span",{className:"passage-label"},`Passage ${t+1}`):c.createElement("span",{className:"passage-label",dangerouslySetInnerHTML:{__html:this.parsedText(e.label)}})),c.createElement(R,{className:"passage-label-underline"})),value:e.id,tabIndex:i===e.id?0:-1,"aria-controls":`tabpanel-${e.id}`,"aria-selected":i===e.id,onKeyDown:t=>this.handleKeyDown(t,e.id)}))),o?this.renderTab(o,s):null)))}}L.propTypes={tabs:p.arrayOf(p.shape({id:p.number.isRequired,label:p.string.isRequired,title:p.string.isRequired,subtitle:p.string,author:p.string,text:p.string.isRequired,teacherInstructions:p.string}).isRequired).isRequired,disabledTabs:p.bool,model:p.object,baseHeadingLevel:p.number};const{renderMath:S}=e,P=t,{createRoot:z}=a;function A(e){const t=e.closest("pie-player")||e.closest("pie-item-player");if(t){let e=t.baseHeadingLevel;null==e&&(s=t.getAttribute("base-heading-level"),i=()=>t.getAttribute("baseheadinglevel"),e=null!=s?s:i());const n=parseInt(e,10);if(Number.isFinite(n)&&n>=1&&n<=6)return n}var s,i}class I extends HTMLElement{constructor(){super(),I.prototype.__init.call(this),this._model={passages:[]},this._session=null,this._root=null,this._mathObserver=null,this._mathRenderPending=!1,this._playerObserver=null}setLangAttribute(){const e=this._model&&(this._model.language,1)?this._model.language:"",t=e?e.slice(0,2):"en";this.setAttribute("lang",t)}__init(){this._scheduleMathRender=()=>{this._mathRenderPending||(this._mathRenderPending=!0,requestAnimationFrame(()=>{this._mathObserver&&this._mathObserver.disconnect(),S(this),this._mathRenderPending=!1,setTimeout(()=>{this._mathObserver&&this._mathObserver.observe(this,{childList:!0,subtree:!0})},50)}))}}_initMathObserver(){this._mathObserver||(this._mathObserver=new MutationObserver(this._scheduleMathRender),this._mathObserver.observe(this,{childList:!0,subtree:!0}))}_disconnectMathObserver(){this._mathObserver&&(this._mathObserver.disconnect(),this._mathObserver=null)}set model(e){this._model=e,this.dispatchEvent(new d(this.tagName.toLowerCase(),this._session,!!this._model)),this.setLangAttribute(),this._render()}set session(e){this._session=e}connectedCallback(){this.setAttribute("aria-label","Passage"),this.setAttribute("role","region"),this._initMathObserver(),this._initPlayerObserver(),this._render()}_render(){const{passages:e=[]}=this._model;if(this._model.passages.length>0){const t=e.map((e,t)=>({id:t,...e})),s=P.createElement(L,{tabs:t,model:this._model,baseHeadingLevel:A(this)});this._root||(this._root=z(this)),this._root.render(s),this._initMathObserver()}}_initPlayerObserver(){const e=this.closest("pie-player")||this.closest("pie-item-player");e&&(this._playerObserver=new MutationObserver(()=>{this._render()}),this._playerObserver.observe(e,{attributes:!0,attributeFilter:["base-heading-level"]}))}_disconnectPlayerObserver(){this._playerObserver&&(this._playerObserver.disconnect(),this._playerObserver=null)}disconnectedCallback(){this._disconnectMathObserver(),this._disconnectPlayerObserver(),this._root&&(this._root.unmount(),this._root=null)}}export{I as default};
package/module/index.html CHANGED
@@ -2,7 +2,7 @@
2
2
  <!doctype html>
3
3
  <html>
4
4
  <head>
5
- <title>@pie-element/passage@7.3.3</title>
5
+ <title>@pie-element/passage@7.3.4</title>
6
6
  <script
7
7
  type="module"
8
8
  src="https://cdn.jsdelivr.net/npm/@pslb/demo-el@^1.0.0/dist/demo-el/demo-el.esm.js"></script>
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@pie-element/passage",
3
- "version": "7.3.3",
3
+ "version": "7.3.4",
4
4
  "modules": [
5
5
  {
6
6
  "name": "@pie-lib/shared-module",
7
- "version": "^5.2.13"
7
+ "version": "^5.2.14"
8
8
  }
9
9
  ]
10
10
  }
package/module/print.html CHANGED
@@ -2,7 +2,7 @@
2
2
  <!doctype html>
3
3
  <html>
4
4
  <head>
5
- <title>@pie-element/passage@7.3.3</title>
5
+ <title>@pie-element/passage@7.3.4</title>
6
6
  <link
7
7
  href="https://fonts.googleapis.com/css?family=Roboto&display=swap"
8
8
  rel="stylesheet"
package/module/print.js CHANGED
@@ -1 +1 @@
1
- import{_dll_react as e,_dll_prop_types as t,_dll_mui__material as n,_dll_mui__material_styles as i,_dll_pie_lib__render_ui as a,_dll_debug as r,_dll_react_dom_client as o}from"../../../@pie-lib/shared-module@^5.2.13/module/index.js";var s="object"==typeof global&&global&&global.Object===Object&&global,l="object"==typeof self&&self&&self.Object===Object&&self,c=s||l||Function("return this")(),d=c.Symbol,u=Object.prototype,p=u.hasOwnProperty,h=u.toString,m=d?d.toStringTag:void 0;var b=Object.prototype.toString;var f=d?d.toStringTag:void 0;function g(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":f&&f in Object(e)?function(e){var t=p.call(e,m),n=e[m];try{e[m]=void 0;var i=!0}catch(e){}var a=h.call(e);return i&&(t?e[m]=n:delete e[m]),a}(e):function(e){return b.call(e)}(e)}var v=/\s/;var x=/^\s+/;function y(e){return e?e.slice(0,function(e){for(var t=e.length;t--&&v.test(e.charAt(t)););return t}(e)+1).replace(x,""):e}function _(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}var E=/^[-+]0x[0-9a-f]+$/i,T=/^0b[01]+$/i,w=/^0o[0-7]+$/i,C=parseInt;function k(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return null!=e&&"object"==typeof e}(e)&&"[object Symbol]"==g(e)}(e))return NaN;if(_(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=_(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=y(e);var n=T.test(e);return n||w.test(e)?C(e.slice(2),n?2:8):E.test(e)?NaN:+e}var S=function(){return c.Date.now()},M=Math.max,R=Math.min;function I(e,t,n){var i,a,r,o,s,l,c=0,d=!1,u=!1,p=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function h(t){var n=i,r=a;return i=a=void 0,c=t,o=e.apply(r,n)}function m(e){var n=e-l;return void 0===l||n>=t||n<0||u&&e-c>=r}function b(){var e=S();if(m(e))return f(e);s=setTimeout(b,function(e){var n=t-(e-l);return u?R(n,r-(e-c)):n}(e))}function f(e){return s=void 0,p&&i?h(e):(i=a=void 0,o)}function g(){var e=S(),n=m(e);if(i=arguments,a=this,l=e,n){if(void 0===s)return function(e){return c=e,s=setTimeout(b,t),d?h(e):o}(l);if(u)return clearTimeout(s),s=setTimeout(b,t),h(l)}return void 0===s&&(s=setTimeout(b,t)),o}return t=k(t)||0,_(n)&&(d=!!n.leading,r=(u="maxWait"in n)?M(k(n.maxWait)||0,t):r,p="trailing"in n?!!n.trailing:p),g.cancel=function(){void 0!==s&&clearTimeout(s),c=0,i=l=a=s=void 0},g.flush=function(){return void 0===s?o:f(S())},g}const O=e,z=t,{Tabs:j}=n,{Tab:L}=n,{styled:W}=i,{Collapsible:A}=a,{color:N}=a,{PreviewPrompt:$}=a,{Purpose:H}=a,{UiLayout:D}=a,{transformDataHeadings:q}=a;const P=()=>{if("undefined"==typeof window)return 1;const e=window.outerWidth/window.innerWidth,t=Number.isFinite(e)&&e>0?e:1;return Math.max(.4,Math.min(1,2/t))},F=W("div")({flexGrow:1,backgroundColor:N.background(),color:N.text(),"&:not(.MathJax) table":{borderCollapse:"collapse"},"&:not(.MathJax) table td, &:not(.MathJax) table th":{padding:".6em 1em",textAlign:"left"}}),B=W("div")(({theme:e})=>({backgroundColor:N.background(),color:N.text(),padding:e.spacing(2),"& blockquote":{background:"#f9f9f9",borderLeft:"5px solid #ccc",margin:"1.5em 10px",padding:".5em 10px"}})),J=W("div")({fontSize:"1.75rem"}),K=W("div")({fontSize:"1.5rem"}),U=W("div")({fontSize:"1.25rem"}),Z=W(L)(({theme:e})=>({background:e.palette.common.white,fontSize:"inherit",fontFamily:"Roboto, sans-serif",color:e.palette.common.black,borderRadius:`${e.spacing(2)} ${e.spacing(2)} 0 0`,border:"1px solid #D9DADA",borderBottomWidth:0,minHeight:"56px",padding:"8px 10px",display:"flex",alignItems:"center",justifyContent:"center",margin:`0 ${e.spacing(1)}`,textTransform:"none",".passage-label":{display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"normal",margin:"auto 0",opacity:.7},"&.Mui-selected":{color:e.palette.common.black,".passage-label":{opacity:1},".passage-label-underline":{backgroundColor:N.tertiary()}},"&:hover":{".passage-label-underline":{backgroundColor:N.tertiaryLight()}},"& .MuiTouchRipple-root":{opacity:.7}})),G=W("div")(({theme:e})=>({height:"2px",width:"100%",marginTop:"6px",background:e.palette.common.white}));class Q extends O.Component{constructor(...e){super(...e),Q.prototype.__init.call(this),Q.prototype.__init2.call(this),Q.prototype.__init3.call(this),Q.prototype.__init4.call(this),Q.prototype.__init5.call(this),Q.prototype.__init6.call(this),Q.prototype.__init7.call(this)}__init(){this.state={activeTab:0,zoomCompensation:P(),containerWidth:0}}__init2(){this.containerRef=O.createRef()}componentDidMount(){"undefined"!=typeof window&&(window.addEventListener("resize",this.updateZoomCompensation),this.containerRef.current&&"undefined"!=typeof ResizeObserver&&(this.resizeObserver=new ResizeObserver(this.updateContainerWidth),this.resizeObserver.observe(this.containerRef.current)),this.updateContainerWidth())}componentWillUnmount(){"undefined"!=typeof window&&(window.removeEventListener("resize",this.updateZoomCompensation),this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null))}__init3(){this.updateZoomCompensation=()=>{this.setState({zoomCompensation:P()})}}__init4(){this.updateContainerWidth=()=>{const e=this.containerRef.current;if(!e)return;const t=e.clientWidth;t!==this.state.containerWidth&&this.setState({containerWidth:t})}}__init5(){this.handleChange=(e,t)=>{this.setState(()=>({activeTab:t})),setTimeout(()=>{const e=new CustomEvent("pie-ui-passage-tabChanged",{detail:{tab:t}});window.dispatchEvent(e)})}}__init6(){this.handleKeyDown=(e,t)=>{const{key:n}=e,{tabs:i}=this.props;let a=-1;const r=i.findIndex(e=>e.id===t);switch(n){case"ArrowRight":a=(r+1)%i.length;break;case"ArrowLeft":a=(r-1+i.length)%i.length;break;case"Home":a=0;break;case"End":a=i.length-1;break;case"Enter":case" ":a=r}-1!==a&&(e.preventDefault(),e.stopPropagation(),this.handleChange(e,i[a].id),document.getElementById(`button-${i[a].id}`).focus())}}__init7(){this.parsedText=(e="")=>{const t=document.createElement("div");t.innerHTML=e.replace(/(<br\/>\n)/g,"<br/>");const n=t.querySelector("audio");if(n){const e=document.createElement("source");e.setAttribute("type","audio/mp3"),e.setAttribute("src",n.getAttribute("src")),n.removeAttribute("src"),n.appendChild(e)}return t.innerHTML}}renderInstructions(e,t=!1){if(!e)return;const n=O.createElement($,{tagName:"div",className:"prompt",defaultClassName:"teacher-instructions",prompt:e});return t?n:O.createElement(A,{labels:{hidden:"Show Teacher Instructions",visible:"Hide Teacher Instructions"}},n)}renderTab(e,t){const{baseHeadingLevel:n}=this.props,i=n?Math.min(6,Math.max(1,n)):void 0,a=n?`h${i}`:"h2",r=n?Math.min(6,Math.max(1,i+1)):void 0;return O.createElement(B,{key:e.id,id:`tabpanel-${e.id}`,role:"tabpanel","aria-labelledby":`button-${e.id}`},this.renderInstructions(e.teacherInstructions,t),e.title&&O.createElement(H,{purpose:"passage-title"},O.createElement(a,null,O.createElement(J,{dangerouslySetInnerHTML:{__html:this.parsedText(e.title)}}))),e.subtitle&&O.createElement(H,{purpose:"passage-subtitle"},O.createElement(K,{dangerouslySetInnerHTML:{__html:this.parsedText(e.subtitle)}})),e.author&&O.createElement(H,{purpose:"passage-author"},O.createElement(U,{className:"author",dangerouslySetInnerHTML:{__html:this.parsedText(e.author)}})),e.text&&O.createElement(H,{purpose:"passage-text"},O.createElement("div",{key:e.id,className:"text",dangerouslySetInnerHTML:{__html:n?q(e.text,r):e.text}})))}render(){const{model:e,tabs:t,disabledTabs:n}=this.props,{activeTab:i,zoomCompensation:a,containerWidth:r}=this.state;if(!function(e){let t,n=e[0],i=1;for(;i<e.length;){const a=e[i],r=e[i+1];if(i+=2,("optionalAccess"===a||"optionalCall"===a)&&null==n)return;"access"===a||"optionalAccess"===a?(t=n,n=r(n)):"call"!==a&&"optionalCall"!==a||(n=r((...e)=>n.call(t,...e)),t=void 0)}return n}([t,"optionalAccess",e=>e.length]))return;const{extraCSSRules:o}=e||{},s=(t||[]).find(e=>e.id===i),l=r>0?r/t.length:null,c=r>0&&r<=170*t.length;return O.createElement(D,{extraCSSRules:o},O.createElement(F,{className:"passages",ref:this.containerRef},n||1===t.length?t.map(e=>this.renderTab(e,n)):O.createElement(O.Fragment,null,O.createElement(j,{sx:{position:"static","@media (min-width: 841px)":{position:"sticky",top:0,zIndex:1},background:"var(--pie-passage-header-background, rgba(255,255,255,0))",color:N.text(),fontFamily:"Roboto, sans-serif",zoom:a,"& .MuiTabs-list":{backgroundColor:"var(--pie-passage-header-background, #ffffff)",borderBottom:"1px solid #D9DADA"},"& .MuiTabs-indicator":{backgroundColor:N.white(),marginBottom:"-1px"}},value:i,onChange:this.handleChange},t.map((e,t)=>O.createElement(Z,{key:e.id,id:`button-${e.id}`,sx:l?{maxWidth:`${l}px`}:void 0,label:O.createElement(O.Fragment,null,O.createElement(H,{purpose:"passage-label"},c?O.createElement("span",{className:"passage-label"},`Passage ${t+1}`):O.createElement("span",{className:"passage-label",dangerouslySetInnerHTML:{__html:this.parsedText(e.label)}})),O.createElement(G,{className:"passage-label-underline"})),value:e.id,tabIndex:i===e.id?0:-1,"aria-controls":`tabpanel-${e.id}`,"aria-selected":i===e.id,onKeyDown:t=>this.handleKeyDown(t,e.id)}))),s?this.renderTab(s,n):null)))}}Q.propTypes={tabs:z.arrayOf(z.shape({id:z.number.isRequired,label:z.string.isRequired,title:z.string.isRequired,subtitle:z.string,author:z.string,text:z.string.isRequired,teacherInstructions:z.string}).isRequired).isRequired,disabledTabs:z.bool,model:z.object,baseHeadingLevel:z.number};const V=e,{createRoot:X}=o,Y=r("pie-element:passage:print"),ee=(e,t)=>(e=>null!=e)(e)?e:t;class te extends HTMLElement{constructor(){super(),this._model=null,this._options=null,this._session=[],this._root=null,this._rerender=I(()=>{if(this._model&&this._session){if(this._model.passages&&this._model.passages.length>0){const e=((e,t)=>{const n="instructor"===t.role,i=ee(e.teacherInstructionsEnabled,!0),a=ee(e.titleEnabled,!0),r=ee(e.authorEnabled,!1),o=ee(e.subtitleEnabled,!0),s=ee(e.textEnabled,!0);return e.passages.map((e,t)=>({id:t,teacherInstructions:ee(e.teacherInstructionsEnabled,i)&&n&&e.teacherInstructions||"",label:e.title||`Passage ${t+1}`,title:ee(e.titleEnabled,a)&&e.title||"",author:ee(e.authorEnabled,r)&&e.author||"",subtitle:ee(e.subtitleEnabled,o)&&e.subtitle||"",text:ee(e.textEnabled,s)&&e.text||""}))})(this._model,this._options),t=V.createElement(Q,{disabledTabs:!0,tabs:e});this._root||(this._root=X(this)),this._root.render(t)}}else Y("skip")},50,{leading:!1,trailing:!0})}set model(e){this._model=e,this._rerender()}set options(e){this._options=e}connectedCallback(){}disconnectedCallback(){this._root&&this._root.unmount()}}export{te as default};
1
+ import{_dll_react as e,_dll_prop_types as t,_dll_mui__material as n,_dll_mui__material_styles as i,_dll_pie_lib__render_ui as r,_dll_debug as a,_dll_react_dom_client as o}from"../../../@pie-lib/shared-module@^5.2.14/module/index.js";var s="object"==typeof global&&global&&global.Object===Object&&global,l="object"==typeof self&&self&&self.Object===Object&&self,c=s||l||Function("return this")(),d=c.Symbol,u=Object.prototype,p=u.hasOwnProperty,h=u.toString,b=d?d.toStringTag:void 0;var m=Object.prototype.toString;var g=d?d.toStringTag:void 0;function f(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":g&&g in Object(e)?function(e){var t=p.call(e,b),n=e[b];try{e[b]=void 0;var i=!0}catch(e){}var r=h.call(e);return i&&(t?e[b]=n:delete e[b]),r}(e):function(e){return m.call(e)}(e)}var v=/\s/;var x=/^\s+/;function y(e){return e?e.slice(0,function(e){for(var t=e.length;t--&&v.test(e.charAt(t)););return t}(e)+1).replace(x,""):e}function _(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}var E=/^[-+]0x[0-9a-f]+$/i,T=/^0b[01]+$/i,w=/^0o[0-7]+$/i,k=parseInt;function C(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return null!=e&&"object"==typeof e}(e)&&"[object Symbol]"==f(e)}(e))return NaN;if(_(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=_(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=y(e);var n=T.test(e);return n||w.test(e)?k(e.slice(2),n?2:8):E.test(e)?NaN:+e}var S=function(){return c.Date.now()},M=Math.max,R=Math.min;function I(e,t,n){var i,r,a,o,s,l,c=0,d=!1,u=!1,p=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function h(t){var n=i,a=r;return i=r=void 0,c=t,o=e.apply(a,n)}function b(e){var n=e-l;return void 0===l||n>=t||n<0||u&&e-c>=a}function m(){var e=S();if(b(e))return g(e);s=setTimeout(m,function(e){var n=t-(e-l);return u?R(n,a-(e-c)):n}(e))}function g(e){return s=void 0,p&&i?h(e):(i=r=void 0,o)}function f(){var e=S(),n=b(e);if(i=arguments,r=this,l=e,n){if(void 0===s)return function(e){return c=e,s=setTimeout(m,t),d?h(e):o}(l);if(u)return clearTimeout(s),s=setTimeout(m,t),h(l)}return void 0===s&&(s=setTimeout(m,t)),o}return t=C(t)||0,_(n)&&(d=!!n.leading,a=(u="maxWait"in n)?M(C(n.maxWait)||0,t):a,p="trailing"in n?!!n.trailing:p),f.cancel=function(){void 0!==s&&clearTimeout(s),c=0,i=l=r=s=void 0},f.flush=function(){return void 0===s?o:g(S())},f}const O=e,z=t,{Tabs:$}=n,{Tab:j}=n,{styled:L}=i,{Collapsible:W}=r,{color:N}=r,{PreviewPrompt:H}=r,{Purpose:A}=r,{UiLayout:q}=r,{transformDataHeadings:D}=r;const P=()=>{if("undefined"==typeof window)return 1;const e=window.outerWidth/window.innerWidth,t=Number.isFinite(e)&&e>0?e:1;return Math.max(.4,Math.min(1,2/t))},F=L("div")({flexGrow:1,backgroundColor:N.background(),color:N.text(),"&:not(.MathJax) table":{borderCollapse:"collapse"},"&:not(.MathJax) table td, &:not(.MathJax) table th":{padding:".6em 1em",textAlign:"left"}}),B=L("div")(({theme:e})=>({backgroundColor:N.background(),color:N.text(),padding:e.spacing(2),"& blockquote":{background:"#f9f9f9",borderLeft:"5px solid #ccc",margin:"1.5em 10px",padding:".5em 10px"}})),G=L("div")({fontSize:"1.75rem"}),J=L("div")({fontSize:"1.5rem"}),K=L("div")({fontSize:"1.25rem"}),U=L(j)(({theme:e})=>({background:N.background(),fontSize:"inherit",fontFamily:"Roboto, sans-serif",color:N.text(),borderRadius:`${e.spacing(2)} ${e.spacing(2)} 0 0`,border:`1px solid ${N.borderGray()}`,borderBottomWidth:0,minHeight:"56px",padding:"8px 10px",display:"flex",alignItems:"center",justifyContent:"center",margin:`0 ${e.spacing(1)}`,textTransform:"none",".passage-label":{display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"normal",margin:"auto 0",opacity:.7},"&.Mui-selected":{color:N.text(),".passage-label":{opacity:1},".passage-label-underline":{backgroundColor:N.tertiary()}},"&:hover":{".passage-label-underline":{backgroundColor:N.tertiaryLight()}},"& .MuiTouchRipple-root":{opacity:.7}})),Z=L("div")(()=>({height:"2px",width:"100%",marginTop:"6px",background:N.background()}));class Q extends O.Component{constructor(...e){super(...e),Q.prototype.__init.call(this),Q.prototype.__init2.call(this),Q.prototype.__init3.call(this),Q.prototype.__init4.call(this),Q.prototype.__init5.call(this),Q.prototype.__init6.call(this),Q.prototype.__init7.call(this)}__init(){this.state={activeTab:0,zoomCompensation:P(),containerWidth:0}}__init2(){this.containerRef=O.createRef()}componentDidMount(){"undefined"!=typeof window&&(window.addEventListener("resize",this.updateZoomCompensation),this.containerRef.current&&"undefined"!=typeof ResizeObserver&&(this.resizeObserver=new ResizeObserver(this.updateContainerWidth),this.resizeObserver.observe(this.containerRef.current)),this.updateContainerWidth())}componentWillUnmount(){"undefined"!=typeof window&&(window.removeEventListener("resize",this.updateZoomCompensation),this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null))}__init3(){this.updateZoomCompensation=()=>{this.setState({zoomCompensation:P()})}}__init4(){this.updateContainerWidth=()=>{const e=this.containerRef.current;if(!e)return;const t=e.clientWidth;t!==this.state.containerWidth&&this.setState({containerWidth:t})}}__init5(){this.handleChange=(e,t)=>{this.setState(()=>({activeTab:t})),setTimeout(()=>{const e=new CustomEvent("pie-ui-passage-tabChanged",{detail:{tab:t}});window.dispatchEvent(e)})}}__init6(){this.handleKeyDown=(e,t)=>{const{key:n}=e,{tabs:i}=this.props;let r=-1;const a=i.findIndex(e=>e.id===t);switch(n){case"ArrowRight":r=(a+1)%i.length;break;case"ArrowLeft":r=(a-1+i.length)%i.length;break;case"Home":r=0;break;case"End":r=i.length-1;break;case"Enter":case" ":r=a}-1!==r&&(e.preventDefault(),e.stopPropagation(),this.handleChange(e,i[r].id),document.getElementById(`button-${i[r].id}`).focus())}}__init7(){this.parsedText=(e="")=>{const t=document.createElement("div");t.innerHTML=e.replace(/(<br\/>\n)/g,"<br/>");const n=t.querySelector("audio");if(n){const e=document.createElement("source");e.setAttribute("type","audio/mp3"),e.setAttribute("src",n.getAttribute("src")),n.removeAttribute("src"),n.appendChild(e)}return t.innerHTML}}renderInstructions(e,t=!1){if(!e)return;const n=O.createElement(H,{tagName:"div",className:"prompt",defaultClassName:"teacher-instructions",prompt:e});return t?n:O.createElement(W,{labels:{hidden:"Show Teacher Instructions",visible:"Hide Teacher Instructions"}},n)}renderTab(e,t){const{baseHeadingLevel:n}=this.props,i=n?Math.min(6,Math.max(1,n)):void 0,r=n?`h${i}`:"h2",a=n?Math.min(6,Math.max(1,i+1)):void 0;return O.createElement(B,{key:e.id,id:`tabpanel-${e.id}`,role:"tabpanel","aria-labelledby":`button-${e.id}`},this.renderInstructions(e.teacherInstructions,t),e.title&&O.createElement(A,{purpose:"passage-title"},O.createElement(r,null,O.createElement(G,{dangerouslySetInnerHTML:{__html:this.parsedText(e.title)}}))),e.subtitle&&O.createElement(A,{purpose:"passage-subtitle"},O.createElement(J,{dangerouslySetInnerHTML:{__html:this.parsedText(e.subtitle)}})),e.author&&O.createElement(A,{purpose:"passage-author"},O.createElement(K,{className:"author",dangerouslySetInnerHTML:{__html:this.parsedText(e.author)}})),e.text&&O.createElement(A,{purpose:"passage-text"},O.createElement("div",{key:e.id,className:"text",dangerouslySetInnerHTML:{__html:n?D(e.text,a):e.text}})))}render(){const{model:e,tabs:t,disabledTabs:n}=this.props,{activeTab:i,zoomCompensation:r,containerWidth:a}=this.state;if(!function(e){let t,n=e[0],i=1;for(;i<e.length;){const r=e[i],a=e[i+1];if(i+=2,("optionalAccess"===r||"optionalCall"===r)&&null==n)return;"access"===r||"optionalAccess"===r?(t=n,n=a(n)):"call"!==r&&"optionalCall"!==r||(n=a((...e)=>n.call(t,...e)),t=void 0)}return n}([t,"optionalAccess",e=>e.length]))return;const{extraCSSRules:o}=e||{},s=(t||[]).find(e=>e.id===i),l=a>0?a/t.length:null,c=a>0&&a<=170*t.length;return O.createElement(q,{extraCSSRules:o},O.createElement(F,{className:"passages",ref:this.containerRef},n||1===t.length?t.map(e=>this.renderTab(e,n)):O.createElement(O.Fragment,null,O.createElement($,{sx:{position:"static","@media (min-width: 841px)":{position:"sticky",top:0,zIndex:1},background:"var(--pie-passage-header-background, rgba(255,255,255,0))",color:N.text(),fontFamily:"Roboto, sans-serif",zoom:r,"& .MuiTabs-list":{backgroundColor:`var(--pie-passage-header-background, ${N.backgroundDark()})`,borderBottom:`1px solid ${N.borderGray()}`},"& .MuiTabs-indicator":{backgroundColor:N.white(),marginBottom:"-1px"}},value:i,onChange:this.handleChange},t.map((e,t)=>O.createElement(U,{key:e.id,id:`button-${e.id}`,sx:l?{maxWidth:`${l}px`}:void 0,label:O.createElement(O.Fragment,null,O.createElement(A,{purpose:"passage-label"},c?O.createElement("span",{className:"passage-label"},`Passage ${t+1}`):O.createElement("span",{className:"passage-label",dangerouslySetInnerHTML:{__html:this.parsedText(e.label)}})),O.createElement(Z,{className:"passage-label-underline"})),value:e.id,tabIndex:i===e.id?0:-1,"aria-controls":`tabpanel-${e.id}`,"aria-selected":i===e.id,onKeyDown:t=>this.handleKeyDown(t,e.id)}))),s?this.renderTab(s,n):null)))}}Q.propTypes={tabs:z.arrayOf(z.shape({id:z.number.isRequired,label:z.string.isRequired,title:z.string.isRequired,subtitle:z.string,author:z.string,text:z.string.isRequired,teacherInstructions:z.string}).isRequired).isRequired,disabledTabs:z.bool,model:z.object,baseHeadingLevel:z.number};const V=e,{createRoot:X}=o,Y=a("pie-element:passage:print"),ee=(e,t)=>(e=>null!=e)(e)?e:t;class te extends HTMLElement{constructor(){super(),this._model=null,this._options=null,this._session=[],this._root=null,this._rerender=I(()=>{if(this._model&&this._session){if(this._model.passages&&this._model.passages.length>0){const e=((e,t)=>{const n="instructor"===t.role,i=ee(e.teacherInstructionsEnabled,!0),r=ee(e.titleEnabled,!0),a=ee(e.authorEnabled,!1),o=ee(e.subtitleEnabled,!0),s=ee(e.textEnabled,!0);return e.passages.map((e,t)=>({id:t,teacherInstructions:ee(e.teacherInstructionsEnabled,i)&&n&&e.teacherInstructions||"",label:e.title||`Passage ${t+1}`,title:ee(e.titleEnabled,r)&&e.title||"",author:ee(e.authorEnabled,a)&&e.author||"",subtitle:ee(e.subtitleEnabled,o)&&e.subtitle||"",text:ee(e.textEnabled,s)&&e.text||""}))})(this._model,this._options),t=V.createElement(Q,{disabledTabs:!0,tabs:e});this._root||(this._root=X(this)),this._root.render(t)}}else Y("skip")},50,{leading:!1,trailing:!0})}set model(e){this._model=e,this._rerender()}set options(e){this._options=e}connectedCallback(){}disconnectedCallback(){this._root&&this._root.unmount()}}export{te as default};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pie-element/passage",
3
3
  "repository": "pie-framework/pie-elements",
4
- "version": "7.3.4",
4
+ "version": "7.3.5",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -20,7 +20,7 @@
20
20
  "react": "18.3.1",
21
21
  "react-dom": "18.3.1"
22
22
  },
23
- "gitHead": "d43fe1fb43626141b09cdda5292cf5d1f044440c",
23
+ "gitHead": "0f939adae5927fe0a54d21a4a98e224775562406",
24
24
  "scripts": {
25
25
  "postpublish": "../../scripts/postpublish"
26
26
  },