Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mathlive

Package Overview
Dependencies
Maintainers
1
Versions
173
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mathlive - npm Package Compare versions

Comparing version 0.58.0 to 0.59.0

2

dist/public/commands.d.ts

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

/* 0.58.0 */ import type { Keys } from './types-utils';
/* 0.59.0 */ import type { Keys } from './types-utils';
import type { ParseMode, Style } from './core';

@@ -3,0 +3,0 @@ import type { Mathfield, Model } from './mathfield';

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

/* 0.58.0 */ /**
/* 0.59.0 */ /**
* The mode that indicates how a portion of content is interpreted

@@ -117,3 +117,3 @@ *

* For example:
```typescript
```javascript
mf.setOptions({

@@ -120,0 +120,0 @@ macros: {

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

/* 0.58.0 */ import { MathfieldOptions } from './options';
/* 0.59.0 */ import { MathfieldOptions } from './options';
import { Selector } from './commands';

@@ -29,8 +29,18 @@ import { InsertOptions, Mathfield, OutputFormat, Range } from './mathfield';

};
/**
* The `keystroke` event is fired when a keystroke is about to be procesed.
* The event is cancellable, which wills suprress further handling of the event.
*
*/
export declare type KeystrokeEvent = {
/** A string descring the keystroke, for example `"Alt-KeyU". See [W3C UIEvents](https://www.w3.org/TR/uievents/#keys-keyvalues)
* for more information on the format of the descriptor.
*
*/
keystroke: string;
event: KeyboardEvent;
/** The native keyboard event */
event?: KeyboardEvent;
};
/**
* This event signals that the mathfield has lost focus through keyboard
* The `focus-out` event signals that the mathfield has lost focus through keyboard
* navigation with arrow keys or the tab key.

@@ -40,2 +50,10 @@ *

* was moving which can be useful to decide which element to focus next.
*
* The event is cancelable, which will prevent the field from losing focus.
*
* ```javascript
* mfe.addEventListener('focus-out', (ev) => {
* console.log("Losing focus ", ev.detail.direction);
* });
* ```
*/

