@pie-element/passage 7.1.1-next.11 → 7.1.2-next.0
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/configure.js +2 -0
- package/controller.js +1 -0
- package/dist/author/common.d.ts +36 -0
- package/dist/author/common.js +56 -0
- package/dist/author/defaults.d.ts +175 -0
- package/dist/author/defaults.js +113 -0
- package/dist/author/design.d.ts +28 -0
- package/dist/author/design.js +120 -0
- package/dist/author/index.d.ts +36 -0
- package/dist/author/index.js +66 -0
- package/dist/author/passage.d.ts +27 -0
- package/dist/author/passage.js +127 -0
- package/dist/browser/author/index.js +39774 -0
- package/dist/browser/author/index.js.map +1 -0
- package/dist/browser/controller/index.js +64 -0
- package/dist/browser/controller/index.js.map +1 -0
- package/dist/browser/debounce-CUPmq2t-.js +86 -0
- package/dist/browser/debounce-CUPmq2t-.js.map +1 -0
- package/dist/browser/delivery/index.js +117 -0
- package/dist/browser/delivery/index.js.map +1 -0
- package/dist/browser/dist-C_PfhNd9.js +9602 -0
- package/dist/browser/dist-C_PfhNd9.js.map +1 -0
- package/dist/browser/isEmpty-xEtDXvJL.js +143 -0
- package/dist/browser/isEmpty-xEtDXvJL.js.map +1 -0
- package/dist/browser/isObjectLike-qb18ZQkj.js +38 -0
- package/dist/browser/isObjectLike-qb18ZQkj.js.map +1 -0
- package/dist/browser/passage.css +2 -0
- package/dist/browser/print/index.js +48 -0
- package/dist/browser/print/index.js.map +1 -0
- package/dist/browser/stimulus-tabs-CMox8txJ.js +218 -0
- package/dist/browser/stimulus-tabs-CMox8txJ.js.map +1 -0
- package/dist/controller/defaults.d.ts +23 -0
- package/dist/controller/defaults.js +17 -0
- package/dist/controller/index.d.ts +18 -0
- package/dist/controller/index.js +50 -0
- package/dist/delivery/index.d.ts +22 -0
- package/dist/delivery/index.js +83 -0
- package/dist/delivery/stimulus-tabs.d.ts +21 -0
- package/dist/delivery/stimulus-tabs.js +220 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.iife.d.ts +8 -0
- package/dist/index.iife.js +145 -0
- package/dist/index.js +2 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_DataView.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Map.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Promise.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Set.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Symbol.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_WeakMap.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGetTag.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsArguments.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsNative.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsTypedArray.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseKeys.js +12 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseTrim.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseUnary.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_coreJsData.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_freeGlobal.js +4 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getNative.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getRawTag.js +14 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getTag.js +23 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getValue.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isMasked.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isPrototype.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeKeys.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nodeUtil.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_objectToString.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_overArg.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_root.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_toSource.js +15 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_trimmedEndIndex.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/debounce.js +50 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArguments.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArray.js +4 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArrayLike.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isBuffer.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isEmpty.js +21 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isFunction.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isLength.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObject.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObjectLike.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isSymbol.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isTypedArray.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/now.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/stubFalse.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/toNumber.js +19 -0
- package/dist/print/index.d.ts +15 -0
- package/dist/print/index.js +47 -0
- package/package.json +83 -19
- package/CHANGELOG.json +0 -227
- package/CHANGELOG.md +0 -1452
- package/LICENSE.md +0 -5
- package/README.md +0 -3
- package/configure/CHANGELOG.md +0 -672
- package/configure/lib/common.js +0 -74
- package/configure/lib/common.js.map +0 -1
- package/configure/lib/defaults.js +0 -174
- package/configure/lib/defaults.js.map +0 -1
- package/configure/lib/design.js +0 -185
- package/configure/lib/design.js.map +0 -1
- package/configure/lib/index.js +0 -86
- package/configure/lib/index.js.map +0 -1
- package/configure/lib/passage.js +0 -194
- package/configure/lib/passage.js.map +0 -1
- package/configure/package.json +0 -23
- package/controller/CHANGELOG.json +0 -1
- package/controller/CHANGELOG.md +0 -109
- package/controller/lib/defaults.js +0 -23
- package/controller/lib/defaults.js.map +0 -1
- package/controller/lib/index.js +0 -80
- package/controller/lib/index.js.map +0 -1
- package/controller/package.json +0 -13
- package/docs/config-schema.json +0 -1325
- package/docs/config-schema.json.md +0 -974
- package/docs/demo/config.js +0 -8
- package/docs/demo/generate.js +0 -32
- package/docs/demo/index.html +0 -1
- package/docs/pie-schema.json +0 -775
- package/docs/pie-schema.json.md +0 -561
- package/lib/index.js +0 -143
- package/lib/index.js.map +0 -1
- package/lib/print.js +0 -78
- package/lib/print.js.map +0 -1
- package/lib/stimulus-tabs.js +0 -323
- package/lib/stimulus-tabs.js.map +0 -1
- package/module/configure.js +0 -1
- package/module/controller.js +0 -920
- package/module/demo.js +0 -57
- package/module/element.js +0 -1
- package/module/index.html +0 -21
- package/module/manifest.json +0 -10
- package/module/print-demo.js +0 -95
- package/module/print.html +0 -18
- package/module/print.js +0 -1
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import e from "react";
|
|
2
|
+
import t from "prop-types";
|
|
3
|
+
import n from "@mui/material/Tabs";
|
|
4
|
+
import r from "@mui/material/Tab";
|
|
5
|
+
import { styled as i } from "@mui/material/styles";
|
|
6
|
+
import * as a from "@pie-lib/render-ui";
|
|
7
|
+
import { Collapsible as o, PreviewPrompt as s, Purpose as c, UiLayout as l, color as u, transformDataHeadings as d } from "@pie-lib/render-ui";
|
|
8
|
+
import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
9
|
+
//#region src/delivery/stimulus-tabs.tsx
|
|
10
|
+
function h(e) {
|
|
11
|
+
return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
|
|
12
|
+
}
|
|
13
|
+
function g(e, t) {
|
|
14
|
+
return !e || h(e) ? e : h(e.default) ? e.default : t && h(e[t]) ? e[t] : t && h(e[t]?.default) ? e[t].default : e;
|
|
15
|
+
}
|
|
16
|
+
var _ = g(l, "UiLayout") || g(C.UiLayout, "UiLayout"), v = g(c, "Purpose") || g(C.Purpose, "Purpose"), y = g(s, "PreviewPrompt") || g(C.PreviewPrompt, "PreviewPrompt"), b = g(o, "Collapsible") || g(C.Collapsible, "Collapsible"), x = a, S = x.default, C = S && typeof S == "object" ? S : x, w = i("div")({
|
|
17
|
+
flexGrow: 1,
|
|
18
|
+
backgroundColor: u.background(),
|
|
19
|
+
color: u.text(),
|
|
20
|
+
"&:not(.MathJax) table": { borderCollapse: "collapse" },
|
|
21
|
+
"&:not(.MathJax) table td, &:not(.MathJax) table th": {
|
|
22
|
+
padding: ".6em 1em",
|
|
23
|
+
textAlign: "left"
|
|
24
|
+
}
|
|
25
|
+
}), T = i("div")(({ theme: e }) => ({
|
|
26
|
+
backgroundColor: u.background(),
|
|
27
|
+
color: u.text(),
|
|
28
|
+
padding: e.spacing(2),
|
|
29
|
+
"& blockquote": {
|
|
30
|
+
background: "#f9f9f9",
|
|
31
|
+
borderLeft: "5px solid #ccc",
|
|
32
|
+
margin: "1.5em 10px",
|
|
33
|
+
padding: ".5em 10px"
|
|
34
|
+
}
|
|
35
|
+
})), E = i("div")({ fontSize: "1.75rem" }), D = i("div")({ fontSize: "1.5rem" }), O = i("div")({ fontSize: "1.25rem" }), k = i(r)(({ theme: e }) => ({
|
|
36
|
+
background: e.palette.common.white,
|
|
37
|
+
fontSize: "inherit",
|
|
38
|
+
fontFamily: "Roboto, sans-serif",
|
|
39
|
+
color: e.palette.common.black,
|
|
40
|
+
borderRadius: `${e.spacing(2)} ${e.spacing(2)} 0 0`,
|
|
41
|
+
border: "1px solid #D9DADA",
|
|
42
|
+
borderBottomWidth: 0,
|
|
43
|
+
minHeight: "56px",
|
|
44
|
+
padding: "8px 10px",
|
|
45
|
+
display: "flex",
|
|
46
|
+
alignItems: "center",
|
|
47
|
+
justifyContent: "center",
|
|
48
|
+
margin: `0 ${e.spacing(1)}`,
|
|
49
|
+
textTransform: "none",
|
|
50
|
+
".passage-label": {
|
|
51
|
+
display: "-webkit-box",
|
|
52
|
+
WebkitLineClamp: 2,
|
|
53
|
+
WebkitBoxOrient: "vertical",
|
|
54
|
+
overflow: "hidden",
|
|
55
|
+
textOverflow: "ellipsis",
|
|
56
|
+
whiteSpace: "normal",
|
|
57
|
+
margin: "auto 0",
|
|
58
|
+
opacity: .7
|
|
59
|
+
},
|
|
60
|
+
"&.Mui-selected": {
|
|
61
|
+
color: e.palette.common.black,
|
|
62
|
+
".passage-label": { opacity: 1 },
|
|
63
|
+
".passage-label-underline": { backgroundColor: "#146EB3" }
|
|
64
|
+
},
|
|
65
|
+
"&:hover": { ".passage-label-underline": { backgroundColor: "#D0E2F0" } },
|
|
66
|
+
"& .MuiTouchRipple-root": { opacity: .7 }
|
|
67
|
+
})), A = i("div")(({ theme: e }) => ({
|
|
68
|
+
height: "2px",
|
|
69
|
+
width: "100%",
|
|
70
|
+
marginTop: "6px",
|
|
71
|
+
background: e.palette.common.white
|
|
72
|
+
})), j = class extends e.Component {
|
|
73
|
+
state = { activeTab: 0 };
|
|
74
|
+
handleChange = (e, t) => {
|
|
75
|
+
this.setState(() => ({ activeTab: t })), setTimeout(() => {
|
|
76
|
+
let e = new CustomEvent("pie-ui-passage-tabChanged", { detail: { tab: t } });
|
|
77
|
+
window.dispatchEvent(e);
|
|
78
|
+
});
|
|
79
|
+
};
|
|
80
|
+
handleKeyDown = (e, t) => {
|
|
81
|
+
let { key: n } = e, { tabs: r } = this.props, i = -1, a = r.findIndex((e) => e.id === t);
|
|
82
|
+
switch (n) {
|
|
83
|
+
case "ArrowRight":
|
|
84
|
+
i = (a + 1) % r.length;
|
|
85
|
+
break;
|
|
86
|
+
case "ArrowLeft":
|
|
87
|
+
i = (a - 1 + r.length) % r.length;
|
|
88
|
+
break;
|
|
89
|
+
case "Home":
|
|
90
|
+
i = 0;
|
|
91
|
+
break;
|
|
92
|
+
case "End":
|
|
93
|
+
i = r.length - 1;
|
|
94
|
+
break;
|
|
95
|
+
case "Enter":
|
|
96
|
+
case " ":
|
|
97
|
+
i = a;
|
|
98
|
+
break;
|
|
99
|
+
default: break;
|
|
100
|
+
}
|
|
101
|
+
i !== -1 && (e.preventDefault(), e.stopPropagation(), this.handleChange(e, r[i].id), document.getElementById(`button-${r[i].id}`).focus());
|
|
102
|
+
};
|
|
103
|
+
parsedText = (e = "") => {
|
|
104
|
+
let t = document.createElement("div");
|
|
105
|
+
t.innerHTML = e.replace(/(<br\/>\n)/g, "<br/>");
|
|
106
|
+
let n = t.querySelector("audio");
|
|
107
|
+
if (n) {
|
|
108
|
+
let e = document.createElement("source");
|
|
109
|
+
e.setAttribute("type", "audio/mp3"), e.setAttribute("src", n.getAttribute("src")), n.removeAttribute("src"), n.appendChild(e);
|
|
110
|
+
}
|
|
111
|
+
return t.innerHTML;
|
|
112
|
+
};
|
|
113
|
+
renderInstructions(e, t = !1) {
|
|
114
|
+
if (!e) return;
|
|
115
|
+
let n = /* @__PURE__ */ p(y, {
|
|
116
|
+
tagName: "div",
|
|
117
|
+
className: "prompt",
|
|
118
|
+
defaultClassName: "teacher-instructions",
|
|
119
|
+
prompt: e
|
|
120
|
+
});
|
|
121
|
+
return t ? n : /* @__PURE__ */ p(b, {
|
|
122
|
+
labels: {
|
|
123
|
+
hidden: "Show Teacher Instructions",
|
|
124
|
+
visible: "Hide Teacher Instructions"
|
|
125
|
+
},
|
|
126
|
+
children: n
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
renderTab(e, t) {
|
|
130
|
+
let { baseHeadingLevel: n } = this.props, r = n ? Math.min(6, Math.max(1, n)) : void 0, i = n ? `h${r}` : "h2", a = n ? Math.min(6, Math.max(1, r + 1)) : void 0;
|
|
131
|
+
return /* @__PURE__ */ m(T, {
|
|
132
|
+
id: `tabpanel-${e.id}`,
|
|
133
|
+
role: "tabpanel",
|
|
134
|
+
"aria-labelledby": `button-${e.id}`,
|
|
135
|
+
children: [
|
|
136
|
+
this.renderInstructions(e.teacherInstructions, t),
|
|
137
|
+
e.title && /* @__PURE__ */ p(v, {
|
|
138
|
+
purpose: "passage-title",
|
|
139
|
+
children: /* @__PURE__ */ p(i, { children: /* @__PURE__ */ p(E, { dangerouslySetInnerHTML: { __html: this.parsedText(e.title) } }) })
|
|
140
|
+
}),
|
|
141
|
+
e.subtitle && /* @__PURE__ */ p(v, {
|
|
142
|
+
purpose: "passage-subtitle",
|
|
143
|
+
children: /* @__PURE__ */ p(D, { dangerouslySetInnerHTML: { __html: this.parsedText(e.subtitle) } })
|
|
144
|
+
}),
|
|
145
|
+
e.author && /* @__PURE__ */ p(v, {
|
|
146
|
+
purpose: "passage-author",
|
|
147
|
+
children: /* @__PURE__ */ p(O, {
|
|
148
|
+
className: "author",
|
|
149
|
+
dangerouslySetInnerHTML: { __html: this.parsedText(e.author) }
|
|
150
|
+
})
|
|
151
|
+
}),
|
|
152
|
+
e.text && /* @__PURE__ */ p(v, {
|
|
153
|
+
purpose: "passage-text",
|
|
154
|
+
children: /* @__PURE__ */ p("div", {
|
|
155
|
+
className: "text",
|
|
156
|
+
dangerouslySetInnerHTML: { __html: n ? d(e.text, a) : e.text }
|
|
157
|
+
}, e.id)
|
|
158
|
+
})
|
|
159
|
+
]
|
|
160
|
+
}, e.id);
|
|
161
|
+
}
|
|
162
|
+
render() {
|
|
163
|
+
let { model: e, tabs: t, disabledTabs: r } = this.props, { activeTab: i } = this.state;
|
|
164
|
+
if (!t?.length) return;
|
|
165
|
+
let { extraCSSRules: a } = e || {}, o = (t || []).find((e) => e.id === i);
|
|
166
|
+
return /* @__PURE__ */ p(_, {
|
|
167
|
+
extraCSSRules: a,
|
|
168
|
+
children: /* @__PURE__ */ p(w, {
|
|
169
|
+
className: "passages",
|
|
170
|
+
children: r || t.length === 1 ? t.map((e) => this.renderTab(e, r)) : /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p(n, {
|
|
171
|
+
sx: {
|
|
172
|
+
position: "sticky",
|
|
173
|
+
top: 0,
|
|
174
|
+
background: u.background(),
|
|
175
|
+
color: u.text(),
|
|
176
|
+
fontFamily: "Roboto, sans-serif",
|
|
177
|
+
"& .MuiTabs-list": { borderBottom: "1px solid #D9DADA" },
|
|
178
|
+
"& .MuiTabs-indicator": {
|
|
179
|
+
backgroundColor: "#ffffff",
|
|
180
|
+
marginBottom: "-1px"
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
value: i,
|
|
184
|
+
onChange: this.handleChange,
|
|
185
|
+
children: t.map((e) => /* @__PURE__ */ p(k, {
|
|
186
|
+
id: `button-${e.id}`,
|
|
187
|
+
label: /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p(v, {
|
|
188
|
+
purpose: "passage-label",
|
|
189
|
+
children: /* @__PURE__ */ p("span", {
|
|
190
|
+
className: "passage-label",
|
|
191
|
+
dangerouslySetInnerHTML: { __html: this.parsedText(e.label) }
|
|
192
|
+
})
|
|
193
|
+
}), /* @__PURE__ */ p(A, { className: "passage-label-underline" })] }),
|
|
194
|
+
value: e.id,
|
|
195
|
+
tabIndex: i === e.id ? 0 : -1,
|
|
196
|
+
"aria-controls": `tabpanel-${e.id}`,
|
|
197
|
+
"aria-selected": i === e.id,
|
|
198
|
+
onKeyDown: (t) => this.handleKeyDown(t, e.id)
|
|
199
|
+
}, e.id))
|
|
200
|
+
}), o ? this.renderTab(o, r) : null] })
|
|
201
|
+
})
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
j.propTypes = {
|
|
206
|
+
tabs: t.arrayOf(t.shape({
|
|
207
|
+
id: t.number.isRequired,
|
|
208
|
+
label: t.string.isRequired,
|
|
209
|
+
title: t.string.isRequired,
|
|
210
|
+
subtitle: t.string,
|
|
211
|
+
author: t.string,
|
|
212
|
+
text: t.string.isRequired,
|
|
213
|
+
teacherInstructions: t.string
|
|
214
|
+
}).isRequired).isRequired,
|
|
215
|
+
disabledTabs: t.bool,
|
|
216
|
+
model: t.object,
|
|
217
|
+
baseHeadingLevel: t.number
|
|
218
|
+
};
|
|
219
|
+
//#endregion
|
|
220
|
+
export { j as default };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './delivery/index.js';
|