@difizen/libro-rendermime 0.0.2-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +0 -0
- package/es/components/html-render.d.ts +6 -0
- package/es/components/html-render.d.ts.map +1 -0
- package/es/components/html-render.js +39 -0
- package/es/components/image-render.d.ts +6 -0
- package/es/components/image-render.d.ts.map +1 -0
- package/es/components/image-render.js +36 -0
- package/es/components/index.d.ts +7 -0
- package/es/components/index.d.ts.map +1 -0
- package/es/components/index.js +6 -0
- package/es/components/latex-render.d.ts +6 -0
- package/es/components/latex-render.d.ts.map +1 -0
- package/es/components/latex-render.js +23 -0
- package/es/components/markdown-render.d.ts +6 -0
- package/es/components/markdown-render.d.ts.map +1 -0
- package/es/components/markdown-render.js +38 -0
- package/es/components/svg-render.d.ts +6 -0
- package/es/components/svg-render.d.ts.map +1 -0
- package/es/components/svg-render.js +33 -0
- package/es/components/text-render.d.ts +9 -0
- package/es/components/text-render.d.ts.map +1 -0
- package/es/components/text-render.js +44 -0
- package/es/index.d.ts +7 -0
- package/es/index.d.ts.map +1 -0
- package/es/index.js +6 -0
- package/es/renderers.d.ts +42 -0
- package/es/renderers.d.ts.map +1 -0
- package/es/renderers.js +327 -0
- package/es/rendermime-factory.d.ts +30 -0
- package/es/rendermime-factory.d.ts.map +1 -0
- package/es/rendermime-factory.js +73 -0
- package/es/rendermime-module.d.ts +3 -0
- package/es/rendermime-module.d.ts.map +1 -0
- package/es/rendermime-module.js +11 -0
- package/es/rendermime-protocol.d.ts +405 -0
- package/es/rendermime-protocol.d.ts.map +1 -0
- package/es/rendermime-protocol.js +60 -0
- package/es/rendermime-registry.d.ts +135 -0
- package/es/rendermime-registry.d.ts.map +1 -0
- package/es/rendermime-registry.js +392 -0
- package/es/rendermime-utils.d.ts +87 -0
- package/es/rendermime-utils.d.ts.map +1 -0
- package/es/rendermime-utils.js +603 -0
- package/package.json +61 -0
- package/src/components/html-render.tsx +42 -0
- package/src/components/image-render.tsx +46 -0
- package/src/components/index.ts +6 -0
- package/src/components/latex-render.tsx +30 -0
- package/src/components/markdown-render.tsx +42 -0
- package/src/components/svg-render.tsx +38 -0
- package/src/components/text-render.tsx +51 -0
- package/src/index.ts +6 -0
- package/src/renderers.ts +325 -0
- package/src/rendermime-factory.ts +92 -0
- package/src/rendermime-module.ts +19 -0
- package/src/rendermime-protocol.ts +516 -0
- package/src/rendermime-registry.ts +301 -0
- package/src/rendermime-utils.ts +665 -0
|
@@ -0,0 +1,603 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
3
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
4
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
5
|
+
import { isDisplayData, isDisplayUpdate, isError, isExecuteResult, isPrimitive, isStream, URL } from '@difizen/libro-common';
|
|
6
|
+
import { URI } from '@difizen/mana-app';
|
|
7
|
+
import escape from 'lodash.escape';
|
|
8
|
+
/**
|
|
9
|
+
* Get the data from a notebook output.
|
|
10
|
+
*/
|
|
11
|
+
export function getData(output) {
|
|
12
|
+
var bundle = {};
|
|
13
|
+
if (isExecuteResult(output) || isDisplayData(output) || isDisplayUpdate(output)) {
|
|
14
|
+
bundle = output.data;
|
|
15
|
+
} else if (isStream(output)) {
|
|
16
|
+
if (output.name === 'stderr') {
|
|
17
|
+
bundle['application/vnd.jupyter.stderr'] = output.text;
|
|
18
|
+
} else {
|
|
19
|
+
bundle['application/vnd.jupyter.stdout'] = output.text;
|
|
20
|
+
}
|
|
21
|
+
} else if (isError(output)) {
|
|
22
|
+
bundle['application/vnd.jupyter.error'] = output;
|
|
23
|
+
var traceback = output.traceback.join('\n');
|
|
24
|
+
bundle['application/vnd.jupyter.stderr'] = traceback || "".concat(output.ename, ": ").concat(output.evalue);
|
|
25
|
+
}
|
|
26
|
+
return convertBundle(bundle);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Extract a value from a JSONObject.
|
|
31
|
+
*/
|
|
32
|
+
export function extract(value, key) {
|
|
33
|
+
var item = value[key];
|
|
34
|
+
if (item === undefined || isPrimitive(item)) {
|
|
35
|
+
return item;
|
|
36
|
+
}
|
|
37
|
+
return JSON.parse(JSON.stringify(item));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Convert a mime bundle to mime data.
|
|
42
|
+
*/
|
|
43
|
+
function convertBundle(bundle) {
|
|
44
|
+
var map = Object.create(null);
|
|
45
|
+
for (var mimeType in bundle) {
|
|
46
|
+
map[mimeType] = extract(bundle, mimeType);
|
|
47
|
+
}
|
|
48
|
+
return map;
|
|
49
|
+
}
|
|
50
|
+
var ANSI_COLORS = ['ansi-black', 'ansi-red', 'ansi-green', 'ansi-yellow', 'ansi-blue', 'ansi-magenta', 'ansi-cyan', 'ansi-white', 'ansi-black-intense', 'ansi-red-intense', 'ansi-green-intense', 'ansi-yellow-intense', 'ansi-blue-intense', 'ansi-magenta-intense', 'ansi-cyan-intense', 'ansi-white-intense'];
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Create HTML tags for a string with given foreground, background etc. and
|
|
54
|
+
* add them to the `out` array.
|
|
55
|
+
*/
|
|
56
|
+
function pushColoredChunk(chunk, fg, bg, bold, underline, inverse, out) {
|
|
57
|
+
var _fg = fg;
|
|
58
|
+
var _bg = bg;
|
|
59
|
+
if (chunk) {
|
|
60
|
+
var classes = [];
|
|
61
|
+
var styles = [];
|
|
62
|
+
if (bold && typeof _fg === 'number' && 0 <= _fg && _fg < 8) {
|
|
63
|
+
_fg += 8; // Bold text uses "intense" colors
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (inverse) {
|
|
67
|
+
var _ref = [_bg, _fg];
|
|
68
|
+
_fg = _ref[0];
|
|
69
|
+
_bg = _ref[1];
|
|
70
|
+
}
|
|
71
|
+
if (typeof _fg === 'number') {
|
|
72
|
+
classes.push(ANSI_COLORS[_fg] + '-fg');
|
|
73
|
+
} else if (_fg.length) {
|
|
74
|
+
styles.push("color: rgb(".concat(_fg, ")"));
|
|
75
|
+
} else if (inverse) {
|
|
76
|
+
classes.push('ansi-default-inverse-fg');
|
|
77
|
+
}
|
|
78
|
+
if (typeof _bg === 'number') {
|
|
79
|
+
classes.push(ANSI_COLORS[_bg] + '-bg');
|
|
80
|
+
} else if (_bg.length) {
|
|
81
|
+
styles.push("background-color: rgb(".concat(_bg, ")"));
|
|
82
|
+
} else if (inverse) {
|
|
83
|
+
classes.push('ansi-default-inverse-bg');
|
|
84
|
+
}
|
|
85
|
+
if (bold) {
|
|
86
|
+
classes.push('ansi-bold');
|
|
87
|
+
}
|
|
88
|
+
if (underline) {
|
|
89
|
+
classes.push('ansi-underline');
|
|
90
|
+
}
|
|
91
|
+
if (classes.length || styles.length) {
|
|
92
|
+
out.push('<span');
|
|
93
|
+
if (classes.length) {
|
|
94
|
+
out.push(" class=\"".concat(classes.join(' '), "\""));
|
|
95
|
+
}
|
|
96
|
+
if (styles.length) {
|
|
97
|
+
out.push(" style=\"".concat(styles.join('; '), "\""));
|
|
98
|
+
}
|
|
99
|
+
out.push('>');
|
|
100
|
+
out.push(chunk);
|
|
101
|
+
out.push('</span>');
|
|
102
|
+
} else {
|
|
103
|
+
out.push(chunk);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Convert ANSI extended colors to R/G/B triple.
|
|
110
|
+
*/
|
|
111
|
+
function getExtendedColors(numbers) {
|
|
112
|
+
var r;
|
|
113
|
+
var g;
|
|
114
|
+
var b;
|
|
115
|
+
var n = numbers.shift();
|
|
116
|
+
if (n === 2 && numbers.length >= 3) {
|
|
117
|
+
// 24-bit RGB
|
|
118
|
+
r = numbers.shift();
|
|
119
|
+
g = numbers.shift();
|
|
120
|
+
b = numbers.shift();
|
|
121
|
+
if ([r, g, b].some(function (c) {
|
|
122
|
+
return c < 0 || 255 < c;
|
|
123
|
+
})) {
|
|
124
|
+
throw new RangeError('Invalid range for RGB colors');
|
|
125
|
+
}
|
|
126
|
+
} else if (n === 5 && numbers.length >= 1) {
|
|
127
|
+
// 256 colors
|
|
128
|
+
var idx = numbers.shift();
|
|
129
|
+
if (idx < 0) {
|
|
130
|
+
throw new RangeError('Color index must be >= 0');
|
|
131
|
+
} else if (idx < 16) {
|
|
132
|
+
// 16 default terminal colors
|
|
133
|
+
return idx;
|
|
134
|
+
} else if (idx < 232) {
|
|
135
|
+
// 6x6x6 color cube, see https://stackoverflow.com/a/27165165/500098
|
|
136
|
+
r = Math.floor((idx - 16) / 36);
|
|
137
|
+
r = r > 0 ? 55 + r * 40 : 0;
|
|
138
|
+
g = Math.floor((idx - 16) % 36 / 6);
|
|
139
|
+
g = g > 0 ? 55 + g * 40 : 0;
|
|
140
|
+
b = (idx - 16) % 6;
|
|
141
|
+
b = b > 0 ? 55 + b * 40 : 0;
|
|
142
|
+
} else if (idx < 256) {
|
|
143
|
+
// grayscale, see https://stackoverflow.com/a/27165165/500098
|
|
144
|
+
r = g = b = (idx - 232) * 10 + 8;
|
|
145
|
+
} else {
|
|
146
|
+
throw new RangeError('Color index must be < 256');
|
|
147
|
+
}
|
|
148
|
+
} else {
|
|
149
|
+
throw new RangeError('Invalid extended color specification');
|
|
150
|
+
}
|
|
151
|
+
return [r, g, b];
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Transform ANSI color escape codes into HTML <span> tags with CSS
|
|
155
|
+
* classes such as "ansi-green-intense-fg".
|
|
156
|
+
* The actual colors used are set in the CSS file.
|
|
157
|
+
* This also removes non-color escape sequences.
|
|
158
|
+
* This is supposed to have the same behavior as nbconvert.filters.ansi2html()
|
|
159
|
+
*/
|
|
160
|
+
export function ansiSpan(str) {
|
|
161
|
+
var ansiRe = /\x1b\[(.*?)([@-~])/g; // eslint-disable-line no-control-regex
|
|
162
|
+
var fg = [];
|
|
163
|
+
var bg = [];
|
|
164
|
+
var bold = false;
|
|
165
|
+
var underline = false;
|
|
166
|
+
var inverse = false;
|
|
167
|
+
var match;
|
|
168
|
+
var out = [];
|
|
169
|
+
var numbers = [];
|
|
170
|
+
var start = 0;
|
|
171
|
+
var _str = escape(str);
|
|
172
|
+
_str += '\x1b[m'; // Ensure markup for trailing text
|
|
173
|
+
// tslint:disable-next-line
|
|
174
|
+
while (match = ansiRe.exec(_str)) {
|
|
175
|
+
if (match[2] === 'm') {
|
|
176
|
+
var items = match[1].split(';');
|
|
177
|
+
for (var i = 0; i < items.length; i++) {
|
|
178
|
+
var item = items[i];
|
|
179
|
+
if (item === '') {
|
|
180
|
+
numbers.push(0);
|
|
181
|
+
} else if (item.search(/^\d+$/) !== -1) {
|
|
182
|
+
numbers.push(parseInt(item, 10));
|
|
183
|
+
} else {
|
|
184
|
+
// Ignored: Invalid color specification
|
|
185
|
+
numbers.length = 0;
|
|
186
|
+
break;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
} else {
|
|
190
|
+
// Ignored: Not a color code
|
|
191
|
+
}
|
|
192
|
+
var chunk = _str.substring(start, match.index);
|
|
193
|
+
pushColoredChunk(chunk, fg, bg, bold, underline, inverse, out);
|
|
194
|
+
start = ansiRe.lastIndex;
|
|
195
|
+
while (numbers.length) {
|
|
196
|
+
var n = numbers.shift();
|
|
197
|
+
switch (n) {
|
|
198
|
+
case 0:
|
|
199
|
+
fg = bg = [];
|
|
200
|
+
bold = false;
|
|
201
|
+
underline = false;
|
|
202
|
+
inverse = false;
|
|
203
|
+
break;
|
|
204
|
+
case 1:
|
|
205
|
+
case 5:
|
|
206
|
+
bold = true;
|
|
207
|
+
break;
|
|
208
|
+
case 4:
|
|
209
|
+
underline = true;
|
|
210
|
+
break;
|
|
211
|
+
case 7:
|
|
212
|
+
inverse = true;
|
|
213
|
+
break;
|
|
214
|
+
case 21:
|
|
215
|
+
case 22:
|
|
216
|
+
bold = false;
|
|
217
|
+
break;
|
|
218
|
+
case 24:
|
|
219
|
+
underline = false;
|
|
220
|
+
break;
|
|
221
|
+
case 27:
|
|
222
|
+
inverse = false;
|
|
223
|
+
break;
|
|
224
|
+
case 30:
|
|
225
|
+
case 31:
|
|
226
|
+
case 32:
|
|
227
|
+
case 33:
|
|
228
|
+
case 34:
|
|
229
|
+
case 35:
|
|
230
|
+
case 36:
|
|
231
|
+
case 37:
|
|
232
|
+
fg = n - 30;
|
|
233
|
+
break;
|
|
234
|
+
case 38:
|
|
235
|
+
try {
|
|
236
|
+
fg = getExtendedColors(numbers);
|
|
237
|
+
} catch (e) {
|
|
238
|
+
numbers.length = 0;
|
|
239
|
+
}
|
|
240
|
+
break;
|
|
241
|
+
case 39:
|
|
242
|
+
fg = [];
|
|
243
|
+
break;
|
|
244
|
+
case 40:
|
|
245
|
+
case 41:
|
|
246
|
+
case 42:
|
|
247
|
+
case 43:
|
|
248
|
+
case 44:
|
|
249
|
+
case 45:
|
|
250
|
+
case 46:
|
|
251
|
+
case 47:
|
|
252
|
+
bg = n - 40;
|
|
253
|
+
break;
|
|
254
|
+
case 48:
|
|
255
|
+
try {
|
|
256
|
+
bg = getExtendedColors(numbers);
|
|
257
|
+
} catch (e) {
|
|
258
|
+
numbers.length = 0;
|
|
259
|
+
}
|
|
260
|
+
break;
|
|
261
|
+
case 49:
|
|
262
|
+
bg = [];
|
|
263
|
+
break;
|
|
264
|
+
case 90:
|
|
265
|
+
case 91:
|
|
266
|
+
case 92:
|
|
267
|
+
case 93:
|
|
268
|
+
case 94:
|
|
269
|
+
case 95:
|
|
270
|
+
case 96:
|
|
271
|
+
case 97:
|
|
272
|
+
fg = n - 90 + 8;
|
|
273
|
+
break;
|
|
274
|
+
case 100:
|
|
275
|
+
case 101:
|
|
276
|
+
case 102:
|
|
277
|
+
case 103:
|
|
278
|
+
case 104:
|
|
279
|
+
case 105:
|
|
280
|
+
case 106:
|
|
281
|
+
case 107:
|
|
282
|
+
bg = n - 100 + 8;
|
|
283
|
+
break;
|
|
284
|
+
default:
|
|
285
|
+
// Unknown codes are ignored
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
return out.join('');
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Replace URLs with links.
|
|
294
|
+
*
|
|
295
|
+
* @param content - The text content of a node.
|
|
296
|
+
*
|
|
297
|
+
* @returns A list of text nodes and anchor elements.
|
|
298
|
+
*/
|
|
299
|
+
export function autolink(content) {
|
|
300
|
+
// Taken from Visual Studio Code:
|
|
301
|
+
// https://github.com/microsoft/vscode/blob/9f709d170b06e991502153f281ec3c012add2e42/src/vs/workbench/contrib/debug/browser/linkDetector.ts#L17-L18
|
|
302
|
+
var controlCodes = "\\u0000-\\u0020\\u007f-\\u009f";
|
|
303
|
+
var webLinkRegex = new RegExp('(?:[a-zA-Z][a-zA-Z0-9+.-]{2,}:\\/\\/|data:|www\\.)[^\\s' + controlCodes + '"]{2,}[^\\s' + controlCodes + '"\'(){}\\[\\],:;.!?]', 'ug');
|
|
304
|
+
var nodes = [];
|
|
305
|
+
var lastIndex = 0;
|
|
306
|
+
var match;
|
|
307
|
+
while (null !== (match = webLinkRegex.exec(content))) {
|
|
308
|
+
if (match.index !== lastIndex) {
|
|
309
|
+
nodes.push(document.createTextNode(content.slice(lastIndex, match.index)));
|
|
310
|
+
}
|
|
311
|
+
var url = match[0];
|
|
312
|
+
// Special case when the URL ends with ">" or "<"
|
|
313
|
+
var lastChars = url.slice(-1);
|
|
314
|
+
var endsWithGtLt = ['>', '<'].indexOf(lastChars) !== -1;
|
|
315
|
+
var len = endsWithGtLt ? url.length - 1 : url.length;
|
|
316
|
+
var anchor = document.createElement('a');
|
|
317
|
+
url = url.slice(0, len);
|
|
318
|
+
anchor.href = url.startsWith('www.') ? 'https://' + url : url;
|
|
319
|
+
anchor.rel = 'noopener';
|
|
320
|
+
anchor.target = '_blank';
|
|
321
|
+
anchor.appendChild(document.createTextNode(url.slice(0, len)));
|
|
322
|
+
nodes.push(anchor);
|
|
323
|
+
lastIndex = match.index + len;
|
|
324
|
+
}
|
|
325
|
+
if (lastIndex !== content.length) {
|
|
326
|
+
nodes.push(document.createTextNode(content.slice(lastIndex, content.length)));
|
|
327
|
+
}
|
|
328
|
+
return nodes;
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* Split a shallow node (node without nested nodes inside) at a given text content position.
|
|
332
|
+
*
|
|
333
|
+
* @param node the shallow node to be split
|
|
334
|
+
* @param at the position in textContent at which the split should occur
|
|
335
|
+
*/
|
|
336
|
+
export function splitShallowNode(node, at) {
|
|
337
|
+
var _node$textContent, _node$textContent2;
|
|
338
|
+
var pre = node.cloneNode();
|
|
339
|
+
pre.textContent = (_node$textContent = node.textContent) === null || _node$textContent === void 0 ? void 0 : _node$textContent.substr(0, at);
|
|
340
|
+
var post = node.cloneNode();
|
|
341
|
+
post.textContent = (_node$textContent2 = node.textContent) === null || _node$textContent2 === void 0 ? void 0 : _node$textContent2.substr(at);
|
|
342
|
+
return {
|
|
343
|
+
pre: pre,
|
|
344
|
+
post: post
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
export function sortedTypes(map) {
|
|
348
|
+
return Object.keys(map).sort(function (a, b) {
|
|
349
|
+
var p1 = map[a];
|
|
350
|
+
var p2 = map[b];
|
|
351
|
+
if (p1.rank !== p2.rank) {
|
|
352
|
+
return p1.rank - p2.rank;
|
|
353
|
+
}
|
|
354
|
+
return p1.id - p2.id;
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
/**
|
|
359
|
+
* Eval the script tags contained in a host populated by `innerHTML`.
|
|
360
|
+
*
|
|
361
|
+
* When script tags are created via `innerHTML`, the browser does not
|
|
362
|
+
* evaluate them when they are added to the page. This function works
|
|
363
|
+
* around that by creating new equivalent script nodes manually, and
|
|
364
|
+
* replacing the originals.
|
|
365
|
+
*/
|
|
366
|
+
export function evalInnerHTMLScriptTags(host) {
|
|
367
|
+
// Create a snapshot of the current script nodes.
|
|
368
|
+
var scripts = Array.from(host.getElementsByTagName('script'));
|
|
369
|
+
|
|
370
|
+
// Loop over each script node.
|
|
371
|
+
for (var _i = 0, _scripts = scripts; _i < _scripts.length; _i++) {
|
|
372
|
+
var script = _scripts[_i];
|
|
373
|
+
// Skip any scripts which no longer have a parent.
|
|
374
|
+
if (!script.parentNode) {
|
|
375
|
+
continue;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
// Create a new script node which will be clone.
|
|
379
|
+
var clone = document.createElement('script');
|
|
380
|
+
|
|
381
|
+
// Copy the attributes into the clone.
|
|
382
|
+
var attrs = script.attributes;
|
|
383
|
+
for (var i = 0, n = attrs.length; i < n; ++i) {
|
|
384
|
+
var _attrs$i = attrs[i],
|
|
385
|
+
name = _attrs$i.name,
|
|
386
|
+
value = _attrs$i.value;
|
|
387
|
+
clone.setAttribute(name, value);
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
// Copy the text content into the clone.
|
|
391
|
+
clone.textContent = script.textContent;
|
|
392
|
+
|
|
393
|
+
// Replace the old script in the parent.
|
|
394
|
+
script.parentNode.replaceChild(clone, script);
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
/**
|
|
399
|
+
* Handle the default behavior of nodes.
|
|
400
|
+
*/
|
|
401
|
+
export function handleDefaults(node, resolver) {
|
|
402
|
+
// Handle anchor elements.
|
|
403
|
+
var anchors = node.getElementsByTagName('a');
|
|
404
|
+
for (var i = 0; i < anchors.length; i++) {
|
|
405
|
+
var el = anchors[i];
|
|
406
|
+
// skip when processing a elements inside svg
|
|
407
|
+
// which are of type SVGAnimatedString
|
|
408
|
+
if (!(el instanceof HTMLAnchorElement)) {
|
|
409
|
+
continue;
|
|
410
|
+
}
|
|
411
|
+
var path = el.href;
|
|
412
|
+
var isLocal = resolver && resolver.isLocal ? resolver.isLocal(path) : URL.isLocal(path);
|
|
413
|
+
// set target attribute if not already present
|
|
414
|
+
if (!el.target) {
|
|
415
|
+
el.target = isLocal ? '_self' : '_blank';
|
|
416
|
+
}
|
|
417
|
+
// set rel as 'noopener' for non-local anchors
|
|
418
|
+
if (!isLocal) {
|
|
419
|
+
el.rel = 'noopener';
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
// Handle image elements.
|
|
424
|
+
var imgs = node.getElementsByTagName('img');
|
|
425
|
+
for (var _i2 = 0; _i2 < imgs.length; _i2++) {
|
|
426
|
+
if (!imgs[_i2].alt) {
|
|
427
|
+
imgs[_i2].alt = 'Image';
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
/**
|
|
433
|
+
* Resolve the relative urls in element `src` and `href` attributes.
|
|
434
|
+
*
|
|
435
|
+
* @param node - The head html element.
|
|
436
|
+
*
|
|
437
|
+
* @param resolver - A url resolver.
|
|
438
|
+
*
|
|
439
|
+
* @param linkHandler - An optional link handler for nodes.
|
|
440
|
+
*
|
|
441
|
+
* @returns a promise fulfilled when the relative urls have been resolved.
|
|
442
|
+
*/
|
|
443
|
+
export function handleUrls(node, resolver, linkHandler) {
|
|
444
|
+
// Set up an array to collect promises.
|
|
445
|
+
var promises = [];
|
|
446
|
+
|
|
447
|
+
// Handle HTML Elements with src attributes.
|
|
448
|
+
var nodes = node.querySelectorAll('*[src]');
|
|
449
|
+
for (var i = 0; i < nodes.length; i++) {
|
|
450
|
+
promises.push(handleAttr(nodes[i], 'src', resolver));
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
// Handle anchor elements.
|
|
454
|
+
var anchors = node.getElementsByTagName('a');
|
|
455
|
+
for (var _i3 = 0; _i3 < anchors.length; _i3++) {
|
|
456
|
+
promises.push(handleAnchor(anchors[_i3], resolver, linkHandler));
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
// Handle link elements.
|
|
460
|
+
var links = node.getElementsByTagName('link');
|
|
461
|
+
for (var _i4 = 0; _i4 < links.length; _i4++) {
|
|
462
|
+
promises.push(handleAttr(links[_i4], 'href', resolver));
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
// Wait on all promises.
|
|
466
|
+
return Promise.all(promises).then(function () {
|
|
467
|
+
return undefined;
|
|
468
|
+
});
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
/**
|
|
472
|
+
* Handle a node with a `src` or `href` attribute.
|
|
473
|
+
*/
|
|
474
|
+
function handleAttr(_x, _x2, _x3) {
|
|
475
|
+
return _handleAttr.apply(this, arguments);
|
|
476
|
+
}
|
|
477
|
+
/**
|
|
478
|
+
* Handle an anchor node.
|
|
479
|
+
*/
|
|
480
|
+
function _handleAttr() {
|
|
481
|
+
_handleAttr = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(node, name, resolver) {
|
|
482
|
+
var source, isLocal, urlPath, url;
|
|
483
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
484
|
+
while (1) switch (_context.prev = _context.next) {
|
|
485
|
+
case 0:
|
|
486
|
+
source = node.getAttribute(name) || '';
|
|
487
|
+
isLocal = resolver.isLocal ? resolver.isLocal(source) : URL.isLocal(source);
|
|
488
|
+
if (!(!source || !isLocal)) {
|
|
489
|
+
_context.next = 4;
|
|
490
|
+
break;
|
|
491
|
+
}
|
|
492
|
+
return _context.abrupt("return");
|
|
493
|
+
case 4:
|
|
494
|
+
_context.prev = 4;
|
|
495
|
+
_context.next = 7;
|
|
496
|
+
return resolver.resolveUrl(source);
|
|
497
|
+
case 7:
|
|
498
|
+
urlPath = _context.sent;
|
|
499
|
+
_context.next = 10;
|
|
500
|
+
return resolver.getDownloadUrl(urlPath);
|
|
501
|
+
case 10:
|
|
502
|
+
url = _context.sent;
|
|
503
|
+
if (new URI(url).scheme !== 'data:') {
|
|
504
|
+
// Bust caching for local src attrs.
|
|
505
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Using_XMLHttpRequest#Bypassing_the_cache
|
|
506
|
+
url += (/\?/.test(url) ? '&' : '?') + new Date().getTime();
|
|
507
|
+
}
|
|
508
|
+
node.setAttribute(name, url);
|
|
509
|
+
_context.next = 19;
|
|
510
|
+
break;
|
|
511
|
+
case 15:
|
|
512
|
+
_context.prev = 15;
|
|
513
|
+
_context.t0 = _context["catch"](4);
|
|
514
|
+
// If there was an error getting the url,
|
|
515
|
+
// just make it an empty link and report the error.
|
|
516
|
+
node.setAttribute(name, '');
|
|
517
|
+
throw _context.t0;
|
|
518
|
+
case 19:
|
|
519
|
+
case "end":
|
|
520
|
+
return _context.stop();
|
|
521
|
+
}
|
|
522
|
+
}, _callee, null, [[4, 15]]);
|
|
523
|
+
}));
|
|
524
|
+
return _handleAttr.apply(this, arguments);
|
|
525
|
+
}
|
|
526
|
+
function handleAnchor(anchor, resolver, linkHandler) {
|
|
527
|
+
// Get the link path without the location prepended.
|
|
528
|
+
// (e.g. "./foo.md#Header 1" vs "http://localhost:8888/foo.md#Header 1")
|
|
529
|
+
var href = anchor.getAttribute('href') || '';
|
|
530
|
+
var isLocal = resolver.isLocal ? resolver.isLocal(href) : URL.isLocal(href);
|
|
531
|
+
// Bail if it is not a file-like url.
|
|
532
|
+
if (!href || !isLocal) {
|
|
533
|
+
return Promise.resolve(undefined);
|
|
534
|
+
}
|
|
535
|
+
// Remove the hash until we can handle it.
|
|
536
|
+
var hash = anchor.hash;
|
|
537
|
+
if (hash) {
|
|
538
|
+
// Handle internal link in the file.
|
|
539
|
+
if (hash === href) {
|
|
540
|
+
anchor.target = '_self';
|
|
541
|
+
return Promise.resolve(undefined);
|
|
542
|
+
}
|
|
543
|
+
// For external links, remove the hash until we have hash handling.
|
|
544
|
+
href = href.replace(hash, '');
|
|
545
|
+
}
|
|
546
|
+
// Get the appropriate file path.
|
|
547
|
+
return resolver.resolveUrl(href).then(function (urlPath) {
|
|
548
|
+
// decode encoded url from url to api path
|
|
549
|
+
var path = decodeURIComponent(urlPath);
|
|
550
|
+
// Handle the click override.
|
|
551
|
+
if (linkHandler) {
|
|
552
|
+
linkHandler.handleLink(anchor, path, hash);
|
|
553
|
+
}
|
|
554
|
+
// Get the appropriate file download path.
|
|
555
|
+
return resolver.getDownloadUrl(urlPath);
|
|
556
|
+
}).then(function (url) {
|
|
557
|
+
// Set the visible anchor.
|
|
558
|
+
anchor.href = url + hash;
|
|
559
|
+
return;
|
|
560
|
+
}).catch(function () {
|
|
561
|
+
// If there was an error getting the url,
|
|
562
|
+
// just make it an empty link.
|
|
563
|
+
anchor.href = '';
|
|
564
|
+
});
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
/**
|
|
568
|
+
* Create a normalized id for a header element.
|
|
569
|
+
*
|
|
570
|
+
* @param header Header element
|
|
571
|
+
* @returns Normalized id
|
|
572
|
+
*/
|
|
573
|
+
export function createHeaderId(header) {
|
|
574
|
+
var _header$textContent;
|
|
575
|
+
return ((_header$textContent = header.textContent) !== null && _header$textContent !== void 0 ? _header$textContent : '').replace(/ /g, '-');
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
/**
|
|
579
|
+
* Apply ids to headers.
|
|
580
|
+
*/
|
|
581
|
+
// export function headerAnchors(node: HTMLElement): void {
|
|
582
|
+
// const headerNames = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
|
|
583
|
+
// for (const headerType of headerNames) {
|
|
584
|
+
// const headers = node.getElementsByTagName(headerType);
|
|
585
|
+
// for (let i = 0; i < headers.length; i++) {
|
|
586
|
+
// const header = headers[i];
|
|
587
|
+
// header.id = createHeaderId(header);
|
|
588
|
+
// const anchor = document.createElement('a');
|
|
589
|
+
// anchor.target = '_self';
|
|
590
|
+
// anchor.textContent = '¶';
|
|
591
|
+
// anchor.href = '#' + header.id;
|
|
592
|
+
// anchor.classList.add('libro-InternalAnchorLink');
|
|
593
|
+
// header.appendChild(anchor);
|
|
594
|
+
// }
|
|
595
|
+
// }
|
|
596
|
+
// }
|
|
597
|
+
// export function sessionConnection(
|
|
598
|
+
// s: Session.ISessionConnection | ISessionContext,
|
|
599
|
+
// ): Session.ISessionConnection | null {
|
|
600
|
+
// return (s as any).sessionChanged
|
|
601
|
+
// ? (s as ISessionContext).session
|
|
602
|
+
// : (s as Session.ISessionConnection);
|
|
603
|
+
// }
|
package/package.json
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@difizen/libro-rendermime",
|
|
3
|
+
"version": "0.0.2-alpha.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"libro",
|
|
7
|
+
"notebook"
|
|
8
|
+
],
|
|
9
|
+
"repository": "git@github.com:difizen/libro.git",
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"type": "module",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"typings": "./es/index.d.ts",
|
|
15
|
+
"default": "./es/index.js"
|
|
16
|
+
},
|
|
17
|
+
"./mock": {
|
|
18
|
+
"typings": "./es/mock/index.d.ts",
|
|
19
|
+
"default": "./es/mock/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./es/mock": {
|
|
22
|
+
"typings": "./es/mock/index.d.ts",
|
|
23
|
+
"default": "./es/mock/index.js"
|
|
24
|
+
},
|
|
25
|
+
"./package.json": "./package.json"
|
|
26
|
+
},
|
|
27
|
+
"main": "es/index.js",
|
|
28
|
+
"module": "es/index.js",
|
|
29
|
+
"typings": "es/index.d.ts",
|
|
30
|
+
"files": [
|
|
31
|
+
"es",
|
|
32
|
+
"src"
|
|
33
|
+
],
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@difizen/libro-common": "^0.0.2-alpha.0",
|
|
36
|
+
"@difizen/libro-core": "^0.0.2-alpha.0",
|
|
37
|
+
"@difizen/libro-markdown": "^0.0.2-alpha.0",
|
|
38
|
+
"@difizen/mana-app": "alpha",
|
|
39
|
+
"lodash.escape": "^4.0.1"
|
|
40
|
+
},
|
|
41
|
+
"peerDependencies": {
|
|
42
|
+
"react": "^18.2.0"
|
|
43
|
+
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"@types/lodash.escape": "^4.0.7",
|
|
46
|
+
"@types/react": "^18.2.25"
|
|
47
|
+
},
|
|
48
|
+
"scripts": {
|
|
49
|
+
"setup": "father build",
|
|
50
|
+
"build": "father build",
|
|
51
|
+
"test": ": Note: lint task is delegated to test:* scripts",
|
|
52
|
+
"test:vitest": "vitest run",
|
|
53
|
+
"test:jest": "jest",
|
|
54
|
+
"coverage": ": Note: lint task is delegated to coverage:* scripts",
|
|
55
|
+
"coverage:vitest": "vitest run --coverage",
|
|
56
|
+
"coverage:jest": "jest --coverage",
|
|
57
|
+
"lint": ": Note: lint task is delegated to lint:* scripts",
|
|
58
|
+
"lint:eslint": "eslint src",
|
|
59
|
+
"lint:tsc": "tsc --noEmit"
|
|
60
|
+
}
|
|
61
|
+
}
|