diff --git a/CHANGELOG.md b/CHANGELOG.md index 08146e155..a26081db5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,23 +1,21 @@ - + -# [1.1.0](https://github.com/deckgo/deckdeckgo/compare/v1.0.0...v1.1.0) (2020-07-08) +# [1.2.0](https://github.com/deckgo/deckdeckgo/compare/v1.1.0...v1.2.0) (2020-07-14) ### Applications -- demo: v2.2.0 ([CHANGELOG](https://github.com/deckgo/deckdeckgo-website/blob/master/CHANGELOG.md)) -- docs: v1.1.0 ([CHANGELOG](https://github.com/deckgo/deckdeckgo/blob/master/docs/CHANGELOG.md)) -- remote: v1.1.0 ([CHANGELOG](https://github.com/deckgo/deckdeckgo/blob/master/remote/CHANGELOG.md)) -- studio: v1.1.0 ([CHANGELOG](https://github.com/deckgo/deckdeckgo/blob/master/studio/CHANGELOG.md)) +- docs: v1.2.0 ([CHANGELOG](https://github.com/deckgo/deckdeckgo/blob/master/docs/CHANGELOG.md)) ### Web Components: New -- demo: v1.0.4 ([CHANGELOG](https://github.com/deckgo/deckdeckgo/blob/master/webcomponents/demo/CHANGELOG.md)) +- math: v1.0.1 ([CHANGELOG](https://github.com/deckgo/deckdeckgo/blob/master/webcomponents/math/CHANGELOG.md)) ### Web Components: Update - charts: v1.0.2 ([CHANGELOG](https://github.com/deckgo/deckdeckgo/blob/master/webcomponents/charts/CHANGELOG.md)) - color: v1.1.1 ([CHANGELOG](https://github.com/deckgo/deckdeckgo/blob/master/webcomponents/color/CHANGELOG.md)) - core: v1.0.2 ([CHANGELOG](https://github.com/deckgo/deckdeckgo/blob/master/webcomponents/core/CHANGELOG.md)) +- demo: v1.0.4 ([CHANGELOG](https://github.com/deckgo/deckdeckgo/blob/master/webcomponents/demo/CHANGELOG.md)) - drag-resize-rotate: v1.0.2 ([CHANGELOG](https://github.com/deckgo/deckdeckgo/blob/master/webcomponents/drag-resize-rotate/CHANGELOG.md)) - highlight-code: v1.0.5 ([CHANGELOG](https://github.com/deckgo/deckdeckgo/blob/master/webcomponents/highlight-code/CHANGELOG.md)) - inline-editor: v1.2.1 ([CHANGELOG](https://github.com/deckgo/deckdeckgo/blob/master/webcomponents/inline-editor/CHANGELOG.md)) @@ -46,6 +44,36 @@ ### Others +- deck-utils: v2.3.0 ([CHANGELOG](https://github.com/deckgo/deckdeckgo/blob/master/utils/deck/CHANGELOG.md)) +- starter kit: v2.3.0 ([CHANGELOG](https://github.com/deckgo/deckdeckgo-starter/blob/master/CHANGELOG.md)) + + + +# [1.1.0](https://github.com/deckgo/deckdeckgo/compare/v1.0.0...v1.1.0) (2020-07-08) + +### Applications + +- demo: v2.2.0 ([CHANGELOG](https://github.com/deckgo/deckdeckgo-website/blob/master/CHANGELOG.md)) +- docs: v1.1.0 ([CHANGELOG](https://github.com/deckgo/deckdeckgo/blob/master/docs/CHANGELOG.md)) +- remote: v1.1.0 ([CHANGELOG](https://github.com/deckgo/deckdeckgo/blob/master/remote/CHANGELOG.md)) +- studio: v1.1.0 ([CHANGELOG](https://github.com/deckgo/deckdeckgo/blob/master/studio/CHANGELOG.md)) + +### Web Components: New + +- demo: v1.0.3 ([CHANGELOG](https://github.com/deckgo/deckdeckgo/blob/master/webcomponents/demo/CHANGELOG.md)) + +### Web Components: Update + +- highlight-code: v1.0.4 ([CHANGELOG](https://github.com/deckgo/deckdeckgo/blob/master/webcomponents/highlight-code/CHANGELOG.md)) +- inline-editor: v1.2.0 ([CHANGELOG](https://github.com/deckgo/deckdeckgo/blob/master/webcomponents/inline-editor/CHANGELOG.md)) +- youtube: v1.1.1 ([CHANGELOG](https://github.com/deckgo/deckdeckgo/blob/master/webcomponents/youtube/CHANGELOG.md)) + +### Web Components Templates + +- slide-split: v1.1.2 ([CHANGELOG](https://github.com/deckgo/deckdeckgo/blob/master/webcomponents/slides/split/CHANGELOG.md)) + +### Others + - deck-utils: v2.2.0 ([CHANGELOG](https://github.com/deckgo/deckdeckgo/blob/master/utils/deck/CHANGELOG.md)) - slide-utils: v1.1.1 ([CHANGELOG](https://github.com/deckgo/deckdeckgo/blob/master/utils/slide/CHANGELOG.md)) - starter kit: v2.2.0 ([CHANGELOG](https://github.com/deckgo/deckdeckgo-starter/blob/master/CHANGELOG.md)) diff --git a/README.md b/README.md index c9d3dc70e..d17a0d369 100644 --- a/README.md +++ b/README.md @@ -62,6 +62,7 @@ Are you interested to contribute to our open source project? That would be aweso | **Highlight code** | [`@deckdeckgo/highlight-code`](https://www.npmjs.com/package/@deckdeckgo/highlight-code) | [![version](https://img.shields.io/npm/v/@deckdeckgo/highlight-code/latest.svg?color=success)](https://www.npmjs.com/package/@deckdeckgo/highlight-code) | [`README.md`](webcomponents/highlight-code/README.md) | | **Inline editor** | [`@deckdeckgo/inline-editor`](https://www.npmjs.com/package/@deckdeckgo/inline-editor) | [![version](https://img.shields.io/npm/v/@deckdeckgo/inline-editor/latest.svg?color=success)](https://www.npmjs.com/package/@deckdeckgo/inline-editor) | [`README.md`](webcomponents/inline-editor/README.md) | | **Lazy image** | [`@deckdeckgo/lazy-img`](https://www.npmjs.com/package/@deckdeckgo/lazy-img) | [![version](https://img.shields.io/npm/v/@deckdeckgo/lazy-img/latest.svg?color=success)](https://www.npmjs.com/package/@deckdeckgo/lazy-img) | [`README.md`](webcomponents/lazy-img/README.md) | +| **Math** | [`@deckdeckgo/math`](https://www.npmjs.com/package/@deckdeckgo/math) | [![version](https://img.shields.io/npm/v/@deckdeckgo/math/latest.svg?color=success)](https://www.npmjs.com/package/@deckdeckgo/math) | [`README.md`](webcomponents/math/README.md) | | **QR-Code** | [`@deckdeckgo/qrcode`](https://www.npmjs.com/package/@deckdeckgo/qrcode) | [![version](https://img.shields.io/npm/v/@deckdeckgo/qrcode/latest.svg?color=success)](https://www.npmjs.com/package/@deckdeckgo/qrcode) | [`README.md`](webcomponents/qrcode/README.md) | | **Remote** | [`@deckdeckgo/remote`](https://www.npmjs.com/package/@deckdeckgo/remote) | [![version](https://img.shields.io/npm/v/@deckdeckgo/remote/latest.svg?color=success)](https://www.npmjs.com/package/@deckdeckgo/remote) | [`README.md`](webcomponents/remote/README.md) | | **Social** | [`@deckdeckgo/social`](https://www.npmjs.com/package/@deckdeckgo/social) | [![version](https://img.shields.io/npm/v/@deckdeckgo/social/latest.svg?color=success)](https://www.npmjs.com/package/@deckdeckgo/social) | [`README.md`](webcomponents/social/README.md) | diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 95423d84a..e35858917 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,3 +1,9 @@ +# 1.2.0 (2020-05-14) + +### Features + +- new component `math` + # 1.1.0 (2020-05-07) ### Features diff --git a/docs/docs/components/app-components-demo/app-components-demo.md b/docs/docs/components/app-components-demo/app-components-demo.md index 891457dac..f473b8146 100644 --- a/docs/docs/components/app-components-demo/app-components-demo.md +++ b/docs/docs/components/app-components-demo/app-components-demo.md @@ -40,7 +40,7 @@ It's recommended to use [unpkg](https://unpkg.com/) to use the [DeckDeckGo] lazy ### Install from NPM -Install it in your project from [npm](https://www.npmjs.com/package/@deckdeckgo/qrcode) using the following command: +Install it in your project from [npm](https://www.npmjs.com/package/@deckdeckgo/demo) using the following command: ```bash npm install @deckdeckgo/demo diff --git a/docs/docs/components/app-components-math/app-components-math.md b/docs/docs/components/app-components-math/app-components-math.md new file mode 100644 index 000000000..98616c894 --- /dev/null +++ b/docs/docs/components/app-components-math/app-components-math.md @@ -0,0 +1,144 @@ +# Demo + +Write and render math expressions. + +This component is using [Katex](https://katex.org/) to renders these. + +## Table of contents + +- [Showcase](#app-components-math-showcase) +- [Installation](#app-components-math-installation) + - [Using from a CDN](#app-components-math-from-a-cdn) + - [Install from NPM](#app-components-math-from-npm) + - [Framework integration](#app-components-math-framework-integration) +- [Usage](#app-components-math-usage) + - [Slots](#app-components-math-slots) + - [Attributes](#app-components-math-attributes) + - [Events](#app-components-math-events) + - [Theming](#app-components-math-theming) + +## Showcase + +
+ + {`% \\f is defined as f(#1) using the macro + \\f{x} = \\int_{-\\infty}^\\infty + \\hat \\f\\xi\\,e^{2 \\pi i \\xi x} + \\,d\\xi`} + +
+ +## Installation + +This component could be added to your web application using the following methods. + +### Using from a CDN + +It's recommended to use [unpkg](https://unpkg.com/) to use the [DeckDeckGo] lazy image component from a CDN. To do so, add the following include script in the main HTML file of your project: + +``` + + +``` + +### Install from NPM + +Install it in your project from [npm](https://www.npmjs.com/package/@deckdeckgo/math) using the following command: + +```bash +npm install @deckdeckgo/math +``` + +### Framework integration + +The [Stencil documentation](https://stenciljs.com/docs/overview) provide examples of framework integration for [Angular](https://stenciljs.com/docs/angular), [React](https://stenciljs.com/docs/react), [Vue](https://stenciljs.com/docs/vue) and [Ember](https://stenciljs.com/docs/ember). + +That being said, commonly, you might either `import` or `load` it: + +#### Import + +``` +import '@deckdeckgo/math'; +``` + +#### Loader + +``` +import { defineCustomElements as deckDeckGoElement } from '@deckdeckgo/math/dist/loader'; +deckDeckGoElement(); +``` + +## Usage + +The "Math" Web Component could be integrated using the tag ``. + +``` + + % \f is defined as f(#1) using the macro + \f{x} = \int_{-\infty}^\infty + \hat \f\xi\,e^{2 \pi i \xi x} + \,d\xi + +``` + +It either supports a single expression, as displayed above, or expressions within paragraphs. + +``` + + + You can write math expression inside paragraph like this: $x + 1$ + + Inline formulas can be written with \$ e.g: $c = \pm\sqrt{a^2 + b^2}$ + + and displayed equations can be written using \$$ e.g: $$\sum_{i=1}^n 2^i$$ + + +``` + +### Slots + +The expressions have to be provided using the slot `math`. + +### Attributes + +This component offers the following options which could be set using attributes: + +| Attribute | Type | Default | Description | +| --------- | ------- | --------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| macros | string | {"\\\\f":"f(#1)"{ | A collection of custom macros. Each macro is a property with a name like \name (written "\\name" in JavaScript) which maps to a string that describes the expansion of the macro, or a function that accepts an instance of MacroExpander as first argument and returns the expansion as a string. | +| editable | boolean | `false` | To set the component has being editable (`contenteditable` will be applied on the `slot` on `click`) | + +See the [Katex](https://katex.org/docs/options.html) documentation for more information. + +### Events + +The `` component triggers the following event. + +| Event | Description | Type | +| --------------- | ------------------------------------ | -------------------------- | +| `mathDidChange` | Emit the host element when modified. | `CustomEvent` | + +### Theming + +The following theming options will affect this component if set on its host or parent. + +| CSS4 variable | Default | Note | +| --------------------------------------- | ----------------------------------- | ------------------------------------------------ | +| --deckgo-math-color | inherit | Color | +| --deckgo-math-background | | Background | +| --deckgo-math-padding | 8px | Padding | +| --deckgo-math-border-radius | | Border radius | +| --deckgo-math-margin | 0px | Margin | +| --deckgo-math-direction | | Direction | +| --deckgo-math-text-align | | Text alignment | +| --deckgo-math-container-display | block | Container display | +| --deckgo-math-container-justify-content | | Container justify-content attribute | +| --deckgo-math-container-flex-direction | | Container flex-direction attribute | +| --deckgo-math-container-align-items | | Container align-items attribute | +| --deckgo-math-scroll | scroll | Scroll property of the expression(s) | +| --deckgo-math-font-size | | Font size property of the expression(s) | +| --deckgo-math-min-height | 23px | Minimal height property of the expression(s) | +| --deckgo-math-display | block | Display property of the expression(s) | +| --deckgo-math-code-empty-text | "Click to add your math expression" | Place holder in case `editable` is set to `true` | + +[deckdeckgo]: https://deckdeckgo.com diff --git a/docs/package-lock.json b/docs/package-lock.json index d24a30a15..2ef9d6dba 100644 --- a/docs/package-lock.json +++ b/docs/package-lock.json @@ -1,6 +1,6 @@ { "name": "deckdeckgo-docs", - "version": "1.1.0", + "version": "1.2.0", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -69,14 +69,31 @@ "requires": { "@deckdeckgo/deck-utils": "^1.0.0", "@deckdeckgo/utils": "^1.0.0" + }, + "dependencies": { + "@deckdeckgo/deck-utils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@deckdeckgo/deck-utils/-/deck-utils-1.0.1.tgz", + "integrity": "sha512-UufGQYkMYm+mQuaMULAAM1/mr7rQXF3JTYzPk/X6Xic3meIzWMjTyVkaNGAA6DSQWcKP5QVt/++J1nuyt3kV6Q==", + "requires": { + "@deckdeckgo/utils": "^1.0.0" + } + } } }, "@deckdeckgo/deck-utils": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@deckdeckgo/deck-utils/-/deck-utils-1.0.0.tgz", - "integrity": "sha512-FF1xrIsU1RETRFxvHVgdxHIEihqB5z1WQ5udDwy4eMVosA35lvm894ZGDgZ8EUCKMg1gd+KJ4jAAQOqzAOGHlQ==", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@deckdeckgo/deck-utils/-/deck-utils-2.3.0.tgz", + "integrity": "sha512-LsfQJPX6lffE7OIxvT24jhMvjLAx0MPxMQGCoEC2gTH2cz7givHq5JUoLBTI6Ojc0zMiLYiZ7yjIOPw/PFyiDQ==", "requires": { - "@deckdeckgo/utils": "^1.0.0" + "@deckdeckgo/utils": "^1.1.0" + }, + "dependencies": { + "@deckdeckgo/utils": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@deckdeckgo/utils/-/utils-1.1.0.tgz", + "integrity": "sha512-/bomB2gBlEuXmLSXCHujABB1EYDTrcK/IQaH9NFh6ZUB+dEfb3L3uCof8RyUvQcEzqhVJJa63ZBnDnitJSOWYg==" + } } }, "@deckdeckgo/demo": { @@ -132,6 +149,15 @@ "resolved": "https://registry.npmjs.org/@deckdeckgo/lazy-img/-/lazy-img-1.0.0.tgz", "integrity": "sha512-KQPhdABNaL29v3UA1hm83tHONWjC+us+k9/Te/cZuiOo3Zoqqa64x3TC2hlyGaCPzuInooVqY2uwbnyjN4dO6Q==" }, + "@deckdeckgo/math": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@deckdeckgo/math/-/math-1.0.1.tgz", + "integrity": "sha512-GeEkTHEOf6FoLsdTA6Y0eM/meyhDY0iITP53TAwRY/CiMIADgYGb8nwQNC/w6VqIPgp5KufeOVM5i2M3a0vFJg==", + "requires": { + "extract-math": "^1.1.0", + "katex": "^0.11.1" + } + }, "@deckdeckgo/qrcode": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/@deckdeckgo/qrcode/-/qrcode-1.0.0.tgz", @@ -649,6 +675,11 @@ "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", "dev": true }, + "commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==" + }, "common-tags": { "version": "1.8.0", "resolved": "https://registry.npmjs.org/common-tags/-/common-tags-1.8.0.tgz", @@ -907,6 +938,21 @@ "strip-final-newline": "^2.0.0" } }, + "extract-math": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/extract-math/-/extract-math-1.1.0.tgz", + "integrity": "sha512-YDbUcfio8SSXayqVz+MscpaJhTt1mUoFtLbrZKL7yVwjQZK9TVI9ebriSIBFH+Jy9YHctgS7OriMFxmr/dpWww==", + "requires": { + "escape-string-regexp": "^2.0.0" + }, + "dependencies": { + "escape-string-regexp": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", + "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==" + } + } + }, "find-up": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", @@ -1178,6 +1224,14 @@ "graceful-fs": "^4.1.6" } }, + "katex": { + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/katex/-/katex-0.11.1.tgz", + "integrity": "sha512-5oANDICCTX0NqYIyAiFCCwjQ7ERu3DQG2JFHLbYOf+fXaMoH8eg/zOq5WSYJsKMi/QebW+Eh3gSM+oss1H/bww==", + "requires": { + "commander": "^2.19.0" + } + }, "lines-and-columns": { "version": "1.1.6", "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.1.6.tgz", diff --git a/docs/package.json b/docs/package.json index ebced5b09..b3311387e 100644 --- a/docs/package.json +++ b/docs/package.json @@ -1,6 +1,6 @@ { "name": "deckdeckgo-docs", - "version": "1.1.0", + "version": "1.2.0", "description": "The Progressive Web App alternative for simple presentations", "license": "MIT", "files": [ @@ -17,11 +17,13 @@ "@deckdeckgo/charts": "^1.0.1", "@deckdeckgo/color": "^1.1.0", "@deckdeckgo/core": "^1.0.1", + "@deckdeckgo/deck-utils": "^2.3.0", "@deckdeckgo/demo": "^1.0.2", "@deckdeckgo/drag-resize-rotate": "^1.0.0", "@deckdeckgo/highlight-code": "^1.0.4", "@deckdeckgo/inline-editor": "^1.2.0", "@deckdeckgo/lazy-img": "^1.0.0", + "@deckdeckgo/math": "^1.0.1", "@deckdeckgo/qrcode": "^1.0.0", "@deckdeckgo/slide-aspect-ratio": "^1.0.0", "@deckdeckgo/slide-author": "^1.0.0", diff --git a/docs/src/app/app-root.tsx b/docs/src/app/app-root.tsx index 8c8ed8bc6..654b879ea 100644 --- a/docs/src/app/app-root.tsx +++ b/docs/src/app/app-root.tsx @@ -58,6 +58,7 @@ export class AppRoot { + @@ -199,6 +200,9 @@ export class AppRoot { Lazy Image + + Math + QR Code diff --git a/docs/src/app/pages/docs/components/app-components-demo/app-components-demo.tsx b/docs/src/app/pages/docs/components/app-components-demo/app-components-demo.tsx index 8b3efc027..652adbf6c 100644 --- a/docs/src/app/pages/docs/components/app-components-demo/app-components-demo.tsx +++ b/docs/src/app/pages/docs/components/app-components-demo/app-components-demo.tsx @@ -87,7 +87,7 @@ export class AppComponentsDemo {

