Socket
Socket
Sign inDemoInstall

mathlive

Package Overview
Dependencies
0
Maintainers
1
Versions
170
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.59.0 to 0.60.0

dist/sounds/keypress-delete.wav

28

dist/public/commands.d.ts

@@ -1,4 +0,4 @@

/* 0.59.0 */ import type { Keys } from './types-utils';
/* 0.60.0 */ import type { Keys } from './types-utils';
import type { ParseMode, Style } from './core';
import type { Mathfield, Model } from './mathfield';
import type { InsertOptions, Mathfield, Model, VirtualKeyboardInterface } from './mathfield';
/**

@@ -72,9 +72,5 @@ * How much of the formula should be spoken:

scrollToEnd: (mathfield: Mathfield) => boolean;
/**
* @deprecated The command mode will be dropped in a future release.
*/
enterCommandMode: (mathfield: Mathfield) => boolean;
toggleKeystrokeCaption: (mathfield: Mathfield) => boolean;
switchMode: (mathfield: Mathfield, mode: ParseMode) => boolean;
insert: (mathfield: Mathfield, s: string, options: any) => boolean;
insert: (mathfield: Mathfield, s: string, options: InsertOptions) => boolean;
typedText: (text: string, options: {

@@ -122,7 +118,7 @@ /** If true, the mathfield will be focused */

*/
deleteNextChar: (model: Model) => boolean;
deleteForward: (model: Model) => boolean;
/**
* @category Deleting
*/
deletePreviousChar: (model: Model) => boolean;
deleteBackward: (model: Model) => boolean;
/**

@@ -231,7 +227,7 @@ * @category Deleting

*/
extendToNextChar: (model: Model) => boolean;
extendSelectionForward: (model: Model) => boolean;
/**
* @category Selection
*/
extendToPreviousChar: (model: Model) => boolean;
extendSelectionBackward: (model: Model) => boolean;
/**

@@ -248,7 +244,7 @@ * @category Selection

*/
extendUp: (model: Model) => boolean;
extendSelectionUpward: (model: Model) => boolean;
/**
* @category Selection
*/
extendDown: (model: Model) => boolean;
extendSelectionDownward: (model: Model) => boolean;
/**

@@ -282,12 +278,12 @@ * @category Selection

*/
toggleVirtualKeyboard: (mathfield: Mathfield, theme: 'apple' | 'material' | '') => boolean;
toggleVirtualKeyboard: (keyboard: VirtualKeyboardInterface, theme: 'apple' | 'material' | '') => boolean;
/**
* @category Virtual Keyboard
*/
hideVirtualKeyboard: (mathfield: Mathfield) => boolean;
hideVirtualKeyboard: (keyboard: VirtualKeyboardInterface) => boolean;
/**
* @category Virtual Keyboard
*/
showVirtualKeyboard: (mathfield: Mathfield, theme: 'apple' | 'material' | '') => boolean;
showVirtualKeyboard: (keyboard: VirtualKeyboardInterface, theme: 'apple' | 'material' | '') => boolean;
}
export declare type Selector = Keys<Commands>;

@@ -1,6 +0,6 @@

/* 0.59.0 */ /**
/* 0.60.0 */ /**
* The mode that indicates how a portion of content is interpreted
*
*/
export declare type ParseMode = 'math' | 'text' | 'command' | 'chem';
export declare type ParseMode = 'math' | 'text' | 'latex';
/**

@@ -89,3 +89,2 @@ * Error code passed to the [[`ErrorListener`]] function.

export interface Style {
mode?: ParseMode | string;
color?: string;

@@ -99,5 +98,2 @@ backgroundColor?: string;

fontSize?: string;
cssId?: string;
cssClass?: string;
isPhantom?: boolean;
letterShapeStyle?: 'tex' | 'french' | 'iso' | 'upright' | 'auto';

@@ -133,4 +129,2 @@ }

*/
export declare type MacroDictionary = {
[name: string]: string | MacroDefinition;
};
export declare type MacroDictionary = Record<string, string | MacroDefinition>;

@@ -1,4 +0,4 @@

/* 0.59.0 */ import { MathfieldOptions } from './options';
/* 0.60.0 */ import { MathfieldOptions } from './options';
import { Selector } from './commands';
import { InsertOptions, Mathfield, OutputFormat, Range } from './mathfield';
import { Mathfield, InsertOptions, OutputFormat, Offset, Range, Selection, FindOptions, ReplacementFunction } from './mathfield';
import { MathfieldErrorCode, ParseMode, ParserErrorCode, Style } from './core';

@@ -73,2 +73,181 @@ /**

/**
* These attributes of the `<math-field>` element correspond to the
* [MathfieldOptions] properties.
*/
export interface MathfieldElementAttributes {
[key: string]: number | string | boolean | undefined;
'default-mode': string;
'fonts-directory': string;
/**
* Scaling factor to be applied to horizontal spacing between elements of
* the formula. A value greater than 1.0 can be used to improve the
* legibility.
*
*/
'horizontal-spacing-scale': string;
/**
* Maximum time, in milliseconds, between consecutive characters for them to be
* considered part of the same shortcut sequence.
*
* A value of 0 is the same as infinity: any consecutive character will be
* candidate for an inline shortcut, regardless of the interval between this
* character and the previous one.
*
* A value of 750 will indicate that the maximum interval between two
* characters to be considered part of the same inline shortcut sequence is
* 3/4 of a second.
*
* This is useful to enter "+-" as a sequence of two characters, while also
* supporting the "±" shortcut with the same sequence.
*
* The first result can be entered by pausing slightly between the first and
* second character if this option is set to a value of 250 or so.
*
* Note that some operations, such as clicking to change the selection, or
* losing the focus on the mathfield, will automatically timeout the
* shortcuts.
*/
'inline-shortcut-timeout': string;
'keypress-vibration': boolean;
'letter-shape-style': string;
/**
* The locale (language + region) to use for string localization.
*
* If none is provided, the locale of the browser is used.
*
*/
'locale': string;
/** When true, the user cannot edit the mathfield. */
'read-only': boolean;
'remove-extraneous-parentheses': boolean;
/**
* When `true` and an open fence is entered via `typedText()` it will
* generate a contextually appropriate markup, for example using
* `\left...\right` if applicable.
*
* When `false`, the literal value of the character will be inserted instead.
*/
'smart-fence': boolean;
/**
* When true, during text input the field will switch automatically between
* 'math' and 'text' mode depending on what is typed and the context of the
* formula. If necessary, what was previously typed will be 'fixed' to
* account for the new info.
*
* For example, when typing "if x >0":
*
* | Type | Interpretation |
* |---:|:---|
* | "i" | math mode, imaginary unit |
* | "if" | text mode, english word "if" |
* | "if x" | all in text mode, maybe the next word is xylophone? |
* | "if x >" | "if" stays in text mode, but now "x >" is in math mode |
* | "if x > 0" | "if" in text mode, "x > 0" in math mode |
*
* Smart Mode is off by default.
*
* Manually switching mode (by typing `alt/option+=`) will temporarily turn
* off smart mode.
*
*
* **Examples**
*
* - slope = rise/run
* - If x > 0, then f(x) = sin(x)
* - x^2 + sin (x) when x > 0
* - When x<0, x^{2n+1}<0
* - Graph x^2 -x+3 =0 for 0<=x<=5
* - Divide by x-3 and then add x^2-1 to both sides
* - Given g(x) = 4x – 3, when does g(x)=0?
* - Let D be the set {(x,y)|0<=x<=1 and 0<=y<=x}
* - \int\_{the unit square} f(x,y) dx dy
* - For all n in NN
*
*/
'smart-mode': boolean;
/**
* When `true`, when a digit is entered in an empty superscript, the cursor
* leaps automatically out of the superscript. This makes entry of common
* polynomials easier and faster. If entering other characters (for example
* "n+1") the navigation out of the superscript must be done manually (by
* using the cursor keys or the spacebar to leap to the next insertion
* point).
*
* When `false`, the navigation out of the superscript must always be done
* manually.
*
*/
'smart-superscript': boolean;
'speech-engine': string;
'speech-engine-rate': string;
'speech-engine-voice': string;
'text-to-speech-markup': string;
'text-to-speech-rules': string;
'virtual-keyboard-layout': string;
/**
* - `'manual'`: pressing the virtual keyboard toggle button will show or hide
* the virtual keyboard. If hidden, the virtual keyboard is not shown when
* the field is focused until the toggle button is pressed.
* - `'onfocus'`: the virtual keyboard will be displayed whenever the field is
* focused and hidden when the field loses focus. In that case, the virtual
* keyboard toggle button is not displayed.
* - `'off'`: the virtual keyboard toggle button is not displayed, and the
* virtual keyboard is never triggered.
*
* If the setting is empty, it will default to `'onfocus'` on touch-capable
* devices and to `'off'` otherwise.
*
*/
'virtual-keyboard-mode': 'auto' | 'manual' | 'onfocus' | 'off';
/**
* The visual theme used for the virtual keyboard.
*
* If empty, the theme will switch automatically based on the device it's
* running on. The two supported themes are 'material' and 'apple' (the
* default).
*/
'virtual-keyboard-theme': string;
/**
* A space separated list of the keyboards that should be available. The
* keyboard `'all'` is synonym with `'numeric'`, `'functions'``, `'symbols'``
* `'roman'` and `'greek'`,
*
* The keyboards will be displayed in the order indicated.
*/
'virtual-keyboards': 'all' | 'numeric' | 'roman' | 'greek' | 'functions' | 'symbols' | 'latex' | string;
/**
* When true, use a shared virtual keyboard for all the mathfield
* elements in the page, even across iframes.
*
* When setting this option to true, you must create the shared
* virtual keyboard in the the parent document:
*
* ```javascript
* import { makeSharedVirtualKeyboard } from 'mathlive';
*
* makeSharedVirtualKeyboard({
* virtualKeyboardToolbar: 'none',
* });
* ```
*
* **Default**: `false`
*/
'use-shared-virtual-keyboard': boolean;
/**
* Specify the `targetOrigin` parameter for
* [postMessage](https://developer.mozilla.org/en/docs/Web/API/Window/postMessage)
* to send control messages from child to parent frame to remote control
* of mathfield component.
*
* **Default**: `window.origin`
*/
'shared-virtual-keyboard-target-origin': string;
/**
* The Latex string to insert when the spacebar is pressed (on the physical or
* virtual keyboard). Empty by default. Use `\;` for a thick space, `\:` for
* a medium space, `\,` for a thin space.
*/
'math-mode-space': string;
}
/**
* The `MathfieldElement` class provides special properties and

@@ -172,4 +351,4 @@ * methods to control the display and behavior of `<math-field>`

* | `fonts-directory` | `options.fontsDirectory` |
* | `sounds-directory` | `options.soundsDirectory` |
* | `horizontal-spacing-scale` | `options.horizontalSpacingScale` |
* | `ignore-spacebar-in-math-mode` | `options.ignoreSpacbarInMathMode` |
* | `inline-shortcut-timeout` | `options.inlineShortcutTimeout` |

@@ -179,2 +358,3 @@ * | `keypress-vibration` | `options.keypressVibration` |

* | `locale` | `options.locale` |
* | `math-mode-space` | `options.mathModeSpace` |
* | `read-only` | `options.readOnly` |

@@ -233,3 +413,2 @@ * | `remove-extraneous-parentheses` | `options.removeExtraneousParentheses` |

export declare class MathfieldElement extends HTMLElement implements Mathfield {
#private;
/**

@@ -239,5 +418,3 @@ * Private lifecycle hooks

*/
static get optionsAttributes(): {
[attribute: string]: 'number' | 'boolean' | 'string';
};
static get optionsAttributes(): Record<string, 'number' | 'boolean' | 'string'>;
/**

@@ -248,18 +425,19 @@ * Custom elements lifecycle hooks

static get observedAttributes(): string[];
private _mathfield;
/**
* To create programmatically a new mahfield use:
* ```javascript
let mfe = new MathfieldElement();
// Set initial value and options
mfe.value = "\\frac{\\sin(x)}{\\cos(x)}";
// Options can be set either as an attribute (for simple options)...
mfe.setAttribute('virtual-keyboard-layout', 'dvorak');
// ... or using `setOptions()`
mfe.setOptions({
virtualKeyboardMode: 'manual',
});
// Attach the element to the DOM
document.body.appendChild(mfe);
* ```
*/
* To create programmatically a new mahfield use:
* ```javascript
let mfe = new MathfieldElement();
// Set initial value and options
mfe.value = "\\frac{\\sin(x)}{\\cos(x)}";
// Options can be set either as an attribute (for simple options)...
mfe.setAttribute('virtual-keyboard-layout', 'dvorak');
// ... or using `setOptions()`
mfe.setOptions({
virtualKeyboardMode: 'manual',
});
// Attach the element to the DOM
document.body.appendChild(mfe);
* ```
*/
constructor(options?: Partial<MathfieldOptions>);

@@ -304,5 +482,5 @@ get mode(): ParseMode;

getValue(format?: OutputFormat): string;
getValue(start: number, end?: number, format?: OutputFormat): string;
getValue(start: Offset, end: Offset, format?: OutputFormat): string;
getValue(range: Range, format?: OutputFormat): string;
getValue(ranges: Range[], format?: OutputFormat): string;
getValue(selection: Selection, format?: OutputFormat): string;
/**

@@ -356,15 +534,24 @@ * @category Accessing and changing the content

*
* If there is a selection, the style is applied to the selection
* If there is no selection and no range is specified, the style will
* apply to the next character typed.
*
* If the selection already has this style, it is removed.
* If a range is specified, the style is applied to the range, otherwise,
* if there is a selection, the style is applied to the selection.
*
* If the selection has the style partially applied (i.e. only some
* sections), it is removed from those sections, and applied to the
* entire selection.
* If the operation is 'toggle' and the range already has this style,
* remove it. If the range
* has the style partially applied (i.e. only some sections), remove it from
* those sections, and apply it to the entire range.
*
* If there is no selection, the style will apply to the next character typed.
* If the operation is 'set', the style is applied to the range,
* whether it already has the style or not.
*
* The default operation is 'set'.
*
* @category Accessing and changing the content
*/
applyStyle(style: Style): void;
applyStyle(style: Style, options?: Range | {
range?: Range;
operation?: 'set' | 'toggle';
}): void;
/**

@@ -400,4 +587,13 @@ * The bottom location of the caret (insertion point) in viewport

*/
find(latex: string): Range[];
find(pattern: string | RegExp, options?: FindOptions): Range[];
/**
* Replace the pattern items matching the **pattern** with the
* **replacement** value.
*
* If **replacement** is a function, the function is called
* for each match and the function return value will be
* used as the replacement.
*/
replace(pattern: string | RegExp, replacement: string | ReplacementFunction, options?: FindOptions): void;
/**
* Custom elements lifecycle hooks

@@ -422,9 +618,5 @@ * @internal

attributeChangedCallback(name: string, oldValue: unknown, newValue: unknown): void;
get disabled(): boolean;
set disabled(value: boolean);
get disabled(): boolean;
/**
* @category Accessing and changing the content
*/
set value(value: string);
/**
* The content of the mathfield as a Latex expression.

@@ -438,2 +630,6 @@ * ```

/**
* @category Accessing and changing the content
*/
set value(value: string);
/**
* An array of ranges representing the selection.

@@ -447,3 +643,3 @@ *

*/
get selection(): Range[];
get selection(): Selection;
/**

@@ -453,5 +649,5 @@ *

*/
set selection(value: Range[]);
set selection(value: Selection);
/**
* The position of the caret/insertion point, from 0 to `lastPosition`.
* The position of the caret/insertion point, from 0 to `lastOffset`.
*

@@ -461,12 +657,12 @@ * @category Selection

*/
get position(): number;
get position(): Offset;
/**
* @category Selection
*/
set position(value: number);
set position(offset: Offset);
/**
* The last valid position.
* The last valid offset.
* @category Selection
*/
get lastPosition(): number;
get lastOffset(): Offset;
}

