@pie-element/passage 6.1.1-next.4 → 6.1.1-next.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 +7 -0
- package/configure/CHANGELOG.md +7 -0
- package/configure/lib/passage.js +4 -3
- package/configure/lib/passage.js.map +1 -1
- package/configure/package.json +1 -1
- package/lib/index.js +39 -3
- package/lib/index.js.map +1 -1
- package/package.json +2 -2
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
|
+
## [6.1.1-next.5](https://github.com/pie-framework/pie-elements/compare/@pie-element/passage@6.1.1-next.4...@pie-element/passage@6.1.1-next.5) (2026-03-18)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- **passage:** ensure ALL_PLUGINS is defined before filtering basic plugins ([7d75830](https://github.com/pie-framework/pie-elements/commit/7d75830ec987457f26106174b78fd7759b976309))
|
|
11
|
+
- **passage:** use basic plugin filtering and add math rendering observer PD-5789 ([8a4ac21](https://github.com/pie-framework/pie-elements/commit/8a4ac213977a3ddda2a73abb9586fb765eaa8c50))
|
|
12
|
+
|
|
6
13
|
## [6.1.1-next.4](https://github.com/pie-framework/pie-elements/compare/@pie-element/passage@6.1.1-next.3...@pie-element/passage@6.1.1-next.4) (2026-03-12)
|
|
7
14
|
|
|
8
15
|
### Bug Fixes
|
package/configure/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
|
+
## [4.1.1-next.5](https://github.com/pie-framework/pie-elements/compare/@pie-element/passage-configure@4.1.1-next.4...@pie-element/passage-configure@4.1.1-next.5) (2026-03-18)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- **passage:** ensure ALL_PLUGINS is defined before filtering basic plugins ([7d75830](https://github.com/pie-framework/pie-elements/commit/7d75830ec987457f26106174b78fd7759b976309))
|
|
11
|
+
- **passage:** use basic plugin filtering and add math rendering observer PD-5789 ([8a4ac21](https://github.com/pie-framework/pie-elements/commit/8a4ac213977a3ddda2a73abb9586fb765eaa8c50))
|
|
12
|
+
|
|
6
13
|
## [4.1.1-next.4](https://github.com/pie-framework/pie-elements/compare/@pie-element/passage-configure@4.1.1-next.3...@pie-element/passage-configure@4.1.1-next.4) (2026-03-12)
|
|
7
14
|
|
|
8
15
|
### Bug Fixes
|
package/configure/lib/passage.js
CHANGED
|
@@ -93,6 +93,7 @@ class PassageComponent extends _react.default.Component {
|
|
|
93
93
|
...baseInputConfiguration,
|
|
94
94
|
...customConfiguration
|
|
95
95
|
});
|
|
96
|
+
const basicPlugins = (_editableHtmlTipTap.ALL_PLUGINS || []).filter(plugin => !['math', 'table', 'bulleted-list', 'numbered-list'].includes(plugin));
|
|
96
97
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, teacherInstructionsEnabled && /*#__PURE__*/_react.default.createElement(StyledInputContainer, {
|
|
97
98
|
label: teacherInstructions.label
|
|
98
99
|
}, /*#__PURE__*/_react.default.createElement(_editableHtmlTipTap.default, {
|
|
@@ -113,7 +114,7 @@ class PassageComponent extends _react.default.Component {
|
|
|
113
114
|
}), teacherInstructionsError && /*#__PURE__*/_react.default.createElement(ErrorText, null, teacherInstructionsError)), titleEnabled && /*#__PURE__*/_react.default.createElement(StyledInputContainer, {
|
|
114
115
|
label: title.label
|
|
115
116
|
}, /*#__PURE__*/_react.default.createElement(_editableHtmlTipTap.default, {
|
|
116
|
-
activePlugins:
|
|
117
|
+
activePlugins: basicPlugins,
|
|
117
118
|
markup: passages[passageIndex].title || '',
|
|
118
119
|
onChange: value => this.handleChange('title', value),
|
|
119
120
|
nonEmpty: false,
|
|
@@ -128,7 +129,7 @@ class PassageComponent extends _react.default.Component {
|
|
|
128
129
|
}), titleError && /*#__PURE__*/_react.default.createElement(ErrorText, null, titleError)), subtitleEnabled && /*#__PURE__*/_react.default.createElement(StyledInputContainer, {
|
|
129
130
|
label: subtitle.label
|
|
130
131
|
}, /*#__PURE__*/_react.default.createElement(_editableHtmlTipTap.default, {
|
|
131
|
-
activePlugins:
|
|
132
|
+
activePlugins: basicPlugins,
|
|
132
133
|
markup: passages[passageIndex].subtitle || '',
|
|
133
134
|
onChange: value => this.handleChange('subtitle', value),
|
|
134
135
|
nonEmpty: false,
|
|
@@ -143,7 +144,7 @@ class PassageComponent extends _react.default.Component {
|
|
|
143
144
|
}), subtitleError && /*#__PURE__*/_react.default.createElement(ErrorText, null, subtitleError)), authorEnabled && /*#__PURE__*/_react.default.createElement(StyledInputContainer, {
|
|
144
145
|
label: author.label
|
|
145
146
|
}, /*#__PURE__*/_react.default.createElement(_editableHtmlTipTap.default, {
|
|
146
|
-
activePlugins:
|
|
147
|
+
activePlugins: basicPlugins,
|
|
147
148
|
markup: passages[passageIndex].author || '',
|
|
148
149
|
onChange: value => this.handleChange('author', value),
|
|
149
150
|
nonEmpty: false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"passage.js","names":["_react","_interopRequireDefault","require","_propTypes","_configUi","_editableHtmlTipTap","_interopRequireWildcard","_styles","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","StyledInputContainer","styled","InputContainer","theme","paddingTop","spacing","marginBottom","width","ErrorText","fontSize","typography","color","palette","error","main","PassageComponent","React","Component","constructor","props","_defineProperty2","fieldName","value","model","onModelChanged","passageIndex","passages","length","updatedPassages","render","configuration","imageSupport","uploadSoundSupport","maxImageWidth","maxImageHeight","mathMlOptions","baseInputConfiguration","teacherInstructions","title","subtitle","text","author","errors","teacherInstructionsEnabled","titleEnabled","subtitleEnabled","authorEnabled","textEnabled","passagesErrors","teacherInstructionsError","titleError","subtitleError","authorError","textError","defaultImageMaxWidth","prompt","defaultImageMaxHeight","getPluginProps","customConfiguration","createElement","Fragment","label","activePlugins","ALL_PLUGINS","markup","onChange","handleChange","nonEmpty","languageCharactersProps","language","pluginProps","inputConfiguration","exports","PropTypes","func","isRequired","object","number","_default"],"sources":["../src/passage.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { InputContainer } from '@pie-lib/config-ui';\nimport EditableHtml, { ALL_PLUGINS } from '@pie-lib/editable-html-tip-tap';\nimport { styled } from '@mui/material/styles';\n\nconst StyledInputContainer = styled(InputContainer)(({ theme }) => ({\n paddingTop: theme.spacing(2),\n marginBottom: theme.spacing(2),\n width: '100%',\n}));\n\nconst ErrorText = styled('div')(({ theme }) => ({\n fontSize: theme.typography.fontSize - 2,\n color: theme.palette.error.main,\n paddingTop: theme.spacing(1),\n}));\n\nexport class PassageComponent extends React.Component {\n static propTypes = {\n onModelChanged: PropTypes.func.isRequired,\n model: PropTypes.object.isRequired,\n configuration: PropTypes.object.isRequired,\n imageSupport: PropTypes.object.isRequired,\n passageIndex: PropTypes.number.isRequired,\n uploadSoundSupport: PropTypes.object.isRequired,\n };\n\n static defaultProps = {\n passageIndex: 0,\n };\n\n constructor(props) {\n super(props);\n }\n\n handleChange = (fieldName, value) => {\n const { model, onModelChanged, passageIndex } = this.props;\n\n if (!model.passages || passageIndex < 0 || passageIndex >= model.passages.length) {\n return;\n }\n\n const updatedPassages = [...model.passages];\n updatedPassages[passageIndex] = { ...updatedPassages[passageIndex], [fieldName]: value };\n\n onModelChanged({ ...model, passages: updatedPassages });\n };\n\n render() {\n const { model, configuration, imageSupport, passageIndex, uploadSoundSupport } = this.props;\n const {\n maxImageWidth = {},\n maxImageHeight = {},\n mathMlOptions = {},\n baseInputConfiguration = {},\n teacherInstructions = {},\n title = {},\n subtitle = {},\n text = {},\n author = {},\n } = configuration || {};\n const {\n errors = {},\n passages = [],\n teacherInstructionsEnabled,\n titleEnabled,\n subtitleEnabled,\n authorEnabled,\n textEnabled,\n } = model || {};\n\n const { passages: passagesErrors } = errors || {};\n const {\n teacherInstructions: teacherInstructionsError,\n title: titleError,\n subtitle: subtitleError,\n author: authorError,\n text: textError,\n } = (passagesErrors && passagesErrors[passageIndex]) || {};\n\n const defaultImageMaxWidth = maxImageWidth && maxImageWidth.prompt;\n const defaultImageMaxHeight = maxImageHeight && maxImageHeight.prompt;\n\n const getPluginProps = (customConfiguration) => ({ ...baseInputConfiguration, ...customConfiguration });\n\n return (\n <React.Fragment>\n {teacherInstructionsEnabled && (\n <StyledInputContainer label={teacherInstructions.label}>\n <EditableHtml\n activePlugins={ALL_PLUGINS}\n markup={passages[passageIndex].teacherInstructions || ''}\n onChange={(value) => this.handleChange('teacherInstructions', value)}\n nonEmpty={false}\n error={teacherInstructionsError}\n maxImageWidth={(maxImageWidth && maxImageWidth.teacherInstructions) || defaultImageMaxWidth}\n maxImageHeight={(maxImageHeight && maxImageHeight.teacherInstructions) || defaultImageMaxHeight}\n mathMlOptions={mathMlOptions}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n pluginProps={getPluginProps(teacherInstructions?.inputConfiguration)}\n />\n {teacherInstructionsError && <ErrorText>{teacherInstructionsError}</ErrorText>}\n </StyledInputContainer>\n )}\n\n {titleEnabled && (\n <StyledInputContainer label={title.label}>\n <EditableHtml\n activePlugins={ALL_PLUGINS}\n markup={passages[passageIndex].title || ''}\n onChange={(value) => this.handleChange('title', value)}\n nonEmpty={false}\n error={titleError}\n mathMlOptions={mathMlOptions}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n pluginProps={getPluginProps(title?.inputConfiguration)}\n />\n {titleError && <ErrorText>{titleError}</ErrorText>}\n </StyledInputContainer>\n )}\n\n {subtitleEnabled && (\n <StyledInputContainer label={subtitle.label}>\n <EditableHtml\n activePlugins={ALL_PLUGINS}\n markup={passages[passageIndex].subtitle || ''}\n onChange={(value) => this.handleChange('subtitle', value)}\n nonEmpty={false}\n error={subtitleError}\n mathMlOptions={mathMlOptions}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n pluginProps={getPluginProps(subtitle?.inputConfiguration)}\n />\n {subtitleError && <ErrorText>{subtitleError}</ErrorText>}\n </StyledInputContainer>\n )}\n\n {authorEnabled && (\n <StyledInputContainer label={author.label}>\n <EditableHtml\n activePlugins={ALL_PLUGINS}\n markup={passages[passageIndex].author || ''}\n onChange={(value) => this.handleChange('author', value)}\n nonEmpty={false}\n error={authorError}\n mathMlOptions={mathMlOptions}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n pluginProps={getPluginProps(author?.inputConfiguration)}\n />\n {authorError && <ErrorText>{authorError}</ErrorText>}\n </StyledInputContainer>\n )}\n\n {textEnabled && (\n <StyledInputContainer label={text.label}>\n <EditableHtml\n activePlugins={ALL_PLUGINS}\n markup={passages[passageIndex].text || ''}\n onChange={(value) => this.handleChange('text', value)}\n imageSupport={imageSupport}\n uploadSoundSupport={uploadSoundSupport}\n nonEmpty={false}\n error={textError}\n maxImageWidth={(maxImageWidth && maxImageWidth.text) || defaultImageMaxWidth}\n maxImageHeight={(maxImageHeight && maxImageHeight.text) || defaultImageMaxHeight}\n mathMlOptions={mathMlOptions}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n pluginProps={getPluginProps(text?.inputConfiguration)}\n />\n {textError && <ErrorText>{textError}</ErrorText>}\n </StyledInputContainer>\n )}\n </React.Fragment>\n );\n }\n}\n\nexport default PassageComponent;\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,mBAAA,GAAAC,uBAAA,CAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AAA8C,SAAAI,wBAAAE,CA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ACvD,CAAC,EACDlB,SAAS,iBAAIhF,MAAA,CAAAkB,OAAA,CAAAoE,aAAA,CAACnD,SAAS,QAAE6C,SAAqB,CAC3B,CAEV,CAAC;EAErB;AACF;AAACmB,OAAA,CAAAzD,gBAAA,GAAAA,gBAAA;AAAA,IAAAK,gBAAA,CAAA7B,OAAA,EA9JYwB,gBAAgB,eACR;EACjBS,cAAc,EAAEiD,kBAAS,CAACC,IAAI,CAACC,UAAU;EACzCpD,KAAK,EAAEkD,kBAAS,CAACG,MAAM,CAACD,UAAU;EAClC7C,aAAa,EAAE2C,kBAAS,CAACG,MAAM,CAACD,UAAU;EAC1C5C,YAAY,EAAE0C,kBAAS,CAACG,MAAM,CAACD,UAAU;EACzClD,YAAY,EAAEgD,kBAAS,CAACI,MAAM,CAACF,UAAU;EACzC3C,kBAAkB,EAAEyC,kBAAS,CAACG,MAAM,CAACD;AACvC,CAAC;AAAA,IAAAvD,gBAAA,CAAA7B,OAAA,EARUwB,gBAAgB,kBAUL;EACpBU,YAAY,EAAE;AAChB,CAAC;AAAA,IAAAqD,QAAA,GAAAN,OAAA,CAAAjF,OAAA,GAoJYwB,gBAAgB","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"passage.js","names":["_react","_interopRequireDefault","require","_propTypes","_configUi","_editableHtmlTipTap","_interopRequireWildcard","_styles","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","StyledInputContainer","styled","InputContainer","theme","paddingTop","spacing","marginBottom","width","ErrorText","fontSize","typography","color","palette","error","main","PassageComponent","React","Component","constructor","props","_defineProperty2","fieldName","value","model","onModelChanged","passageIndex","passages","length","updatedPassages","render","configuration","imageSupport","uploadSoundSupport","maxImageWidth","maxImageHeight","mathMlOptions","baseInputConfiguration","teacherInstructions","title","subtitle","text","author","errors","teacherInstructionsEnabled","titleEnabled","subtitleEnabled","authorEnabled","textEnabled","passagesErrors","teacherInstructionsError","titleError","subtitleError","authorError","textError","defaultImageMaxWidth","prompt","defaultImageMaxHeight","getPluginProps","customConfiguration","basicPlugins","ALL_PLUGINS","filter","plugin","includes","createElement","Fragment","label","activePlugins","markup","onChange","handleChange","nonEmpty","languageCharactersProps","language","pluginProps","inputConfiguration","exports","PropTypes","func","isRequired","object","number","_default"],"sources":["../src/passage.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { InputContainer } from '@pie-lib/config-ui';\nimport EditableHtml, { ALL_PLUGINS } from '@pie-lib/editable-html-tip-tap';\nimport { styled } from '@mui/material/styles';\n\nconst StyledInputContainer = styled(InputContainer)(({ theme }) => ({\n paddingTop: theme.spacing(2),\n marginBottom: theme.spacing(2),\n width: '100%',\n}));\n\nconst ErrorText = styled('div')(({ theme }) => ({\n fontSize: theme.typography.fontSize - 2,\n color: theme.palette.error.main,\n paddingTop: theme.spacing(1),\n}));\n\nexport class PassageComponent extends React.Component {\n static propTypes = {\n onModelChanged: PropTypes.func.isRequired,\n model: PropTypes.object.isRequired,\n configuration: PropTypes.object.isRequired,\n imageSupport: PropTypes.object.isRequired,\n passageIndex: PropTypes.number.isRequired,\n uploadSoundSupport: PropTypes.object.isRequired,\n };\n\n static defaultProps = {\n passageIndex: 0,\n };\n\n constructor(props) {\n super(props);\n }\n\n handleChange = (fieldName, value) => {\n const { model, onModelChanged, passageIndex } = this.props;\n\n if (!model.passages || passageIndex < 0 || passageIndex >= model.passages.length) {\n return;\n }\n\n const updatedPassages = [...model.passages];\n updatedPassages[passageIndex] = { ...updatedPassages[passageIndex], [fieldName]: value };\n\n onModelChanged({ ...model, passages: updatedPassages });\n };\n\n render() {\n const { model, configuration, imageSupport, passageIndex, uploadSoundSupport } = this.props;\n const {\n maxImageWidth = {},\n maxImageHeight = {},\n mathMlOptions = {},\n baseInputConfiguration = {},\n teacherInstructions = {},\n title = {},\n subtitle = {},\n text = {},\n author = {},\n } = configuration || {};\n const {\n errors = {},\n passages = [],\n teacherInstructionsEnabled,\n titleEnabled,\n subtitleEnabled,\n authorEnabled,\n textEnabled,\n } = model || {};\n\n const { passages: passagesErrors } = errors || {};\n const {\n teacherInstructions: teacherInstructionsError,\n title: titleError,\n subtitle: subtitleError,\n author: authorError,\n text: textError,\n } = (passagesErrors && passagesErrors[passageIndex]) || {};\n\n const defaultImageMaxWidth = maxImageWidth && maxImageWidth.prompt;\n const defaultImageMaxHeight = maxImageHeight && maxImageHeight.prompt;\n\n const getPluginProps = (customConfiguration) => ({ ...baseInputConfiguration, ...customConfiguration });\n\n const basicPlugins = (ALL_PLUGINS || []).filter(plugin => ![\n 'math',\n 'table',\n 'bulleted-list',\n 'numbered-list',\n ].includes(plugin));\n\n return (\n <React.Fragment>\n {teacherInstructionsEnabled && (\n <StyledInputContainer label={teacherInstructions.label}>\n <EditableHtml\n activePlugins={ALL_PLUGINS}\n markup={passages[passageIndex].teacherInstructions || ''}\n onChange={(value) => this.handleChange('teacherInstructions', value)}\n nonEmpty={false}\n error={teacherInstructionsError}\n maxImageWidth={(maxImageWidth && maxImageWidth.teacherInstructions) || defaultImageMaxWidth}\n maxImageHeight={(maxImageHeight && maxImageHeight.teacherInstructions) || defaultImageMaxHeight}\n mathMlOptions={mathMlOptions}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n pluginProps={getPluginProps(teacherInstructions?.inputConfiguration)}\n />\n {teacherInstructionsError && <ErrorText>{teacherInstructionsError}</ErrorText>}\n </StyledInputContainer>\n )}\n\n {titleEnabled && (\n <StyledInputContainer label={title.label}>\n <EditableHtml\n activePlugins={basicPlugins}\n markup={passages[passageIndex].title || ''}\n onChange={(value) => this.handleChange('title', value)}\n nonEmpty={false}\n error={titleError}\n mathMlOptions={mathMlOptions}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n pluginProps={getPluginProps(title?.inputConfiguration)}\n />\n {titleError && <ErrorText>{titleError}</ErrorText>}\n </StyledInputContainer>\n )}\n\n {subtitleEnabled && (\n <StyledInputContainer label={subtitle.label}>\n <EditableHtml\n activePlugins={basicPlugins}\n markup={passages[passageIndex].subtitle || ''}\n onChange={(value) => this.handleChange('subtitle', value)}\n nonEmpty={false}\n error={subtitleError}\n mathMlOptions={mathMlOptions}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n pluginProps={getPluginProps(subtitle?.inputConfiguration)}\n />\n {subtitleError && <ErrorText>{subtitleError}</ErrorText>}\n </StyledInputContainer>\n )}\n\n {authorEnabled && (\n <StyledInputContainer label={author.label}>\n <EditableHtml\n activePlugins={basicPlugins}\n markup={passages[passageIndex].author || ''}\n onChange={(value) => this.handleChange('author', value)}\n nonEmpty={false}\n error={authorError}\n mathMlOptions={mathMlOptions}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n pluginProps={getPluginProps(author?.inputConfiguration)}\n />\n {authorError && <ErrorText>{authorError}</ErrorText>}\n </StyledInputContainer>\n )}\n\n {textEnabled && (\n <StyledInputContainer label={text.label}>\n <EditableHtml\n activePlugins={ALL_PLUGINS}\n markup={passages[passageIndex].text || ''}\n onChange={(value) => this.handleChange('text', value)}\n imageSupport={imageSupport}\n uploadSoundSupport={uploadSoundSupport}\n nonEmpty={false}\n error={textError}\n maxImageWidth={(maxImageWidth && maxImageWidth.text) || defaultImageMaxWidth}\n maxImageHeight={(maxImageHeight && maxImageHeight.text) || defaultImageMaxHeight}\n mathMlOptions={mathMlOptions}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n pluginProps={getPluginProps(text?.inputConfiguration)}\n />\n {textError && <ErrorText>{textError}</ErrorText>}\n </StyledInputContainer>\n )}\n </React.Fragment>\n );\n }\n}\n\nexport default PassageComponent;\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,mBAAA,GAAAC,uBAAA,CAAAJ,OAAA;A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M,IAAI,IAAKgB,qBAAsB;MACjFrB,aAAa,EAAEA,aAAc;MAC7BqC,uBAAuB,EAAE,CAAC;QAAEC,QAAQ,EAAE;MAAU,CAAC,EAAE;QAAEA,QAAQ,EAAE;MAAU,CAAC,CAAE;MAC5EC,WAAW,EAAEjB,cAAc,CAACjB,IAAI,EAAEmC,kBAAkB;IAAE,CACvD,CAAC,EACDtB,SAAS,iBAAIhF,MAAA,CAAAkB,OAAA,CAAAyE,aAAA,CAACxD,SAAS,QAAE6C,SAAqB,CAC3B,CAEV,CAAC;EAErB;AACF;AAACuB,OAAA,CAAA7D,gBAAA,GAAAA,gBAAA;AAAA,IAAAK,gBAAA,CAAA7B,OAAA,EArKYwB,gBAAgB,eACR;EACjBS,cAAc,EAAEqD,kBAAS,CAACC,IAAI,CAACC,UAAU;EACzCxD,KAAK,EAAEsD,kBAAS,CAACG,MAAM,CAACD,UAAU;EAClCjD,aAAa,EAAE+C,kBAAS,CAACG,MAAM,CAACD,UAAU;EAC1ChD,YAAY,EAAE8C,kBAAS,CAACG,MAAM,CAACD,UAAU;EACzCtD,YAAY,EAAEoD,kBAAS,CAACI,MAAM,CAACF,UAAU;EACzC/C,kBAAkB,EAAE6C,kBAAS,CAACG,MAAM,CAACD;AACvC,CAAC;AAAA,IAAA3D,gBAAA,CAAA7B,OAAA,EARUwB,gBAAgB,kBAUL;EACpBU,YAAY,EAAE;AAChB,CAAC;AAAA,IAAAyD,QAAA,GAAAN,OAAA,CAAArF,OAAA,GA2JYwB,gBAAgB","ignoreList":[]}
|
package/configure/package.json
CHANGED
package/lib/index.js
CHANGED
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
8
9
|
var _piePlayerEvents = require("@pie-framework/pie-player-events");
|
|
9
10
|
var _mathRendering = require("@pie-lib/math-rendering");
|
|
10
11
|
var _react = _interopRequireDefault(require("react"));
|
|
@@ -13,17 +14,52 @@ var _stimulusTabs = _interopRequireDefault(require("./stimulus-tabs"));
|
|
|
13
14
|
class PiePassage extends HTMLElement {
|
|
14
15
|
constructor() {
|
|
15
16
|
super();
|
|
17
|
+
(0, _defineProperty2.default)(this, "_scheduleMathRender", () => {
|
|
18
|
+
if (this._mathRenderPending) return;
|
|
19
|
+
this._mathRenderPending = true;
|
|
20
|
+
requestAnimationFrame(() => {
|
|
21
|
+
if (this._mathObserver) {
|
|
22
|
+
this._mathObserver.disconnect();
|
|
23
|
+
}
|
|
24
|
+
(0, _mathRendering.renderMath)(this);
|
|
25
|
+
this._mathRenderPending = false;
|
|
26
|
+
setTimeout(() => {
|
|
27
|
+
if (this._mathObserver) {
|
|
28
|
+
this._mathObserver.observe(this, {
|
|
29
|
+
childList: true,
|
|
30
|
+
subtree: true
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
}, 50);
|
|
34
|
+
});
|
|
35
|
+
});
|
|
16
36
|
this._model = {
|
|
17
37
|
passages: []
|
|
18
38
|
};
|
|
19
39
|
this._session = null;
|
|
20
40
|
this._root = null;
|
|
41
|
+
this._mathObserver = null;
|
|
42
|
+
this._mathRenderPending = false;
|
|
21
43
|
}
|
|
22
44
|
setLangAttribute() {
|
|
23
45
|
const language = this._model && typeof this._model.language ? this._model.language : '';
|
|
24
46
|
const lang = language ? language.slice(0, 2) : 'en';
|
|
25
47
|
this.setAttribute('lang', lang);
|
|
26
48
|
}
|
|
49
|
+
_initMathObserver() {
|
|
50
|
+
if (this._mathObserver) return;
|
|
51
|
+
this._mathObserver = new MutationObserver(this._scheduleMathRender);
|
|
52
|
+
this._mathObserver.observe(this, {
|
|
53
|
+
childList: true,
|
|
54
|
+
subtree: true
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
_disconnectMathObserver() {
|
|
58
|
+
if (this._mathObserver) {
|
|
59
|
+
this._mathObserver.disconnect();
|
|
60
|
+
this._mathObserver = null;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
27
63
|
set model(s) {
|
|
28
64
|
this._model = s;
|
|
29
65
|
this.dispatchEvent(new _piePlayerEvents.ModelSetEvent(this.tagName.toLowerCase(), this._session, !!this._model));
|
|
@@ -36,6 +72,7 @@ class PiePassage extends HTMLElement {
|
|
|
36
72
|
connectedCallback() {
|
|
37
73
|
this.setAttribute('aria-label', 'Passage');
|
|
38
74
|
this.setAttribute('role', 'region');
|
|
75
|
+
this._initMathObserver();
|
|
39
76
|
this._render();
|
|
40
77
|
}
|
|
41
78
|
_render() {
|
|
@@ -54,12 +91,11 @@ class PiePassage extends HTMLElement {
|
|
|
54
91
|
this._root = (0, _client.createRoot)(this);
|
|
55
92
|
}
|
|
56
93
|
this._root.render(elem);
|
|
57
|
-
|
|
58
|
-
(0, _mathRendering.renderMath)(this);
|
|
59
|
-
});
|
|
94
|
+
this._initMathObserver();
|
|
60
95
|
}
|
|
61
96
|
}
|
|
62
97
|
disconnectedCallback() {
|
|
98
|
+
this._disconnectMathObserver();
|
|
63
99
|
if (this._root) {
|
|
64
100
|
this._root.unmount();
|
|
65
101
|
}
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_piePlayerEvents","require","_mathRendering","_react","_interopRequireDefault","_client","_stimulusTabs","PiePassage","HTMLElement","constructor","_model","passages","_session","_root","setLangAttribute","language","lang","slice","setAttribute","model","s","dispatchEvent","ModelSetEvent","tagName","toLowerCase","_render","session","connectedCallback","length","passagesTabs","map","passage","index","id","elem","React","createElement","StimulusTabs","tabs","createRoot","render","
|
|
1
|
+
{"version":3,"file":"index.js","names":["_piePlayerEvents","require","_mathRendering","_react","_interopRequireDefault","_client","_stimulusTabs","PiePassage","HTMLElement","constructor","_defineProperty2","default","_mathRenderPending","requestAnimationFrame","_mathObserver","disconnect","renderMath","setTimeout","observe","childList","subtree","_model","passages","_session","_root","setLangAttribute","language","lang","slice","setAttribute","_initMathObserver","MutationObserver","_scheduleMathRender","_disconnectMathObserver","model","s","dispatchEvent","ModelSetEvent","tagName","toLowerCase","_render","session","connectedCallback","length","passagesTabs","map","passage","index","id","elem","React","createElement","StimulusTabs","tabs","createRoot","render","disconnectedCallback","unmount","exports"],"sources":["../src/index.js"],"sourcesContent":["import { ModelSetEvent } from '@pie-framework/pie-player-events';\nimport { renderMath } from '@pie-lib/math-rendering';\nimport React from 'react';\nimport { createRoot } from 'react-dom/client';\n\nimport StimulusTabs from './stimulus-tabs';\n\nexport default class PiePassage extends HTMLElement {\n constructor() {\n super();\n this._model = {\n passages: [],\n };\n this._session = null;\n this._root = null;\n this._mathObserver = null;\n this._mathRenderPending = false;\n }\n\n setLangAttribute() {\n const language = this._model && typeof this._model.language ? this._model.language : '';\n const lang = language ? language.slice(0, 2) : 'en';\n this.setAttribute('lang', lang);\n }\n\n _scheduleMathRender = () => {\n if (this._mathRenderPending) return;\n this._mathRenderPending = true;\n\n requestAnimationFrame(() => {\n if (this._mathObserver) {\n this._mathObserver.disconnect();\n }\n renderMath(this);\n this._mathRenderPending = false;\n setTimeout(() => {\n if (this._mathObserver) {\n this._mathObserver.observe(this, { childList: true, subtree: true });\n }\n }, 50);\n });\n };\n\n _initMathObserver() {\n if (this._mathObserver) return;\n this._mathObserver = new MutationObserver(this._scheduleMathRender);\n this._mathObserver.observe(this, { childList: true, subtree: true });\n }\n\n _disconnectMathObserver() {\n if (this._mathObserver) {\n this._mathObserver.disconnect();\n this._mathObserver = null;\n }\n }\n\n set model(s) {\n this._model = s;\n this.dispatchEvent(new ModelSetEvent(this.tagName.toLowerCase(), this._session, !!this._model));\n this.setLangAttribute();\n\n this._render();\n }\n\n set session(s) {\n this._session = s;\n }\n\n connectedCallback() {\n this.setAttribute('aria-label', 'Passage');\n this.setAttribute('role', 'region');\n this._initMathObserver();\n this._render();\n }\n\n _render() {\n const { passages = [] } = this._model;\n\n if (this._model.passages.length > 0) {\n const passagesTabs = passages.map((passage, index) => ({\n id: index,\n ...passage,\n }));\n\n const elem = React.createElement(StimulusTabs, {\n tabs: passagesTabs,\n });\n\n if (!this._root) {\n this._root = createRoot(this);\n }\n this._root.render(elem);\n\n this._initMathObserver();\n }\n }\n\n disconnectedCallback() {\n this._disconnectMathObserver();\n if (this._root) {\n this._root.unmount();\n }\n }\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,gBAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAEA,IAAAK,aAAA,GAAAF,sBAAA,CAAAH,OAAA;AAEe,MAAMM,UAAU,SAASC,WAAW,CAAC;EAClDC,WAAWA,CAAA,EAAG;IACZ,KAAK,CAAC,CAAC;IAAC,IAAAC,gBAAA,CAAAC,OAAA,+BAgBY,MAAM;MAC1B,IAAI,IAAI,CAACC,kBAAkB,EAAE;MAC7B,IAAI,CAACA,kBAAkB,GAAG,IAAI;MAE9BC,qBAAqB,CAAC,MAAM;QAC1B,IAAI,IAAI,CAACC,aAAa,EAAE;UACtB,IAAI,CAACA,aAAa,CAACC,UAAU,CAAC,CAAC;QACjC;QACA,IAAAC,yBAAU,EAAC,IAAI,CAAC;QAChB,IAAI,CAACJ,kBAAkB,GAAG,KAAK;QAC/BK,UAAU,CAAC,MAAM;UACf,IAAI,IAAI,CAACH,aAAa,EAAE;YACtB,IAAI,CAACA,aAAa,CAACI,OAAO,CAAC,IAAI,EAAE;cAAEC,SAAS,EAAE,IAAI;cAAEC,OAAO,EAAE;YAAK,CAAC,CAAC;UACtE;QACF,CAAC,EAAE,EAAE,CAAC;MACR,CAAC,CAAC;IACJ,CAAC;IA/BC,IAAI,CAACC,MAAM,GAAG;MACZC,QAAQ,EAAE;IACZ,CAAC;IACD,IAAI,CAACC,QAAQ,GAAG,IAAI;IACpB,IAAI,CAACC,KAAK,GAAG,IAAI;IACjB,I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,CAAC;EACnB;EAEAO,iBAAiBA,CAAA,EAAG;IAClB,IAAI,CAACb,YAAY,CAAC,YAAY,EAAE,SAAS,CAAC;IAC1C,IAAI,CAACA,YAAY,CAAC,MAAM,EAAE,QAAQ,CAAC;IACnC,IAAI,CAACC,iBAAiB,CAAC,CAAC;IACxB,IAAI,CAACU,OAAO,CAAC,CAAC;EAChB;EAEAA,OAAOA,CAAA,EAAG;IACR,MAAM;MAAElB,QAAQ,GAAG;IAAG,CAAC,GAAG,IAAI,CAACD,MAAM;IAErC,IAAI,IAAI,CAACA,MAAM,CAACC,QAAQ,CAACqB,MAAM,GAAG,CAAC,EAAE;MACnC,MAAMC,YAAY,GAAGtB,QAAQ,CAACuB,GAAG,CAAC,CAACC,OAAO,EAAEC,KAAK,MAAM;QACrDC,EAAE,EAAED,KAAK;QACT,GAAGD;MACL,CAAC,CAAC,CAAC;MAEH,MAAMG,IAAI,gBAAGC,cAAK,CAACC,aAAa,CAACC,qBAAY,EAAE;QAC7CC,IAAI,EAAET;MACR,CAAC,CAAC;MAEF,IAAI,CAAC,IAAI,CAACpB,KAAK,EAAE;QACf,IAAI,CAACA,KAAK,GAAG,IAAA8B,kBAAU,EAAC,IAAI,CAAC;MAC/B;MACA,IAAI,CAAC9B,KAAK,CAAC+B,MAAM,CAACN,IAAI,CAAC;MAEvB,IAAI,CAACnB,iBAAiB,CAAC,CAAC;IAC1B;EACF;EAEA0B,oBAAoBA,CAAA,EAAG;IACrB,IAAI,CAACvB,uBAAuB,CAAC,CAAC;IAC9B,IAAI,IAAI,CAACT,KAAK,EAAE;MACd,IAAI,CAACA,KAAK,CAACiC,OAAO,CAAC,CAAC;IACtB;EACF;AACF;AAACC,OAAA,CAAA/C,OAAA,GAAAJ,UAAA","ignoreList":[]}
|
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": "6.1.1-next.
|
|
4
|
+
"version": "6.1.1-next.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": "
|
|
23
|
+
"gitHead": "d73b4baeb204e75095024baab5dc99182023301e",
|
|
24
24
|
"scripts": {
|
|
25
25
|
"postpublish": "../../scripts/postpublish"
|
|
26
26
|
},
|