@pie-element/passage 2.13.1-next.0 → 2.13.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/docs/demo/generate.js +20 -18
- package/lib/index.js +7 -2
- package/lib/index.js.map +1 -1
- package/lib/print.js +4 -2
- package/lib/print.js.map +1 -1
- package/lib/stimulus-tabs.js +94 -103
- package/lib/stimulus-tabs.js.map +1 -1
- package/module/demo.js +20 -18
- package/module/element.js +162 -182
- package/module/print-demo.js +20 -18
- package/module/print.js +161 -181
- package/package.json +2 -2
package/module/print.js
CHANGED
|
@@ -8544,39 +8544,62 @@ const classNames = _dll_classnames;
|
|
|
8544
8544
|
const {Collapsible: Collapsible} = _dll_pie_lib__pie_toolbox_render_ui;
|
|
8545
8545
|
const {color: color} = _dll_pie_lib__pie_toolbox_render_ui;
|
|
8546
8546
|
const {PreviewPrompt: PreviewPrompt} = _dll_pie_lib__pie_toolbox_render_ui;
|
|
8547
|
-
const {Purpose: Purpose} = _dll_pie_lib__pie_toolbox_render_ui;
|
|
8548
8547
|
const _jsxFileName = "/home/circleci/repo/packages/passage/src/stimulus-tabs.jsx";
|
|
8548
|
+
function _optionalChain(ops) {
|
|
8549
|
+
let lastAccessLHS = undefined;
|
|
8550
|
+
let value = ops[0];
|
|
8551
|
+
let i = 1;
|
|
8552
|
+
while (i < ops.length) {
|
|
8553
|
+
const op = ops[i];
|
|
8554
|
+
const fn = ops[i + 1];
|
|
8555
|
+
i += 2;
|
|
8556
|
+
if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) {
|
|
8557
|
+
return undefined;
|
|
8558
|
+
}
|
|
8559
|
+
if (op === 'access' || op === 'optionalAccess') {
|
|
8560
|
+
lastAccessLHS = value;
|
|
8561
|
+
value = fn(value);
|
|
8562
|
+
} else if (op === 'call' || op === 'optionalCall') {
|
|
8563
|
+
value = fn((...args) => value.call(lastAccessLHS, ...args));
|
|
8564
|
+
lastAccessLHS = undefined;
|
|
8565
|
+
}
|
|
8566
|
+
}
|
|
8567
|
+
return value;
|
|
8568
|
+
}
|
|
8549
8569
|
const styles = theme => ({
|
|
8550
|
-
|
|
8570
|
+
passages: {
|
|
8551
8571
|
flexGrow: 1,
|
|
8552
8572
|
backgroundColor: color.background(),
|
|
8553
8573
|
color: color.text()
|
|
8554
8574
|
},
|
|
8555
|
-
|
|
8556
|
-
|
|
8557
|
-
|
|
8558
|
-
|
|
8575
|
+
passage: {
|
|
8576
|
+
backgroundColor: color.background(),
|
|
8577
|
+
color: color.text(),
|
|
8578
|
+
padding: theme.spacing.unit * 2
|
|
8579
|
+
},
|
|
8580
|
+
passageTitle: {
|
|
8581
|
+
fontSize: '1.75rem'
|
|
8582
|
+
},
|
|
8583
|
+
passageSubtitle: {
|
|
8584
|
+
fontSize: '1.5rem'
|
|
8585
|
+
},
|
|
8586
|
+
passageAuthor: {
|
|
8587
|
+
fontSize: '1.25rem'
|
|
8559
8588
|
},
|
|
8589
|
+
passageText: {},
|
|
8560
8590
|
stickyTabs: {
|
|
8561
8591
|
background: color.background(),
|
|
8562
8592
|
position: 'sticky',
|
|
8563
8593
|
top: 0
|
|
8564
8594
|
},
|
|
8565
|
-
|
|
8566
|
-
|
|
8567
|
-
|
|
8568
|
-
|
|
8569
|
-
width: 'fit-content',
|
|
8570
|
-
marginBottom: theme.spacing.unit
|
|
8595
|
+
tab: {
|
|
8596
|
+
background: theme.palette.common.white,
|
|
8597
|
+
fontSize: 'inherit',
|
|
8598
|
+
color: theme.palette.common.black
|
|
8571
8599
|
},
|
|
8572
|
-
|
|
8600
|
+
tabButton: {
|
|
8573
8601
|
background: theme.palette.common.white
|
|
8574
8602
|
},
|
|
8575
|
-
tabContainer: {
|
|
8576
|
-
backgroundColor: color.background(),
|
|
8577
|
-
color: color.text(),
|
|
8578
|
-
padding: theme.spacing.unit * 2
|
|
8579
|
-
},
|
|
8580
8603
|
breakSpaces: {
|
|
8581
8604
|
whiteSpace: 'break-spaces'
|
|
8582
8605
|
},
|
|
@@ -8645,7 +8668,7 @@ class StimulusTabs extends React$1.Component {
|
|
|
8645
8668
|
};
|
|
8646
8669
|
}
|
|
8647
8670
|
__init4() {
|
|
8648
|
-
this.parsedText = text => {
|
|
8671
|
+
this.parsedText = (text = '') => {
|
|
8649
8672
|
const div = document.createElement('div');
|
|
8650
8673
|
div.innerHTML = text.replace(/(<br\/>\n)/g, '<br/>');
|
|
8651
8674
|
const audio = div.querySelector('audio');
|
|
@@ -8671,7 +8694,7 @@ class StimulusTabs extends React$1.Component {
|
|
|
8671
8694
|
__self: this,
|
|
8672
8695
|
__source: {
|
|
8673
8696
|
fileName: _jsxFileName,
|
|
8674
|
-
lineNumber:
|
|
8697
|
+
lineNumber: 130
|
|
8675
8698
|
}
|
|
8676
8699
|
});
|
|
8677
8700
|
if (disabledTabs) {
|
|
@@ -8685,171 +8708,126 @@ class StimulusTabs extends React$1.Component {
|
|
|
8685
8708
|
__self: this,
|
|
8686
8709
|
__source: {
|
|
8687
8710
|
fileName: _jsxFileName,
|
|
8688
|
-
lineNumber:
|
|
8711
|
+
lineNumber: 143
|
|
8689
8712
|
}
|
|
8690
8713
|
}, teacherInstructionsDiv);
|
|
8691
8714
|
}
|
|
8715
|
+
renderTab(tab, showTeacherInstructions, disabledTabs) {
|
|
8716
|
+
const {classes} = this.props;
|
|
8717
|
+
return React$1.createElement('div', {
|
|
8718
|
+
className: classNames(classes.passage, 'passage'),
|
|
8719
|
+
key: tab.id,
|
|
8720
|
+
id: `tabpanel-${tab.id}`,
|
|
8721
|
+
role: "tabpanel",
|
|
8722
|
+
'aria-labelledby': `button-${tab.id}`,
|
|
8723
|
+
__self: this,
|
|
8724
|
+
__source: {
|
|
8725
|
+
fileName: _jsxFileName,
|
|
8726
|
+
lineNumber: 158
|
|
8727
|
+
}
|
|
8728
|
+
}, this.renderInstructions(showTeacherInstructions, tab.teacherInstructions, disabledTabs), React$1.createElement('h2', {
|
|
8729
|
+
__self: this,
|
|
8730
|
+
__source: {
|
|
8731
|
+
fileName: _jsxFileName,
|
|
8732
|
+
lineNumber: 166
|
|
8733
|
+
}
|
|
8734
|
+
}, React$1.createElement('div', {
|
|
8735
|
+
className: classNames(classes.passageTitle, 'title'),
|
|
8736
|
+
dangerouslySetInnerHTML: {
|
|
8737
|
+
__html: this.parsedText(tab.title)
|
|
8738
|
+
},
|
|
8739
|
+
__self: this,
|
|
8740
|
+
__source: {
|
|
8741
|
+
fileName: _jsxFileName,
|
|
8742
|
+
lineNumber: 167
|
|
8743
|
+
}
|
|
8744
|
+
}), React$1.createElement('div', {
|
|
8745
|
+
className: classNames(classes.passageSubtitle, 'subtitle'),
|
|
8746
|
+
dangerouslySetInnerHTML: {
|
|
8747
|
+
__html: this.parsedText(tab.subtitle)
|
|
8748
|
+
},
|
|
8749
|
+
__self: this,
|
|
8750
|
+
__source: {
|
|
8751
|
+
fileName: _jsxFileName,
|
|
8752
|
+
lineNumber: 171
|
|
8753
|
+
}
|
|
8754
|
+
})), React$1.createElement('div', {
|
|
8755
|
+
className: classNames(classes.passageAuthor, 'author'),
|
|
8756
|
+
dangerouslySetInnerHTML: {
|
|
8757
|
+
__html: this.parsedText(tab.author)
|
|
8758
|
+
},
|
|
8759
|
+
__self: this,
|
|
8760
|
+
__source: {
|
|
8761
|
+
fileName: _jsxFileName,
|
|
8762
|
+
lineNumber: 176
|
|
8763
|
+
}
|
|
8764
|
+
}), React$1.createElement('div', {
|
|
8765
|
+
key: tab.id,
|
|
8766
|
+
className: classNames(classes.passageText, 'text'),
|
|
8767
|
+
dangerouslySetInnerHTML: {
|
|
8768
|
+
__html: this.parsedText(tab.text)
|
|
8769
|
+
},
|
|
8770
|
+
__self: this,
|
|
8771
|
+
__source: {
|
|
8772
|
+
fileName: _jsxFileName,
|
|
8773
|
+
lineNumber: 180
|
|
8774
|
+
}
|
|
8775
|
+
}));
|
|
8776
|
+
}
|
|
8692
8777
|
render() {
|
|
8693
8778
|
const {classes, tabs, disabledTabs, showTeacherInstructions} = this.props;
|
|
8694
8779
|
const {activeTab} = this.state;
|
|
8695
|
-
if (tabs
|
|
8696
|
-
return
|
|
8697
|
-
|
|
8698
|
-
|
|
8699
|
-
|
|
8700
|
-
|
|
8701
|
-
|
|
8702
|
-
|
|
8703
|
-
|
|
8704
|
-
|
|
8705
|
-
|
|
8706
|
-
|
|
8707
|
-
|
|
8708
|
-
|
|
8709
|
-
|
|
8710
|
-
|
|
8711
|
-
|
|
8712
|
-
|
|
8713
|
-
|
|
8714
|
-
|
|
8715
|
-
|
|
8716
|
-
|
|
8717
|
-
|
|
8718
|
-
|
|
8719
|
-
|
|
8720
|
-
|
|
8721
|
-
|
|
8722
|
-
|
|
8723
|
-
|
|
8724
|
-
|
|
8725
|
-
}, React$1.createElement('div', {
|
|
8726
|
-
className: classNames(classes.title, 'title'),
|
|
8780
|
+
if (!_optionalChain([tabs, 'optionalAccess', _ => _.length])) {
|
|
8781
|
+
return;
|
|
8782
|
+
}
|
|
8783
|
+
const selectedTab = (tabs || []).find(tab => tab.id === activeTab);
|
|
8784
|
+
return React$1.createElement('div', {
|
|
8785
|
+
className: classNames(classes.passages, {
|
|
8786
|
+
[classes.breakSpaces]: tabs.length === 1
|
|
8787
|
+
}, 'passages'),
|
|
8788
|
+
__self: this,
|
|
8789
|
+
__source: {
|
|
8790
|
+
fileName: _jsxFileName,
|
|
8791
|
+
lineNumber: 200
|
|
8792
|
+
}
|
|
8793
|
+
}, disabledTabs || tabs.length === 1 ? tabs.map(tab => this.renderTab(tab, showTeacherInstructions, disabledTabs)) : React$1.createElement(React$1.Fragment, null, React$1.createElement(Tabs, {
|
|
8794
|
+
classes: {
|
|
8795
|
+
root: classes.stickyTabs,
|
|
8796
|
+
flexContainer: classes.tabButton
|
|
8797
|
+
},
|
|
8798
|
+
value: activeTab,
|
|
8799
|
+
onChange: this.handleChange,
|
|
8800
|
+
__self: this,
|
|
8801
|
+
__source: {
|
|
8802
|
+
fileName: _jsxFileName,
|
|
8803
|
+
lineNumber: 205
|
|
8804
|
+
}
|
|
8805
|
+
}, tabs.map(tab => React$1.createElement(Tab, {
|
|
8806
|
+
className: classes.tab,
|
|
8807
|
+
key: tab.id,
|
|
8808
|
+
id: `button-${tab.id}`,
|
|
8809
|
+
label: React$1.createElement('span', {
|
|
8727
8810
|
dangerouslySetInnerHTML: {
|
|
8728
8811
|
__html: this.parsedText(tab.title)
|
|
8729
8812
|
},
|
|
8730
8813
|
__self: this,
|
|
8731
8814
|
__source: {
|
|
8732
8815
|
fileName: _jsxFileName,
|
|
8733
|
-
lineNumber:
|
|
8734
|
-
}
|
|
8735
|
-
}), this.renderInstructions(showTeacherInstructions, tab.teacherInstructions, disabledTabs), React$1.createElement(Purpose, {
|
|
8736
|
-
purpose: "passage-text",
|
|
8737
|
-
__self: this,
|
|
8738
|
-
__source: {
|
|
8739
|
-
fileName: _jsxFileName,
|
|
8740
|
-
lineNumber: 178
|
|
8741
|
-
}
|
|
8742
|
-
}, React$1.createElement('div', {
|
|
8743
|
-
className: "text",
|
|
8744
|
-
key: tab.id,
|
|
8745
|
-
dangerouslySetInnerHTML: {
|
|
8746
|
-
__html: this.parsedText(tab.text)
|
|
8747
|
-
},
|
|
8748
|
-
__self: this,
|
|
8749
|
-
__source: {
|
|
8750
|
-
fileName: _jsxFileName,
|
|
8751
|
-
lineNumber: 179
|
|
8752
|
-
}
|
|
8753
|
-
})))))) : React$1.createElement('div', {
|
|
8754
|
-
className: classNames(classes.root, 'passages'),
|
|
8755
|
-
__self: this,
|
|
8756
|
-
__source: {
|
|
8757
|
-
fileName: _jsxFileName,
|
|
8758
|
-
lineNumber: 186
|
|
8759
|
-
}
|
|
8760
|
-
}, React$1.createElement(Tabs, {
|
|
8761
|
-
classes: {
|
|
8762
|
-
root: classes.stickyTabs,
|
|
8763
|
-
flexContainer: classes.buttonContainer
|
|
8764
|
-
},
|
|
8765
|
-
value: activeTab,
|
|
8766
|
-
onChange: this.handleChange,
|
|
8767
|
-
__self: this,
|
|
8768
|
-
__source: {
|
|
8769
|
-
fileName: _jsxFileName,
|
|
8770
|
-
lineNumber: 187
|
|
8771
|
-
}
|
|
8772
|
-
}, tabs.map(tab => React$1.createElement(Tab, {
|
|
8773
|
-
className: classes.tab,
|
|
8774
|
-
key: tab.id,
|
|
8775
|
-
id: `button-${tab.id}`,
|
|
8776
|
-
label: React$1.createElement(Purpose, {
|
|
8777
|
-
purpose: "passage-title",
|
|
8778
|
-
__self: this,
|
|
8779
|
-
__source: {
|
|
8780
|
-
fileName: _jsxFileName,
|
|
8781
|
-
lineNumber: 201
|
|
8782
|
-
}
|
|
8783
|
-
}, React$1.createElement('span', {
|
|
8784
|
-
dangerouslySetInnerHTML: {
|
|
8785
|
-
__html: this.parsedText(tab.title)
|
|
8786
|
-
},
|
|
8787
|
-
__self: this,
|
|
8788
|
-
__source: {
|
|
8789
|
-
fileName: _jsxFileName,
|
|
8790
|
-
lineNumber: 202
|
|
8791
|
-
}
|
|
8792
|
-
})),
|
|
8793
|
-
value: tab.id,
|
|
8794
|
-
tabIndex: activeTab === tab.id ? 0 : -1,
|
|
8795
|
-
'aria-controls': `tabpanel-${tab.id}`,
|
|
8796
|
-
'aria-selected': activeTab === tab.id,
|
|
8797
|
-
onFocus: () => this.handleChange(null, tab.id),
|
|
8798
|
-
onKeyDown: event => this.handleKeyDown(event, tab.id),
|
|
8799
|
-
__self: this,
|
|
8800
|
-
__source: {
|
|
8801
|
-
fileName: _jsxFileName,
|
|
8802
|
-
lineNumber: 196
|
|
8803
|
-
}
|
|
8804
|
-
}))), tabs.map(tab => activeTab === tab.id ? React$1.createElement('div', {
|
|
8805
|
-
className: classes.tabContainer,
|
|
8806
|
-
key: tab.id,
|
|
8807
|
-
id: `tabpanel-${tab.id}`,
|
|
8808
|
-
role: "tabpanel",
|
|
8809
|
-
'aria-labelledby': `button-${tab.id}`,
|
|
8810
|
-
__self: this,
|
|
8811
|
-
__source: {
|
|
8812
|
-
fileName: _jsxFileName,
|
|
8813
|
-
lineNumber: 217
|
|
8814
|
-
}
|
|
8815
|
-
}, this.renderInstructions(showTeacherInstructions, tab.teacherInstructions), React$1.createElement(Purpose, {
|
|
8816
|
-
purpose: "passage-text",
|
|
8817
|
-
__self: this,
|
|
8818
|
-
__source: {
|
|
8819
|
-
fileName: _jsxFileName,
|
|
8820
|
-
lineNumber: 226
|
|
8821
|
-
}
|
|
8822
|
-
}, React$1.createElement('div', {
|
|
8823
|
-
key: tab.id,
|
|
8824
|
-
dangerouslySetInnerHTML: {
|
|
8825
|
-
__html: this.parsedText(tab.text)
|
|
8826
|
-
},
|
|
8827
|
-
__self: this,
|
|
8828
|
-
__source: {
|
|
8829
|
-
fileName: _jsxFileName,
|
|
8830
|
-
lineNumber: 227
|
|
8831
|
-
}
|
|
8832
|
-
}))) : null));
|
|
8833
|
-
} else if (tabs && tabs[0]) {
|
|
8834
|
-
return React$1.createElement(React$1.Fragment, null, this.renderInstructions(showTeacherInstructions, tabs[0].teacherInstructions, disabledTabs), React$1.createElement('div', {
|
|
8835
|
-
className: classNames(classes.root, classes.tabContainer, classes.breakSpaces, 'passage'),
|
|
8836
|
-
__self: this,
|
|
8837
|
-
__source: {
|
|
8838
|
-
fileName: _jsxFileName,
|
|
8839
|
-
lineNumber: 238
|
|
8840
|
-
}
|
|
8841
|
-
}, React$1.createElement('div', {
|
|
8842
|
-
className: "text",
|
|
8843
|
-
dangerouslySetInnerHTML: {
|
|
8844
|
-
__html: this.parsedText(tabs[0].text)
|
|
8845
|
-
},
|
|
8846
|
-
__self: this,
|
|
8847
|
-
__source: {
|
|
8848
|
-
fileName: _jsxFileName,
|
|
8849
|
-
lineNumber: 239
|
|
8816
|
+
lineNumber: 218
|
|
8850
8817
|
}
|
|
8851
|
-
})
|
|
8852
|
-
|
|
8818
|
+
}),
|
|
8819
|
+
value: tab.id,
|
|
8820
|
+
tabIndex: activeTab === tab.id ? 0 : -1,
|
|
8821
|
+
'aria-controls': `tabpanel-${tab.id}`,
|
|
8822
|
+
'aria-selected': activeTab === tab.id,
|
|
8823
|
+
onFocus: () => this.handleChange(null, tab.id),
|
|
8824
|
+
onKeyDown: event => this.handleKeyDown(event, tab.id),
|
|
8825
|
+
__self: this,
|
|
8826
|
+
__source: {
|
|
8827
|
+
fileName: _jsxFileName,
|
|
8828
|
+
lineNumber: 214
|
|
8829
|
+
}
|
|
8830
|
+
}))), selectedTab ? this.renderTab(selectedTab, showTeacherInstructions, disabledTabs) : null));
|
|
8853
8831
|
}
|
|
8854
8832
|
}
|
|
8855
8833
|
StimulusTabs.propTypes = {
|
|
@@ -8857,6 +8835,8 @@ StimulusTabs.propTypes = {
|
|
|
8857
8835
|
tabs: PropTypes.arrayOf(PropTypes.shape({
|
|
8858
8836
|
id: PropTypes.number.isRequired,
|
|
8859
8837
|
title: PropTypes.string.isRequired,
|
|
8838
|
+
subtitle: PropTypes.string,
|
|
8839
|
+
author: PropTypes.string,
|
|
8860
8840
|
text: PropTypes.string.isRequired,
|
|
8861
8841
|
teacherInstructions: PropTypes.string
|
|
8862
8842
|
}).isRequired).isRequired,
|
|
@@ -8870,15 +8850,15 @@ const {debounce: debounce} = _dll_lodash;
|
|
|
8870
8850
|
const debug = _dll_debug;
|
|
8871
8851
|
const log = debug('pie-element:passage:print');
|
|
8872
8852
|
const preparePrintPassage = (model, opts) => {
|
|
8873
|
-
const
|
|
8874
|
-
return model.passages.map((passage, index) => {
|
|
8875
|
-
|
|
8876
|
-
|
|
8877
|
-
|
|
8878
|
-
|
|
8879
|
-
|
|
8880
|
-
|
|
8881
|
-
});
|
|
8853
|
+
const isInstructor = opts.role === 'instructor';
|
|
8854
|
+
return model.passages.map((passage, index) => ({
|
|
8855
|
+
id: index,
|
|
8856
|
+
title: passage.title,
|
|
8857
|
+
subtitle: passage.subtitle,
|
|
8858
|
+
author: passage.author,
|
|
8859
|
+
text: passage.text,
|
|
8860
|
+
teacherInstructions: isInstructor && passage.teacherInstructions
|
|
8861
|
+
}));
|
|
8882
8862
|
};
|
|
8883
8863
|
class PassagePrint extends HTMLElement {
|
|
8884
8864
|
constructor() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/passage",
|
|
3
|
-
"version": "2.13.1-next.
|
|
3
|
+
"version": "2.13.1-next.5+13679356e",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"react": "^16.8.1",
|
|
18
18
|
"react-dom": "^16.8.1"
|
|
19
19
|
},
|
|
20
|
-
"gitHead": "
|
|
20
|
+
"gitHead": "13679356ec1bc148cb4629364e415bb60cd77ec3",
|
|
21
21
|
"scripts": {
|
|
22
22
|
"postpublish": "../../scripts/postpublish"
|
|
23
23
|
},
|