@@ -479,2 +675,7 @@ export default MathfieldElement;

}
namespace JSX {
interface IntrinsicElements {
'math-field': MathfieldElementAttributes;
}
}
}

@@ -1,53 +0,5 @@

/* 0.59.0 */ import { Selector } from './commands';
import { MathfieldOptions } from './options';
/* 0.60.0 */ import { Selector } from './commands';
import { CoreOptions, MathfieldOptions, VirtualKeyboardOptions } from './options';
import { ParseMode, MacroDictionary, Style } from './core';
/**
* A pair of boundary points that can be used to denote a fragment of an
* expression such as the selection.
*
* A range can be collapsed (empty) in which case it points to a single
* location in an expression and its content is empty.
*
* A range can also have a direction. While many operations are insensitive
* to the direction, a few are. For example, when selecting a fragment of an
* expression from left to right, the direction of this range will be "forward".
* Pressing the left arrow key will sets the insertion at the start of the range.
* Conversely, if the selectionis made from right to left, the direction is
* "backward" and pressing the left arrow key will set the insertion point at
* the end of the range.
*
* **See Also**
* * [[`selection`]]
*/
export interface Range {
/**
* An offset indicating where the range starts.
*
* 0 is the first possible offset.
*/
start: number;
/**
* An offset indicating where the range ends.
*
* `end` should be greater than or equal to `start`
*/
end?: number;
/**
*
*/
direction?: 'forward' | 'backward' | 'none';
/**
* True when `start === end`, that is an empty range with no content, a single
* insertion point.
*/
collapsed?: boolean;
/**
* The depth of the common ancestor of the start and end offsets.
*
* Depth starts at 0 and increase for each fraction, root, superscript
* and subscript.
*/
depth?: number;
}
/**
* | Format | Description |

@@ -69,22 +21,22 @@ | :------------------ | :---------------------- |

/**
* The format of the input string:
*
| <!-- --> | <!-- --> |
|:------------|:------------|
|`"auto"`| The string is Latex fragment or command) (default)|
|`"latex"`| The string is a Latex fragment|
*
*/
format?: string;
* The format of the input string:
*
| <!-- --> | <!-- --> |
|:------------|:------------|
|`"auto"`| The string is Latex fragment or command) (default)|
|`"latex"`| The string is a Latex fragment|
*
*/
format?: OutputFormat | 'auto';
insertionMode?: 'replaceSelection' | 'replaceAll' | 'insertBefore' | 'insertAfter';
/**
* Describes where the selection
* will be after the insertion:
| <!-- --> | <!-- --> |
| :---------- | :---------- |
|`"placeholder"`| The selection will be the first available placeholder in the text that has been inserted (default)|
|`"after"`| The selection will be an insertion point after the inserted text|
|`"before"`| The selection will be an insertion point before the inserted text|
|`"item"`| The inserted text will be selected|
*/
* Describes where the selection
* will be after the insertion:
| <!-- --> | <!-- --> |
| :---------- | :---------- |
|`"placeholder"`| The selection will be the first available placeholder in the text that has been inserted (default)|
|`"after"`| The selection will be an insertion point after the inserted text|
|`"before"`| The selection will be an insertion point before the inserted text|
|`"item"`| The inserted text will be selected|
*/
selectionMode?: 'placeholder' | 'after' | 'before' | 'item';