Install from NPM

- Install it in your project from npm using the following command: + Install it in your project from npm using the following command:

npm install @deckdeckgo/demo diff --git a/docs/src/app/pages/docs/components/app-components-math/app-components-math.tsx b/docs/src/app/pages/docs/components/app-components-math/app-components-math.tsx new file mode 100644 index 000000000..9c2c994eb --- /dev/null +++ b/docs/src/app/pages/docs/components/app-components-math/app-components-math.tsx @@ -0,0 +1,302 @@ +import {Component, Element, h} from '@stencil/core'; + +import {DeckdeckgoDocsUtils} from '../../../../utils/deckdeckgo-docs-utils'; + +@Component({ + tag: 'app-components-math', +}) +export class AppComponentsMath { + @Element() el: HTMLElement; + + async componentDidLoad() { + await DeckdeckgoDocsUtils.reloadCode(this.el); + } + + render() { + return [ + , + + +
+

Demo

+

Write and render math expressions.

+

+ This component is using Katex to renders these. +

+

Table of contents

+ +

Showcase

+
+ + {`% \\f is defined as f(#1) using the macro + \\f{x} = \\int_{-\\infty}^\\infty + \\hat \\f\\xi\\,e^{2 \\pi i \\xi x} + \\,d\\xi`} + +
+ +

Installation

+

This component could be added to your web application using the following methods.

+

Using from a CDN

+

+ It's recommended to use unpkg to use the DeckDeckGo lazy image component + from a CDN. To do so, add the following include script in the main HTML file of your project: +

+ + + <script type="module" + src="https://unpkg.com/@deckdeckgo/math@latest/dist/deckdeckgo-math/deckdeckgo-math.esm.js"></script> + {'\n'}<script nomodule="" + src="https://unpkg.com/@deckdeckgo/math@latest/dist/deckdeckgo-math/deckdeckgo-math.js"></script> + + +

Install from NPM

+

+ Install it in your project from npm using the following command: +

+ + npm install @deckdeckgo/math + +

Framework integration

+

+ The Stencil documentation provide examples of framework integration for{' '} + Angular, React,{' '} + Vue and Ember. +

+

+ That being said, commonly, you might either import or load it: +

+

Import

+ + import '@deckdeckgo/math'; + +

Loader

+ + + import { defineCustomElements as deckDeckGoElement } from '@deckdeckgo/math/dist/loader';{'\n'} + deckDeckGoElement(); + + +

Usage

+

+ The "Math" Web Component could be integrated using the tag <deckgo-math/>. +

+ + + <deckgo-math>{'\n'} <code slot="math">% \f is defined as f(#1) using the macro{'\n'} \f{x} = + \int_{-\infty}^\infty{'\n'} \hat \f\xi\,e^{2 \pi i \xi x}{'\n'}{' '} + \,d\xi</code>{'\n'}</deckgo-math> + + +

It either supports a single expression, as displayed above, or expressions within paragraphs.

+ + + <deckgo-math editable="true">{'\n'} <code slot="math">{'\n'} You can write math expression inside paragraph like + this: $x + 1${'\n'} + {'\n'} Inline formulas can be written with \$ e.g: $c = \pm\sqrt{a^2 + b^2}${'\n'} + {'\n'} and displayed equations can be written using \$ e.g: $\sum_{i=1}^n 2^i${'\n'} </code>{'\n'} + </deckgo-math> + + +

Slots

+

+ The expressions have to be provided using the slot math. +

+

Attributes

+

This component offers the following options which could be set using attributes:

+ + + + + + + + + + + + + + + + + + + + + + + +
AttributeTypeDefaultDescription
macrosstring{"\\f":"f(#1)"{ + A collection of custom macros. Each macro is a property with a name like \name (written "\name" in JavaScript) which maps to a + string that describes the expansion of the macro, or a function that accepts an instance of MacroExpander as first argument and returns the + expansion as a string. +
editableboolean + false + + To set the component has being editable (contenteditable will be applied on the slot on click) +
+

+ See the Katex documentation for more information. +

+

Events

+

+ The <deckgo-math/> component triggers the following event. +

+ + + + + + + + + + + + + + + +
EventDescriptionType
+ mathDidChange + Emit the host element when modified. + CustomEvent<HTMLElement> +
+

Theming

+

The following theming options will affect this component if set on its host or parent.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
CSS4 variableDefaultNote
--deckgo-math-colorinheritColor
--deckgo-math-backgroundBackground
--deckgo-math-padding8pxPadding
--deckgo-math-border-radiusBorder radius
--deckgo-math-margin0pxMargin
--deckgo-math-directionDirection
--deckgo-math-text-alignText alignment
--deckgo-math-container-displayblockContainer display
--deckgo-math-container-justify-contentContainer justify-content attribute
--deckgo-math-container-flex-directionContainer flex-direction attribute
--deckgo-math-container-align-itemsContainer align-items attribute
--deckgo-math-scrollscrollScroll property of the expression(s)
--deckgo-math-font-sizeFont size property of the expression(s)
--deckgo-math-min-height23pxMinimal height property of the expression(s)
--deckgo-math-displayblockDisplay property of the expression(s)
--deckgo-math-code-empty-text"Click to add your math expression" + Place holder in case editable is set to true +
+
+ + +
, + ]; + } +} diff --git a/docs/src/components.d.ts b/docs/src/components.d.ts index 86cefa7dc..e9e736241 100644 --- a/docs/src/components.d.ts +++ b/docs/src/components.d.ts @@ -18,6 +18,7 @@ export namespace Components { interface AppComponentsHighlightCode {} interface AppComponentsInlineEditor {} interface AppComponentsLazyImg {} + interface AppComponentsMath {} interface AppComponentsQrcode {} interface AppComponentsSocial {} interface AppComponentsYoutube {} @@ -127,6 +128,12 @@ declare global { new (): HTMLAppComponentsLazyImgElement; }; + interface HTMLAppComponentsMathElement extends Components.AppComponentsMath, HTMLStencilElement {} + var HTMLAppComponentsMathElement: { + prototype: HTMLAppComponentsMathElement; + new (): HTMLAppComponentsMathElement; + }; + interface HTMLAppComponentsQrcodeElement extends Components.AppComponentsQrcode, HTMLStencilElement {} var HTMLAppComponentsQrcodeElement: { prototype: HTMLAppComponentsQrcodeElement; @@ -435,6 +442,7 @@ declare global { 'app-components-highlight-code': HTMLAppComponentsHighlightCodeElement; 'app-components-inline-editor': HTMLAppComponentsInlineEditorElement; 'app-components-lazy-img': HTMLAppComponentsLazyImgElement; + 'app-components-math': HTMLAppComponentsMathElement; 'app-components-qrcode': HTMLAppComponentsQrcodeElement; 'app-components-social': HTMLAppComponentsSocialElement; 'app-components-youtube': HTMLAppComponentsYoutubeElement; @@ -497,6 +505,7 @@ declare namespace LocalJSX { interface AppComponentsHighlightCode {} interface AppComponentsInlineEditor {} interface AppComponentsLazyImg {} + interface AppComponentsMath {} interface AppComponentsQrcode {} interface AppComponentsSocial {} interface AppComponentsYoutube {} @@ -563,6 +572,7 @@ declare namespace LocalJSX { 'app-components-highlight-code': AppComponentsHighlightCode; 'app-components-inline-editor': AppComponentsInlineEditor; 'app-components-lazy-img': AppComponentsLazyImg; + 'app-components-math': AppComponentsMath; 'app-components-qrcode': AppComponentsQrcode; 'app-components-social': AppComponentsSocial; 'app-components-youtube': AppComponentsYoutube; @@ -630,6 +640,7 @@ declare module "@stencil/core" { 'app-components-highlight-code': LocalJSX.AppComponentsHighlightCode & JSXBase.HTMLAttributes; 'app-components-inline-editor': LocalJSX.AppComponentsInlineEditor & JSXBase.HTMLAttributes; 'app-components-lazy-img': LocalJSX.AppComponentsLazyImg & JSXBase.HTMLAttributes; + 'app-components-math': LocalJSX.AppComponentsMath & JSXBase.HTMLAttributes; 'app-components-qrcode': LocalJSX.AppComponentsQrcode & JSXBase.HTMLAttributes; 'app-components-social': LocalJSX.AppComponentsSocial & JSXBase.HTMLAttributes; 'app-components-youtube': LocalJSX.AppComponentsYoutube & JSXBase.HTMLAttributes; diff --git a/docs/src/global/app.ts b/docs/src/global/app.ts index f8ce73c28..79a3673e5 100644 --- a/docs/src/global/app.ts +++ b/docs/src/global/app.ts @@ -26,3 +26,4 @@ import '@deckdeckgo/social'; import '@deckdeckgo/youtube'; import '@deckdeckgo/drag-resize-rotate'; import '@deckdeckgo/demo'; +import '@deckdeckgo/math'; diff --git a/remote/package-lock.json b/remote/package-lock.json index f5ef799b1..78f00773e 100644 --- a/remote/package-lock.json +++ b/remote/package-lock.json @@ -989,9 +989,9 @@ } }, "@deckdeckgo/deck-utils": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/@deckdeckgo/deck-utils/-/deck-utils-2.2.0.tgz", - "integrity": "sha512-VObxHKYzOgD8LCvKe1iDyaVj2id0kON4xOmY0Sq6Vj29arVDHo9CzmisSBiijVnE44+nIZlGjXsU1cytEKGs8g==", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@deckdeckgo/deck-utils/-/deck-utils-2.3.0.tgz", + "integrity": "sha512-LsfQJPX6lffE7OIxvT24jhMvjLAx0MPxMQGCoEC2gTH2cz7givHq5JUoLBTI6Ojc0zMiLYiZ7yjIOPw/PFyiDQ==", "requires": { "@deckdeckgo/utils": "^1.1.0" } @@ -1033,6 +1033,15 @@ "resolved": "https://registry.npmjs.org/@deckdeckgo/lazy-img/-/lazy-img-1.0.0.tgz", "integrity": "sha512-KQPhdABNaL29v3UA1hm83tHONWjC+us+k9/Te/cZuiOo3Zoqqa64x3TC2hlyGaCPzuInooVqY2uwbnyjN4dO6Q==" }, + "@deckdeckgo/math": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@deckdeckgo/math/-/math-1.0.1.tgz", + "integrity": "sha512-GeEkTHEOf6FoLsdTA6Y0eM/meyhDY0iITP53TAwRY/CiMIADgYGb8nwQNC/w6VqIPgp5KufeOVM5i2M3a0vFJg==", + "requires": { + "extract-math": "^1.1.0", + "katex": "^0.11.1" + } + }, "@deckdeckgo/qrcode": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/@deckdeckgo/qrcode/-/qrcode-1.0.0.tgz", @@ -1991,8 +2000,7 @@ "commander": { "version": "2.20.3", "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", - "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", - "dev": true + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==" }, "common-tags": { "version": "1.8.0", @@ -2503,6 +2511,21 @@ "strip-final-newline": "^2.0.0" } }, + "extract-math": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/extract-math/-/extract-math-1.1.0.tgz", + "integrity": "sha512-YDbUcfio8SSXayqVz+MscpaJhTt1mUoFtLbrZKL7yVwjQZK9TVI9ebriSIBFH+Jy9YHctgS7OriMFxmr/dpWww==", + "requires": { + "escape-string-regexp": "^2.0.0" + }, + "dependencies": { + "escape-string-regexp": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", + "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==" + } + } + }, "fast-deep-equal": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", @@ -2977,6 +3000,14 @@ "graceful-fs": "^4.1.6" } }, + "katex": { + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/katex/-/katex-0.11.1.tgz", + "integrity": "sha512-5oANDICCTX0NqYIyAiFCCwjQ7ERu3DQG2JFHLbYOf+fXaMoH8eg/zOq5WSYJsKMi/QebW+Eh3gSM+oss1H/bww==", + "requires": { + "commander": "^2.19.0" + } + }, "level-blobs": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/level-blobs/-/level-blobs-0.1.7.tgz", diff --git a/remote/package.json b/remote/package.json index 1a8fbb175..b329faf47 100644 --- a/remote/package.json +++ b/remote/package.json @@ -17,11 +17,12 @@ "dependencies": { "@deckdeckgo/charts": "^1.0.1", "@deckdeckgo/core": "^1.0.1", - "@deckdeckgo/deck-utils": "^2.2.0", + "@deckdeckgo/deck-utils": "^2.3.0", "@deckdeckgo/demo": "^1.0.2", "@deckdeckgo/drag-resize-rotate": "^1.0.0", "@deckdeckgo/highlight-code": "^1.0.4", "@deckdeckgo/lazy-img": "^1.0.0", + "@deckdeckgo/math": "^1.0.1", "@deckdeckgo/qrcode": "^1.0.0", "@deckdeckgo/remote-utils": "^1.0.0", "@deckdeckgo/slide-aspect-ratio": "^1.0.0", diff --git a/remote/src/global/app-local.ts b/remote/src/global/app-local.ts index a8b17e591..51e374a27 100644 --- a/remote/src/global/app-local.ts +++ b/remote/src/global/app-local.ts @@ -9,6 +9,7 @@ import '@deckdeckgo/social'; import '@deckdeckgo/youtube'; import '@deckdeckgo/drag-resize-rotate'; import '@deckdeckgo/demo'; +import '@deckdeckgo/math'; import '@deckdeckgo/slide-title'; import '@deckdeckgo/slide-author'; diff --git a/remote/src/global/app.ts b/remote/src/global/app.ts index fdd47860d..c65d86c21 100644 --- a/remote/src/global/app.ts +++ b/remote/src/global/app.ts @@ -9,6 +9,7 @@ import '@deckdeckgo/social'; import '@deckdeckgo/youtube'; import '@deckdeckgo/drag-resize-rotate'; import '@deckdeckgo/demo'; +import '@deckdeckgo/math'; import '@deckdeckgo/slide-title'; import '@deckdeckgo/slide-author'; diff --git a/studio/package-lock.json b/studio/package-lock.json index 60ca8af3b..9bede34a9 100644 --- a/studio/package-lock.json +++ b/studio/package-lock.json @@ -82,9 +82,9 @@ } }, "@deckdeckgo/deck-utils": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/@deckdeckgo/deck-utils/-/deck-utils-2.2.0.tgz", - "integrity": "sha512-VObxHKYzOgD8LCvKe1iDyaVj2id0kON4xOmY0Sq6Vj29arVDHo9CzmisSBiijVnE44+nIZlGjXsU1cytEKGs8g==", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@deckdeckgo/deck-utils/-/deck-utils-2.3.0.tgz", + "integrity": "sha512-LsfQJPX6lffE7OIxvT24jhMvjLAx0MPxMQGCoEC2gTH2cz7givHq5JUoLBTI6Ojc0zMiLYiZ7yjIOPw/PFyiDQ==", "requires": { "@deckdeckgo/utils": "^1.1.0" } @@ -135,6 +135,15 @@ "resolved": "https://registry.npmjs.org/@deckdeckgo/lazy-img/-/lazy-img-1.0.0.tgz", "integrity": "sha512-KQPhdABNaL29v3UA1hm83tHONWjC+us+k9/Te/cZuiOo3Zoqqa64x3TC2hlyGaCPzuInooVqY2uwbnyjN4dO6Q==" }, + "@deckdeckgo/math": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@deckdeckgo/math/-/math-1.0.1.tgz", + "integrity": "sha512-GeEkTHEOf6FoLsdTA6Y0eM/meyhDY0iITP53TAwRY/CiMIADgYGb8nwQNC/w6VqIPgp5KufeOVM5i2M3a0vFJg==", + "requires": { + "extract-math": "^1.1.0", + "katex": "^0.11.1" + } + }, "@deckdeckgo/qrcode": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/@deckdeckgo/qrcode/-/qrcode-1.0.0.tgz", @@ -1064,6 +1073,11 @@ "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", "dev": true }, + "commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==" + }, "common-tags": { "version": "1.8.0", "resolved": "https://registry.npmjs.org/common-tags/-/common-tags-1.8.0.tgz", @@ -1348,6 +1362,21 @@ } } }, + "extract-math": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/extract-math/-/extract-math-1.1.0.tgz", + "integrity": "sha512-YDbUcfio8SSXayqVz+MscpaJhTt1mUoFtLbrZKL7yVwjQZK9TVI9ebriSIBFH+Jy9YHctgS7OriMFxmr/dpWww==", + "requires": { + "escape-string-regexp": "^2.0.0" + }, + "dependencies": { + "escape-string-regexp": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", + "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==" + } + } + }, "faye-websocket": { "version": "0.11.3", "resolved": "https://registry.npmjs.org/faye-websocket/-/faye-websocket-0.11.3.tgz", @@ -1690,6 +1719,14 @@ "graceful-fs": "^4.1.6" } }, + "katex": { + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/katex/-/katex-0.11.1.tgz", + "integrity": "sha512-5oANDICCTX0NqYIyAiFCCwjQ7ERu3DQG2JFHLbYOf+fXaMoH8eg/zOq5WSYJsKMi/QebW+Eh3gSM+oss1H/bww==", + "requires": { + "commander": "^2.19.0" + } + }, "lines-and-columns": { "version": "1.1.6", "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.1.6.tgz", diff --git a/studio/package.json b/studio/package.json index 368f2231c..b790cfc3d 100644 --- a/studio/package.json +++ b/studio/package.json @@ -19,12 +19,13 @@ "@deckdeckgo/charts": "^1.0.1", "@deckdeckgo/color": "^1.1.0", "@deckdeckgo/core": "^1.0.1", - "@deckdeckgo/deck-utils": "^2.2.0", + "@deckdeckgo/deck-utils": "^2.3.0", "@deckdeckgo/demo": "^1.0.2", "@deckdeckgo/drag-resize-rotate": "^1.0.0", "@deckdeckgo/highlight-code": "^1.0.4", "@deckdeckgo/inline-editor": "^1.2.0", "@deckdeckgo/lazy-img": "^1.0.0", + "@deckdeckgo/math": "^1.0.1", "@deckdeckgo/qrcode": "^1.0.0", "@deckdeckgo/remote": "^1.1.0", "@deckdeckgo/slide-aspect-ratio": "^1.0.0", diff --git a/studio/src/app/components/editor/actions/element/app-actions-element/app-actions-element.tsx b/studio/src/app/components/editor/actions/element/app-actions-element/app-actions-element.tsx index a195c4769..eeb19b8a5 100644 --- a/studio/src/app/components/editor/actions/element/app-actions-element/app-actions-element.tsx +++ b/studio/src/app/components/editor/actions/element/app-actions-element/app-actions-element.tsx @@ -52,6 +52,9 @@ export class AppActionsElement { @State() private code: boolean = false; + @State() + private math: boolean = false; + @State() private image: boolean = false; @@ -70,6 +73,7 @@ export class AppActionsElement { @Event() private slideDidChange: EventEmitter; @Event() private codeDidChange: EventEmitter; + @Event() private mathDidChange: EventEmitter; @Event() private imgDidChange: EventEmitter; @Event() private notesDidChange: EventEmitter; @@ -227,7 +231,7 @@ export class AppActionsElement { return; } - if (element.hasAttribute('slot') && element.getAttribute('slot') !== 'code') { + if (element.hasAttribute('slot') && element.getAttribute('slot') !== 'code' && element.getAttribute('slot') !== 'math') { resolve(element); return; } @@ -246,6 +250,10 @@ export class AppActionsElement { return element && element.nodeName && element.nodeName.toLowerCase() === SlotType.CODE; } + private isElementMath(element: HTMLElement): boolean { + return element && element.nodeName && element.nodeName.toLowerCase() === SlotType.MATH; + } + private isElementShape(element: HTMLElement): boolean { return element && element.nodeName && element.nodeName.toLowerCase() === SlotType.DRAG_RESIZE_ROTATE; } @@ -611,6 +619,24 @@ export class AppActionsElement { await popover.present(); } + private async openMath() { + if (!this.math) { + return; + } + + const popover: HTMLIonPopoverElement = await popoverController.create({ + component: 'app-math', + componentProps: { + selectedElement: this.selectedElement, + mathDidChange: this.mathDidChange, + }, + mode: 'md', + showBackdrop: false, + cssClass: 'popover-menu', + }); + + await popover.present(); + } private async openEditYoutubeSlide() { if (this.slideNodeName !== 'deckgo-slide-youtube') { @@ -766,6 +792,7 @@ export class AppActionsElement { this.slideNodeName = this.slide ? element.nodeName.toLowerCase() : undefined; this.slideDemo = this.slide && this.slideNodeName === 'deckgo-slide-split' && element.getAttribute('type') === SlideSplitType.DEMO; + this.math = this.isElementMath(SlotUtils.isNodeReveal(element) ? (element.firstElementChild as HTMLElement) : element); this.code = this.isElementCode(SlotUtils.isNodeReveal(element) ? (element.firstElementChild as HTMLElement) : element); this.image = this.isElementImage(SlotUtils.isNodeReveal(element) ? (element.firstElementChild as HTMLElement) : element); this.shape = this.isElementShape(element); @@ -1039,7 +1066,7 @@ export class AppActionsElement { } private hideReveal(): boolean { - return this.slide || this.code || this.shape || this.slideNodeName === 'deckgo-slide-youtube'; + return this.slide || this.code || this.math || this.shape || this.slideNodeName === 'deckgo-slide-youtube'; } render() { @@ -1054,6 +1081,7 @@ export class AppActionsElement { {this.renderList()} {this.renderImages()} {this.renderCodeOptions()} + {this.renderMathOptions()} @@ -1162,6 +1190,16 @@ export class AppActionsElement { ); } + private renderMathOptions() { + const classSlideMath: string | undefined = this.math ? undefined : 'hidden'; + + return ( + this.openMath()} aria-label="Math options" color="primary" mode="md" class={classSlideMath}> + + Attributes + + ); + } private renderImages() { const classImage: string | undefined = this.image || this.slide ? undefined : 'hidden'; diff --git a/studio/src/app/components/feed/card/app-feed-card/app-feed-card.tsx b/studio/src/app/components/feed/card/app-feed-card/app-feed-card.tsx index 956a27bde..9b6c348db 100644 --- a/studio/src/app/components/feed/card/app-feed-card/app-feed-card.tsx +++ b/studio/src/app/components/feed/card/app-feed-card/app-feed-card.tsx @@ -1,6 +1,6 @@ -import { Component, Prop, State, h, Element } from "@stencil/core"; +import {Component, Prop, State, h, Element} from '@stencil/core'; -import { debounce } from "@deckdeckgo/utils"; +import {debounce} from '@deckdeckgo/utils'; import DateTimeFormatOptions = Intl.DateTimeFormatOptions; @@ -11,7 +11,7 @@ import {EnvironmentConfigService} from '../../../../services/core/environment/en @Component({ tag: 'app-feed-card', styleUrl: 'app-feed-card.scss', - shadow: false + shadow: false, }) export class AppFeedCard { @Element() el: HTMLElement; @@ -74,7 +74,7 @@ export class AppFeedCard { private onWindowResize = async () => { this.width = this.el.offsetWidth; - } + }; private init(): Promise { return new Promise(async (resolve) => { @@ -158,7 +158,11 @@ export class AppFeedCard { } render() { - return {this.renderCardContent()}; + return ( + + {this.renderCardContent()} + + ); } private renderCardContent() { diff --git a/studio/src/app/handlers/editor/events/deck/deck-events.handler.tsx b/studio/src/app/handlers/editor/events/deck/deck-events.handler.tsx index d57ae1096..0eca4ea16 100644 --- a/studio/src/app/handlers/editor/events/deck/deck-events.handler.tsx +++ b/studio/src/app/handlers/editor/events/deck/deck-events.handler.tsx @@ -65,6 +65,7 @@ export class DeckEventsHandler { this.el.addEventListener('slidesDidLoad', this.onSlidesDidLoad, false); this.el.addEventListener('slideDelete', this.onSlideDelete, false); this.el.addEventListener('codeDidChange', this.onCustomEventChange, false); + this.el.addEventListener('mathDidChange', this.onCustomEventChange, false); this.el.addEventListener('imgDidChange', this.onCustomEventChange, false); this.el.addEventListener('linkCreated', this.onCustomEventChange, false); this.el.addEventListener('drrDidChange', this.onCustomEventChange, false); @@ -95,6 +96,7 @@ export class DeckEventsHandler { this.el.removeEventListener('slidesDidLoad', this.onSlidesDidLoad, true); this.el.removeEventListener('slideDelete', this.onSlideDelete, true); this.el.removeEventListener('codeDidChange', this.onCustomEventChange, true); + this.el.removeEventListener('mathDidChange', this.onCustomEventChange, true); this.el.removeEventListener('imgDidChange', this.onCustomEventChange, true); this.el.removeEventListener('linkCreated', this.onCustomEventChange, true); this.el.removeEventListener('drrDidChange', this.onCustomEventChange, true); diff --git a/studio/src/app/pages/editor/app-editor/app-editor.tsx b/studio/src/app/pages/editor/app-editor/app-editor.tsx index 43aacd2ca..6c606ab9a 100644 --- a/studio/src/app/pages/editor/app-editor/app-editor.tsx +++ b/studio/src/app/pages/editor/app-editor/app-editor.tsx @@ -44,7 +44,7 @@ import {FontsService} from '../../../services/editor/fonts/fonts.service'; @Component({ tag: 'app-editor', - styleUrl: 'app-editor.scss', + styleUrl: 'app-editor.scss' }) export class AppEditor { @Element() el: HTMLElement; @@ -392,7 +392,7 @@ export class AppEditor { const modal: HTMLIonModalElement = await modalController.create({ component: 'app-publish', - cssClass: 'fullscreen', + cssClass: 'fullscreen' }); modal.onDidDismiss().then(async (_detail: OverlayEventDetail) => { @@ -589,7 +589,7 @@ export class AppEditor { async signIn() { this.navService.navigate({ url: '/signin' + (window && window.location ? window.location.pathname : ''), - direction: NavDirection.FORWARD, + direction: NavDirection.FORWARD }); } @@ -603,7 +603,7 @@ export class AppEditor { const elements: HTMLElement[] = Array.prototype.slice.call(slide.childNodes); elements.forEach((e: HTMLElement) => { if (e.nodeName && e.nodeType === 1 && e.hasAttribute('slot')) { - if (e.nodeName.toLowerCase() === SlotType.CODE) { + if (e.nodeName.toLowerCase() === SlotType.CODE || e.nodeName.toLowerCase() === SlotType.MATH) { e.setAttribute('editable', ''); } else if (ParseElementsUtils.isElementContentEditable(e)) { e.setAttribute('contentEditable', ''); @@ -673,7 +673,6 @@ export class AppEditor {
{this.renderLoading()} - , - this.inactivity($event)}>, + this.inactivity($event)}> ]; } diff --git a/studio/src/app/popovers/editor/app-math/app-math.scss b/studio/src/app/popovers/editor/app-math/app-math.scss new file mode 100644 index 000000000..ac48e03b2 --- /dev/null +++ b/studio/src/app/popovers/editor/app-math/app-math.scss @@ -0,0 +1,8 @@ +app-math { + @import "../../../../global/theme/editor/editor-info"; + @import "../../../../global/theme/editor/editor-popover"; + + ion-textarea[class*="sc-ion-textarea"] { + margin: 8px 16px; + } +} diff --git a/studio/src/app/popovers/editor/app-math/app-math.tsx b/studio/src/app/popovers/editor/app-math/app-math.tsx new file mode 100644 index 000000000..2aefd4b5d --- /dev/null +++ b/studio/src/app/popovers/editor/app-math/app-math.tsx @@ -0,0 +1,168 @@ +import {Component, Element, EventEmitter, Prop, State, h} from '@stencil/core'; + +enum MathFontSize { + VERY_SMALL, + SMALL, + NORMAL, + BIG, + VERY_BIG, +} + +@Component({ + tag: 'app-math', + styleUrl: 'app-math.scss', +}) +export class AppMath { + @Element() el: HTMLElement; + + @Prop() + selectedElement: HTMLElement; + + @Prop() + mathDidChange: EventEmitter; + + @State() + private currentFontSize: MathFontSize = undefined; + + @State() + private macros: string | undefined; + + constructor() {} + + async componentWillLoad() { + await this.initCurrent(); + } + + private async closePopover() { + await (this.el.closest('ion-popover') as HTMLIonPopoverElement).dismiss(); + } + + private async initCurrent(): Promise { + this.currentFontSize = await this.initFontSize(); + this.macros = this.selectedElement ? this.selectedElement.getAttribute('macros') : undefined; + } + + private emitMathDidChange() { + this.mathDidChange.emit(this.selectedElement); + } + + private initFontSize(): Promise { + return new Promise((resolve) => { + if (!this.selectedElement || !this.selectedElement.style) { + resolve(null); + return; + } + + const property: string = this.selectedElement.style.getPropertyValue('--deckgo-math-font-size'); + + if (property === '50%') { + resolve(MathFontSize.VERY_SMALL); + } else if (property === '75%') { + resolve(MathFontSize.SMALL); + } else if (property === '150%') { + resolve(MathFontSize.BIG); + } else if (property === '200%') { + resolve(MathFontSize.VERY_BIG); + } else { + resolve(MathFontSize.NORMAL); + } + }); + } + + private toggleFontSize($event: CustomEvent): Promise { + return new Promise(async (resolve) => { + if (!$event || !$event.detail) { + resolve(); + return; + } + + this.currentFontSize = $event.detail.value; + + if (!this.selectedElement) { + resolve(); + return; + } + + this.selectedElement.style.removeProperty('--deckgo-math-font-size'); + + if (this.currentFontSize === MathFontSize.VERY_SMALL) { + this.selectedElement.style.setProperty('--deckgo-math-font-size', '50%'); + } else if (this.currentFontSize === MathFontSize.SMALL) { + this.selectedElement.style.setProperty('--deckgo-math-font-size', '75%'); + } else if (this.currentFontSize === MathFontSize.BIG) { + this.selectedElement.style.setProperty('--deckgo-math-font-size', '150%'); + } else if (this.currentFontSize === MathFontSize.VERY_BIG) { + this.selectedElement.style.setProperty('--deckgo-math-font-size', '200%'); + } + + this.emitMathDidChange(); + + resolve(); + }); + } + + private handleMacrosInput($event: CustomEvent) { + this.macros = ($event.target as InputTargetEvent).value; + } + + private async applyMacrosInput(): Promise { + if (!this.selectedElement) { + return; + } + + if (this.macros && this.macros !== '') { + this.selectedElement.setAttribute('macros', this.macros); + } else { + this.selectedElement.removeAttribute('macros'); + } + + this.emitMathDidChange(); + } + + render() { + return [ + +

Math attributes

+ this.closePopover()}> + + +
, + + + Font size + + + + Size + + this.toggleFontSize($event)} + class="ion-padding-start ion-padding-end"> + Very small + Small + Normal + Big + Very big + + + + + Macros + + + + ) => this.handleMacrosInput($event)} + onIonChange={() => this.applyMacrosInput()}> + + , + ]; + } +} diff --git a/studio/src/app/popovers/editor/app-slot-type/app-slot-type.tsx b/studio/src/app/popovers/editor/app-slot-type/app-slot-type.tsx index 1e35e1451..018aff067 100644 --- a/studio/src/app/popovers/editor/app-slot-type/app-slot-type.tsx +++ b/studio/src/app/popovers/editor/app-slot-type/app-slot-type.tsx @@ -127,6 +127,11 @@ export class AppSlideAdd {

Code

+ , + this.closePopover(SlotType.MATH)} class={this.currentType === SlotType.MATH ? 'current' : ''}> + +

