@pie-lib/math-rendering-accessible 3.18.1-next.0 → 3.19.2

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/esm/index.js ADDED
@@ -0,0 +1,512 @@
1
+ import { SerializedMmlVisitor } from 'mathjax-full/js/core/MmlTree/SerializedMmlVisitor';
2
+ import TexError from 'mathjax-full/js/input/tex/TexError';
3
+ import { MathMLToLaTeX } from '@pie-framework/mathml-to-latex';
4
+
5
+ const BracketTypes = {};
6
+ BracketTypes.ROUND_BRACKETS = 'round_brackets';
7
+ BracketTypes.SQUARE_BRACKETS = 'square_brackets';
8
+ BracketTypes.DOLLAR = 'dollar';
9
+ BracketTypes.DOUBLE_DOLLAR = 'double_dollar';
10
+ const PAIRS = {
11
+ [BracketTypes.ROUND_BRACKETS]: ['\\(', '\\)'],
12
+ [BracketTypes.SQUARE_BRACKETS]: ['\\[', '\\]'],
13
+ [BracketTypes.DOLLAR]: ['$', '$'],
14
+ [BracketTypes.DOUBLE_DOLLAR]: ['$$', '$$']
15
+ };
16
+ const wrapMath = (content, wrapType) => {
17
+ if (wrapType === BracketTypes.SQUARE_BRACKETS) {
18
+ console.warn('\\[...\\] is not supported yet'); // eslint-disable-line
19
+
20
+ wrapType = BracketTypes.ROUND_BRACKETS;
21
+ }
22
+
23
+ if (wrapType === BracketTypes.DOUBLE_DOLLAR) {
24
+ console.warn('$$...$$ is not supported yet'); // eslint-disable-line
25
+
26
+ wrapType = BracketTypes.DOLLAR;
27
+ }
28
+
29
+ const [start, end] = PAIRS[wrapType] || PAIRS[BracketTypes.ROUND_BRACKETS];
30
+ return `${start}${content}${end}`;
31
+ };
32
+ const unWrapMath = content => {
33
+ const displayStyleIndex = content.indexOf('\\displaystyle');
34
+
35
+ if (displayStyleIndex !== -1) {
36
+ console.warn('\\displaystyle is not supported - removing'); // eslint-disable-line
37
+
38
+ content = content.replace('\\displaystyle', '').trim();
39
+ }
40
+
41
+ if (content.startsWith('$$') && content.endsWith('$$')) {
42
+ console.warn('$$ syntax is not yet supported'); // eslint-disable-line
43
+
44
+ return {
45
+ unwrapped: content.substring(2, content.length - 2),
46
+ wrapType: BracketTypes.DOLLAR
47
+ };
48
+ }
49
+
50
+ if (content.startsWith('$') && content.endsWith('$')) {
51
+ return {
52
+ unwrapped: content.substring(1, content.length - 1),
53
+ wrapType: BracketTypes.DOLLAR
54
+ };
55
+ }
56
+
57
+ if (content.startsWith('\\[') && content.endsWith('\\]')) {
58
+ console.warn('\\[..\\] syntax is not yet supported'); // eslint-disable-line
59
+
60
+ return {
61
+ unwrapped: content.substring(2, content.length - 2),
62
+ wrapType: BracketTypes.ROUND_BRACKETS
63
+ };
64
+ }
65
+
66
+ if (content.startsWith('\\(') && content.endsWith('\\)')) {
67
+ return {
68
+ unwrapped: content.substring(2, content.length - 2),
69
+ wrapType: BracketTypes.ROUND_BRACKETS
70
+ };
71
+ }
72
+
73
+ return {
74
+ unwrapped: content,
75
+ wrapType: BracketTypes.ROUND_BRACKETS
76
+ };
77
+ };
78
+
79
+ const visitor = new SerializedMmlVisitor();
80
+
81
+ const toMMl = node => visitor.visitTree(node);
82
+
83
+ const NEWLINE_BLOCK_REGEX = /\\embed\{newLine\}\[\]/g;
84
+ const NEWLINE_LATEX = '\\newline ';
85
+ const mathRenderingKEY = '@pie-lib/math-rendering@2';
86
+ const mathRenderingAccessibleKEY = '@pie-lib/math-rendering-accessible@1';
87
+ const MathJaxVersion = '3.2.2';
88
+ const getGlobal = () => {
89
+ // TODO does it make sense to use version?
90
+ // const key = `${pkg.name}@${pkg.version.split('.')[0]}`;
91
+ // It looks like Ed made this change when he switched from mathjax3 to mathjax-full
92
+ // I think it was supposed to make sure version 1 (using mathjax3) is not used
93
+ // in combination with version 2 (using mathjax-full)
94
+ // TODO higher level wrappers use this instance of math-rendering, and if 2 different instances are used, math rendering is not working
95
+ // so I will hardcode this for now until a better solution is found
96
+ if (typeof window !== 'undefined') {
97
+ if (!window[mathRenderingAccessibleKEY]) {
98
+ window[mathRenderingAccessibleKEY] = {};
99
+ }
100
+
101
+ return window[mathRenderingAccessibleKEY];
102
+ } else {
103
+ return {};
104
+ }
105
+ };
106
+ const fixMathElement = element => {
107
+ if (element.dataset.mathHandled) {
108
+ return;
109
+ }
110
+
111
+ let property = 'innerText';
112
+
113
+ if (element.textContent) {
114
+ property = 'textContent';
115
+ }
116
+
117
+ if (element[property]) {
118
+ element[property] = wrapMath(unWrapMath(element[property]).unwrapped); // because mathquill doesn't understand line breaks, sometimes we end up with custom elements on prompts/rationale/etc.
119
+ // we need to replace the custom embedded elements with valid latex that Mathjax can understand
120
+
121
+ element[property] = element[property].replace(NEWLINE_BLOCK_REGEX, NEWLINE_LATEX);
122
+ element.dataset.mathHandled = true;
123
+ }
124
+ };
125
+ const fixMathElements = (el = document) => {
126
+ const mathElements = el.querySelectorAll('[data-latex]');
127
+ mathElements.forEach(item => fixMathElement(item));
128
+ };
129
+
130
+ const adjustMathMLStyle = (el = document) => {
131
+ const nodes = el.querySelectorAll('math');
132
+ nodes.forEach(node => node.setAttribute('displaystyle', 'true'));
133
+ };
134
+
135
+ const createPlaceholder = element => {
136
+ var _element$previousSibl;
137
+
138
+ if (!element.previousSibling || !((_element$previousSibl = element.previousSibling.classList) != null && _element$previousSibl.contains('math-placeholder'))) {
139
+ var _element$parentNode;
140
+
141
+ // Store the original display style before setting it to 'none'
142
+ element.dataset.originalDisplay = element.style.display || '';
143
+ element.style.display = 'none';
144
+ const placeholder = document.createElement('span');
145
+ placeholder.style.cssText = 'height: 10px; width: 50px; display: inline-block; vertical-align: middle; justify-content: center; background: #fafafa; border-radius: 4px;';
146
+ placeholder.classList.add('math-placeholder');
147
+ (_element$parentNode = element.parentNode) == null ? void 0 : _element$parentNode.insertBefore(placeholder, element);
148
+ }
149
+ };
150
+
151
+ const removePlaceholdersAndRestoreDisplay = () => {
152
+ document.querySelectorAll('.math-placeholder').forEach(placeholder => {
153
+ var _targetElement$datase;
154
+
155
+ const targetElement = placeholder.nextElementSibling;
156
+
157
+ if (targetElement && ((_targetElement$datase = targetElement.dataset) == null ? void 0 : _targetElement$datase.originalDisplay) !== undefined) {
158
+ targetElement.style.display = targetElement.dataset.originalDisplay;
159
+ delete targetElement.dataset.originalDisplay;
160
+ }
161
+
162
+ placeholder.remove();
163
+ });
164
+ };
165
+
166
+ const removeExcessMjxContainers = content => {
167
+ const elements = content.querySelectorAll('[data-latex][data-math-handled="true"]');
168
+ elements.forEach(element => {
169
+ const mjxContainers = element.querySelectorAll('mjx-container'); // Check if there are more than one mjx-container children.
170
+
171
+ if (mjxContainers.length > 1) {
172
+ for (let i = 1; i < mjxContainers.length; i++) {
173
+ mjxContainers[i].parentNode.removeChild(mjxContainers[i]);
174
+ }
175
+ }
176
+ });
177
+ };
178
+
179
+ const renderContentsWithMathJax = el => {
180
+ // el sometimes is an array
181
+ // renderMath is used like that in pie-print-support and pie-element-extensions
182
+ // there seems to be no reason for that, however, it's better to handle the case here
183
+ if (el instanceof Array) {
184
+ el.forEach(elNode => renderContentWithMathJax(elNode));
185
+ } else {
186
+ renderContentWithMathJax(el);
187
+ }
188
+ };
189
+
190
+ const renderContentWithMathJax = executeOn => {
191
+ executeOn = executeOn || document.body; // this happens for charting - mark-label; we receive a ref which is not yet ready ( el = { current: null })
192
+ // we have to fix this in charting
193
+
194
+ if (!(executeOn instanceof HTMLElement)) return;
195
+ fixMathElements(executeOn);
196
+ adjustMathMLStyle(executeOn);
197
+ const mathJaxInstance = getGlobal().instance;
198
+
199
+ if (mathJaxInstance) {
200
+ // Reset and clear typesetting before processing the new content
201
+ // Reset the tex labels (and automatic equation number).
202
+ mathJaxInstance.texReset(); // Reset the typesetting system (font caches, etc.)
203
+
204
+ mathJaxInstance.typesetClear(); // Use typesetPromise for asynchronous typesetting
205
+ // Using MathJax.typesetPromise() for asynchronous typesetting to handle situations where additional code needs to be loaded (e.g., for certain TeX commands or characters).
206
+ // This ensures typesetting waits for any needed resources to load and complete processing, unlike the synchronous MathJax.typeset() which can't handle such dynamic loading.
207
+
208
+ mathJaxInstance.typesetPromise([executeOn]).then(() => {
209
+ try {
210
+ removePlaceholdersAndRestoreDisplay();
211
+ removeExcessMjxContainers(executeOn);
212
+ const updatedDocument = mathJaxInstance.startup.document;
213
+ const list = updatedDocument.math.list;
214
+
215
+ for (let item = list.next; typeof item.data !== 'symbol'; item = item.next) {
216
+ const mathMl = toMMl(item.data.root);
217
+ const parsedMathMl = mathMl.replaceAll('\n', '');
218
+ item.data.typesetRoot.setAttribute('data-mathml', parsedMathMl);
219
+ item.data.typesetRoot.setAttribute('tabindex', '-1');
220
+ } // If the original input was a string, return the parsed MathML
221
+
222
+ } catch (e) {
223
+ console.error('Error post-processing MathJax typesetting:', e.toString());
224
+ } // Clearing the document if needed
225
+
226
+
227
+ mathJaxInstance.startup.document.clear();
228
+ }).catch(error => {
229
+ // If there was an internal error, put the message into the output instead
230
+ console.error('Error in typesetting with MathJax:', error);
231
+ });
232
+ }
233
+ };
234
+
235
+ const convertMathJax2ToMathJax3 = () => {
236
+ // Make MathJax v2 compatible with v3
237
+ // https://docs.mathjax.org/en/v3.2-latest/upgrading/v2.html#version-2-compatibility-example
238
+ // Replace the require command map with a new one that checks for
239
+ // renamed extensions and converts them to the new names.
240
+ const CommandMap = MathJax._.input.tex.SymbolMap.CommandMap;
241
+ const requireMap = MathJax.config.startup.requireMap;
242
+ const RequireLoad = MathJax._.input.tex.require.RequireConfiguration.RequireLoad;
243
+ const RequireMethods = {
244
+ Require: function (parser, name) {
245
+ let required = parser.GetArgument(name);
246
+
247
+ if (required.match(/[^_a-zA-Z0-9]/) || required === '') {
248
+ throw new TexError('BadPackageName', 'Argument for %1 is not a valid package name', name);
249
+ }
250
+
251
+ if (requireMap.hasOwnProperty(required)) {
252
+ required = requireMap[required];
253
+ }
254
+
255
+ RequireLoad(parser, required);
256
+ }
257
+ };
258
+ new CommandMap('require', {
259
+ require: 'Require'
260
+ }, RequireMethods); //
261
+ // Add a replacement for MathJax.Callback command
262
+ //
263
+
264
+ MathJax.Callback = function (args) {
265
+ if (Array.isArray(args)) {
266
+ if (args.length === 1 && typeof args[0] === 'function') {
267
+ return args[0];
268
+ } else if (typeof args[0] === 'string' && args[1] instanceof Object && typeof args[1][args[0]] === 'function') {
269
+ return Function.bind.apply(args[1][args[0]], args.slice(1));
270
+ } else if (typeof args[0] === 'function') {
271
+ return Function.bind.apply(args[0], [window].concat(args.slice(1)));
272
+ } else if (typeof args[1] === 'function') {
273
+ return Function.bind.apply(args[1], [args[0]].concat(args.slice(2)));
274
+ }
275
+ } else if (typeof args === 'function') {
276
+ return args;
277
+ }
278
+
279
+ throw Error("Can't make callback from given data");
280
+ }; //
281
+ // Add a replacement for MathJax.Hub commands
282
+ //
283
+
284
+
285
+ MathJax.Hub = {
286
+ Queue: function () {
287
+ for (let i = 0, m = arguments.length; i < m; i++) {
288
+ const fn = MathJax.Callback(arguments[i]);
289
+ MathJax.startup.promise = MathJax.startup.promise.then(fn);
290
+ }
291
+
292
+ return MathJax.startup.promise;
293
+ },
294
+ Typeset: function (elements, callback) {
295
+ let promise = MathJax.typesetPromise(elements);
296
+
297
+ if (callback) {
298
+ promise = promise.then(callback);
299
+ }
300
+
301
+ return promise;
302
+ },
303
+ Register: {
304
+ MessageHook: function () {
305
+ console.log('MessageHooks are not supported in version 3');
306
+ },
307
+ StartupHook: function () {
308
+ console.log('StartupHooks are not supported in version 3');
309
+ },
310
+ LoadHook: function () {
311
+ console.log('LoadHooks are not supported in version 3');
312
+ }
313
+ },
314
+ Config: function () {
315
+ console.log('MathJax configurations should be converted for version 3');
316
+ }
317
+ };
318
+ };
319
+
320
+ const initializeMathJax = callback => {
321
+ if (window.mathjaxLoadedP) {
322
+ return;
323
+ }
324
+
325
+ const PreviousMathJaxIsUsed = window.MathJax && window.MathJax.version && window.MathJax.version !== MathJaxVersion && window.MathJax.version[0] === '2';
326
+ const texConfig = {
327
+ macros: {
328
+ parallelogram: '\\lower.2em{\\Huge\\unicode{x25B1}}',
329
+ overarc: '\\overparen',
330
+ napprox: '\\not\\approx',
331
+ longdiv: '\\enclose{longdiv}'
332
+ },
333
+ displayMath: [['$$', '$$'], ['\\[', '\\]']]
334
+ };
335
+
336
+ if (PreviousMathJaxIsUsed) {
337
+ texConfig.autoload = {
338
+ color: [],
339
+ // don't autoload the color extension
340
+ colorv2: ['color'] // do autoload the colorv2 extension
341
+
342
+ };
343
+ } // Create a new promise that resolves when MathJax is ready
344
+
345
+
346
+ window.mathjaxLoadedP = new Promise(resolve => {
347
+ // Set up the MathJax configuration
348
+ window.MathJax = {
349
+ startup: {
350
+ //
351
+ // Mapping of old extension names to new ones
352
+ //
353
+ requireMap: PreviousMathJaxIsUsed ? {
354
+ AMSmath: 'ams',
355
+ AMSsymbols: 'ams',
356
+ AMScd: 'amscd',
357
+ HTML: 'html',
358
+ noErrors: 'noerrors',
359
+ noUndefined: 'noundefined'
360
+ } : {},
361
+ typeset: false,
362
+ ready: () => {
363
+ if (PreviousMathJaxIsUsed) {
364
+ convertMathJax2ToMathJax3();
365
+ }
366
+
367
+ const {
368
+ mathjax
369
+ } = MathJax._.mathjax;
370
+ const {
371
+ STATE
372
+ } = MathJax._.core.MathItem;
373
+ const {
374
+ Menu
375
+ } = MathJax._.ui.menu.Menu;
376
+ const rerender = Menu.prototype.rerender;
377
+
378
+ Menu.prototype.rerender = function (start = STATE.TYPESET) {
379
+ mathjax.handleRetriesFor(() => rerender.call(this, start));
380
+ };
381
+
382
+ MathJax.startup.defaultReady(); // Set the MathJax instance in the global object
383
+
384
+ const globalObj = getGlobal();
385
+ globalObj.instance = MathJax;
386
+ window.mathjaxLoadedComplete = true;
387
+ console.log('MathJax has initialised!', new Date().toString()); // in this file, initializeMathJax is called with a callback that has to be executed when MathJax was loaded
388
+
389
+ if (callback) {
390
+ callback();
391
+ } // but previous versions of math-rendering-accessible they're expecting window.mathjaxLoadedP to be a Promise, so we also keep the
392
+ // resolve here;
393
+
394
+
395
+ resolve();
396
+ }
397
+ },
398
+ loader: {
399
+ load: ['input/mml'],
400
+ // I just added preLoad: () => {} to prevent the console error: "MathJax.loader.preLoad is not a function",
401
+ // which is being called because in math-rendering-accessible/render-math we're having this line:
402
+ // import * as mr from '@pie-lib/math-rendering';
403
+ // which takes us to: import { AllPackages } from 'mathjax-full/js/input/tex/AllPackages';
404
+ // which tries to call MathJax.loader.preLoad.
405
+ // Understand that AllPackages is NOT needed in math-rendering-accessible, so it is not a problem if we hardcode this function.
406
+ // The better solution would be for math-rendering-accessible to import math-rendering only IF needed,
407
+ // but that's actually complicated and could cause other issues.
408
+ preLoad: () => {},
409
+ // function to call if a component fails to load
410
+ // eslint-disable-next-line no-console
411
+ failed: error => console.log(`MathJax(${error.package || '?'}): ${error.message}`)
412
+ },
413
+ tex: texConfig,
414
+ chtml: {
415
+ fontURL: 'https://unpkg.com/mathjax-full@3.2.2/ts/output/chtml/fonts/tex-woff-v2',
416
+ displayAlign: 'center'
417
+ },
418
+ customKey: '@pie-lib/math-rendering-accessible@1',
419
+ options: {
420
+ enableEnrichment: true,
421
+ sre: {
422
+ speech: 'deep'
423
+ },
424
+ menuOptions: {
425
+ settings: {
426
+ assistiveMml: true,
427
+ collapsible: false,
428
+ explorer: false
429
+ }
430
+ }
431
+ }
432
+ }; // Load the MathJax script
433
+
434
+ const script = document.createElement('script');
435
+ script.type = 'text/javascript';
436
+ script.src = `https://cdn.jsdelivr.net/npm/mathjax@${MathJaxVersion}/es5/tex-chtml-full.js`;
437
+ script.async = true;
438
+ document.head.appendChild(script); // at this time of the execution, there's no document.body; setTimeout does the trick
439
+
440
+ setTimeout(() => {
441
+ if (!window.mathjaxLoadedComplete) {
442
+ var _document, _document$body;
443
+
444
+ const mathElements = (_document = document) == null ? void 0 : (_document$body = _document.body) == null ? void 0 : _document$body.querySelectorAll('[data-latex]');
445
+ (mathElements || []).forEach(createPlaceholder);
446
+ }
447
+ });
448
+ });
449
+ };
450
+
451
+ const renderMath = (el, renderOpts) => {
452
+ const usedForMmlOutput = typeof el === 'string';
453
+ let executeOn = document.body;
454
+
455
+ if (!usedForMmlOutput) {
456
+ // If math-rendering was not available, then:
457
+ // If window.mathjaxLoadedComplete, it means that we initialised MathJax using the function from this file,
458
+ // and it means MathJax is successfully completed, so we can already use it
459
+ if (window.mathjaxLoadedComplete) {
460
+ renderContentsWithMathJax(el);
461
+ } else if (window.mathjaxLoadedP) {
462
+ // However, because there is a small chance that MathJax was initialised by a previous version of math-rendering-accessible,
463
+ // we need to keep the old handling method, which means adding the .then.catch on window.mathjaxLoadedP Promise.
464
+ // We still want to set window.mathjaxLoadedComplete, to prevent adding .then.catch after the first initialization
465
+ // (again, in case MathJax was initialised by a previous math-rendering-accessible version)
466
+ window.mathjaxLoadedP.then(() => {
467
+ window.mathjaxLoadedComplete = true;
468
+ renderContentsWithMathJax(el);
469
+ }).catch(error => console.error('Error in initializing MathJax:', error));
470
+ }
471
+ } else {
472
+ // Here we're handling the case when renderMath is being called for mmlOutput
473
+ if (window.MathJax && window.mathjaxLoadedP) {
474
+ const div = document.createElement('div');
475
+ div.innerHTML = el;
476
+ executeOn = div;
477
+
478
+ try {
479
+ MathJax.texReset();
480
+ MathJax.typesetClear();
481
+ window.MathJax.typeset([executeOn]);
482
+ const updatedDocument = window.MathJax.startup.document;
483
+ const list = updatedDocument.math.list;
484
+ const item = list.next;
485
+ const mathMl = toMMl(item.data.root);
486
+ const parsedMathMl = mathMl.replaceAll('\n', '');
487
+ return parsedMathMl;
488
+ } catch (error) {
489
+ console.error('Error rendering math:', error.message);
490
+ }
491
+
492
+ return el;
493
+ }
494
+
495
+ return el;
496
+ }
497
+ }; // this function calls itself
498
+
499
+
500
+ (function () {
501
+ initializeMathJax(renderContentWithMathJax);
502
+ window[mathRenderingKEY] = {
503
+ instance: {
504
+ Typeset: renderMath
505
+ }
506
+ };
507
+ })();
508
+
509
+ var mmlToLatex = (mathml => MathMLToLaTeX.convert(mathml));
510
+
511
+ export { mmlToLatex, renderMath, unWrapMath, wrapMath };
512
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../src/normalization.js","../src/render-math.js","../src/mml-to-latex.js"],"sourcesContent":["export const BracketTypes = {};\n\nBracketTypes.ROUND_BRACKETS = 'round_brackets';\nBracketTypes.SQUARE_BRACKETS = 'square_brackets';\nBracketTypes.DOLLAR = 'dollar';\nBracketTypes.DOUBLE_DOLLAR = 'double_dollar';\n\nconst PAIRS = {\n [BracketTypes.ROUND_BRACKETS]: ['\\\\(', '\\\\)'],\n [BracketTypes.SQUARE_BRACKETS]: ['\\\\[', '\\\\]'],\n [BracketTypes.DOLLAR]: ['$', '$'],\n [BracketTypes.DOUBLE_DOLLAR]: ['$$', '$$'],\n};\n\nexport const wrapMath = (content, wrapType) => {\n if (wrapType === BracketTypes.SQUARE_BRACKETS) {\n console.warn('\\\\[...\\\\] is not supported yet'); // eslint-disable-line\n wrapType = BracketTypes.ROUND_BRACKETS;\n }\n if (wrapType === BracketTypes.DOUBLE_DOLLAR) {\n console.warn('$$...$$ is not supported yet'); // eslint-disable-line\n wrapType = BracketTypes.DOLLAR;\n }\n\n const [start, end] = PAIRS[wrapType] || PAIRS[BracketTypes.ROUND_BRACKETS];\n return `${start}${content}${end}`;\n};\n\nexport const unWrapMath = (content) => {\n const displayStyleIndex = content.indexOf('\\\\displaystyle');\n if (displayStyleIndex !== -1) {\n console.warn('\\\\displaystyle is not supported - removing'); // eslint-disable-line\n content = content.replace('\\\\displaystyle', '').trim();\n }\n\n if (content.startsWith('$$') && content.endsWith('$$')) {\n console.warn('$$ syntax is not yet supported'); // eslint-disable-line\n return {\n unwrapped: content.substring(2, content.length - 2),\n wrapType: BracketTypes.DOLLAR,\n };\n }\n if (content.startsWith('$') && content.endsWith('$')) {\n return {\n unwrapped: content.substring(1, content.length - 1),\n wrapType: BracketTypes.DOLLAR,\n };\n }\n\n if (content.startsWith('\\\\[') && content.endsWith('\\\\]')) {\n console.warn('\\\\[..\\\\] syntax is not yet supported'); // eslint-disable-line\n return {\n unwrapped: content.substring(2, content.length - 2),\n wrapType: BracketTypes.ROUND_BRACKETS,\n };\n }\n\n if (content.startsWith('\\\\(') && content.endsWith('\\\\)')) {\n return {\n unwrapped: content.substring(2, content.length - 2),\n wrapType: BracketTypes.ROUND_BRACKETS,\n };\n }\n\n return {\n unwrapped: content,\n wrapType: BracketTypes.ROUND_BRACKETS,\n };\n};\n","import { wrapMath, unWrapMath } from './normalization';\nimport { SerializedMmlVisitor } from 'mathjax-full/js/core/MmlTree/SerializedMmlVisitor';\nimport TexError from 'mathjax-full/js/input/tex/TexError';\n\nconst visitor = new SerializedMmlVisitor();\nconst toMMl = (node) => visitor.visitTree(node);\n\nconst NEWLINE_BLOCK_REGEX = /\\\\embed\\{newLine\\}\\[\\]/g;\nconst NEWLINE_LATEX = '\\\\newline ';\n\nconst mathRenderingKEY = '@pie-lib/math-rendering@2';\nconst mathRenderingAccessibleKEY = '@pie-lib/math-rendering-accessible@1';\n\nexport const MathJaxVersion = '3.2.2';\n\nexport const getGlobal = () => {\n // TODO does it make sense to use version?\n // const key = `${pkg.name}@${pkg.version.split('.')[0]}`;\n // It looks like Ed made this change when he switched from mathjax3 to mathjax-full\n // I think it was supposed to make sure version 1 (using mathjax3) is not used\n // in combination with version 2 (using mathjax-full)\n // TODO higher level wrappers use this instance of math-rendering, and if 2 different instances are used, math rendering is not working\n // so I will hardcode this for now until a better solution is found\n if (typeof window !== 'undefined') {\n if (!window[mathRenderingAccessibleKEY]) {\n window[mathRenderingAccessibleKEY] = {};\n }\n return window[mathRenderingAccessibleKEY];\n } else {\n return {};\n }\n};\n\nexport const fixMathElement = (element) => {\n if (element.dataset.mathHandled) {\n return;\n }\n\n let property = 'innerText';\n\n if (element.textContent) {\n property = 'textContent';\n }\n\n if (element[property]) {\n element[property] = wrapMath(unWrapMath(element[property]).unwrapped);\n // because mathquill doesn't understand line breaks, sometimes we end up with custom elements on prompts/rationale/etc.\n // we need to replace the custom embedded elements with valid latex that Mathjax can understand\n element[property] = element[property].replace(NEWLINE_BLOCK_REGEX, NEWLINE_LATEX);\n element.dataset.mathHandled = true;\n }\n};\n\nexport const fixMathElements = (el = document) => {\n const mathElements = el.querySelectorAll('[data-latex]');\n\n mathElements.forEach((item) => fixMathElement(item));\n};\n\nconst adjustMathMLStyle = (el = document) => {\n const nodes = el.querySelectorAll('math');\n nodes.forEach((node) => node.setAttribute('displaystyle', 'true'));\n};\n\nconst createPlaceholder = (element) => {\n if (!element.previousSibling || !element.previousSibling.classList?.contains('math-placeholder')) {\n // Store the original display style before setting it to 'none'\n element.dataset.originalDisplay = element.style.display || '';\n element.style.display = 'none';\n\n const placeholder = document.createElement('span');\n placeholder.style.cssText =\n 'height: 10px; width: 50px; display: inline-block; vertical-align: middle; justify-content: center; background: #fafafa; border-radius: 4px;';\n placeholder.classList.add('math-placeholder');\n element.parentNode?.insertBefore(placeholder, element);\n }\n};\n\nconst removePlaceholdersAndRestoreDisplay = () => {\n document.querySelectorAll('.math-placeholder').forEach((placeholder) => {\n const targetElement = placeholder.nextElementSibling;\n\n if (targetElement && targetElement.dataset?.originalDisplay !== undefined) {\n targetElement.style.display = targetElement.dataset.originalDisplay;\n delete targetElement.dataset.originalDisplay;\n }\n\n placeholder.remove();\n });\n};\nconst removeExcessMjxContainers = (content) => {\n const elements = content.querySelectorAll('[data-latex][data-math-handled=\"true\"]');\n\n elements.forEach((element) => {\n const mjxContainers = element.querySelectorAll('mjx-container');\n\n // Check if there are more than one mjx-container children.\n if (mjxContainers.length > 1) {\n for (let i = 1; i < mjxContainers.length; i++) {\n mjxContainers[i].parentNode.removeChild(mjxContainers[i]);\n }\n }\n });\n};\n\nconst renderContentsWithMathJax = (el) => {\n // el sometimes is an array\n // renderMath is used like that in pie-print-support and pie-element-extensions\n // there seems to be no reason for that, however, it's better to handle the case here\n if (el instanceof Array) {\n el.forEach((elNode) => renderContentWithMathJax(elNode));\n } else {\n renderContentWithMathJax(el);\n }\n};\n\nconst renderContentWithMathJax = (executeOn) => {\n executeOn = executeOn || document.body;\n\n // this happens for charting - mark-label; we receive a ref which is not yet ready ( el = { current: null })\n // we have to fix this in charting\n if (!(executeOn instanceof HTMLElement)) return;\n\n fixMathElements(executeOn);\n adjustMathMLStyle(executeOn);\n\n const mathJaxInstance = getGlobal().instance;\n\n if (mathJaxInstance) {\n // Reset and clear typesetting before processing the new content\n // Reset the tex labels (and automatic equation number).\n\n mathJaxInstance.texReset();\n\n // Reset the typesetting system (font caches, etc.)\n mathJaxInstance.typesetClear();\n\n // Use typesetPromise for asynchronous typesetting\n // Using MathJax.typesetPromise() for asynchronous typesetting to handle situations where additional code needs to be loaded (e.g., for certain TeX commands or characters).\n // This ensures typesetting waits for any needed resources to load and complete processing, unlike the synchronous MathJax.typeset() which can't handle such dynamic loading.\n mathJaxInstance\n .typesetPromise([executeOn])\n .then(() => {\n try {\n removePlaceholdersAndRestoreDisplay();\n removeExcessMjxContainers(executeOn);\n\n const updatedDocument = mathJaxInstance.startup.document;\n const list = updatedDocument.math.list;\n\n for (let item = list.next; typeof item.data !== 'symbol'; item = item.next) {\n const mathMl = toMMl(item.data.root);\n const parsedMathMl = mathMl.replaceAll('\\n', '');\n\n item.data.typesetRoot.setAttribute('data-mathml', parsedMathMl);\n item.data.typesetRoot.setAttribute('tabindex', '-1');\n }\n\n // If the original input was a string, return the parsed MathML\n } catch (e) {\n console.error('Error post-processing MathJax typesetting:', e.toString());\n }\n\n // Clearing the document if needed\n mathJaxInstance.startup.document.clear();\n })\n .catch((error) => {\n // If there was an internal error, put the message into the output instead\n\n console.error('Error in typesetting with MathJax:', error);\n });\n }\n};\n\nconst convertMathJax2ToMathJax3 = () => {\n // Make MathJax v2 compatible with v3\n // https://docs.mathjax.org/en/v3.2-latest/upgrading/v2.html#version-2-compatibility-example\n // Replace the require command map with a new one that checks for\n // renamed extensions and converts them to the new names.\n const CommandMap = MathJax._.input.tex.SymbolMap.CommandMap;\n const requireMap = MathJax.config.startup.requireMap;\n const RequireLoad = MathJax._.input.tex.require.RequireConfiguration.RequireLoad;\n const RequireMethods = {\n Require: function(parser, name) {\n let required = parser.GetArgument(name);\n if (required.match(/[^_a-zA-Z0-9]/) || required === '') {\n throw new TexError('BadPackageName', 'Argument for %1 is not a valid package name', name);\n }\n if (requireMap.hasOwnProperty(required)) {\n required = requireMap[required];\n }\n RequireLoad(parser, required);\n },\n };\n\n new CommandMap('require', { require: 'Require' }, RequireMethods);\n\n //\n // Add a replacement for MathJax.Callback command\n //\n MathJax.Callback = function(args) {\n if (Array.isArray(args)) {\n if (args.length === 1 && typeof args[0] === 'function') {\n return args[0];\n } else if (typeof args[0] === 'string' && args[1] instanceof Object && typeof args[1][args[0]] === 'function') {\n return Function.bind.apply(args[1][args[0]], args.slice(1));\n } else if (typeof args[0] === 'function') {\n return Function.bind.apply(args[0], [window].concat(args.slice(1)));\n } else if (typeof args[1] === 'function') {\n return Function.bind.apply(args[1], [args[0]].concat(args.slice(2)));\n }\n } else if (typeof args === 'function') {\n return args;\n }\n throw Error(\"Can't make callback from given data\");\n };\n\n //\n // Add a replacement for MathJax.Hub commands\n //\n MathJax.Hub = {\n Queue: function() {\n for (let i = 0, m = arguments.length; i < m; i++) {\n const fn = MathJax.Callback(arguments[i]);\n MathJax.startup.promise = MathJax.startup.promise.then(fn);\n }\n return MathJax.startup.promise;\n },\n Typeset: function(elements, callback) {\n let promise = MathJax.typesetPromise(elements);\n\n if (callback) {\n promise = promise.then(callback);\n }\n return promise;\n },\n Register: {\n MessageHook: function() {\n console.log('MessageHooks are not supported in version 3');\n },\n StartupHook: function() {\n console.log('StartupHooks are not supported in version 3');\n },\n LoadHook: function() {\n console.log('LoadHooks are not supported in version 3');\n },\n },\n Config: function() {\n console.log('MathJax configurations should be converted for version 3');\n },\n };\n};\nexport const initializeMathJax = (callback) => {\n if (window.mathjaxLoadedP) {\n return;\n }\n\n const PreviousMathJaxIsUsed =\n window.MathJax &&\n window.MathJax.version &&\n window.MathJax.version !== MathJaxVersion &&\n window.MathJax.version[0] === '2';\n\n const texConfig = {\n macros: {\n parallelogram: '\\\\lower.2em{\\\\Huge\\\\unicode{x25B1}}',\n overarc: '\\\\overparen',\n napprox: '\\\\not\\\\approx',\n longdiv: '\\\\enclose{longdiv}',\n },\n displayMath: [\n ['$$', '$$'],\n ['\\\\[', '\\\\]'],\n ],\n };\n\n if (PreviousMathJaxIsUsed) {\n texConfig.autoload = {\n color: [], // don't autoload the color extension\n colorv2: ['color'], // do autoload the colorv2 extension\n };\n }\n\n // Create a new promise that resolves when MathJax is ready\n window.mathjaxLoadedP = new Promise((resolve) => {\n // Set up the MathJax configuration\n window.MathJax = {\n startup: {\n //\n // Mapping of old extension names to new ones\n //\n requireMap: PreviousMathJaxIsUsed\n ? {\n AMSmath: 'ams',\n AMSsymbols: 'ams',\n AMScd: 'amscd',\n HTML: 'html',\n noErrors: 'noerrors',\n noUndefined: 'noundefined',\n }\n : {},\n typeset: false,\n ready: () => {\n if (PreviousMathJaxIsUsed) {\n convertMathJax2ToMathJax3();\n }\n\n const { mathjax } = MathJax._.mathjax;\n const { STATE } = MathJax._.core.MathItem;\n const { Menu } = MathJax._.ui.menu.Menu;\n const rerender = Menu.prototype.rerender;\n Menu.prototype.rerender = function(start = STATE.TYPESET) {\n mathjax.handleRetriesFor(() => rerender.call(this, start));\n };\n MathJax.startup.defaultReady();\n // Set the MathJax instance in the global object\n\n const globalObj = getGlobal();\n globalObj.instance = MathJax;\n\n window.mathjaxLoadedComplete = true;\n console.log('MathJax has initialised!', new Date().toString());\n\n // in this file, initializeMathJax is called with a callback that has to be executed when MathJax was loaded\n if (callback) {\n callback();\n }\n\n // but previous versions of math-rendering-accessible they're expecting window.mathjaxLoadedP to be a Promise, so we also keep the\n // resolve here;\n resolve();\n },\n },\n loader: {\n load: ['input/mml'],\n // I just added preLoad: () => {} to prevent the console error: \"MathJax.loader.preLoad is not a function\",\n // which is being called because in math-rendering-accessible/render-math we're having this line:\n // import * as mr from '@pie-lib/math-rendering';\n // which takes us to: import { AllPackages } from 'mathjax-full/js/input/tex/AllPackages';\n // which tries to call MathJax.loader.preLoad.\n // Understand that AllPackages is NOT needed in math-rendering-accessible, so it is not a problem if we hardcode this function.\n // The better solution would be for math-rendering-accessible to import math-rendering only IF needed,\n // but that's actually complicated and could cause other issues.\n preLoad: () => {},\n // function to call if a component fails to load\n // eslint-disable-next-line no-console\n failed: (error) => console.log(`MathJax(${error.package || '?'}): ${error.message}`),\n },\n tex: texConfig,\n chtml: {\n fontURL: 'https://unpkg.com/mathjax-full@3.2.2/ts/output/chtml/fonts/tex-woff-v2',\n displayAlign: 'center',\n },\n customKey: '@pie-lib/math-rendering-accessible@1',\n options: {\n enableEnrichment: true,\n sre: {\n speech: 'deep',\n },\n menuOptions: {\n settings: {\n assistiveMml: true,\n collapsible: false,\n explorer: false,\n },\n },\n },\n };\n // Load the MathJax script\n const script = document.createElement('script');\n script.type = 'text/javascript';\n script.src = `https://cdn.jsdelivr.net/npm/mathjax@${MathJaxVersion}/es5/tex-chtml-full.js`;\n script.async = true;\n document.head.appendChild(script);\n\n // at this time of the execution, there's no document.body; setTimeout does the trick\n setTimeout(() => {\n if (!window.mathjaxLoadedComplete) {\n const mathElements = document?.body?.querySelectorAll('[data-latex]');\n (mathElements || []).forEach(createPlaceholder);\n }\n });\n });\n};\n\nconst renderMath = (el, renderOpts) => {\n const usedForMmlOutput = typeof el === 'string';\n let executeOn = document.body;\n\n if (!usedForMmlOutput) {\n // If math-rendering was not available, then:\n // If window.mathjaxLoadedComplete, it means that we initialised MathJax using the function from this file,\n // and it means MathJax is successfully completed, so we can already use it\n if (window.mathjaxLoadedComplete) {\n renderContentsWithMathJax(el);\n } else if (window.mathjaxLoadedP) {\n // However, because there is a small chance that MathJax was initialised by a previous version of math-rendering-accessible,\n // we need to keep the old handling method, which means adding the .then.catch on window.mathjaxLoadedP Promise.\n // We still want to set window.mathjaxLoadedComplete, to prevent adding .then.catch after the first initialization\n // (again, in case MathJax was initialised by a previous math-rendering-accessible version)\n window.mathjaxLoadedP\n .then(() => {\n window.mathjaxLoadedComplete = true;\n renderContentsWithMathJax(el);\n })\n .catch((error) => console.error('Error in initializing MathJax:', error));\n }\n } else {\n // Here we're handling the case when renderMath is being called for mmlOutput\n if (window.MathJax && window.mathjaxLoadedP) {\n const div = document.createElement('div');\n\n div.innerHTML = el;\n executeOn = div;\n\n try {\n MathJax.texReset();\n MathJax.typesetClear();\n window.MathJax.typeset([executeOn]);\n const updatedDocument = window.MathJax.startup.document;\n const list = updatedDocument.math.list;\n const item = list.next;\n const mathMl = toMMl(item.data.root);\n\n const parsedMathMl = mathMl.replaceAll('\\n', '');\n\n return parsedMathMl;\n } catch (error) {\n console.error('Error rendering math:', error.message);\n }\n\n return el;\n }\n\n return el;\n }\n};\n\n// this function calls itself\n(function() {\n initializeMathJax(renderContentWithMathJax);\n\n window[mathRenderingKEY] = {\n instance: {\n Typeset: renderMath,\n },\n };\n})();\n\nexport default renderMath;\n","import { MathMLToLaTeX } from '@pie-framework/mathml-to-latex';\nexport default (mathml) => MathMLToLaTeX.convert(mathml);\n"],"names":["BracketTypes","ROUND_BRACKETS","SQUARE_BRACKETS","DOLLAR","DOUBLE_DOLLAR","PAIRS","wrapMath","content","wrapType","console","warn","start","end","unWrapMath","displayStyleIndex","indexOf","replace","trim","startsWith","endsWith","unwrapped","substring","length","visitor","SerializedMmlVisitor","toMMl","node","visitTree","NEWLINE_BLOCK_REGEX","NEWLINE_LATEX","mathRenderingKEY","mathRenderingAccessibleKEY","MathJaxVersion","getGlobal","window","fixMathElement","element","dataset","mathHandled","property","textContent","fixMathElements","el","document","mathElements","querySelectorAll","forEach","item","adjustMathMLStyle","nodes","setAttribute","createPlaceholder","previousSibling","classList","contains","originalDisplay","style","display","placeholder","createElement","cssText","add","parentNode","insertBefore","removePlaceholdersAndRestoreDisplay","targetElement","nextElementSibling","undefined","remove","removeExcessMjxContainers","elements","mjxContainers","i","removeChild","renderContentsWithMathJax","Array","elNode","renderContentWithMathJax","executeOn","body","HTMLElement","mathJaxInstance","instance","texReset","typesetClear","typesetPromise","then","updatedDocument","startup","list","math","next","data","mathMl","root","parsedMathMl","replaceAll","typesetRoot","e","error","toString","clear","catch","convertMathJax2ToMathJax3","CommandMap","MathJax","_","input","tex","SymbolMap","requireMap","config","RequireLoad","require","RequireConfiguration","RequireMethods","Require","parser","name","required","GetArgument","match","TexError","hasOwnProperty","Callback","args","isArray","Object","Function","bind","apply","slice","concat","Error","Hub","Queue","m","arguments","fn","promise","Typeset","callback","Register","MessageHook","log","StartupHook","LoadHook","Config","initializeMathJax","mathjaxLoadedP","PreviousMathJaxIsUsed","version","texConfig","macros","parallelogram","overarc","napprox","longdiv","displayMath","autoload","color","colorv2","Promise","resolve","AMSmath","AMSsymbols","AMScd","HTML","noErrors","noUndefined","typeset","ready","mathjax","STATE","core","MathItem","Menu","ui","menu","rerender","prototype","TYPESET","handleRetriesFor","call","defaultReady","globalObj","mathjaxLoadedComplete","Date","loader","load","preLoad","failed","package","message","chtml","fontURL","displayAlign","customKey","options","enableEnrichment","sre","speech","menuOptions","settings","assistiveMml","collapsible","explorer","script","type","src","async","head","appendChild","setTimeout","renderMath","renderOpts","usedForMmlOutput","div","innerHTML","mathml","MathMLToLaTeX","convert"],"mappings":";;;;AAAO,MAAMA,YAAY,GAAG,EAArB;AAEPA,YAAY,CAACC,cAAb,GAA8B,gBAA9B;AACAD,YAAY,CAACE,eAAb,GAA+B,iBAA/B;AACAF,YAAY,CAACG,MAAb,GAAsB,QAAtB;AACAH,YAAY,CAACI,aAAb,GAA6B,eAA7B;AAEA,MAAMC,KAAK,GAAG;AACZ,EAAA,CAACL,YAAY,CAACC,cAAd,GAA+B,CAAC,KAAD,EAAQ,KAAR,CADnB;AAEZ,EAAA,CAACD,YAAY,CAACE,eAAd,GAAgC,CAAC,KAAD,EAAQ,KAAR,CAFpB;AAGZ,EAAA,CAACF,YAAY,CAACG,MAAd,GAAuB,CAAC,GAAD,EAAM,GAAN,CAHX;AAI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AAP,CAAeiE,OAAf,CAAuB,CAAC5F,SAAD,CAAvB,CAAA;AACA,QAAA,MAAMS,eAAe,GAAGrD,MAAM,CAACuE,OAAP,CAAejB,OAAf,CAAuB7C,QAA/C;AACA,QAAA,MAAM8C,IAAI,GAAGF,eAAe,CAACG,IAAhB,CAAqBD,IAAlC;AACA,QAAA,MAAM1C,IAAI,GAAG0C,IAAI,CAACE,IAAlB;AACA,QAAA,MAAME,MAAM,GAAGpE,KAAK,CAACsB,IAAI,CAAC6C,IAAL,CAAUE,IAAX,CAApB;AAEA,QAAA,MAAMC,YAAY,GAAGF,MAAM,CAACG,UAAP,CAAkB,IAAlB,EAAwB,EAAxB,CAArB;AAEA,QAAA,OAAOD,YAAP;AACD,MAAA,CAZD,CAYE,OAAOI,KAAP,EAAc;AACd1F,QAAAA,OAAO,CAAC0F,KAAR,CAAc,uBAAd,EAAuCA,KAAK,CAAC8F,OAA7C,CAAA;AACD,MAAA;;AAED,MAAA,OAAOvJ,EAAP;AACD,IAAA;;AAED,IAAA,OAAOA,EAAP;AACD,EAAA;AACF;;;AAGD,CAAC,YAAW;AACV0G,EAAAA,iBAAiB,CAACvE,wBAAD,CAAjB;AAEA3C,EAAAA,MAAM,CAACJ,gBAAD,CAAN,GAA2B;AACzBoD,IAAAA,QAAQ,EAAE;AACR0D,MAAAA,OAAO,EAAE0E;AADD;AADe,GAA3B;AAKD,CARD,GAAA;;ACtbA,iBAAA,CAAgBK,MAAD,IAAYC,aAAa,CAACC,OAAd,CAAsBF,MAAtB,CAA3B;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pie-lib/math-rendering-accessible",
3
- "version": "3.18.1-next.0+a5d1550f",
3
+ "version": "3.19.2",
4
4
  "description": "math rendering utilities",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -11,7 +11,7 @@
11
11
  "license": "ISC",
12
12
  "dependencies": {
13
13
  "@pie-framework/mathml-to-latex": "1.4.4",
14
- "@pie-lib/math-rendering": "^3.18.1-next.0+a5d1550f",
14
+ "@pie-lib/math-rendering": "^3.19.2",
15
15
  "debug": "^4.1.1",
16
16
  "lodash": "^4.17.11",
17
17
  "mathjax-full": "3.2.2",
@@ -19,6 +19,13 @@
19
19
  "react": "^16.8.1",
20
20
  "slate": "^0.36.2"
21
21
  },
22
- "gitHead": "a5d1550faec7e27c8824e5aa4b4ef29ad4ee525a",
23
- "scripts": {}
22
+ "gitHead": "8a327571bd64249e4c88c0c8e750d16d6213f535",
23
+ "scripts": {},
24
+ "exports": {
25
+ ".": {
26
+ "import": "./esm/index.js",
27
+ "require": "./lib/index.js",
28
+ "default": "./esm/index.js"
29
+ }
30
+ }
24
31
  }
package/LICENSE.md DELETED
@@ -1,5 +0,0 @@
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.