@guihz/trading-vue-editor-tes 0.1.8 → 0.1.10

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.
@@ -1,5 +1,5 @@
1
1
  var Yd = (n, e) => () => (e || n((e = { exports: {} }).exports, e), e.exports);
2
- var xg = Yd((jE, q2) => {
2
+ var Cg = Yd((GE, q2) => {
3
3
  /**
4
4
  * @license
5
5
  * Copyright 2019 Google LLC
@@ -75039,7 +75039,8 @@ ${this._prefixNameVar}.setCacheData("m${O}_" + ${m}, ${q})
75039
75039
  requestLowerTfPeriodErr: "The chart's timeframe must be greater or equal to the `$period` timeframe used with `request.security_lower_tf()`.",
75040
75040
  optionsRepeatErr: "options have to be unique, but there is at least one duplicate in options. Duplicated values: $option",
75041
75041
  scriptLongTimeErr: "Script execution takes too long, the limit is 40 seconds",
75042
- plotFillForceOverlayErr: "Cannot call `fill()` with two plots that may not show in the same pane. Both plots must have the same `force_overlay` value."
75042
+ plotFillForceOverlayErr: "Cannot call `fill()` with two plots that may not show in the same pane. Both plots must have the same `force_overlay` value.",
75043
+ constModifyErr: "A variable declared with the `const` type form cannot be modified"
75043
75044
  }, vt = {
75044
75045
  repeatVar: "Shadowing variable '$name' which exists in parent scope. Did you want to use the ':=' operator instead of '=' ?",
75045
75046
  typeMismatch: "The `$index` parameter of the `$operator` function accepts a '$type' argument. To avoid potential unexpected results, pass a '$type' value or expression to this parameter.",
@@ -75051,7 +75052,15 @@ ${this._prefixNameVar}.setCacheData("m${O}_" + ${m}, ${q})
75051
75052
  lineWidthWarning: "Passing a value below 1 to `linewidth` will be replaced with 1 during compilation.",
75052
75053
  boolVarNumWarning: "The `$name` variable casts a numeric value to the 'bool' type. To avoid potential unexpected results, assign a 'bool' value to this variable.",
75053
75054
  transpDeprecatedTips: "The `transp` argument is deprecated. We recommend using color.new() or color.rgb() functions to specify the transparency of the plots instead. Additionally, note that `transp` has no effect in plots where the color is calculated at runtime"
75054
- }, Ir = [
75055
+ }, mg = [
75056
+ D.LINE,
75057
+ D.LINEFILL,
75058
+ D.POLYLINE,
75059
+ D.CHART_POINT,
75060
+ D.TABLE,
75061
+ D.BOX,
75062
+ D.LABEL
75063
+ ], Ir = [
75055
75064
  D.SERIES,
75056
75065
  D.SIMPLE,
75057
75066
  D.INPUT,
@@ -75074,7 +75083,7 @@ ${this._prefixNameVar}.setCacheData("m${O}_" + ${m}, ${q})
75074
75083
  "barcolor",
75075
75084
  "bgcolor",
75076
75085
  "fill"
75077
- ], mg = [
75086
+ ], _g = [
75078
75087
  ...HM,
75079
75088
  "indicator",
75080
75089
  "library",
@@ -75085,7 +75094,7 @@ ${this._prefixNameVar}.setCacheData("m${O}_" + ${m}, ${q})
75085
75094
  "strategy.risk.max_intraday_filled_orders",
75086
75095
  "strategy.risk.max_intraday_loss",
75087
75096
  "strategy.risk.max_position_size"
75088
- ], _g = [
75097
+ ], qg = [
75089
75098
  ...HM,
75090
75099
  "table.new",
75091
75100
  "label.new",
@@ -75093,7 +75102,7 @@ ${this._prefixNameVar}.setCacheData("m${O}_" + ${m}, ${q})
75093
75102
  "box.new",
75094
75103
  "polyline.new",
75095
75104
  "linefill.new"
75096
- ], qg = [
75105
+ ], yg = [
75097
75106
  "strategy.entry",
75098
75107
  "strategy.order",
75099
75108
  "strategy.exit",
@@ -75120,7 +75129,7 @@ ${this._prefixNameVar}.setCacheData("m${O}_" + ${m}, ${q})
75120
75129
  "hlcc4",
75121
75130
  "ohlc4",
75122
75131
  "volume"
75123
- ], yg = /^\/\/\s*@(description|field|function|param|returns|type|enum|variable)/, Ne = [
75132
+ ], gg = /^\/\/\s*@(description|field|function|param|returns|type|enum|variable)/, Ne = [
75124
75133
  "case",
75125
75134
  "catch",
75126
75135
  "default",
@@ -75231,7 +75240,7 @@ ${this._prefixNameVar}.setCacheData("m${O}_" + ${m}, ${q})
75231
75240
  var e = encodeURI(n), t = btoa(e);
75232
75241
  return t;
75233
75242
  }
75234
- class gg extends El {
75243
+ class Eg extends El {
75235
75244
  /**
75236
75245
  * Visit a parse tree produced by `tccScriptParser.program`.
75237
75246
  * @param ctx the parse tree
@@ -75661,7 +75670,7 @@ ${this._prefixNameVar}.setCacheData("m${O}_" + ${m}, ${q})
75661
75670
  */
75662
75671
  visitEnumElement;
75663
75672
  }
75664
- class Eg extends gg {
75673
+ class Rg extends Eg {
75665
75674
  _buildinVariables;
75666
75675
  _buildinTypes;
75667
75676
  _buildinConstants;
@@ -75847,7 +75856,7 @@ ${this._prefixNameVar}.setCacheData("m${O}_" + ${m}, ${q})
75847
75856
  return t = this._removePrefix(t), this._isMapType(t) || this._isMatrixType(t) ? t : this._isArrayType(t) ? this._arrayTypeConvert(t) : (t = e.startsWith(D.SERIES) ? e.replace("<type>", t) : e.replace("type", t), r || (t = this._removePrefix(t)), this._arrayTypeConvert(t));
75848
75857
  }
75849
75858
  }
75850
- class dh extends Eg {
75859
+ class dh extends Rg {
75851
75860
  _loopCount;
75852
75861
  _errors;
75853
75862
  _variables;
@@ -76073,7 +76082,7 @@ ${this._prefixNameVar}.setCacheData("m${O}_" + ${m}, ${q})
76073
76082
  if (o && this._errorHandle(d0(O0.buidinAssignErr, { name: r }), t), !i)
76074
76083
  return;
76075
76084
  const c = this._currentBlockVars[0].get(r);
76076
- if (!c)
76085
+ if (c.prefix === D.CONST && this._errorHandle(O0.constModifyErr, t), !c)
76077
76086
  return;
76078
76087
  const { column: b, lineNumber: O } = c.pos || {};
76079
76088
  this._isInFunc && b === i.column && O === i.lineNumber ? this._errorHandle(d0(O0.modifyGlobalVarErr, { name: r }), t) : c.hasAssigned = !0;
@@ -76238,7 +76247,7 @@ ${this._prefixNameVar}.setCacheData("m${O}_" + ${m}, ${q})
76238
76247
  _commentsParser = (e, t, r = !1) => {
76239
76248
  const i = this._comments.filter((O) => O.line < e && O.line >= this._currentLine), o = {}, c = { line: 0, key: "", secKey: "" }, b = [Me.field, Me.param];
76240
76249
  for (const O of i) {
76241
- const [m, y] = yg.exec(O.text) || [];
76250
+ const [m, y] = gg.exec(O.text) || [];
76242
76251
  if (y && t.includes(y)) {
76243
76252
  const q = O.text.replace(m, "").trim();
76244
76253
  if (Object.assign(c, { line: O.line, key: y }), b.includes(y)) {
@@ -77005,7 +77014,7 @@ ${this._prefixNameVar}.setCacheData("m${O}_" + ${m}, ${q})
77005
77014
  }
77006
77015
  }
77007
77016
  const O = r.join("");
77008
- return _g.includes(O) ? this._hasDrawFunc = !0 : qg.includes(O) && (this._hasCreateOrderFunc = !0), [O, i, c, b];
77017
+ return qg.includes(O) ? this._hasDrawFunc = !0 : yg.includes(O) && (this._hasCreateOrderFunc = !0), [O, i, c, b];
77009
77018
  };
77010
77019
  visitArrowFunction = (e) => {
77011
77020
  const { children: t, start: r, stop: i } = e, o = {
@@ -77775,12 +77784,12 @@ ${this._prefixNameVar}.setCacheData("m${O}_" + ${m}, ${q})
77775
77784
  const o = i?.type || i?.returnedTypes?.[0];
77776
77785
  (i?.types?.isBrackethesized || i?.returnedTypes?.isBrackethesized || i?.types?.length > 1) && this._errorHandle(d0(O0.tupleLeftVarErr, {
77777
77786
  name: r.name
77778
- }), t), !r.type && o === `${D.SIMPLE} ${D.NA}` && this._errorHandle(O0.naVarErr, t), r.prefix && Ir.indexOf(r.prefix) > Ir.indexOf(this._getPrefix(o)) && this._errorHandle(d0(O0.declaredErr, {
77787
+ }), t), !r.type && o === `${D.SIMPLE} ${D.NA}` && this._errorHandle(O0.naVarErr, t), r.prefix && !mg.includes(this._removePrefix(o)) && Ir.indexOf(r.prefix) > Ir.indexOf(this._getPrefix(o)) && this._errorHandle(d0(O0.declaredErr, {
77779
77788
  prefix: r.prefix,
77780
77789
  type: o
77781
77790
  }), t);
77782
77791
  const c = this._varTypeJudge(r.type, o || D.UNDETERMINED, r.name, t);
77783
- r.type = c, this._addVarToMap(r.name, c, r.pos, !0, r.isForVar, r.declare, i?.type, r.desc);
77792
+ r.type = c, this._addVarToMap(r.name, c, r.pos, !0, r.isForVar, r.declare, i?.type, r.desc, r.prefix);
77784
77793
  }
77785
77794
  }
77786
77795
  _checkVarMultiple(e, t, r) {
@@ -77803,21 +77812,22 @@ ${this._prefixNameVar}.setCacheData("m${O}_" + ${m}, ${q})
77803
77812
  };
77804
77813
  i.set(e, c), this._currentBlockVars[this._blockCount] = i;
77805
77814
  }
77806
- _addVarToMap(e, t, r, i = !0, o = !1, c, b, O) {
77807
- const m = this._currentBlockVars[this._blockCount] || /* @__PURE__ */ new Map(), y = this._types.get(t)?.[0];
77808
- if (y && y.fields)
77809
- for (const v of y.fields) {
77810
- const N = `${e}.${v.name}`;
77811
- m.set(N, { ...v, name: N });
77815
+ _addVarToMap(e, t, r, i = !0, o = !1, c, b, O, m) {
77816
+ const y = this._currentBlockVars[this._blockCount] || /* @__PURE__ */ new Map(), q = this._types.get(t)?.[0];
77817
+ if (q && q.fields)
77818
+ for (const N of q.fields) {
77819
+ const S = `${e}.${N.name}`;
77820
+ y.set(S, { ...N, name: S });
77812
77821
  }
77813
- const q = {
77822
+ const v = {
77814
77823
  name: e,
77815
77824
  type: t,
77816
77825
  pos: r,
77817
77826
  valueType: b,
77818
- desc: O
77827
+ desc: O,
77828
+ prefix: m
77819
77829
  };
77820
- i && this._setVariablesMap(q), m.set(e, Object.assign(q, { isForVar: o, declare: c })), this._currentBlockVars[this._blockCount] = m;
77830
+ i && this._setVariablesMap(v), y.set(e, Object.assign(v, { isForVar: o, declare: c })), this._currentBlockVars[this._blockCount] = y;
77821
77831
  }
77822
77832
  _setVariablesMap(e, t = !1) {
77823
77833
  const r = this._blockRanges[this._blockCount];
@@ -78039,7 +78049,7 @@ ${this._prefixNameVar}.setCacheData("m${O}_" + ${m}, ${q})
78039
78049
  }), t[0]), r;
78040
78050
  }
78041
78051
  _globalFuncVerify(e, t) {
78042
- this._blockCount !== 0 && mg.includes(e.name) && this._errorHandle(d0(O0.globalFuncErr, {
78052
+ this._blockCount !== 0 && _g.includes(e.name) && this._errorHandle(d0(O0.globalFuncErr, {
78043
78053
  name: e.name
78044
78054
  }), t);
78045
78055
  }
@@ -78761,7 +78771,7 @@ ${this._prefixNameVar}.setCacheData("m${O}_" + ${m}, ${q})
78761
78771
  return [D.UNDETERMINED];
78762
78772
  }
78763
78773
  }
78764
- class Rg {
78774
+ class Wg {
78765
78775
  _nameMap;
78766
78776
  _argChangeMap;
78767
78777
  // 用户自定义方法传入参数会改变的参数索引
@@ -79608,7 +79618,7 @@ ${this._prefixNameVar}.setCacheData("m${O}_" + ${m}, ${q})
79608
79618
  })()`;
79609
79619
  }
79610
79620
  }
79611
- class Wg {
79621
+ class vg {
79612
79622
  _nameMap;
79613
79623
  _prefixNameVar;
79614
79624
  _prefixNameFunc;
@@ -80423,7 +80433,7 @@ ${this._prefixNameVar}.setCacheData("m${O}_" + ${m}, ${q})
80423
80433
  t.removeErrorListeners();
80424
80434
  const r = new Al(t), i = new T(r);
80425
80435
  i._interp.predictionMode = vl.SLL, i.removeErrorListeners();
80426
- const o = new Lg();
80436
+ const o = new Sg();
80427
80437
  t.addErrorListener(o), i.addErrorListener(o), i.buildParseTrees = !0;
80428
80438
  const c = i.program(), b = r.tokens.filter((O) => O.channel === 2);
80429
80439
  return {
@@ -80432,15 +80442,16 @@ ${this._prefixNameVar}.setCacheData("m${O}_" + ${m}, ${q})
80432
80442
  comments: b
80433
80443
  };
80434
80444
  }
80435
- async function vg(n, e, t, r) {
80445
+ async function Tg(n, e, t, r) {
80436
80446
  const { errors: i, ast: o, comments: c } = Ah(n + `
80437
80447
 
80438
80448
  `), b = new dh(r, c, t), O = await b.visit(o);
80439
80449
  let m = i.splice(0, 1);
80440
80450
  m.length || (m = b.errors);
80441
80451
  let y = "";
80442
- const q = new Rg("_$");
80452
+ const q = new Wg("_$");
80443
80453
  let v = e ? "" : q.preParser(O);
80454
+ console.log(v);
80444
80455
  const N = {};
80445
80456
  if (e && !m.some((S) => S.type === Pe.Error)) {
80446
80457
  const { code: S = "", hasLeftVisibleBarTime: _, hasRightVisibleBarTime: z } = q.parser(O) || {};
@@ -80506,17 +80517,17 @@ ${this._prefixNameVar}.setCacheData("m${O}_" + ${m}, ${q})
80506
80517
  config: N
80507
80518
  };
80508
80519
  }
80509
- async function Tg(n, e, t, r) {
80520
+ async function Lg(n, e, t, r) {
80510
80521
  const { ast: i, comments: o } = Ah(n + `
80511
80522
 
80512
- `), c = new dh(r, o, t), b = await c.visit(i), { name: O, index: m } = c.endExport, y = b.findIndex((_) => _.name === O && _.index === m), q = b.slice(0, y + 1), N = new Wg("$", e).parser(q) || "", S = await Ep(N, { compress: !0, mangle: !0 });
80523
+ `), c = new dh(r, o, t), b = await c.visit(i), { name: O, index: m } = c.endExport, y = b.findIndex((_) => _.name === O && _.index === m), q = b.slice(0, y + 1), N = new vg("$", e).parser(q) || "", S = await Ep(N, { compress: !0, mangle: !0 });
80513
80524
  return {
80514
80525
  ...c.exportLibs,
80515
80526
  description: c.description,
80516
80527
  codeStr: S.code || ""
80517
80528
  };
80518
80529
  }
80519
- class Lg extends ml {
80530
+ class Sg extends ml {
80520
80531
  errors = [];
80521
80532
  syntaxError(e, t, r, i, o) {
80522
80533
  this.errors.push({
@@ -80529,15 +80540,15 @@ ${this._prefixNameVar}.setCacheData("m${O}_" + ${m}, ${q})
80529
80540
  });
80530
80541
  }
80531
80542
  }
80532
- async function Sg(n, e, t, r, i) {
80533
- return i === 3 ? (console.log("parseTccV3"), Oy(n, e, r)) : i === 4 ? (console.log("parseTccV4"), Yy(n, e, r)) : (console.log("parseTccV5"), vg(n, e, t, r));
80543
+ async function Ng(n, e, t, r, i) {
80544
+ return i === 3 ? (console.log("parseTccV3"), Oy(n, e, r)) : i === 4 ? (console.log("parseTccV4"), Yy(n, e, r)) : (console.log("parseTccV5"), Tg(n, e, t, r));
80534
80545
  }
80535
- async function Ng(n, e, t, r) {
80536
- return Tg(n, e, t, r);
80546
+ async function xg(n, e, t, r) {
80547
+ return Lg(n, e, t, r);
80537
80548
  }
80538
80549
  hl({
80539
- parseTcc: Sg,
80540
- parseLibraryCode: Ng
80550
+ parseTcc: Ng,
80551
+ parseLibraryCode: xg
80541
80552
  });
80542
80553
  });
80543
- export default xg();
80554
+ export default Cg();