Math

+
]; } diff --git a/studio/src/app/utils/editor/align.utils.tsx b/studio/src/app/utils/editor/align.utils.tsx index c3fca420e..b89a93f7f 100644 --- a/studio/src/app/utils/editor/align.utils.tsx +++ b/studio/src/app/utils/editor/align.utils.tsx @@ -43,6 +43,7 @@ export class AlignUtils { SlotType.UL.toString(), SlotType.REVEAL.toString(), SlotType.REVEAL_LIST.toString(), + SlotType.MATH.toString(), ].indexOf(element.nodeName.toLowerCase()) > -1 ); } diff --git a/studio/src/app/utils/editor/parse-elements.utils.tsx b/studio/src/app/utils/editor/parse-elements.utils.tsx index 1eb3514b8..59182d879 100644 --- a/studio/src/app/utils/editor/parse-elements.utils.tsx +++ b/studio/src/app/utils/editor/parse-elements.utils.tsx @@ -80,6 +80,7 @@ export class ParseElementsUtils { static isElementContentEditable(element: HTMLElement): boolean { return ( (!element.nodeName || (element.nodeName.toLowerCase() !== 'code' && element.nodeName.toLowerCase() !== SlotType.CODE)) && + (!element.nodeName || (element.nodeName.toLowerCase() !== 'div' && element.nodeName.toLowerCase() !== SlotType.MATH)) && (!element.nodeName || (element.nodeName.toLowerCase() !== 'deckgo-social' && element.nodeName.toLowerCase() !== SlotType.SOCIAL)) && (!element.nodeName || (element.nodeName.toLowerCase() !== 'deckgo-lazy-img' && element.nodeName.toLowerCase() !== SlotType.IMG)) && (!element.nodeName || (element.nodeName.toLowerCase() !== 'deckgo-demo' && element.nodeName.toLowerCase() !== SlotType.DEMO)) && diff --git a/studio/src/app/utils/editor/slot-type.tsx b/studio/src/app/utils/editor/slot-type.tsx index 5815a910f..fa22553d9 100644 --- a/studio/src/app/utils/editor/slot-type.tsx +++ b/studio/src/app/utils/editor/slot-type.tsx @@ -12,4 +12,5 @@ export enum SlotType { REVEAL_LIST = 'deckgo-reveal-list', DRAG_RESIZE_ROTATE = 'deckgo-drr', DEMO = 'deckgo-demo', + MATH = 'deckgo-math' } diff --git a/studio/src/app/utils/editor/toggle-slot.utils.tsx b/studio/src/app/utils/editor/toggle-slot.utils.tsx index 615fe88cf..19a10fa2d 100644 --- a/studio/src/app/utils/editor/toggle-slot.utils.tsx +++ b/studio/src/app/utils/editor/toggle-slot.utils.tsx @@ -47,17 +47,21 @@ export class ToggleSlotUtils { }); } - private static createSlotContainer(element: HTMLElement, type: SlotType): HTMLElement { - if (type !== SlotType.CODE) { + private static async createSlotContainer(element: HTMLElement, type: SlotType): Promise { + if (type == SlotType.CODE) { + return this.createSlotCode(element, 'code'); + } else if (type == SlotType.MATH) { + return this.createSlotCode(element, 'math'); + } else { return element; } + } - const code: HTMLElement = document.createElement('code'); - code.setAttribute('slot', 'code'); - - element.appendChild(code); - - return code; + private static async createSlotCode(element: HTMLElement, slotName: 'code' | 'math'): Promise { + const container: HTMLElement = document.createElement('code'); + container.setAttribute('slot', slotName); + element.appendChild(container); + return container; } private static getSlotContainer(selectedElement: HTMLElement): HTMLElement { @@ -78,7 +82,7 @@ export class ToggleSlotUtils { if (!SlotUtils.isSlotTypeEditable(type)) { selectedElement.removeAttribute('editable'); selectedElement.removeAttribute('contenteditable'); - } else if (type === SlotType.CODE) { + } else if (type === SlotType.CODE || type == SlotType.MATH) { selectedElement.setAttribute('editable', 'true'); selectedElement.removeAttribute('contenteditable'); } else { @@ -109,7 +113,7 @@ export class ToggleSlotUtils { reveal && !SlotUtils.isNodeRevealList(selectedElement) ? (selectedElement.firstElementChild as HTMLElement) : selectedElement ); - const container: HTMLElement = this.createSlotContainer(element, type); + const container: HTMLElement = await this.createSlotContainer(element, type); // We don't copy content if the source or the destination is an image if (SlotUtils.isNodeImage(currentContainer) || SlotUtils.isNodeSocial(currentContainer) || !SlotUtils.isSlotTypeEditable(type)) { diff --git a/studio/src/assets/assets.json b/studio/src/assets/assets.json index 4db15b934..1ba3463fc 100644 --- a/studio/src/assets/assets.json +++ b/studio/src/assets/assets.json @@ -238,6 +238,7 @@ {"src": "/icons/ionicons/checkmark.svg", "ariaLabel": "Check"}, {"src": "/icons/align-center.svg", "ariaLabel": "Align center"}, {"src": "/icons/align-left.svg", "ariaLabel": "Align left"}, - {"src": "/icons/align-right.svg", "ariaLabel": "Align right"} + {"src": "/icons/align-right.svg", "ariaLabel": "Align right"}, + {"src": "/icons/math.svg", "ariaLabel": "Math"} ] } diff --git a/studio/src/assets/icons/math.svg b/studio/src/assets/icons/math.svg new file mode 100644 index 000000000..f10cb92b7 --- /dev/null +++ b/studio/src/assets/icons/math.svg @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/studio/src/components.d.ts b/studio/src/components.d.ts index 6a3a0d198..8c4ed8f5d 100644 --- a/studio/src/components.d.ts +++ b/studio/src/components.d.ts @@ -229,6 +229,10 @@ export namespace Components { 'selectedElement': HTMLElement; } interface AppLogo {} + interface AppMath { + 'mathDidChange': EventEmitter; + 'selectedElement': HTMLElement; + } interface AppMenu {} interface AppMoreDeckActions { 'offline': boolean; @@ -689,6 +693,12 @@ declare global { new (): HTMLAppLogoElement; }; + interface HTMLAppMathElement extends Components.AppMath, HTMLStencilElement {} + var HTMLAppMathElement: { + prototype: HTMLAppMathElement; + new (): HTMLAppMathElement; + }; + interface HTMLAppMenuElement extends Components.AppMenu, HTMLStencilElement {} var HTMLAppMenuElement: { prototype: HTMLAppMenuElement; @@ -988,6 +998,7 @@ declare global { 'app-landing-footer': HTMLAppLandingFooterElement; 'app-list': HTMLAppListElement; 'app-logo': HTMLAppLogoElement; + 'app-math': HTMLAppMathElement; 'app-menu': HTMLAppMenuElement; 'app-more-deck-actions': HTMLAppMoreDeckActionsElement; 'app-more-element-actions': HTMLAppMoreElementActionsElement; @@ -1081,6 +1092,7 @@ declare namespace LocalJSX { 'onBlockSlide'?: (event: CustomEvent) => void; 'onCodeDidChange'?: (event: CustomEvent) => void; 'onImgDidChange'?: (event: CustomEvent) => void; + 'onMathDidChange'?: (event: CustomEvent) => void; 'onNotesDidChange'?: (event: CustomEvent) => void; 'onResetted'?: (event: CustomEvent) => void; 'onSignIn'?: (event: CustomEvent) => void; @@ -1260,6 +1272,10 @@ declare namespace LocalJSX { 'selectedElement'?: HTMLElement; } interface AppLogo {} + interface AppMath { + 'mathDidChange'?: EventEmitter; + 'selectedElement'?: HTMLElement; + } interface AppMenu {} interface AppMoreDeckActions { 'offline'?: boolean; @@ -1429,6 +1445,7 @@ declare namespace LocalJSX { 'app-landing-footer': AppLandingFooter; 'app-list': AppList; 'app-logo': AppLogo; + 'app-math': AppMath; 'app-menu': AppMenu; 'app-more-deck-actions': AppMoreDeckActions; 'app-more-element-actions': AppMoreElementActions; @@ -1537,6 +1554,7 @@ declare module "@stencil/core" { 'app-landing-footer': LocalJSX.AppLandingFooter & JSXBase.HTMLAttributes; 'app-list': LocalJSX.AppList & JSXBase.HTMLAttributes; 'app-logo': LocalJSX.AppLogo & JSXBase.HTMLAttributes; + 'app-math': LocalJSX.AppMath & JSXBase.HTMLAttributes; 'app-menu': LocalJSX.AppMenu & JSXBase.HTMLAttributes; 'app-more-deck-actions': LocalJSX.AppMoreDeckActions & JSXBase.HTMLAttributes; 'app-more-element-actions': LocalJSX.AppMoreElementActions & JSXBase.HTMLAttributes; diff --git a/studio/src/global/app-dev.ts b/studio/src/global/app-dev.ts index 344fc2d0e..22637d84f 100644 --- a/studio/src/global/app-dev.ts +++ b/studio/src/global/app-dev.ts @@ -11,6 +11,7 @@ import '@deckdeckgo/inline-editor'; import '@deckdeckgo/remote'; import '@deckdeckgo/qrcode'; import '@deckdeckgo/highlight-code'; +import '@deckdeckgo/math'; import '@deckdeckgo/lazy-img'; import '@deckdeckgo/color'; import '@deckdeckgo/charts'; diff --git a/studio/src/global/app-staging.ts b/studio/src/global/app-staging.ts index 3eb412659..88c717f56 100644 --- a/studio/src/global/app-staging.ts +++ b/studio/src/global/app-staging.ts @@ -11,6 +11,7 @@ import '@deckdeckgo/inline-editor'; import '@deckdeckgo/remote'; import '@deckdeckgo/qrcode'; import '@deckdeckgo/highlight-code'; +import '@deckdeckgo/math'; import '@deckdeckgo/lazy-img'; import '@deckdeckgo/color'; import '@deckdeckgo/charts'; diff --git a/studio/src/global/app.ts b/studio/src/global/app.ts index ddb47b5be..1640be6e5 100644 --- a/studio/src/global/app.ts +++ b/studio/src/global/app.ts @@ -11,6 +11,7 @@ import '@deckdeckgo/inline-editor'; import '@deckdeckgo/remote'; import '@deckdeckgo/qrcode'; import '@deckdeckgo/highlight-code'; +import '@deckdeckgo/math'; import '@deckdeckgo/lazy-img'; import '@deckdeckgo/color'; import '@deckdeckgo/charts'; diff --git a/studio/src/global/theme/editor/editor-deck.scss b/studio/src/global/theme/editor/editor-deck.scss index 7d52d54a1..11e5a02ef 100644 --- a/studio/src/global/theme/editor/editor-deck.scss +++ b/studio/src/global/theme/editor/editor-deck.scss @@ -12,7 +12,8 @@ deckgo-deck { section, ol, ul, - deckgo-reveal-list { + deckgo-reveal-list, + deckgo-math { border-radius: 2px; border: 1px solid var(--ion-color-light); } @@ -43,6 +44,12 @@ deckgo-deck { } } + deckgo-math { + code[slot] { + min-height: 23px; + } + } + a { cursor: pointer; } diff --git a/studio/src/global/theme/editor/editor-fullscreen.scss b/studio/src/global/theme/editor/editor-fullscreen.scss index c12fa5872..e58d3820d 100644 --- a/studio/src/global/theme/editor/editor-fullscreen.scss +++ b/studio/src/global/theme/editor/editor-fullscreen.scss @@ -58,7 +58,8 @@ ul, deckgo-reveal-list, *:not([slot="background"]) > deckgo-lazy-img, - deckgo-reveal[img] { + deckgo-reveal[img], + deckgo-math { border: 1px solid transparent; } diff --git a/utils/deck/CHANGELOG.md b/utils/deck/CHANGELOG.md index ce063fc99..6d0e7b6a4 100644 --- a/utils/deck/CHANGELOG.md +++ b/utils/deck/CHANGELOG.md @@ -1,3 +1,11 @@ + + +# 2.3.0 (2020-05-14) + +### Features + +- add style for new component `deckgo-math` + # 2.2.0 (2020-05-07) diff --git a/utils/deck/package-lock.json b/utils/deck/package-lock.json index d83d5008e..bffa2199a 100644 --- a/utils/deck/package-lock.json +++ b/utils/deck/package-lock.json @@ -1,6 +1,6 @@ { "name": "@deckdeckgo/deck-utils", - "version": "2.2.0", + "version": "2.3.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/utils/deck/package.json b/utils/deck/package.json index 3065b931c..c9c3df7cb 100644 --- a/utils/deck/package.json +++ b/utils/deck/package.json @@ -1,6 +1,6 @@ { "name": "@deckdeckgo/deck-utils", - "version": "2.2.0", + "version": "2.3.0", "author": "David Dal Busco", "description": "Utils and styles for the DeckDeckGo applications", "license": "MIT", diff --git a/utils/deck/styles/deck/deck.scss b/utils/deck/styles/deck/deck.scss index a0ebf34d4..72f22dbce 100644 --- a/utils/deck/styles/deck/deck.scss +++ b/utils/deck/styles/deck/deck.scss @@ -12,7 +12,8 @@ deckgo-deck section, deckgo-deck ol, deckgo-deck ul, deckgo-deck deckgo-reveal-list, -deckgo-deck deckgo-highlight-code { +deckgo-deck deckgo-highlight-code, +deckgo-deck deckgo-math { width: 100%; } @@ -34,6 +35,7 @@ deckgo-deck ol, deckgo-deck ul, deckgo-deck deckgo-reveal-list, deckgo-deck deckgo-highlight-code, +deckgo-deck deckgo-math, deckgo-deck deckgo-lazy-img[slot] { margin: 16px 0; overflow: auto; @@ -149,6 +151,7 @@ deckgo-deck deckgo-reveal h2, deckgo-deck deckgo-reveal h3, deckgo-deck deckgo-reveal section, deckgo-deck deckgo-reveal deckgo-highlight-code, +deckgo-deck deckgo-reveal deckgo-math, deckgo-deck deckgo-reveal deckgo-lazy-img[slot] { margin: 0; } diff --git a/webcomponents/math/.editorconfig b/webcomponents/math/.editorconfig new file mode 100644 index 000000000..f1cc3ad32 --- /dev/null +++ b/webcomponents/math/.editorconfig @@ -0,0 +1,15 @@ +# http://editorconfig.org + +root = true + +[*] +charset = utf-8 +indent_style = space +indent_size = 2 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true + +[*.md] +insert_final_newline = false +trim_trailing_whitespace = false diff --git a/webcomponents/math/.prettierrc b/webcomponents/math/.prettierrc new file mode 100644 index 000000000..55895b9a6 --- /dev/null +++ b/webcomponents/math/.prettierrc @@ -0,0 +1,15 @@ +{ + "printWidth": 160, + "singleQuote": true, + "arrowParens": "always", + "bracketSpacing": false, + "jsxBracketSameLine": true, + "overrides": [ + { + "files": ["*.scss", "*.css"], + "options": { + "singleQuote": false + } + } + ] +} diff --git a/webcomponents/math/CHANGELOG.md b/webcomponents/math/CHANGELOG.md new file mode 100644 index 000000000..cef00e367 --- /dev/null +++ b/webcomponents/math/CHANGELOG.md @@ -0,0 +1,3 @@ +# 1.0.1 (2020-05-14) + +Hello World 👋 diff --git a/webcomponents/math/LICENSE b/webcomponents/math/LICENSE new file mode 100644 index 000000000..c0e5d1513 --- /dev/null +++ b/webcomponents/math/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 David Dal Busco and Nicolas Mattia + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/webcomponents/math/README.md b/webcomponents/math/README.md new file mode 100644 index 000000000..c3f933a54 --- /dev/null +++ b/webcomponents/math/README.md @@ -0,0 +1,37 @@ +# DeckDeckGo - Math + +A Web Component to write and render math expressions. + +It is developed with [Stencil](https://stenciljs.com) and use [Katex](https://katex.org/) to renders the math expressions. + +## Table of contents + +- [Getting Started](#getting-started) +- [Develop](#develop) +- [Credits](#credits) +- [License](#license) + +## Getting Started + +To get started with this Web Component, have a look to its [documentation](https://docs.deckdeckgo.com/components/math). + +## Develop + +To develop and run this Web Component locally, proceed as following: + +``` +git clone https://github.com/deckgo/deckdeckgo +cd deckdeckgo/webcomponents/math +npm install +npm run start +``` + +## Credits + +Shout out to [Akash Borad](https://twitter.com/BoradAkash) for having created this component! + +## License + +MIT © [David Dal Busco](mailto:david.dalbusco@outlook.com) and [Nicolas Mattia](mailto:nicolas@nmattia.com) + +[deckdeckgo]: https://deckdeckgo.com diff --git a/webcomponents/math/package-lock.json b/webcomponents/math/package-lock.json new file mode 100644 index 000000000..82c00308f --- /dev/null +++ b/webcomponents/math/package-lock.json @@ -0,0 +1,934 @@ +{ + "name": "@deckdeckgo/math", + "version": "1.0.1", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@babel/code-frame": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.8.3.tgz", + "integrity": "sha512-a9gxpmdXtZEInkCSHUJDLHZVBgb1QS0jhss4cPP93EW7s+uC5bikET2twEF3KV+7rDblJcmNvTR7VJejqd2C2g==", + "dev": true, + "requires": { + "@babel/highlight": "^7.8.3" + } + }, + "@babel/helper-validator-identifier": { + "version": "7.9.5", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.9.5.tgz", + "integrity": "sha512-/8arLKUFq882w4tWGj9JYzRpAlZgiWUJ+dtteNTDqrRBz9Iguck9Rn3ykuBDoUwh2TO4tSAJlrxDUOXWklJe4g==", + "dev": true + }, + "@babel/highlight": { + "version": "7.9.0", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.9.0.tgz", + "integrity": "sha512-lJZPilxX7Op3Nv/2cvFdnlepPXDxi29wxteT57Q965oc5R9v86ztx0jfxVrTcBk8C2kcPkkDa2Z4T3ZsPPVWsQ==", + "dev": true, + "requires": { + "@babel/helper-validator-identifier": "^7.9.0", + "chalk": "^2.0.0", + "js-tokens": "^4.0.0" + } + }, + "@babel/runtime": { + "version": "7.9.6", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.9.6.tgz", + "integrity": "sha512-64AF1xY3OAkFHqOb9s4jpgk1Mm5vDZ4L3acHvAml+53nO1XbXLuDodsVpO4OIUsmemlUHMxNdYMNJmsvOwLrvQ==", + "dev": true, + "requires": { + "regenerator-runtime": "^0.13.4" + } + }, + "@stencil/core": { + "version": "1.13.0", + "resolved": "https://registry.npmjs.org/@stencil/core/-/core-1.13.0.tgz", + "integrity": "sha512-++kIXaEgmwm/vq+9QAVHPuLLddCKVdJyI8OfHxknkpu5udxZMYA/vaN/K9i+2NIiTLbGpvHNk9E+RyYzKxS0XQ==", + "dev": true, + "requires": { + "typescript": "3.8.3" + } + }, + "@stencil/postcss": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@stencil/postcss/-/postcss-1.0.1.tgz", + "integrity": "sha512-+QOLwdiMSeE6XbvjOM8bfMIX6E6L4DFLmnp0wZqCj4O/PVkNfEQA6IXZgd6F+OIfZ1wBy/dxR4Jvtwfo+QXa2g==", + "dev": true, + "requires": { + "postcss": "~7.0.17" + } + }, + "@stencil/sass": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@stencil/sass/-/sass-1.3.1.tgz", + "integrity": "sha512-5qsEyhLGTywpG4zlWv6eBhhj/z2Z37nbUGa87Ak0KqfsEiclJCYRA/AMM9FiN1jHfBvr968G4zE8rNlYmiPLsQ==", + "dev": true + }, + "@types/color-name": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz", + "integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==", + "dev": true + }, + "@types/katex": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@types/katex/-/katex-0.11.0.tgz", + "integrity": "sha512-27BfE8zASRLYfSBNMk5/+KIjr2CBBrH0i5lhsO04fca4TGirIIMay73v3zNkzqmsaeIa/Mi5kejWDcxPLAmkvA==", + "dev": true + }, + "@types/minimatch": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz", + "integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==", + "dev": true + }, + "@types/parse-json": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.0.tgz", + "integrity": "sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==", + "dev": true + }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "array-differ": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/array-differ/-/array-differ-3.0.0.tgz", + "integrity": "sha512-THtfYS6KtME/yIAhKjZ2ul7XI96lQGHRputJQHO80LAWQnuGP4iCIN8vdMRboGbIEYBwU33q8Tch1os2+X0kMg==", + "dev": true + }, + "array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "dev": true + }, + "arrify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/arrify/-/arrify-2.0.1.tgz", + "integrity": "sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug==", + "dev": true + }, + "autoprefixer": { + "version": "9.7.6", + "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-9.7.6.tgz", + "integrity": "sha512-F7cYpbN7uVVhACZTeeIeealwdGM6wMtfWARVLTy5xmKtgVdBNJvbDRoCK3YO1orcs7gv/KwYlb3iXwu9Ug9BkQ==", + "dev": true, + "requires": { + "browserslist": "^4.11.1", + "caniuse-lite": "^1.0.30001039", + "chalk": "^2.4.2", + "normalize-range": "^0.1.2", + "num2fraction": "^1.2.2", + "postcss": "^7.0.27", + "postcss-value-parser": "^4.0.3" + } + }, + "balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", + "dev": true + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "browserslist": { + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.12.0.tgz", + "integrity": "sha512-UH2GkcEDSI0k/lRkuDSzFl9ZZ87skSy9w2XAn1MsZnL+4c4rqbBd3e82UWHbYDpztABrPBhZsTEeuxVfHppqDg==", + "dev": true, + "requires": { + "caniuse-lite": "^1.0.30001043", + "electron-to-chromium": "^1.3.413", + "node-releases": "^1.1.53", + "pkg-up": "^2.0.0" + } + }, + "callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true + }, + "caniuse-lite": { + "version": "1.0.30001055", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001055.tgz", + "integrity": "sha512-MbwsBmKrBSKIWldfdIagO5OJWZclpJtS4h0Jrk/4HFrXJxTdVdH23Fd+xCiHriVGvYcWyW8mR/CPsYajlH8Iuw==", + "dev": true + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "dependencies": { + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "ci-info": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz", + "integrity": "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==", + "dev": true + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "dev": true + }, + "commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==" + }, + "compare-versions": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/compare-versions/-/compare-versions-3.6.0.tgz", + "integrity": "sha512-W6Af2Iw1z4CB7q4uU4hv646dW9GQuBM+YpC0UvUCWSD8w90SJjp+ujJuXaEMtAXBtSqGfMPuFOVn4/+FlaqfBA==", + "dev": true + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true + }, + "cosmiconfig": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-6.0.0.tgz", + "integrity": "sha512-xb3ZL6+L8b9JLLCx3ZdoZy4+2ECphCMo2PwqgP1tlfVq6M6YReyzBJtvWWtbDSpNr9hn96pkCiZqUcFEc+54Qg==", + "dev": true, + "requires": { + "@types/parse-json": "^4.0.0", + "import-fresh": "^3.1.0", + "parse-json": "^5.0.0", + "path-type": "^4.0.0", + "yaml": "^1.7.2" + } + }, + "cross-spawn": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.2.tgz", + "integrity": "sha512-PD6G8QG3S4FK/XCGFbEQrDqO2AnMMsy0meR7lerlIOHAAbkuavGU/pOqprrlvfTNjvowivTeBsjebAL0NSoMxw==", + "dev": true, + "requires": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + } + }, + "electron-to-chromium": { + "version": "1.3.432", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.432.tgz", + "integrity": "sha512-/GdNhXyLP5Yl2322CUX/+Xi8NhdHBqL6lD9VJVKjH6CjoPGakvwZ5CpKgj/oOlbzuWWjOvMjDw1bBuAIRCNTlw==", + "dev": true + }, + "end-of-stream": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "dev": true, + "requires": { + "once": "^1.4.0" + } + }, + "error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "dev": true, + "requires": { + "is-arrayish": "^0.2.1" + } + }, + "escape-string-regexp": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", + "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==" + }, + "execa": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-2.1.0.tgz", + "integrity": "sha512-Y/URAVapfbYy2Xp/gb6A0E7iR8xeqOCXsuuaoMn7A5PzrXUK84E1gyiEfq0wQd/GHA6GsoHWwhNq8anb0mleIw==", + "dev": true, + "requires": { + "cross-spawn": "^7.0.0", + "get-stream": "^5.0.0", + "is-stream": "^2.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^3.0.0", + "onetime": "^5.1.0", + "p-finally": "^2.0.0", + "signal-exit": "^3.0.2", + "strip-final-newline": "^2.0.0" + } + }, + "extract-math": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/extract-math/-/extract-math-1.1.0.tgz", + "integrity": "sha512-YDbUcfio8SSXayqVz+MscpaJhTt1mUoFtLbrZKL7yVwjQZK9TVI9ebriSIBFH+Jy9YHctgS7OriMFxmr/dpWww==", + "requires": { + "escape-string-regexp": "^2.0.0" + } + }, + "find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "dev": true, + "requires": { + "locate-path": "^2.0.0" + } + }, + "find-versions": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/find-versions/-/find-versions-3.2.0.tgz", + "integrity": "sha512-P8WRou2S+oe222TOCHitLy8zj+SIsVJh52VP4lvXkaFVnOFFdoWv1H1Jjvel1aI6NCFOAaeAVm8qrI0odiLcww==", + "dev": true, + "requires": { + "semver-regex": "^2.0.0" + } + }, + "get-stream": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.1.0.tgz", + "integrity": "sha512-EXr1FOzrzTfGeL0gQdeFEvOMm2mzMOglyiOXSTpPC+iAjAKftbr3jpCMWynogwYnM+eSj9sHGc6wjIcDvYiygw==", + "dev": true, + "requires": { + "pump": "^3.0.0" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "husky": { + "version": "4.2.5", + "resolved": "https://registry.npmjs.org/husky/-/husky-4.2.5.tgz", + "integrity": "sha512-SYZ95AjKcX7goYVZtVZF2i6XiZcHknw50iXvY7b0MiGoj5RwdgRQNEHdb+gPDPCXKlzwrybjFjkL6FOj8uRhZQ==", + "dev": true, + "requires": { + "chalk": "^4.0.0", + "ci-info": "^2.0.0", + "compare-versions": "^3.6.0", + "cosmiconfig": "^6.0.0", + "find-versions": "^3.2.0", + "opencollective-postinstall": "^2.0.2", + "pkg-dir": "^4.2.0", + "please-upgrade-node": "^3.2.0", + "slash": "^3.0.0", + "which-pm-runs": "^1.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "requires": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.0.0.tgz", + "integrity": "sha512-N9oWFcegS0sFr9oh1oz2d7Npos6vNoWW9HvtCg5N1KRFpUhaAhvTv5Y58g880fZaEYSNm3qDz8SU1UrGvp+n7A==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "ignore": { + "version": "5.1.4", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.4.tgz", + "integrity": "sha512-MzbUSahkTW1u7JpKKjY7LCARd1fU5W2rLdxlM4kdkayuCwZImjkpluF9CM1aLewYJguPDqewLam18Y6AU69A8A==", + "dev": true + }, + "import-fresh": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.2.1.tgz", + "integrity": "sha512-6e1q1cnWP2RXD9/keSkxHScg508CdXqXWgWBaETNhyuBFz+kUZlKboh+ISK+bU++DmbHimVBrOz/zzPe0sZ3sQ==", + "dev": true, + "requires": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + } + }, + "is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", + "dev": true + }, + "is-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz", + "integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==", + "dev": true + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, + "js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true + }, + "json-parse-better-errors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", + "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", + "dev": true + }, + "katex": { + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/katex/-/katex-0.11.1.tgz", + "integrity": "sha512-5oANDICCTX0NqYIyAiFCCwjQ7ERu3DQG2JFHLbYOf+fXaMoH8eg/zOq5WSYJsKMi/QebW+Eh3gSM+oss1H/bww==", + "requires": { + "commander": "^2.19.0" + } + }, + "lines-and-columns": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.1.6.tgz", + "integrity": "sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA=", + "dev": true + }, + "locate-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", + "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", + "dev": true, + "requires": { + "p-locate": "^2.0.0", + "path-exists": "^3.0.0" + } + }, + "merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "dev": true + }, + "mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "mri": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/mri/-/mri-1.1.5.tgz", + "integrity": "sha512-d2RKzMD4JNyHMbnbWnznPaa8vbdlq/4pNZ3IgdaGrVbBhebBsGUUE/6qorTMYNS6TwuH3ilfOlD2bf4Igh8CKg==", + "dev": true + }, + "multimatch": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/multimatch/-/multimatch-4.0.0.tgz", + "integrity": "sha512-lDmx79y1z6i7RNx0ZGCPq1bzJ6ZoDDKbvh7jxr9SJcWLkShMzXrHbYVpTdnhNM5MXpDUxCQ4DgqVttVXlBgiBQ==", + "dev": true, + "requires": { + "@types/minimatch": "^3.0.3", + "array-differ": "^3.0.0", + "array-union": "^2.1.0", + "arrify": "^2.0.1", + "minimatch": "^3.0.4" + } + }, + "node-releases": { + "version": "1.1.55", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.55.tgz", + "integrity": "sha512-H3R3YR/8TjT5WPin/wOoHOUPHgvj8leuU/Keta/rwelEQN9pA/S2Dx8/se4pZ2LBxSd0nAGzsNzhqwa77v7F1w==", + "dev": true + }, + "normalize-range": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/normalize-range/-/normalize-range-0.1.2.tgz", + "integrity": "sha1-LRDAa9/TEuqXd2laTShDlFa3WUI=", + "dev": true + }, + "npm-run-path": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-3.1.0.tgz", + "integrity": "sha512-Dbl4A/VfiVGLgQv29URL9xshU8XDY1GeLy+fsaZ1AA8JDSfjvr5P5+pzRbWqRSBxk6/DW7MIh8lTM/PaGnP2kg==", + "dev": true, + "requires": { + "path-key": "^3.0.0" + } + }, + "num2fraction": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/num2fraction/-/num2fraction-1.2.2.tgz", + "integrity": "sha1-b2gragJ6Tp3fpFZM0lidHU5mnt4=", + "dev": true + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "requires": { + "wrappy": "1" + } + }, + "onetime": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.0.tgz", + "integrity": "sha512-5NcSkPHhwTVFIQN+TUqXoS5+dlElHXdpAWu9I0HP20YOtIi+aZ0Ct82jdlILDxjLEAWwvm+qj1m6aEtsDVmm6Q==", + "dev": true, + "requires": { + "mimic-fn": "^2.1.0" + } + }, + "opencollective-postinstall": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/opencollective-postinstall/-/opencollective-postinstall-2.0.2.tgz", + "integrity": "sha512-pVOEP16TrAO2/fjej1IdOyupJY8KDUM1CvsaScRbw6oddvpQoOfGk4ywha0HKKVAD6RkW4x6Q+tNBwhf3Bgpuw==", + "dev": true + }, + "p-finally": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-2.0.1.tgz", + "integrity": "sha512-vpm09aKwq6H9phqRQzecoDpD8TmVyGw70qmWlyq5onxY7tqyTTFVvxMykxQSQKILBSFlbXpypIw2T1Ml7+DDtw==", + "dev": true + }, + "p-limit": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", + "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", + "dev": true, + "requires": { + "p-try": "^1.0.0" + } + }, + "p-locate": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", + "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", + "dev": true, + "requires": { + "p-limit": "^1.1.0" + } + }, + "p-try": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", + "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=", + "dev": true + }, + "parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "requires": { + "callsites": "^3.0.0" + } + }, + "parse-json": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.0.0.tgz", + "integrity": "sha512-OOY5b7PAEFV0E2Fir1KOkxchnZNCdowAJgQ5NuxjpBKTRP3pQhwkrkxqQjeoKJ+fO7bCpmIZaogI4eZGDMEGOw==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.0.0", + "error-ex": "^1.3.1", + "json-parse-better-errors": "^1.0.1", + "lines-and-columns": "^1.1.6" + } + }, + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true + }, + "path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true + }, + "path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true + }, + "pkg-dir": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", + "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", + "dev": true, + "requires": { + "find-up": "^4.0.0" + }, + "dependencies": { + "find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "requires": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + } + }, + "locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "requires": { + "p-locate": "^4.1.0" + } + }, + "p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "requires": { + "p-limit": "^2.2.0" + } + }, + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true + }, + "path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true + } + } + }, + "pkg-up": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/pkg-up/-/pkg-up-2.0.0.tgz", + "integrity": "sha1-yBmscoBZpGHKscOImivjxJoATX8=", + "dev": true, + "requires": { + "find-up": "^2.1.0" + } + }, + "please-upgrade-node": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/please-upgrade-node/-/please-upgrade-node-3.2.0.tgz", + "integrity": "sha512-gQR3WpIgNIKwBMVLkpMUeR3e1/E1y42bqDQZfql+kDeXd8COYfM8PQA4X6y7a8u9Ua9FHmsrrmirW2vHs45hWg==", + "dev": true, + "requires": { + "semver-compare": "^1.0.0" + } + }, + "postcss": { + "version": "7.0.30", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-7.0.30.tgz", + "integrity": "sha512-nu/0m+NtIzoubO+xdAlwZl/u5S5vi/y6BCsoL8D+8IxsD3XvBS8X4YEADNIVXKVuQvduiucnRv+vPIqj56EGMQ==", + "dev": true, + "requires": { + "chalk": "^2.4.2", + "source-map": "^0.6.1", + "supports-color": "^6.1.0" + } + }, + "postcss-value-parser": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.1.0.tgz", + "integrity": "sha512-97DXOFbQJhk71ne5/Mt6cOu6yxsSfM0QGQyl0L25Gca4yGWEGJaig7l7gbCX623VqTBNGLRLaVUCnNkcedlRSQ==", + "dev": true + }, + "prettier": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.0.5.tgz", + "integrity": "sha512-7PtVymN48hGcO4fGjybyBSIWDsLU4H4XlvOHfq91pz9kkGlonzwTfYkaIEwiRg/dAJF9YlbsduBAgtYLi+8cFg==", + "dev": true + }, + "pretty-quick": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pretty-quick/-/pretty-quick-2.0.1.tgz", + "integrity": "sha512-y7bJt77XadjUr+P1uKqZxFWLddvj3SKY6EU4BuQtMxmmEFSMpbN132pUWdSG1g1mtUfO0noBvn7wBf0BVeomHg==", + "dev": true, + "requires": { + "chalk": "^2.4.2", + "execa": "^2.1.0", + "find-up": "^4.1.0", + "ignore": "^5.1.4", + "mri": "^1.1.4", + "multimatch": "^4.0.0" + }, + "dependencies": { + "find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "requires": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + } + }, + "locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "requires": { + "p-locate": "^4.1.0" + } + }, + "p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "requires": { + "p-limit": "^2.2.0" + } + }, + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true + }, + "path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true + } + } + }, + "pump": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "dev": true, + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "regenerator-runtime": { + "version": "0.13.5", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.5.tgz", + "integrity": "sha512-ZS5w8CpKFinUzOwW3c83oPeVXoNsrLsaCoLtJvAClH135j/R77RuymhiSErhm2lKcwSCIpmvIWSbDkIfAqKQlA==", + "dev": true + }, + "resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true + }, + "semver-compare": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/semver-compare/-/semver-compare-1.0.0.tgz", + "integrity": "sha1-De4hahyUGrN+nvsXiPavxf9VN/w=", + "dev": true + }, + "semver-regex": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/semver-regex/-/semver-regex-2.0.0.tgz", + "integrity": "sha512-mUdIBBvdn0PLOeP3TEkMH7HHeUP3GjsXCwKarjv/kGmUFOYg1VqEemKhoQpWMu6X2I8kHeuVdGibLGkVK+/5Qw==", + "dev": true + }, + "shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true + }, + "signal-exit": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", + "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==", + "dev": true + }, + "slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + }, + "strip-final-newline": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", + "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", + "dev": true + }, + "supports-color": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.1.0.tgz", + "integrity": "sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + }, + "typescript": { + "version": "3.8.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.8.3.tgz", + "integrity": "sha512-MYlEfn5VrLNsgudQTVJeNaQFUAI7DkhnOjdpAp4T+ku1TfQClewlbSuTVHiA+8skNBgaf02TL/kLOvig4y3G8w==", + "dev": true + }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + }, + "which-pm-runs": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/which-pm-runs/-/which-pm-runs-1.0.0.tgz", + "integrity": "sha1-Zws6+8VS4LVd9rd4DKdGFfI60cs=", + "dev": true + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + }, + "yaml": { + "version": "1.9.2", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.9.2.tgz", + "integrity": "sha512-HPT7cGGI0DuRcsO51qC1j9O16Dh1mZ2bnXwsi0jrSpsLz0WxOLSLXfkABVl6bZO629py3CU+OMJtpNHDLB97kg==", + "dev": true, + "requires": { + "@babel/runtime": "^7.9.2" + } + } + } +} diff --git a/webcomponents/math/package.json b/webcomponents/math/package.json new file mode 100644 index 000000000..8fd4f19ec --- /dev/null +++ b/webcomponents/math/package.json @@ -0,0 +1,67 @@ +{ + "name": "@deckdeckgo/math", + "version": "1.0.1", + "description": "A Web Component to write and render math expressions", + "main": "dist/index.js", + "module": "dist/index.mjs", + "es2015": "dist/esm/index.mjs", + "es2017": "dist/esm/index.mjs", + "types": "dist/types/index.d.ts", + "collection": "dist/collection/collection-manifest.json", + "collection:main": "dist/collection/index.js", + "unpkg": "dist/deckdeckgo-math/deckdeckgo-math.js", + "files": [ + "dist/", + "README.md", + "LICENSE" + ], + "scripts": { + "build": "stencil build", + "start": "stencil build --dev --watch --serve", + "test": "stencil test --spec --e2e", + "test.watch": "stencil test --spec --e2e --watchAll" + }, + "dependencies": { + "extract-math": "^1.1.0", + "katex": "^0.11.1" + }, + "devDependencies": { + "@stencil/core": "^1.13.0", + "@stencil/postcss": "^1.0.1", + "@stencil/sass": "^1.3.1", + "@types/katex": "^0.11.0", + "autoprefixer": "^9.7.6", + "husky": "^4.2.5", + "prettier": "2.0.5", + "pretty-quick": "^2.0.1" + }, + "license": "MIT", + "repository": { + "type": "git", + "url": "git+https://github.com/deckgo/deckdeckgo.git" + }, + "author": "Akash Borad", + "bugs": { + "url": "https://github.com/deckgo/deckdeckgo" + }, + "homepage": "https://deckdeckgo.com", + "keywords": [ + "stencil", + "stenciljs", + "web components", + "pwa", + "progressive web app", + "presentation", + "slides", + "slideshow", + "talk", + "katex", + "math expressions", + "TeX math" + ], + "husky": { + "hooks": { + "pre-commit": "pretty-quick --staged" + } + } +} diff --git a/webcomponents/math/src/components.d.ts b/webcomponents/math/src/components.d.ts new file mode 100644 index 000000000..188d5c453 --- /dev/null +++ b/webcomponents/math/src/components.d.ts @@ -0,0 +1,42 @@ +/* eslint-disable */ +/* tslint:disable */ +/** + * This is an autogenerated file created by the Stencil compiler. + * It contains typing information for all components that exist in this project. + */ +import { HTMLStencilElement, JSXBase } from "@stencil/core/internal"; +export namespace Components { + interface DeckgoMath { + "editable": boolean; + "macros": string; + } +} +declare global { + interface HTMLDeckgoMathElement extends Components.DeckgoMath, HTMLStencilElement { + } + var HTMLDeckgoMathElement: { + prototype: HTMLDeckgoMathElement; + new (): HTMLDeckgoMathElement; + }; + interface HTMLElementTagNameMap { + "deckgo-math": HTMLDeckgoMathElement; + } +} +declare namespace LocalJSX { + interface DeckgoMath { + "editable"?: boolean; + "macros"?: string; + "onMathDidChange"?: (event: CustomEvent) => void; + } + interface IntrinsicElements { + "deckgo-math": DeckgoMath; + } +} +export { LocalJSX as JSX }; +declare module "@stencil/core" { + export namespace JSX { + interface IntrinsicElements { + "deckgo-math": LocalJSX.DeckgoMath & JSXBase.HTMLAttributes; + } + } +} diff --git a/webcomponents/math/src/components/math/deckdeckgo-math.scss b/webcomponents/math/src/components/math/deckdeckgo-math.scss new file mode 100644 index 000000000..ea5a82ace --- /dev/null +++ b/webcomponents/math/src/components/math/deckdeckgo-math.scss @@ -0,0 +1,52 @@ +@import "~katex/dist/katex.min.css"; + +:host { + ::slotted([slot="math"]) { + display: none; + } +} + +:host([editable]) { + div.math:empty:not(:focus):after { + content: var(--deckgo-math-empty-text, "Click to add your math expression"); + } +} + +:host(.deckgo-math-edit) { + ::slotted([slot="math"]) { + display: block; + white-space: pre-wrap; + } + + div.math { + display: none; + } +} + +div.deckgo-math-container { + color: var(--deckgo-math-color, inherit); + background: var(--deckgo-math-background); + padding: var(--deckgo-math-padding, 8px); + border-radius: var(--deckgo-math-border-radius); + + margin: var(--deckgo-math-margin, 0px); + + direction: var(--deckgo-math-direction); + text-align: var(--deckgo-math-text-align); + + display: var(--deckgo-math-container-display, block); + justify-content: var(--deckgo-math-container-justify-content); + flex-direction: var(--deckgo-math-container-flex-direction); + align-items: var(--deckgo-math-container-align-items); + + div.math { + overflow-y: var(--deckgo-math-scroll, scroll); + + white-space: pre-wrap; + + font-size: var(--deckgo-math-font-size); + min-height: var(--deckgo-math-min-height, 23px); + + display: var(--deckgo-math-display, block); + } +} diff --git a/webcomponents/math/src/components/math/deckdeckgo-math.tsx b/webcomponents/math/src/components/math/deckdeckgo-math.tsx new file mode 100644 index 000000000..85e84421c --- /dev/null +++ b/webcomponents/math/src/components/math/deckdeckgo-math.tsx @@ -0,0 +1,192 @@ +import {Component, Prop, Watch, Element, h, State, Host, Event, EventEmitter} from '@stencil/core'; + +import katex from 'katex'; +import {extractMath, Segment} from 'extract-math'; + +@Component({ + tag: 'deckgo-math', + styleUrl: 'deckdeckgo-math.scss', + shadow: true, +}) +export class DeckdeckgoMath { + @Element() el: HTMLElement; + + @Prop() editable: boolean = false; + + @Prop({reflectToAttr: true}) macros: string = `{"\\\\f":"f(#1)"}`; + + @State() + private editing: boolean = false; + + @Event() + private mathDidChange: EventEmitter; + + private parseAfterUpdate: boolean = false; + + private containerRef!: HTMLDivElement; + + async componentDidLoad() { + await this.parseSlottedMath(); + } + + async componentDidUpdate() { + if (this.parseAfterUpdate) { + await this.parseSlottedMath(); + this.parseAfterUpdate = false; + } + } + + @Watch('macros') + async macrosChanged() { + this.parseAfterUpdate = true; + + await this.parseSlottedMath(); + } + + private parseSlottedMath(): Promise { + const mathContent: HTMLElement = this.el.querySelector("[slot='math']"); + + if (mathContent) { + return this.parseMath(mathContent.innerText); + } else { + return Promise.resolve(); + } + } + + private parseMath(mathContentHTML: string): Promise { + return new Promise(async (resolve, reject) => { + if (!this.containerRef) { + resolve(); + return; + } + + if (!mathContentHTML || mathContentHTML === undefined || mathContentHTML === '') { + this.containerRef.children[0].innerHTML = ''; + + resolve(); + return; + } + + try { + this.containerRef.children[0].innerHTML = ''; + + const div: HTMLElement = document.createElement('div'); + + try { + div.innerHTML = await this.extractAndRenderMath(mathContentHTML); + + if (div.childNodes) { + this.containerRef.children[0].append(...Array.from(div.childNodes)); + } + } catch (err) { + this.containerRef.children[0].innerHTML = mathContentHTML; + console.error(err); + } + + resolve(); + } catch (err) { + reject(err); + } + }); + } + + private async extractAndRenderMath(mathContentHTML: string): Promise { + const segments: Segment[] = extractMath(mathContentHTML); + + if (!segments || (segments.length === 1 && !segments[0].math)) { + return this.extract(segments[0].raw, segments[0].type); + } + + let renderedHTML = ''; + + segments.forEach((segment) => { + if (segment.math) { + renderedHTML += this.extract(segment.raw, segment.type); + } else { + renderedHTML += segment.value; + } + }); + + return renderedHTML; + } + + private extract(raw: string, type: 'text' | 'display' | 'inline') { + return katex.renderToString(raw, { + displayMode: type === 'display', + leqno: false, + fleqn: false, + macros: this.macros ? JSON.parse(this.macros) : null, + strict: 'warn', + trust: false, + throwOnError: true, + }); + } + + private applyMath = async () => { + await this.stopEditing(); + + await this.parseSlottedMath(); + }; + + private edit(): Promise { + return new Promise((resolve) => { + if (!this.editable) { + resolve(); + return; + } + + this.editing = true; + + const slottedMath: HTMLElement = this.el.querySelector("[slot='math']"); + + if (slottedMath) { + setTimeout(() => { + slottedMath.setAttribute('contentEditable', 'true'); + slottedMath.addEventListener('blur', this.applyMath, {once: true}); + + slottedMath.focus(); + }, 100); + } + + resolve(); + }); + } + + private stopEditing(): Promise { + return new Promise((resolve) => { + this.editing = false; + + const slottedMath: HTMLElement = this.el.querySelector("[slot='math']"); + + if (slottedMath) { + slottedMath.removeAttribute('contentEditable'); + + if (slottedMath.innerHTML) { + slottedMath.innerHTML = slottedMath.innerHTML.trim(); + } + + this.mathDidChange.emit(this.el); + } + + resolve(); + }); + } + + render() { + return ( + +
(this.containerRef = el as HTMLInputElement)} + onMouseDown={() => this.edit()} + onTouchStart={() => this.edit()}> +
+ +
+
+ ); + } +} diff --git a/webcomponents/math/src/index.html b/webcomponents/math/src/index.html new file mode 100644 index 000000000..1b9907a46 --- /dev/null +++ b/webcomponents/math/src/index.html @@ -0,0 +1,74 @@ + + + + + + DeckDeckGo - Math + + + + + + +

Editable:

+ + + + + You can write math expression inside paragraph like this: $x + 1$ +
+ Inline formulas can be written with \$ e.g: $c = \pm\sqrt{a^2 + b^2}$ +
+ and displayed equations can be written using \$$ e.g: $$\sum_{i=1}^n 2^i$$ +
+
+ +

Editable empty:

+ + + + + +

Just an expression (not editable):

+ + + + % \f is defined as f(#1) using the macro + \f{x} = \int_{-\infty}^\infty + \hat \f\xi\,e^{2 \pi i \xi x} + \,d\xi + + +

Not an expression (not editable):

+ + Yolo I'm formatted but that's not a problem + + Above text is formatted as an expression as it does not contain any math expression. We accept this in order to support both inline and paragraph + mode. + +

A single line paragraph (not editable):

+ + You can write math expression inside paragraph like this: $x + 1$ + +

More examples (not editable):

+ + Source: https://tiddlywiki.com/plugins/tiddlywiki/katex/ + + f(x) = \int_{-\infty}^\infty\hat f(\xi)\,e^{2 \pi i \xi x}\,d\xi + + + \frac{1}{\Bigl(\sqrt{\phi \sqrt{5}}-\phi\Bigr) e^{\frac25 \pi}} = 1+\frac{e^{-2\pi}} {1+\frac{e^{-4\pi}} {1+\frac{e^{-6\pi}} {1+\frac{e^{-8\pi}} + {1+\cdots} } } } + + + + 1 + \frac{q^2}{(1-q)}+\frac{q^6}{(1-q)(1-q^2)}+\cdots = \prod_{j=0}^{\infty}\frac{1}{(1-q^{5j+2})(1-q^{5j+3})}, \quad\quad \text{for }\lvert q\rvert<1. + + + diff --git a/webcomponents/math/src/index.ts b/webcomponents/math/src/index.ts new file mode 100644 index 000000000..07635cbbc --- /dev/null +++ b/webcomponents/math/src/index.ts @@ -0,0 +1 @@ +export * from './components'; diff --git a/webcomponents/math/stencil.config.ts b/webcomponents/math/stencil.config.ts new file mode 100644 index 000000000..fb3806f2b --- /dev/null +++ b/webcomponents/math/stencil.config.ts @@ -0,0 +1,24 @@ +import {Config} from '@stencil/core'; + +import {sass} from '@stencil/sass'; +import {postcss} from '@stencil/postcss'; +import autoprefixer from 'autoprefixer'; + +export const config: Config = { + namespace: 'deckdeckgo-math', + outputTargets: [ + { + type: 'dist', + }, + { + type: 'www', + serviceWorker: null, + }, + ], + plugins: [ + sass(), + postcss({ + plugins: [autoprefixer()], + }), + ], +}; diff --git a/webcomponents/math/tsconfig.json b/webcomponents/math/tsconfig.json new file mode 100644 index 000000000..1ba949095 --- /dev/null +++ b/webcomponents/math/tsconfig.json @@ -0,0 +1,18 @@ +{ + "compilerOptions": { + "allowSyntheticDefaultImports": true, + "allowUnreachableCode": false, + "declaration": false, + "experimentalDecorators": true, + "lib": ["dom", "es2017"], + "moduleResolution": "node", + "module": "esnext", + "target": "es2017", + "noUnusedLocals": true, + "noUnusedParameters": true, + "jsx": "react", + "jsxFactory": "h" + }, + "include": ["src", "types/jsx.d.ts"], + "exclude": ["node_modules"] +}