@@ -15,15 +15,15 @@ const themeMap = new Map([
1515 [
1616 'light' ,
1717 {
18- expressionVisualizerStyle : 'background-color: #fff;' ,
19- } ,
18+ expressionVisualizerStyle : 'background-color: #fff;'
19+ }
2020 ] ,
2121 [
2222 'dark' ,
2323 {
24- expressionVisualizerStyle : 'background-color: #000;' ,
25- } ,
26- ] ,
24+ expressionVisualizerStyle : 'background-color: #000;'
25+ }
26+ ]
2727] ) ;
2828
2929const operatorMap = new Map ( [
@@ -42,7 +42,7 @@ const operatorMap = new Map([
4242 [ 'and' , 'and' ] ,
4343 [ 'or' , 'or' ] ,
4444 [ 'xor' , 'xor' ] ,
45- [ 'not' , 'not' ] ,
45+ [ 'not' , 'not' ]
4646] ) ;
4747
4848const funcMap = new Map ( [ [ 'equalText' , true ] ] ) ;
@@ -109,7 +109,10 @@ function _handleDragOver(e: DragEvent) {
109109async function _initMath ( ) {
110110 // math
111111 if ( ! ( window as any ) . math ) {
112- await loadScript ( 'https://unpkg.com/[email protected] /lib/browser/math.js' ) ; 112+ // await loadScript('https://unpkg.com/[email protected] /lib/browser/math.js'); 113+ await loadScript (
114+ 'https://mega-automation.oss-cn-hongkong.aliyuncs.com/lib/unpkg.com_mathjs%4011.8.0_lib_browser_math.js'
115+ ) ;
113116 }
114117
115118 const hasMath = ! ! ( window as any ) . math ;
@@ -269,7 +272,7 @@ export class ExpressionVisualizerWebComponent extends LitElement {
269272 { name : 'and' } ,
270273 { name : 'or' } ,
271274 { name : 'xor' } ,
272- { name : 'not' } ,
275+ { name : 'not' }
273276 ] ;
274277
275278 @property ( { type : Array } ) funcs : {
@@ -313,13 +316,13 @@ export class ExpressionVisualizerWebComponent extends LitElement {
313316 const detail = {
314317 expression : this . _expression ,
315318 result : this . _result ,
316- errMsg : this . _errMsg ,
319+ errMsg : this . _errMsg
317320 } ;
318321 const event = new CustomEvent ( 'expression-changed' , {
319322 detail,
320323 bubbles : true ,
321324 composed : true ,
322- cancelable : true ,
325+ cancelable : true
323326 } ) ;
324327 this . dispatchEvent ( event ) ;
325328 }
@@ -458,19 +461,19 @@ export class ExpressionVisualizerWebComponent extends LitElement {
458461 this . constantList . push ( value ) ;
459462 const event = new CustomEvent ( 'variableList-changed' , {
460463 detail : {
461- constantList : this . constantList ,
464+ constantList : this . constantList
462465 } ,
463466 bubbles : true ,
464467 composed : true ,
465- cancelable : true ,
468+ cancelable : true
466469 } ) ;
467470 this . dispatchEvent ( event ) ;
468471 }
469472
470473 const block = {
471474 type : 'ConstantNode' ,
472475 value,
473- uuid : uuidv4 ( ) ,
476+ uuid : uuidv4 ( )
474477 } ;
475478
476479 this . _blocks = [ block , ...this . _blocks ] ;
@@ -504,7 +507,7 @@ export class ExpressionVisualizerWebComponent extends LitElement {
504507 const block = {
505508 type : 'ConstantNode' ,
506509 value,
507- uuid : uuidv4 ( ) ,
510+ uuid : uuidv4 ( )
508511 } ;
509512
510513 this . _blocks = [ block , ...this . _blocks ] ;
@@ -538,10 +541,10 @@ export class ExpressionVisualizerWebComponent extends LitElement {
538541 uuid : uuidv4 ( ) ,
539542 isUnknown : true ,
540543 path : 'args[0]' ,
541- index : 0 ,
542- } ,
544+ index : 0
545+ }
543546 ] ,
544- type : 'OperatorNode' ,
547+ type : 'OperatorNode'
545548 } ;
546549 } else {
547550 block = {
@@ -557,18 +560,18 @@ export class ExpressionVisualizerWebComponent extends LitElement {
557560 uuid : uuidv4 ( ) ,
558561 isUnknown : true ,
559562 path : 'args[0]' ,
560- index : 0 ,
563+ index : 0
561564 } ,
562565 {
563566 type : 'ConstantNode' ,
564567 value : 'U' ,
565568 uuid : uuidv4 ( ) ,
566569 isUnknown : true ,
567570 path : 'args[1]' ,
568- index : 1 ,
569- } ,
571+ index : 1
572+ }
570573 ] ,
571- type : 'OperatorNode' ,
574+ type : 'OperatorNode'
572575 } ;
573576 }
574577
@@ -587,7 +590,7 @@ export class ExpressionVisualizerWebComponent extends LitElement {
587590 implicit : false ,
588591 isPercentage : false ,
589592 fn : {
590- name,
593+ name
591594 } ,
592595 args : [
593596 {
@@ -596,18 +599,18 @@ export class ExpressionVisualizerWebComponent extends LitElement {
596599 uuid : uuidv4 ( ) ,
597600 isUnknown : true ,
598601 path : 'args[0]' ,
599- index : 0 ,
602+ index : 0
600603 } ,
601604 {
602605 type : 'ConstantNode' ,
603606 value : 'U' ,
604607 uuid : uuidv4 ( ) ,
605608 isUnknown : true ,
606609 path : 'args[1]' ,
607- index : 1 ,
608- } ,
610+ index : 1
611+ }
609612 ] ,
610- type : 'FunctionNode' ,
613+ type : 'FunctionNode'
611614 } ;
612615
613616 this . _blocks = [ block , ...this . _blocks ] ;
@@ -623,7 +626,7 @@ export class ExpressionVisualizerWebComponent extends LitElement {
623626 const block = {
624627 type : 'SymbolNode' ,
625628 name,
626- uuid : uuidv4 ( ) ,
629+ uuid : uuidv4 ( )
627630 } ;
628631
629632 this . _blocks = [ block , ...this . _blocks ] ;
@@ -646,23 +649,23 @@ export class ExpressionVisualizerWebComponent extends LitElement {
646649 uuid : uuidv4 ( ) ,
647650 path : 'args[0]' ,
648651 index : 0 ,
649- name : variable . name ,
652+ name : variable . name
650653 } ,
651654 {
652655 type : 'ConstantNode' ,
653656 value : variable . test ,
654657 uuid : uuidv4 ( ) ,
655658 path : 'args[1]' ,
656- index : 1 ,
657- } ,
659+ index : 1
660+ }
658661 ] ,
659662 fn : {
660- name : variable . isFn ,
663+ name : variable . isFn
661664 } ,
662665 implicit : false ,
663666 isPercentage : false ,
664667 type : 'FunctionNode' ,
665- uuid : uuidv4 ( ) ,
668+ uuid : uuidv4 ( )
666669 } ;
667670 } else {
668671 block = {
@@ -677,17 +680,17 @@ export class ExpressionVisualizerWebComponent extends LitElement {
677680 uuid : uuidv4 ( ) ,
678681 path : 'args[0]' ,
679682 index : 0 ,
680- name : variable . name ,
683+ name : variable . name
681684 } ,
682685 {
683686 type : 'ConstantNode' ,
684687 value : variable . test ,
685688 uuid : uuidv4 ( ) ,
686689 path : 'args[1]' ,
687- index : 1 ,
688- } ,
690+ index : 1
691+ }
689692 ] ,
690- type : 'OperatorNode' ,
693+ type : 'OperatorNode'
691694 } ;
692695 }
693696
@@ -729,7 +732,7 @@ export class ExpressionVisualizerWebComponent extends LitElement {
729732 uuid : uuidv4 ( ) ,
730733 isUnknown : true ,
731734 path,
732- index,
735+ index
733736 } ) ;
734737 this . _blocks = blocks ;
735738 } else {
@@ -764,7 +767,7 @@ export class ExpressionVisualizerWebComponent extends LitElement {
764767 uuid : uuidv4 ( ) ,
765768 isUnknown : true ,
766769 path : node ! . path ,
767- index : node ! . index ! ,
770+ index : node ! . index !
768771 } ) ;
769772
770773 // e.target 一定是class="expression-visualizer" 的 div
@@ -810,7 +813,7 @@ export class ExpressionVisualizerWebComponent extends LitElement {
810813 detail,
811814 bubbles : true ,
812815 composed : true ,
813- cancelable : true ,
816+ cancelable : true
814817 } ) ;
815818 this . dispatchEvent ( event ) ;
816819 } ) ;
@@ -874,11 +877,11 @@ export class ExpressionVisualizerWebComponent extends LitElement {
874877 }
875878 const event = new CustomEvent ( 'variableList-changed' , {
876879 detail : {
877- constantList : this . constantList ,
880+ constantList : this . constantList
878881 } ,
879882 bubbles : true ,
880883 composed : true ,
881- cancelable : true ,
884+ cancelable : true
882885 } ) ;
883886 this . dispatchEvent ( event ) ;
884887 }
0 commit comments