Comparing version 0.52.0 to 0.53.0
@@ -0,1 +1,84 @@ | ||
## 0.53.0 (2020-05-31) | ||
### Breaking Change / New Feature | ||
- **#158** The CSS files `mathlive.css` and `mathlive.core.css` have been deprecated and removed from the distribution. | ||
The necessary CSS is now injected dynamically into the page. This simplifies the use of the library, but also reduces the amount of CSS in the page, potentially improving performance. That's particularly the case when the virtual keyboard is not used, as the CSS stylesheet for the virtual keyboard is substantial, and it is now injected only when the keyboard is used. | ||
To transition, you should remove from your code any instance of: | ||
```html | ||
<link rel="stylesheet" href="mathlive.core.css" type="text/css" /> | ||
<link rel="stylesheet" href="mathlive.css" type="text/css" /> | ||
``` | ||
(the path to your CSS file may be different). | ||
You may need to specify the location of the 'fonts' directory. By default, | ||
the 'fonts' directory is expected to be next to the 'mathlive.js', | ||
'mathlive.mjs' file. If you need to copy the 'fonts' directory to a different | ||
location, specify it using the `Config.fontsDirectory` option. It should be | ||
either a relative path or a full URL pointing to the directory that contains | ||
the fonts. (Fix for **#425**) | ||
You no longer need to manually specify the stylesheets when using | ||
`renderMathInElement()` or `renderMathInDocument()` either. | ||
The necessary stylesheet will get injected in the | ||
document as needed. Note that this stylesheet for these functions is | ||
smaller than the stylesheet used when | ||
the editor is in use. These two functions also gain a property to specify the | ||
location of the 'fonts' directory, if necessary (by default, the 'fonts' | ||
directory is expected to be next to the 'mathlive.js', 'mathlive.mjs' file.) | ||
In some rare cases, you may have used the CSS stylesheet without the Mathlive library, for example, after you may have saved the output of `latexToMarkup()` to a database | ||
and use it to render later in a page. In that case, you would need to use the | ||
CSS styelsheet `dist/mathlive-static.css`, which is suitable for this use case. | ||
Note that it does reference a 'fonts' folder that may need to be adjusted. By | ||
default, the `fonts` folder should be placed next to the stylesheet. If you | ||
need a different location when using the static stylesheet, you will need | ||
to modify it. | ||
- **#425** Added CSS variable `--ML_keyboard-zindex` to control the zindex | ||
of the virtual keyboard. | ||
- Add support for `^^` and `^^^^` constructs in Latex. See TexBook p. 56: | ||
There’s also a special convention in which ^^ is followed by two | ||
“lowercase hexadecimal digits,” 0–9 or a–f. With this convention, all 256 characters are | ||
obtainable in a uniform way, from ^^00 to ^^ff. Character 127 is ^^7f. | ||
XeTeX extends this convention with `^^^^` for four-digit Unicode characters. | ||
- Added support for more TeX primitives, including `\string`, `\csname`, `\endcsname`, `\obeyspaces` | ||
- Improved the handling of parameters (e.g. `#1`) to more accurately match the TeX behavior | ||
(previously parameters could only substitute for an entire argument, i.e. `{#1}`). | ||
They are now handled by replacing their value with their corresponding tokens. | ||
- Added support for `\laplace` and `\Laplace` symbols | ||
### Bug Fixes | ||
- **#469** The keyboard layout on Linux was not detected | ||
correctly, resulting in some keys (such as arrows and backspace) not working correctly. | ||
- Integers in a Latex stream would not always be parsed | ||
correctly. As per the TeXBook, an integer can be preceded by an arbitrary number | ||
of "+", "-" or whitespace characters, so `\char -+ +- "4A` is valid and | ||
equivalent to `\char"4A` | ||
- Integers in a latex stream specified with a backtick ( | ||
"alphabetic constant") would not be parsed correctly. Now `` \char`A `` gives the | ||
expected result (`A`). | ||
- Consecutive whitespace where not always coalesced. | ||
- The bounding box of the initial selection (before the 'first' atom was inserted) was incorrect. | ||
- The sizing commands (`\huge`, `\small`, `\tiny`, etc...) should not apply in 'math' mode. | ||
## 0.52 (2020-05-23) | ||
@@ -2,0 +85,0 @@ |
@@ -1,2 +0,2 @@ | ||
/* 0.52.0 */ import type { Keys } from './types-utils'; | ||
/* 0.53.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.52.0 */ import { ErrorListener, MacroDictionary, ParseMode } from './core'; | ||
/* 0.53.0 */ import { ErrorListener, MacroDictionary, ParseMode } from './core'; | ||
import type { Mathfield } from './mathfield'; | ||
@@ -651,2 +651,38 @@ import type { Selector } from './commands'; | ||
/** | ||
* A URL fragment pointing to the directory containing the fonts | ||
* necessary to render a formula. | ||
* | ||
* These fonts are available in the `/dist/fonts` directory of the SDK. | ||
* | ||
* Customize this value to reflect where you have copied these fonts, | ||
* or to use the CDN version. | ||
* | ||
* The default value is './fonts'. | ||
* | ||
* Changing this setting after the mathfield has been created will have | ||
* no effect. | ||
* | ||
* ```javascript | ||
* { | ||
* // Use the CDN version | ||
* fontsDirectory: '' | ||
* } | ||
* ``` | ||
* ```javascript | ||
* { | ||
* // Use a directory called 'fonts', located next to the | ||
* // `mathlive.js` (or `mathlive.mjs`) file. | ||
* fontsDirectory: './fonts' | ||
* } | ||
* ``` | ||
* ```javascript | ||
* { | ||
* // Use a directory located at the top your website | ||
* fontsDirectory: 'https://example.com/fonts' | ||
* } | ||
* ``` | ||
* | ||
*/ | ||
fontsDirectory?: string; | ||
/** | ||
* Support for [Trusted Type](https://w3c.github.io/webappsec-trusted-types/dist/spec/). | ||
@@ -653,0 +689,0 @@ * |
@@ -1,2 +0,2 @@ | ||
/* 0.52.0 */ /** | ||
/* 0.53.0 */ /** | ||
* The mode that indicates how a portion of content is interpreted | ||
@@ -15,6 +15,10 @@ * | ||
| ------------------ | --- | | ||
| `font-not-found` | A required font could not be loaded. The `fontDirectory` option may not be setup correctly or the 'fonts' directory is missing. | | ||
| `invalid-keybinding` | A keybinding includes a combinatino of keys which cannot be performed with the current keyboard layout. | | ||
| `unknown-command` | There is no definition available for this command, e.g. `\zin` | | ||
| `unknown-environment` | There is no definition available for this environment, e.g. `\begin{foo}` | | ||
| `invalid-command` | This command is not valid in the current mode (e.g. text command in math mode) | | ||
| `unbalanced-braces` | There are too many or too few `{` or `}` | | ||
| `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}`) | | ||
| `unbalanced-mode-shift` | A `$`, `$$`, `\(` or `\[` was not balanced | | ||
| `missing-argument` | A required argument is missing, e.g. `\frac{2}` | | ||
@@ -27,5 +31,6 @@ | `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. | | ||
| `unexpected-end-of-string` | The end of the string was reached, but some required arguments were missing. | | ||
| `improper-alphabetic-constant` | The alphabetic constant prefix `` ` `` was not followed by a letter or single character command. | | ||
*/ | ||
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 MathfieldErrorCode = 'invalid-keybinding'; | ||
export declare 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'; | ||
export declare type MathfieldErrorCode = 'invalid-keybinding' | 'font-not-found'; | ||
export declare type ErrorListener = (err: { | ||
@@ -32,0 +37,0 @@ code: ParserErrorCode | MathfieldErrorCode; |
@@ -1,2 +0,2 @@ | ||
/* 0.52.0 */ import { Selector } from './commands'; | ||
/* 0.53.0 */ import { Selector } from './commands'; | ||
import { MathfieldConfig } from './config'; | ||
@@ -224,3 +224,3 @@ import { ParseMode, MacroDictionary, Style } from './core'; | ||
export interface Model { | ||
mathfield: Mathfield; | ||
readonly mathfield: Mathfield; | ||
} |
@@ -1,2 +0,2 @@ | ||
/* 0.52.0 */ /** | ||
/* 0.53.0 */ /** | ||
* | ||
@@ -16,4 +16,4 @@ * Use MathLive to render and edit mathematical formulas. | ||
* | ||
* @packageDocumentation MathLive SDK Reference 0.52.0 | ||
* @version 0.52.0 | ||
* @packageDocumentation MathLive SDK Reference 0.53.0 | ||
* @version 0.53.0 | ||
* | ||
@@ -27,3 +27,3 @@ */ | ||
/** | ||
* Current version: `0.52.0` | ||
* Current version: `0.53.0` | ||
* | ||
@@ -183,2 +183,38 @@ * The version string of the SDK using the [semver](https://semver.org/) convention: | ||
/** | ||
* A URL fragment pointing to the directory containing the fonts | ||
* necessary to render a formula. | ||
* | ||
* These fonts are available in the `/dist/fonts` directory of the SDK. | ||
* | ||
* Customize this value to reflect where you have copied these fonts, | ||
* or to use the CDN version. | ||
* | ||
* The default value is './fonts'. | ||
* | ||
* Changing this setting after the mathfield has been created will have | ||
* no effect. | ||
* | ||
* ```javascript | ||
* { | ||
* // Use the CDN version | ||
* fontsDirectory: '' | ||
* } | ||
* ``` | ||
* ```javascript | ||
* { | ||
* // Use a directory called 'fonts', located next to the | ||
* // `mathlive.js` (or `mathlive.mjs`) file. | ||
* fontsDirectory: './fonts' | ||
* } | ||
* ``` | ||
* ```javascript | ||
* { | ||
* // Use a directory located at the top your website | ||
* fontsDirectory: 'https://example.com/fonts' | ||
* } | ||
* ``` | ||
* | ||
*/ | ||
fontsDirectory?: string; | ||
/** | ||
* Support for [Trusted Type](https://w3c.github.io/webappsec-trusted-types/dist/spec/). | ||
@@ -185,0 +221,0 @@ * |
@@ -1,2 +0,2 @@ | ||
/* 0.52.0 */ /** | ||
/* 0.53.0 */ /** | ||
* @internal | ||
@@ -3,0 +3,0 @@ */ |
{ | ||
"name": "mathlive", | ||
"version": "0.52.0", | ||
"version": "0.53.0", | ||
"description": "Render and edit beautifully typeset math", | ||
@@ -87,2 +87,3 @@ "license": "MIT", | ||
"@cortex-js/prettier-config": "^1.0.0", | ||
"@types/css-font-loading-module": "0.0.4", | ||
"@types/jest": "latest", | ||
@@ -92,2 +93,3 @@ "@types/node": "latest", | ||
"@typescript-eslint/parser": "latest", | ||
"@typescript-eslint/typescript-estree": "latest", | ||
"autoprefixer": "^9.8.0", | ||
@@ -103,14 +105,16 @@ "check-node-version": "^4.0.3", | ||
"jest": "^26.0.1", | ||
"jest-silent-reporter": "^0.2.1", | ||
"less": "^3.11.1", | ||
"lint-staged": "^10.2.6", | ||
"lint-staged": "^10.2.7", | ||
"postcss-cli": "^7.1.1", | ||
"prettier": "^2.0.5", | ||
"rimraf": "^3.0.2", | ||
"rollup": "latest", | ||
"rollup": "^2.12.0", | ||
"rollup-plugin-copy": "^3.3.0", | ||
"rollup-plugin-eslint": "^7.0.0", | ||
"rollup-plugin-node-resolve": "^5.2.0", | ||
"rollup-plugin-postcss": "^3.1.1", | ||
"rollup-plugin-terser": "latest", | ||
"rollup-plugin-typescript2": "latest", | ||
"ts-jest": "^26.0.0", | ||
"ts-jest": "^26.1.0", | ||
"typescript": "latest" | ||
@@ -117,0 +121,0 @@ }, |
@@ -50,3 +50,3 @@ <img alt="math live" src="assets/logo.png?raw=true"> | ||
Render math equations by | ||
[adding a few lines to your web page](tutorials/USAGE_GUIDE.md). | ||
[adding a two lines to your web page](tutorials/USAGE_GUIDE.md). | ||
@@ -56,13 +56,2 @@ ```html | ||
<html lang="en-US"> | ||
<head> | ||
... | ||
<link | ||
href="https://unpkg.com/mathlive/dist/mathlive.core.css" | ||
rel="stylesheet" | ||
/> | ||
<link | ||
href="https://unpkg.com/mathlive/dist/mathlive.css" | ||
rel="stylesheet" | ||
/> | ||
</head> | ||
<body> | ||
@@ -89,13 +78,2 @@ <h1>Euler's Identity</h1> | ||
<html lang="en-US"> | ||
<head> | ||
... | ||
<link | ||
rel="stylesheet" | ||
href="https://unpkg.com/mathlive/dist/mathlive.core.css" | ||
/> | ||
<link | ||
rel="stylesheet" | ||
href="https://unpkg.com/mathlive/dist/mathlive.css" | ||
/> | ||
</head> | ||
<body> | ||
@@ -102,0 +80,0 @@ <div id="mathfield">f(x)=</div> |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2369374
16604
32
56
3
110
15