@@ -113,2 +65,79 @@ placeholder?: string;

};
export declare type FindOptions = {
mode?: ParseMode;
};
export declare type ReplacementFunction = (args: {
range: Range;
match: string;
latex: string;
p: string[];
}) => string;
export declare type ApplyStyleOptions = {
range?: Range;
operation?: 'set' | 'toggle';
suppressChangeNotifications?: boolean;
};
/**
* A position of the caret/insertion point from the beginning of the formula.
*/
export declare type Offset = number;
/**
* A pair of offests (boundary points) that can be used to denote a fragment
* of an expression.
*
* A range is said to be collapsed when start and end are equal.
*
* When specifying a range, a negative offset can be used to indicate an
* offset from the last valid offset, i.e. -1 is the last valid offset, -2
* is one offset before that, etc...
*
* A normalized range will always be such that start <= end, start >= 0,
* end >= 0, start < lastOffset, end < lastOffset. All the methods return
* a normalized range.
*
* **See Also**
* * [[`Selection`]]
*/
export declare type Range = [start: Offset, end: Offset];
/**
* A selection is a set of ranges (to support discontinous selection, for
* example when selecting a column in a matrix).
*
* If there is a single range and that range is collapsed, the selection is
* collapsed.
*
* A selection can also have a direction. While many operations are insensitive
* to the direction, a few are. For example, when selecting a fragment of an
* expression from left to right, the direction of this range will be "forward".
* Pressing the left arrow key will sets the insertion at the start of the range.
* Conversely, if the selectionis made from right to left, the direction is
* "backward" and pressing the left arrow key will set the insertion point at
* the end of the range.
*
* **See Also**
* * [[`Range`]]
*/
export declare type Selection = {
ranges: Range[];
direction?: 'forward' | 'backward' | 'none';
};
/**
* This interface is implemented by:
* - VirtualKeyboard
* - VirtualKeyboardDelegate (used when the virtual keyboard is shared amongst
* mathfield instances)
* - RemoteVirtualKeyboard (the shared virtual keyboard instance)
*/
export interface VirtualKeyboardInterface {
visible: boolean;
height: number;
dispose(): void;
executeCommand(command: string | [string, ...any[]]): boolean;
focusMathfield(): void;
blurMathfield(): void;
enable(): void;
disable(): void;
stateChanged(): void;
setOptions(options: VirtualKeyboardOptions & CoreOptions): void;
}
export interface Mathfield {

@@ -179,2 +208,5 @@ mode: ParseMode;

getValue(format?: OutputFormat): string;
getValue(start: Offset, end: Offset, format?: OutputFormat): string;
getValue(range: Range | Selection, format?: OutputFormat): string;
getValue(arg1?: Offset | OutputFormat | Range | Selection, arg2?: Offset | OutputFormat, arg3?: OutputFormat): string;
/**

@@ -190,3 +222,3 @@ * @deprecated Use [[`getValue`]]

* @category Accessing the Content
* @deprecated Use `mfe.getValue(mfe.getSelection())`
* @deprecated Use `mfe.getValue(mfe.selection)`
*/

@@ -316,12 +348,20 @@ $selectedText?(format?: OutputFormat): string;

*
* If there is a selection, the style is applied to the selection
* If there is no selection and no range is specified, the style will
* apply to the next character typed.
*
* If the selection already has this style, remove it. If the selection
* If a range is specified, the style is applied to the range, otherwise,
* if there is a selection, the style is applied to the selection.
*
* If the operation is 'toggle' and the range already has this style,
* remove it. If the range
* has the style partially applied (i.e. only some sections), remove it from
* those sections, and apply it to the entire selection.
* those sections, and apply it to the entire range.
*
* If there is no selection, the style will apply to the next character typed.
* If the operation is 'set', the style is applied to the range,
* whether it already has the style or not.
*
* The default operation is 'set'.
*
*/
applyStyle(style: Style): void;
applyStyle(style: Style, options?: ApplyStyleOptions): void;
/**

@@ -361,3 +401,19 @@ * @deprecated Use [[`applyStyle`]]

setCaretPoint(x: number, y: number): boolean;
find(latex: string): Range[];
/**
* Search the formula for items matching the **pattern** as a Latex string or
* as a regular expression matching a Latex string.
*
* Results are returned as a `Range` array. If no results are found
* an empty array is returned.
*/
find(pattern: string | RegExp, options?: FindOptions): Range[];
/**
* Replace the pattern items matching the **pattern** with the
* **replacement** value.
*
* If **replacement** is a function, the function is called
* for each match and the function return value will be
* used as the replacement.
*/
replace(pattern: string | RegExp, replacement: string | ReplacementFunction, options?: FindOptions): void;
}

