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

mathlive

Package Overview
Dependencies
Maintainers
1
Versions
172
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.51.0 to 0.52.0

43

CHANGELOG.md

@@ -0,1 +1,33 @@

## 0.52 (2020-05-23)
### New Feature
- Support for [Trusted Types](https://w3c.github.io/webappsec-trusted-types/dist/spec/).
A new option in `Config`, `createHTML`, is called before injecting HTML
into the page, providing an opportunity to sanitize the markup according
to a policy set by the host
### Improvements
- Move some of the Mathematica inspired command (e.g. `\differentialD`,
`doubleStruckCapitalN`, etc...) to be macros instead of built-in commands.
This will allow them to be properly expanded during copy/paste operations
for improved interoperability
- When an invalid keybinding is encountered, the `onError` listener is now
invoked with an erorr code of `invalid-keybinding`
- Added support for German keyboard layout.
### Bug Fixes
- The Undo and Redo button in the virtual keyboard did not change their
state appropriately given the state of the undo stack.
- 'overunder': The superscript and subscript after an 'overunder' atom
(e.g. `\overbrace`) did not display correctly (above or below the brace).
The 'overunder' atom would also not display correctly if the width of
the atom was below a minimal threshold.
## 0.51.0 (2020-05-19)

@@ -9,6 +41,7 @@

extended or replaced.
See `config.keybindings` and `Keybinding`.
See `config.keybindings` and `Keybinding`
- Added `setKeyboardLayout()` and `setKeyboardLayoutLocale()` functions to
customize the current physical keyboard layout.
customize the current physical keyboard layout

@@ -18,6 +51,6 @@ ### Improvements

- **#461** The array editing commands only worked in math mode. They now apply
in text mode as well.
in text mode as well
- **#459**: Add a placeholder for incomplete commands, for example entering
`\frac` in command mode.
`\frac` in command mode

@@ -29,3 +62,3 @@ - Added some missing commands: `deleteNextChar`, `deletePreviousChar`,

- In some cases, the top of the placeholder character could be cut off.
- In some cases, the top of the placeholder character could be cut off

@@ -32,0 +65,0 @@ ### Bug Fixes

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

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

@@ -139,2 +139,6 @@ import type { Mathfield, Model } from './mathfield';

*/
deleteToMathFieldStart: (model: Model) => boolean;
/**
* @category Deleting
*/
deleteToMathFieldEnd: (model: Model) => boolean;

@@ -141,0 +145,0 @@ /**

141

dist/config.d.ts

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

/* 0.51.0 */ import { ParserErrorListener, MacroDictionary, ParseMode } from './core';
/* 0.52.0 */ import { ErrorListener, MacroDictionary, ParseMode } from './core';
import type { Mathfield } from './mathfield';

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

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

@@ -38,12 +38,18 @@ * ```

*
* If a `cmd` modifier is used, the keybinding will only apply on macOS,
* and so on.
* If the `cmd` modifier is used, the keybinding will only apply on macOS.
* If the `win` modifier is used, the keybinding will only apply to Windows.
* If the `meta` modifier is used, the keybinding will apply to platforms
* other than macOS or Windows.
*
* The `alt` key is the `option` key on Apple keyboards.
*
*
* The following values for keys can be used:
* * `f1`-`f19`, `a`-`z`, `0`-`9`
* * `\``, `-`, `=`, `[`, `]`, `\`, `;`, `'`, `,`, `.`, `/`
* * `left`, `up, `right`, `down`, `pageup`, `pagedown`, `end`, `home`
* * `a`–`z`, `0`–`9`
* * `` ` ``, `-`, `=`, `[`, `]`, `\`, `;`, `'`, `,`, `.`, `/`
* * `left`, `up`, `right`, `down`, `pageup`, `pagedown`, `end`, `home`
* * `tab`, `enter`, `escape`, `space`, `backspace`, `delete`
* * `f1`–`f19`
* * `pausebreak`, `capslock`, `insert`
* * `numpad0`-`numpad9`, `numpad_multiply`, `numpad_add`, `numpad_separator`
* * `numpad0`–`numpad9`, `numpad_multiply`, `numpad_add`, `numpad_separator`
* * `numpad_subtract`, `numpad_decimal`, `numpad_divide`

@@ -59,8 +65,9 @@ *

*
* - `[F1]`-`[F19]`, `[KeyA]`-`[KeyZ]`, `[Digit0]`-`[Digit9]`
* - `[KeyA]`–`[KeyZ]`, `[Digit0]`–`[Digit9]`
* - `[Backquote]`, `[Minus]`, `[Equal]`, `[BracketLeft]`, `[BracketRight]`, `[Backslash]`, `[Semicolon]`, `[Quote]`, `[Comma]`, `[Period]`, `[Slash]`
* - `[ArrowLeft]`, `[ArrowUp]`, `[ArrowRight]`, `[ArrowDown]`, `[PageUp]`, `[PageDown]`, `[End]`, `[Home]`
* - `[Tab]`, `[Enter]`, `[Escape]`, `[Space]`, `[Backspace]`, `[Delete]`
* - `[F1]`–`[F19]`
* - `[Pause]`, `[CapsLock]`, `[Insert]`
* - `[Numpad0]`-`[Numpad9]`, `[NumpadMultiply]`, `[NumpadAdd]`, `[NumpadComma]`
* - `[Numpad0]`–`[Numpad9]`, `[NumpadMultiply]`, `[NumpadAdd]`, `[NumpadComma]`
* - `[NumpadSubtract]`, `[NumpadDecimal]`, `[NumpadDivide]`

@@ -71,6 +78,19 @@ *

*
* As a general guideline, it is preferable to use the key values `a`-`z`
* As a general guideline, it is preferable to use the key values `a`–`z`
* for keybinding that are pseudo-mnemotechnic. For the other, it is generally
* preferable to use the keycodes.
*
* Consider the key combination: `alt+2`. With an AZERTY (French) layout,
* the digits (i.e. '2') are only accessible when shifted. The '2' key produces
* 'é' when not shifted. It is therefore impossible on an AZERTY keyboard to
* produce the `alt+2` key combination, at best it would be `alt+shift+2`.
* To indicate that the intended key combination should be `alt` and the
* key on the keyboard which has the position of the `2` key on a US keyboard,
* a key code should be used instead: `alt+[Digit2]`. This will correspond
* to a key combination that can be generated on any keyboard.
*
* If a keybinding is invalid (impossible to produce) with the current
* keyboard layout, an error will be generated, and the `onError` listener
* will be called with a `invalid-keybinding` error code.
*
*/

@@ -81,4 +101,4 @@ key: string;

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

@@ -537,3 +557,3 @@ ifMode?: ParseMode;

*
*For example:
*For example, to add a new macro to the default macro dictionary:
*

@@ -543,2 +563,3 @@ ```javascript

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

@@ -549,4 +570,7 @@ },

*
*The code above will support the following notation:
* Note that `getConfig()` 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

@@ -597,34 +621,47 @@ \smallfrac{5}{16}

/**
*
* - <var>namespace</var> Namespace that is added to `data-` attributes
* to avoid collisions with other libraries.
*
* It is empty by default.
*
* The namespace should be a string of lowercase letters.
*
* - <var>onError</var> An optional listener function that will be
* invoked when an error is encountered while parsing some Latex. This
* could be 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 errors.
*
* - <var>substituteTextArea</var> A function that returns a focusable
* element that can be used to capture text 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.
*
* This function provides the option of substituting the DOM element
* used for keyboard capture.
*
* Alternatively, the ID of a DOM element can be provided.
* @keywords security, trust, sanitize, errors
*/
export declare type MathfieldConfig = LayoutOptions & EditingOptions & LocalizationOptions & InlineShortcutsOptions & KeyboardOptions & VirtualKeyboardOptions & TextToSpeechOptions & MathfieldHooks & MathfieldListeners & {
/**
* Namespace that is added to `data-` attributes to avoid collisions
* with other libraries.
*
* The namespace should be a string of lowercase letters.
*
* It is empty by default.
*/
namespace?: string;
onError?: ParserErrorListener;
/**
* 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;
/**
* 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);
/**
* Support for [Trusted Type](https://w3c.github.io/webappsec-trusted-types/dist/spec/).
*
* This optional function will be called before a string of HTML is
* injected in the DOM, allowing that string to be sanitized
* according to a policy defined by the host.
*/
createHTML?: (html: string) => any;
};

@@ -634,7 +671,13 @@ /**

* | :----- | :----- | :----- |
* | `'apple.en-intl'` | Apple | English (International) |
* | `'windows.en-intl'` | Windows | English (International) |
* | `'linux.en'` | Linux | English |
* | `'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) |
*/
export declare type KeyboardLayoutName = 'apple.french' | 'windows.french' | 'linux.french' | 'apple.en-intl' | 'windows.en-intl' | 'linux.en';
export declare type KeyboardLayoutName = 'apple.en-intl' | 'apple.french' | 'apple.german' | 'windows.en-intl' | 'windows.french' | 'windows.german' | 'linux.en' | 'linux.french' | 'linux.german';
/**

@@ -641,0 +684,0 @@ * Change the current physical keyboard layout.

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

/* 0.51.0 */ /**
/* 0.52.0 */ /**
* The mode that indicates how a portion of content is interpreted

@@ -18,3 +18,3 @@ *

| `unbalanced-braces` | There are too many or too few `{` or `}` |
| `unbalanced-environment` | An environment was open but never closed (`\begin{array}`} |
| `unbalanced-environment` | An environment was open but never closed (`\begin{array}`) or the `\end` command does not match the `\begin` command (`\begin{array*}\end{array}`) |
| `missing-argument` | A required argument is missing, e.g. `\frac{2}` |

@@ -29,8 +29,9 @@ | `too-many-infix-commands` | A group can include only one infix command (i.e. `\choose`, `\atop`). In general it's best to avoid infix commands. |

export declare type ParserErrorCode = 'unknown-command' | 'invalid-command' | 'unbalanced-braces' | 'unbalanced-environment' | 'missing-argument' | 'too-many-infix-commands' | 'unexpected-command-in-string' | 'missing-unit' | 'unexpected-delimiter' | 'unexpected-token' | 'unexpected-end-of-string';
export declare type ParserErrorListener = (err: {
export declare type MathfieldErrorCode = 'invalid-keybinding';
export declare type ErrorListener = (err: {
code: ParserErrorCode | MathfieldErrorCode;
arg?: string;
latex?: string;
before?: string;
after?: string;
code: ParserErrorCode;
arg?: string;
}) => void;

@@ -37,0 +38,0 @@ /**

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

/* 0.51.0 */ import { Selector } from './commands';
/* 0.52.0 */ import { Selector } from './commands';
import { MathfieldConfig } from './config';

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

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

/* 0.51.0 */ /**
/* 0.52.0 */ /**
*
* Use MathLive to render and edit mathematical formulas in your browser.
* Use MathLive to render and edit mathematical formulas.
*

@@ -10,4 +10,3 @@ *

* <script type="module">
* // To invoke the functions in this module, import the `Mathlive` module.
*
* // Load the `Mathlive` module from a CDN
* import MathLive from 'https://unpkg.com/mathlive/dist/mathlive.mjs';

@@ -18,4 +17,4 @@ *

*
* @packageDocumentation MathLive SDK Reference 0.51.0
* @version 0.51.0
* @packageDocumentation MathLive SDK Reference 0.52.0
* @version 0.52.0
*

@@ -25,21 +24,19 @@ */

import { MathfieldConfig, TextToSpeechOptions } from './config';
import { MacroDictionary, ParserErrorListener } from './core';
import { MacroDictionary, ErrorListener } from './core';
export { Mathfield };
export { MathfieldConfig };
/**
* The version string of the SDK in the form of:
* Current version: `0.52.0`
*
* The version string of the SDK using the [semver](https://semver.org/) convention:
*
* `MAJOR`.`MINOR`.`PATCH`
*
* The version uses [semver](https://semver.org/):
* - The **MAJOR** version is incremented for incompatible API changes
* - The **MINOR** version is incremented for new features
* - The **PATCH** version is incremented for bug fixes
*
* Current version: `0.51.0`
*
* * **`MAJOR`** is incremented for incompatible API changes
* * **`MINOR`** is incremented for new features
* * **`PATCH`** is incremented for bug fixes
*/
export declare const version: string;
/**
* Converts a LaTeX string to a string of HTML markup.
* Convert a LaTeX string to a string of HTML markup.
*

@@ -69,3 +66,3 @@ * @param text A string of valid LaTeX. It does not have to start

macros?: MacroDictionary;
onError?: ParserErrorListener;
onError?: ErrorListener;
}): string;

@@ -75,5 +72,4 @@ /**

*
* After the DOM element has been created, the value `element.mathfield` will
* return a reference to the mathfield object. This value is also returned
* by `makeMathField`
* The `mathfield` property of the DOM element is a reference to the corresponding
* `Mathfield` object. This value is also returned by `makeMathField()`.
*

@@ -97,3 +93,3 @@ * @param element A DOM element, for example as obtained

/**
* Converts a LaTeX string to a string of MathML markup.
* Convert a LaTeX string to a string of MathML markup.
*

@@ -111,6 +107,6 @@ * @param latex A string of valid LaTeX. It does not have to start

generateID: boolean;
onError?: ParserErrorListener;
onError?: ErrorListener;
}): string;
/**
* Converts a LaTeX string to an {@tutorial math-json | MathJSON } Abstract Syntax Tree
* Convert a LaTeX string to a {@tutorial math-json | MathJSON } Abstract Syntax Tree
*

@@ -131,3 +127,3 @@ * **See Also:** [[astToLatex|astToLatex()]]

macros?: MacroDictionary;
onError?: ParserErrorListener;
onError?: ErrorListener;
}): any;

@@ -164,3 +160,3 @@ /**

/**
* Converts a LaTeX string to a textual representation ready to be spoken
* Convert a LaTeX string to a textual representation ready to be spoken
*

@@ -183,3 +179,3 @@ * @param latex A string of valid LaTeX. It does not have to start

macros?: MacroDictionary;
onError?: ParserErrorListener;
onError?: ErrorListener;
}): string;

@@ -194,2 +190,10 @@ export declare type AutoRenderOptions = {

namespace?: string;
/**
* Support for [Trusted Type](https://w3c.github.io/webappsec-trusted-types/dist/spec/).
*
* This optional function will be called whenever the DOM is modified
* by injecting a string of HTML, allowing that string to be sanitized
* according to a policy defined by the host.
*/
createHTML?: (html: string) => any;
/** Custom LaTeX macros */

@@ -274,14 +278,2 @@ macros?: MacroDictionary;

};
/** A function that will convert any LaTeX found to
* HTML markup. This is only useful to override the default MathLive renderer
*/
renderToMarkup?: Function;
/**
* a function that will convert any LaTeX found to
* MathML markup.
*/
renderToMathML?: Function;
/** A function that will convert any LaTeX found to
* speakable text markup. */
renderToSpeakableText?: Function;
};

