@guihz/trading-vue-editor-tes 0.0.98 → 0.0.99

Sign up to get free protection for your applications and to get access to all the features.
@@ -26,6 +26,7 @@ export interface IBoxArgs {
26
26
  color?: string;
27
27
  point?: Point;
28
28
  width?: number;
29
+ index?: number;
29
30
  }
30
31
  type VBoxArgs = Omit<IBoxArgs, 'id'> & {
31
32
  id: Box;
@@ -71,7 +72,9 @@ export declare class Box {
71
72
  private _id;
72
73
  private _variables;
73
74
  private _errorListener;
75
+ private _index;
74
76
  constructor(variables: BuiltInVariables, key: string, errorListener: TccErrorListener);
77
+ set index(index: number);
75
78
  copy(posStr: string): Box;
76
79
  delete(): void;
77
80
  get_top(): number | undefined;
@@ -16,6 +16,7 @@ interface ILabelArgs {
16
16
  textcolor: string;
17
17
  tooltip: string;
18
18
  text_font_family: string;
19
+ index: number;
19
20
  }
20
21
  export type PartialLabelArgs = Partial<ILabelArgs>;
21
22
  type TLabelArgs = Omit<PartialLabelArgs, 'id'> & {
@@ -56,7 +57,9 @@ export declare class Label {
56
57
  private _id;
57
58
  private _variables;
58
59
  private _errorListener;
60
+ private _index;
59
61
  constructor(key: string, variables: BuiltInVariables, errorListener: TccErrorListener);
62
+ set index(index: number);
60
63
  copy(posStr: string): Label;
61
64
  get_x(posStr: string): number | undefined;
62
65
  get_y(posStr: string): number | undefined;
@@ -18,6 +18,7 @@ export interface ILineArgs {
18
18
  style?: VLineStyle;
19
19
  width?: number;
20
20
  linefills?: string[];
21
+ index?: number;
21
22
  }
22
23
  type LineArgs = Omit<ILineArgs, 'id'> & {
23
24
  id: Line;
@@ -58,8 +59,10 @@ export declare class Line {
58
59
  private _variables;
59
60
  private _id;
60
61
  private _errorListener;
62
+ private _index;
61
63
  constructor(key: string, variables: BuiltInVariables, errorListener: TccErrorListener);
62
64
  get data(): ILineArgs | undefined;
65
+ set index(index: number);
63
66
  copy(posStr: string): Line;
64
67
  delete(): void;
65
68
  get_price({ x }: ILineArgs, posStr: string): number | undefined;
@@ -5,6 +5,7 @@ interface ILinefillArgs {
5
5
  line1?: Line;
6
6
  line2?: Line;
7
7
  color?: string;
8
+ index?: number;
8
9
  }
9
10
  export type TLinefill = Omit<ILinefillArgs, 'line1' | 'line2' | 'id'> & {
10
11
  id: string;
@@ -25,7 +26,9 @@ export declare class Linefill {
25
26
  private _line1?;
26
27
  private _line2?;
27
28
  private _variables;
29
+ private _index;
28
30
  constructor(variables: BuiltInVariables, key: string, line1?: Line, line2?: Line);
31
+ set index(index: number);
29
32
  linefill(args: {
30
33
  x?: Linefill;
31
34
  }, posStr: string): Linefill;
@@ -11,6 +11,7 @@ export interface IPolyline {
11
11
  fill_color?: string;
12
12
  line_style?: VLineStyle;
13
13
  line_width?: number;
14
+ index?: number;
14
15
  }
15
16
  type TPolylineArgs = Omit<IPolyline, 'id'> & {
16
17
  id: Polyline;
@@ -28,7 +29,9 @@ export default class BuildInPolyline {
28
29
  export declare class Polyline {
29
30
  private _id;
30
31
  private _variables;
32
+ private _index;
31
33
  constructor(key: string, variables: BuiltInVariables);
34
+ set index(index: number);
32
35
  delete(): void;
33
36
  }
34
37
  export {};
@@ -17,6 +17,7 @@ export interface ITableArgs {
17
17
  start_row?: number;
18
18
  end_column?: number;
19
19
  end_row?: number;
20
+ index?: number;
20
21
  }
21
22
  interface ITableCellArgs {
22
23
  table_id?: Table;
@@ -71,8 +72,10 @@ export declare class Table {
71
72
  private _id;
72
73
  private _variables;
73
74
  private _errorListener;
75
+ private _index;
74
76
  private _defaultCell;
75
77
  constructor(variables: BuiltInVariables, key: string, errorListener: TccErrorListener);
78
+ set index(index: number);
76
79
  cell(args: ITableCellArgs): void;
77
80
  cell_set_bgcolor({ column, row, bgcolor }: ITableCellArgs): void;
78
81
  cell_set_height({ column, row, height }: ITableCellArgs): void;
@@ -67519,14 +67519,14 @@ function ar(a, n, r) {
67519
67519
  function lh() {
67520
67520
  return new Array(4).fill(0).map(() => Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(16)).join("-");
67521
67521
  }
67522
- const Fp = new Worker(new URL("" + new URL("assets/scriptsRunWorker-CgIm6yWg.js", import.meta.url).href, import.meta.url), { type: "module", name: "Run TccScript Server" });
67522
+ const Fp = new Worker(new URL("" + new URL("assets/scriptsRunWorker-C4tBpFa1.js", import.meta.url).href, import.meta.url), { type: "module", name: "Run TccScript Server" });
67523
67523
  Fp.onerror = (a) => {
67524
67524
  console.error(a);
67525
67525
  };
67526
67526
  async function Rp(a) {
67527
67527
  return await Ja.setInlayHints(a);
67528
67528
  }
67529
- const Bp = Hi(Fp), Kp = Hi(new Worker(new URL("" + new URL("assets/parserTccWorker-C_GCg1II.js", import.meta.url).href, import.meta.url), { type: "module", name: "Parser TccScript Server" }));
67529
+ const Bp = Hi(Fp), Kp = Hi(new Worker(new URL("" + new URL("assets/parserTccWorker-ChPWymni.js", import.meta.url).href, import.meta.url), { type: "module", name: "Parser TccScript Server" }));
67530
67530
  async function ch(a, n = !1) {
67531
67531
  const { functions: r, types: o, constants: c, variables: l, methods: m } = bt;
67532
67532
  return await Kp.parseTcc(a, n, ji(Rp), { functions: Object.fromEntries(r), methods: Object.fromEntries(m), types: Object.fromEntries(o), constants: Object.fromEntries(c), variables: Object.fromEntries(l) });
@@ -141,7 +141,7 @@ function print() { __p += __j.call(arguments, '') }
141
141
  * @license
142
142
  * Copyright 2019 Google LLC
143
143
  * SPDX-License-Identifier: Apache-2.0
144
- */const _o=Symbol("Comlink.proxy"),nm=Symbol("Comlink.endpoint"),im=Symbol("Comlink.releaseProxy"),yn=Symbol("Comlink.finalizer"),Ys=Symbol("Comlink.thrown"),fo=a=>typeof a=="object"&&a!==null||typeof a=="function",om={canHandle:a=>fo(a)&&a[_o],serialize(a){const{port1:n,port2:s}=new MessageChannel;return bo(a,n),[s,[s]]},deserialize(a){return a.start(),_n(a)}},lm={canHandle:a=>fo(a)&&Ys in a,serialize({value:a}){let n;return a instanceof Error?n={isError:!0,value:{message:a.message,name:a.name,stack:a.stack}}:n={isError:!1,value:a},[n,[]]},deserialize(a){throw a.isError?Object.assign(new Error(a.value.message),a.value):a.value}},go=new Map([["proxy",om],["throw",lm]]);function cm(a,n){for(const s of a)if(n===s||s==="*"||s instanceof RegExp&&s.test(n))return!0;return!1}function bo(a,n=globalThis,s=["*"]){n.addEventListener("message",function o(c){if(!c||!c.data)return;if(!cm(s,c.origin)){console.warn(`Invalid origin '${c.origin}' for comlink proxy`);return}const{id:l,type:m,path:_}=Object.assign({path:[]},c.data),g=(c.data.argumentList||[]).map(gr);let b;try{const h=_.slice(0,-1).reduce((M,U)=>M[U],a),T=_.reduce((M,U)=>M[U],a);switch(m){case"GET":b=T;break;case"SET":h[_.slice(-1)[0]]=gr(c.data.value),b=!0;break;case"APPLY":b=T.apply(h,g);break;case"CONSTRUCT":{const M=new T(...g);b=gn(M)}break;case"ENDPOINT":{const{port1:M,port2:U}=new MessageChannel;bo(a,U),b=ym(M,[M])}break;case"RELEASE":b=void 0;break;default:return}}catch(h){b={value:h,[Ys]:0}}Promise.resolve(b).catch(h=>({value:h,[Ys]:0})).then(h=>{const[T,M]=ea(h);n.postMessage(Object.assign(Object.assign({},T),{id:l}),M),m==="RELEASE"&&(n.removeEventListener("message",o),xo(n),yn in a&&typeof a[yn]=="function"&&a[yn]())}).catch(h=>{const[T,M]=ea({value:new TypeError("Unserializable return value"),[Ys]:0});n.postMessage(Object.assign(Object.assign({},T),{id:l}),M)})}),n.start&&n.start()}function pm(a){return a.constructor.name==="MessagePort"}function xo(a){pm(a)&&a.close()}function _n(a,n){return fn(a,[],n)}function Qs(a){if(a)throw new Error("Proxy has been released and is not useable")}function ho(a){return Lr(a,{type:"RELEASE"}).then(()=>{xo(a)})}const Zs=new WeakMap,Js="FinalizationRegistry"in globalThis&&new FinalizationRegistry(a=>{const n=(Zs.get(a)||0)-1;Zs.set(a,n),n===0&&ho(a)});function dm(a,n){const s=(Zs.get(n)||0)+1;Zs.set(n,s),Js&&Js.register(a,n,a)}function mm(a){Js&&Js.unregister(a)}function fn(a,n=[],s=function(){}){let o=!1;const c=new Proxy(s,{get(l,m){if(Qs(o),m===im)return()=>{mm(c),ho(a),o=!0};if(m==="then"){if(n.length===0)return{then:()=>c};const _=Lr(a,{type:"GET",path:n.map(g=>g.toString())}).then(gr);return _.then.bind(_)}return fn(a,[...n,m])},set(l,m,_){Qs(o);const[g,b]=ea(_);return Lr(a,{type:"SET",path:[...n,m].map(h=>h.toString()),value:g},b).then(gr)},apply(l,m,_){Qs(o);const g=n[n.length-1];if(g===nm)return Lr(a,{type:"ENDPOINT"}).then(gr);if(g==="bind")return fn(a,n.slice(0,-1));const[b,h]=wo(_);return Lr(a,{type:"APPLY",path:n.map(T=>T.toString()),argumentList:b},h).then(gr)},construct(l,m){Qs(o);const[_,g]=wo(m);return Lr(a,{type:"CONSTRUCT",path:n.map(b=>b.toString()),argumentList:_},g).then(gr)}});return dm(c,a),c}function um(a){return Array.prototype.concat.apply([],a)}function wo(a){const n=a.map(ea);return[n.map(s=>s[0]),um(n.map(s=>s[1]))]}const vo=new WeakMap;function ym(a,n){return vo.set(a,n),a}function gn(a){return Object.assign(a,{[_o]:!0})}function ea(a){for(const[n,s]of go)if(s.canHandle(a)){const[o,c]=s.serialize(a);return[{type:"HANDLER",name:n,value:o},c]}return[{type:"RAW",value:a},vo.get(a)||[]]}function gr(a){switch(a.type){case"HANDLER":return go.get(a.name).deserialize(a.value);case"RAW":return a.value}}function Lr(a,n,s){return new Promise(o=>{const c=_m();a.addEventListener("message",function l(m){!m.data||!m.data.id||m.data.id!==c||(a.removeEventListener("message",l),o(m.data))}),a.start&&a.start(),a.postMessage(Object.assign({id:c},n),s)})}function _m(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}const To=new Worker(new URL(""+(typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__dirname+"/assets/scriptsRunWorker-CgIm6yWg.js").href:new URL("assets/scriptsRunWorker-CgIm6yWg.js",typeof document>"u"?location.href:document.currentScript&&document.currentScript.src||document.baseURI).href),typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:Us&&Us.src||new URL("trading-vue-editor.umd.cjs",document.baseURI).href),{type:"module",name:"Run TccScript Server"});To.onerror=a=>{console.error(a)};async function Do(a){return await Gs.setInlayHints(a)}const ko=_n(To),Io=_n(new Worker(new URL(""+(typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__dirname+"/assets/parserTccWorker-C_GCg1II.js").href:new URL("assets/parserTccWorker-C_GCg1II.js",typeof document>"u"?location.href:document.currentScript&&document.currentScript.src||document.baseURI).href),typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:Us&&Us.src||new URL("trading-vue-editor.umd.cjs",document.baseURI).href),{type:"module",name:"Parser TccScript Server"}));async function Ao(a,n=!1){const{functions:s,types:o,constants:c,variables:l,methods:m}=lt;return await Io.parseTcc(a,n,gn(Do),{functions:Object.fromEntries(s),methods:Object.fromEntries(m),types:Object.fromEntries(o),constants:Object.fromEntries(c),variables:Object.fromEntries(l)})}async function fm(a,n){const{functions:s,types:o,constants:c,variables:l,methods:m}=lt;return await Io.parseLibraryCode(a,n,gn(Do),{functions:Object.fromEntries(s),methods:Object.fromEntries(m),types:Object.fromEntries(o),constants:Object.fromEntries(c),variables:Object.fromEntries(l)})}async function qo(a,n,s=!0){return await ko.runScript(a,n,s)}async function gm(a){return await ko.removeScript(a)}function bm(a){return new Worker(""+(typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__dirname+"/assets/editor.worker-CT5Cb1wO.js").href:new URL("assets/editor.worker-CT5Cb1wO.js",typeof document>"u"?location.href:document.currentScript&&document.currentScript.src||document.baseURI).href),{name:a==null?void 0:a.name})}self.MonacoEnvironment={getWorker(){return new bm({name:"Editor Worker"})}},sn.config({monaco:pp});let Co={};const xm=(a,n)=>{const{height:s,width:o,theme:c,options:l,hasDiff:m,readOnly:_,defaultValue:g,onChange:b,onLinkOpen:h,onDeclareConfigChange:T,onCursorPositionChange:M,onActionTrigger:U,onEditorDidMount:R}=a,E=F.useRef(null),H=F.useRef(null);F.useImperativeHandle(n,()=>({setOriginalScript(D){var P;(P=E.current)==null||P.setOriginalScript(D)},setScript(D){var P;(P=E.current)==null||P.setValue(D)},gotoLine(){var D;(D=E.current)==null||D.gotoLine()},getEditorLayout(){var D;return(D=E.current)==null?void 0:D.getEditorLayout()},setPosition(D,P){var K;(K=E.current)==null||K.setPosition({column:D,lineNumber:P})},setModelMarkers(D){var P;(P=E.current)==null||P.setModelMarkers(D)}})),F.useEffect(()=>{var D,P;m?(P=E.current)==null||P.addDiffDecorations():(D=E.current)==null||D.removeDiffDecorations()},[m]),F.useEffect(()=>{var D;(D=E.current)==null||D.updateActionTrigger(U)},[U]),F.useEffect(()=>{var D;h&&((D=E.current)==null||D.addLinkOpenFunc(h))},[h]);function Y(D,P){var ne,ae,ie;zt.initBuiltinsTrees(),Gs.setEditor(D),E.current=new am(D,P,U),h&&((ne=E.current)==null||ne.addLinkOpenFunc(h)),m&&((ae=E.current)==null||ae.addDiffDecorations()),zd(D),(ie=E.current)==null||ie.setEditorLayout(Number(s));const K=D.getValue();E.current.onChangeCursorPosition(M),b&&b(K),!_&&G(K),R&&R()}const G=F.useCallback(async D=>{var ht;const P=Date.now(),{errors:K,functions:ne,methods:ae,types:ie,variables:xt,overloadsFuncs:St,imports:$e,preParserCode:Be,enums:Q}=await Ao(D),ge=new Map(Object.entries(ne)),Ne=new Map(Object.entries(ae)),Pe=new Map(Object.entries(ie)),ct=new Map(Object.entries(xt)),Et=new Map(Object.entries($e)),te=new Map(Object.entries(Q));Er.setUserDefined({functions:ge,methods:Ne,types:Pe,variables:ct,imports:Et,enums:te},St),zt.setUserDefind(ge,Pe,ct,Ne,te);const he=K.map(Ae=>({...Ae,severity:Ae.type||ke.MarkerSeverity.Error}));if(_)return;try{if(!K.length&&Be){const Ae=await qo(Be,{isPreParser:!0});io.isEqual(Ae,Co)||(Co=Ae,T&&T(Ae))}}catch(Ae){console.log(Ae),K.push({message:Ae.message,startLineNumber:0,endLineNumber:0,startColumn:0,endColumn:0})}(ht=E.current)==null||ht.setModelMarkers(he);const Fe=Date.now();console.log((Fe-P)/1e3)},[T,_]),B=F.useMemo(()=>io.debounce(G,1500),[G]);function O(D){var P;if(_){G(D||"");return}Gs.clearInlayHints(),(P=E.current)==null||P.setModelMarkers([]),D!==void 0&&(b&&b(D),B(D))}return F.useEffect(()=>{const D=()=>{window.requestAnimationFrame(()=>{var ne,ae;const K=(ne=H.current)==null?void 0:ne.getBoundingClientRect();(ae=E.current)==null||ae.setEditorLayout((K==null?void 0:K.height)||0,K==null?void 0:K.width)})},P=new ResizeObserver(D);return H.current&&P.observe(H.current),()=>{H.current&&P.unobserve(H.current),P.disconnect()}},[]),N.jsx("div",{ref:H,children:N.jsx(xd,{height:s,width:o||"100%",defaultLanguage:Ee,defaultValue:g||`indicator("我的脚本")
144
+ */const _o=Symbol("Comlink.proxy"),nm=Symbol("Comlink.endpoint"),im=Symbol("Comlink.releaseProxy"),yn=Symbol("Comlink.finalizer"),Ys=Symbol("Comlink.thrown"),fo=a=>typeof a=="object"&&a!==null||typeof a=="function",om={canHandle:a=>fo(a)&&a[_o],serialize(a){const{port1:n,port2:s}=new MessageChannel;return bo(a,n),[s,[s]]},deserialize(a){return a.start(),_n(a)}},lm={canHandle:a=>fo(a)&&Ys in a,serialize({value:a}){let n;return a instanceof Error?n={isError:!0,value:{message:a.message,name:a.name,stack:a.stack}}:n={isError:!1,value:a},[n,[]]},deserialize(a){throw a.isError?Object.assign(new Error(a.value.message),a.value):a.value}},go=new Map([["proxy",om],["throw",lm]]);function cm(a,n){for(const s of a)if(n===s||s==="*"||s instanceof RegExp&&s.test(n))return!0;return!1}function bo(a,n=globalThis,s=["*"]){n.addEventListener("message",function o(c){if(!c||!c.data)return;if(!cm(s,c.origin)){console.warn(`Invalid origin '${c.origin}' for comlink proxy`);return}const{id:l,type:m,path:_}=Object.assign({path:[]},c.data),g=(c.data.argumentList||[]).map(gr);let b;try{const h=_.slice(0,-1).reduce((M,U)=>M[U],a),T=_.reduce((M,U)=>M[U],a);switch(m){case"GET":b=T;break;case"SET":h[_.slice(-1)[0]]=gr(c.data.value),b=!0;break;case"APPLY":b=T.apply(h,g);break;case"CONSTRUCT":{const M=new T(...g);b=gn(M)}break;case"ENDPOINT":{const{port1:M,port2:U}=new MessageChannel;bo(a,U),b=ym(M,[M])}break;case"RELEASE":b=void 0;break;default:return}}catch(h){b={value:h,[Ys]:0}}Promise.resolve(b).catch(h=>({value:h,[Ys]:0})).then(h=>{const[T,M]=ea(h);n.postMessage(Object.assign(Object.assign({},T),{id:l}),M),m==="RELEASE"&&(n.removeEventListener("message",o),xo(n),yn in a&&typeof a[yn]=="function"&&a[yn]())}).catch(h=>{const[T,M]=ea({value:new TypeError("Unserializable return value"),[Ys]:0});n.postMessage(Object.assign(Object.assign({},T),{id:l}),M)})}),n.start&&n.start()}function pm(a){return a.constructor.name==="MessagePort"}function xo(a){pm(a)&&a.close()}function _n(a,n){return fn(a,[],n)}function Qs(a){if(a)throw new Error("Proxy has been released and is not useable")}function ho(a){return Lr(a,{type:"RELEASE"}).then(()=>{xo(a)})}const Zs=new WeakMap,Js="FinalizationRegistry"in globalThis&&new FinalizationRegistry(a=>{const n=(Zs.get(a)||0)-1;Zs.set(a,n),n===0&&ho(a)});function dm(a,n){const s=(Zs.get(n)||0)+1;Zs.set(n,s),Js&&Js.register(a,n,a)}function mm(a){Js&&Js.unregister(a)}function fn(a,n=[],s=function(){}){let o=!1;const c=new Proxy(s,{get(l,m){if(Qs(o),m===im)return()=>{mm(c),ho(a),o=!0};if(m==="then"){if(n.length===0)return{then:()=>c};const _=Lr(a,{type:"GET",path:n.map(g=>g.toString())}).then(gr);return _.then.bind(_)}return fn(a,[...n,m])},set(l,m,_){Qs(o);const[g,b]=ea(_);return Lr(a,{type:"SET",path:[...n,m].map(h=>h.toString()),value:g},b).then(gr)},apply(l,m,_){Qs(o);const g=n[n.length-1];if(g===nm)return Lr(a,{type:"ENDPOINT"}).then(gr);if(g==="bind")return fn(a,n.slice(0,-1));const[b,h]=wo(_);return Lr(a,{type:"APPLY",path:n.map(T=>T.toString()),argumentList:b},h).then(gr)},construct(l,m){Qs(o);const[_,g]=wo(m);return Lr(a,{type:"CONSTRUCT",path:n.map(b=>b.toString()),argumentList:_},g).then(gr)}});return dm(c,a),c}function um(a){return Array.prototype.concat.apply([],a)}function wo(a){const n=a.map(ea);return[n.map(s=>s[0]),um(n.map(s=>s[1]))]}const vo=new WeakMap;function ym(a,n){return vo.set(a,n),a}function gn(a){return Object.assign(a,{[_o]:!0})}function ea(a){for(const[n,s]of go)if(s.canHandle(a)){const[o,c]=s.serialize(a);return[{type:"HANDLER",name:n,value:o},c]}return[{type:"RAW",value:a},vo.get(a)||[]]}function gr(a){switch(a.type){case"HANDLER":return go.get(a.name).deserialize(a.value);case"RAW":return a.value}}function Lr(a,n,s){return new Promise(o=>{const c=_m();a.addEventListener("message",function l(m){!m.data||!m.data.id||m.data.id!==c||(a.removeEventListener("message",l),o(m.data))}),a.start&&a.start(),a.postMessage(Object.assign({id:c},n),s)})}function _m(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}const To=new Worker(new URL(""+(typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__dirname+"/assets/scriptsRunWorker-C4tBpFa1.js").href:new URL("assets/scriptsRunWorker-C4tBpFa1.js",typeof document>"u"?location.href:document.currentScript&&document.currentScript.src||document.baseURI).href),typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:Us&&Us.src||new URL("trading-vue-editor.umd.cjs",document.baseURI).href),{type:"module",name:"Run TccScript Server"});To.onerror=a=>{console.error(a)};async function Do(a){return await Gs.setInlayHints(a)}const ko=_n(To),Io=_n(new Worker(new URL(""+(typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__dirname+"/assets/parserTccWorker-ChPWymni.js").href:new URL("assets/parserTccWorker-ChPWymni.js",typeof document>"u"?location.href:document.currentScript&&document.currentScript.src||document.baseURI).href),typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:Us&&Us.src||new URL("trading-vue-editor.umd.cjs",document.baseURI).href),{type:"module",name:"Parser TccScript Server"}));async function Ao(a,n=!1){const{functions:s,types:o,constants:c,variables:l,methods:m}=lt;return await Io.parseTcc(a,n,gn(Do),{functions:Object.fromEntries(s),methods:Object.fromEntries(m),types:Object.fromEntries(o),constants:Object.fromEntries(c),variables:Object.fromEntries(l)})}async function fm(a,n){const{functions:s,types:o,constants:c,variables:l,methods:m}=lt;return await Io.parseLibraryCode(a,n,gn(Do),{functions:Object.fromEntries(s),methods:Object.fromEntries(m),types:Object.fromEntries(o),constants:Object.fromEntries(c),variables:Object.fromEntries(l)})}async function qo(a,n,s=!0){return await ko.runScript(a,n,s)}async function gm(a){return await ko.removeScript(a)}function bm(a){return new Worker(""+(typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__dirname+"/assets/editor.worker-CT5Cb1wO.js").href:new URL("assets/editor.worker-CT5Cb1wO.js",typeof document>"u"?location.href:document.currentScript&&document.currentScript.src||document.baseURI).href),{name:a==null?void 0:a.name})}self.MonacoEnvironment={getWorker(){return new bm({name:"Editor Worker"})}},sn.config({monaco:pp});let Co={};const xm=(a,n)=>{const{height:s,width:o,theme:c,options:l,hasDiff:m,readOnly:_,defaultValue:g,onChange:b,onLinkOpen:h,onDeclareConfigChange:T,onCursorPositionChange:M,onActionTrigger:U,onEditorDidMount:R}=a,E=F.useRef(null),H=F.useRef(null);F.useImperativeHandle(n,()=>({setOriginalScript(D){var P;(P=E.current)==null||P.setOriginalScript(D)},setScript(D){var P;(P=E.current)==null||P.setValue(D)},gotoLine(){var D;(D=E.current)==null||D.gotoLine()},getEditorLayout(){var D;return(D=E.current)==null?void 0:D.getEditorLayout()},setPosition(D,P){var K;(K=E.current)==null||K.setPosition({column:D,lineNumber:P})},setModelMarkers(D){var P;(P=E.current)==null||P.setModelMarkers(D)}})),F.useEffect(()=>{var D,P;m?(P=E.current)==null||P.addDiffDecorations():(D=E.current)==null||D.removeDiffDecorations()},[m]),F.useEffect(()=>{var D;(D=E.current)==null||D.updateActionTrigger(U)},[U]),F.useEffect(()=>{var D;h&&((D=E.current)==null||D.addLinkOpenFunc(h))},[h]);function Y(D,P){var ne,ae,ie;zt.initBuiltinsTrees(),Gs.setEditor(D),E.current=new am(D,P,U),h&&((ne=E.current)==null||ne.addLinkOpenFunc(h)),m&&((ae=E.current)==null||ae.addDiffDecorations()),zd(D),(ie=E.current)==null||ie.setEditorLayout(Number(s));const K=D.getValue();E.current.onChangeCursorPosition(M),b&&b(K),!_&&G(K),R&&R()}const G=F.useCallback(async D=>{var ht;const P=Date.now(),{errors:K,functions:ne,methods:ae,types:ie,variables:xt,overloadsFuncs:St,imports:$e,preParserCode:Be,enums:Q}=await Ao(D),ge=new Map(Object.entries(ne)),Ne=new Map(Object.entries(ae)),Pe=new Map(Object.entries(ie)),ct=new Map(Object.entries(xt)),Et=new Map(Object.entries($e)),te=new Map(Object.entries(Q));Er.setUserDefined({functions:ge,methods:Ne,types:Pe,variables:ct,imports:Et,enums:te},St),zt.setUserDefind(ge,Pe,ct,Ne,te);const he=K.map(Ae=>({...Ae,severity:Ae.type||ke.MarkerSeverity.Error}));if(_)return;try{if(!K.length&&Be){const Ae=await qo(Be,{isPreParser:!0});io.isEqual(Ae,Co)||(Co=Ae,T&&T(Ae))}}catch(Ae){console.log(Ae),K.push({message:Ae.message,startLineNumber:0,endLineNumber:0,startColumn:0,endColumn:0})}(ht=E.current)==null||ht.setModelMarkers(he);const Fe=Date.now();console.log((Fe-P)/1e3)},[T,_]),B=F.useMemo(()=>io.debounce(G,1500),[G]);function O(D){var P;if(_){G(D||"");return}Gs.clearInlayHints(),(P=E.current)==null||P.setModelMarkers([]),D!==void 0&&(b&&b(D),B(D))}return F.useEffect(()=>{const D=()=>{window.requestAnimationFrame(()=>{var ne,ae;const K=(ne=H.current)==null?void 0:ne.getBoundingClientRect();(ae=E.current)==null||ae.setEditorLayout((K==null?void 0:K.height)||0,K==null?void 0:K.width)})},P=new ResizeObserver(D);return H.current&&P.observe(H.current),()=>{H.current&&P.unobserve(H.current),P.disconnect()}},[]),N.jsx("div",{ref:H,children:N.jsx(xd,{height:s,width:o||"100%",defaultLanguage:Ee,defaultValue:g||`indicator("我的脚本")
145
145
  plot(close)
146
146
  `,theme:c||"vs-dark",className:`tvue-script ${c||"vs-dark"}`,options:{colorDecorators:!0,useShadowDOM:!1,matchOnWordStartOnly:!0,automaticLayout:!1,suggest:{filterGraceful:!0},fontSize:13,..._?Rd:{},readOnlyMessage:{value:"该脚本是只读的。它无法被编辑。"},...l},onMount:Y,onChange:O})})},hm=F.forwardRef(xm),wm=a=>{const{theme:n,modified:s,original:o,height:c,width:l,renderSideBySide:m=!0}=a,_=F.useCallback((g,b)=>{b.languages.register({id:Ee}),b.editor.defineTheme("vs-dark",cn),b.editor.defineTheme("vs",ln),b.languages.setMonarchTokensProvider(Ee,Nr),b.languages.setLanguageConfiguration(Ee,on)},[]);return N.jsx(yd,{height:c||"90vh",width:l||"100%",theme:n||"vs-dark",options:{readOnly:!0,renderSideBySide:m,scrollBeyondLastLine:!1},language:Ee,modified:s,original:o,onMount:_})};A.VMarkerSeverity=void 0,function(a){a[a.Hint=1]="Hint",a[a.Info=2]="Info",a[a.Warning=4]="Warning",a[a.Error=8]="Error"}(A.VMarkerSeverity||(A.VMarkerSeverity={}));var ta={},vm=function(){var a=document.getSelection();if(!a.rangeCount)return function(){};for(var n=document.activeElement,s=[],o=0;o<a.rangeCount;o++)s.push(a.getRangeAt(o));switch(n.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":n.blur();break;default:n=null;break}return a.removeAllRanges(),function(){a.type==="Caret"&&a.removeAllRanges(),a.rangeCount||s.forEach(function(c){a.addRange(c)}),n&&n.focus()}},Tm=vm,zo={"text/plain":"Text","text/html":"Url",default:"Text"},Dm="Copy to clipboard: #{key}, Enter";function km(a){var n=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return a.replace(/#{\s*key\s*}/g,n)}function Im(a,n){var s,o,c,l,m,_,g=!1;n||(n={}),s=n.debug||!1;try{c=Tm(),l=document.createRange(),m=document.getSelection(),_=document.createElement("span"),_.textContent=a,_.ariaHidden="true",_.style.all="unset",_.style.position="fixed",_.style.top=0,_.style.clip="rect(0, 0, 0, 0)",_.style.whiteSpace="pre",_.style.webkitUserSelect="text",_.style.MozUserSelect="text",_.style.msUserSelect="text",_.style.userSelect="text",_.addEventListener("copy",function(h){if(h.stopPropagation(),n.format)if(h.preventDefault(),typeof h.clipboardData>"u"){s&&console.warn("unable to use e.clipboardData"),s&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var T=zo[n.format]||zo.default;window.clipboardData.setData(T,a)}else h.clipboardData.clearData(),h.clipboardData.setData(n.format,a);n.onCopy&&(h.preventDefault(),n.onCopy(h.clipboardData))}),document.body.appendChild(_),l.selectNodeContents(_),m.addRange(l);var b=document.execCommand("copy");if(!b)throw new Error("copy command was unsuccessful");g=!0}catch(h){s&&console.error("unable to copy using execCommand: ",h),s&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(n.format||"text",a),n.onCopy&&n.onCopy(window.clipboardData),g=!0}catch(T){s&&console.error("unable to copy using clipboardData: ",T),s&&console.error("falling back to prompt"),o=km("message"in n?n.message:Dm),window.prompt(o,a)}}finally{m&&(typeof m.removeRange=="function"?m.removeRange(l):m.removeAllRanges()),_&&document.body.removeChild(_),c()}return g}var Am=Im;function bn(a){"@babel/helpers - typeof";return bn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},bn(a)}Object.defineProperty(ta,"__esModule",{value:!0}),ta.CopyToClipboard=void 0;var ra=So(F),qm=So(Am),Cm=["text","onCopy","options","children"];function So(a){return a&&a.__esModule?a:{default:a}}function Eo(a,n){var s=Object.keys(a);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(a);n&&(o=o.filter(function(c){return Object.getOwnPropertyDescriptor(a,c).enumerable})),s.push.apply(s,o)}return s}function No(a){for(var n=1;n<arguments.length;n++){var s=arguments[n]!=null?arguments[n]:{};n%2?Eo(Object(s),!0).forEach(function(o){hn(a,o,s[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(s)):Eo(Object(s)).forEach(function(o){Object.defineProperty(a,o,Object.getOwnPropertyDescriptor(s,o))})}return a}function zm(a,n){if(a==null)return{};var s=Sm(a,n),o,c;if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(a);for(c=0;c<l.length;c++)o=l[c],!(n.indexOf(o)>=0)&&Object.prototype.propertyIsEnumerable.call(a,o)&&(s[o]=a[o])}return s}function Sm(a,n){if(a==null)return{};var s={},o=Object.keys(a),c,l;for(l=0;l<o.length;l++)c=o[l],!(n.indexOf(c)>=0)&&(s[c]=a[c]);return s}function Em(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function")}function Lo(a,n){for(var s=0;s<n.length;s++){var o=n[s];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(a,o.key,o)}}function Nm(a,n,s){return n&&Lo(a.prototype,n),s&&Lo(a,s),Object.defineProperty(a,"prototype",{writable:!1}),a}function Lm(a,n){if(typeof n!="function"&&n!==null)throw new TypeError("Super expression must either be null or a function");a.prototype=Object.create(n&&n.prototype,{constructor:{value:a,writable:!0,configurable:!0}}),Object.defineProperty(a,"prototype",{writable:!1}),n&&xn(a,n)}function xn(a,n){return xn=Object.setPrototypeOf||function(o,c){return o.__proto__=c,o},xn(a,n)}function Mm(a){var n=Om();return function(){var o=sa(a),c;if(n){var l=sa(this).constructor;c=Reflect.construct(o,arguments,l)}else c=o.apply(this,arguments);return Pm(this,c)}}function Pm(a,n){if(n&&(bn(n)==="object"||typeof n=="function"))return n;if(n!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Mo(a)}function Mo(a){if(a===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}function Om(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function sa(a){return sa=Object.setPrototypeOf?Object.getPrototypeOf:function(s){return s.__proto__||Object.getPrototypeOf(s)},sa(a)}function hn(a,n,s){return n in a?Object.defineProperty(a,n,{value:s,enumerable:!0,configurable:!0,writable:!0}):a[n]=s,a}var Po=function(a){Lm(s,a);var n=Mm(s);function s(){var o;Em(this,s);for(var c=arguments.length,l=new Array(c),m=0;m<c;m++)l[m]=arguments[m];return o=n.call.apply(n,[this].concat(l)),hn(Mo(o),"onClick",function(_){var g=o.props,b=g.text,h=g.onCopy,T=g.children,M=g.options,U=ra.default.Children.only(T),R=(0,qm.default)(b,M);h&&h(b,R),U&&U.props&&typeof U.props.onClick=="function"&&U.props.onClick(_)}),o}return Nm(s,[{key:"render",value:function(){var c=this.props;c.text,c.onCopy,c.options;var l=c.children,m=zm(c,Cm),_=ra.default.Children.only(l);return ra.default.cloneElement(_,No(No({},m),{},{onClick:this.onClick}))}}]),s}(ra.default.PureComponent);ta.CopyToClipboard=Po,hn(Po,"defaultProps",{onCopy:void 0,options:void 0});var Rm=ta,wn=Rm.CopyToClipboard;wn.CopyToClipboard=wn;var Fm=wn;const vn=dp(Fm);async function Bm(a,n=0){const s=a[n];if(!s)return;const{name:o,args:c,type:l,desc:m,examples:_,remarks:g,seeAlso:b,syntax:h,detailedDesc:T,fields:M,returns:U}=s,R={name:o};if(a.length>1&&(R.overloads=`${a.length} overloads`),l&&(R.type=l),c&&(R.name=`${o}()`,R.args=c.map(E=>{const{name:H,desc:Y,displayType:G}=E;return{label:`${H} (${G})`,desc:Y&&br(Y)}})),m&&(R.desc=m.map(E=>br(E))),_&&(R.originalExample=_.join(`
147
147
  `),R.examples=await ke.editor.colorize(R.originalExample,Ee,{tabSize:4})),T){R.detailedDesc=[];for(const E of T){const{desc:H,examples:Y}=E;let G=H.map(D=>br(D)),B,O;Y&&(O=Y.join(`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@guihz/trading-vue-editor-tes",
3
- "version": "0.0.98",
3
+ "version": "0.0.99",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "lib"