@pie-element/ebsr 7.0.24-next.2 → 7.0.26
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 +48 -0
- package/{configure/node_modules/@pie-element/multiple-choice/LICENSE.md → LICENSE.md} +0 -0
- package/configure/CHANGELOG.md +48 -0
- package/configure/package.json +3 -3
- package/controller/CHANGELOG.md +8 -0
- package/controller/package.json +1 -1
- package/package.json +3 -3
- package/configure/node_modules/@pie-element/multiple-choice/CHANGELOG.json +0 -1972
- package/configure/node_modules/@pie-element/multiple-choice/CHANGELOG.md +0 -1793
- package/configure/node_modules/@pie-element/multiple-choice/PRINT.md +0 -35
- package/configure/node_modules/@pie-element/multiple-choice/README.md +0 -56
- package/configure/node_modules/@pie-element/multiple-choice/choice.png +0 -0
- package/configure/node_modules/@pie-element/multiple-choice/configure/CHANGELOG.json +0 -1387
- package/configure/node_modules/@pie-element/multiple-choice/configure/CHANGELOG.md +0 -1334
- package/configure/node_modules/@pie-element/multiple-choice/configure/lib/defaults.js +0 -104
- package/configure/node_modules/@pie-element/multiple-choice/configure/lib/defaults.js.map +0 -1
- package/configure/node_modules/@pie-element/multiple-choice/configure/lib/index.js +0 -198
- package/configure/node_modules/@pie-element/multiple-choice/configure/lib/index.js.map +0 -1
- package/configure/node_modules/@pie-element/multiple-choice/configure/lib/main.js +0 -599
- package/configure/node_modules/@pie-element/multiple-choice/configure/lib/main.js.map +0 -1
- package/configure/node_modules/@pie-element/multiple-choice/configure/lib/utils.js +0 -18
- package/configure/node_modules/@pie-element/multiple-choice/configure/lib/utils.js.map +0 -1
- package/configure/node_modules/@pie-element/multiple-choice/configure/package.json +0 -20
- package/configure/node_modules/@pie-element/multiple-choice/controller/CHANGELOG.json +0 -527
- package/configure/node_modules/@pie-element/multiple-choice/controller/CHANGELOG.md +0 -768
- package/configure/node_modules/@pie-element/multiple-choice/controller/lib/defaults.js +0 -18
- package/configure/node_modules/@pie-element/multiple-choice/controller/lib/defaults.js.map +0 -1
- package/configure/node_modules/@pie-element/multiple-choice/controller/lib/index.js +0 -305
- package/configure/node_modules/@pie-element/multiple-choice/controller/lib/index.js.map +0 -1
- package/configure/node_modules/@pie-element/multiple-choice/controller/lib/utils.js +0 -36
- package/configure/node_modules/@pie-element/multiple-choice/controller/lib/utils.js.map +0 -1
- package/configure/node_modules/@pie-element/multiple-choice/controller/package.json +0 -15
- package/configure/node_modules/@pie-element/multiple-choice/docs/config-schema.json +0 -353
- package/configure/node_modules/@pie-element/multiple-choice/docs/config-schema.json.md +0 -277
- package/configure/node_modules/@pie-element/multiple-choice/docs/demo/config.js +0 -8
- package/configure/node_modules/@pie-element/multiple-choice/docs/demo/generate.js +0 -52
- package/configure/node_modules/@pie-element/multiple-choice/docs/demo/index.html +0 -1
- package/configure/node_modules/@pie-element/multiple-choice/docs/demo/session.js +0 -7
- package/configure/node_modules/@pie-element/multiple-choice/docs/pie-schema.json +0 -338
- package/configure/node_modules/@pie-element/multiple-choice/docs/pie-schema.json.md +0 -274
- package/configure/node_modules/@pie-element/multiple-choice/lib/choice-input.js +0 -298
- package/configure/node_modules/@pie-element/multiple-choice/lib/choice-input.js.map +0 -1
- package/configure/node_modules/@pie-element/multiple-choice/lib/choice.js +0 -157
- package/configure/node_modules/@pie-element/multiple-choice/lib/choice.js.map +0 -1
- package/configure/node_modules/@pie-element/multiple-choice/lib/feedback-tick.js +0 -174
- package/configure/node_modules/@pie-element/multiple-choice/lib/feedback-tick.js.map +0 -1
- package/configure/node_modules/@pie-element/multiple-choice/lib/index.js +0 -151
- package/configure/node_modules/@pie-element/multiple-choice/lib/index.js.map +0 -1
- package/configure/node_modules/@pie-element/multiple-choice/lib/main.js +0 -97
- package/configure/node_modules/@pie-element/multiple-choice/lib/main.js.map +0 -1
- package/configure/node_modules/@pie-element/multiple-choice/lib/multiple-choice.js +0 -254
- package/configure/node_modules/@pie-element/multiple-choice/lib/multiple-choice.js.map +0 -1
- package/configure/node_modules/@pie-element/multiple-choice/lib/print.js +0 -129
- package/configure/node_modules/@pie-element/multiple-choice/lib/print.js.map +0 -1
- package/configure/node_modules/@pie-element/multiple-choice/lib/session-updater.js +0 -35
- package/configure/node_modules/@pie-element/multiple-choice/lib/session-updater.js.map +0 -1
- package/configure/node_modules/@pie-element/multiple-choice/module/configure.js +0 -843
- package/configure/node_modules/@pie-element/multiple-choice/module/controller.js +0 -20686
- package/configure/node_modules/@pie-element/multiple-choice/module/demo.js +0 -77
- package/configure/node_modules/@pie-element/multiple-choice/module/element.js +0 -2019
- package/configure/node_modules/@pie-element/multiple-choice/module/index.html +0 -21
- package/configure/node_modules/@pie-element/multiple-choice/module/manifest.json +0 -14
- package/configure/node_modules/@pie-element/multiple-choice/module/print-demo.js +0 -115
- package/configure/node_modules/@pie-element/multiple-choice/module/print.html +0 -18
- package/configure/node_modules/@pie-element/multiple-choice/module/print.js +0 -1983
- package/configure/node_modules/@pie-element/multiple-choice/package.json +0 -34
- package/configure/node_modules/@pie-lib/math-rendering/CHANGELOG.json +0 -672
- package/configure/node_modules/@pie-lib/math-rendering/CHANGELOG.md +0 -427
- package/configure/node_modules/@pie-lib/math-rendering/LICENSE.md +0 -5
- package/configure/node_modules/@pie-lib/math-rendering/lib/index.js +0 -30
- package/configure/node_modules/@pie-lib/math-rendering/lib/index.js.map +0 -1
- package/configure/node_modules/@pie-lib/math-rendering/lib/mstack/chtml.js +0 -316
- package/configure/node_modules/@pie-lib/math-rendering/lib/mstack/chtml.js.map +0 -1
- package/configure/node_modules/@pie-lib/math-rendering/lib/mstack/index.js +0 -23
- package/configure/node_modules/@pie-lib/math-rendering/lib/mstack/index.js.map +0 -1
- package/configure/node_modules/@pie-lib/math-rendering/lib/mstack/mml.js +0 -123
- package/configure/node_modules/@pie-lib/math-rendering/lib/mstack/mml.js.map +0 -1
- package/configure/node_modules/@pie-lib/math-rendering/lib/normalization.js +0 -103
- package/configure/node_modules/@pie-lib/math-rendering/lib/normalization.js.map +0 -1
- package/configure/node_modules/@pie-lib/math-rendering/lib/render-math.js +0 -275
- package/configure/node_modules/@pie-lib/math-rendering/lib/render-math.js.map +0 -1
- package/configure/node_modules/@pie-lib/math-rendering/package.json +0 -19
- package/configure/node_modules/@pie-lib/math-rendering/playground/demo.html +0 -872
- package/configure/node_modules/@pie-lib/math-rendering/playground/demo.js +0 -108
- package/configure/node_modules/@pie-lib/math-rendering/playground/main.html +0 -156
- package/configure/node_modules/@pie-lib/math-rendering/playground/main.js +0 -16
- package/configure/node_modules/@pie-lib/math-rendering/playground/webpack.config.js +0 -29
- package/configure/node_modules/@pie-lib/math-rendering/src/index.js +0 -4
- package/configure/node_modules/@pie-lib/math-rendering/src/mstack/chtml.js +0 -215
- package/configure/node_modules/@pie-lib/math-rendering/src/mstack/index.js +0 -13
- package/configure/node_modules/@pie-lib/math-rendering/src/mstack/mml.js +0 -24
- package/configure/node_modules/@pie-lib/math-rendering/src/normalization.js +0 -69
- package/configure/node_modules/@pie-lib/math-rendering/src/render-math.js +0 -234
- package/configure/node_modules/@pie-lib/render-ui/CHANGELOG.json +0 -937
- package/configure/node_modules/@pie-lib/render-ui/CHANGELOG.md +0 -602
- package/configure/node_modules/@pie-lib/render-ui/LICENSE.md +0 -5
- package/configure/node_modules/@pie-lib/render-ui/README.md +0 -33
- package/configure/node_modules/@pie-lib/render-ui/lib/collapsible/index.js +0 -146
- package/configure/node_modules/@pie-lib/render-ui/lib/collapsible/index.js.map +0 -1
- package/configure/node_modules/@pie-lib/render-ui/lib/color.js +0 -134
- package/configure/node_modules/@pie-lib/render-ui/lib/color.js.map +0 -1
- package/configure/node_modules/@pie-lib/render-ui/lib/feedback.js +0 -160
- package/configure/node_modules/@pie-lib/render-ui/lib/feedback.js.map +0 -1
- package/configure/node_modules/@pie-lib/render-ui/lib/has-text.js +0 -24
- package/configure/node_modules/@pie-lib/render-ui/lib/has-text.js.map +0 -1
- package/configure/node_modules/@pie-lib/render-ui/lib/html-and-math.js +0 -102
- package/configure/node_modules/@pie-lib/render-ui/lib/html-and-math.js.map +0 -1
- package/configure/node_modules/@pie-lib/render-ui/lib/index.js +0 -104
- package/configure/node_modules/@pie-lib/render-ui/lib/index.js.map +0 -1
- package/configure/node_modules/@pie-lib/render-ui/lib/input-container.js +0 -60
- package/configure/node_modules/@pie-lib/render-ui/lib/input-container.js.map +0 -1
- package/configure/node_modules/@pie-lib/render-ui/lib/preview-layout.js +0 -133
- package/configure/node_modules/@pie-lib/render-ui/lib/preview-layout.js.map +0 -1
- package/configure/node_modules/@pie-lib/render-ui/lib/preview-prompt.js +0 -162
- package/configure/node_modules/@pie-lib/render-ui/lib/preview-prompt.js.map +0 -1
- package/configure/node_modules/@pie-lib/render-ui/lib/purpose.js +0 -28
- package/configure/node_modules/@pie-lib/render-ui/lib/purpose.js.map +0 -1
- package/configure/node_modules/@pie-lib/render-ui/lib/readable.js +0 -28
- package/configure/node_modules/@pie-lib/render-ui/lib/readable.js.map +0 -1
- package/configure/node_modules/@pie-lib/render-ui/lib/response-indicators.js +0 -160
- package/configure/node_modules/@pie-lib/render-ui/lib/response-indicators.js.map +0 -1
- package/configure/node_modules/@pie-lib/render-ui/lib/withUndoReset.js +0 -206
- package/configure/node_modules/@pie-lib/render-ui/lib/withUndoReset.js.map +0 -1
- package/configure/node_modules/@pie-lib/render-ui/package.json +0 -30
- package/configure/node_modules/@pie-lib/render-ui/src/collapsible/index.jsx +0 -68
- package/configure/node_modules/@pie-lib/render-ui/src/color.js +0 -48
- package/configure/node_modules/@pie-lib/render-ui/src/feedback.jsx +0 -100
- package/configure/node_modules/@pie-lib/render-ui/src/has-text.js +0 -14
- package/configure/node_modules/@pie-lib/render-ui/src/html-and-math.js +0 -40
- package/configure/node_modules/@pie-lib/render-ui/src/index.js +0 -27
- package/configure/node_modules/@pie-lib/render-ui/src/input-container.jsx +0 -41
- package/configure/node_modules/@pie-lib/render-ui/src/preview-layout.jsx +0 -77
- package/configure/node_modules/@pie-lib/render-ui/src/preview-prompt.jsx +0 -90
- package/configure/node_modules/@pie-lib/render-ui/src/purpose.jsx +0 -19
- package/configure/node_modules/@pie-lib/render-ui/src/readable.jsx +0 -19
- package/configure/node_modules/@pie-lib/render-ui/src/response-indicators.jsx +0 -89
- package/configure/node_modules/@pie-lib/render-ui/src/withUndoReset.jsx +0 -118
|
@@ -1,234 +0,0 @@
|
|
|
1
|
-
import { mathjax } from 'mathjax-full/js/mathjax';
|
|
2
|
-
import { MathML } from 'mathjax-full/js/input/mathml';
|
|
3
|
-
import { TeX } from 'mathjax-full/js/input/tex';
|
|
4
|
-
|
|
5
|
-
import { CHTML } from 'mathjax-full/js/output/chtml';
|
|
6
|
-
import { RegisterHTMLHandler } from 'mathjax-full/js/handlers/html';
|
|
7
|
-
import { browserAdaptor } from 'mathjax-full/js/adaptors/browserAdaptor';
|
|
8
|
-
import { AllPackages } from 'mathjax-full/js/input/tex/AllPackages';
|
|
9
|
-
|
|
10
|
-
if (typeof window !== 'undefined') {
|
|
11
|
-
RegisterHTMLHandler(browserAdaptor());
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
import pkg from '../package.json';
|
|
15
|
-
import { mmlNodes, chtmlNodes } from './mstack';
|
|
16
|
-
import debug from 'debug';
|
|
17
|
-
import { wrapMath, unWrapMath } from './normalization';
|
|
18
|
-
import { MmlFactory } from 'mathjax-full/js/core/MmlTree/MmlFactory';
|
|
19
|
-
import { SerializedMmlVisitor } from 'mathjax-full/js/core/MmlTree/SerializedMmlVisitor';
|
|
20
|
-
import { CHTMLWrapperFactory } from 'mathjax-full/js/output/chtml/WrapperFactory';
|
|
21
|
-
import { CHTMLmspace } from 'mathjax-full/js/output/chtml/Wrappers/mspace';
|
|
22
|
-
|
|
23
|
-
const visitor = new SerializedMmlVisitor();
|
|
24
|
-
const toMMl = node => visitor.visitTree(node);
|
|
25
|
-
|
|
26
|
-
const log = debug('pie-lib:math-rendering');
|
|
27
|
-
|
|
28
|
-
const NEWLINE_BLOCK_REGEX = /\\embed\{newLine\}\[\]/g;
|
|
29
|
-
const NEWLINE_LATEX = '\\newline ';
|
|
30
|
-
|
|
31
|
-
const getGlobal = () => {
|
|
32
|
-
const key = `${pkg.name}@${pkg.version.split('.')[0]}`;
|
|
33
|
-
|
|
34
|
-
if (typeof window !== 'undefined') {
|
|
35
|
-
if (!window[key]) {
|
|
36
|
-
window[key] = {};
|
|
37
|
-
}
|
|
38
|
-
return window[key];
|
|
39
|
-
} else {
|
|
40
|
-
return {};
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
/** Add temporary support for a global singleDollar override
|
|
45
|
-
* <code>
|
|
46
|
-
* // This will enable single dollar rendering
|
|
47
|
-
* window.pie = window.pie || {};
|
|
48
|
-
* window.pie.mathRendering = {useSingleDollar: true };
|
|
49
|
-
* </code>
|
|
50
|
-
*/
|
|
51
|
-
const defaultOpts = () => getGlobal().opts || {};
|
|
52
|
-
|
|
53
|
-
export const fixMathElement = element => {
|
|
54
|
-
let property = 'innerText';
|
|
55
|
-
|
|
56
|
-
if (element.textContent) {
|
|
57
|
-
property = 'textContent';
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
if (element[property]) {
|
|
61
|
-
element[property] = wrapMath(unWrapMath(element[property]).unwrapped);
|
|
62
|
-
// because mathquill doesn't understand line breaks, sometimes we end up with custom elements on prompts/rationale/etc.
|
|
63
|
-
// we need to replace the custom embedded elements with valid latex that Mathjax can understand
|
|
64
|
-
element[property] = element[property].replace(NEWLINE_BLOCK_REGEX, NEWLINE_LATEX);
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
export const fixMathElements = () => {
|
|
69
|
-
const mathElements = document.querySelectorAll('[data-latex]');
|
|
70
|
-
|
|
71
|
-
mathElements.forEach(item => fixMathElement(item));
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
const bootstrap = opts => {
|
|
75
|
-
if (typeof window === 'undefined') {
|
|
76
|
-
return { Typeset: () => ({}) };
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
opts = opts || defaultOpts();
|
|
80
|
-
|
|
81
|
-
if (opts.useSingleDollar) {
|
|
82
|
-
// eslint-disable-next-line
|
|
83
|
-
console.warn('[math-rendering] using $ is not advisable, please use $$..$$ or \\(...\\)');
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
const packages = AllPackages.filter(name => name !== 'bussproofs'); // Bussproofs needs an output jax
|
|
87
|
-
|
|
88
|
-
// The autoload extension predefines all the macros from the extensions that haven't been loaded already
|
|
89
|
-
// so that they automatically load the needed extension when they are first used
|
|
90
|
-
packages.push('autoload');
|
|
91
|
-
|
|
92
|
-
const macros = {
|
|
93
|
-
parallelogram: '\\lower.2em{\\Huge\\unicode{x25B1}}',
|
|
94
|
-
overarc: '\\overparen',
|
|
95
|
-
napprox: '\\not\\approx',
|
|
96
|
-
longdiv: '\\enclose{longdiv}'
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
const texConfig = opts.useSingleDollar
|
|
100
|
-
? {
|
|
101
|
-
loader: {
|
|
102
|
-
require: require
|
|
103
|
-
},
|
|
104
|
-
packages,
|
|
105
|
-
macros,
|
|
106
|
-
inlineMath: [
|
|
107
|
-
['$', '$'],
|
|
108
|
-
['\\(', '\\)']
|
|
109
|
-
],
|
|
110
|
-
displayMath: [
|
|
111
|
-
['$$', '$$'],
|
|
112
|
-
['\\[', '\\]']
|
|
113
|
-
],
|
|
114
|
-
processEscapes: true
|
|
115
|
-
}
|
|
116
|
-
: {
|
|
117
|
-
packages,
|
|
118
|
-
macros
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
const mmlConfig = {
|
|
122
|
-
parseAs: 'html',
|
|
123
|
-
forceReparse: false,
|
|
124
|
-
parseError: function(node) {
|
|
125
|
-
// function to process parsing errors
|
|
126
|
-
console.log('error:', node);
|
|
127
|
-
this.error(this.adaptor.textContent(node).replace(/\n.*/g, ''));
|
|
128
|
-
}
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
const fontURL = `https://unpkg.com/mathjax-full@${mathjax.version}/ts/output/chtml/fonts/tex-woff-v2`;
|
|
132
|
-
const htmlConfig = {
|
|
133
|
-
fontURL,
|
|
134
|
-
|
|
135
|
-
wrapperFactory: new CHTMLWrapperFactory({
|
|
136
|
-
...CHTMLWrapperFactory.defaultNodes,
|
|
137
|
-
...chtmlNodes
|
|
138
|
-
})
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
const mml = new MathML(mmlConfig);
|
|
142
|
-
console.log([new TeX(texConfig), mml]);
|
|
143
|
-
|
|
144
|
-
const customMmlFactory = new MmlFactory({
|
|
145
|
-
...MmlFactory.defaultNodes,
|
|
146
|
-
...mmlNodes
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
const html = mathjax.document(document, {
|
|
150
|
-
compileError: (mj, math, err) => {
|
|
151
|
-
console.log('bad math?:', math);
|
|
152
|
-
console.error(err);
|
|
153
|
-
},
|
|
154
|
-
typesetError: function(doc, math, err) {
|
|
155
|
-
console.log('typeset error');
|
|
156
|
-
console.error(err);
|
|
157
|
-
doc.typesetError(math, err);
|
|
158
|
-
},
|
|
159
|
-
|
|
160
|
-
InputJax: [new TeX(texConfig), mml],
|
|
161
|
-
OutputJax: new CHTML(htmlConfig)
|
|
162
|
-
});
|
|
163
|
-
|
|
164
|
-
// Note: we must set this *after* mathjax.document (no idea why)
|
|
165
|
-
mml.setMmlFactory(customMmlFactory);
|
|
166
|
-
|
|
167
|
-
return {
|
|
168
|
-
version: mathjax.version,
|
|
169
|
-
html: html,
|
|
170
|
-
Typeset: function(...elements) {
|
|
171
|
-
const updatedDocument = this.html
|
|
172
|
-
.findMath(elements.length ? { elements } : {})
|
|
173
|
-
.compile()
|
|
174
|
-
.getMetrics()
|
|
175
|
-
.typeset()
|
|
176
|
-
.updateDocument();
|
|
177
|
-
|
|
178
|
-
try {
|
|
179
|
-
const list = updatedDocument.math.list;
|
|
180
|
-
|
|
181
|
-
for (let item = list.next; typeof item.data !== 'symbol'; item = item.next) {
|
|
182
|
-
const mathMl = toMMl(item.data.root);
|
|
183
|
-
const parsedMathMl = mathMl.replaceAll('\n', '');
|
|
184
|
-
|
|
185
|
-
item.data.typesetRoot.setAttribute('data-mathml', parsedMathMl);
|
|
186
|
-
}
|
|
187
|
-
} catch (e) {
|
|
188
|
-
console.error(e.toString());
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
updatedDocument.clear();
|
|
192
|
-
}
|
|
193
|
-
};
|
|
194
|
-
};
|
|
195
|
-
|
|
196
|
-
const renderMath = (el, renderOpts) => {
|
|
197
|
-
//TODO: remove this - has nothing to do with math-rendering (it's from editable-html)
|
|
198
|
-
fixMathElements();
|
|
199
|
-
|
|
200
|
-
if (!getGlobal().instance) {
|
|
201
|
-
getGlobal().instance = bootstrap(renderOpts);
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
if (!el) {
|
|
205
|
-
log('el is undefined');
|
|
206
|
-
return;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
if (el instanceof Element) {
|
|
210
|
-
getGlobal().instance.Typeset(el);
|
|
211
|
-
} else if (el.length) {
|
|
212
|
-
const arr = Array.from(el);
|
|
213
|
-
getGlobal().instance.Typeset(...arr);
|
|
214
|
-
}
|
|
215
|
-
};
|
|
216
|
-
|
|
217
|
-
/**
|
|
218
|
-
* This style is added to overried default styling of mjx-mspace Mathjax tag
|
|
219
|
-
* In mathjax src code \newline latex gets parsed to <mjx-mspace></mjx-mspace>,
|
|
220
|
-
* but has the default style
|
|
221
|
-
* 'mjx-mspace': {
|
|
222
|
-
"display": 'in-line',
|
|
223
|
-
"text-align": 'left'
|
|
224
|
-
} which prevents it from showing as a newline value
|
|
225
|
-
*/
|
|
226
|
-
CHTMLmspace.styles = {
|
|
227
|
-
'mjx-mspace': {
|
|
228
|
-
display: 'block',
|
|
229
|
-
'text-align': 'center',
|
|
230
|
-
height: '5px'
|
|
231
|
-
}
|
|
232
|
-
};
|
|
233
|
-
|
|
234
|
-
export default renderMath;
|