@@ -313,4 +305,4 @@ /**

/**
* Transform all the children of `element`, recursively, that contain LaTeX code
* into typeset math.
* Transform all the children of `element` that contain LaTeX code
* into typeset math, recursively.
*

@@ -327,2 +319,5 @@ * Read {@tutorial mathfield-getting-started | Getting Started}.

/**
* After calling {@linkcode renderMathInElement}
* or {@linkcode makeMathField} the original content
* can be restored by calling this function.
*

@@ -329,0 +324,0 @@ * @category Rendering

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

/* 0.51.0 */ /**
/* 0.52.0 */ /**
* @internal

@@ -10,3 +10,3 @@ */

*/
export declare type Keys<T> = Filter<T, Function> & string;
export declare type Keys<T> = Filter<T, (...args: any[]) => any> & string;
export {};
{
"name": "mathlive",
"version": "0.51.0",
"version": "0.52.0",
"description": "Render and edit beautifully typeset math",

@@ -94,3 +94,3 @@ "license": "MIT",

"cssnano": "^4.1.10",
"eslint": "^7.0.0",
"eslint": "latest",
"eslint-config-prettier": "latest",

@@ -103,3 +103,3 @@ "eslint-plugin-no-unsanitized": "^3.1.1",

"less": "^3.11.1",
"lint-staged": "^10.2.4",
"lint-staged": "^10.2.6",
"postcss-cli": "^7.1.1",

@@ -112,3 +112,3 @@ "prettier": "^2.0.5",

"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-terser": "^5.3.0",
"rollup-plugin-terser": "latest",
"rollup-plugin-typescript2": "latest",

@@ -115,0 +115,0 @@ "ts-jest": "^26.0.0",

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 not supported yet

Sorry, the diff of this file is not supported yet

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

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