mathlive
Advanced tools
Comparing version
@@ -1,2 +0,2 @@ | ||
/* 0.104.0 */ import type { Keys } from './types-utils'; | ||
/* 0.104.1 */ import type { Keys } from './types-utils'; | ||
import type { InsertOptions, ParseMode, Style, TabularEnvironment } from './core-types'; | ||
@@ -104,2 +104,5 @@ import type { Mathfield, Model } from './mathfield'; | ||
toggleKeystrokeCaption: (mathfield: Mathfield) => boolean; | ||
toggleVirtualKeyboard: (mathfield: Mathfield) => boolean; | ||
showVirtualKeyboard: (mathfield: Mathfield) => boolean; | ||
hideVirtualKeyboard: (mathfield: Mathfield) => boolean; | ||
plonk: (mathfield: Mathfield) => boolean; | ||
@@ -106,0 +109,0 @@ switchMode: (mathfield: Mathfield, mode: ParseMode) => boolean; |
@@ -1,2 +0,3 @@ | ||
/* 0.104.0 */ export type MathstyleName = 'displaystyle' | 'textstyle' | 'scriptstyle' | 'scriptscriptstyle'; | ||
/* 0.104.1 */ /** @category Styles */ | ||
export type MathstyleName = 'displaystyle' | 'textstyle' | 'scriptstyle' | 'scriptscriptstyle'; | ||
/** @internal */ | ||
@@ -33,4 +34,6 @@ export type ArgumentType = ParseMode | ('bbox' | 'colspec' | 'delim' | 'value' | 'rest' | 'string' | 'balanced-string' | 'expression' | 'auto'); | ||
| `improper-alphabetic-constant` | The alphabetic constant prefix `` ` `` was not followed by a letter or single character command. | | ||
*/ | ||
* @category Conversion | ||
*/ | ||
export type ParserErrorCode = 'unknown-command' | 'invalid-command' | 'unbalanced-braces' | 'unknown-environment' | 'unbalanced-environment' | 'unbalanced-mode-shift' | 'missing-argument' | 'too-many-infix-commands' | 'unexpected-command-in-string' | 'missing-unit' | 'unexpected-delimiter' | 'unexpected-token' | 'unexpected-end-of-string' | 'improper-alphabetic-constant'; | ||
/** @category Conversion */ | ||
export type LatexSyntaxError<T = ParserErrorCode> = { | ||
@@ -73,2 +76,4 @@ code: T; | ||
* * {@linkcode Style} | ||
* | ||
* @category Styles | ||
*/ | ||
@@ -91,7 +96,20 @@ export type Variant = 'ams' | 'double-struck' | 'calligraphic' | 'script' | 'fraktur' | 'sans-serif' | 'monospace' | 'normal' | 'main' | 'math'; | ||
* @category Styles | ||
*/ | ||
export type VariantStyle = 'up' | 'bold' | 'italic' | 'bolditalic' | ''; | ||
/** | ||
* @category Styles | ||
*/ | ||
export type FontShape = 'auto' | 'n' | 'it' | 'sl' | 'sc' | ''; | ||
/** | ||
* @category Styles | ||
*/ | ||
export type FontSeries = 'auto' | 'm' | 'b' | 'l' | ''; | ||
/** | ||
* @category Styles | ||
*/ | ||
export type FontFamily = 'none' | 'roman' | 'monospace' | 'sans-serif'; | ||
/** | ||
* @category Styles | ||
*/ | ||
export type FontSize = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10; | ||
@@ -108,3 +126,8 @@ /** | ||
* * [Interacting with a Mathfield](mathfield/guides/interacting/) | ||
* | ||
* @category Styles | ||
*/ | ||
/** | ||
* @category Styles | ||
*/ | ||
export interface Style { | ||
@@ -123,3 +146,3 @@ color?: string; | ||
* * {@linkcode MacroDictionary} | ||
* * {@link //mathfield/guides/macros/} | ||
* * [Macros guide](//mathfield/guides/macros/) | ||
* | ||
@@ -131,4 +154,7 @@ * @category Macros | ||
def: string; | ||
/** Number of arguments (`#1`, etc...) in the macro definition */ | ||
args?: number; | ||
/** If `false` elements inside the macro can be selected */ | ||
captureSelection?: boolean; | ||
/** If `false`, even if `expandMacro` is true, do not expand. */ | ||
expand?: boolean; | ||
@@ -258,3 +284,3 @@ }; | ||
| `"math-ml"` | A string of MathML markup. | | ||
' `"plain-text"` | A plain text rendering of the content. | | ||
| `"plain-text"` | A plain text rendering of the content. | | ||
| `"spoken"` | Spoken text rendering, using the default format defined in config, which could be either text or SSML markup. | | ||
@@ -265,10 +291,13 @@ | `"spoken-text"` | A plain spoken text rendering of the content. | | ||
* To use the`"math-json"` format the Compute Engine library must be loaded. Use for example: | ||
* | ||
To use the`"math-json"` format the Compute Engine library must be loaded. Use for example: | ||
```js | ||
import "https://unpkg.com/@cortex-js/compute-engine?module"; | ||
``` | ||
* | ||
* @category Mathfield | ||
*/ | ||
export type OutputFormat = 'ascii-math' | 'latex' | 'latex-expanded' | 'latex-unstyled' | 'latex-without-placeholders' | 'math-json' | 'math-ml' | 'plain-text' | 'spoken' | 'spoken-text' | 'spoken-ssml' | 'spoken-ssml-with-highlighting'; | ||
/** | ||
* @category Mathfield | ||
*/ | ||
export type InsertOptions = { | ||
@@ -315,2 +344,5 @@ /** If `"auto"` or omitted, the current mode is used */ | ||
}; | ||
/** | ||
* @category Styles | ||
*/ | ||
export type ApplyStyleOptions = { | ||
@@ -322,3 +354,6 @@ range?: Range; | ||
/** | ||
* Some additional information about an element in the formula | ||
* Some additional information about an element of the formula | ||
* returned by `mf.getElementInfo()`. | ||
* | ||
* @category Mathfield | ||
*/ | ||
@@ -346,3 +381,5 @@ export type ElementInfo = { | ||
/** | ||
* A position of the caret/insertion point from the beginning of the formula. | ||
* Position of the caret/insertion point from the beginning of the formula. The first position is 0. The last valid offset is `mf.lastOffset`. | ||
* | ||
* @category Selection | ||
*/ | ||
@@ -354,6 +391,6 @@ export type Offset = number; | ||
* | ||
* A range is said to be collapsed when start and end are equal. | ||
* 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 | ||
* offset relative to the last valid offset, i.e. -1 is the last valid offset, -2 | ||
* is one offset before that, etc... | ||
@@ -367,2 +404,4 @@ * | ||
* * {@linkcode Selection} | ||
* | ||
* @category Selection | ||
*/ | ||
@@ -387,2 +426,3 @@ export type Range = [start: Offset, end: Offset]; | ||
* * {@linkcode Range} | ||
* @category Selection | ||
*/ | ||
@@ -389,0 +429,0 @@ export type Selection = { |
@@ -1,2 +0,2 @@ | ||
/* 0.104.0 */ import type { Selector } from './commands'; | ||
/* 0.104.1 */ import type { Selector } from './commands'; | ||
import type { Expression, LatexSyntaxError, MacroDictionary, Offset, ParseMode, Registers, Style, Selection, Range, OutputFormat, ElementInfo, InsertOptions } from './core-types'; | ||
@@ -9,28 +9,29 @@ import type { InsertStyleHook, Mathfield } from './mathfield'; | ||
/** | ||
* ## Event re-targeting | ||
* Some events bubble up through the DOM tree, so that they are detectable by | ||
* any element on the page. | ||
* | ||
* Bubbling events fired from within shadow DOM are re-targeted so that, to any | ||
* listener external to your component, they appear to come from your | ||
* component itself. | ||
* ## Custom Event Bubbling | ||
* By default, a bubbling custom event fired inside shadow DOM will stop | ||
* bubbling when it reaches the shadow root. | ||
* To make a custom event pass through shadow DOM boundaries, you must set | ||
* both the `composed` and `bubbles` flags to true. | ||
* The `move-out` event signals that the user pressed an **arrow** key or | ||
* **tab** key but there was no navigation possible inside the mathfield. | ||
* | ||
* This event provides an opportunity to handle this situation, for example | ||
* by focusing an element adjacent to the mathfield. | ||
* | ||
* If the event is canceled (i.e. `evt.preventDefault()` is called inside your | ||
* event handler), the default behavior is to play a "plonk" sound. | ||
* | ||
* @category Web Component | ||
* **Event re-targeting** | ||
* | ||
* Some events bubble up through the DOM tree, so that they are detectable by | ||
* any element on the page. | ||
* | ||
* Bubbling events fired from within shadow DOM are re-targeted so that, to any | ||
* listener external to your component, they appear to come from your | ||
* component itself. | ||
* | ||
* **Custom Event Bubbling** | ||
* | ||
* By default, a bubbling custom event fired inside shadow DOM will stop | ||
* bubbling when it reaches the shadow root. | ||
* | ||
* To make a custom event pass through shadow DOM boundaries, you must set | ||
* both the `composed` and `bubbles` flags to true. | ||
* | ||
* The `move-out` event signals that the user pressed an **arrow** key or | ||
* **tab** key but there was no navigation possible inside the mathfield. | ||
* | ||
* This event provides an opportunity to handle this situation, for example | ||
* by focusing an element adjacent to the mathfield. | ||
* | ||
* If the event is canceled (i.e. `evt.preventDefault()` is called inside your | ||
* event handler), the default behavior is to play a "plonk" sound. | ||
* | ||
* @category Mathfield | ||
*/ | ||
@@ -69,6 +70,5 @@ export type MoveOutEvent = { | ||
/** | ||
* These attributes of the `<math-field>` element correspond to the | ||
* [MathfieldOptions] properties. | ||
* These attributes of the `<math-field>` element correspond to matching properties. | ||
* | ||
* @category Web Component | ||
* @category Mathfield | ||
*/ | ||
@@ -197,25 +197,18 @@ export interface MathfieldElementAttributes { | ||
/** | ||
* The `MathfieldElement` class represent a DOM element that displays | ||
* math equations. | ||
* | ||
* The `MathfieldElement` class is a DOM element that provides a math input | ||
* field. | ||
* | ||
* It is a subclass of the standard | ||
* [`HTMLElement`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement) | ||
* class and as such inherits all of its properties and methods. | ||
* class and as such inherits all of its properties and methods, such | ||
* as `style`, `tabIndex`, `addEventListener()`, `getAttribute()`, etc... | ||
* | ||
* It inherits many useful properties and methods from `HTMLElement` such | ||
* as `style`, `tabIndex`, `addEventListener()`, `getAttribute()`, etc... | ||
* | ||
* It is typically used to render a single equation. | ||
* | ||
* To render multiple equations, use multiple instances of `MathfieldElement`. | ||
* | ||
* The `MathfieldElement` class provides special properties and methods to | ||
* The `MathfieldElement` class provides additional properties and methods to | ||
* control the display and behavior of `<math-field>` elements. | ||
* | ||
* **To instantiate a `MathfieldElement`** use the `<math-field>` tag in HTML. | ||
* You can also instantiate a `MathfieldElement` programmatically using | ||
* `new MathfieldElement()`. | ||
* | ||
* You will usually instantiate a `MathfieldElement` using the | ||
* `<math-field>` tag in HTML. However, if necessary you can also create | ||
* it programmatically using `new MathfieldElement()`. | ||
* | ||
* | ||
* ```javascript | ||
@@ -227,11 +220,15 @@ * // 1. Create a new MathfieldElement | ||
* document.body.appendChild(mf); | ||
* ``` | ||
* | ||
* // Modifying options after construction | ||
* mf.smartFence = true; | ||
* // 3. Modifying options after construction | ||
* mf.addEventListener("mount"), () => { | ||
* mf.smartFence = true; | ||
* }); | ||
* ``` | ||
* | ||
* Read more about customizing the appearance and behavior of the mathfield in | ||
* the [Customizing the Mathfield](mathfield/guides/customizing/) guide. | ||
* | ||
* #### MathfieldElement CSS Variables | ||
* | ||
* To customize the appearance of the mathfield, declare the following CSS | ||
* **To customize the appearance of the mathfield**, declare the following CSS | ||
* variables (custom properties) in a ruleset that applies to the mathfield. | ||
@@ -250,15 +247,5 @@ * | ||
* ``` | ||
* <div className='symbols-table' style={{"--first-col-width":"25ex"}}> | ||
* | ||
* | CSS Variable | Usage | | ||
* |:---|:---| | ||
* | `--hue` | Hue of the highlight color and the caret | | ||
* | `--contains-highlight-background-color` | Backround property for items that contain the caret | | ||
* | `--primary-color` | Primary accent color, used for example in the virtual keyboard | | ||
* | `--text-font-family` | The font stack used in text mode | | ||
* | `--smart-fence-opacity` | Opacity of a smart fence (default is 50%) | | ||
* | `--smart-fence-color` | Color of a smart fence (default is current color) | | ||
* Read more about the [CSS variables](mathfield/guides/customizing/#css-variables) available for customization. | ||
* | ||
* </div> | ||
* | ||
* You can customize the appearance and zindex of the virtual keyboard panel | ||
@@ -272,9 +259,10 @@ * with some CSS variables associated with a selector that applies to the | ||
* | ||
* To style the virtual keyboard toggle, use the `virtual-keyboard-toggle` CSS | ||
* part. To use it, define a CSS rule with a `::part()` selector | ||
* for example: | ||
* In addition to the CSS variables, the mathfield exposes [CSS | ||
* parts that can be used to style the mathfield](https://cortexjs.io/mathfield/guides/customizing/#mathfield-parts) | ||
* | ||
* For example, to hide the menu button: | ||
* | ||
* ```css | ||
* math-field::part(virtual-keyboard-toggle) { | ||
* color: red; | ||
* math-field::part(menu-toggle) { | ||
* display: none; | ||
* } | ||
@@ -298,4 +286,4 @@ * ``` | ||
* ```javascript | ||
* getElementById('mf').value = "\\sin x"; | ||
* getElementById('mf').letterShapeStyle = "text"; | ||
* mf.value = "\\sin x"; | ||
* mf.letterShapeStyle = "text"; | ||
* ``` | ||
@@ -307,7 +295,8 @@ * | ||
* ```javascript | ||
* getElementById('mf').setAttribute('letter-shape-style', 'french'); | ||
* console.log(getElementById('mf').letterShapeStyle); | ||
* mf.setAttribute('letter-shape-style', 'french'); | ||
* console.log(mf.letterShapeStyle); | ||
* // Result: "french" | ||
* getElementById('mf').letterShapeStyle ='tex; | ||
* console.log(getElementById('mf').getAttribute('letter-shape-style'); | ||
* | ||
* mf.letterShapeStyle ='tex; | ||
* console.log(mf.getAttribute('letter-shape-style'); | ||
* // Result: 'tex' | ||
@@ -344,3 +333,3 @@ * ``` | ||
* | ||
* See `MathfieldOptions` for more details about these options. | ||
* See the corresponding property for more details about these options. | ||
* | ||
@@ -360,3 +349,3 @@ * In addition, the following [global attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes) | ||
* | ||
* Listen to these events by using `addEventListener()`. For events with | ||
* Listen to these events by using `mf.addEventListener()`. For events with | ||
* additional arguments, the arguments are available in `event.detail`. | ||
@@ -386,9 +375,9 @@ * | ||
* </div> | ||
* @category Mathfield | ||
* @keywords zindex, events, attribute, attributes, property, properties, parts, variables, css, mathfield, mathfieldelement | ||
* | ||
* @category Web Component | ||
* @keywords zindex, events, attribute, attributes, property, properties, parts, variables, css, mathfield, mathfieldelement | ||
*/ | ||
export declare class MathfieldElement extends HTMLElement implements Mathfield { | ||
static version: string; | ||
/** @internal */ | ||
static get formAssociated(): boolean; | ||
@@ -491,3 +480,7 @@ /** | ||
* The value of the properties should be either a string, the name of an | ||
* audio file in the `soundsDirectory` directory or `null` to suppress the sound. | ||
* audio file in the `soundsDirectory` directory or `null` to suppress | ||
* the sound. | ||
* | ||
* If the `soundsDirectory` is `null`, no sound will be played. | ||
* | ||
* @category Virtual Keyboard | ||
@@ -517,3 +510,6 @@ */ | ||
* - a string, the name of an audio file in the `soundsDirectory` directory | ||
* - null to turn off the sound | ||
* - `null` to turn off the sound | ||
* | ||
* If the `soundsDirectory` is `null`, no sound will be played. | ||
* | ||
*/ | ||
@@ -534,2 +530,5 @@ static get plonkSound(): string | null; | ||
* according to a policy defined by the host. | ||
* | ||
* Consider using this option if you are displaying untrusted content. Read more about [Security Considerations](mathfield/guides/security/) | ||
* | ||
*/ | ||
@@ -547,2 +546,3 @@ static createHTML: (html: string) => any; | ||
* {@link mathfield/guides/speech/ | Guide: Speech} | ||
* @category Speech | ||
*/ | ||
@@ -561,2 +561,3 @@ static get speechEngine(): 'local' | 'amazon'; | ||
* twice the default rate. | ||
* @category Speech | ||
*/ | ||
@@ -573,2 +574,3 @@ static get speechEngineRate(): string; | ||
* | ||
* @category Speech | ||
*/ | ||
@@ -584,2 +586,3 @@ static get speechEngineVoice(): string; | ||
* markup, i.e. `[[ltr]]`. | ||
* @category Speech | ||
* | ||
@@ -605,2 +608,3 @@ */ | ||
* {@link mathfield/guides/speech/ | Guide: Speech} | ||
* @category Speech | ||
*/ | ||
@@ -619,2 +623,3 @@ static get textToSpeechRules(): 'mathlive' | 'sre'; | ||
* {@link https://github.com/zorkow/speech-rule-engine | here} | ||
* @category Speech | ||
*/ | ||
@@ -625,3 +630,5 @@ static get textToSpeechRulesOptions(): Readonly<Record<string, string>>; | ||
private static _textToSpeechRulesOptions; | ||
/** @category Speech */ | ||
static speakHook: (text: string) => void; | ||
/** @category Speech */ | ||
static readAloudHook: (element: HTMLElement, text: string) => void; | ||
@@ -674,2 +681,4 @@ /** | ||
* | ||
* **Default**: `true` | ||
* @category Customization | ||
*/ | ||
@@ -704,5 +713,5 @@ static restoreFocusWhenDocumentFocused: boolean; | ||
* numerator and navigator are traversed: | ||
* - "numerator-denominator": first the elements in the numerator, then | ||
* - `"numerator-denominator"`: first the elements in the numerator, then | ||
* the elements in the denominator. | ||
* - "denominator-numerator": first the elements in the denominator, then | ||
* - `"denominator-numerator"`: first the elements in the denominator, then | ||
* the elements in the numerator. In some East-Asian cultures, fractions | ||
@@ -766,2 +775,3 @@ * are read and written denominator first ("fēnzhī"). With this option | ||
constructor(options?: Partial<MathfieldOptions>); | ||
/** @category Menu */ | ||
showMenu(_: { | ||
@@ -780,3 +790,4 @@ location: { | ||
* Return the content of the `\placeholder{}` command with the `placeholderId` | ||
* @category Prompts */ | ||
* @category Prompts | ||
*/ | ||
getPromptValue(placeholderId: string, format?: OutputFormat): string; | ||
@@ -806,4 +817,7 @@ /** @category Prompts */ | ||
}): string[]; | ||
/** @internal */ | ||
get form(): HTMLFormElement | null; | ||
/** @internal */ | ||
get name(): string; | ||
/** @internal */ | ||
get type(): string; | ||
@@ -853,3 +867,2 @@ get mode(): ParseMode; | ||
/** | ||
* @category Commands | ||
* Execute a [`command`](#commands) defined by a selector. | ||
@@ -871,2 +884,3 @@ * ```javascript | ||
* ``` | ||
* @category Commands | ||
*/ | ||
@@ -964,3 +978,3 @@ executeCommand(selector: Selector): boolean; | ||
* | ||
* @category Accessing and changing the content | ||
* @category Styles | ||
*/ | ||
@@ -979,3 +993,3 @@ applyStyle(style: Readonly<Style>, options?: Range | { | ||
* | ||
* @category Accessing and changing the content | ||
* @category Styles | ||
*/ | ||
@@ -1045,7 +1059,4 @@ queryStyle(style: Readonly<Style>): 'some' | 'all' | 'none'; | ||
get value(): string; | ||
set value(value: string); | ||
/** | ||
* @category Accessing and changing the content | ||
*/ | ||
set value(value: string); | ||
/** @category Customization | ||
* The mode of the element when it is empty: | ||
@@ -1055,6 +1066,7 @@ * - `"math"`: equivalent to `\displaystyle` (display math mode) | ||
* - `"text"`: text mode | ||
* @category Customization | ||
*/ | ||
get defaultMode(): 'inline-math' | 'math' | 'text'; | ||
set defaultMode(value: 'inline-math' | 'math' | 'text'); | ||
/** @category Customization | ||
/** | ||
* A dictionary of LaTeX macros to be used to interpret and render the content. | ||
@@ -1080,11 +1092,13 @@ * | ||
``` | ||
@category Macros | ||
*/ | ||
get macros(): Readonly<MacroDictionary>; | ||
set macros(value: MacroDictionary); | ||
/** @category Customization | ||
/** | ||
* @inheritDoc Registers | ||
* @category Registers | ||
*/ | ||
get registers(): Registers; | ||
set registers(value: Registers); | ||
/** @category Customization | ||
/** | ||
* Map a color name as used in commands such as `\textcolor{}{}` or | ||
@@ -1108,2 +1122,4 @@ * `\colorbox{}{}` to a CSS color value. | ||
* `purple`, `magenta`, `black`, `dark-grey`, `grey`, `light-grey`, `white` | ||
* | ||
* @category Customization | ||
*/ | ||
@@ -1115,3 +1131,3 @@ get colorMap(): (name: string) => string | undefined; | ||
set backgroundColorMap(value: (name: string) => string | undefined); | ||
/** @category Customization | ||
/** | ||
* Control the letter shape style: | ||
@@ -1143,6 +1159,8 @@ | ||
* that this convention is not universally followed. | ||
* | ||
* @category Customization | ||
*/ | ||
get letterShapeStyle(): 'auto' | 'tex' | 'iso' | 'french' | 'upright'; | ||
set letterShapeStyle(value: 'auto' | 'tex' | 'iso' | 'french' | 'upright'); | ||
/** @category Customization | ||
/** | ||
* Set the minimum relative font size for nested superscripts and fractions. The value | ||
@@ -1154,13 +1172,17 @@ * should be a number between `0` and `1`. The size is in releative `em` units relative to the | ||
* **Default**: `0` | ||
* | ||
* @category Customization | ||
*/ | ||
get minFontScale(): number; | ||
set minFontScale(value: number); | ||
/** @category Customization | ||
/** | ||
* Sets the maximum number of columns for the matrix environment. The default is | ||
* 10 columns to match the behavior of the amsmath matrix environment. | ||
* **Default**: `10` | ||
* | ||
* @category Customization | ||
*/ | ||
get maxMatrixCols(): number; | ||
set maxMatrixCols(value: number); | ||
/** @category Customization | ||
/** | ||
* When `true`, during text input the field will switch automatically between | ||
@@ -1199,6 +1221,8 @@ * 'math' and 'text' mode depending on what is typed and the context of the | ||
* - `For all n in NN` | ||
* | ||
* @category Customization | ||
*/ | ||
get smartMode(): boolean; | ||
set smartMode(value: boolean); | ||
/** @category Customization | ||
/** | ||
* | ||
@@ -1210,6 +1234,7 @@ * When `true` and an open fence is entered via `typedText()` it will | ||
* When `false`, the literal value of the character will be inserted instead. | ||
* @category Customization | ||
*/ | ||
get smartFence(): boolean; | ||
set smartFence(value: boolean); | ||
/** @category Customization | ||
/** | ||
* When `true` and a digit is entered in an empty superscript, the cursor | ||
@@ -1224,6 +1249,7 @@ * leaps automatically out of the superscript. This makes entry of common | ||
* manually. | ||
* @category Customization | ||
*/ | ||
get smartSuperscript(): boolean; | ||
set smartSuperscript(value: boolean); | ||
/** @category Customization | ||
/** | ||
* This option controls how many levels of subscript/superscript can be entered. For | ||
@@ -1242,6 +1268,7 @@ * example, if `scriptDepth` is "1", there can be one level of superscript or | ||
* suppress the entry of subscripts, and allow one level of superscripts. | ||
* @category Customization | ||
*/ | ||
get scriptDepth(): number | [number, number]; | ||
set scriptDepth(value: number | [number, number]); | ||
/** @category Customization | ||
/** | ||
* If `true`, extra parentheses around a numerator or denominator are | ||
@@ -1251,6 +1278,7 @@ * removed automatically. | ||
* **Default**: `true` | ||
* @category Customization | ||
*/ | ||
get removeExtraneousParentheses(): boolean; | ||
set removeExtraneousParentheses(value: boolean); | ||
/** @category Customization | ||
/** | ||
* The LaTeX string to insert when the spacebar is pressed (on the physical or | ||
@@ -1266,18 +1294,22 @@ * virtual keyboard). | ||
* **Default**: `""` (empty string) | ||
* @category Customization | ||
*/ | ||
get mathModeSpace(): string; | ||
set mathModeSpace(value: string); | ||
/** @category Customization | ||
/** | ||
* The symbol used to represent a placeholder in an expression. | ||
* | ||
* **Default**: `▢` `U+25A2 WHITE SQUARE WITH ROUNDED CORNERS` | ||
* | ||
* @category Customization | ||
*/ | ||
get placeholderSymbol(): string; | ||
set placeholderSymbol(value: string); | ||
/** @category Customization | ||
/** | ||
* A LaTeX string displayed inside the mathfield when there is no content. | ||
* @category Customization | ||
*/ | ||
get placeholder(): string; | ||
set placeholder(value: string); | ||
/** @category Customization | ||
/** | ||
* If `"auto"` a popover with suggestions may be displayed when a LaTeX | ||
@@ -1287,2 +1319,4 @@ * command is input. | ||
* **Default**: `"auto"` | ||
* | ||
* @category Customization | ||
*/ | ||
@@ -1292,3 +1326,3 @@ get popoverPolicy(): 'auto' | 'off'; | ||
/** | ||
* @category Customization | ||
* | ||
* If `"auto"` a popover with commands to edit an environment (matrix) | ||
@@ -1298,2 +1332,4 @@ * is displayed when the virtual keyboard is displayed. | ||
* **Default**: `"auto"` | ||
* | ||
* @category Customization | ||
*/ | ||
@@ -1303,3 +1339,3 @@ get environmentPopoverPolicy(): 'auto' | 'off' | 'on'; | ||
/** | ||
* @category Customization | ||
* @category Menu | ||
*/ | ||
@@ -1309,3 +1345,2 @@ get menuItems(): Readonly<MenuItem[]>; | ||
/** | ||
* @category Customization | ||
* @category Virtual Keyboard | ||
@@ -1315,9 +1350,10 @@ */ | ||
set mathVirtualKeyboardPolicy(value: VirtualKeyboardPolicy); | ||
/** @category Customization | ||
/** | ||
* The keys of this object literal indicate the sequence of characters | ||
* that will trigger an inline shortcut. | ||
* @category Keyboard Shortcuts | ||
*/ | ||
get inlineShortcuts(): Readonly<InlineShortcutDefinitions>; | ||
set inlineShortcuts(value: InlineShortcutDefinitions); | ||
/** @category Customization | ||
/** | ||
* Maximum time, in milliseconds, between consecutive characters for them to be | ||
@@ -1343,13 +1379,14 @@ * considered part of the same shortcut sequence. | ||
* shortcuts. | ||
* @category Keyboard Shortcuts | ||
*/ | ||
get inlineShortcutTimeout(): number; | ||
set inlineShortcutTimeout(value: number); | ||
/** @category Customization */ | ||
/** @category Keyboard Shortcuts */ | ||
get keybindings(): Readonly<Keybinding[]>; | ||
set keybindings(value: Readonly<Keybinding[]>); | ||
/** @category Hooks | ||
/** @category Styles | ||
*/ | ||
get onInsertStyle(): InsertStyleHook | undefined | null; | ||
set onInsertStyle(value: InsertStyleHook | undefined | null); | ||
/** @category Hooks | ||
/** | ||
* A hook invoked when a string of characters that could be | ||
@@ -1362,6 +1399,7 @@ * interpreted as shortcut has been typed. | ||
* for example `\mathrm{${symbol}}`. | ||
* @category Hooks | ||
*/ | ||
get onInlineShortcut(): (sender: Mathfield, symbol: string) => string; | ||
set onInlineShortcut(value: (sender: Mathfield, symbol: string) => string); | ||
/** @category Hooks | ||
/** | ||
* A hook invoked when scrolling the mathfield into view is necessary. | ||
@@ -1371,6 +1409,7 @@ * | ||
* when the mathfield is in another div that has scrollable content. | ||
* @category Hooks | ||
*/ | ||
get onScrollIntoView(): ((sender: Mathfield) => void) | null; | ||
set onScrollIntoView(value: ((sender: Mathfield) => void) | null); | ||
/** @category Hooks | ||
/** | ||
* This hook is invoked when the user has requested to export the content | ||
@@ -1390,3 +1429,3 @@ * of the mathfield, for example when pressing ctrl/command+C. | ||
* ``` | ||
* | ||
* @category Hooks | ||
*/ | ||
@@ -1397,5 +1436,9 @@ get onExport(): (from: Mathfield, latex: string, range: Range) => string; | ||
set readOnly(value: boolean); | ||
/** | ||
* This is a standard DOM property | ||
* @internal */ | ||
get isSelectionEditable(): boolean; | ||
/** @category Prompts */ | ||
setPromptState(id: string, state: 'correct' | 'incorrect' | 'undefined' | undefined, locked?: boolean): void; | ||
/** @category Prompts */ | ||
getPromptState(id: string): ['correct' | 'incorrect' | undefined, boolean]; | ||
@@ -1402,0 +1445,0 @@ /** @category Virtual Keyboard */ |
@@ -1,3 +0,4 @@ | ||
/* 0.104.0 */ import type { Selector } from './commands'; | ||
/* 0.104.1 */ import type { Selector } from './commands'; | ||
import type { ApplyStyleOptions, InsertOptions, Offset, OutputFormat, Style, Range, Selection } from './core-types'; | ||
/** @category Styles */ | ||
export type InsertStyleHook = (sender: Mathfield, at: Offset, info: { | ||
@@ -4,0 +5,0 @@ before: Offset; |
@@ -1,2 +0,2 @@ | ||
/* 0.104.0 */ /** | ||
/* 0.104.1 */ /** | ||
* Server-side rendering exports. | ||
@@ -49,2 +49,7 @@ * | ||
export declare function convertLatexToMarkup(text: string, options?: Partial<LayoutOptions>): string; | ||
/** | ||
* Check if a string of LaTeX is valid and return an array of syntax errors. | ||
* | ||
* @category Conversion | ||
*/ | ||
export declare function validateLatex(s: string): LatexSyntaxError[]; | ||
@@ -51,0 +56,0 @@ /** |
@@ -1,2 +0,2 @@ | ||
/* 0.104.0 */ /** | ||
/* 0.104.1 */ /** | ||
* | ||
@@ -23,3 +23,3 @@ * Importing this package in a web page will make the `<math-field>` custom | ||
* @packageDocumentation Mathfield API Reference | ||
* @version 0.104.0 | ||
* @version 0.104.1 | ||
* | ||
@@ -26,0 +26,0 @@ */ |
@@ -1,6 +0,6 @@ | ||
/* 0.104.0 */ import type { Mathfield, InsertStyleHook } from './mathfield'; | ||
/* 0.104.1 */ import type { Mathfield, InsertStyleHook } from './mathfield'; | ||
import type { Selector } from './commands'; | ||
import type { ParseMode, MacroDictionary, Registers, Range } from './core-types'; | ||
/** | ||
* Specify behavior for origin validation. | ||
* Specify behavior for origin validation when using the virtual keyboard. | ||
* | ||
@@ -17,3 +17,3 @@ * <div className='symbols-table' style={{"--first-col-width":"32ex"}}> | ||
* | ||
* @category Options | ||
* @category Virtual Keyboard | ||
*/ | ||
@@ -38,3 +38,3 @@ export type OriginValidator = ((origin: string) => boolean) | 'same-origin' | 'none'; | ||
* ``` | ||
* @category Options | ||
* @category Keyboard Shortcuts | ||
*/ | ||
@@ -170,3 +170,3 @@ export type Keybinding = { | ||
* | ||
* @category Options | ||
* @category Keyboard Shortcuts | ||
*/ | ||
@@ -177,3 +177,3 @@ export type InlineShortcutDefinition = string | { | ||
}; | ||
/** @category Options */ | ||
/** @category Keyboard Shortcuts */ | ||
export type InlineShortcutDefinitions = Record<string, InlineShortcutDefinition>; | ||
@@ -184,3 +184,3 @@ /** | ||
* should proceed. | ||
* @category Options | ||
* @internal | ||
*/ | ||
@@ -193,5 +193,5 @@ export interface MathfieldHooks { | ||
} | ||
/** @category Options */ | ||
/** @internal */ | ||
export type ContentChangeType = 'insertText' | 'insertLineBreak' | 'insertFromPaste' | 'historyUndo' | 'historyRedo' | 'deleteByCut' | 'deleteContent' | 'deleteContentBackward' | 'deleteContentForward' | 'deleteWordBackward' | 'deleteWordForward' | 'deleteSoftLineBackward' | 'deleteSoftLineForward' | 'deleteHardLineBackward' | 'deleteHardLineForward'; | ||
/** @category Options */ | ||
/** @internal */ | ||
export type ContentChangeOptions = { | ||
@@ -202,7 +202,7 @@ data?: string | null; | ||
}; | ||
/** @category Options */ | ||
/** @internal */ | ||
export type KeyboardOptions = { | ||
keybindings: Readonly<Keybinding[]>; | ||
}; | ||
/** @category Options */ | ||
/** @internal */ | ||
export type InlineShortcutsOptions = { | ||
@@ -212,3 +212,3 @@ inlineShortcuts: InlineShortcutDefinitions; | ||
}; | ||
/** @category Options */ | ||
/** @internal */ | ||
export type EditingOptions = { | ||
@@ -243,3 +243,3 @@ /** When `true`, the user cannot edit the mathfield. The mathfield can still | ||
}; | ||
/** @category Options */ | ||
/** @internal */ | ||
export type LayoutOptions = { | ||
@@ -259,4 +259,3 @@ defaultMode: 'inline-math' | 'math' | 'text'; | ||
/** | ||
* @category Options | ||
* @keywords security, trust, sanitize, errors | ||
* @internal | ||
*/ | ||
@@ -297,3 +296,3 @@ export type MathfieldOptions = LayoutOptions & EditingOptions & InlineShortcutsOptions & KeyboardOptions & MathfieldHooks & { | ||
* | ||
* @category Options | ||
* @category Localization | ||
*/ | ||
@@ -308,3 +307,3 @@ export 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'; | ||
* | ||
* @category Options | ||
* @category Localization | ||
* | ||
@@ -319,3 +318,3 @@ */ | ||
* | ||
* @category Options | ||
* @category Localization | ||
* | ||
@@ -380,4 +379,4 @@ */ | ||
delimiters?: { | ||
display?: [openDelim: string, closeDelim: string][]; | ||
inline?: [openDelim: string, closeDelim: string][]; | ||
display?: string[]; | ||
inline?: string[]; | ||
}; | ||
@@ -384,0 +383,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
/* 0.104.0 */ /** | ||
/* 0.104.1 */ /** | ||
* @internal | ||
@@ -3,0 +3,0 @@ */ |
@@ -1,2 +0,2 @@ | ||
/* 0.104.0 */ export type KeyboardModifiers = { | ||
/* 0.104.1 */ export type KeyboardModifiers = { | ||
alt: boolean; | ||
@@ -3,0 +3,0 @@ control: boolean; |
@@ -1,2 +0,2 @@ | ||
/* 0.104.0 */ import type { KeyboardModifiers } from './ui-events-types'; | ||
/* 0.104.1 */ import type { KeyboardModifiers } from './ui-events-types'; | ||
/** | ||
@@ -3,0 +3,0 @@ * The type of a menu item: |
@@ -1,2 +0,2 @@ | ||
/* 0.104.0 */ import type { Selector } from './commands'; | ||
/* 0.104.1 */ import type { Selector } from './commands'; | ||
import type { ParseMode, Style } from './core-types'; | ||
@@ -3,0 +3,0 @@ import type { OriginValidator } from './options'; |
{ | ||
"name": "mathlive", | ||
"version": "0.104.0", | ||
"version": "0.104.1", | ||
"description": "A web component for math input", | ||
@@ -134,3 +134,3 @@ "license": "MIT", | ||
"dependencies": { | ||
"@cortex-js/compute-engine": "0.27.0" | ||
"@cortex-js/compute-engine": "0.28.0" | ||
}, | ||
@@ -141,25 +141,23 @@ "devDependencies": { | ||
"@playwright/test": "^1.43.0", | ||
"@types/css-font-loading-module": "0.0.13", | ||
"@types/jest": "^29.5.12", | ||
"@typescript-eslint/eslint-plugin": "^7.0.1", | ||
"@typescript-eslint/parser": "^7.0.1", | ||
"@typescript-eslint/eslint-plugin": "^8.26.1", | ||
"@typescript-eslint/parser": "^8.26.1", | ||
"autoprefixer": "^10.4.17", | ||
"concat-md": "^0.5.1", | ||
"cssnano": "^6.0.3", | ||
"esbuild": "^0.21.5", | ||
"eslint": "^8.57.0", | ||
"eslint-config-prettier": "^9.1.0", | ||
"eslint-plugin-import": "^2.29.1", | ||
"eslint-plugin-no-unsanitized": "^4.0.2", | ||
"eslint-plugin-prettier": "^5.1.3", | ||
"esbuild": "^0.25.1", | ||
"eslint": "^9.22.0", | ||
"eslint-config-prettier": "^10.1.1", | ||
"eslint-plugin-import": "^2.31.0", | ||
"eslint-plugin-no-unsanitized": "^4.1.2", | ||
"eslint-plugin-prettier": "^5.2.3", | ||
"jest": "^29.7.0", | ||
"jest-silent-reporter": "^0.5.0", | ||
"less": "^4.2.0", | ||
"less": "^4.2.2", | ||
"postcss": "^8.4.35", | ||
"postcss-cli": "^11.0.0", | ||
"prettier": "^3.2.5", | ||
"prettier": "^3.5.3", | ||
"ts-jest": "^29.1.2", | ||
"typedoc": "^0.25.8", | ||
"typedoc-plugin-markdown": "^4.0.3", | ||
"typedoc-plugin-no-inherit": "^1.4.0", | ||
"typedoc": "^0.28.0", | ||
"typedoc-plugin-markdown": "^4.4.2", | ||
"typescript": "^5.3.3" | ||
@@ -166,0 +164,0 @@ }, |
@@ -80,4 +80,4 @@ <div align="center"> | ||
Check documentation for [React](https://cortexjs.io/mathlive/guides/react/) and | ||
[interaction with Mathfield](https://cortexjs.io/mathlive/guides/interacting/). | ||
Check documentation for [React](https://cortexjs.io/mathfield/guides/react/) and | ||
[interaction with Mathfield](https://cortexjs.io/mathfield/guides/interacting/). | ||
@@ -90,6 +90,6 @@ ## 📖 Documentation | ||
controlling speech output, and displaying static math formulas. You can find all | ||
of these guides on the [CortexJS.io website](https://cortexjs.io/mathlive/). | ||
of these guides on the [CortexJS.io website](https://cortexjs.io/mathfield/). | ||
In addition to the guides, you can also find reference documentation of the | ||
MathLive API on the [MathLive SDK page](https://cortexjs.io/docs/mathlive). | ||
MathLive API on the [Mathfield API Reference page](https://cortexjs.io/mathfield/api/). | ||
@@ -96,0 +96,0 @@ ## FAQ |
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
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
5502675
0.51%25
-7.41%99400
0.44%+ Added
- Removed