@@ -364,0 +420,0 @@ export interface Model {

@@ -1,2 +0,2 @@

/* 0.59.0 */ /**
/* 0.60.0 */ /**
*

@@ -16,4 +16,4 @@ * Use MathLive to render and edit mathematical formulas.

*
* @packageDocumentation MathLive SDK Reference 0.59.0
* @version 0.59.0
* @packageDocumentation MathLive SDK Reference 0.60.0
* @version 0.60.0
*

@@ -23,3 +23,3 @@ */

import { MathfieldElement } from './mathfield-element';
import { MathfieldOptions, TextToSpeechOptions } from './options';
import { MathfieldOptions, RemoteVirtualKeyboardOptions, TextToSpeechOptions } from './options';
import { MacroDictionary, ErrorListener, ParserErrorCode } from './core';

@@ -30,3 +30,3 @@ export { Mathfield };

/**
* Current version: `0.59.0`
* Current version: `0.60.0`
*

@@ -66,4 +66,30 @@ * The version string of the SDK using the [semver](https://semver.org/) convention:

*/
export declare function makeMathField(element: HTMLElement | string, options: MathfieldOptions): Mathfield;
export declare function makeMathField(element: HTMLElement | string, options: Partial<MathfieldOptions>): Mathfield;
/**
* Initialize remote client for mathfield elements rendered in child frames.
* This client instance control focus between multiple frames and mathfield elements and
* renders the virtual keyboard with required options passed by params of this method.
*
* @param options Options to configure virtual keyboard that will be rendered on this frame.
*
* ```html
* <iframe src="...">
* <!-- The iframe page content -->
* <math-field virtual-keyboard-mode="onfocus" use-shared-virtual-keyboard />
*
* <script type="module">
* import { makeMathField } from 'https://unpkg.com/mathlive/dist/mathlive.min.mjs';
* </script>
* </iframe>
* ```
*
* ```javascript
* import { makeSharedVirtualKeyboard } from 'https://unpkg.com/mathlive/dist/mathlive.min.mjs';
*
* makeSharedVirtualKeyboard({});
* ```
* @keywords create, make, mathfield, iframe
*/
export declare function makeSharedVirtualKeyboard(options: RemoteVirtualKeyboardOptions): void;
/**
* Convert a LaTeX string to a string of HTML markup.

@@ -190,4 +216,4 @@ *

/** The format used for numbers using the scientific notation. **Default** = `"auto"` * /
scientificNotation?: 'auto' | 'engineering' | 'on';
/** The string used at the begining of repeating digits. **Default** = `"\\overline{"` */
scientificNotation?: 'auto' | 'engineering' | 'on';
/** The string used at the begining of repeating digits. **Default** = `"\\overline{"` */
beginRepeatingDigits?: string;

@@ -341,3 +367,3 @@ /** The string used at the end of repeating digits. **Default** = `"}"` */

TeX?: {
/** if false, math expression
/** If false, math expression
* that start with `\begin{` will not automatically be rendered.

@@ -354,4 +380,4 @@ */

delimiters?: {
display: string[][];
inline: string[][];
display: [openDelim: string, closeDelim: string][];
inline: [openDelim: string, closeDelim: string][];
};

@@ -358,0 +384,0 @@ };

@@ -1,5 +0,14 @@

/* 0.59.0 */ import { ErrorListener, MacroDictionary, ParseMode, ParserErrorCode, MathfieldErrorCode } from './core';
/* 0.60.0 */ import { ErrorListener, MacroDictionary, ParseMode, ParserErrorCode, MathfieldErrorCode } from './core';
import type { Mathfield } from './mathfield';
import type { Selector } from './commands';
/**
* Specify behaviour for origin validation.
* | Value | Description |
* | ----- | ----------- |
* | `'same-origin'` | The origin of received message must be the same of hosted window, instead exception will thow. |
* | `'(origin: string) => boolean` | The callback to verify origin to be expected validation. When callback return `false` value, message will rejected and exception will throw. |
* | `'none'` | No origin validation for post messages. |
*/
export declare type OriginValidator = ((origin: string) => boolean) | 'same-origin' | 'none';
/**
* A keybinding associates a combination of physical keyboard keys with a

@@ -88,3 +97,3 @@ * command.

*
* If a keybinding is invalid (impossible to produce) with the current
* If a keybinding is invalid (impossible to produce or ambiguous) with the current
* keyboard layout, an error will be generated, and the `onError` listener

@@ -99,3 +108,3 @@ * will be called with a `invalid-keybinding` error code.

* If specified, this indicates in which mode this keybinding will apply.
* If none is specified, the keybinding apply in every mode.
* If none is specified, the keybinding will apply in every mode.
*/

@@ -181,3 +190,3 @@ ifMode?: ParseMode;

* **See**
* {@link https://github.com/arnog/mathlive/tree/master/examples/speech | speech example}
* {@link https://cortexjs.io/mathlive/guides/speech/ | Guide: Speech}
*/

@@ -202,5 +211,3 @@ textToSpeechRules: 'mathlive' | 'sre';

*/
textToSpeechRulesOptions: {
[key: string]: string;
};
textToSpeechRulesOptions: Record<string, string>;
/**

@@ -215,3 +222,3 @@ * Indicates which speech engine to use for speech output.

* **See**
* {@link https://github.com/arnog/mathlive/tree/master/examples/speech | speech example}
* {@link https://cortexjs.io/mathlive/guides/speech/ | Guide: Speech}
*/

@@ -245,3 +252,3 @@ speechEngine: 'local' | 'amazon';

/**
* The string displayed for the keycap
* The HTML markup displayed for the keycap
*/

@@ -252,3 +259,3 @@ label?: string;

*/
command?: string;
command: Selector | [Selector, ...any[]];
/**

@@ -269,7 +276,22 @@ * Latex fragment to insert when the keycap is pressed

key?: string;
/** CSS class to apply to the keycap.
/**
* CSS classes to apply to the keycap.
*
* - `keycap`: a standard-width keycap, using the system font for its label
* - `keycap tex`: a standard-width keycap, using the TeX font for its label.
* Using the tex class is not necessary if using the latex property to
* define the label.
* - `modifier`: a modifier (shift/option, etc…) keycap
* - `keycap small`: display the label in a smaller size
* - `action`: an “action” keycap (for arrows, return, etc…)
* - `separator w5`: a half-width blank used as a separator. Other widths
* include `w15` (1.5 width), `w20` (double width) and `w50` (five-wide,
* used for the space bar).
* - `bottom`, `left`, `right`: alignment of the label
*
*/
class?: string;
/**
* Markup displayed with the key label (for example to explain what the symbol of the key is)
* Markup displayed with the key label (for example to explain what the
* symbol of the key is)
*/

@@ -288,32 +310,25 @@ aside?: string;

*/
shiftedCommand?: string;
shiftedCommand?: Selector | [Selector, ...any[]];
}
export interface VirtualKeyboardDefinition {
label: string;
layer?: string;
tooltip?: string;
layers?: string[];
classes?: string;
command?: string | string[];
}
export interface VirtualKeyboardLayer {
/** The CSS stylesheet associated with this layer */
styles?: string;
/** A CSS class name to customize the appearance of the background of the layer */
backdrop?: string;
/** A CSS class name to customize the appearance of the container the layer */
container?: string;
/** The rows of keycaps in this layer */
rows?: VirtualKeyboardKeycap[][];
}
export declare type VirtualKeyboardToolbarOptions = 'none' | 'default';
export declare type VirtualKeyboardOptions = {
/**
* If specified, the markup to be used to display the virtual keyboard
* toggle glyph. If none is specified a default keyboard icon is used.
*/
virtualKeyboardToggleGlyph: string;
/**
* - `'manual'`: pressing the virtual keyboard toggle button will show or hide
* the virtual keyboard. If hidden, the virtual keyboard is not shown when
* the field is focused until the toggle button is pressed.
* - `'onfocus'`: the virtual keyboard will be displayed whenever the field is
* focused and hidden when the field loses focus. In that case, the virtual
* keyboard toggle button is not displayed.
* - `'off'`: the virtual keyboard toggle button is not displayed, and the
* virtual keyboard is never triggered.
*
* If the setting is empty, it will default to `'onfocus'` on touch-capable
* devices and to `'off'` otherwise.
*
*/
virtualKeyboardMode: 'auto' | 'manual' | 'onfocus' | 'off';
/**
* A space separated list of the keyboards that should be available. The

@@ -325,6 +340,6 @@ * keyboard `'all'` is synonym with `'numeric'`, `'functions'``, `'symbols'``

*/
virtualKeyboards: 'all' | 'numeric' | 'roman' | 'greek' | 'functions' | 'symbols' | 'command' | string;
virtualKeyboards: 'all' | 'numeric' | 'roman' | 'greek' | 'functions' | 'symbols' | 'latex' | string;
virtualKeyboardLayout: 'auto' | 'qwerty' | 'azerty' | 'qwertz' | 'dvorak' | 'colemak';
/**
* Some additional custom virtual keyboard layers.
* Custom virtual keyboard layers.
*

@@ -336,14 +351,10 @@ * A keyboard is made up of one or more layers (think of the main layer and the

*
* **See**
* {@link https://github.com/arnog/mathlive/tree/master/examples/virtual_keyboard | virtual keyboard example}
* **See* {@link https://cortexjs.io/mathlive/guides/virtual-keyboards | Guide: Virtual Keyboards}
*
*
*/
customVirtualKeyboardLayers: {
[layerName: string]: string | VirtualKeyboardLayer;
};
customVirtualKeyboards: {
[layerName: string]: string;
};
customVirtualKeyboardLayers: Record<string, string | VirtualKeyboardLayer>;
customVirtualKeyboards: Record<string, VirtualKeyboardDefinition>;
/**
* The visual theme used for the virtual keyboard.
* The visual theme of the virtual keyboard.
*

@@ -362,6 +373,8 @@ * If empty, the theme will switch automatically based on the device it's

* When a key on the virtual keyboard is pressed, produce a short audio
* feedback. The value should be either a URL to a sound file or an object
* with the following keys:
* feedback.
*
* - `delete` URL to a sound file played when the delete key is pressed
* If the property is set to a `string` or `HTMLAudioElement`, the same
* sound is played in all cases. Otherwise, a distinct sound is played:
*
* - `delete` a sound played when the delete key is pressed
* - `return` ... when the return/tab key is pressed

@@ -372,2 +385,5 @@ * - `spacebar` ... when the spacebar is pressed

* well.
*
* The value of the properties should be either a string, the name of an
* audio file in the `soundsDirectory` directory, or an `HTMLAudioElement`.
*/

@@ -381,7 +397,35 @@ keypressSound: string | HTMLAudioElement | {

/**
* URL to a sound file which will be played to provide feedback when a
* command has no effect, for example when pressing the spacebar at the root
* level.
* Sound played to provide feedback when a command has no effect, for example
* when pressing the spacebar at the root level.
*
* The property is either a string, the name of an audio file in the
* `soundsDirectory` directory, or an `HTMLAudioElement`.
*/
plonkSound?: string | HTMLAudioElement;
/**
* The right hand side toolbar configuration.
*
* Use `none` to disable right hand side toolbar of virtual keyboard.
*/
virtualKeyboardToolbar?: VirtualKeyboardToolbarOptions;
/**
* Markup for the virtual keyboard toggle glyph.
*
* If none is specified a default keyboard icon is used.
*/
virtualKeyboardToggleGlyph: string;
/**
* - `'manual'`: pressing the virtual keyboard toggle button will show or hide
* the virtual keyboard. If hidden, the virtual keyboard is not shown when
* the field is focused until the toggle button is pressed.
* - `'onfocus'`: the virtual keyboard will be displayed whenever the field is
* focused and hidden when the field loses focus. In that case, the virtual
* keyboard toggle button is not displayed.
* - `'off'`: the virtual keyboard toggle button is not displayed, and the
* virtual keyboard is never triggered.
* - '`auto'`: `'onfocus'` on touch-capable devices and `'off'` otherwise
* (**default**).
*
*/
virtualKeyboardMode: 'auto' | 'manual' | 'onfocus' | 'off';
};

@@ -429,2 +473,19 @@ /**

}
export declare type RemoteVirtualKeyboardOptions = CoreOptions & VirtualKeyboardOptions & {
/**
* Specify the `targetOrigin` parameter for [postMessage](https://developer.mozilla.org/en/docs/Web/API/Window/postMessage)
* to send control messages from parent to child frame to remote control of
* mathfield component.
*
* **Default**: `window.origin`
*/
targetOrigin: string;
/**
* Specify behaviour how origin of message from [postMessage](https://developer.mozilla.org/en/docs/Web/API/Window/postMessage)
* should be validated.
*
* **Default**: `'same-origin'`
*/
originValidator: OriginValidator;
};
export declare type UndoStateChangeListener = (target: Mathfield, action: 'undo' | 'redo' | 'snapshot') => void;

@@ -457,3 +518,2 @@ /**

onModeChange: (sender: Mathfield, mode: ParseMode) => void;
onVirtualKeyboardToggle: (sender: Mathfield, visible: boolean, keyboardElement: HTMLElement) => void;
onReadAloudStatus: (sender: Mathfield) => void;

@@ -482,5 +542,3 @@ }

*/
inlineShortcuts: {
[key: string]: InlineShortcutDefinition;
};
inlineShortcuts: Record<string, InlineShortcutDefinition>;
/**

@@ -519,23 +577,19 @@ * Maximum time, in milliseconds, between consecutive characters for them to be

/**
* An object whose keys are a locale string, and whose values are an object of
* string identifier to localized string.
*
* **Example**
*
```json
{
"fr-CA": {
"tooltip.undo": "Annuler",
"tooltip.redo": "Refaire",
}
}
```
*
* This will override the default localized strings.
*/
strings: {
[locale: string]: {
[key: string]: string;
};
};
* An object whose keys are a locale string, and whose values are an object of
* string identifier to localized string.
*
* **Example**
*
```json
{
"fr-CA": {
"tooltip.undo": "Annuler",
"tooltip.redo": "Refaire",
}
}
```
*
* This will override the default localized strings.
*/
strings: Record<string, Record<string, string>>;
};

@@ -625,7 +679,7 @@ export declare type EditingOptions = {

/**
* When `true` and the spacebar is pressed, no space is inserted.
*
* When `false`, a space is inserted when the spacebar is pressed.
* The Latex string to insert when the spacebar is pressed (on the physical or
* virtual keyboard). Empty by default. Use `\;` for a thick space, `\:` for
* a medium space, `\,` for a thin space.
*/
ignoreSpacebarInMathMode: boolean;
mathModeSpace: string;
};

@@ -635,24 +689,24 @@ export declare type LayoutOptions = {

/**
*A dictionary of LaTeX macros to be used to interpret and render the content.
*
*For example, to add a new macro to the default macro dictionary:
*
```javascript
mf.setConfig({
macros: {
...mf.getOption('macros'),
smallfrac: '^{#1}\\!\\!/\\!_{#2}',
},
});
```
*
* Note that `getOption()` is called to keep the existing macros and add to them.
* Otherwise, all the macros are replaced with the new definition.
*
* The code above will support the following notation:
*
```tex
\smallfrac{5}{16}
```
*/
*A dictionary of LaTeX macros to be used to interpret and render the content.
*
*For example, to add a new macro to the default macro dictionary:
*
```javascript
mf.setConfig({
macros: {
...mf.getOption('macros'),
smallfrac: '^{#1}\\!\\!/\\!_{#2}',
},
});
```
*
* Note that `getOption()` is called to keep the existing macros and add to them.
* Otherwise, all the macros are replaced with the new definition.
*
* The code above will support the following notation:
*
```tex
\smallfrac{5}{16}
```
*/
macros: MacroDictionary;

@@ -667,37 +721,34 @@ /**

/**
* Control the letter shape style:
| `letterShapeStyle` | xyz | ABC | αβɣ | ΓΔΘ |
| ------------------ | --- | --- | --- | --- |
| `iso` | it | it | it | it |
| `tex` | it | it | it | up |
| `french` | it | up | up | up |
| `upright` | up | up | up | up |
(it) = italic (up) = upright
* The default letter shape style is `auto`, which indicates that `french`
* should be used if the locale is "french", and `tex` otherwise.
*
* **(Historical Note)**
*
* Where do the "french" rules come from? The
* TeX standard font, Computer Modern, is based on Monotype 155M, itself
* based on the Porson greek font which was one of the most widely used
* Greek fonts in english-speaking countries. This font had upright
* capitals, but slanted lowercase. In France, the traditional font for
* greek was Didot, which has both upright capitals and lowercase.
*
*
* As for roman uppercase, they are recommended by "Lexique des règles
* typographiques en usage à l’Imprimerie Nationale". It should be noted
* that this convention is not universally followed.
* ---
*/
* Control the letter shape style:
| `letterShapeStyle` | xyz | ABC | αβɣ | ΓΔΘ |
| ------------------ | --- | --- | --- | --- |
| `iso` | it | it | it | it |
| `tex` | it | it | it | up |
| `french` | it | up | up | up |
| `upright` | up | up | up | up |
(it) = italic (up) = upright
* The default letter shape style is `auto`, which indicates that `french`
* should be used if the locale is "french", and `tex` otherwise.
*
* **(Historical Note)**
*
* Where do the "french" rules come from? The
* TeX standard font, Computer Modern, is based on Monotype 155M, itself
* based on the Porson greek font which was one of the most widely used
* Greek fonts in english-speaking countries. This font had upright
* capitals, but slanted lowercase. In France, the traditional font for
* greek was Didot, which has both upright capitals and lowercase.
*
*
* As for roman uppercase, they are recommended by "Lexique des règles
* typographiques en usage à l’Imprimerie Nationale". It should be noted
* that this convention is not universally followed.
* ---
*/
letterShapeStyle: 'auto' | 'tex' | 'iso' | 'french' | 'upright';
};
/**
* @keywords security, trust, sanitize, errors
*/
export declare type MathfieldOptions = LayoutOptions & EditingOptions & LocalizationOptions & InlineShortcutsOptions & KeyboardOptions & VirtualKeyboardOptions & TextToSpeechOptions & MathfieldHooks & MathfieldListeners & {
export declare type CoreOptions = {
/**

@@ -715,27 +766,2 @@ * Namespace that is added to `data-` attributes to avoid collisions

/**
* An optional listener function that will be
* invoked when an error is encountered.
*
* This could be a Latex parsing error, for the initial value of the
* mathfield, a value inserted programmatically later, or through a
* user interaction (pasting in the mathfield for example).
* See [[`ParserErrorCode`]] for the list of possible parsing errors.
*
* This could also be another kind of error, such as an invalid keybinding.
*
*/
onError: ErrorListener<ParserErrorCode | MathfieldErrorCode>;
/**
* This function provides the option of substituting the focusable DOM
* element used to capture keyboard input.
*
* An (invisible) DOM element is used to capture the keyboard events. By
* default, this element is a `<textarea>` on desktop and a `<span>` on
* mobile devices, to prevent the device virtual keyboard from being
* displayed.
*
* Alternatively, the ID of a DOM element can be provided.
*/
substituteTextArea: string | (() => HTMLElement);
/**
* A URL fragment pointing to the directory containing the fonts

@@ -777,2 +803,9 @@ * necessary to render a formula.

/**
* A URL fragment pointing to the directory containing the optional
* sounds used to provide feedback while typing.
*
* Some default sounds are available in the `/dist/sounds` directory of the SDK.
*/
soundsDirectory: string;
/**
* Support for [Trusted Type](https://w3c.github.io/webappsec-trusted-types/dist/spec/).

@@ -787,2 +820,66 @@ *

/**
* @keywords security, trust, sanitize, errors
*/
export declare type MathfieldOptions = LayoutOptions & EditingOptions & LocalizationOptions & InlineShortcutsOptions & KeyboardOptions & VirtualKeyboardOptions & TextToSpeechOptions & CoreOptions & MathfieldHooks & MathfieldListeners & {
/**
* When true, use a shared virtual keyboard for all the mathfield
* elements in the page, even across iframes.
*
* When setting this option to true, you must create the shared
* virtual keyboard in the the parent document:
*
* ```javascript
* import { makeSharedVirtualKeyboard } from 'mathlive';
*
* makeSharedVirtualKeyboard({
* virtualKeyboardToolbar: 'none',
* });
* ```
*
* **Default**: `false`
*/
useSharedVirtualKeyboard: boolean;
/**
* Specify the `targetOrigin` parameter for
* [postMessage](https://developer.mozilla.org/en/docs/Web/API/Window/postMessage)
* to send control messages from child to parent frame to remote control
* of mathfield component.
*
* **Default**: `window.origin`
*/
sharedVirtualKeyboardTargetOrigin: string;
/**
* Specify behaviour how origin of message from [postMessage](https://developer.mozilla.org/en/docs/Web/API/Window/postMessage)
* should be validated.
*
* **Default**: `'same-origin'`
*/
originValidator: OriginValidator;
/**
* An optional listener function that will be
* invoked when an error is encountered.
*
* This could be a Latex parsing error, for the initial value of the
* mathfield, a value inserted programmatically later, or through a
* user interaction (pasting in the mathfield for example).
* See [[`ParserErrorCode`]] for the list of possible parsing errors.
*
* This could also be another kind of error, such as an invalid keybinding.
*
*/
onError: ErrorListener<ParserErrorCode | MathfieldErrorCode>;
/**
* This function provides the option of substituting the focusable DOM
* element used to capture keyboard input.
*
* An (invisible) DOM element is used to capture the keyboard events. By
* default, this element is a `<textarea>` on desktop and a `<span>` on
* mobile devices, to prevent the device virtual keyboard from being
* displayed.
*
* Alternatively, the ID of a DOM element can be provided.
*/
substituteTextArea: string | (() => HTMLElement);
};
/**
* @deprecated Use [[`MathfieldOptions`]]

@@ -796,13 +893,14 @@ */

* | :----- | :----- | :----- |
* | `'apple.en-intl'` | Apple | English (International) |
* | `'apple.french'` | Apple | French (AZERTY) |
* | `'apple.german'` | Apple | German (QWERTZ) |
* | `'windows.en-intl'` | Windows | English (International) |
* | `'windows.french'` | Windows | French (AZERTY) |
* | `'windows.german'` | Windows | German (QWERTZ) |
* | `'linux.en'` | Linux | English |
* | `'linux.french'` | Linux | French (AZERTY) |
* | `'linux.german'` | Linux | German (QWERTZ) |
* | `'apple.en-intl'` | Apple | English (International) |
* | `'apple.french'` | Apple | French (AZERTY) |
* | `'apple.german'` | Apple | German (QWERTZ) |
* | `'dvorak'` | | English (Dvorak) |
* | `'windows.en-intl'` | Windows | English (International) |
* | `'windows.french'` | Windows | French (AZERTY) |
* | `'windows.german'` | Windows | German (QWERTZ) |
* | `'linux.en'` | Linux | English |
* | `'linux.french'` | Linux | French (AZERTY) |
* | `'linux.german'` | Linux | German (QWERTZ) |
*/
export declare type KeyboardLayoutName = 'apple.en-intl' | 'apple.french' | 'apple.german' | 'apple.spanish' | 'windows.en-intl' | 'windows.french' | 'windows.german' | 'windows.spanish' | 'linux.en' | 'linux.french' | 'linux.german' | 'linux.spanish';
export declare type KeyboardLayoutName = 'apple.en-intl' | 'apple.french' | 'apple.german' | 'apple.spanish' | 'dvorak' | 'windows.en-intl' | 'windows.french' | 'windows.german' | 'windows.spanish' | 'linux.en' | 'linux.french' | 'linux.german' | 'linux.spanish';
/**

@@ -809,0 +907,0 @@ * Change the current physical keyboard layout.

@@ -1,2 +0,2 @@

/* 0.59.0 */ /**
/* 0.60.0 */ /**
* @internal

@@ -3,0 +3,0 @@ */

@@ -0,0 +0,0 @@ Copyright (c) 2017 - present Arno Gourdol. All rights reserved.

{
"name": "mathlive",
"version": "0.59.0",
"description": "Render and edit beautifully typeset math",
"license": "MIT",
"funding": {
"type": "patreon",
"url": "https://patreon.com/arnog"
},
"repository": {
"type": "git",
"url": "https://github.com/arnog/mathlive.git"
},
"bugs": "https://github.com/arnog/mathlive/issues/",
"scripts": {
"build": "bash ./scripts/build.sh",
"clean": "rimraf build dist coverage",
"dist": "bash ./scripts/build.sh production",
"lint": "eslint --fix src/",
"start": "bash ./scripts/build.sh watch",
"test": "bash ./scripts/test.sh",
"version": "bash ./scripts/version.sh",
"postversion": "bash ./scripts/github-release.sh"
},
"main": "./dist/mathlive.js",
"module": "./dist/mathlive.mjs",
"types": "./dist/public/mathlive.d.ts",
"files": [
"/dist"
"name": "mathlive",
"version": "0.60.0",
"description": "Render and edit beautifully typeset math",
"license": "MIT",
"funding": {
"type": "patreon",
"url": "https://patreon.com/arnog"
},
"repository": {
"type": "git",
"url": "https://github.com/arnog/mathlive.git"
},
"bugs": "https://github.com/arnog/mathlive/issues/",
"scripts": {
"build": "bash ./scripts/build.sh",
"clean": "bash ./scripts/clean.sh",
"dist": "bash ./scripts/build.sh production; bash ./scripts/test.sh",
"prepare": "bash ./scripts/build.sh production",
"lint": "eslint --fix src/",
"xo": "xo --prettier --fix src/",
"start": "bash ./scripts/build.sh watch",
"test": "bash ./scripts/test.sh",
"version": "bash ./scripts/version.sh",
"postversion": "bash ./scripts/github-release.sh"
},
"main": "./dist/mathlive.js",
"module": "./dist/mathlive.mjs",
"types": "./dist/public/mathlive.d.ts",
"files": [
"/dist"
],
"prettier": {
"arrowParens": "always",
"bracketSpacing": true,
"endOfLine": "lf",
"jsxSingleQuote": false,
"jsxBracketSameLine": false,
"proseWrap": "always",
"quoteProps": "consistent",
"semi": true,
"singleQuote": true,
"indentSize": 2,
"tabWidth": 2,
"trailingComma": "es5",
"useTabs": false
},
"xo": {
"prettier": true,
"rules": {
"import/no-unassigned-import": "off",
"import/no-anonymous-default-export": "off",
"accessor-pairs": "off",
"no-negated-condition": "off",
"radix": "off",
"default-case": "off",
"no-anonymous-default-import": "off",
"eslint-comments/no-unused-disable": "warn",
"unicorn/no-abusive-eslint-disable": "off",
"unicorn/prefer-node-remove": "off",
"unicorn/no-reduce": "off",
"unicorn/prefer-query-selector": "off",
"unicorn/no-fn-reference-in-iterator": "off",
"unicorn/no-object-as-default-parameter": "off",
"unicorn/prefer-node-append": "off",
"@typescript-eslint/prefer-regexp-exec": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/unified-signatures": "off",
"@typescript-eslint/array-type": "off",
"prefer-math-trunc": "off"
}
},
"husky": {
"hooks": {
"pre-commit": "lint-staged && bash ./scripts/pre-commit.sh",
"pre-push": "npm test"
}
},
"lint-staged": {
"/src/**/*.ts": [
"eslint --fix"
],
"prettier": {
"singleQuote": true,
"trailingComma": "es5",
"endOfLine": "lf",
"tabWidth": 4,
"jsxSingleQuote": true
},
"husky": {
"hooks": {
"pre-commit": "lint-staged && bash ./scripts/pre-commit.sh",
"pre-push": "npm test"
}
},
"lint-staged": {
"/src/**/*.ts": [
"eslint --fix"
],
"/src/**/*.{ts,css,json,less}": [
"prettier --write"
],
"/*.md": [
"prettier --write"
]
},
"engines": {
"npm": ">=6.14.8",
"node": ">=12.0.0"
},
"browserslist": [
"> 1%",
"last 2 versions",
"maintained node versions",
"not dead"
"/src/**/*.{ts,css,json,less}": [
"prettier --write"
],
"author": "Arno Gourdol <arno@arno.org>",
"contributors": [
"Louis Larpin (lilfaf.github.io)",
"Neil Soiffer (https://github.com/NSoiffer)",
"Jason Boxman (https://github.com/jboxman)",
"Synergy Codes (https://www.synergycodes.com/)",
"Rafał Piekarski (https://github.com/rpdiss)",
"Kajetan Champlewski <kchamplewski@gmail.com>",
"Fabian Grewing <Fabian.Heimbuerger@gmail.com>",
"Paul Masson <paulmasson@comcast.net>",
"Soroush Javadi <soroush.javadi@gmail.com>",
"Thomas Schell <thom.schell@gmail.com>",
"leerobert <lee.robert.138@gmail.com>",
"spirobel <spirobel@protonmail.com>",
"Artur Fijał <afijal@soldevelo.com>",
"David Le Jolly <david.lejolly@gmail.com>",
"Johannes Wilm <johanneswilm@gmail.com>",
"Nick Gravelyn <nick@gravelyn.com>",
"paosder <denjaraos@gmail.com>"
],
"devDependencies": {
"@babel/types": "^7.12.5",
"@cortex-js/prettier-config": "^1.0.0",
"@rollup/plugin-node-resolve": "^9.0.0",
"@types/css-font-loading-module": "0.0.4",
"@types/jest": "^26.0.15",
"@types/node": "^14.14.6",
"@typescript-eslint/eslint-plugin": "^4.6.1",
"@typescript-eslint/parser": "^4.6.1",
"@typescript-eslint/typescript-estree": "^4.6.1",
"autoprefixer": "^9.8.6",
"check-node-version": "^4.0.3",
"cssnano": "^4.1.10",
"eslint": "^7.12.1",
"eslint-config-prettier": "^6.15.0",
"eslint-plugin-no-unsanitized": "^3.1.4",
"eslint-plugin-prettier": "^3.1.4",
"http-server": "^0.12.3",
"husky": "^4.3.0",
"jest": "^26.6.3",
"jest-silent-reporter": "^0.2.1",
"less": "^3.12.2",
"lint-staged": "^10.5.1",
"postcss-cli": "^7.1.2",
"prettier": "^2.1.2",
"rimraf": "^3.0.2",
"rollup": "^2.33.1",
"rollup-plugin-copy": "^3.3.0",
"rollup-plugin-eslint": "^7.0.0",
"rollup-plugin-postcss": "^3.1.8",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.29.0",
"ts-jest": "^26.4.3",
"typescript": "^4.0.5"
},
"dependencies": {},
"keywords": [
"math",
"editor",
"javascript",
"math-editing",
"latex",
"tex",
"mathjax",
"katex",
"mathquill"
"/*.md": [
"prettier --write"
]
},
"engines": {
"npm": ">=6.14.8",
"node": ">=12.0.0"
},
"browserslist": [
"> 1%",
"last 2 versions",
"maintained node versions",
"not dead"
],
"author": "Arno Gourdol <arno@arno.org>",
"contributors": [
"Louis Larpin (lilfaf.github.io)",
"Neil Soiffer (https://github.com/NSoiffer)",
"Jason Boxman (https://github.com/jboxman)",
"Synergy Codes (https://www.synergycodes.com/)",
"Rafał Piekarski (https://github.com/rpdiss)",
"Kajetan Champlewski <kchamplewski@gmail.com>",
"Fabian Grewing <Fabian.Heimbuerger@gmail.com>",
"Paul Masson <paulmasson@comcast.net>",
"Soroush Javadi <soroush.javadi@gmail.com>",
"Thomas Schell <thom.schell@gmail.com>",
"leerobert <lee.robert.138@gmail.com>",
"spirobel <spirobel@protonmail.com>",
"Artur Fijał <afijal@soldevelo.com>",
"David Le Jolly <david.lejolly@gmail.com>",
"Johannes Wilm <johanneswilm@gmail.com>",
"Nick Gravelyn <nick@gravelyn.com>",
"paosder <denjaraos@gmail.com>"
],
"devDependencies": {
"@babel/types": "^7.13.0",
"@cortex-js/prettier-config": "^1.1.0",
"@rollup/plugin-node-resolve": "^11.2.0",
"@types/css-font-loading-module": "0.0.4",
"@types/jest": "^26.0.20",
"@types/node": "^14.14.35",
"@typescript-eslint/eslint-plugin": "^4.14.2",
"@typescript-eslint/parser": "^4.14.2",
"@typescript-eslint/typescript-estree": "^4.14.2",
"autoprefixer": "10.2.4",
"check-node-version": "^4.1.0",
"cssnano": "^4.1.10",
"eslint": "^7.19.0",
"eslint-config-prettier": "^8.1.0",
"eslint-plugin-no-unsanitized": "^3.1.4",
"eslint-plugin-prettier": "^3.3.1",
"http-server": "^0.12.3",
"husky": "^4.3.8",
"jest": "^26.6.3",
"jest-silent-reporter": "^0.5.0",
"less": "^4.1.1",
"lint-staged": "^10.5.4",
"postcss": "^8.2.4",
"postcss-cli": "^8.3.1",
"prettier": "^2.2.1",
"rollup": "^2.41.4",
"rollup-plugin-copy": "^3.4.0",
"rollup-plugin-eslint": "^7.0.0",
"rollup-plugin-postcss": "^4.0.0",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.30.0",
"ts-jest": "^26.5.3",
"typescript": "^4.2.3",
"xo": "^0.37.1"
},
"keywords": [
"math",
"editor",
"javascript",
"math-editing",
"latex",
"tex",
"mathjax",
"katex",
"mathquill"
]
}

@@ -1,21 +0,11 @@

<h1 align="center">
<img alt="math live" src="assets/logo.png?raw=true">
</h1>
<div align="center">
<img alt="math live" src="assets/mathlive-1.png?raw=true">
</div>
<p align="center">
<img width="479" alt="Screenshot" src="assets/screenshots/mathlive-demo.png">
</p>
<h3><strong>MathLive</strong></h3>
<h1>A Web Component for Math Input</h1>
## MathLive: A Web Component for Math Input
<img src="assets/screenshots/mathlive-demo.png">
- [x] A Web Component easy to integrate in your project, regardless of the
framework you use (or even if you use no framework)
- [x] Beautiful, TeX-quality typesetting
- [x] Easy to use interface for formula editing
- [x] Designed for mobile devices with an extensive set of virtual keyboards
- [x] Accessility support: screen reader compatible, and includes custom math-to-speech support
- [x] Outputs **LaTeX**, **MathML** and **MathJSON** (Abstract Syntax Tree)
- [x] And it is easy to customize to your needs!
[![Maintenance](https://img.shields.io/maintenance/yes/2020.svg)]()
[![Maintenance](https://img.shields.io/maintenance/yes/2021.svg)]()
[![GitHub license](https://img.shields.io/badge/license-MIT-brightgreen.svg)](https://raw.githubusercontent.com/arnog/mathlive/master/LICENSE.txt)

@@ -25,4 +15,19 @@ [![Build Status](https://travis-ci.org/arnog/mathlive.svg?branch=master)](https://travis-ci.org/arnog/mathlive)

See [cortexjs.io](http://cortexjs.io/mathlive/) for more info or try it at [mathlive.io](https://mathlive.io)
- [x] A **Web Component** easy to integrate in your project, regardless of the
framework you use, or even if you use no framework
- [x] Edit **math formulas** with an easy to use interface
- [x] Beautiful, **TeX-quality** typesetting: over 800 LaTex commands built-in
- [x] Designed for **mobile devices** with an extensive set of **virtual
keyboards**
- [x] Compatible with **screen readers**, and includes custom math-to-speech
support for improved **accessibility**
- [x] Output to **LaTeX**, **MathML** or **MathJSON** (Abstract Syntax Tree)
formats
- [x] And it is easy to **customize** to your needs!
Reference documentation and guides at
[cortexjs.io/mathlive](https://cortexjs.io/mathlive/).
Try it at [mathlive.io](https://mathlive.io).
<table align="center" >

@@ -52,8 +57,7 @@ <tr>

### Editing Math
To add a mathfield element in your page use a `<math-field>` tag.
To add a mathfield element in your page use a `<math-field>` tag. It works
just like a `<textarea>` or `<button>`. You can manipulate the mathfield using
methods of the element and listen for events to be notified when its internal
state changes.
It works just like a `<textarea>` or `<button>`. You can manipulate the
mathfield using methods of the element and listen for events to be notified when
its internal state changes.

@@ -63,50 +67,55 @@ ```html

<html lang="en-US">
<body>
<math-field>f(x)=</math-field>
<script src="https://unpkg.com/mathlive/dist/mathlive.min.js"></script>
</body>
<body>
<math-field>f(x)=</math-field>
<script src="https://unpkg.com/mathlive/dist/mathlive.min.js"></script>
</body>
</html>
```
### Displaying Static Math
## Documentation
Render static math equations by
[adding two lines to your web page](tutorials/USAGE_GUIDE.md).
<dl>
<dt><a href="https://cortexjs.io/mathlive/guides/introduction">Quick Start</a></dt>
<dd>Quick introduction to using MathLive in your project</dd>
<dt><a href="https://cortexjs.io/mathlive/guides/interacting">Interact with a mathfield</a></dt>
<dd>Receive input and change the value of a mathfield</dd>
<dt><a href="https://cortexjs.io/mathlive/guides/customizing">Customize a mathfield</a></dt>
<dd>Adapt the behavior and appearance of a mathfield to your needs</dd>
<dt><a href="https://cortexjs.io/mathlive/guides/commands">Execute commands</a></dt>
<dd>Send editing commands to a mathfield</dd>
<dt><a href="https://cortexjs.io/mathlive/guides/macros">Define custom Latex macros</a></dt>
<dd>Extend the Latex commands supported</dd>
<dt><a href="https://cortexjs.io/mathlive/guides/shortcuts">Manage inline and keyboard shortcuts</a></dt>
<dd>Add or modify editing keyboard shortcuts</dd>
<dt><a href="https://cortexjs.io/mathlive/guides/speech">Control speech output</a></dt>
<dd>A mathfield can provide speech feedback to interact with it.</dd>
<dt><a href="https://cortexjs.io/mathlive/guides/static">Display static math formulas</a></dt>
<dd>Display non-editable math formulas in your page</dd>
<dt><a href="https://cortexjs.io/mathlive/guides/virtual-keyboards">Define custom virtual keyboards</a></dt>
<dd>Customize or create new virtual (on-screen) keyboards</dd>
<hr>
<dt><a href="https://cortexjs.io/guides/mathfield-getting-started">Getting Started</a></dt>
<dd>Everything you need to integrate the MathLive library to your project</dd>
<dt><a href="https://cortexjs.io/docs/mathlive">MathLive SDK</a></dt>
<dd>Reference documentation of the MathLive API</dd>
</dl>
```html
<!DOCTYPE html>
<html lang="en-US">
<body>
<h1>Euler's Identity</h1>
<p>$$e^{i\pi} + 1 = 0$$</p>
## Related Projects
<script type="module">
import { renderMathInDocument } from 'https://unpkg.com/mathlive/dist/mathlive.min.mjs';
renderMathInDocument();
</script>
</body>
</html>
```
<dl>
<dt><a href="https://cortexjs.io/math-json">MathJSON</a> (on <a href="https://github.com/cortex-js/math-json">GitHub</a>)</dt>
<dd>A lightweight data interchange format for mathematical notation.</dd>
<dt><a href="https://cortexjs.io/compute-engine">Compute Engine</a> (on <a href="https://github.com/cortex-js/math-json/tree/master/src/compute-engine">GitHub</a>)</dt>
<dd>The CortexJS Compute Engine performs calculations on MathJSON expressions</dd>
<dt><a href="https://cortexjs.io/cortex">Cortex</a> (on <a href="https://github.com/cortex-js/math-json/tree/master/src/cortex">GitHub</a>)</dt>
<dd>Cortex is a programming language for scientific computing</dd>
</dl>
## Want to Help?
## Contact Us
- Using MathLive in your project? Want to support the project ongoing maintenance?
Consider making a donation with [PayPal](https://www.paypal.me/arnogourdol)
- Something wrong? Got ideas for new features? Write up an issue. Read about
[Contributing](CONTRIBUTING.md) and follow our [Code of Conduct](CODE_OF_CONDUCT.md)
- Want to contribute some code for an issue or a feature? Read the
[Contributor Guide](tutorials/CONTRIBUTOR_GUIDE.md) and the
[docs](http://docs.mathlive.io). Looking for inspiration? Pick one of
the [good first issues](https://github.com/arnog/mathlive/labels/good%20first%20issue)
- Join our [Gitter community](https://gitter.im/cortex-js/community)
- Drop a line to arno@arno.org
## More Questions?
- Read the [Getting Started Guide](http://cortexjs.io/guides/mathfield-getting-started/)
- Look at some [examples](http://cortexjs.io/mathlive/)
- [Read the API documentation](https://cortexjs.io/docs/mathlive/)
- Join our [Gitter community](https://gitter.im/cortex-js/community)
- Drop a line to arno@arno.org or [/u/real_arnog](https://www.reddit.com/user/real_arnog)
## License
This project is licensed under the [MIT License](LICENSE.txt).

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc