@cortex-js/compute-engine 0.27.0 → 0.29.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/dist/{compute-engine.js → compute-engine.cjs} +24718 -24251
- package/dist/compute-engine.esm.js +24718 -24251
- package/dist/compute-engine.min.cjs +129 -0
- package/dist/compute-engine.min.esm.js +55 -68
- package/dist/math-json.cjs +413 -0
- package/dist/math-json.esm.js +287 -7
- package/dist/math-json.min.cjs +6 -0
- package/dist/math-json.min.esm.js +287 -7
- package/dist/types/common/ansi-codes.d.ts +1 -1
- package/dist/types/common/fuzzy-string-match.d.ts +2 -0
- package/dist/types/common/grapheme-splitter.d.ts +1 -1
- package/dist/types/common/interruptible.d.ts +2 -2
- package/dist/types/common/json5.d.ts +3 -0
- package/dist/types/common/one-of.d.ts +2 -1
- package/dist/types/common/signals.d.ts +1 -2
- package/dist/types/common/type/boxed-type.d.ts +14 -0
- package/dist/types/common/type/parse.d.ts +1 -1
- package/dist/types/common/type/primitive.d.ts +2 -1
- package/dist/types/common/type/serialize.d.ts +1 -1
- package/dist/types/common/type/subtype.d.ts +1 -1
- package/dist/types/common/type/types.d.ts +121 -136
- package/dist/types/common/type/utils.d.ts +3 -7
- package/dist/types/common/utils.d.ts +1 -1
- package/dist/types/compute-engine/assume.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/abstract-boxed-expression.d.ts +17 -18
- package/dist/types/compute-engine/boxed-expression/apply.d.ts +2 -2
- package/dist/types/compute-engine/boxed-expression/arithmetic-add.d.ts +5 -4
- package/dist/types/compute-engine/boxed-expression/arithmetic-mul-div.d.ts +27 -0
- package/dist/types/compute-engine/boxed-expression/arithmetic-power.d.ts +2 -2
- package/dist/types/compute-engine/boxed-expression/ascii-math.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/box.d.ts +5 -5
- package/dist/types/compute-engine/boxed-expression/boxed-function-definition.d.ts +20 -14
- package/dist/types/compute-engine/boxed-expression/boxed-function.d.ts +14 -13
- package/dist/types/compute-engine/boxed-expression/boxed-number.d.ts +8 -10
- package/dist/types/compute-engine/boxed-expression/boxed-patterns.d.ts +2 -2
- package/dist/types/compute-engine/boxed-expression/boxed-string.d.ts +4 -5
- package/dist/types/compute-engine/boxed-expression/boxed-symbol-definition.d.ts +6 -5
- package/dist/types/compute-engine/boxed-expression/boxed-symbol.d.ts +11 -11
- package/dist/types/compute-engine/boxed-expression/boxed-tensor.d.ts +7 -10
- package/dist/types/compute-engine/boxed-expression/cache.d.ts +2 -1
- package/dist/types/compute-engine/boxed-expression/canonical.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/compare.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/expand.d.ts +3 -3
- package/dist/types/compute-engine/boxed-expression/expression-map.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/factor.d.ts +1 -3
- package/dist/types/compute-engine/boxed-expression/flatten.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/hold.d.ts +3 -2
- package/dist/types/compute-engine/boxed-expression/match.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/negate.d.ts +2 -2
- package/dist/types/compute-engine/boxed-expression/numerics.d.ts +3 -3
- package/dist/types/compute-engine/boxed-expression/order.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/polynomials.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/product.d.ts +5 -5
- package/dist/types/compute-engine/boxed-expression/rules.d.ts +2 -2
- package/dist/types/compute-engine/boxed-expression/serialize.d.ts +3 -3
- package/dist/types/compute-engine/boxed-expression/sgn.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/simplify.d.ts +1 -1
- package/dist/types/compute-engine/boxed-expression/solve.d.ts +1 -2
- package/dist/types/compute-engine/boxed-expression/terms.d.ts +2 -2
- package/dist/types/compute-engine/boxed-expression/trigonometry.d.ts +2 -9
- package/dist/types/compute-engine/boxed-expression/utils.d.ts +13 -4
- package/dist/types/compute-engine/boxed-expression/validate.d.ts +9 -10
- package/dist/types/compute-engine/collection-utils.d.ts +1 -1
- package/dist/types/compute-engine/compile.d.ts +2 -4
- package/dist/types/compute-engine/cost-function.d.ts +1 -1
- package/dist/types/compute-engine/function-utils.d.ts +1 -1
- package/dist/types/compute-engine/{boxed-expression/public.d.ts → global-types.d.ts} +887 -849
- package/dist/types/compute-engine/{compute-engine.d.ts → index.d.ts} +29 -19
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-algebra.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-arithmetic.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-calculus.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-complex.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-core.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-linear-algebra.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-logic.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-other.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-relational-operators.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-sets.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-statistics.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-symbols.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions-trigonometry.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/dictionary/definitions.d.ts +2 -2
- package/dist/types/compute-engine/latex-syntax/parse-identifier.d.ts +2 -2
- package/dist/types/compute-engine/latex-syntax/parse.d.ts +2 -2
- package/dist/types/compute-engine/latex-syntax/serialize-number.d.ts +2 -2
- package/dist/types/compute-engine/latex-syntax/serializer-style.d.ts +2 -2
- package/dist/types/compute-engine/latex-syntax/serializer.d.ts +2 -2
- package/dist/types/compute-engine/latex-syntax/tokenizer.d.ts +1 -1
- package/dist/types/compute-engine/latex-syntax/{public.d.ts → types.d.ts} +13 -6
- package/dist/types/compute-engine/library/arithmetic.d.ts +1 -2
- package/dist/types/compute-engine/library/calculus.d.ts +1 -1
- package/dist/types/compute-engine/library/collections.d.ts +3 -2
- package/dist/types/compute-engine/library/complex.d.ts +1 -1
- package/dist/types/compute-engine/library/control-structures.d.ts +1 -1
- package/dist/types/compute-engine/library/core.d.ts +1 -1
- package/dist/types/compute-engine/library/invisible-operator.d.ts +2 -2
- package/dist/types/compute-engine/library/library.d.ts +3 -3
- package/dist/types/compute-engine/library/linear-algebra.d.ts +1 -1
- package/dist/types/compute-engine/library/logic.d.ts +1 -1
- package/dist/types/compute-engine/library/polynomials.d.ts +1 -1
- package/dist/types/compute-engine/library/random-expression.d.ts +1 -1
- package/dist/types/compute-engine/library/relational-operator.d.ts +1 -1
- package/dist/types/compute-engine/library/sets.d.ts +1 -1
- package/dist/types/compute-engine/library/statistics.d.ts +1 -1
- package/dist/types/compute-engine/library/trigonometry.d.ts +1 -1
- package/dist/types/compute-engine/library/utils.d.ts +3 -5
- package/dist/types/compute-engine/numeric-value/big-numeric-value.d.ts +3 -4
- package/dist/types/compute-engine/numeric-value/exact-numeric-value.d.ts +3 -5
- package/dist/types/compute-engine/numeric-value/machine-numeric-value.d.ts +3 -4
- package/dist/types/compute-engine/numeric-value/{public.d.ts → types.d.ts} +9 -5
- package/dist/types/compute-engine/numerics/bigint.d.ts +1 -1
- package/dist/types/compute-engine/numerics/expression.d.ts +1 -1
- package/dist/types/compute-engine/numerics/interval.d.ts +1 -1
- package/dist/types/compute-engine/numerics/monte-carlo.d.ts +1 -1
- package/dist/types/compute-engine/numerics/numeric-bigint.d.ts +1 -1
- package/dist/types/compute-engine/numerics/numeric-bignum.d.ts +1 -1
- package/dist/types/compute-engine/numerics/numeric-complex.d.ts +1 -1
- package/dist/types/compute-engine/numerics/numeric.d.ts +2 -7
- package/dist/types/compute-engine/numerics/primes.d.ts +1 -1
- package/dist/types/compute-engine/numerics/rationals.d.ts +1 -5
- package/dist/types/compute-engine/numerics/richardson.d.ts +1 -1
- package/dist/types/compute-engine/numerics/special-functions.d.ts +4 -4
- package/dist/types/compute-engine/numerics/statistics.d.ts +2 -2
- package/dist/types/compute-engine/numerics/strings.d.ts +1 -1
- package/dist/types/compute-engine/numerics/types.d.ts +30 -0
- package/dist/types/compute-engine/symbolic/derivative.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/distribute.d.ts +1 -1
- package/dist/types/compute-engine/symbolic/simplify-rules.d.ts +1 -1
- package/dist/types/compute-engine/{boxed-expression → tensor}/tensor-fields.d.ts +19 -18
- package/dist/types/compute-engine/tensor/tensors.d.ts +9 -12
- package/dist/types/compute-engine/types.d.ts +11 -0
- package/dist/types/compute-engine.d.ts +3 -5
- package/dist/types/math-json/identifiers.d.ts +1 -1
- package/dist/types/math-json/types.d.ts +9 -7
- package/dist/types/math-json/utils.d.ts +3 -3
- package/dist/types/math-json.d.ts +3 -3
- package/package.json +9 -9
- package/dist/compute-engine.min.js +0 -142
- package/dist/math-json.js +0 -133
- package/dist/math-json.min.js +0 -4
- package/dist/types/common/buffer.d.ts +0 -9
- package/dist/types/common/styled-text.d.ts +0 -28
- package/dist/types/common/suggest.d.ts +0 -1
- package/dist/types/common/syntax-highlighter.d.ts +0 -40
- package/dist/types/common/terminal.d.ts +0 -19
- package/dist/types/compute-engine/boxed-expression/arithmetic-divide.d.ts +0 -12
- package/dist/types/compute-engine/boxed-expression/arithmetic-multiply.d.ts +0 -16
- package/dist/types/compute-engine/debug.d.ts +0 -3
- package/dist/types/compute-engine/numerics/bignum.d.ts +0 -12
- package/dist/types/compute-engine/private.d.ts +0 -29
- package/dist/types/compute-engine/public.d.ts +0 -42
package/dist/math-json.js
DELETED
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
/** MathJSON 0.27.0 */
|
|
2
|
-
(function(global,factory){typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'],factory):(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.MathJson = {}));})(this, (function (exports) { 'use strict';
|
|
3
|
-
var MathJson = (() => {
|
|
4
|
-
var __defProp = Object.defineProperty;
|
|
5
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
-
|
|
22
|
-
// src/math-json.ts
|
|
23
|
-
var math_json_exports = {};
|
|
24
|
-
__export(math_json_exports, {
|
|
25
|
-
getDictionary: () => dictionary,
|
|
26
|
-
getStringValue: () => stringValue,
|
|
27
|
-
isFunctionObject: () => isFunctionObject,
|
|
28
|
-
isStringObject: () => isStringObject,
|
|
29
|
-
isSymbolObject: () => isSymbolObject,
|
|
30
|
-
mapArgs: () => mapArgs,
|
|
31
|
-
operand: () => operand,
|
|
32
|
-
operator: () => operator,
|
|
33
|
-
symbol: () => symbol,
|
|
34
|
-
version: () => version
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
// src/math-json/utils.ts
|
|
38
|
-
function isSymbolObject(expr) {
|
|
39
|
-
return expr !== null && typeof expr === "object" && "sym" in expr;
|
|
40
|
-
}
|
|
41
|
-
function isStringObject(expr) {
|
|
42
|
-
return expr !== null && typeof expr === "object" && "str" in expr;
|
|
43
|
-
}
|
|
44
|
-
function isFunctionObject(expr) {
|
|
45
|
-
return expr !== null && typeof expr === "object" && "fn" in expr;
|
|
46
|
-
}
|
|
47
|
-
function stringValue(expr) {
|
|
48
|
-
if (expr === null || expr === void 0) return null;
|
|
49
|
-
if (typeof expr === "object" && "str" in expr) return expr.str;
|
|
50
|
-
if (typeof expr !== "string") return null;
|
|
51
|
-
if (expr.length < 2) return null;
|
|
52
|
-
if (expr.at(0) !== "'" || expr.at(-1) !== "'") return null;
|
|
53
|
-
return expr.substring(1, expr.length - 1);
|
|
54
|
-
}
|
|
55
|
-
function operator(expr) {
|
|
56
|
-
if (Array.isArray(expr)) return expr[0];
|
|
57
|
-
if (expr === null || expr === void 0) return "";
|
|
58
|
-
if (isFunctionObject(expr)) return expr.fn[0];
|
|
59
|
-
return "";
|
|
60
|
-
}
|
|
61
|
-
function operands(expr) {
|
|
62
|
-
if (Array.isArray(expr)) return expr.slice(1);
|
|
63
|
-
if (expr !== void 0 && isFunctionObject(expr)) return expr.fn.slice(1);
|
|
64
|
-
return [];
|
|
65
|
-
}
|
|
66
|
-
function operand(expr, n) {
|
|
67
|
-
if (Array.isArray(expr)) return expr[n] ?? null;
|
|
68
|
-
if (expr === null || !isFunctionObject(expr)) return null;
|
|
69
|
-
return expr.fn[n] ?? null;
|
|
70
|
-
}
|
|
71
|
-
function nops(expr) {
|
|
72
|
-
if (expr === null || expr === void 0) return 0;
|
|
73
|
-
if (Array.isArray(expr)) return Math.max(0, expr.length - 1);
|
|
74
|
-
if (isFunctionObject(expr)) return Math.max(0, expr.fn.length - 1);
|
|
75
|
-
return 0;
|
|
76
|
-
}
|
|
77
|
-
function symbol(expr) {
|
|
78
|
-
if (typeof expr === "string") {
|
|
79
|
-
if (/^[+-]?[0-9\.]/.test(expr)) return null;
|
|
80
|
-
if (expr.length >= 2 && expr[0] === "'" && expr[expr.length - 1] === "'")
|
|
81
|
-
return null;
|
|
82
|
-
return expr;
|
|
83
|
-
}
|
|
84
|
-
if (expr === null || expr === void 0) return null;
|
|
85
|
-
const s = isSymbolObject(expr) ? expr.sym : expr;
|
|
86
|
-
if (typeof s !== "string") return null;
|
|
87
|
-
return s;
|
|
88
|
-
}
|
|
89
|
-
function keyValuePair(expr) {
|
|
90
|
-
const h = operator(expr);
|
|
91
|
-
if (h === "KeyValuePair" || h === "Tuple" || h === "Pair") {
|
|
92
|
-
const [k, v] = operands(expr);
|
|
93
|
-
const key = stringValue(k);
|
|
94
|
-
if (!key) return null;
|
|
95
|
-
return [key, v ?? "Nothing"];
|
|
96
|
-
}
|
|
97
|
-
return null;
|
|
98
|
-
}
|
|
99
|
-
function dictionary(expr) {
|
|
100
|
-
if (expr === null) return null;
|
|
101
|
-
const kv = keyValuePair(expr);
|
|
102
|
-
if (kv) return { [kv[0]]: kv[1] };
|
|
103
|
-
const h = operator(expr);
|
|
104
|
-
if (h === "Dictionary") {
|
|
105
|
-
const result = {};
|
|
106
|
-
const ops = operands(expr);
|
|
107
|
-
for (let i = 1; i < nops(expr); i++) {
|
|
108
|
-
const kv2 = keyValuePair(ops[i]);
|
|
109
|
-
if (kv2) result[kv2[0]] = kv2[1];
|
|
110
|
-
}
|
|
111
|
-
return result;
|
|
112
|
-
}
|
|
113
|
-
return null;
|
|
114
|
-
}
|
|
115
|
-
function mapArgs(expr, fn) {
|
|
116
|
-
let args = null;
|
|
117
|
-
if (Array.isArray(expr)) args = expr;
|
|
118
|
-
if (isFunctionObject(expr)) args = expr.fn;
|
|
119
|
-
if (args === null) return [];
|
|
120
|
-
let i = 1;
|
|
121
|
-
const result = [];
|
|
122
|
-
while (i < args.length) {
|
|
123
|
-
result.push(fn(args[i]));
|
|
124
|
-
i += 1;
|
|
125
|
-
}
|
|
126
|
-
return result;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
// src/math-json.ts
|
|
130
|
-
var version = "0.27.0";
|
|
131
|
-
return __toCommonJS(math_json_exports);
|
|
132
|
-
})();
|
|
133
|
-
Object.assign(exports, MathJson); Object.defineProperty(exports, '__esModule', { value: true });}));
|
package/dist/math-json.min.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
/** MathJSON 0.27.0 */
|
|
2
|
-
(function(global,factory){typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'],factory):(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.MathJson = {}));})(this, (function (exports) { 'use strict';
|
|
3
|
-
var MathJson=(()=>{var f=Object.defineProperty;var M=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var N=Object.prototype.hasOwnProperty;var A=(n,t)=>{for(var e in t)f(n,e,{get:t[e],enumerable:!0})},p=(n,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of S(t))!N.call(n,i)&&i!==e&&f(n,i,{get:()=>t[i],enumerable:!(r=M(t,i))||r.enumerable});return n};var J=n=>p(f({},"__esModule",{value:!0}),n);var O={};A(O,{getDictionary:()=>g,getStringValue:()=>c,isFunctionObject:()=>u,isStringObject:()=>y,isSymbolObject:()=>a,mapArgs:()=>h,operand:()=>E,operator:()=>o,symbol:()=>b,version:()=>I});function a(n){return n!==null&&typeof n=="object"&&"sym"in n}function y(n){return n!==null&&typeof n=="object"&&"str"in n}function u(n){return n!==null&&typeof n=="object"&&"fn"in n}function c(n){return n==null?null:typeof n=="object"&&"str"in n?n.str:typeof n!="string"||n.length<2||n.at(0)!=="'"||n.at(-1)!=="'"?null:n.substring(1,n.length-1)}function o(n){return Array.isArray(n)?n[0]:n==null?"":u(n)?n.fn[0]:""}function m(n){return Array.isArray(n)?n.slice(1):n!==void 0&&u(n)?n.fn.slice(1):[]}function E(n,t){return Array.isArray(n)?n[t]??null:n===null||!u(n)?null:n.fn[t]??null}function j(n){return n==null?0:Array.isArray(n)?Math.max(0,n.length-1):u(n)?Math.max(0,n.fn.length-1):0}function b(n){if(typeof n=="string")return/^[+-]?[0-9\.]/.test(n)||n.length>=2&&n[0]==="'"&&n[n.length-1]==="'"?null:n;if(n==null)return null;let t=a(n)?n.sym:n;return typeof t!="string"?null:t}function d(n){let t=o(n);if(t==="KeyValuePair"||t==="Tuple"||t==="Pair"){let[e,r]=m(n),i=c(e);return i?[i,r??"Nothing"]:null}return null}function g(n){if(n===null)return null;let t=d(n);if(t)return{[t[0]]:t[1]};if(o(n)==="Dictionary"){let r={},i=m(n);for(let l=1;l<j(n);l++){let s=d(i[l]);s&&(r[s[0]]=s[1])}return r}return null}function h(n,t){let e=null;if(Array.isArray(n)&&(e=n),u(n)&&(e=n.fn),e===null)return[];let r=1,i=[];for(;r<e.length;)i.push(t(e[r])),r+=1;return i}var I="0.27.0";return J(O);})();
|
|
4
|
-
Object.assign(exports, MathJson); Object.defineProperty(exports, '__esModule', { value: true });}));
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/* 0.27.0 */
|
|
2
|
-
fg?: string;
|
|
3
|
-
bg?: string;
|
|
4
|
-
weight?: 'bold' | 'normal' | 'thin';
|
|
5
|
-
italic?: boolean;
|
|
6
|
-
mono?: boolean;
|
|
7
|
-
content: string;
|
|
8
|
-
};
|
|
9
|
-
/** A paragraph block has a blank line before and after
|
|
10
|
-
* and is wrapped to the width of the terminal.
|
|
11
|
-
*
|
|
12
|
-
* A 'block' is rendered as is, with no wrapping, but possibly
|
|
13
|
-
* with an indent. Used for code blocks, tables.
|
|
14
|
-
*
|
|
15
|
-
* A `blockquote` is a block with a vertical bar on the left,
|
|
16
|
-
* and is wrapped to the available width.
|
|
17
|
-
*
|
|
18
|
-
* A `note`, `warning` or `error` is an admonition block with a
|
|
19
|
-
* colored background or border (blue, orange or red).
|
|
20
|
-
*
|
|
21
|
-
*/
|
|
22
|
-
export type StyledBlock = {
|
|
23
|
-
tag: 'paragraph' | 'block';
|
|
24
|
-
spans: StyledSpan[];
|
|
25
|
-
} | {
|
|
26
|
-
tag: 'blockquote' | 'note' | 'warning' | 'error';
|
|
27
|
-
blocks: StyledBlock[];
|
|
28
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/* 0.27.0 */
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/* 0.27.0 */
|
|
2
|
-
import { StyledBlock, StyledSpan } from './styled-text';
|
|
3
|
-
export type CodeTag =
|
|
4
|
-
/** Plain text in default foreground/background color */
|
|
5
|
-
'default'
|
|
6
|
-
/** A literal such as a number, string or regex */
|
|
7
|
-
| 'literal'
|
|
8
|
-
/** A comment */
|
|
9
|
-
| 'comment'
|
|
10
|
-
/** A language keyword: if, while, export */
|
|
11
|
-
| 'keyword'
|
|
12
|
-
/** An operator such as =, >=, +, etc... */
|
|
13
|
-
| 'operator'
|
|
14
|
-
/** A punctuation such as `;`, `,`, `:` */
|
|
15
|
-
| 'punctuation'
|
|
16
|
-
/** An identifier such as "foo" or "bar" */
|
|
17
|
-
| 'identifier'
|
|
18
|
-
/** A type such as `boolean` or `number` */
|
|
19
|
-
| 'type';
|
|
20
|
-
export type CodeSpan = {
|
|
21
|
-
tag: CodeTag;
|
|
22
|
-
content: string;
|
|
23
|
-
};
|
|
24
|
-
export type SyntaxGrammar = {
|
|
25
|
-
comment?: (buf: Buffer) => undefined | CodeSpan;
|
|
26
|
-
number?: (buf: Buffer) => undefined | CodeSpan;
|
|
27
|
-
string?: (buf: Buffer) => undefined | CodeSpan;
|
|
28
|
-
regex?: (buf: Buffer) => undefined | CodeSpan;
|
|
29
|
-
identifier?: (buf: Buffer) => undefined | CodeSpan;
|
|
30
|
-
keyword?: (buf: Buffer) => undefined | CodeSpan;
|
|
31
|
-
};
|
|
32
|
-
export declare function parseCode(text: string, grammar?: SyntaxGrammar, pos?: number): CodeSpan[];
|
|
33
|
-
/** Return a style span of the input code */
|
|
34
|
-
export declare function highlightCodeSpan(code: string, grammar?: SyntaxGrammar): StyledSpan[];
|
|
35
|
-
/** Return a style block of the input code, including a
|
|
36
|
-
* gutter with line numbers and an optional highlighted line
|
|
37
|
-
*/
|
|
38
|
-
export declare function highlightCodeBlock(code: string, lineStart?: number | undefined, markIndicator?: string, grammar?: SyntaxGrammar): StyledBlock;
|
|
39
|
-
export declare function mark(line: StyledSpan[], mark: string): StyledSpan[];
|
|
40
|
-
/** JS sample */
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/* 0.27.0 */
|
|
2
|
-
declare abstract class Terminal {
|
|
3
|
-
width: number | undefined;
|
|
4
|
-
indent: number;
|
|
5
|
-
constructor(options?: {
|
|
6
|
-
indent?: number;
|
|
7
|
-
width?: number;
|
|
8
|
-
});
|
|
9
|
-
renderBlock(block: StyledBlock): string;
|
|
10
|
-
abstract renderSpan(span: StyledSpan): string;
|
|
11
|
-
renderSpans(s: StyledSpan[]): string;
|
|
12
|
-
display(s: StyledSpan[] | StyledBlock): void;
|
|
13
|
-
}
|
|
14
|
-
export declare const terminal: Terminal;
|
|
15
|
-
/** Word-wrap a string that contains ANSI escape sequences.
|
|
16
|
-
* ANSI escape sequences do not add to the string length.
|
|
17
|
-
*/
|
|
18
|
-
export declare const wrapAnsiString: (string: string, width: number | undefined) => string[];
|
|
19
|
-
export {};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/* 0.27.0 */
|
|
2
|
-
/**
|
|
3
|
-
* Canonical form of 'Divide' (and 'Rational')
|
|
4
|
-
* - remove denominator of 1
|
|
5
|
-
* - simplify the signs
|
|
6
|
-
* - factor out negate (make the numerator and denominator positive)
|
|
7
|
-
* - if numerator and denominator are integer literals, return a rational number
|
|
8
|
-
* or Rational expression
|
|
9
|
-
* - evaluate number literals
|
|
10
|
-
*/
|
|
11
|
-
export declare function canonicalDivide(op1: BoxedExpression, op2: BoxedExpression): BoxedExpression;
|
|
12
|
-
export declare function div(num: BoxedExpression, denom: number | BoxedExpression): BoxedExpression;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/* 0.27.0 */
|
|
2
|
-
/**
|
|
3
|
-
* The canonical form of `Multiply`:
|
|
4
|
-
* - removes `1` anb `-1`
|
|
5
|
-
* - simplifies the signs:
|
|
6
|
-
* - i.e. `-y \times -x` -> `x \times y`
|
|
7
|
-
* - `2 \times -x` -> `-2 \times x`
|
|
8
|
-
* - arguments are sorted
|
|
9
|
-
* - complex numbers promoted (['Multiply', 2, 'ImaginaryUnit'] -> 2i)
|
|
10
|
-
* - Numeric values are promoted (['Multiply', 2, 'Sqrt', 3] -> 2√3)
|
|
11
|
-
*
|
|
12
|
-
* The input ops may not be canonical, the result is canonical.
|
|
13
|
-
*/
|
|
14
|
-
export declare function canonicalMultiply(ce: IComputeEngine, ops: ReadonlyArray<BoxedExpression>): BoxedExpression;
|
|
15
|
-
export declare function mul(...xs: ReadonlyArray<BoxedExpression>): BoxedExpression;
|
|
16
|
-
export declare function mulN(...xs: ReadonlyArray<BoxedExpression>): BoxedExpression;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/* 0.27.0 */
|
|
2
|
-
export type BigNum = Decimal;
|
|
3
|
-
export interface IBigNum {
|
|
4
|
-
readonly _BIGNUM_NAN: BigNum;
|
|
5
|
-
readonly _BIGNUM_ZERO: BigNum;
|
|
6
|
-
readonly _BIGNUM_ONE: BigNum;
|
|
7
|
-
readonly _BIGNUM_TWO: BigNum;
|
|
8
|
-
readonly _BIGNUM_HALF: BigNum;
|
|
9
|
-
readonly _BIGNUM_PI: BigNum;
|
|
10
|
-
readonly _BIGNUM_NEGATIVE_ONE: BigNum;
|
|
11
|
-
bignum(value: string | number | bigint | BigNum): BigNum;
|
|
12
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/* 0.27.0 */
|
|
2
|
-
import './compute-engine';
|
|
3
|
-
import './debug';
|
|
4
|
-
import './boxed-expression/expression-map';
|
|
5
|
-
import './boxed-expression/abstract-boxed-expression';
|
|
6
|
-
import './boxed-expression/boxed-function';
|
|
7
|
-
import './boxed-expression/boxed-number';
|
|
8
|
-
import './boxed-expression/boxed-patterns';
|
|
9
|
-
import './boxed-expression/boxed-string';
|
|
10
|
-
import './boxed-expression/order';
|
|
11
|
-
import './boxed-expression/utils';
|
|
12
|
-
import './boxed-expression/serialize';
|
|
13
|
-
import './boxed-expression/rules';
|
|
14
|
-
import './symbolic/simplify-rules';
|
|
15
|
-
import './boxed-expression/solve';
|
|
16
|
-
export * from './assume';
|
|
17
|
-
export * from './boxed-expression/expression-map';
|
|
18
|
-
export * from './boxed-expression/abstract-boxed-expression';
|
|
19
|
-
export * from './boxed-expression/boxed-function';
|
|
20
|
-
export * from './boxed-expression/boxed-number';
|
|
21
|
-
export * from './boxed-expression/boxed-patterns';
|
|
22
|
-
export * from './boxed-expression/boxed-string';
|
|
23
|
-
export * from './boxed-expression/order';
|
|
24
|
-
export * from './boxed-expression/utils';
|
|
25
|
-
export * from './compute-engine';
|
|
26
|
-
export * from './debug';
|
|
27
|
-
export * from './boxed-expression/rules';
|
|
28
|
-
export * from './symbolic/simplify-rules';
|
|
29
|
-
export * from './boxed-expression/solve';
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/* 0.27.0 */
|
|
2
|
-
*
|
|
3
|
-
* The Compute Engine is a symbolic computation engine that can be used to
|
|
4
|
-
* manipulate and evaluate mathematical expressions.
|
|
5
|
-
*
|
|
6
|
-
* Use an instance of {@linkcode ComputeEngine} to create boxed expressions
|
|
7
|
-
* with {@linkcode ComputeEngine.parse} and {@linkcode ComputeEngine.box}.
|
|
8
|
-
*
|
|
9
|
-
* Use a {@linkcode BoxedExpression} object to manipulate and evaluate
|
|
10
|
-
* mathematical expressions.
|
|
11
|
-
*
|
|
12
|
-
* @module "compute-engine"
|
|
13
|
-
*
|
|
14
|
-
*/
|
|
15
|
-
import type { OneOf } from '../common/one-of';
|
|
16
|
-
import type { FunctionDefinition, SemiBoxedExpression, SymbolDefinition } from './boxed-expression/public';
|
|
17
|
-
export * from './boxed-expression/public';
|
|
18
|
-
/**
|
|
19
|
-
* A table mapping identifiers to their definition.
|
|
20
|
-
*
|
|
21
|
-
* Identifiers should be valid MathJSON identifiers. In addition, the
|
|
22
|
-
* following rules are recommended:
|
|
23
|
-
*
|
|
24
|
-
* - Use only latin letters, digits and `-`: `/[a-zA-Z0-9-]+/`
|
|
25
|
-
* - The first character should be a letter: `/^[a-zA-Z]/`
|
|
26
|
-
* - Functions and symbols exported from a library should start with an uppercase letter `/^[A-Z]/`
|
|
27
|
-
*
|
|
28
|
-
* @category Definitions
|
|
29
|
-
*
|
|
30
|
-
*/
|
|
31
|
-
export type IdentifierDefinition = OneOf<[
|
|
32
|
-
SymbolDefinition,
|
|
33
|
-
FunctionDefinition,
|
|
34
|
-
SemiBoxedExpression
|
|
35
|
-
]>;
|
|
36
|
-
/**
|
|
37
|
-
* @category Definitions
|
|
38
|
-
*
|
|
39
|
-
*/
|
|
40
|
-
export type IdentifierDefinitions = Readonly<{
|
|
41
|
-
[id: string]: IdentifierDefinition;
|
|
42
|
-
}>;
|