@luxalgo/vela 0.7.6 → 0.7.8
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/NOTICE +28 -28
- package/dist/{chunk-EMB53WNQ.js → chunk-M6GP7DAX.js} +123 -36
- package/dist/{chunk-JSVCWYBF.js → chunk-N4ZZYLMP.js} +2409 -896
- package/dist/{chunk-ZADTVRUO.js → chunk-PVGWNF7V.js} +1 -1
- package/dist/{chunk-BKHSQ4YM.js → chunk-WTWGEB7K.js} +23 -9
- package/dist/{contributions-D6p1RB38.d.cts → contributions-DF_Ea07m.d.cts} +17 -0
- package/dist/{contributions-C7Wsm_S9.d.ts → contributions-nKOSeLy8.d.ts} +17 -0
- package/dist/index.cjs +2416 -902
- package/dist/index.d.cts +37 -6
- package/dist/index.d.ts +37 -6
- package/dist/index.js +2 -2
- package/dist/{plugin-CxWfg6vK.d.cts → plugin-6F04gjQe.d.cts} +23 -23
- package/dist/{plugin-SodaQhjQ.d.ts → plugin-BLsNipkc.d.ts} +23 -23
- package/dist/plugin.d.cts +2 -2
- package/dist/plugin.d.ts +2 -2
- package/dist/{statusline-model-gWHrsOy3.d.cts → statusline-model-BoWJ3cWQ.d.cts} +16 -3
- package/dist/{statusline-model-xBiVsKoE.d.ts → statusline-model-DAFyqVmR.d.ts} +16 -3
- package/dist/ui.cjs +23 -9
- package/dist/ui.d.cts +19 -2
- package/dist/ui.d.ts +19 -2
- package/dist/ui.js +2 -2
- package/dist/vela.global.js +2420 -906
- package/dist/vela.global.min.js +65 -55
- package/dist/widget.cjs +2549 -935
- package/dist/widget.d.cts +5 -5
- package/dist/widget.d.ts +5 -5
- package/dist/widget.js +5 -5
- package/dist/workspace.cjs +2549 -935
- package/dist/workspace.d.cts +35 -6
- package/dist/workspace.d.ts +35 -6
- package/dist/workspace.js +4 -4
- package/package.json +21 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { normalizeProps, nextUid, runMachine, spreadProps } from './chunk-
|
|
1
|
+
import { normalizeProps, nextUid, runMachine, spreadProps } from './chunk-WTWGEB7K.js';
|
|
2
2
|
import { injectStyles } from './chunk-CAFCLMPF.js';
|
|
3
3
|
import * as tooltip from '@zag-js/tooltip';
|
|
4
4
|
import * as dialog from '@zag-js/dialog';
|
|
@@ -2177,7 +2177,8 @@ function addRecent(hex6) {
|
|
|
2177
2177
|
recents.unshift(hex6);
|
|
2178
2178
|
if (recents.length > 10) recents.length = 10;
|
|
2179
2179
|
}
|
|
2180
|
-
function buildColorPicker(color, theme, onChange) {
|
|
2180
|
+
function buildColorPicker(color, theme, onChange, options = {}) {
|
|
2181
|
+
const commit = options.commit ?? "live";
|
|
2181
2182
|
const parsed = splitColor(color);
|
|
2182
2183
|
let curHex = parsed.hex6;
|
|
2183
2184
|
let curAlpha = parsed.alpha;
|
|
@@ -2260,7 +2261,12 @@ function buildColorPicker(color, theme, onChange) {
|
|
|
2260
2261
|
const r = track.getBoundingClientRect();
|
|
2261
2262
|
curAlpha = Math.max(0, Math.min(1, (clientX - r.left) / r.width));
|
|
2262
2263
|
paintOpacity();
|
|
2263
|
-
emit();
|
|
2264
|
+
if (commit === "live") emit();
|
|
2265
|
+
};
|
|
2266
|
+
const endDrag = () => {
|
|
2267
|
+
if (!dragging) return;
|
|
2268
|
+
dragging = false;
|
|
2269
|
+
if (commit === "release") emit();
|
|
2264
2270
|
};
|
|
2265
2271
|
track.addEventListener("pointerdown", (e) => {
|
|
2266
2272
|
e.stopPropagation();
|
|
@@ -2271,7 +2277,8 @@ function buildColorPicker(color, theme, onChange) {
|
|
|
2271
2277
|
track.addEventListener("pointermove", (e) => {
|
|
2272
2278
|
if (dragging) onDrag(e.clientX);
|
|
2273
2279
|
});
|
|
2274
|
-
track.addEventListener("pointerup",
|
|
2280
|
+
track.addEventListener("pointerup", endDrag);
|
|
2281
|
+
track.addEventListener("pointercancel", endDrag);
|
|
2275
2282
|
function emit() {
|
|
2276
2283
|
onChange(combineColor(curHex, curAlpha));
|
|
2277
2284
|
}
|
|
@@ -2294,7 +2301,7 @@ function buildColorPicker(color, theme, onChange) {
|
|
|
2294
2301
|
return root;
|
|
2295
2302
|
}
|
|
2296
2303
|
function colorField(theme, getVal, onVal, opts) {
|
|
2297
|
-
return new ColorField({ theme, getVal, onVal, shape: opts?.shape, id: opts?.id, popover: opts?.popover }).el;
|
|
2304
|
+
return new ColorField({ theme, getVal, onVal, shape: opts?.shape, id: opts?.id, popover: opts?.popover, commit: opts?.commit }).el;
|
|
2298
2305
|
}
|
|
2299
2306
|
var ColorField = class {
|
|
2300
2307
|
constructor(opts) {
|
|
@@ -2303,6 +2310,7 @@ var ColorField = class {
|
|
|
2303
2310
|
this.getVal = opts.getVal;
|
|
2304
2311
|
this.onVal = opts.onVal;
|
|
2305
2312
|
this.popoverOpts = opts.popover;
|
|
2313
|
+
this.commit = opts.commit;
|
|
2306
2314
|
const trigger = document.createElement("button");
|
|
2307
2315
|
trigger.type = "button";
|
|
2308
2316
|
if (opts.id) trigger.id = opts.id;
|
|
@@ -2342,10 +2350,15 @@ var ColorField = class {
|
|
|
2342
2350
|
boundary: this.popoverOpts?.boundary,
|
|
2343
2351
|
zIndex: this.popoverOpts?.zIndex,
|
|
2344
2352
|
className: "vela-color-field-pop",
|
|
2345
|
-
content: buildColorPicker(
|
|
2346
|
-
this.
|
|
2347
|
-
this.
|
|
2348
|
-
|
|
2353
|
+
content: buildColorPicker(
|
|
2354
|
+
this.getVal(),
|
|
2355
|
+
this.theme,
|
|
2356
|
+
(val) => {
|
|
2357
|
+
this.onVal(val);
|
|
2358
|
+
this.paint();
|
|
2359
|
+
},
|
|
2360
|
+
{ commit: this.commit }
|
|
2361
|
+
)
|
|
2349
2362
|
});
|
|
2350
2363
|
pop.show();
|
|
2351
2364
|
}
|
|
@@ -2829,7 +2842,8 @@ function buildFieldControl(desc) {
|
|
|
2829
2842
|
const el2 = colorField(desc.theme, desc.get, desc.onChange, {
|
|
2830
2843
|
shape: "circle",
|
|
2831
2844
|
id: desc.id,
|
|
2832
|
-
popover: desc.popover
|
|
2845
|
+
popover: desc.popover,
|
|
2846
|
+
commit: desc.commit
|
|
2833
2847
|
});
|
|
2834
2848
|
if (desc.title) el2.title = desc.title;
|
|
2835
2849
|
return { el: el2 };
|
|
@@ -47,6 +47,23 @@ interface StrategyTrade {
|
|
|
47
47
|
exit?: StrategyFill;
|
|
48
48
|
/** Still open at the last computed bar. */
|
|
49
49
|
open: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Realized P&L of this round trip in account currency, net of commission. Absent
|
|
52
|
+
* while the trade is open, and for an engine that reports no per-trade ledger.
|
|
53
|
+
*/
|
|
54
|
+
pnl?: number;
|
|
55
|
+
/** Commission charged on this trade, in account currency. */
|
|
56
|
+
commission?: number;
|
|
57
|
+
/**
|
|
58
|
+
* Worst / best unrealized excursion of THIS trade from its entry, in account
|
|
59
|
+
* currency (positive magnitudes). Read `maxDrawdown` as the adverse excursion and
|
|
60
|
+
* `maxRunup` as the favorable one — the per-trade counterparts of the account-level
|
|
61
|
+
* {@link StrategyState.maxDrawdown} / {@link StrategyState.maxRunup}. An engine
|
|
62
|
+
* defines the exact convention (intrabar extremes, commission handling); absent when
|
|
63
|
+
* it does not track them.
|
|
64
|
+
*/
|
|
65
|
+
maxDrawdown?: number;
|
|
66
|
+
maxRunup?: number;
|
|
50
67
|
}
|
|
51
68
|
/** One side of a {@link StrategyTrade}. */
|
|
52
69
|
interface StrategyFill {
|
|
@@ -47,6 +47,23 @@ interface StrategyTrade {
|
|
|
47
47
|
exit?: StrategyFill;
|
|
48
48
|
/** Still open at the last computed bar. */
|
|
49
49
|
open: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Realized P&L of this round trip in account currency, net of commission. Absent
|
|
52
|
+
* while the trade is open, and for an engine that reports no per-trade ledger.
|
|
53
|
+
*/
|
|
54
|
+
pnl?: number;
|
|
55
|
+
/** Commission charged on this trade, in account currency. */
|
|
56
|
+
commission?: number;
|
|
57
|
+
/**
|
|
58
|
+
* Worst / best unrealized excursion of THIS trade from its entry, in account
|
|
59
|
+
* currency (positive magnitudes). Read `maxDrawdown` as the adverse excursion and
|
|
60
|
+
* `maxRunup` as the favorable one — the per-trade counterparts of the account-level
|
|
61
|
+
* {@link StrategyState.maxDrawdown} / {@link StrategyState.maxRunup}. An engine
|
|
62
|
+
* defines the exact convention (intrabar extremes, commission handling); absent when
|
|
63
|
+
* it does not track them.
|
|
64
|
+
*/
|
|
65
|
+
maxDrawdown?: number;
|
|
66
|
+
maxRunup?: number;
|
|
50
67
|
}
|
|
51
68
|
/** One side of a {@link StrategyTrade}. */
|
|
52
69
|
interface StrategyFill {
|