@pie-element/passage 1.6.4-ps.4 → 1.6.6
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 +16 -0
- package/LICENSE.md +5 -0
- package/lib/index.js +1 -1
- package/lib/print.js +99 -0
- package/lib/print.js.map +1 -0
- package/lib/stimulus-tabs.js +53 -23
- package/lib/stimulus-tabs.js.map +1 -1
- package/package.json +4 -4
- package/module/demo.js +0 -63
- package/module/element.js +0 -325
- package/module/index.html +0 -21
- package/module/manifest.json +0 -10
- package/module/print-demo.js +0 -92
- package/module/print.html +0 -18
- package/module/print.js +0 -292
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,22 @@
|
|
|
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
|
+
## [1.6.6](https://github.com/pie-framework/pie-elements/compare/@pie-element/passage@1.6.5...@pie-element/passage@1.6.6) (2021-11-01)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @pie-element/passage
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [1.6.5](https://github.com/pie-framework/pie-elements/compare/@pie-element/passage@1.6.4...@pie-element/passage@1.6.5) (2021-09-01)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @pie-element/passage
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
6
22
|
## [1.6.4](https://github.com/pie-framework/pie-elements/compare/@pie-element/passage@1.6.3...@pie-element/passage@1.6.4) (2021-08-05)
|
|
7
23
|
|
|
8
24
|
**Note:** Version bump only for package @pie-element/passage
|
package/LICENSE.md
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
Copyright 2019 CoreSpring Inc
|
|
2
|
+
|
|
3
|
+
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
|
|
4
|
+
|
|
5
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
package/lib/index.js
CHANGED
|
@@ -29,7 +29,7 @@ var _stimulusTabs = _interopRequireDefault(require("./stimulus-tabs"));
|
|
|
29
29
|
|
|
30
30
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
31
31
|
|
|
32
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try {
|
|
32
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
33
33
|
|
|
34
34
|
var PiePassage = /*#__PURE__*/function (_HTMLElement) {
|
|
35
35
|
(0, _inherits2["default"])(PiePassage, _HTMLElement);
|
package/lib/print.js
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
|
|
10
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
+
|
|
12
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
+
|
|
14
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
15
|
+
|
|
16
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
17
|
+
|
|
18
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
19
|
+
|
|
20
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
21
|
+
|
|
22
|
+
var _wrapNativeSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/wrapNativeSuper"));
|
|
23
|
+
|
|
24
|
+
var _react = _interopRequireDefault(require("react"));
|
|
25
|
+
|
|
26
|
+
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
27
|
+
|
|
28
|
+
var _debounce = _interopRequireDefault(require("lodash/debounce"));
|
|
29
|
+
|
|
30
|
+
var _stimulusTabs = _interopRequireDefault(require("./stimulus-tabs"));
|
|
31
|
+
|
|
32
|
+
var _debug = _interopRequireDefault(require("debug"));
|
|
33
|
+
|
|
34
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
35
|
+
|
|
36
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
37
|
+
|
|
38
|
+
var log = (0, _debug["default"])('pie-element:passage:print');
|
|
39
|
+
|
|
40
|
+
var preparePrintPassage = function preparePrintPassage(model) {
|
|
41
|
+
return model.passages.map(function (passage, index) {
|
|
42
|
+
return {
|
|
43
|
+
id: index,
|
|
44
|
+
title: passage.title,
|
|
45
|
+
text: passage.text
|
|
46
|
+
};
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
var PassagePrint = /*#__PURE__*/function (_HTMLElement) {
|
|
51
|
+
(0, _inherits2["default"])(PassagePrint, _HTMLElement);
|
|
52
|
+
|
|
53
|
+
var _super = _createSuper(PassagePrint);
|
|
54
|
+
|
|
55
|
+
function PassagePrint() {
|
|
56
|
+
var _this;
|
|
57
|
+
|
|
58
|
+
(0, _classCallCheck2["default"])(this, PassagePrint);
|
|
59
|
+
_this = _super.call(this);
|
|
60
|
+
_this._model = null;
|
|
61
|
+
_this._session = [];
|
|
62
|
+
_this._rerender = (0, _debounce["default"])(function () {
|
|
63
|
+
if (_this._model && _this._session) {
|
|
64
|
+
if (_this._model.passages && _this._model.passages.length > 0) {
|
|
65
|
+
var printPassage = preparePrintPassage(_this._model);
|
|
66
|
+
|
|
67
|
+
var element = /*#__PURE__*/_react["default"].createElement(_stimulusTabs["default"], {
|
|
68
|
+
tabs: printPassage,
|
|
69
|
+
disabledTabs: true
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
_reactDom["default"].render(element, (0, _assertThisInitialized2["default"])(_this));
|
|
73
|
+
}
|
|
74
|
+
} else {
|
|
75
|
+
log('skip');
|
|
76
|
+
}
|
|
77
|
+
}, 50, {
|
|
78
|
+
leading: false,
|
|
79
|
+
trailing: true
|
|
80
|
+
});
|
|
81
|
+
return _this;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
(0, _createClass2["default"])(PassagePrint, [{
|
|
85
|
+
key: "model",
|
|
86
|
+
set: function set(s) {
|
|
87
|
+
this._model = s;
|
|
88
|
+
|
|
89
|
+
this._rerender();
|
|
90
|
+
}
|
|
91
|
+
}, {
|
|
92
|
+
key: "connectedCallback",
|
|
93
|
+
value: function connectedCallback() {}
|
|
94
|
+
}]);
|
|
95
|
+
return PassagePrint;
|
|
96
|
+
}( /*#__PURE__*/(0, _wrapNativeSuper2["default"])(HTMLElement));
|
|
97
|
+
|
|
98
|
+
exports["default"] = PassagePrint;
|
|
99
|
+
//# sourceMappingURL=print.js.map
|
package/lib/print.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/print.js"],"names":["log","preparePrintPassage","model","passages","map","passage","index","id","title","text","PassagePrint","_model","_session","_rerender","length","printPassage","element","React","createElement","StimulusTabs","tabs","disabledTabs","ReactDOM","render","leading","trailing","s","HTMLElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,2BAAN,CAAZ;;AAEA,IAAMC,mBAAmB,GAAG,SAAtBA,mBAAsB,CAAAC,KAAK;AAAA,SAC/BA,KAAK,CAACC,QAAN,CAAeC,GAAf,CAAmB,UAACC,OAAD,EAAUC,KAAV,EAAoB;AACrC,WAAO;AACLC,MAAAA,EAAE,EAAED,KADC;AAELE,MAAAA,KAAK,EAAEH,OAAO,CAACG,KAFV;AAGLC,MAAAA,IAAI,EAAEJ,OAAO,CAACI;AAHT,KAAP;AAKD,GAND,CAD+B;AAAA,CAAjC;;IASqBC,Y;;;;;AACnB,0BAAc;AAAA;;AAAA;AACZ;AACA,UAAKC,MAAL,GAAc,IAAd;AACA,UAAKC,QAAL,GAAgB,EAAhB;AAEA,UAAKC,SAAL,GAAiB,0BACf,YAAM;AACJ,UAAI,MAAKF,MAAL,IAAe,MAAKC,QAAxB,EAAkC;AAChC,YAAI,MAAKD,MAAL,CAAYR,QAAZ,IAAwB,MAAKQ,MAAL,CAAYR,QAAZ,CAAqBW,MAArB,GAA8B,CAA1D,EAA6D;AAC3D,cAAMC,YAAY,GAAGd,mBAAmB,CAAC,MAAKU,MAAN,CAAxC;;AAEA,cAAMK,OAAO,gBAAGC,kBAAMC,aAAN,CAAoBC,wBAApB,EAAkC;AAAEC,YAAAA,IAAI,EAAEL,YAAR;AAAsBM,YAAAA,YAAY,EAAE;AAApC,WAAlC,CAAhB;;AAEAC,+BAASC,MAAT,CAAgBP,OAAhB;AACD;AACF,OARD,MAQO;AACLhB,QAAAA,GAAG,CAAC,MAAD,CAAH;AACD;AACF,KAbc,EAcf,EAde,EAef;AAAEwB,MAAAA,OAAO,EAAE,KAAX;AAAkBC,MAAAA,QAAQ,EAAE;AAA5B,KAfe,CAAjB;AALY;AAsBb;;;;SAED,aAAUC,CAAV,EAAa;AACX,WAAKf,MAAL,GAAce,CAAd;;AACA,WAAKb,SAAL;AACD;;;WAED,6BAAoB,CAAE;;;kDA9BkBc,W","sourcesContent":["import React from 'react';\nimport ReactDOM from 'react-dom';\nimport debounce from 'lodash/debounce';\nimport StimulusTabs from './stimulus-tabs';\nimport debug from 'debug';\n\nconst log = debug('pie-element:passage:print');\n\nconst preparePrintPassage = model =>\n model.passages.map((passage, index) => {\n return {\n id: index,\n title: passage.title,\n text: passage.text,\n };\n });\n\nexport default class PassagePrint extends HTMLElement {\n constructor() {\n super();\n this._model = null;\n this._session = [];\n\n this._rerender = debounce(\n () => {\n if (this._model && this._session) {\n if (this._model.passages && this._model.passages.length > 0) {\n const printPassage = preparePrintPassage(this._model);\n\n const element = React.createElement(StimulusTabs, { tabs: printPassage, disabledTabs: true });\n\n ReactDOM.render(element, this);\n }\n } else {\n log('skip');\n }\n },\n 50,\n { leading: false, trailing: true }\n );\n }\n\n set model(s) {\n this._model = s;\n this._rerender();\n }\n\n connectedCallback() {}\n}\n"],"file":"print.js"}
|
package/lib/stimulus-tabs.js
CHANGED
|
@@ -35,32 +35,36 @@ var _Typography = _interopRequireDefault(require("@material-ui/core/Typography")
|
|
|
35
35
|
|
|
36
36
|
var _renderUi = require("@pie-lib/render-ui");
|
|
37
37
|
|
|
38
|
-
var
|
|
38
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
39
39
|
|
|
40
40
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
41
41
|
|
|
42
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try {
|
|
42
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
43
43
|
|
|
44
44
|
var styles = function styles() {
|
|
45
|
-
return
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
45
|
+
return {
|
|
46
|
+
root: {
|
|
47
|
+
flexGrow: 1,
|
|
48
|
+
backgroundColor: _renderUi.color.background(),
|
|
49
|
+
color: _renderUi.color.text()
|
|
50
|
+
},
|
|
51
|
+
tab: {
|
|
52
|
+
fontSize: '0.8125em'
|
|
53
|
+
},
|
|
54
|
+
stickyTabs: {
|
|
55
|
+
background: _renderUi.color.background(),
|
|
56
|
+
paddingBottom: '20px',
|
|
57
|
+
position: 'sticky',
|
|
58
|
+
top: 0
|
|
59
|
+
},
|
|
60
|
+
title: {
|
|
61
|
+
textTransform: 'uppercase',
|
|
62
|
+
padding: '6px 24px',
|
|
63
|
+
borderBottom: "2px solid ".concat(_renderUi.color.secondary()),
|
|
64
|
+
width: 'fit-content',
|
|
65
|
+
marginBottom: '6px'
|
|
62
66
|
}
|
|
63
|
-
|
|
67
|
+
};
|
|
64
68
|
};
|
|
65
69
|
|
|
66
70
|
function TabContainer(props) {
|
|
@@ -128,11 +132,34 @@ var StimulusTabs = /*#__PURE__*/function (_React$Component) {
|
|
|
128
132
|
|
|
129
133
|
var _this$props = this.props,
|
|
130
134
|
classes = _this$props.classes,
|
|
131
|
-
tabs = _this$props.tabs
|
|
135
|
+
tabs = _this$props.tabs,
|
|
136
|
+
disabledTabs = _this$props.disabledTabs;
|
|
132
137
|
var activeTab = this.state.activeTab;
|
|
133
138
|
|
|
134
139
|
if (tabs && tabs.length > 1) {
|
|
135
|
-
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
140
|
+
return disabledTabs ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
141
|
+
className: "passages"
|
|
142
|
+
}, tabs.map(function (tab) {
|
|
143
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
144
|
+
key: tab.id,
|
|
145
|
+
className: "passage-".concat(tab.id)
|
|
146
|
+
}, /*#__PURE__*/_react["default"].createElement(TabContainer, {
|
|
147
|
+
multiple: true
|
|
148
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
149
|
+
className: (0, _classnames["default"])(classes.title, 'title'),
|
|
150
|
+
dangerouslySetInnerHTML: {
|
|
151
|
+
__html: _this2.parsedText(tab.title)
|
|
152
|
+
}
|
|
153
|
+
}), /*#__PURE__*/_react["default"].createElement(_renderUi.Purpose, {
|
|
154
|
+
purpose: "passage-text"
|
|
155
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
156
|
+
className: "text",
|
|
157
|
+
key: tab.id,
|
|
158
|
+
dangerouslySetInnerHTML: {
|
|
159
|
+
__html: _this2.parsedText(tab.text)
|
|
160
|
+
}
|
|
161
|
+
}))));
|
|
162
|
+
})) : /*#__PURE__*/_react["default"].createElement("div", {
|
|
136
163
|
className: classes.root
|
|
137
164
|
}, /*#__PURE__*/_react["default"].createElement(_Tabs["default"], {
|
|
138
165
|
classes: {
|
|
@@ -168,10 +195,12 @@ var StimulusTabs = /*#__PURE__*/function (_React$Component) {
|
|
|
168
195
|
}));
|
|
169
196
|
} else if (tabs && tabs[0]) {
|
|
170
197
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
198
|
+
className: "passage",
|
|
171
199
|
style: {
|
|
172
200
|
whiteSpace: 'break-spaces'
|
|
173
201
|
}
|
|
174
202
|
}, /*#__PURE__*/_react["default"].createElement(TabContainer, null, /*#__PURE__*/_react["default"].createElement("div", {
|
|
203
|
+
className: "text",
|
|
175
204
|
dangerouslySetInnerHTML: {
|
|
176
205
|
__html: this.parsedText(tabs[0].text)
|
|
177
206
|
}
|
|
@@ -188,7 +217,8 @@ StimulusTabs.propTypes = {
|
|
|
188
217
|
id: _propTypes["default"].number.isRequired,
|
|
189
218
|
title: _propTypes["default"].string.isRequired,
|
|
190
219
|
text: _propTypes["default"].string.isRequired
|
|
191
|
-
}).isRequired).isRequired
|
|
220
|
+
}).isRequired).isRequired,
|
|
221
|
+
disabledTabs: _propTypes["default"].bool
|
|
192
222
|
};
|
|
193
223
|
|
|
194
224
|
var _default = (0, _styles.withStyles)(styles)(StimulusTabs);
|
package/lib/stimulus-tabs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/stimulus-tabs.jsx"],"names":["styles","root","flexGrow","backgroundColor","color","background","text","tab","fontSize","stickyTabs","paddingBottom","position","top","
|
|
1
|
+
{"version":3,"sources":["../src/stimulus-tabs.jsx"],"names":["styles","root","flexGrow","backgroundColor","color","background","text","tab","fontSize","stickyTabs","paddingBottom","position","top","title","textTransform","padding","borderBottom","secondary","width","marginBottom","TabContainer","props","multiple","children","propTypes","PropTypes","node","isRequired","bool","StimulusTabs","activeTab","event","setState","setTimeout","tabChangeEvent","CustomEvent","detail","window","dispatchEvent","replace","classes","tabs","disabledTabs","state","length","map","id","__html","parsedText","handleChange","whiteSpace","React","Component","object","arrayOf","shape","number","string"],"mappings":"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","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport Tabs from '@material-ui/core/Tabs';\nimport Tab from '@material-ui/core/Tab';\nimport { withStyles } from '@material-ui/core/styles';\nimport Typography from '@material-ui/core/Typography';\nimport { color, Purpose } from '@pie-lib/render-ui';\nimport classNames from 'classnames';\n\nconst styles = (/*theme*/) => ({\n root: {\n flexGrow: 1,\n backgroundColor: color.background(),\n color: color.text(),\n },\n tab: {\n fontSize: '0.8125em',\n },\n stickyTabs: {\n background: color.background(),\n paddingBottom: '20px',\n position: 'sticky',\n top: 0,\n },\n title: {\n textTransform: 'uppercase',\n padding: '6px 24px',\n borderBottom: `2px solid ${color.secondary()}`,\n width: 'fit-content',\n marginBottom: '6px'\n }\n});\n\nfunction TabContainer(props) {\n const padding = props.multiple ? '0 24px 24px 24px' : '24px';\n\n return (\n <Typography\n component=\"div\"\n style={{\n padding,\n fontSize: '0.875em',\n backgroundColor: color.background(),\n color: color.text(),\n }}\n >\n {props.children}\n </Typography>\n );\n}\n\nTabContainer.propTypes = {\n children: PropTypes.node.isRequired,\n multiple: PropTypes.bool,\n};\n\nclass StimulusTabs extends React.Component {\n state = {\n activeTab: 0,\n };\n\n handleChange = (event, activeTab) => {\n this.setState(() => ({ activeTab }));\n setTimeout(() => {\n const tabChangeEvent = new CustomEvent('pie-ui-passage-tabChanged', {\n detail: {\n tab: activeTab,\n },\n });\n\n window.dispatchEvent(tabChangeEvent);\n });\n };\n\n parsedText = (text) => text.replace(/(<br\\/>\\n)/g, '<br/>');\n\n render() {\n const { classes, tabs, disabledTabs } = this.props;\n const { activeTab } = this.state;\n\n if (tabs && tabs.length > 1) {\n return disabledTabs ? (\n <div className=\"passages\">\n {tabs.map(tab =>\n <div key={tab.id} className={`passage-${tab.id}`}>\n <TabContainer multiple >\n <div\n className={classNames(classes.title, 'title')}\n dangerouslySetInnerHTML={{ __html: this.parsedText(tab.title) }}\n />\n <Purpose purpose=\"passage-text\">\n <div\n className=\"text\"\n key={tab.id}\n dangerouslySetInnerHTML={{ __html: this.parsedText(tab.text) }}\n />\n </Purpose>\n </TabContainer>\n </div>)}\n </div>\n ) : (\n <div className={classes.root}>\n <Tabs\n classes={{\n root: classes.stickyTabs,\n }}\n value={activeTab}\n onChange={this.handleChange}\n >\n {tabs.map((tab) => (\n <Tab\n className={classes.tab}\n key={tab.id}\n label={\n <Purpose purpose=\"passage-title\">\n <span\n dangerouslySetInnerHTML={{ __html: this.parsedText(tab.title) }}\n />\n </Purpose>\n }\n value={tab.id}\n />\n ))}\n </Tabs>\n {tabs.map((tab) =>\n activeTab === tab.id ? (\n <TabContainer multiple key={tab.id}>\n <Purpose purpose=\"passage-text\">\n <div\n key={tab.id}\n dangerouslySetInnerHTML={{ __html: this.parsedText(tab.text) }}\n />\n </Purpose>\n </TabContainer>\n\n ) : null\n )}\n </div>\n );\n\n } else if (tabs && tabs[0]) {\n return (\n <div className=\"passage\" style={{ whiteSpace: 'break-spaces' }} >\n <TabContainer>\n <div className=\"text\" dangerouslySetInnerHTML={{ __html: this.parsedText(tabs[0].text) }} />\n </TabContainer>\n </div>\n );\n }\n }\n}\n\nStimulusTabs.propTypes = {\n classes: PropTypes.object.isRequired,\n tabs: PropTypes.arrayOf(\n PropTypes.shape({\n id: PropTypes.number.isRequired,\n title: PropTypes.string.isRequired,\n text: PropTypes.string.isRequired,\n }).isRequired\n ).isRequired,\n disabledTabs: PropTypes.bool\n};\n\nexport default withStyles(styles)(StimulusTabs);\n"],"file":"stimulus-tabs.js"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/passage",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.6",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -12,12 +12,12 @@
|
|
|
12
12
|
"@material-ui/core": "^3.9.2",
|
|
13
13
|
"@pie-framework/pie-player-events": "^0.1.0",
|
|
14
14
|
"@pie-lib/render-ui": "^4.12.0",
|
|
15
|
+
"classnames": "^2.2.5",
|
|
15
16
|
"prop-types": "^15.6.1",
|
|
16
17
|
"react": "^16.8.1",
|
|
17
|
-
"react-dom": "^16.8.1"
|
|
18
|
-
"classnames": "^2.2.5"
|
|
18
|
+
"react-dom": "^16.8.1"
|
|
19
19
|
},
|
|
20
|
-
"gitHead": "
|
|
20
|
+
"gitHead": "39691eb79f1f5ece91c831add33b05871b20828b",
|
|
21
21
|
"scripts": {
|
|
22
22
|
"postpublish": "../../scripts/postpublish"
|
|
23
23
|
},
|
package/module/demo.js
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import Element from './element.js';
|
|
2
|
-
|
|
3
|
-
var generate = {};
|
|
4
|
-
|
|
5
|
-
generate.model = (id, element) => ({
|
|
6
|
-
id,
|
|
7
|
-
element,
|
|
8
|
-
passages: [
|
|
9
|
-
{
|
|
10
|
-
title: 'Hope Is the Thing with Feathers',
|
|
11
|
-
text: '<p><font style="visibility:hidden">00000</font>Hope is the thing with feathers<br /><font style="visibility:hidden">00000</font>That perches in the soul,<br /><font style="visibility:hidden">00000</font>And sings the tune without the words,<br /><font style="visibility:hidden">00000</font>And never stops at all,</p><p>5<font style="visibility:hidden">0000</font>And sweetest in the gale is heard;<br /><font style="visibility:hidden">00000</font>And sore must be the storm<br /><font style="visibility:hidden">00000</font>That could abash the little bird<br /><font style="visibility:hidden">00000</font>That kept so many warm.</p><p><font style="visibility:hidden">00000</font>I’ve heard it in the chillest land,<br />10<font style="visibility:hidden">000</font>And on the strangest sea;<br /><font style="visibility:hidden">00000</font>Yet, never, in extremity,<br /><font style="visibility:hidden">00000</font>It asked a crumb of me.</p><p><span class="no-number">"Hope is the Thing With Feathers" by Emily Dickinson, from <em>The Complete Poems of Emily Dickinson</em>. In the public domain.</span></p>'
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
title: 'Ineskeen Road, July Evening',
|
|
15
|
-
text: `The bicycles go by in twos and threes -<br/>
|
|
16
|
-
There's a dance in Billy Brennan's barn tonight,<br/>
|
|
17
|
-
And there's the half-talk code of mysteries<br/>
|
|
18
|
-
And the wink-and-elbow language of delight.<br/>
|
|
19
|
-
Half-past eight and there is not a spot<br/>
|
|
20
|
-
Upon a mile of road, no shadow thrown<br/>
|
|
21
|
-
That might turn out a man or woman, not<br/>
|
|
22
|
-
A footfall tapping secrecies of stone. <br/>
|
|
23
|
-
<p/>
|
|
24
|
-
I have what every poet hates in spite<br/>
|
|
25
|
-
Of all the solemn talk of contemplation.<br/>
|
|
26
|
-
Oh, Alexander Selkirk knew the plight<br/>
|
|
27
|
-
Of being king and government and nation.<br/>
|
|
28
|
-
A road, a mile of kingdom. I am king<br/>
|
|
29
|
-
Of banks and stones and every blooming thing.<br/>
|
|
30
|
-
`
|
|
31
|
-
}
|
|
32
|
-
]
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
const { model } = generate;
|
|
36
|
-
|
|
37
|
-
var config = {
|
|
38
|
-
elements: {
|
|
39
|
-
'passage-element': '../..'
|
|
40
|
-
},
|
|
41
|
-
models: [model('1', 'passage-element')]
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
// configure
|
|
45
|
-
class Configure extends HTMLElement{}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
// controller
|
|
49
|
-
const controller = {
|
|
50
|
-
model: (q) => Promise.resolve(q),
|
|
51
|
-
outcome: (q) => Promise.resolve(q)
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
//Note: demo-el is a custom element loaded in the markup.
|
|
56
|
-
customElements.whenDefined("demo-el").then(() => {
|
|
57
|
-
config.models.forEach((m) => {
|
|
58
|
-
const de = document.createElement("demo-el");
|
|
59
|
-
document.body.appendChild(de);
|
|
60
|
-
de.def = { tagName: m.element, Element, Configure, controller };
|
|
61
|
-
de.model = m;
|
|
62
|
-
});
|
|
63
|
-
});
|
package/module/element.js
DELETED
|
@@ -1,325 +0,0 @@
|
|
|
1
|
-
import {_dll_react, _dll_prop_types, _dll_material_ui__core, _dll_material_ui__core_styles, _dll_pie_lib__render_ui, _dll_classnames, _dll_react_dom} from "../../../@pie-lib/shared-module@^1.2.9/module/index.js";
|
|
2
|
-
var lib = {};
|
|
3
|
-
Object.defineProperty(lib, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
class ModelSetEvent extends CustomEvent {
|
|
7
|
-
constructor(component, complete, hasModel) {
|
|
8
|
-
super(ModelSetEvent.TYPE, {
|
|
9
|
-
bubbles: true,
|
|
10
|
-
composed: true,
|
|
11
|
-
detail: {
|
|
12
|
-
complete,
|
|
13
|
-
component,
|
|
14
|
-
hasModel
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
this.component = component;
|
|
18
|
-
this.complete = complete;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
ModelSetEvent.TYPE = 'model-set';
|
|
22
|
-
var ModelSetEvent_1 = lib.ModelSetEvent = ModelSetEvent;
|
|
23
|
-
class SessionChangedEvent extends CustomEvent {
|
|
24
|
-
constructor(component, complete) {
|
|
25
|
-
super(SessionChangedEvent.TYPE, {
|
|
26
|
-
bubbles: true,
|
|
27
|
-
composed: true,
|
|
28
|
-
detail: {
|
|
29
|
-
complete,
|
|
30
|
-
component
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
this.component = component;
|
|
34
|
-
this.complete = complete;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
SessionChangedEvent.TYPE = 'session-changed';
|
|
38
|
-
lib.SessionChangedEvent = SessionChangedEvent;
|
|
39
|
-
const React$1 = _dll_react;
|
|
40
|
-
const PropTypes = _dll_prop_types;
|
|
41
|
-
const {Tabs: Tabs} = _dll_material_ui__core;
|
|
42
|
-
const {Tab: Tab} = _dll_material_ui__core;
|
|
43
|
-
const {Typography: Typography} = _dll_material_ui__core;
|
|
44
|
-
const {withStyles: withStyles} = _dll_material_ui__core_styles;
|
|
45
|
-
const {color: color} = _dll_pie_lib__render_ui;
|
|
46
|
-
const {Purpose: Purpose} = _dll_pie_lib__render_ui;
|
|
47
|
-
const classNames = _dll_classnames;
|
|
48
|
-
const _jsxFileName = "/home/ede/dev/github/pie-framework/pie-elements/packages/passage/src/stimulus-tabs.jsx";
|
|
49
|
-
const styles = () => ({
|
|
50
|
-
root: {
|
|
51
|
-
flexGrow: 1,
|
|
52
|
-
backgroundColor: color.background(),
|
|
53
|
-
color: color.text()
|
|
54
|
-
},
|
|
55
|
-
tab: {
|
|
56
|
-
fontSize: '0.8125em'
|
|
57
|
-
},
|
|
58
|
-
stickyTabs: {
|
|
59
|
-
background: color.background(),
|
|
60
|
-
paddingBottom: '20px',
|
|
61
|
-
position: 'sticky',
|
|
62
|
-
top: 0
|
|
63
|
-
},
|
|
64
|
-
title: {
|
|
65
|
-
textTransform: 'uppercase',
|
|
66
|
-
padding: '6px 24px',
|
|
67
|
-
borderBottom: `2px solid ${color.secondary()}`,
|
|
68
|
-
width: 'fit-content',
|
|
69
|
-
marginBottom: '6px'
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
function TabContainer(props) {
|
|
73
|
-
const padding = props.multiple ? '0 24px 24px 24px' : '24px';
|
|
74
|
-
return React$1.createElement(Typography, {
|
|
75
|
-
component: "div",
|
|
76
|
-
style: {
|
|
77
|
-
padding,
|
|
78
|
-
fontSize: '0.875em',
|
|
79
|
-
backgroundColor: color.background(),
|
|
80
|
-
color: color.text()
|
|
81
|
-
},
|
|
82
|
-
__self: this,
|
|
83
|
-
__source: {
|
|
84
|
-
fileName: _jsxFileName,
|
|
85
|
-
lineNumber: 38
|
|
86
|
-
}
|
|
87
|
-
}, props.children);
|
|
88
|
-
}
|
|
89
|
-
TabContainer.propTypes = {
|
|
90
|
-
children: PropTypes.node.isRequired,
|
|
91
|
-
multiple: PropTypes.bool
|
|
92
|
-
};
|
|
93
|
-
class StimulusTabs extends React$1.Component {
|
|
94
|
-
constructor(...args) {
|
|
95
|
-
super(...args);
|
|
96
|
-
StimulusTabs.prototype.__init.call(this);
|
|
97
|
-
StimulusTabs.prototype.__init2.call(this);
|
|
98
|
-
StimulusTabs.prototype.__init3.call(this);
|
|
99
|
-
}
|
|
100
|
-
__init() {
|
|
101
|
-
this.state = {
|
|
102
|
-
activeTab: 0
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
__init2() {
|
|
106
|
-
this.handleChange = (event, activeTab) => {
|
|
107
|
-
this.setState(() => ({
|
|
108
|
-
activeTab
|
|
109
|
-
}));
|
|
110
|
-
setTimeout(() => {
|
|
111
|
-
const tabChangeEvent = new CustomEvent('pie-ui-passage-tabChanged', {
|
|
112
|
-
detail: {
|
|
113
|
-
tab: activeTab
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
window.dispatchEvent(tabChangeEvent);
|
|
117
|
-
});
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
__init3() {
|
|
121
|
-
this.parsedText = text => text.replace(/(<br\/>\n)/g, '<br/>');
|
|
122
|
-
}
|
|
123
|
-
render() {
|
|
124
|
-
const {classes, tabs, disabledTabs} = this.props;
|
|
125
|
-
const {activeTab} = this.state;
|
|
126
|
-
if (tabs && tabs.length > 1) {
|
|
127
|
-
return disabledTabs ? React$1.createElement('div', {
|
|
128
|
-
className: "passages",
|
|
129
|
-
__self: this,
|
|
130
|
-
__source: {
|
|
131
|
-
fileName: _jsxFileName,
|
|
132
|
-
lineNumber: 83
|
|
133
|
-
}
|
|
134
|
-
}, tabs.map(tab => React$1.createElement('div', {
|
|
135
|
-
key: tab.id,
|
|
136
|
-
className: `passage-${tab.id}`,
|
|
137
|
-
__self: this,
|
|
138
|
-
__source: {
|
|
139
|
-
fileName: _jsxFileName,
|
|
140
|
-
lineNumber: 85
|
|
141
|
-
}
|
|
142
|
-
}, React$1.createElement(TabContainer, {
|
|
143
|
-
multiple: true,
|
|
144
|
-
__self: this,
|
|
145
|
-
__source: {
|
|
146
|
-
fileName: _jsxFileName,
|
|
147
|
-
lineNumber: 86
|
|
148
|
-
}
|
|
149
|
-
}, React$1.createElement('div', {
|
|
150
|
-
className: classNames(classes.title, 'title'),
|
|
151
|
-
dangerouslySetInnerHTML: {
|
|
152
|
-
__html: this.parsedText(tab.title)
|
|
153
|
-
},
|
|
154
|
-
__self: this,
|
|
155
|
-
__source: {
|
|
156
|
-
fileName: _jsxFileName,
|
|
157
|
-
lineNumber: 87
|
|
158
|
-
}
|
|
159
|
-
}), React$1.createElement(Purpose, {
|
|
160
|
-
purpose: "passage-text",
|
|
161
|
-
__self: this,
|
|
162
|
-
__source: {
|
|
163
|
-
fileName: _jsxFileName,
|
|
164
|
-
lineNumber: 91
|
|
165
|
-
}
|
|
166
|
-
}, React$1.createElement('div', {
|
|
167
|
-
className: "text",
|
|
168
|
-
key: tab.id,
|
|
169
|
-
dangerouslySetInnerHTML: {
|
|
170
|
-
__html: this.parsedText(tab.text)
|
|
171
|
-
},
|
|
172
|
-
__self: this,
|
|
173
|
-
__source: {
|
|
174
|
-
fileName: _jsxFileName,
|
|
175
|
-
lineNumber: 92
|
|
176
|
-
}
|
|
177
|
-
})))))) : React$1.createElement('div', {
|
|
178
|
-
className: classes.root,
|
|
179
|
-
__self: this,
|
|
180
|
-
__source: {
|
|
181
|
-
fileName: _jsxFileName,
|
|
182
|
-
lineNumber: 102
|
|
183
|
-
}
|
|
184
|
-
}, React$1.createElement(Tabs, {
|
|
185
|
-
classes: {
|
|
186
|
-
root: classes.stickyTabs
|
|
187
|
-
},
|
|
188
|
-
value: activeTab,
|
|
189
|
-
onChange: this.handleChange,
|
|
190
|
-
__self: this,
|
|
191
|
-
__source: {
|
|
192
|
-
fileName: _jsxFileName,
|
|
193
|
-
lineNumber: 103
|
|
194
|
-
}
|
|
195
|
-
}, tabs.map(tab => React$1.createElement(Tab, {
|
|
196
|
-
className: classes.tab,
|
|
197
|
-
key: tab.id,
|
|
198
|
-
label: React$1.createElement(Purpose, {
|
|
199
|
-
purpose: "passage-title",
|
|
200
|
-
__self: this,
|
|
201
|
-
__source: {
|
|
202
|
-
fileName: _jsxFileName,
|
|
203
|
-
lineNumber: 115
|
|
204
|
-
}
|
|
205
|
-
}, React$1.createElement('span', {
|
|
206
|
-
dangerouslySetInnerHTML: {
|
|
207
|
-
__html: this.parsedText(tab.title)
|
|
208
|
-
},
|
|
209
|
-
__self: this,
|
|
210
|
-
__source: {
|
|
211
|
-
fileName: _jsxFileName,
|
|
212
|
-
lineNumber: 116
|
|
213
|
-
}
|
|
214
|
-
})),
|
|
215
|
-
value: tab.id,
|
|
216
|
-
__self: this,
|
|
217
|
-
__source: {
|
|
218
|
-
fileName: _jsxFileName,
|
|
219
|
-
lineNumber: 111
|
|
220
|
-
}
|
|
221
|
-
}))), tabs.map(tab => activeTab === tab.id ? React$1.createElement(TabContainer, {
|
|
222
|
-
multiple: true,
|
|
223
|
-
key: tab.id,
|
|
224
|
-
__self: this,
|
|
225
|
-
__source: {
|
|
226
|
-
fileName: _jsxFileName,
|
|
227
|
-
lineNumber: 127
|
|
228
|
-
}
|
|
229
|
-
}, React$1.createElement(Purpose, {
|
|
230
|
-
purpose: "passage-text",
|
|
231
|
-
__self: this,
|
|
232
|
-
__source: {
|
|
233
|
-
fileName: _jsxFileName,
|
|
234
|
-
lineNumber: 128
|
|
235
|
-
}
|
|
236
|
-
}, React$1.createElement('div', {
|
|
237
|
-
key: tab.id,
|
|
238
|
-
dangerouslySetInnerHTML: {
|
|
239
|
-
__html: this.parsedText(tab.text)
|
|
240
|
-
},
|
|
241
|
-
__self: this,
|
|
242
|
-
__source: {
|
|
243
|
-
fileName: _jsxFileName,
|
|
244
|
-
lineNumber: 129
|
|
245
|
-
}
|
|
246
|
-
}))) : null));
|
|
247
|
-
} else if (tabs && tabs[0]) {
|
|
248
|
-
return React$1.createElement('div', {
|
|
249
|
-
className: "passage",
|
|
250
|
-
style: {
|
|
251
|
-
whiteSpace: 'break-spaces'
|
|
252
|
-
},
|
|
253
|
-
__self: this,
|
|
254
|
-
__source: {
|
|
255
|
-
fileName: _jsxFileName,
|
|
256
|
-
lineNumber: 143
|
|
257
|
-
}
|
|
258
|
-
}, React$1.createElement(TabContainer, {
|
|
259
|
-
__self: this,
|
|
260
|
-
__source: {
|
|
261
|
-
fileName: _jsxFileName,
|
|
262
|
-
lineNumber: 144
|
|
263
|
-
}
|
|
264
|
-
}, React$1.createElement('div', {
|
|
265
|
-
className: "text",
|
|
266
|
-
dangerouslySetInnerHTML: {
|
|
267
|
-
__html: this.parsedText(tabs[0].text)
|
|
268
|
-
},
|
|
269
|
-
__self: this,
|
|
270
|
-
__source: {
|
|
271
|
-
fileName: _jsxFileName,
|
|
272
|
-
lineNumber: 145
|
|
273
|
-
}
|
|
274
|
-
})));
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
StimulusTabs.propTypes = {
|
|
279
|
-
classes: PropTypes.object.isRequired,
|
|
280
|
-
tabs: PropTypes.arrayOf(PropTypes.shape({
|
|
281
|
-
id: PropTypes.number.isRequired,
|
|
282
|
-
title: PropTypes.string.isRequired,
|
|
283
|
-
text: PropTypes.string.isRequired
|
|
284
|
-
}).isRequired).isRequired,
|
|
285
|
-
disabledTabs: PropTypes.bool
|
|
286
|
-
};
|
|
287
|
-
var StimulusTabs$1 = withStyles(styles)(StimulusTabs);
|
|
288
|
-
const React = _dll_react;
|
|
289
|
-
const ReactDOM = _dll_react_dom;
|
|
290
|
-
class PiePassage extends HTMLElement {
|
|
291
|
-
constructor() {
|
|
292
|
-
super();
|
|
293
|
-
this._model = {
|
|
294
|
-
passages: []
|
|
295
|
-
};
|
|
296
|
-
this._session = null;
|
|
297
|
-
}
|
|
298
|
-
set model(s) {
|
|
299
|
-
this._model = s;
|
|
300
|
-
this.dispatchEvent(new ModelSetEvent_1(this.tagName.toLowerCase(), this._session, !!this._model));
|
|
301
|
-
this._render();
|
|
302
|
-
}
|
|
303
|
-
set session(s) {
|
|
304
|
-
this._session = s;
|
|
305
|
-
}
|
|
306
|
-
connectedCallback() {
|
|
307
|
-
this._render();
|
|
308
|
-
}
|
|
309
|
-
_render() {
|
|
310
|
-
if (this._model.passages.length > 0) {
|
|
311
|
-
const passagesTabs = this._model.passages.map((passage, index) => {
|
|
312
|
-
return {
|
|
313
|
-
id: index,
|
|
314
|
-
title: passage.title,
|
|
315
|
-
text: passage.text
|
|
316
|
-
};
|
|
317
|
-
});
|
|
318
|
-
let elem = React.createElement(StimulusTabs$1, {
|
|
319
|
-
tabs: passagesTabs
|
|
320
|
-
});
|
|
321
|
-
ReactDOM.render(elem, this);
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
export {PiePassage as default};
|
package/module/index.html
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
<!doctype html>
|
|
3
|
-
<html>
|
|
4
|
-
<head>
|
|
5
|
-
<title>@pie-element/passage@1.6.4</title>
|
|
6
|
-
<script
|
|
7
|
-
type="module"
|
|
8
|
-
src="https://cdn.jsdelivr.net/npm/@pslb/demo-el@^1.0.0/dist/demo-el/demo-el.esm.js"></script>
|
|
9
|
-
|
|
10
|
-
<link
|
|
11
|
-
href="https://fonts.googleapis.com/css?family=Roboto&display=swap"
|
|
12
|
-
rel="stylesheet"
|
|
13
|
-
/>
|
|
14
|
-
<style>
|
|
15
|
-
html, body {
|
|
16
|
-
font-family: 'Roboto', sans-serif;
|
|
17
|
-
}
|
|
18
|
-
</style>
|
|
19
|
-
<script type="module" src="./demo.js"></script>
|
|
20
|
-
</head>
|
|
21
|
-
</html>
|
package/module/manifest.json
DELETED
package/module/print-demo.js
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import PrintElement from './print.js';
|
|
2
|
-
|
|
3
|
-
var generate = {};
|
|
4
|
-
|
|
5
|
-
generate.model = (id, element) => ({
|
|
6
|
-
id,
|
|
7
|
-
element,
|
|
8
|
-
passages: [
|
|
9
|
-
{
|
|
10
|
-
title: 'Hope Is the Thing with Feathers',
|
|
11
|
-
text: '<p><font style="visibility:hidden">00000</font>Hope is the thing with feathers<br /><font style="visibility:hidden">00000</font>That perches in the soul,<br /><font style="visibility:hidden">00000</font>And sings the tune without the words,<br /><font style="visibility:hidden">00000</font>And never stops at all,</p><p>5<font style="visibility:hidden">0000</font>And sweetest in the gale is heard;<br /><font style="visibility:hidden">00000</font>And sore must be the storm<br /><font style="visibility:hidden">00000</font>That could abash the little bird<br /><font style="visibility:hidden">00000</font>That kept so many warm.</p><p><font style="visibility:hidden">00000</font>I’ve heard it in the chillest land,<br />10<font style="visibility:hidden">000</font>And on the strangest sea;<br /><font style="visibility:hidden">00000</font>Yet, never, in extremity,<br /><font style="visibility:hidden">00000</font>It asked a crumb of me.</p><p><span class="no-number">"Hope is the Thing With Feathers" by Emily Dickinson, from <em>The Complete Poems of Emily Dickinson</em>. In the public domain.</span></p>'
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
title: 'Ineskeen Road, July Evening',
|
|
15
|
-
text: `The bicycles go by in twos and threes -<br/>
|
|
16
|
-
There's a dance in Billy Brennan's barn tonight,<br/>
|
|
17
|
-
And there's the half-talk code of mysteries<br/>
|
|
18
|
-
And the wink-and-elbow language of delight.<br/>
|
|
19
|
-
Half-past eight and there is not a spot<br/>
|
|
20
|
-
Upon a mile of road, no shadow thrown<br/>
|
|
21
|
-
That might turn out a man or woman, not<br/>
|
|
22
|
-
A footfall tapping secrecies of stone. <br/>
|
|
23
|
-
<p/>
|
|
24
|
-
I have what every poet hates in spite<br/>
|
|
25
|
-
Of all the solemn talk of contemplation.<br/>
|
|
26
|
-
Oh, Alexander Selkirk knew the plight<br/>
|
|
27
|
-
Of being king and government and nation.<br/>
|
|
28
|
-
A road, a mile of kingdom. I am king<br/>
|
|
29
|
-
Of banks and stones and every blooming thing.<br/>
|
|
30
|
-
`
|
|
31
|
-
}
|
|
32
|
-
]
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
const { model } = generate;
|
|
36
|
-
|
|
37
|
-
var config = {
|
|
38
|
-
elements: {
|
|
39
|
-
'passage-element': '../..'
|
|
40
|
-
},
|
|
41
|
-
models: [model('1', 'passage-element')]
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
// new init - just shows off print!
|
|
45
|
-
|
|
46
|
-
const init = async () => {
|
|
47
|
-
console.log('define the element...');
|
|
48
|
-
await Promise.all(
|
|
49
|
-
config.models.map(async (m) => {
|
|
50
|
-
try {
|
|
51
|
-
const printTag = `${m.element}-print`;
|
|
52
|
-
if (customElements.get(printTag)) {
|
|
53
|
-
return true;
|
|
54
|
-
} else {
|
|
55
|
-
customElements.define(printTag, PrintElement);
|
|
56
|
-
await customElements.whenDefined(printTag);
|
|
57
|
-
return true;
|
|
58
|
-
}
|
|
59
|
-
} catch (e) {
|
|
60
|
-
return false;
|
|
61
|
-
}
|
|
62
|
-
})
|
|
63
|
-
);
|
|
64
|
-
|
|
65
|
-
console.log('now apply the model...');
|
|
66
|
-
config.models.forEach((m) => {
|
|
67
|
-
const printTag = `${m.element}-print`;
|
|
68
|
-
const h3s = document.createElement('h3');
|
|
69
|
-
h3s.textContent = 'student mode';
|
|
70
|
-
document.body.appendChild(h3s);
|
|
71
|
-
const de = document.createElement(printTag);
|
|
72
|
-
document.body.appendChild(de);
|
|
73
|
-
de.options = {};
|
|
74
|
-
de.model = m;
|
|
75
|
-
|
|
76
|
-
const h3 = document.createElement('h3');
|
|
77
|
-
h3.textContent = 'instructor mode';
|
|
78
|
-
document.body.appendChild(h3);
|
|
79
|
-
const instr = document.createElement(printTag);
|
|
80
|
-
document.body.appendChild(instr);
|
|
81
|
-
instr.options = { mode: 'instructor' };
|
|
82
|
-
instr.model = JSON.parse(JSON.stringify(m));
|
|
83
|
-
});
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
init()
|
|
87
|
-
.then(() => {
|
|
88
|
-
console.log('ready');
|
|
89
|
-
})
|
|
90
|
-
.catch((e) => {
|
|
91
|
-
console.error(e);
|
|
92
|
-
});
|
package/module/print.html
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
<!doctype html>
|
|
3
|
-
<html>
|
|
4
|
-
<head>
|
|
5
|
-
<title>@pie-element/passage@1.6.4</title>
|
|
6
|
-
<link
|
|
7
|
-
href="https://fonts.googleapis.com/css?family=Roboto&display=swap"
|
|
8
|
-
rel="stylesheet"
|
|
9
|
-
/>
|
|
10
|
-
<style>
|
|
11
|
-
html, body {
|
|
12
|
-
font-family: 'Roboto', sans-serif;
|
|
13
|
-
}
|
|
14
|
-
</style>
|
|
15
|
-
<script type="module" src="./print-demo.js"></script>
|
|
16
|
-
</head>
|
|
17
|
-
<body></body>
|
|
18
|
-
</html>
|
package/module/print.js
DELETED
|
@@ -1,292 +0,0 @@
|
|
|
1
|
-
import {_dll_react, _dll_prop_types, _dll_material_ui__core, _dll_material_ui__core_styles, _dll_pie_lib__render_ui, _dll_classnames, _dll_react_dom, _dll_lodash, _dll_debug} from "../../../@pie-lib/shared-module@^1.2.9/module/index.js";
|
|
2
|
-
const React$1 = _dll_react;
|
|
3
|
-
const PropTypes = _dll_prop_types;
|
|
4
|
-
const {Tabs: Tabs} = _dll_material_ui__core;
|
|
5
|
-
const {Tab: Tab} = _dll_material_ui__core;
|
|
6
|
-
const {Typography: Typography} = _dll_material_ui__core;
|
|
7
|
-
const {withStyles: withStyles} = _dll_material_ui__core_styles;
|
|
8
|
-
const {color: color} = _dll_pie_lib__render_ui;
|
|
9
|
-
const {Purpose: Purpose} = _dll_pie_lib__render_ui;
|
|
10
|
-
const classNames = _dll_classnames;
|
|
11
|
-
const _jsxFileName = "/home/ede/dev/github/pie-framework/pie-elements/packages/passage/src/stimulus-tabs.jsx";
|
|
12
|
-
const styles = () => ({
|
|
13
|
-
root: {
|
|
14
|
-
flexGrow: 1,
|
|
15
|
-
backgroundColor: color.background(),
|
|
16
|
-
color: color.text()
|
|
17
|
-
},
|
|
18
|
-
tab: {
|
|
19
|
-
fontSize: '0.8125em'
|
|
20
|
-
},
|
|
21
|
-
stickyTabs: {
|
|
22
|
-
background: color.background(),
|
|
23
|
-
paddingBottom: '20px',
|
|
24
|
-
position: 'sticky',
|
|
25
|
-
top: 0
|
|
26
|
-
},
|
|
27
|
-
title: {
|
|
28
|
-
textTransform: 'uppercase',
|
|
29
|
-
padding: '6px 24px',
|
|
30
|
-
borderBottom: `2px solid ${color.secondary()}`,
|
|
31
|
-
width: 'fit-content',
|
|
32
|
-
marginBottom: '6px'
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
function TabContainer(props) {
|
|
36
|
-
const padding = props.multiple ? '0 24px 24px 24px' : '24px';
|
|
37
|
-
return React$1.createElement(Typography, {
|
|
38
|
-
component: "div",
|
|
39
|
-
style: {
|
|
40
|
-
padding,
|
|
41
|
-
fontSize: '0.875em',
|
|
42
|
-
backgroundColor: color.background(),
|
|
43
|
-
color: color.text()
|
|
44
|
-
},
|
|
45
|
-
__self: this,
|
|
46
|
-
__source: {
|
|
47
|
-
fileName: _jsxFileName,
|
|
48
|
-
lineNumber: 38
|
|
49
|
-
}
|
|
50
|
-
}, props.children);
|
|
51
|
-
}
|
|
52
|
-
TabContainer.propTypes = {
|
|
53
|
-
children: PropTypes.node.isRequired,
|
|
54
|
-
multiple: PropTypes.bool
|
|
55
|
-
};
|
|
56
|
-
class StimulusTabs extends React$1.Component {
|
|
57
|
-
constructor(...args) {
|
|
58
|
-
super(...args);
|
|
59
|
-
StimulusTabs.prototype.__init.call(this);
|
|
60
|
-
StimulusTabs.prototype.__init2.call(this);
|
|
61
|
-
StimulusTabs.prototype.__init3.call(this);
|
|
62
|
-
}
|
|
63
|
-
__init() {
|
|
64
|
-
this.state = {
|
|
65
|
-
activeTab: 0
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
__init2() {
|
|
69
|
-
this.handleChange = (event, activeTab) => {
|
|
70
|
-
this.setState(() => ({
|
|
71
|
-
activeTab
|
|
72
|
-
}));
|
|
73
|
-
setTimeout(() => {
|
|
74
|
-
const tabChangeEvent = new CustomEvent('pie-ui-passage-tabChanged', {
|
|
75
|
-
detail: {
|
|
76
|
-
tab: activeTab
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
window.dispatchEvent(tabChangeEvent);
|
|
80
|
-
});
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
__init3() {
|
|
84
|
-
this.parsedText = text => text.replace(/(<br\/>\n)/g, '<br/>');
|
|
85
|
-
}
|
|
86
|
-
render() {
|
|
87
|
-
const {classes, tabs, disabledTabs} = this.props;
|
|
88
|
-
const {activeTab} = this.state;
|
|
89
|
-
if (tabs && tabs.length > 1) {
|
|
90
|
-
return disabledTabs ? React$1.createElement('div', {
|
|
91
|
-
className: "passages",
|
|
92
|
-
__self: this,
|
|
93
|
-
__source: {
|
|
94
|
-
fileName: _jsxFileName,
|
|
95
|
-
lineNumber: 83
|
|
96
|
-
}
|
|
97
|
-
}, tabs.map(tab => React$1.createElement('div', {
|
|
98
|
-
key: tab.id,
|
|
99
|
-
className: `passage-${tab.id}`,
|
|
100
|
-
__self: this,
|
|
101
|
-
__source: {
|
|
102
|
-
fileName: _jsxFileName,
|
|
103
|
-
lineNumber: 85
|
|
104
|
-
}
|
|
105
|
-
}, React$1.createElement(TabContainer, {
|
|
106
|
-
multiple: true,
|
|
107
|
-
__self: this,
|
|
108
|
-
__source: {
|
|
109
|
-
fileName: _jsxFileName,
|
|
110
|
-
lineNumber: 86
|
|
111
|
-
}
|
|
112
|
-
}, React$1.createElement('div', {
|
|
113
|
-
className: classNames(classes.title, 'title'),
|
|
114
|
-
dangerouslySetInnerHTML: {
|
|
115
|
-
__html: this.parsedText(tab.title)
|
|
116
|
-
},
|
|
117
|
-
__self: this,
|
|
118
|
-
__source: {
|
|
119
|
-
fileName: _jsxFileName,
|
|
120
|
-
lineNumber: 87
|
|
121
|
-
}
|
|
122
|
-
}), React$1.createElement(Purpose, {
|
|
123
|
-
purpose: "passage-text",
|
|
124
|
-
__self: this,
|
|
125
|
-
__source: {
|
|
126
|
-
fileName: _jsxFileName,
|
|
127
|
-
lineNumber: 91
|
|
128
|
-
}
|
|
129
|
-
}, React$1.createElement('div', {
|
|
130
|
-
className: "text",
|
|
131
|
-
key: tab.id,
|
|
132
|
-
dangerouslySetInnerHTML: {
|
|
133
|
-
__html: this.parsedText(tab.text)
|
|
134
|
-
},
|
|
135
|
-
__self: this,
|
|
136
|
-
__source: {
|
|
137
|
-
fileName: _jsxFileName,
|
|
138
|
-
lineNumber: 92
|
|
139
|
-
}
|
|
140
|
-
})))))) : React$1.createElement('div', {
|
|
141
|
-
className: classes.root,
|
|
142
|
-
__self: this,
|
|
143
|
-
__source: {
|
|
144
|
-
fileName: _jsxFileName,
|
|
145
|
-
lineNumber: 102
|
|
146
|
-
}
|
|
147
|
-
}, React$1.createElement(Tabs, {
|
|
148
|
-
classes: {
|
|
149
|
-
root: classes.stickyTabs
|
|
150
|
-
},
|
|
151
|
-
value: activeTab,
|
|
152
|
-
onChange: this.handleChange,
|
|
153
|
-
__self: this,
|
|
154
|
-
__source: {
|
|
155
|
-
fileName: _jsxFileName,
|
|
156
|
-
lineNumber: 103
|
|
157
|
-
}
|
|
158
|
-
}, tabs.map(tab => React$1.createElement(Tab, {
|
|
159
|
-
className: classes.tab,
|
|
160
|
-
key: tab.id,
|
|
161
|
-
label: React$1.createElement(Purpose, {
|
|
162
|
-
purpose: "passage-title",
|
|
163
|
-
__self: this,
|
|
164
|
-
__source: {
|
|
165
|
-
fileName: _jsxFileName,
|
|
166
|
-
lineNumber: 115
|
|
167
|
-
}
|
|
168
|
-
}, React$1.createElement('span', {
|
|
169
|
-
dangerouslySetInnerHTML: {
|
|
170
|
-
__html: this.parsedText(tab.title)
|
|
171
|
-
},
|
|
172
|
-
__self: this,
|
|
173
|
-
__source: {
|
|
174
|
-
fileName: _jsxFileName,
|
|
175
|
-
lineNumber: 116
|
|
176
|
-
}
|
|
177
|
-
})),
|
|
178
|
-
value: tab.id,
|
|
179
|
-
__self: this,
|
|
180
|
-
__source: {
|
|
181
|
-
fileName: _jsxFileName,
|
|
182
|
-
lineNumber: 111
|
|
183
|
-
}
|
|
184
|
-
}))), tabs.map(tab => activeTab === tab.id ? React$1.createElement(TabContainer, {
|
|
185
|
-
multiple: true,
|
|
186
|
-
key: tab.id,
|
|
187
|
-
__self: this,
|
|
188
|
-
__source: {
|
|
189
|
-
fileName: _jsxFileName,
|
|
190
|
-
lineNumber: 127
|
|
191
|
-
}
|
|
192
|
-
}, React$1.createElement(Purpose, {
|
|
193
|
-
purpose: "passage-text",
|
|
194
|
-
__self: this,
|
|
195
|
-
__source: {
|
|
196
|
-
fileName: _jsxFileName,
|
|
197
|
-
lineNumber: 128
|
|
198
|
-
}
|
|
199
|
-
}, React$1.createElement('div', {
|
|
200
|
-
key: tab.id,
|
|
201
|
-
dangerouslySetInnerHTML: {
|
|
202
|
-
__html: this.parsedText(tab.text)
|
|
203
|
-
},
|
|
204
|
-
__self: this,
|
|
205
|
-
__source: {
|
|
206
|
-
fileName: _jsxFileName,
|
|
207
|
-
lineNumber: 129
|
|
208
|
-
}
|
|
209
|
-
}))) : null));
|
|
210
|
-
} else if (tabs && tabs[0]) {
|
|
211
|
-
return React$1.createElement('div', {
|
|
212
|
-
className: "passage",
|
|
213
|
-
style: {
|
|
214
|
-
whiteSpace: 'break-spaces'
|
|
215
|
-
},
|
|
216
|
-
__self: this,
|
|
217
|
-
__source: {
|
|
218
|
-
fileName: _jsxFileName,
|
|
219
|
-
lineNumber: 143
|
|
220
|
-
}
|
|
221
|
-
}, React$1.createElement(TabContainer, {
|
|
222
|
-
__self: this,
|
|
223
|
-
__source: {
|
|
224
|
-
fileName: _jsxFileName,
|
|
225
|
-
lineNumber: 144
|
|
226
|
-
}
|
|
227
|
-
}, React$1.createElement('div', {
|
|
228
|
-
className: "text",
|
|
229
|
-
dangerouslySetInnerHTML: {
|
|
230
|
-
__html: this.parsedText(tabs[0].text)
|
|
231
|
-
},
|
|
232
|
-
__self: this,
|
|
233
|
-
__source: {
|
|
234
|
-
fileName: _jsxFileName,
|
|
235
|
-
lineNumber: 145
|
|
236
|
-
}
|
|
237
|
-
})));
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
StimulusTabs.propTypes = {
|
|
242
|
-
classes: PropTypes.object.isRequired,
|
|
243
|
-
tabs: PropTypes.arrayOf(PropTypes.shape({
|
|
244
|
-
id: PropTypes.number.isRequired,
|
|
245
|
-
title: PropTypes.string.isRequired,
|
|
246
|
-
text: PropTypes.string.isRequired
|
|
247
|
-
}).isRequired).isRequired,
|
|
248
|
-
disabledTabs: PropTypes.bool
|
|
249
|
-
};
|
|
250
|
-
var StimulusTabs$1 = withStyles(styles)(StimulusTabs);
|
|
251
|
-
const React = _dll_react;
|
|
252
|
-
const ReactDOM = _dll_react_dom;
|
|
253
|
-
const {debounce: debounce} = _dll_lodash;
|
|
254
|
-
const debug = _dll_debug;
|
|
255
|
-
const log = debug('pie-element:passage:print');
|
|
256
|
-
const preparePrintPassage = model => model.passages.map((passage, index) => {
|
|
257
|
-
return {
|
|
258
|
-
id: index,
|
|
259
|
-
title: passage.title,
|
|
260
|
-
text: passage.text
|
|
261
|
-
};
|
|
262
|
-
});
|
|
263
|
-
class PassagePrint extends HTMLElement {
|
|
264
|
-
constructor() {
|
|
265
|
-
super();
|
|
266
|
-
this._model = null;
|
|
267
|
-
this._session = [];
|
|
268
|
-
this._rerender = debounce(() => {
|
|
269
|
-
if (this._model && this._session) {
|
|
270
|
-
if (this._model.passages && this._model.passages.length > 0) {
|
|
271
|
-
const printPassage = preparePrintPassage(this._model);
|
|
272
|
-
const element = React.createElement(StimulusTabs$1, {
|
|
273
|
-
tabs: printPassage,
|
|
274
|
-
disabledTabs: true
|
|
275
|
-
});
|
|
276
|
-
ReactDOM.render(element, this);
|
|
277
|
-
}
|
|
278
|
-
} else {
|
|
279
|
-
log('skip');
|
|
280
|
-
}
|
|
281
|
-
}, 50, {
|
|
282
|
-
leading: false,
|
|
283
|
-
trailing: true
|
|
284
|
-
});
|
|
285
|
-
}
|
|
286
|
-
set model(s) {
|
|
287
|
-
this._model = s;
|
|
288
|
-
this._rerender();
|
|
289
|
-
}
|
|
290
|
-
connectedCallback() {}
|
|
291
|
-
}
|
|
292
|
-
export {PassagePrint as default};
|