add initial marp implementation with sample content and build configuration
This commit is contained in:
9
node_modules/mathjax-full/js/ui/safe/SafeHandler.d.ts
generated
vendored
Normal file
9
node_modules/mathjax-full/js/ui/safe/SafeHandler.d.ts
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
import { MathDocument, MathDocumentConstructor } from '../../core/MathDocument.js';
|
||||
import { Handler } from '../../core/Handler.js';
|
||||
import { Safe } from './safe.js';
|
||||
export declare type Constructor<T> = new (...args: any[]) => T;
|
||||
export interface SafeMathDocument<N, T, D> extends MathDocument<N, T, D> {
|
||||
safe: Safe<N, T, D>;
|
||||
}
|
||||
export declare function SafeMathDocumentMixin<N, T, D, B extends MathDocumentConstructor<MathDocument<N, T, D>>>(BaseDocument: B): Constructor<SafeMathDocument<N, T, D>> & B;
|
||||
export declare function SafeHandler<N, T, D>(handler: Handler<N, T, D>): Handler<N, T, D>;
|
||||
119
node_modules/mathjax-full/js/ui/safe/SafeHandler.js
generated
vendored
Normal file
119
node_modules/mathjax-full/js/ui/safe/SafeHandler.js
generated
vendored
Normal file
@@ -0,0 +1,119 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = function (d, b) {
|
||||
extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
||||
return extendStatics(d, b);
|
||||
};
|
||||
return function (d, b) {
|
||||
if (typeof b !== "function" && b !== null)
|
||||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
var __assign = (this && this.__assign) || function () {
|
||||
__assign = Object.assign || function(t) {
|
||||
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
||||
s = arguments[i];
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
||||
t[p] = s[p];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
return __assign.apply(this, arguments);
|
||||
};
|
||||
var __read = (this && this.__read) || function (o, n) {
|
||||
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
||||
if (!m) return o;
|
||||
var i = m.call(o), r, ar = [], e;
|
||||
try {
|
||||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
||||
}
|
||||
catch (error) { e = { error: error }; }
|
||||
finally {
|
||||
try {
|
||||
if (r && !r.done && (m = i["return"])) m.call(i);
|
||||
}
|
||||
finally { if (e) throw e.error; }
|
||||
}
|
||||
return ar;
|
||||
};
|
||||
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
||||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
||||
if (ar || !(i in from)) {
|
||||
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
||||
ar[i] = from[i];
|
||||
}
|
||||
}
|
||||
return to.concat(ar || Array.prototype.slice.call(from));
|
||||
};
|
||||
var __values = (this && this.__values) || function(o) {
|
||||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
||||
if (m) return m.call(o);
|
||||
if (o && typeof o.length === "number") return {
|
||||
next: function () {
|
||||
if (o && i >= o.length) o = void 0;
|
||||
return { value: o && o[i++], done: !o };
|
||||
}
|
||||
};
|
||||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.SafeHandler = exports.SafeMathDocumentMixin = void 0;
|
||||
var safe_js_1 = require("./safe.js");
|
||||
function SafeMathDocumentMixin(BaseDocument) {
|
||||
var _a;
|
||||
return _a = (function (_super) {
|
||||
__extends(class_1, _super);
|
||||
function class_1() {
|
||||
var e_1, _a;
|
||||
var args = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
args[_i] = arguments[_i];
|
||||
}
|
||||
var _this = _super.apply(this, __spreadArray([], __read(args), false)) || this;
|
||||
_this.safe = new _this.options.SafeClass(_this, _this.options.safeOptions);
|
||||
var ProcessBits = _this.constructor.ProcessBits;
|
||||
if (!ProcessBits.has('safe')) {
|
||||
ProcessBits.allocate('safe');
|
||||
}
|
||||
try {
|
||||
for (var _b = __values(_this.inputJax), _c = _b.next(); !_c.done; _c = _b.next()) {
|
||||
var jax = _c.value;
|
||||
if (jax.name.match(/MathML/)) {
|
||||
jax.mathml.filterAttribute = _this.safe.mmlAttribute.bind(_this.safe);
|
||||
jax.mathml.filterClassList = _this.safe.mmlClassList.bind(_this.safe);
|
||||
}
|
||||
else if (jax.name.match(/TeX/)) {
|
||||
jax.postFilters.add(_this.sanitize.bind(jax), -5.5);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
||||
finally {
|
||||
try {
|
||||
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
||||
}
|
||||
finally { if (e_1) throw e_1.error; }
|
||||
}
|
||||
return _this;
|
||||
}
|
||||
class_1.prototype.sanitize = function (data) {
|
||||
data.math.root = this.parseOptions.root;
|
||||
data.document.safe.sanitize(data.math, data.document);
|
||||
};
|
||||
return class_1;
|
||||
}(BaseDocument)),
|
||||
_a.OPTIONS = __assign(__assign({}, BaseDocument.OPTIONS), { safeOptions: __assign({}, safe_js_1.Safe.OPTIONS), SafeClass: safe_js_1.Safe }),
|
||||
_a;
|
||||
}
|
||||
exports.SafeMathDocumentMixin = SafeMathDocumentMixin;
|
||||
function SafeHandler(handler) {
|
||||
handler.documentClass = SafeMathDocumentMixin(handler.documentClass);
|
||||
return handler;
|
||||
}
|
||||
exports.SafeHandler = SafeHandler;
|
||||
//# sourceMappingURL=SafeHandler.js.map
|
||||
1
node_modules/mathjax-full/js/ui/safe/SafeHandler.js.map
generated
vendored
Normal file
1
node_modules/mathjax-full/js/ui/safe/Saf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,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;yBACpD;qBACF;;;;;;;;;;YACH,CAAC;YAMS,0BAAQ,GAAlB,UAAmB,IAAoE;gBACrF,IAAI,CAAC,IAAI,CAAC,IAAI,GAAI,IAAY,CAAC,YAAY,CAAC,IAAI,CAAC;gBACjD,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;YACxD,CAAC;YACH,cAAC;QAAD,CAAC,AAjDM,CAAc,YAAY;QAKjB,UAAO,yBAChB,YAAY,CAAC,OAAO,KACvB,WAAW,eACN,cAAI,CAAC,OAAO,GAEjB,SAAS,EAAE,cAAI,GACf;WAsCF;AAEJ,CAAC;AAvDD,sDAuDC;AAWD,SAAgB,WAAW,CAAU,OAAyB;IAC5D,OAAO,CAAC,aAAa,GAAG,qBAAqB,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;IACrE,OAAO,OAAO,CAAC;AACjB,CAAC;AAHD,kCAGC"}
|
||||
4
node_modules/mathjax-full/js/ui/safe/SafeMethods.d.ts
generated
vendored
Normal file
4
node_modules/mathjax-full/js/ui/safe/SafeMethods.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
import { FilterFunction } from './safe.js';
|
||||
export declare const SafeMethods: {
|
||||
[name: string]: FilterFunction<any, any, any>;
|
||||
};
|
||||
158
node_modules/mathjax-full/js/ui/safe/SafeMethods.js
generated
vendored
Normal file
158
node_modules/mathjax-full/js/ui/safe/SafeMethods.js
generated
vendored
Normal file
@@ -0,0 +1,158 @@
|
||||
"use strict";
|
||||
var __values = (this && this.__values) || function(o) {
|
||||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
||||
if (m) return m.call(o);
|
||||
if (o && typeof o.length === "number") return {
|
||||
next: function () {
|
||||
if (o && i >= o.length) o = void 0;
|
||||
return { value: o && o[i++], done: !o };
|
||||
}
|
||||
};
|
||||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
||||
};
|
||||
var __read = (this && this.__read) || function (o, n) {
|
||||
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
||||
if (!m) return o;
|
||||
var i = m.call(o), r, ar = [], e;
|
||||
try {
|
||||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
||||
}
|
||||
catch (error) { e = { error: error }; }
|
||||
finally {
|
||||
try {
|
||||
if (r && !r.done && (m = i["return"])) m.call(i);
|
||||
}
|
||||
finally { if (e) throw e.error; }
|
||||
}
|
||||
return ar;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.SafeMethods = void 0;
|
||||
var lengths_js_1 = require("../../util/lengths.js");
|
||||
exports.SafeMethods = {
|
||||
filterURL: function (safe, url) {
|
||||
var protocol = (url.match(/^\s*([a-z]+):/i) || [null, ''])[1].toLowerCase();
|
||||
var allow = safe.allow.URLs;
|
||||
return (allow === 'all' || (allow === 'safe' &&
|
||||
(safe.options.safeProtocols[protocol] || !protocol))) ? url : null;
|
||||
},
|
||||
filterClassList: function (safe, list) {
|
||||
var _this = this;
|
||||
var classes = list.trim().replace(/\s\s+/g, ' ').split(/ /);
|
||||
return classes.map(function (name) { return _this.filterClass(safe, name) || ''; }).join(' ').trim().replace(/\s\s+/g, '');
|
||||
},
|
||||
filterClass: function (safe, CLASS) {
|
||||
var allow = safe.allow.classes;
|
||||
return (allow === 'all' || (allow === 'safe' && CLASS.match(safe.options.classPattern))) ? CLASS : null;
|
||||
},
|
||||
filterID: function (safe, id) {
|
||||
var allow = safe.allow.cssIDs;
|
||||
return (allow === 'all' || (allow === 'safe' && id.match(safe.options.idPattern))) ? id : null;
|
||||
},
|
||||
filterStyles: function (safe, styles) {
|
||||
var e_1, _a, e_2, _b;
|
||||
if (safe.allow.styles === 'all')
|
||||
return styles;
|
||||
if (safe.allow.styles !== 'safe')
|
||||
return null;
|
||||
var adaptor = safe.adaptor;
|
||||
var options = safe.options;
|
||||
try {
|
||||
var div1 = adaptor.node('div', { style: styles });
|
||||
var div2 = adaptor.node('div');
|
||||
try {
|
||||
for (var _c = __values(Object.keys(options.safeStyles)), _d = _c.next(); !_d.done; _d = _c.next()) {
|
||||
var style = _d.value;
|
||||
if (options.styleParts[style]) {
|
||||
try {
|
||||
for (var _e = (e_2 = void 0, __values(['Top', 'Right', 'Bottom', 'Left'])), _f = _e.next(); !_f.done; _f = _e.next()) {
|
||||
var sufix = _f.value;
|
||||
var name_1 = style + sufix;
|
||||
var value = this.filterStyle(safe, name_1, div1);
|
||||
if (value) {
|
||||
adaptor.setStyle(div2, name_1, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
||||
finally {
|
||||
try {
|
||||
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
|
||||
}
|
||||
finally { if (e_2) throw e_2.error; }
|
||||
}
|
||||
}
|
||||
else {
|
||||
var value = this.filterStyle(safe, style, div1);
|
||||
if (value) {
|
||||
adaptor.setStyle(div2, style, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
||||
finally {
|
||||
try {
|
||||
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
||||
}
|
||||
finally { if (e_1) throw e_1.error; }
|
||||
}
|
||||
styles = adaptor.allStyles(div2);
|
||||
}
|
||||
catch (err) {
|
||||
styles = '';
|
||||
}
|
||||
return styles;
|
||||
},
|
||||
filterStyle: function (safe, style, div) {
|
||||
var value = safe.adaptor.getStyle(div, style);
|
||||
if (typeof value !== 'string' || value === '' || value.match(/^\s*calc/) ||
|
||||
(value.match(/javascript:/) && !safe.options.safeProtocols.javascript) ||
|
||||
(value.match(/data:/) && !safe.options.safeProtocols.data)) {
|
||||
return null;
|
||||
}
|
||||
var name = style.replace(/Top|Right|Left|Bottom/, '');
|
||||
if (!safe.options.safeStyles[style] && !safe.options.safeStyles[name]) {
|
||||
return null;
|
||||
}
|
||||
return this.filterStyleValue(safe, style, value, div);
|
||||
},
|
||||
filterStyleValue: function (safe, style, value, div) {
|
||||
var name = safe.options.styleLengths[style];
|
||||
if (!name) {
|
||||
return value;
|
||||
}
|
||||
if (typeof name !== 'string') {
|
||||
return this.filterStyleLength(safe, style, value);
|
||||
}
|
||||
var length = this.filterStyleLength(safe, name, safe.adaptor.getStyle(div, name));
|
||||
if (!length) {
|
||||
return null;
|
||||
}
|
||||
safe.adaptor.setStyle(div, name, length);
|
||||
return safe.adaptor.getStyle(div, style);
|
||||
},
|
||||
filterStyleLength: function (safe, style, value) {
|
||||
if (!value.match(/^(.+)(em|ex|ch|rem|px|mm|cm|in|pt|pc|%)$/))
|
||||
return null;
|
||||
var em = (0, lengths_js_1.length2em)(value, 1);
|
||||
var lengths = safe.options.styleLengths[style];
|
||||
var _a = __read((Array.isArray(lengths) ? lengths : [-safe.options.lengthMax, safe.options.lengthMax]), 2), m = _a[0], M = _a[1];
|
||||
return (m <= em && em <= M ? value : (em < m ? m : M).toFixed(3).replace(/\.?0+$/, '') + 'em');
|
||||
},
|
||||
filterFontSize: function (safe, size) {
|
||||
return this.filterStyleLength(safe, 'fontSize', size);
|
||||
},
|
||||
filterSizeMultiplier: function (safe, size) {
|
||||
var _a = __read(safe.options.scriptsizemultiplierRange || [-Infinity, Infinity], 2), m = _a[0], M = _a[1];
|
||||
return Math.min(M, Math.max(m, parseFloat(size))).toString();
|
||||
},
|
||||
filterScriptLevel: function (safe, level) {
|
||||
var _a = __read(safe.options.scriptlevelRange || [-Infinity, Infinity], 2), m = _a[0], M = _a[1];
|
||||
return Math.min(M, Math.max(m, parseInt(level))).toString();
|
||||
},
|
||||
filterData: function (safe, value, id) {
|
||||
return (id.match(safe.options.dataPattern) ? value : null);
|
||||
}
|
||||
};
|
||||
//# sourceMappingURL=SafeMethods.js.map
|
||||
1
node_modules/mathjax-full/js/ui/safe/SafeMethods.js.map
generated
vendored
Normal file
1
node_modules/mathjax-full/js/ui/safe/SafeMethods.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
22
node_modules/mathjax-full/js/ui/safe/safe.d.ts
generated
vendored
Normal file
22
node_modules/mathjax-full/js/ui/safe/safe.d.ts
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
import { Property } from '../../core/Tree/Node.js';
|
||||
import { MmlNode } from '../../core/MmlTree/MmlNode.js';
|
||||
import { MathItem } from '../../core/MathItem.js';
|
||||
import { MathDocument } from '../../core/MathDocument.js';
|
||||
import { OptionList } from '../../util/Options.js';
|
||||
import { DOMAdaptor } from '../../core/DOMAdaptor.js';
|
||||
export declare type FilterFunction<N, T, D> = (safe: Safe<N, T, D>, value: Property, ...args: any[]) => Property;
|
||||
export declare class Safe<N, T, D> {
|
||||
static OPTIONS: OptionList;
|
||||
filterAttributes: Map<string, string>;
|
||||
options: OptionList;
|
||||
allow: OptionList;
|
||||
adaptor: DOMAdaptor<N, T, D>;
|
||||
filterMethods: {
|
||||
[name: string]: FilterFunction<N, T, D>;
|
||||
};
|
||||
constructor(document: MathDocument<N, T, D>, options: OptionList);
|
||||
sanitize(math: MathItem<N, T, D>, document: MathDocument<N, T, D>): void;
|
||||
protected sanitizeNode(node: MmlNode): void;
|
||||
mmlAttribute(id: string, value: string): string | null;
|
||||
mmlClassList(list: string[]): string[];
|
||||
}
|
||||
165
node_modules/mathjax-full/js/ui/safe/safe.js
generated
vendored
Normal file
165
node_modules/mathjax-full/js/ui/safe/safe.js
generated
vendored
Normal file
@@ -0,0 +1,165 @@
|
||||
"use strict";
|
||||
var __assign = (this && this.__assign) || function () {
|
||||
__assign = Object.assign || function(t) {
|
||||
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
||||
s = arguments[i];
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
||||
t[p] = s[p];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
return __assign.apply(this, arguments);
|
||||
};
|
||||
var __values = (this && this.__values) || function(o) {
|
||||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
||||
if (m) return m.call(o);
|
||||
if (o && typeof o.length === "number") return {
|
||||
next: function () {
|
||||
if (o && i >= o.length) o = void 0;
|
||||
return { value: o && o[i++], done: !o };
|
||||
}
|
||||
};
|
||||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Safe = void 0;
|
||||
var Options_js_1 = require("../../util/Options.js");
|
||||
var SafeMethods_js_1 = require("./SafeMethods.js");
|
||||
var Safe = (function () {
|
||||
function Safe(document, options) {
|
||||
this.filterAttributes = new Map([
|
||||
['href', 'filterURL'],
|
||||
['src', 'filterURL'],
|
||||
['altimg', 'filterURL'],
|
||||
['class', 'filterClassList'],
|
||||
['style', 'filterStyles'],
|
||||
['id', 'filterID'],
|
||||
['fontsize', 'filterFontSize'],
|
||||
['mathsize', 'filterFontSize'],
|
||||
['scriptminsize', 'filterFontSize'],
|
||||
['scriptsizemultiplier', 'filterSizeMultiplier'],
|
||||
['scriptlevel', 'filterScriptLevel'],
|
||||
['data-', 'filterData']
|
||||
]);
|
||||
this.filterMethods = __assign({}, SafeMethods_js_1.SafeMethods);
|
||||
this.adaptor = document.adaptor;
|
||||
this.options = options;
|
||||
this.allow = this.options.allow;
|
||||
}
|
||||
Safe.prototype.sanitize = function (math, document) {
|
||||
try {
|
||||
math.root.walkTree(this.sanitizeNode.bind(this));
|
||||
}
|
||||
catch (err) {
|
||||
document.options.compileError(document, math, err);
|
||||
}
|
||||
};
|
||||
Safe.prototype.sanitizeNode = function (node) {
|
||||
var e_1, _a;
|
||||
var attributes = node.attributes.getAllAttributes();
|
||||
try {
|
||||
for (var _b = __values(Object.keys(attributes)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
||||
var id = _c.value;
|
||||
var method = this.filterAttributes.get(id);
|
||||
if (method) {
|
||||
var value = this.filterMethods[method](this, attributes[id]);
|
||||
if (value) {
|
||||
if (value !== (typeof value === 'number' ? parseFloat(attributes[id]) : attributes[id])) {
|
||||
attributes[id] = value;
|
||||
}
|
||||
}
|
||||
else {
|
||||
delete attributes[id];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
||||
finally {
|
||||
try {
|
||||
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
||||
}
|
||||
finally { if (e_1) throw e_1.error; }
|
||||
}
|
||||
};
|
||||
Safe.prototype.mmlAttribute = function (id, value) {
|
||||
if (id === 'class')
|
||||
return null;
|
||||
var method = this.filterAttributes.get(id);
|
||||
var filter = (method || (id.substr(0, 5) === 'data-' ? this.filterAttributes.get('data-') : null));
|
||||
if (!filter) {
|
||||
return value;
|
||||
}
|
||||
var result = this.filterMethods[filter](this, value, id);
|
||||
return (typeof result === 'number' || typeof result === 'boolean' ? String(result) : result);
|
||||
};
|
||||
Safe.prototype.mmlClassList = function (list) {
|
||||
var _this = this;
|
||||
return list.map(function (name) { return _this.filterMethods.filterClass(_this, name); })
|
||||
.filter(function (value) { return value !== null; });
|
||||
};
|
||||
Safe.OPTIONS = {
|
||||
allow: {
|
||||
URLs: 'safe',
|
||||
classes: 'safe',
|
||||
cssIDs: 'safe',
|
||||
styles: 'safe'
|
||||
},
|
||||
lengthMax: 3,
|
||||
scriptsizemultiplierRange: [.6, 1],
|
||||
scriptlevelRange: [-2, 2],
|
||||
classPattern: /^mjx-[-a-zA-Z0-9_.]+$/,
|
||||
idPattern: /^mjx-[-a-zA-Z0-9_.]+$/,
|
||||
dataPattern: /^data-mjx-/,
|
||||
safeProtocols: (0, Options_js_1.expandable)({
|
||||
http: true,
|
||||
https: true,
|
||||
file: true,
|
||||
javascript: false,
|
||||
data: false
|
||||
}),
|
||||
safeStyles: (0, Options_js_1.expandable)({
|
||||
color: true,
|
||||
backgroundColor: true,
|
||||
border: true,
|
||||
cursor: true,
|
||||
margin: true,
|
||||
padding: true,
|
||||
textShadow: true,
|
||||
fontFamily: true,
|
||||
fontSize: true,
|
||||
fontStyle: true,
|
||||
fontWeight: true,
|
||||
opacity: true,
|
||||
outline: true
|
||||
}),
|
||||
styleParts: (0, Options_js_1.expandable)({
|
||||
border: true,
|
||||
padding: true,
|
||||
margin: true,
|
||||
outline: true
|
||||
}),
|
||||
styleLengths: (0, Options_js_1.expandable)({
|
||||
borderTop: 'borderTopWidth',
|
||||
borderRight: 'borderRightWidth',
|
||||
borderBottom: 'borderBottomWidth',
|
||||
borderLeft: 'borderLeftWidth',
|
||||
paddingTop: true,
|
||||
paddingRight: true,
|
||||
paddingBottom: true,
|
||||
paddingLeft: true,
|
||||
marginTop: true,
|
||||
marginRight: true,
|
||||
marginBottom: true,
|
||||
marginLeft: true,
|
||||
outlineTop: true,
|
||||
outlineRight: true,
|
||||
outlineBottom: true,
|
||||
outlineLeft: true,
|
||||
fontSize: [.707, 1.44]
|
||||
})
|
||||
};
|
||||
return Safe;
|
||||
}());
|
||||
exports.Safe = Safe;
|
||||
//# sourceMappingURL=safe.js.map
|
||||
1
node_modules/mathjax-full/js/ui/safe/safe.js.map
generated
vendored
Normal file
1
node_modules/mathjax-full/js/ui/safe/safe.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"safe.js","sourceRoot":"","sources":["../../../ts/ui/safe/safe.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,oDAA6D;AAE7D,mDAA6C;AAmB7C;IAsJE,cAAY,QAA+B,EAAE,OAAmB;QA5CzD,qBAAgB,GAAwB,IAAI,GAAG,CAAC;YAIrD,CAAC,MAAM,EAAE,WAAW,CAAC;YACrB,CAAC,KAAK,EAAG,WAAW,CAAC;YACrB,CAAC,QAAQ,EAAE,WAAW,CAAC;YACvB,CAAC,OAAO,EAAE,iBAAiB,CAAC;YAC5B,CAAC,OAAO,EAA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