Skip to content

Commit c60475a

Browse files
committed
logs
1 parent a04c518 commit c60475a

File tree

3 files changed

+31
-39
lines changed

3 files changed

+31
-39
lines changed

packages/mathjaxjs/src/index.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ let mathJaxInstance: any = null;
2020

2121
export const getMathJax = () => mathJaxInstance || (globalThis as any).MathJax;
2222

23-
export const loadMathJax = async (callback = () => {}, config = DEFAULT_CONFIG) => {
23+
export const loadMathJax = async (callback = () => { }, config = DEFAULT_CONFIG) => {
2424
if (typeof window === 'undefined') {
2525
callback();
2626
return;
@@ -40,7 +40,6 @@ export const loadMathJax = async (callback = () => {}, config = DEFAULT_CONFIG)
4040
ready: () => {
4141
(globalThis as any).MathJax.startup.defaultReady();
4242
mathJaxInstance = (globalThis as any).MathJax;
43-
console.log('MathJax v3 loaded and initialized successfully');
4443
if (config.startup?.ready) {
4544
config.startup.ready();
4645
}
@@ -60,9 +59,9 @@ export const loadMathJax = async (callback = () => {}, config = DEFAULT_CONFIG)
6059
console.error('Failed to load MathJax v3 from CDN');
6160
callback();
6261
};
63-
62+
6463
document.head.appendChild(script);
65-
64+
6665
} catch (error) {
6766
console.error('Failed to load MathJax v3:', error);
6867
callback();

packages/pstricks/src/lib/pstricks.ts

Lines changed: 28 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -17,45 +17,45 @@ export const Expressions = {
1717
psplot: /\\psplot(\[[^\]]*\])?\{([^\}]*)\}\{([^\}]*)\}\{([^\}]*)\}/,
1818
psarc: new RegExp(
1919
'\\\\psarc' +
20-
RE.options +
21-
RE.type +
22-
RE.coords +
23-
RE.squiggle +
24-
RE.squiggle +
25-
RE.squiggle
20+
RE.options +
21+
RE.type +
22+
RE.coords +
23+
RE.squiggle +
24+
RE.squiggle +
25+
RE.squiggle
2626
),
2727
pscircle: /\\pscircle.*\(\s*(.*),(.*)\s*\)\{(.*)\}/,
2828
pspolygon: new RegExp('\\\\pspolygon' + RE.options + '(.*)'),
2929
psaxes: new RegExp(
3030
'\\\\psaxes' +
31-
RE.options +
32-
RE.type +
33-
RE.coords +
34-
RE.coordsOpt +
35-
RE.coordsOpt
31+
RE.options +
32+
RE.type +
33+
RE.coords +
34+
RE.coordsOpt +
35+
RE.coordsOpt
3636
),
3737
slider: new RegExp(
3838
'\\\\slider' +
39-
RE.options +
40-
RE.squiggle +
41-
RE.squiggle +
42-
RE.squiggle +
43-
RE.squiggle +
44-
RE.squiggle
39+
RE.options +
40+
RE.squiggle +
41+
RE.squiggle +
42+
RE.squiggle +
43+
RE.squiggle +
44+
RE.squiggle
4545
),
4646
psline: new RegExp(
4747
'\\\\psline' + RE.options + RE.type + RE.coords + RE.coordsOpt
4848
),
4949
userline: new RegExp(
5050
'\\\\userline' +
51-
RE.options +
52-
RE.type +
53-
RE.coords +
54-
RE.coords +
55-
RE.squiggleOpt +
56-
RE.squiggleOpt +
57-
RE.squiggleOpt +
58-
RE.squiggleOpt
51+
RE.options +
52+
RE.type +
53+
RE.coords +
54+
RE.coords +
55+
RE.squiggleOpt +
56+
RE.squiggleOpt +
57+
RE.squiggleOpt +
58+
RE.squiggleOpt
5959
),
6060
uservariable: new RegExp(
6161
'\\\\uservariable' + RE.options + RE.squiggle + RE.coords + RE.squiggle
@@ -191,26 +191,21 @@ export const Functions = {
191191
Object.entries(this.variables || {}).forEach(([name, val]) => {
192192
expression += 'var ' + name + ' = ' + val + ';';
193193
});
194-
194+
195195
const mathFunctions = 'var cos=Math.cos,sin=Math.sin,tan=Math.tan,atan=Math.atan,atan2=Math.atan2,exp=Math.exp,log=Math.log,sqrt=Math.sqrt,abs=Math.abs,floor=Math.floor,ceil=Math.ceil,round=Math.round,pow=Math.pow,PI=Math.PI,E=Math.E;';
196196
expression += mathFunctions + 'return ' + m[4] + ';';
197-
198-
console.log('psplot expression setup:', { expression, startX, endX, mathExpression: m[4] });
199-
197+
200198
for (x = startX; x <= endX; x += 0.005) {
201199
data.push(X.call(this, x));
202200
try {
203201
const evalFunc = new Function('x', expression);
204202
const yValue = evalFunc(x);
205-
console.log('psplot evaluation:', { x, yValue, expression: m[4] });
206203
if (yValue !== undefined && !isNaN(yValue)) {
207204
data.push(Y.call(this, yValue));
208205
} else {
209-
console.warn('Invalid yValue:', yValue, 'for x:', x);
210206
data.push(Y.call(this, 0));
211207
}
212208
} catch (err) {
213-
console.warn('Error evaluating expression:', err, { x, expression: m[4] });
214209
data.push(Y.call(this, 0)); // fallback value
215210
}
216211
}
@@ -374,7 +369,7 @@ export const Functions = {
374369
var xExp = m[7];
375370
var yExp = m[8];
376371
const mathFunctions = 'var cos=Math.cos,sin=Math.sin,tan=Math.tan,atan=Math.atan,atan2=Math.atan2,exp=Math.exp,log=Math.log,sqrt=Math.sqrt,abs=Math.abs,floor=Math.floor,ceil=Math.ceil,round=Math.round,pow=Math.pow,PI=Math.PI,E=Math.E;';
377-
372+
378373
if (xExp)
379374
xExp = mathFunctions + xExp.replace(/^\{/, '').replace(/\}$/, '');
380375
if (yExp)

packages/utils/src/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ export const evaluate = function (this: any, exp: string) {
105105
};
106106

107107
export const X = function (this: any, v: number | string) {
108-
console.log('X function called with:', { v, w: this.w, x1: this.x1, xunit: this.xunit });
109108
if (isNaN(this.w) || isNaN(this.x1) || isNaN(this.xunit)) {
110109
console.warn('X function: NaN detected in context properties', { w: this.w, x1: this.x1, xunit: this.xunit });
111110
return 0;
@@ -118,7 +117,6 @@ export const Xinv = function (this: any, v: number | string) {
118117
};
119118

120119
export const Y = function (this: any, v: number | string) {
121-
console.log('Y function called with:', { v, y1: this.y1, yunit: this.yunit });
122120
if (isNaN(this.y1) || isNaN(this.yunit)) {
123121
console.warn('Y function: NaN detected in context properties', { y1: this.y1, yunit: this.yunit });
124122
return 0;

0 commit comments

Comments
 (0)