@tradecanvas/core 0.1.2 → 0.1.3
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/LICENSE +21 -0
- package/dist/features/ChartState.d.ts.map +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/package.json +16 -9
package/dist/index.js
CHANGED
|
@@ -865,7 +865,7 @@ var k = class {
|
|
|
865
865
|
addIndicator(e, t = {}, n) {
|
|
866
866
|
let r = this.registry.get(e);
|
|
867
867
|
if (!r) throw Error(`Unknown indicator: ${e}`);
|
|
868
|
-
let i =
|
|
868
|
+
let i = `tc_${e}_${he++}`, a = {
|
|
869
869
|
id: e,
|
|
870
870
|
instanceId: i,
|
|
871
871
|
params: {
|
|
@@ -2695,7 +2695,7 @@ var He = class {
|
|
|
2695
2695
|
}, r = this.listeners.get(e);
|
|
2696
2696
|
if (r) for (let e of r) e(n);
|
|
2697
2697
|
if (this.tauriBridge?.enabled && window.__TAURI__) {
|
|
2698
|
-
let t = this.tauriBridge.eventPrefix ?? "chart";
|
|
2698
|
+
let t = this.tauriBridge.eventPrefix ?? "tc-chart";
|
|
2699
2699
|
window.__TAURI__.event.emit(`${t}:${e}`, n).catch(() => {});
|
|
2700
2700
|
}
|
|
2701
2701
|
}
|
|
@@ -2968,7 +2968,7 @@ var He = class {
|
|
|
2968
2968
|
let t = this.drawings.find((t) => t.id === e);
|
|
2969
2969
|
if (!t) return null;
|
|
2970
2970
|
let n = structuredClone(t);
|
|
2971
|
-
return n.id = `
|
|
2971
|
+
return n.id = `tc_drawing_${Ue++}`, n.anchors = n.anchors.map((e) => ({
|
|
2972
2972
|
...e,
|
|
2973
2973
|
time: e.time + 3
|
|
2974
2974
|
})), n.locked = !1, this.drawings.push(n), this.undoRedo?.push({
|
|
@@ -3010,7 +3010,7 @@ var He = class {
|
|
|
3010
3010
|
if (!n) return !1;
|
|
3011
3011
|
let r = x(e.x, t), i = S(e.y, t), a = this.snapToOHLC(r, i, t);
|
|
3012
3012
|
return this.creatingDrawing ? (this.creatingDrawing.anchors.push(a), this.committedAnchors++, this.previewAnchor = null, this.committedAnchors >= n.descriptor.requiredAnchors && this.finalizeCreation(), this.requestRender?.(), !0) : (this.creatingDrawing = {
|
|
3013
|
-
id: `
|
|
3013
|
+
id: `tc_drawing_${Ue++}`,
|
|
3014
3014
|
type: this.activeTool,
|
|
3015
3015
|
anchors: [a],
|
|
3016
3016
|
style: { ...this.activeStyle },
|
|
@@ -4807,7 +4807,7 @@ var vt = class {
|
|
|
4807
4807
|
this.pricePrecision = e;
|
|
4808
4808
|
}
|
|
4809
4809
|
addAlert(e, t = "crossing", n, r = !1) {
|
|
4810
|
-
let i = `
|
|
4810
|
+
let i = `tc_alert_${Lt++}`, a = {
|
|
4811
4811
|
id: i,
|
|
4812
4812
|
price: e,
|
|
4813
4813
|
condition: t,
|
|
@@ -4976,7 +4976,7 @@ var vt = class {
|
|
|
4976
4976
|
let t = localStorage.getItem(e);
|
|
4977
4977
|
return t ? this.deserialize(t) : null;
|
|
4978
4978
|
}
|
|
4979
|
-
static downloadFile(e, t = "chart-state.json") {
|
|
4979
|
+
static downloadFile(e, t = "tc-chart-state.json") {
|
|
4980
4980
|
let n = new Blob([this.serialize(e)], { type: "application/json" }), r = URL.createObjectURL(n), i = document.createElement("a");
|
|
4981
4981
|
i.href = r, i.download = t, document.body.appendChild(i), i.click(), document.body.removeChild(i), URL.revokeObjectURL(r);
|
|
4982
4982
|
}
|