@@ -62,3 +80,3 @@ export declare type FocusOutEvent = {

* It inherits many useful properties and methods from [[`HTMLElement`]] such
* as `style`, `tabIndex`, `addListener()`, etc...
* as `style`, `tabIndex`, `addEventListener()`, `getAttribute()`, etc...
*

@@ -68,5 +86,5 @@ * To create a new `MathfieldElement`:

* ```javascript
* // Create a new MathfieldElement
* // 1. Create a new MathfieldElement
* const mfe = new MathfieldElement();
* // Attach it to the document
* // 2. Attach it to the DOM
* document.body.appendChild(mfe);

@@ -78,3 +96,7 @@ * ```

* be modified later:
*
* ```javascript
* // Setting options during construction
* const mfe = new MathfieldElement({smartFence: false});
* // Modifying options after construction
* mfe.setOptions({smartFence: true});

@@ -85,5 +107,9 @@ * ```

*
* The following CSS variables, if applied to the mathfield element or
* to one of its ancestors, can be used to customize the appearance of the
* mathfield.
* To customize the appearance of the mathfield, declare the following CSS
* variables (custom properties) in a ruleset that applied to the mathfield.
* ```css
* math-field {
* --hue: 10 // Set the highlight color and caret to a reddish hue
* }
* ```
*

@@ -102,4 +128,4 @@ * | CSS Variable | Usage |

*
* The `virtual-keyboard-toggle` CSS part can be used to style the virtual
* keyboard toggle. To use it, define a CSS style with a `::part()` selector
* 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:

@@ -115,10 +141,15 @@ * ```css

*
* An attribute is a key-value pair set as part of the tag, for example in
* `<math-field locale="fr"></math-field>`, `locale` is an attribute.
* An attribute is a key-value pair set as part of the tag:
*
* ```html
* <math-field locale="fr"></math-field>
* ```
*
* The supported attributes are listed in the table below with their correspnding
* property. The property can be changed either directly on the
* `MathfieldElement` object, or using `setOptions()` when it is prefixed with
* property.
*
* The property can be changed either directly on the
* `MathfieldElement` object, or using `setOptions()` if it is prefixed with
* `options.`, for example
* ```
* ```javascript
* getElementById('mf').value = '\\sin x';

@@ -128,16 +159,16 @@ * getElementById('mf').setOptions({horizontalSpacingScale: 1.1});

*
* Most properties are reflected: changing the attribute will also change the
* property and vice versa) except for `value` whose attribute value is not
* updated.
* The values of attributes and properties are reflected, which means you can change one or the
* other, for example:
* ```javascript
* getElementById('mf').setAttribute('virtual-keyboard-mode', 'manual');
* console.log(getElementById('mf').getOption('virtualKeyboardMode'));
* // Result: "manual"
* getElementById('mf').setOptions({virtualKeyboardMode: 'onfocus');
* console.log(getElementById('mf').getAttribute('virtual-keyboard-mode');
* // Result: 'onfocus'
* ```
*
* An exception is the `value` property, which is not reflected on the `value`
* attribute: the `value` attribute remains at its initial value.
*
* In addition, the following [global attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes)
* can also be used:
* - `class`
* - `data-*`
* - `hidden`
* - `id`
* - `item*`
* - `style`
* - `tabindex`
*

@@ -165,2 +196,3 @@ * | Attribute | Property |

* | `text-to-speech-rules` | `options.textToSpeechRules` |
* | `value` | value |
* | `virtual-keyboard-layout` | `options.keyboardLayout` |

@@ -171,4 +203,15 @@ * | `virtual-keyboard-mode` | `options.keyboardMode` |

*
* See [[`MathfieldOptions`]] for more details about these options.
* See [[`MathfieldOptions`]] for more details about these options.
*
* In addition, the following [global attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes)
* can also be used:
* - `class`
* - `data-*`
* - `hidden`
* - `id`
* - `item*`
* - `style`
* - `tabindex`
*
*
* ### Events

@@ -179,18 +222,18 @@ *

*
* | Event Name | Event Arguments | Description |
* |:---|:---|:---|
* | `input | | The value of the mathfield has been modified |
* | `change` | | The user has commited the value of the mathfield |
* | `selection-change` | | The selection of the mathfield has changed |
* | `mode-change` | | The mode of the mathfield has changed |
* | `undo-state-change` | | The state of the undo stack has changed |
* | `read-aloud-status-change` | | The status of a read aloud operation has changed |
* | `virtual-keyboard-toggle` | | The visibility of the virtual keyboard has changed |
* | `blur` | | The mathfield is losing focus |
* | `focus` | | The mathfield is gaining focus |
* | `focus-out` | `(direction: 'forward' | 'backward' | 'upward' | 'downward'): boolean` | The user is navigating out of the mathfield, typically using the keyboard |
* | `math-error` | `ErrorListener<ParserErrorCode | MathfieldErrorCode>` | A parsing or configuration error happened |
* | `keystroke` | `(keystroke: string, event: KeyboardEvent): boolean` | The user typed a keystroke with a physical keyboard |
* | `mount` | | Fired once when the element has been attached to the DOM |
* | `unmount` | | Fired once when the element is about to be removed from the DOM |
* | Event Name | Description |
* |:---|:---|
* | `input` | The value of the mathfield has been modified. This happens on almost every keystroke in the mathfield. |
* | `change` | The user has commited the value of the mathfield. This happens when the user presses **Return** or leaves the mathfield. |
* | `selection-change` | The selection (or caret position) in the mathfield has changed |
* | `mode-change` | The mode (`math`, `text`) of the mathfield has changed |
* | `undo-state-change` | The state of the undo stack has changed |
* | `read-aloud-status-change` | The status of a read aloud operation has changed |
* | `virtual-keyboard-toggle` | The visibility of the virtual keyboard panel has changed |
* | `blur` | The mathfield is losing focus |
* | `focus` | The mathfield is gaining focus |
* | `focus-out` | The user is navigating out of the mathfield, typically using the keyboard<br> `detail: {direction: 'forward' | 'backward' | 'upward' | 'downward'}` **cancellable**|
* | `math-error` | A parsing or configuration error happened <br> `detail: ErrorListener<ParserErrorCode | MathfieldErrorCode>` |
* | `keystroke` | The user typed a keystroke with a physical keyboard <br> `detail: {keystroke: string, event: KeyboardEvent}` |
* | `mount` | The element has been attached to the DOM |
* | `unmount` | The element is about to be removed from the DOM |
*

@@ -213,3 +256,3 @@ */

/**
* A new mathfield can be created using
* To create programmatically a new mahfield use:
* ```javascript

@@ -225,3 +268,3 @@ let mfe = new MathfieldElement();

});
// Attach the element
// Attach the element to the DOM
document.body.appendChild(mfe);

@@ -238,2 +281,5 @@ * ```

getOptions(): MathfieldOptions;
/**
* @category Options
*/
getOption<K extends keyof MathfieldOptions>(key: K): MathfieldOptions[K];

@@ -264,7 +310,10 @@ /**

/**
* @category Accessing and Changing the content
* @category Accessing and changing the content
*/
getValue(format?: OutputFormat): string;
getValue(start: number, end?: number, format?: OutputFormat): string;
getValue(range: Range, format?: OutputFormat): string;
getValue(ranges: Range[], format?: OutputFormat): string;
/**
* @category Accessing and Changing the content
* @category Accessing and changing the content
*/

@@ -309,3 +358,3 @@ setValue(value?: string, options?: InsertOptions): void;

*
* @category Accessing and Changing the content
* @category Accessing and changing the content
*/

@@ -327,17 +376,37 @@ insert(s: string, options?: InsertOptions): boolean;

*
* @category Accessing and Changing the content
* @category Accessing and changing the content
*/
applyStyle(style: Style): void;
/**
* The bottom location of the caret (insertion point) in viewport
* coordinates.
*
* See also [[`setCaretPoint`]]
* @category Selection
*/
getCaretPosition(): {
get caretPoint(): {
x: number;
y: number;
};
set caretPoint(point: {
x: number;
y: number;
});
/**
* `x` and `y` are in viewport coordinates.
*
* Return true if the location of the point is a valid caret location.
*
* See also [[`caretPoint`]]
* @category Selection
*/
setCaretPosition(x: number, y: number): boolean;
setCaretPoint(x: number, y: number): boolean;
/**
* Return an array of ranges matching the argument.
*
* An array is always returned, but it has no element if there are no
* matching items.
*/
find(latex: string): Range[];
/**
* Custom elements lifecycle hooks

@@ -365,3 +434,3 @@ * @internal

/**
* @category Accessing and Changing the content
* @category Accessing and changing the content
*/

@@ -374,3 +443,3 @@ set value(value: string);

* ```
* @category Accessing and Changing the content
* @category Accessing and changing the content
*/

@@ -389,3 +458,2 @@ get value(): string;

/**
* Change the selection
*

@@ -392,0 +460,0 @@ * @category Selection

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

/* 0.58.0 */ import { Selector } from './commands';
/* 0.59.0 */ import { Selector } from './commands';
import { MathfieldOptions } from './options';

@@ -187,3 +187,3 @@ import { ParseMode, MacroDictionary, Style } from './core';

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

@@ -193,3 +193,3 @@ $selectedText?(format?: OutputFormat): string;

/**
* @deprecated Use [[`executeCommand`]]
* @deprecated Use [[`select`]]
*/

@@ -207,3 +207,3 @@ $select?(): void;

*
* @deprecated Use `selection[0].collapsed`
* @deprecated Use `mfe.selection[0].collapsed`
*/

@@ -220,3 +220,3 @@ $selectionIsCollapsed?(): boolean;

*
* @deprecated Use `mf.selection[0].depth`
* @deprecated Use `mfe.selection[0].depth`
*/

@@ -355,7 +355,8 @@ $selectionDepth?(): number;

$typedText?(text: string): void;
getCaretPosition(): {
getCaretPoint?(): {
x: number;
y: number;
} | null;
setCaretPosition(x: number, y: number): boolean;
setCaretPoint(x: number, y: number): boolean;
find(latex: string): Range[];
}

@@ -362,0 +363,0 @@ export interface Model {

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

/* 0.58.0 */ /**
/* 0.59.0 */ /**
*

@@ -11,9 +11,9 @@ * Use MathLive to render and edit mathematical formulas.

* // Load the `Mathlive` module from a CDN
* import MathLive from 'https://unpkg.com/mathlive/dist/mathlive.min.mjs';
* import { convertLatexToSpeakableText } from 'https://unpkg.com/mathlive/dist/mathlive.min.mjs';
*
* console.log(MathLive.latexToAST('e^{i\\pi}+1=0'));
* console.log(convertLatexToSpeakableText('e^{i\\pi}+1=0'));
* </script>
*
* @packageDocumentation MathLive SDK Reference 0.58.0
* @version 0.58.0
* @packageDocumentation MathLive SDK Reference 0.59.0
* @version 0.59.0
*

@@ -29,3 +29,3 @@ */

/**
* Current version: `0.58.0`
* Current version: `0.59.0`
*

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

* @keywords create, make, mathfield
* @deprecated Use `MathfieldElement`.
* @deprecated Use `new [[MathfieldElement]]()`
*/

@@ -70,2 +70,15 @@ export declare function makeMathField(element: HTMLElement | string, options: MathfieldOptions): Mathfield;

*
* **(Note)**
*
* This function does not interact with the DOM. It can be used
* on the server side. The function does not load fonts or inject stylesheets
* in the document. To get the output of this function to correctly display
* in a document, use the mathlive static style sheet by adding the following
* to the `<head>` of the document:
* ```html
* <link rel="stylesheet" href="https://unpkg.com/mathlive/dist/mathlive-static.css" />
* ```
*
* ---
*
* @param text A string of valid LaTeX. It does not have to start

@@ -195,3 +208,3 @@ * with a mode token such as `$$` or `\(`.

* @example
* console.log(MathLive.convertLatexToSpeakableText('\\frac{1}{2}'));
* console.log(convertLatexToSpeakableText('\\frac{1}{2}'));
* // 'half'

@@ -360,5 +373,5 @@ * @category Converting

* @example
* import MathLive from 'https://unpkg.com/mathlive/dist/mathlive.min.mjs';
* import { renderMathInDocument } from 'https://unpkg.com/mathlive/dist/mathlive.min.mjs';
* document.addEventListener("load", () => {
* MathLive.renderMathInDocument();
* renderMathInDocument();
* });

@@ -411,4 +424,4 @@ *

* ```javascript
* MathLive.renderMathInElement('equation');
* console.log(MathLive.getOriginalContent('equation'));
* renderMathInElement('equation');
* console.log(getOriginalContent('equation'));
* ```

@@ -415,0 +428,0 @@ * will output:

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

/* 0.58.0 */ import { ErrorListener, MacroDictionary, ParseMode, ParserErrorCode, MathfieldErrorCode } from './core';
/* 0.59.0 */ import { ErrorListener, MacroDictionary, ParseMode, ParserErrorCode, MathfieldErrorCode } from './core';
import type { Mathfield } from './mathfield';

@@ -16,5 +16,5 @@ import type { Selector } from './commands';

* {
* key: 'ctrl+[Digit2]',
* ifMode: 'math',
* command: ['insert', '\\sqrt{#0}'],
* "key": 'ctrl+[Digit2]',
* "ifMode": 'math',
* "command": ['insert', '\\sqrt{#0}'],
* }

@@ -98,3 +98,3 @@ * ```

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

@@ -379,2 +379,4 @@ */

* Their return value indicate whether the default handling should proceed.
*
* @deprecated Use corresponding events of `MathfieldEvent` instead
*/

@@ -408,4 +410,3 @@ export interface MathfieldHooks {

*
* <var>direction</var> indicates the direction of the navigation, either
* `"forward"` or `"backward"`.
* <var>direction</var> indicates the direction of the navigation.
*

@@ -430,2 +431,3 @@ * By default, the insertion point jumps to the next/previous focussable

* ```
* @deprecated Use corresponding events of `MathfieldEvent` instead
*/

@@ -453,3 +455,3 @@ export interface MathfieldListeners {

/** @deprecated Use:
* ```typescript
* ```javascript
* mf.setConfig(

@@ -539,7 +541,9 @@ * 'inlineShortcuts',

*
* - "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
* | 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 |
*

@@ -626,3 +630,3 @@ * Smart Mode is off by default.

macros: {
...mf.getConfig('macros'),
...mf.getOption('macros'),
smallfrac: '^{#1}\\!\\!/\\!_{#2}',

@@ -633,3 +637,3 @@ },

*
* Note that `getConfig()` is called to keep the existing macros and add to them.
* Note that `getOption()` is called to keep the existing macros and add to them.
* Otherwise, all the macros are replaced with the new definition.

@@ -694,2 +698,4 @@ *

* It is empty by default.
*
* @deprecated
*/

@@ -772,2 +778,4 @@ namespace: string;

/**
* See [[`setKeyboardLayout`]].
*
* | Name | Platform | Display name |

@@ -791,3 +799,3 @@ * | :----- | :----- | :----- |

*
* If set to `auto` the keyboard layout is guessed approximately.
* If set to `auto` the keyboard layout is guessed.
*

@@ -794,0 +802,0 @@ */

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

/* 0.58.0 */ /**
/* 0.59.0 */ /**
* @internal

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

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

{
"name": "mathlive",
"version": "0.58.0",
"version": "0.59.0",
"description": "Render and edit beautifully typeset math",

@@ -86,16 +86,16 @@ "license": "MIT",

"devDependencies": {
"@babel/types": "^7.11.5",
"@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.14",
"@types/node": "^14.11.8",
"@typescript-eslint/eslint-plugin": "^4.4.0",
"@typescript-eslint/parser": "^4.4.0",
"@typescript-eslint/typescript-estree": "^4.4.0",
"@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.11.0",
"eslint-config-prettier": "^6.12.0",
"eslint": "^7.12.1",
"eslint-config-prettier": "^6.15.0",
"eslint-plugin-no-unsanitized": "^3.1.4",

@@ -105,10 +105,10 @@ "eslint-plugin-prettier": "^3.1.4",

"husky": "^4.3.0",
"jest": "^26.5.2",
"jest": "^26.6.3",
"jest-silent-reporter": "^0.2.1",
"less": "^3.12.2",
"lint-staged": "^10.4.0",
"lint-staged": "^10.5.1",
"postcss-cli": "^7.1.2",
"prettier": "^2.1.2",
"rimraf": "^3.0.2",
"rollup": "^2.29.0",
"rollup": "^2.33.1",
"rollup-plugin-copy": "^3.3.0",

@@ -118,5 +118,5 @@ "rollup-plugin-eslint": "^7.0.0",

"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.27.3",
"ts-jest": "^26.4.1",
"typescript": "^4.0.3"
"rollup-plugin-typescript2": "^0.29.0",
"ts-jest": "^26.4.3",
"typescript": "^4.0.5"
},

@@ -123,0 +123,0 @@ "dependencies": {},

@@ -0,0 +0,0 @@ <h1 align="center">

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc