@tradecanvas/chart 1.72.0 → 1.72.1
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/dist/{LayoutSession-r7Rgc5Sw.cjs → LayoutSession-DO4bYkUi.cjs} +2 -2
- package/dist/{LayoutSession-r7Rgc5Sw.cjs.map → LayoutSession-DO4bYkUi.cjs.map} +1 -1
- package/dist/{LayoutSession-DjHF7tmL.js → LayoutSession-qRYG8GTD.js} +2 -2
- package/dist/{LayoutSession-DjHF7tmL.js.map → LayoutSession-qRYG8GTD.js.map} +1 -1
- package/dist/WidgetCommandPalette-CeCLHPy1.js +177 -0
- package/dist/WidgetCommandPalette-CeCLHPy1.js.map +1 -0
- package/dist/WidgetCommandPalette-ZZNbWwCZ.cjs +2 -0
- package/dist/WidgetCommandPalette-ZZNbWwCZ.cjs.map +1 -0
- package/dist/{WidgetDrawingSettings-MSpeHFhV.js → WidgetDrawingSettings-BeW8fX7r.js} +5 -5
- package/dist/{WidgetDrawingSettings-MSpeHFhV.js.map → WidgetDrawingSettings-BeW8fX7r.js.map} +1 -1
- package/dist/{WidgetDrawingSettings-B3KAH9Ag.cjs → WidgetDrawingSettings-Cyl2u_u8.cjs} +2 -2
- package/dist/{WidgetDrawingSettings-B3KAH9Ag.cjs.map → WidgetDrawingSettings-Cyl2u_u8.cjs.map} +1 -1
- package/dist/WidgetGoToDate-BNdngHlg.cjs +2 -0
- package/dist/{WidgetGoToDate-CPzfStIm.cjs.map → WidgetGoToDate-BNdngHlg.cjs.map} +1 -1
- package/dist/{WidgetGoToDate-R2teTLpJ.js → WidgetGoToDate-hcDtezRm.js} +6 -5
- package/dist/{WidgetGoToDate-R2teTLpJ.js.map → WidgetGoToDate-hcDtezRm.js.map} +1 -1
- package/dist/{WidgetHotkeySheet-BE0glkVA.js → WidgetHotkeySheet-1lRFSdvt.js} +3 -3
- package/dist/{WidgetHotkeySheet-BE0glkVA.js.map → WidgetHotkeySheet-1lRFSdvt.js.map} +1 -1
- package/dist/{WidgetHotkeySheet-pnsXreK6.cjs → WidgetHotkeySheet-y5LWKSG6.cjs} +2 -2
- package/dist/{WidgetHotkeySheet-pnsXreK6.cjs.map → WidgetHotkeySheet-y5LWKSG6.cjs.map} +1 -1
- package/dist/WidgetIndicatorPicker-CGvZ5kYd.js +245 -0
- package/dist/WidgetIndicatorPicker-CGvZ5kYd.js.map +1 -0
- package/dist/WidgetIndicatorPicker-DuKJFPRC.cjs +2 -0
- package/dist/WidgetIndicatorPicker-DuKJFPRC.cjs.map +1 -0
- package/dist/{WidgetIndicatorSettings-BJUjACzj.cjs → WidgetIndicatorSettings-C7vpco6e.cjs} +2 -2
- package/dist/{WidgetIndicatorSettings-BJUjACzj.cjs.map → WidgetIndicatorSettings-C7vpco6e.cjs.map} +1 -1
- package/dist/{WidgetIndicatorSettings-DgbsZk0h.js → WidgetIndicatorSettings-dDkqzzYo.js} +6 -6
- package/dist/{WidgetIndicatorSettings-DgbsZk0h.js.map → WidgetIndicatorSettings-dDkqzzYo.js.map} +1 -1
- package/dist/{WidgetSettings-Pgt3p6vv.cjs → WidgetSettings-D7Pq42zW.cjs} +2 -2
- package/dist/{WidgetSettings-Pgt3p6vv.cjs.map → WidgetSettings-D7Pq42zW.cjs.map} +1 -1
- package/dist/{WidgetSettings-D35fHGXL.js → WidgetSettings-eOo93L7Z.js} +4 -4
- package/dist/{WidgetSettings-D35fHGXL.js.map → WidgetSettings-eOo93L7Z.js.map} +1 -1
- package/dist/WidgetSymbolSearch-C4OR42nZ.cjs +2 -0
- package/dist/WidgetSymbolSearch-C4OR42nZ.cjs.map +1 -0
- package/dist/WidgetSymbolSearch-CvPpjIwa.js +580 -0
- package/dist/WidgetSymbolSearch-CvPpjIwa.js.map +1 -0
- package/dist/{focusTrap-Hm7AUTBw.js → focusTrap-Br9Zfje0.js} +1 -1
- package/dist/{focusTrap-Hm7AUTBw.js.map → focusTrap-Br9Zfje0.js.map} +1 -1
- package/dist/{focusTrap-B8OoGwHb.cjs → focusTrap-DrhhmG0V.cjs} +1 -1
- package/dist/{focusTrap-B8OoGwHb.cjs.map → focusTrap-DrhhmG0V.cjs.map} +1 -1
- package/dist/{i18n-DFR1Oukq.cjs → i18n-C2nQBZTY.cjs} +1 -1
- package/dist/{i18n-DFR1Oukq.cjs.map → i18n-C2nQBZTY.cjs.map} +1 -1
- package/dist/{i18n-CvnQcfor.js → i18n-C5v6Tzp1.js} +1 -1
- package/dist/{i18n-CvnQcfor.js.map → i18n-C5v6Tzp1.js.map} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{indicatorInputWords-D19kY9NO.js → indicatorInputWords-Bd9Pt6qp.js} +2 -2
- package/dist/{indicatorInputWords-D19kY9NO.js.map → indicatorInputWords-Bd9Pt6qp.js.map} +1 -1
- package/dist/{indicatorInputWords-DzrKBU2I.cjs → indicatorInputWords-CTA4IcJR.cjs} +2 -2
- package/dist/{indicatorInputWords-DzrKBU2I.cjs.map → indicatorInputWords-CTA4IcJR.cjs.map} +1 -1
- package/dist/{indicatorSettingsTabs-BLEULMJJ.cjs → indicatorSettingsTabs-B0liE3ST.cjs} +2 -2
- package/dist/{indicatorSettingsTabs-BLEULMJJ.cjs.map → indicatorSettingsTabs-B0liE3ST.cjs.map} +1 -1
- package/dist/{indicatorSettingsTabs-Wxx2v_y4.js → indicatorSettingsTabs-XcgMdbLp.js} +3 -3
- package/dist/{indicatorSettingsTabs-Wxx2v_y4.js.map → indicatorSettingsTabs-XcgMdbLp.js.map} +1 -1
- package/dist/monthView-B-CieFDJ.cjs +2 -0
- package/dist/monthView-B-CieFDJ.cjs.map +1 -0
- package/dist/monthView-N8yDaTqZ.js +198 -0
- package/dist/monthView-N8yDaTqZ.js.map +1 -0
- package/dist/{platformKeys-BAPueZ1I.cjs → platformKeys-B82-j1Fs.cjs} +1 -1
- package/dist/{platformKeys-BAPueZ1I.cjs.map → platformKeys-B82-j1Fs.cjs.map} +1 -1
- package/dist/{platformKeys-D_x_6ZrV.js → platformKeys-Dd1qOCjF.js} +1 -1
- package/dist/{platformKeys-D_x_6ZrV.js.map → platformKeys-Dd1qOCjF.js.map} +1 -1
- package/dist/{settingsControls-ef4j_clQ.js → settingsControls-DIjzCFHI.js} +2 -2
- package/dist/{settingsControls-ef4j_clQ.js.map → settingsControls-DIjzCFHI.js.map} +1 -1
- package/dist/{settingsControls-jNn0If4b.cjs → settingsControls-Tn8_vJJv.cjs} +2 -2
- package/dist/{settingsControls-jNn0If4b.cjs.map → settingsControls-Tn8_vJJv.cjs.map} +1 -1
- package/dist/symbolCatalog-CA1fpz3s.js +90 -0
- package/dist/symbolCatalog-CA1fpz3s.js.map +1 -0
- package/dist/symbolCatalog-Dx1YnZgm.cjs +2 -0
- package/dist/symbolCatalog-Dx1YnZgm.cjs.map +1 -0
- package/dist/widget/ChartWidget.d.ts +67 -579
- package/dist/widget/ChartWidget.d.ts.map +1 -1
- package/dist/widget/WidgetAlerts.d.ts +35 -0
- package/dist/widget/WidgetAlerts.d.ts.map +1 -0
- package/dist/widget/WidgetChartSettings.d.ts +194 -0
- package/dist/widget/WidgetChartSettings.d.ts.map +1 -0
- package/dist/widget/WidgetCommands.d.ts +54 -0
- package/dist/widget/WidgetCommands.d.ts.map +1 -0
- package/dist/widget/WidgetCompares.d.ts +140 -0
- package/dist/widget/WidgetCompares.d.ts.map +1 -0
- package/dist/widget/WidgetDockArea.d.ts +89 -0
- package/dist/widget/WidgetDockArea.d.ts.map +1 -0
- package/dist/widget/WidgetDrawingEdit.d.ts +73 -0
- package/dist/widget/WidgetDrawingEdit.d.ts.map +1 -0
- package/dist/widget/WidgetIntervals.d.ts +66 -0
- package/dist/widget/WidgetIntervals.d.ts.map +1 -0
- package/dist/widget/WidgetLayouts.d.ts +85 -0
- package/dist/widget/WidgetLayouts.d.ts.map +1 -0
- package/dist/widget/WidgetLegendView.d.ts +54 -0
- package/dist/widget/WidgetLegendView.d.ts.map +1 -0
- package/dist/widget/WidgetMenus.d.ts +79 -0
- package/dist/widget/WidgetMenus.d.ts.map +1 -0
- package/dist/widget/WidgetReplay.d.ts +199 -0
- package/dist/widget/WidgetReplay.d.ts.map +1 -0
- package/dist/widget/WidgetTrading.d.ts +48 -0
- package/dist/widget/WidgetTrading.d.ts.map +1 -0
- package/dist/widget/WidgetWatchlists.d.ts +77 -0
- package/dist/widget/WidgetWatchlists.d.ts.map +1 -0
- package/dist/widget/index.cjs +21 -21
- package/dist/widget/index.cjs.map +1 -1
- package/dist/widget/index.js +6779 -7050
- package/dist/widget/index.js.map +1 -1
- package/dist/widget/keyTarget.d.ts +4 -0
- package/dist/widget/keyTarget.d.ts.map +1 -1
- package/dist/widget/locales/index.cjs +1 -1
- package/dist/widget/locales/index.js +1 -1
- package/dist/widget/pageEnv.d.ts +5 -0
- package/dist/widget/pageEnv.d.ts.map +1 -0
- package/dist/widget/widgetDialogs.d.ts +3 -0
- package/dist/widget/widgetDialogs.d.ts.map +1 -1
- package/dist/widgetFeatures-BM6u0u74.js +186 -0
- package/dist/widgetFeatures-BM6u0u74.js.map +1 -0
- package/dist/widgetFeatures-BZ8OVPN2.cjs +3 -0
- package/dist/widgetFeatures-BZ8OVPN2.cjs.map +1 -0
- package/package.json +3 -3
- package/dist/WidgetGoToDate-CPzfStIm.cjs +0 -2
- package/dist/widgetFeatures-BvkTbsQn.js +0 -378
- package/dist/widgetFeatures-BvkTbsQn.js.map +0 -1
- package/dist/widgetFeatures-Cy0fs3Nl.cjs +0 -3
- package/dist/widgetFeatures-Cy0fs3Nl.cjs.map +0 -1
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** Whether the page is hidden: another tab, the app in the background. */
|
|
2
|
+
export declare const pageHidden: () => boolean;
|
|
3
|
+
/** The page's local storage, or null where there is none or it is refused (a private window, a sandbox). */
|
|
4
|
+
export declare function browserStorage(): Storage | null;
|
|
5
|
+
//# sourceMappingURL=pageEnv.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pageEnv.d.ts","sourceRoot":"","sources":["../../src/widget/pageEnv.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,eAAO,MAAM,UAAU,QAAO,OAA6D,CAAC;AAE5F,4GAA4G;AAC5G,wBAAgB,cAAc,IAAI,OAAO,GAAG,IAAI,CAM/C"}
|
|
@@ -8,6 +8,9 @@ export declare const DIALOGS: {
|
|
|
8
8
|
drawingSettings: import('./lazyPart.js').ModuleRef<typeof import("./WidgetDrawingSettings.js")>;
|
|
9
9
|
goToDate: import('./lazyPart.js').ModuleRef<typeof import("./WidgetGoToDate.js")>;
|
|
10
10
|
hotkeySheet: import('./lazyPart.js').ModuleRef<typeof import("./WidgetHotkeySheet.js")>;
|
|
11
|
+
indicatorPicker: import('./lazyPart.js').ModuleRef<typeof import("./WidgetIndicatorPicker.js")>;
|
|
12
|
+
commandPalette: import('./lazyPart.js').ModuleRef<typeof import("./WidgetCommandPalette.js")>;
|
|
13
|
+
symbolSearch: import('./lazyPart.js').ModuleRef<typeof import("./WidgetSymbolSearch.js")>;
|
|
11
14
|
};
|
|
12
15
|
/** Loads every dialog's code; a failure is left for the dialog to report when it is opened. */
|
|
13
16
|
export declare function preloadDialogs(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"widgetDialogs.d.ts","sourceRoot":"","sources":["../../src/widget/widgetDialogs.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,eAAO,MAAM,OAAO
|
|
1
|
+
{"version":3,"file":"widgetDialogs.d.ts","sourceRoot":"","sources":["../../src/widget/widgetDialogs.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,eAAO,MAAM,OAAO;;;;;;;;;CASnB,CAAC;AAEF,+FAA+F;AAC/F,wBAAsB,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CAEpD"}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
//#region src/widget/widgetFeatures.ts
|
|
2
|
+
var e = /* @__PURE__ */ "toolbar,sidebar,statusBar,dock,alerts,objectTree,symbolInfo,symbolSearch,settings,indicatorSettings,drawingSettings,dataWindow,commandPalette,hotkeySheet,goToDate,replay,screenshot,copyImage,shareView,autoFib,themeToggle,fullscreen,accountPanel,orderTicket,bracketOrders,depthLadder,layouts,indicatorTemplates,compare,indicatorLegend,navigation,customTimeframes,intervalTyping,symbolTyping,dragDropImport,hotkeys,toasts,toolbar.symbol,toolbar.symbolInfo,toolbar.timeframes,toolbar.timeframeMenu,toolbar.chartType,toolbar.indicators,toolbar.layouts,toolbar.replay,toolbar.bracketOrders,toolbar.depthLadder,toolbar.accountPanel,toolbar.objectTree,toolbar.alerts,toolbar.screenshot,toolbar.settings,toolbar.themeToggle,toolbar.fullscreen,toolbar.compare,toolbar.undo,toolbar.redo,toolbar.trade,sidebar.cursor,sidebar.favorites,sidebar.lines,sidebar.fibonacci,sidebar.patterns,sidebar.forecasting,sidebar.annotation,sidebar.style,sidebar.magnet,sidebar.eraser,sidebar.zoomArea,sidebar.stayInDrawing,sidebar.undo,sidebar.redo,sidebar.clear,sidebar.lockAll,sidebar.hideAll,dock.watchlist,dock.alerts,dock.objectTree,dock.dataWindow,dock.symbolInfo,dock.depthLadder,statusBar.range,statusBar.goToDate,statusBar.market,statusBar.connection,statusBar.symbol,statusBar.clock,statusBar.scale,statusBar.rangeTimeframe,indicatorLegend.values,indicatorLegend.visibility,indicatorLegend.settings,indicatorLegend.remove,indicatorLegend.more,pane.move,pane.collapse,pane.maximize,navigation.zoom,navigation.scroll,navigation.reset,menu.chart,menu.chart.alert,menu.chart.order,menu.chart.orderTicket,menu.chart.horizontalLine,menu.chart.resetView,menu.chart.drawings,menu.chart.exportData,menu.chart.settings,menu.chart.scale,menu.chart.goToDate,menu.chart.paneScale,menu.priceAxisAdd,menu.chart.indicators,menu.chart.timezone,menu.drawing,menu.drawing.settings,menu.drawing.alert,menu.drawing.order,menu.drawing.group,menu.drawing.lock,menu.drawing.hide,menu.drawing.duplicate,menu.drawing.delete,selectionToolbar,hotkeys.commandPalette,hotkeys.symbolSearch,hotkeys.save,hotkeys.tools,hotkeys.invertScale,hotkeys.goToDate,hotkeys.help,hotkeys.resetView".split(","), t = new Set(e), n = {
|
|
3
|
+
toolbar: ["toolbar"],
|
|
4
|
+
drawingTools: [
|
|
5
|
+
"sidebar",
|
|
6
|
+
"drawingSettings",
|
|
7
|
+
"hotkeys.tools",
|
|
8
|
+
"menu.chart.horizontalLine"
|
|
9
|
+
],
|
|
10
|
+
settings: ["settings"],
|
|
11
|
+
statusBar: ["statusBar", "goToDate"],
|
|
12
|
+
rangeBar: [
|
|
13
|
+
"statusBar.range",
|
|
14
|
+
"statusBar.rangeTimeframe",
|
|
15
|
+
"goToDate"
|
|
16
|
+
],
|
|
17
|
+
indicatorLegend: ["indicatorLegend"],
|
|
18
|
+
fullscreen: ["fullscreen"],
|
|
19
|
+
alerts: ["alerts"],
|
|
20
|
+
objectTree: ["objectTree"],
|
|
21
|
+
accountPanel: ["accountPanel", "orderTicket"],
|
|
22
|
+
indicatorTemplates: ["indicatorTemplates"],
|
|
23
|
+
intervalTyping: ["intervalTyping"],
|
|
24
|
+
symbolInfo: ["symbolInfo"],
|
|
25
|
+
navigation: ["navigation"],
|
|
26
|
+
dragDropImport: ["dragDropImport"],
|
|
27
|
+
customTimeframes: ["customTimeframes"]
|
|
28
|
+
}, r = {
|
|
29
|
+
alert: ["alerts", "menu.chart.alert"],
|
|
30
|
+
buyLimit: ["menu.chart.order"],
|
|
31
|
+
buyStop: ["menu.chart.order"],
|
|
32
|
+
sellLimit: ["menu.chart.order"],
|
|
33
|
+
sellStop: ["menu.chart.order"],
|
|
34
|
+
orderTicket: ["orderTicket", "menu.chart.orderTicket"],
|
|
35
|
+
horizontalLine: ["menu.chart.horizontalLine"],
|
|
36
|
+
resetView: ["menu.chart.resetView"],
|
|
37
|
+
paste: ["menu.chart.drawings"],
|
|
38
|
+
hideDrawings: ["menu.chart.drawings"],
|
|
39
|
+
showDrawings: ["menu.chart.drawings"],
|
|
40
|
+
removeDrawings: ["menu.chart.drawings"],
|
|
41
|
+
removeIndicators: ["menu.chart.indicators"],
|
|
42
|
+
settings: ["settings", "menu.chart.settings"],
|
|
43
|
+
exportData: ["menu.chart.exportData"],
|
|
44
|
+
resetPriceScale: ["menu.chart.scale"],
|
|
45
|
+
autoScale: ["menu.chart.scale"],
|
|
46
|
+
invertScale: ["menu.chart.scale"],
|
|
47
|
+
leftScale: ["menu.chart.scale"],
|
|
48
|
+
regularScale: ["menu.chart.scale"],
|
|
49
|
+
logScale: ["menu.chart.scale"],
|
|
50
|
+
percentScale: ["menu.chart.scale"],
|
|
51
|
+
indexedScale: ["menu.chart.scale"],
|
|
52
|
+
labels: ["menu.chart.scale"],
|
|
53
|
+
indicatorValueLabels: ["menu.chart.scale"],
|
|
54
|
+
alignAxisLabels: ["menu.chart.scale"],
|
|
55
|
+
barCountdown: ["menu.chart.scale"],
|
|
56
|
+
lines: ["menu.chart.scale"],
|
|
57
|
+
highLowLines: ["menu.chart.scale"],
|
|
58
|
+
lastPriceLine: ["menu.chart.scale"],
|
|
59
|
+
goToDate: ["goToDate", "menu.chart.goToDate"],
|
|
60
|
+
timezone: ["menu.chart.timezone"],
|
|
61
|
+
paneLog: ["menu.chart.paneScale"],
|
|
62
|
+
paneInvert: ["menu.chart.paneScale"],
|
|
63
|
+
panePercent: ["menu.chart.paneScale"]
|
|
64
|
+
}, i = {
|
|
65
|
+
settings: ["drawingSettings", "menu.drawing.settings"],
|
|
66
|
+
alert: ["alerts", "menu.drawing.alert"],
|
|
67
|
+
front: ["menu.drawing.order"],
|
|
68
|
+
forward: ["menu.drawing.order"],
|
|
69
|
+
backward: ["menu.drawing.order"],
|
|
70
|
+
back: ["menu.drawing.order"],
|
|
71
|
+
group: ["menu.drawing.group"],
|
|
72
|
+
ungroup: ["menu.drawing.group"],
|
|
73
|
+
lock: ["menu.drawing.lock"],
|
|
74
|
+
unlock: ["menu.drawing.lock"],
|
|
75
|
+
hide: ["menu.drawing.hide"],
|
|
76
|
+
duplicate: ["menu.drawing.duplicate"],
|
|
77
|
+
delete: ["menu.drawing.delete"]
|
|
78
|
+
}, a = {
|
|
79
|
+
symbolSearch: "symbolSearch",
|
|
80
|
+
compare: "compare",
|
|
81
|
+
goToDate: "goToDate",
|
|
82
|
+
saveLayout: "layouts",
|
|
83
|
+
alerts: "alerts",
|
|
84
|
+
objectTree: "objectTree",
|
|
85
|
+
hotkeys: "hotkeySheet",
|
|
86
|
+
screenshot: "screenshot",
|
|
87
|
+
copyImage: "copyImage",
|
|
88
|
+
toggleTheme: "themeToggle",
|
|
89
|
+
settings: "settings",
|
|
90
|
+
shareView: "shareView",
|
|
91
|
+
autoFib: "autoFib",
|
|
92
|
+
dataWindow: "dataWindow",
|
|
93
|
+
symbolInfo: "symbolInfo"
|
|
94
|
+
};
|
|
95
|
+
function o(e) {
|
|
96
|
+
if (typeof e != "object" || !e || Array.isArray(e)) return {};
|
|
97
|
+
let n = {}, r = [];
|
|
98
|
+
for (let [i, a] of Object.entries(e)) t.has(i) && typeof a == "boolean" ? n[i] = a : r.push(i);
|
|
99
|
+
return r.length > 0 && console.warn(`[ChartWidget] Unknown or non-boolean feature switches left out: ${r.join(", ")}.`), n;
|
|
100
|
+
}
|
|
101
|
+
function s(t) {
|
|
102
|
+
let r = Object.fromEntries(e.map((e) => [e, !0]));
|
|
103
|
+
for (let [e, i] of Object.entries(n)) if (t[e] === !1) for (let e of i) r[e] = !1;
|
|
104
|
+
return {
|
|
105
|
+
...r,
|
|
106
|
+
...o(t.features)
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
function c(t) {
|
|
110
|
+
return e.filter((e) => !t[e]).join(" ");
|
|
111
|
+
}
|
|
112
|
+
var l = "tcw-divider-off", u = [
|
|
113
|
+
{
|
|
114
|
+
names: [
|
|
115
|
+
"navigation.zoom",
|
|
116
|
+
"navigation.scroll",
|
|
117
|
+
"navigation.reset"
|
|
118
|
+
],
|
|
119
|
+
selector: ".tcw-nav"
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
names: [
|
|
123
|
+
"pane.move",
|
|
124
|
+
"pane.collapse",
|
|
125
|
+
"pane.maximize"
|
|
126
|
+
],
|
|
127
|
+
selector: ".tcw-pane-controls"
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
names: [
|
|
131
|
+
"indicatorLegend.visibility",
|
|
132
|
+
"indicatorLegend.settings",
|
|
133
|
+
"indicatorLegend.more",
|
|
134
|
+
"indicatorLegend.remove"
|
|
135
|
+
],
|
|
136
|
+
selector: ".tcw-ind-legend-actions"
|
|
137
|
+
}
|
|
138
|
+
];
|
|
139
|
+
function d() {
|
|
140
|
+
return [
|
|
141
|
+
...e.map((e) => `.tcw-root[data-tcw-off~="${e}"] [data-tcw-part~="${e}"]{display:none!important}`),
|
|
142
|
+
...u.map(({ names: e, selector: t }) => `.tcw-root${e.map((e) => `[data-tcw-off~="${e}"]`).join("")} ${t}{display:none!important}`),
|
|
143
|
+
`.${l}{display:none!important}`
|
|
144
|
+
].join("\n");
|
|
145
|
+
}
|
|
146
|
+
function f(e, ...t) {
|
|
147
|
+
e.dataset.tcwPart = t.join(" ");
|
|
148
|
+
}
|
|
149
|
+
function p(...e) {
|
|
150
|
+
return `data-tcw-part="${e.join(" ")}"`;
|
|
151
|
+
}
|
|
152
|
+
function m(e) {
|
|
153
|
+
return Object.prototype.hasOwnProperty.call(a, e) ? a[e] : void 0;
|
|
154
|
+
}
|
|
155
|
+
function h(e, t, n) {
|
|
156
|
+
let r = [...e.children], i = (e) => e.classList.contains(t);
|
|
157
|
+
for (let e of r) i(e) && e.classList.remove(l);
|
|
158
|
+
let a = (e) => !e.hidden && getComputedStyle(e).display !== "none", o = (e) => a(e) && (e instanceof HTMLButtonElement || e.childElementCount > 0 || e.textContent !== ""), s = !1, c = null;
|
|
159
|
+
for (let e of r) if (n !== void 0 && e.classList.contains(n)) c?.classList.add(l), c = null, s = !1;
|
|
160
|
+
else if (i(e)) {
|
|
161
|
+
if (!a(e)) continue;
|
|
162
|
+
s ? (c = e, s = !1) : e.classList.add(l);
|
|
163
|
+
} else o(e) && (s = !0, c = null);
|
|
164
|
+
c?.classList.add(l);
|
|
165
|
+
}
|
|
166
|
+
function g(e, t, n) {
|
|
167
|
+
let r = e.flatMap((e) => {
|
|
168
|
+
if (e === "separator") return [e];
|
|
169
|
+
if (!(t[e.id] ?? []).every((e) => n[e])) return [];
|
|
170
|
+
if (!e.submenu) return [e];
|
|
171
|
+
let r = g(e.submenu, t, n);
|
|
172
|
+
return r.length > 0 ? [{
|
|
173
|
+
...e,
|
|
174
|
+
submenu: r
|
|
175
|
+
}] : [];
|
|
176
|
+
});
|
|
177
|
+
return r.filter((e, t) => {
|
|
178
|
+
if (e !== "separator") return !0;
|
|
179
|
+
let n = r.slice(0, t).some((e) => e !== "separator"), i = r[t + 1];
|
|
180
|
+
return n && i !== void 0 && i !== "separator";
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
//#endregion
|
|
184
|
+
export { g as a, p as c, h as d, d as f, m as i, o as l, i as n, f as o, e as r, c as s, r as t, s as u };
|
|
185
|
+
|
|
186
|
+
//# sourceMappingURL=widgetFeatures-BM6u0u74.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"widgetFeatures-BM6u0u74.js","names":[],"sources":["../src/widget/widgetFeatures.ts"],"sourcesContent":["import type { ContextMenuEntry } from './WidgetContextMenu.js';\nimport type { ChartMenuAction } from './chartMenu.js';\nimport type { DrawingMenuAction } from './drawingMenu.js';\n\n/**\n * The widget's switches, by name; every one is on until turned off. A name\n * without a dot is a whole capability, off wherever it shows (its button,\n * its menu entries, its command, its keys); a dotted name is one place.\n * A switch hides; it never adds a part that is off until its option asks\n * for it (`depthLadder: true`, `watchlist: true`).\n * The names are a contract: new ones are added, none is renamed.\n */\nexport const WIDGET_FEATURES = [\n // The bars.\n 'toolbar', 'sidebar', 'statusBar', 'dock',\n // Capabilities, wherever they show.\n 'alerts', 'objectTree', 'symbolInfo', 'symbolSearch', 'settings', 'indicatorSettings', 'drawingSettings',\n 'dataWindow', 'commandPalette', 'hotkeySheet', 'goToDate', 'replay', 'screenshot', 'copyImage', 'shareView',\n 'autoFib', 'themeToggle', 'fullscreen', 'accountPanel', 'orderTicket', 'bracketOrders', 'depthLadder',\n 'layouts', 'indicatorTemplates', 'compare', 'indicatorLegend', 'navigation', 'customTimeframes',\n 'intervalTyping', 'symbolTyping', 'dragDropImport', 'hotkeys', 'toasts',\n // The toolbar's buttons.\n 'toolbar.symbol', 'toolbar.symbolInfo', 'toolbar.timeframes', 'toolbar.timeframeMenu', 'toolbar.chartType',\n 'toolbar.indicators', 'toolbar.layouts', 'toolbar.replay', 'toolbar.bracketOrders', 'toolbar.depthLadder',\n 'toolbar.accountPanel', 'toolbar.objectTree', 'toolbar.alerts', 'toolbar.screenshot', 'toolbar.settings',\n 'toolbar.themeToggle', 'toolbar.fullscreen', 'toolbar.compare', 'toolbar.undo', 'toolbar.redo', 'toolbar.trade',\n // The drawing sidebar: its tools by section, then its buttons.\n 'sidebar.cursor', 'sidebar.favorites', 'sidebar.lines', 'sidebar.fibonacci', 'sidebar.patterns',\n 'sidebar.forecasting', 'sidebar.annotation', 'sidebar.style', 'sidebar.magnet', 'sidebar.eraser',\n 'sidebar.zoomArea', 'sidebar.stayInDrawing', 'sidebar.undo', 'sidebar.redo', 'sidebar.clear',\n 'sidebar.lockAll', 'sidebar.hideAll',\n // The dock's rail: a button for each panel.\n 'dock.watchlist', 'dock.alerts', 'dock.objectTree', 'dock.dataWindow', 'dock.symbolInfo', 'dock.depthLadder',\n // The status bar.\n 'statusBar.range', 'statusBar.goToDate', 'statusBar.market', 'statusBar.connection', 'statusBar.symbol',\n 'statusBar.clock', 'statusBar.scale',\n // A long range on the range bar switches to weeks or months, a short one back.\n 'statusBar.rangeTimeframe',\n // On the chart: the indicators' rows, the panes' buttons, the navigation.\n 'indicatorLegend.values', 'indicatorLegend.visibility', 'indicatorLegend.settings', 'indicatorLegend.remove',\n 'indicatorLegend.more', 'pane.move', 'pane.collapse', 'pane.maximize',\n 'navigation.zoom', 'navigation.scroll', 'navigation.reset',\n // Menus: a right-click on the chart (and the \"+\" by the price axis), and on a drawing.\n 'menu.chart', 'menu.chart.alert', 'menu.chart.order', 'menu.chart.orderTicket', 'menu.chart.horizontalLine',\n 'menu.chart.resetView', 'menu.chart.drawings', 'menu.chart.exportData', 'menu.chart.settings',\n 'menu.chart.scale', 'menu.chart.goToDate', 'menu.chart.paneScale', 'menu.priceAxisAdd',\n 'menu.chart.indicators', 'menu.chart.timezone',\n 'menu.drawing', 'menu.drawing.settings', 'menu.drawing.alert', 'menu.drawing.order', 'menu.drawing.group',\n 'menu.drawing.lock', 'menu.drawing.hide', 'menu.drawing.duplicate', 'menu.drawing.delete',\n // The toolbar that appears over a selected drawing.\n 'selectionToolbar',\n // Keys.\n 'hotkeys.commandPalette', 'hotkeys.symbolSearch', 'hotkeys.save', 'hotkeys.tools', 'hotkeys.invertScale',\n 'hotkeys.goToDate', 'hotkeys.help', 'hotkeys.resetView',\n] as const;\n\nexport type WidgetFeature = (typeof WIDGET_FEATURES)[number];\n/** Switches to turn on (`true`) or off (`false`), by name. */\nexport type WidgetFeatures = Partial<Record<WidgetFeature, boolean>>;\n/** Every switch, on or off. */\nexport type WidgetFeatureState = Readonly<Record<WidgetFeature, boolean>>;\n\nconst KNOWN: ReadonlySet<string> = new Set(WIDGET_FEATURES);\n\n/** The widget's older on/off options, each the switches it stands for. */\nexport const LEGACY_FEATURE_OPTIONS = {\n toolbar: ['toolbar'],\n drawingTools: ['sidebar', 'drawingSettings', 'hotkeys.tools', 'menu.chart.horizontalLine'],\n settings: ['settings'],\n statusBar: ['statusBar', 'goToDate'],\n rangeBar: ['statusBar.range', 'statusBar.rangeTimeframe', 'goToDate'],\n indicatorLegend: ['indicatorLegend'],\n fullscreen: ['fullscreen'],\n alerts: ['alerts'],\n objectTree: ['objectTree'],\n accountPanel: ['accountPanel', 'orderTicket'],\n indicatorTemplates: ['indicatorTemplates'],\n intervalTyping: ['intervalTyping'],\n symbolInfo: ['symbolInfo'],\n navigation: ['navigation'],\n dragDropImport: ['dragDropImport'],\n customTimeframes: ['customTimeframes'],\n} as const satisfies Record<string, readonly WidgetFeature[]>;\n\ntype LegacyOptions = { readonly [K in keyof typeof LEGACY_FEATURE_OPTIONS]?: unknown };\n\n/** The switches each chart menu entry needs on (the right-click menu and the \"+\" by the price axis). */\nexport const CHART_MENU_FEATURES: Readonly<Record<ChartMenuAction, readonly WidgetFeature[]>> = {\n alert: ['alerts', 'menu.chart.alert'],\n buyLimit: ['menu.chart.order'],\n buyStop: ['menu.chart.order'],\n sellLimit: ['menu.chart.order'],\n sellStop: ['menu.chart.order'],\n orderTicket: ['orderTicket', 'menu.chart.orderTicket'],\n horizontalLine: ['menu.chart.horizontalLine'],\n resetView: ['menu.chart.resetView'],\n paste: ['menu.chart.drawings'],\n hideDrawings: ['menu.chart.drawings'],\n showDrawings: ['menu.chart.drawings'],\n removeDrawings: ['menu.chart.drawings'],\n removeIndicators: ['menu.chart.indicators'],\n settings: ['settings', 'menu.chart.settings'],\n exportData: ['menu.chart.exportData'],\n resetPriceScale: ['menu.chart.scale'],\n autoScale: ['menu.chart.scale'],\n invertScale: ['menu.chart.scale'],\n leftScale: ['menu.chart.scale'],\n regularScale: ['menu.chart.scale'],\n logScale: ['menu.chart.scale'],\n percentScale: ['menu.chart.scale'],\n indexedScale: ['menu.chart.scale'],\n labels: ['menu.chart.scale'],\n indicatorValueLabels: ['menu.chart.scale'],\n alignAxisLabels: ['menu.chart.scale'],\n barCountdown: ['menu.chart.scale'],\n lines: ['menu.chart.scale'],\n highLowLines: ['menu.chart.scale'],\n lastPriceLine: ['menu.chart.scale'],\n goToDate: ['goToDate', 'menu.chart.goToDate'],\n timezone: ['menu.chart.timezone'],\n paneLog: ['menu.chart.paneScale'],\n paneInvert: ['menu.chart.paneScale'],\n panePercent: ['menu.chart.paneScale'],\n};\n\n/** The switches each entry of a drawing's menu needs on. */\nexport const DRAWING_MENU_FEATURES: Readonly<Record<DrawingMenuAction, readonly WidgetFeature[]>> = {\n settings: ['drawingSettings', 'menu.drawing.settings'],\n alert: ['alerts', 'menu.drawing.alert'],\n front: ['menu.drawing.order'],\n forward: ['menu.drawing.order'],\n backward: ['menu.drawing.order'],\n back: ['menu.drawing.order'],\n group: ['menu.drawing.group'],\n ungroup: ['menu.drawing.group'],\n lock: ['menu.drawing.lock'],\n unlock: ['menu.drawing.lock'],\n hide: ['menu.drawing.hide'],\n duplicate: ['menu.drawing.duplicate'],\n delete: ['menu.drawing.delete'],\n};\n\n/** The switch each command of the command palette needs on (by its action id). */\nexport const COMMAND_FEATURES: Readonly<Record<string, WidgetFeature>> = {\n symbolSearch: 'symbolSearch',\n compare: 'compare',\n goToDate: 'goToDate',\n saveLayout: 'layouts',\n alerts: 'alerts',\n objectTree: 'objectTree',\n hotkeys: 'hotkeySheet',\n screenshot: 'screenshot',\n copyImage: 'copyImage',\n toggleTheme: 'themeToggle',\n settings: 'settings',\n shareView: 'shareView',\n autoFib: 'autoFib',\n dataWindow: 'dataWindow',\n symbolInfo: 'symbolInfo',\n};\n\n/**\n * Switches as given (an option, a `setFeatures` call): known names set to\n * `true` or `false`. Anything else is dropped, with a warning.\n */\nexport function readWidgetFeatures(value: unknown): WidgetFeatures {\n if (typeof value !== 'object' || value === null || Array.isArray(value)) return {};\n const out: WidgetFeatures = {};\n const dropped: string[] = [];\n for (const [name, on] of Object.entries(value)) {\n if (KNOWN.has(name) && typeof on === 'boolean') out[name as WidgetFeature] = on;\n else dropped.push(name);\n }\n if (dropped.length > 0) {\n console.warn(`[ChartWidget] Unknown or non-boolean feature switches left out: ${dropped.join(', ')}.`);\n }\n return out;\n}\n\n/** Every switch at the start: on, then off where an older option says `false`, then as `features` says. */\nexport function resolveWidgetFeatures(options: LegacyOptions & { readonly features?: unknown }): WidgetFeatureState {\n const state = Object.fromEntries(WIDGET_FEATURES.map((name) => [name, true])) as Record<WidgetFeature, boolean>;\n for (const [option, names] of Object.entries(LEGACY_FEATURE_OPTIONS)) {\n if (options[option as keyof LegacyOptions] !== false) continue;\n for (const name of names) state[name] = false;\n }\n return { ...state, ...readWidgetFeatures(options.features) };\n}\n\n/** The switches that are off, space apart (the root's `data-tcw-off`). */\nexport function offFeatures(state: WidgetFeatureState): string {\n return WIDGET_FEATURES.filter((name) => !state[name]).join(' ');\n}\n\n/** A divider with nothing shown on one side of it. */\nconst DIVIDER_OFF = 'tcw-divider-off';\n\n/** Holders whose every part can be switched off: they go too, rather than show empty. */\nconst GROUPED_PARTS: readonly { names: readonly WidgetFeature[]; selector: string }[] = [\n { names: ['navigation.zoom', 'navigation.scroll', 'navigation.reset'], selector: '.tcw-nav' },\n { names: ['pane.move', 'pane.collapse', 'pane.maximize'], selector: '.tcw-pane-controls' },\n {\n names: ['indicatorLegend.visibility', 'indicatorLegend.settings', 'indicatorLegend.more', 'indicatorLegend.remove'],\n selector: '.tcw-ind-legend-actions',\n },\n];\n\n/** Hides every part (`data-tcw-part`) whose switch is off on its widget, and the dividers left with nothing to divide. */\nexport function widgetFeatureCss(): string {\n return [\n ...WIDGET_FEATURES.map((name) => `.tcw-root[data-tcw-off~=\"${name}\"] [data-tcw-part~=\"${name}\"]{display:none!important}`),\n ...GROUPED_PARTS.map(({ names, selector }) =>\n `.tcw-root${names.map((name) => `[data-tcw-off~=\"${name}\"]`).join('')} ${selector}{display:none!important}`),\n `.${DIVIDER_OFF}{display:none!important}`,\n ].join('\\n');\n}\n\n/** Marks an element as a part of the switches named: it is hidden while any of them is off. */\nexport function markPart(el: HTMLElement, ...names: WidgetFeature[]): void {\n el.dataset.tcwPart = names.join(' ');\n}\n\n/** The same mark as an attribute, for markup built as text. */\nexport function partAttr(...names: WidgetFeature[]): string {\n return `data-tcw-part=\"${names.join(' ')}\"`;\n}\n\n/** The switch a command of the command palette needs on, if it has one. */\nexport function commandFeature(id: string): WidgetFeature | undefined {\n return Object.prototype.hasOwnProperty.call(COMMAND_FEATURES, id) ? COMMAND_FEATURES[id] : undefined;\n}\n\n/**\n * Hides each divider among `container`'s children with nothing shown between\n * it and the edge, a boundary (a spacer) or the divider before it.\n */\nexport function tidyDividers(container: HTMLElement, dividerClass: string, boundaryClass?: string): void {\n const children = [...container.children] as HTMLElement[];\n const isDivider = (el: HTMLElement) => el.classList.contains(dividerClass);\n for (const el of children) if (isDivider(el)) el.classList.remove(DIVIDER_OFF);\n const shown = (el: HTMLElement) => !el.hidden && getComputedStyle(el).display !== 'none';\n // An empty holder (for a host's buttons, say) shows nothing.\n const isItem = (el: HTMLElement) => shown(el) && (el instanceof HTMLButtonElement || el.childElementCount > 0 || el.textContent !== '');\n let itemSince = false;\n let pending: HTMLElement | null = null;\n for (const el of children) {\n if (boundaryClass !== undefined && el.classList.contains(boundaryClass)) {\n pending?.classList.add(DIVIDER_OFF);\n pending = null;\n itemSince = false;\n } else if (isDivider(el)) {\n if (!shown(el)) continue;\n if (!itemSince) {\n el.classList.add(DIVIDER_OFF);\n } else {\n pending = el;\n itemSince = false;\n }\n } else if (isItem(el)) {\n itemSince = true;\n pending = null;\n }\n }\n pending?.classList.add(DIVIDER_OFF);\n}\n\n/**\n * A menu's entries with those whose switches are off left out, in its\n * submenus too (a submenu with nothing left goes), and no separator at\n * either end or next to another.\n */\nexport function filterMenuEntries<Id extends string>(\n entries: readonly ContextMenuEntry[],\n featuresOf: Readonly<Record<Id, readonly WidgetFeature[]>>,\n state: WidgetFeatureState,\n): ContextMenuEntry[] {\n const kept = entries.flatMap((entry): ContextMenuEntry[] => {\n if (entry === 'separator') return [entry];\n const names = (featuresOf as Readonly<Record<string, readonly WidgetFeature[]>>)[entry.id] ?? [];\n if (!names.every((name) => state[name])) return [];\n if (!entry.submenu) return [entry];\n const submenu = filterMenuEntries(entry.submenu, featuresOf, state);\n return submenu.length > 0 ? [{ ...entry, submenu }] : [];\n });\n return kept.filter((entry, i) => {\n if (entry !== 'separator') return true;\n const before = kept.slice(0, i).some((e) => e !== 'separator');\n const next = kept[i + 1];\n return before && next !== undefined && next !== 'separator';\n });\n}\n"],"mappings":";AAYA,IAAa,IAAkB,onEA0C9B,EAQK,IAA6B,IAAI,IAAI,EAAgB,EAG9C,IAAyB;CACpC,SAAS,CAAC,UAAU;CACpB,cAAc;EAAC;EAAW;EAAmB;EAAiB;EAA4B;CAC1F,UAAU,CAAC,WAAW;CACtB,WAAW,CAAC,aAAa,WAAW;CACpC,UAAU;EAAC;EAAmB;EAA4B;EAAW;CACrE,iBAAiB,CAAC,kBAAkB;CACpC,YAAY,CAAC,aAAa;CAC1B,QAAQ,CAAC,SAAS;CAClB,YAAY,CAAC,aAAa;CAC1B,cAAc,CAAC,gBAAgB,cAAc;CAC7C,oBAAoB,CAAC,qBAAqB;CAC1C,gBAAgB,CAAC,iBAAiB;CAClC,YAAY,CAAC,aAAa;CAC1B,YAAY,CAAC,aAAa;CAC1B,gBAAgB,CAAC,iBAAiB;CAClC,kBAAkB,CAAC,mBAAmB;CACvC,EAKY,IAAmF;CAC9F,OAAO,CAAC,UAAU,mBAAmB;CACrC,UAAU,CAAC,mBAAmB;CAC9B,SAAS,CAAC,mBAAmB;CAC7B,WAAW,CAAC,mBAAmB;CAC/B,UAAU,CAAC,mBAAmB;CAC9B,aAAa,CAAC,eAAe,yBAAyB;CACtD,gBAAgB,CAAC,4BAA4B;CAC7C,WAAW,CAAC,uBAAuB;CACnC,OAAO,CAAC,sBAAsB;CAC9B,cAAc,CAAC,sBAAsB;CACrC,cAAc,CAAC,sBAAsB;CACrC,gBAAgB,CAAC,sBAAsB;CACvC,kBAAkB,CAAC,wBAAwB;CAC3C,UAAU,CAAC,YAAY,sBAAsB;CAC7C,YAAY,CAAC,wBAAwB;CACrC,iBAAiB,CAAC,mBAAmB;CACrC,WAAW,CAAC,mBAAmB;CAC/B,aAAa,CAAC,mBAAmB;CACjC,WAAW,CAAC,mBAAmB;CAC/B,cAAc,CAAC,mBAAmB;CAClC,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AK,QAAQ,GAAO,MAAM;AAC/B,MAAI,MAAU,YAAa,QAAO;EAClC,IAAM,IAAS,EAAK,MAAM,GAAG,EAAE,CAAC,MAAM,MAAM,MAAM,YAAY,EACxD,IAAO,EAAK,IAAI;AACtB,SAAO,KAAU,MAAS,KAAA,KAAa,MAAS;GAChD"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var e=`toolbar,sidebar,statusBar,dock,alerts,objectTree,symbolInfo,symbolSearch,settings,indicatorSettings,drawingSettings,dataWindow,commandPalette,hotkeySheet,goToDate,replay,screenshot,copyImage,shareView,autoFib,themeToggle,fullscreen,accountPanel,orderTicket,bracketOrders,depthLadder,layouts,indicatorTemplates,compare,indicatorLegend,navigation,customTimeframes,intervalTyping,symbolTyping,dragDropImport,hotkeys,toasts,toolbar.symbol,toolbar.symbolInfo,toolbar.timeframes,toolbar.timeframeMenu,toolbar.chartType,toolbar.indicators,toolbar.layouts,toolbar.replay,toolbar.bracketOrders,toolbar.depthLadder,toolbar.accountPanel,toolbar.objectTree,toolbar.alerts,toolbar.screenshot,toolbar.settings,toolbar.themeToggle,toolbar.fullscreen,toolbar.compare,toolbar.undo,toolbar.redo,toolbar.trade,sidebar.cursor,sidebar.favorites,sidebar.lines,sidebar.fibonacci,sidebar.patterns,sidebar.forecasting,sidebar.annotation,sidebar.style,sidebar.magnet,sidebar.eraser,sidebar.zoomArea,sidebar.stayInDrawing,sidebar.undo,sidebar.redo,sidebar.clear,sidebar.lockAll,sidebar.hideAll,dock.watchlist,dock.alerts,dock.objectTree,dock.dataWindow,dock.symbolInfo,dock.depthLadder,statusBar.range,statusBar.goToDate,statusBar.market,statusBar.connection,statusBar.symbol,statusBar.clock,statusBar.scale,statusBar.rangeTimeframe,indicatorLegend.values,indicatorLegend.visibility,indicatorLegend.settings,indicatorLegend.remove,indicatorLegend.more,pane.move,pane.collapse,pane.maximize,navigation.zoom,navigation.scroll,navigation.reset,menu.chart,menu.chart.alert,menu.chart.order,menu.chart.orderTicket,menu.chart.horizontalLine,menu.chart.resetView,menu.chart.drawings,menu.chart.exportData,menu.chart.settings,menu.chart.scale,menu.chart.goToDate,menu.chart.paneScale,menu.priceAxisAdd,menu.chart.indicators,menu.chart.timezone,menu.drawing,menu.drawing.settings,menu.drawing.alert,menu.drawing.order,menu.drawing.group,menu.drawing.lock,menu.drawing.hide,menu.drawing.duplicate,menu.drawing.delete,selectionToolbar,hotkeys.commandPalette,hotkeys.symbolSearch,hotkeys.save,hotkeys.tools,hotkeys.invertScale,hotkeys.goToDate,hotkeys.help,hotkeys.resetView`.split(`,`),t=new Set(e),n={toolbar:[`toolbar`],drawingTools:[`sidebar`,`drawingSettings`,`hotkeys.tools`,`menu.chart.horizontalLine`],settings:[`settings`],statusBar:[`statusBar`,`goToDate`],rangeBar:[`statusBar.range`,`statusBar.rangeTimeframe`,`goToDate`],indicatorLegend:[`indicatorLegend`],fullscreen:[`fullscreen`],alerts:[`alerts`],objectTree:[`objectTree`],accountPanel:[`accountPanel`,`orderTicket`],indicatorTemplates:[`indicatorTemplates`],intervalTyping:[`intervalTyping`],symbolInfo:[`symbolInfo`],navigation:[`navigation`],dragDropImport:[`dragDropImport`],customTimeframes:[`customTimeframes`]},r={alert:[`alerts`,`menu.chart.alert`],buyLimit:[`menu.chart.order`],buyStop:[`menu.chart.order`],sellLimit:[`menu.chart.order`],sellStop:[`menu.chart.order`],orderTicket:[`orderTicket`,`menu.chart.orderTicket`],horizontalLine:[`menu.chart.horizontalLine`],resetView:[`menu.chart.resetView`],paste:[`menu.chart.drawings`],hideDrawings:[`menu.chart.drawings`],showDrawings:[`menu.chart.drawings`],removeDrawings:[`menu.chart.drawings`],removeIndicators:[`menu.chart.indicators`],settings:[`settings`,`menu.chart.settings`],exportData:[`menu.chart.exportData`],resetPriceScale:[`menu.chart.scale`],autoScale:[`menu.chart.scale`],invertScale:[`menu.chart.scale`],leftScale:[`menu.chart.scale`],regularScale:[`menu.chart.scale`],logScale:[`menu.chart.scale`],percentScale:[`menu.chart.scale`],indexedScale:[`menu.chart.scale`],labels:[`menu.chart.scale`],indicatorValueLabels:[`menu.chart.scale`],alignAxisLabels:[`menu.chart.scale`],barCountdown:[`menu.chart.scale`],lines:[`menu.chart.scale`],highLowLines:[`menu.chart.scale`],lastPriceLine:[`menu.chart.scale`],goToDate:[`goToDate`,`menu.chart.goToDate`],timezone:[`menu.chart.timezone`],paneLog:[`menu.chart.paneScale`],paneInvert:[`menu.chart.paneScale`],panePercent:[`menu.chart.paneScale`]},i={settings:[`drawingSettings`,`menu.drawing.settings`],alert:[`alerts`,`menu.drawing.alert`],front:[`menu.drawing.order`],forward:[`menu.drawing.order`],backward:[`menu.drawing.order`],back:[`menu.drawing.order`],group:[`menu.drawing.group`],ungroup:[`menu.drawing.group`],lock:[`menu.drawing.lock`],unlock:[`menu.drawing.lock`],hide:[`menu.drawing.hide`],duplicate:[`menu.drawing.duplicate`],delete:[`menu.drawing.delete`]},a={symbolSearch:`symbolSearch`,compare:`compare`,goToDate:`goToDate`,saveLayout:`layouts`,alerts:`alerts`,objectTree:`objectTree`,hotkeys:`hotkeySheet`,screenshot:`screenshot`,copyImage:`copyImage`,toggleTheme:`themeToggle`,settings:`settings`,shareView:`shareView`,autoFib:`autoFib`,dataWindow:`dataWindow`,symbolInfo:`symbolInfo`};function o(e){if(typeof e!=`object`||!e||Array.isArray(e))return{};let n={},r=[];for(let[i,a]of Object.entries(e))t.has(i)&&typeof a==`boolean`?n[i]=a:r.push(i);return r.length>0&&console.warn(`[ChartWidget] Unknown or non-boolean feature switches left out: ${r.join(`, `)}.`),n}function s(t){let r=Object.fromEntries(e.map(e=>[e,!0]));for(let[e,i]of Object.entries(n))if(t[e]===!1)for(let e of i)r[e]=!1;return{...r,...o(t.features)}}function c(t){return e.filter(e=>!t[e]).join(` `)}var l=`tcw-divider-off`,u=[{names:[`navigation.zoom`,`navigation.scroll`,`navigation.reset`],selector:`.tcw-nav`},{names:[`pane.move`,`pane.collapse`,`pane.maximize`],selector:`.tcw-pane-controls`},{names:[`indicatorLegend.visibility`,`indicatorLegend.settings`,`indicatorLegend.more`,`indicatorLegend.remove`],selector:`.tcw-ind-legend-actions`}];function d(){return[...e.map(e=>`.tcw-root[data-tcw-off~="${e}"] [data-tcw-part~="${e}"]{display:none!important}`),...u.map(({names:e,selector:t})=>`.tcw-root${e.map(e=>`[data-tcw-off~="${e}"]`).join(``)} ${t}{display:none!important}`),`.${l}{display:none!important}`].join(`
|
|
2
|
+
`)}function f(e,...t){e.dataset.tcwPart=t.join(` `)}function p(...e){return`data-tcw-part="${e.join(` `)}"`}function m(e){return Object.prototype.hasOwnProperty.call(a,e)?a[e]:void 0}function h(e,t,n){let r=[...e.children],i=e=>e.classList.contains(t);for(let e of r)i(e)&&e.classList.remove(l);let a=e=>!e.hidden&&getComputedStyle(e).display!==`none`,o=e=>a(e)&&(e instanceof HTMLButtonElement||e.childElementCount>0||e.textContent!==``),s=!1,c=null;for(let e of r)if(n!==void 0&&e.classList.contains(n))c?.classList.add(l),c=null,s=!1;else if(i(e)){if(!a(e))continue;s?(c=e,s=!1):e.classList.add(l)}else o(e)&&(s=!0,c=null);c?.classList.add(l)}function g(e,t,n){let r=e.flatMap(e=>{if(e===`separator`)return[e];if(!(t[e.id]??[]).every(e=>n[e]))return[];if(!e.submenu)return[e];let r=g(e.submenu,t,n);return r.length>0?[{...e,submenu:r}]:[]});return r.filter((e,t)=>{if(e!==`separator`)return!0;let n=r.slice(0,t).some(e=>e!==`separator`),i=r[t+1];return n&&i!==void 0&&i!==`separator`})}Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,`d`,{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,`f`,{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,`l`,{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return e}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,`u`,{enumerable:!0,get:function(){return s}});
|
|
3
|
+
//# sourceMappingURL=widgetFeatures-BZ8OVPN2.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"widgetFeatures-BZ8OVPN2.cjs","names":[],"sources":["../src/widget/widgetFeatures.ts"],"sourcesContent":["import type { ContextMenuEntry } from './WidgetContextMenu.js';\nimport type { ChartMenuAction } from './chartMenu.js';\nimport type { DrawingMenuAction } from './drawingMenu.js';\n\n/**\n * The widget's switches, by name; every one is on until turned off. A name\n * without a dot is a whole capability, off wherever it shows (its button,\n * its menu entries, its command, its keys); a dotted name is one place.\n * A switch hides; it never adds a part that is off until its option asks\n * for it (`depthLadder: true`, `watchlist: true`).\n * The names are a contract: new ones are added, none is renamed.\n */\nexport const WIDGET_FEATURES = [\n // The bars.\n 'toolbar', 'sidebar', 'statusBar', 'dock',\n // Capabilities, wherever they show.\n 'alerts', 'objectTree', 'symbolInfo', 'symbolSearch', 'settings', 'indicatorSettings', 'drawingSettings',\n 'dataWindow', 'commandPalette', 'hotkeySheet', 'goToDate', 'replay', 'screenshot', 'copyImage', 'shareView',\n 'autoFib', 'themeToggle', 'fullscreen', 'accountPanel', 'orderTicket', 'bracketOrders', 'depthLadder',\n 'layouts', 'indicatorTemplates', 'compare', 'indicatorLegend', 'navigation', 'customTimeframes',\n 'intervalTyping', 'symbolTyping', 'dragDropImport', 'hotkeys', 'toasts',\n // The toolbar's buttons.\n 'toolbar.symbol', 'toolbar.symbolInfo', 'toolbar.timeframes', 'toolbar.timeframeMenu', 'toolbar.chartType',\n 'toolbar.indicators', 'toolbar.layouts', 'toolbar.replay', 'toolbar.bracketOrders', 'toolbar.depthLadder',\n 'toolbar.accountPanel', 'toolbar.objectTree', 'toolbar.alerts', 'toolbar.screenshot', 'toolbar.settings',\n 'toolbar.themeToggle', 'toolbar.fullscreen', 'toolbar.compare', 'toolbar.undo', 'toolbar.redo', 'toolbar.trade',\n // The drawing sidebar: its tools by section, then its buttons.\n 'sidebar.cursor', 'sidebar.favorites', 'sidebar.lines', 'sidebar.fibonacci', 'sidebar.patterns',\n 'sidebar.forecasting', 'sidebar.annotation', 'sidebar.style', 'sidebar.magnet', 'sidebar.eraser',\n 'sidebar.zoomArea', 'sidebar.stayInDrawing', 'sidebar.undo', 'sidebar.redo', 'sidebar.clear',\n 'sidebar.lockAll', 'sidebar.hideAll',\n // The dock's rail: a button for each panel.\n 'dock.watchlist', 'dock.alerts', 'dock.objectTree', 'dock.dataWindow', 'dock.symbolInfo', 'dock.depthLadder',\n // The status bar.\n 'statusBar.range', 'statusBar.goToDate', 'statusBar.market', 'statusBar.connection', 'statusBar.symbol',\n 'statusBar.clock', 'statusBar.scale',\n // A long range on the range bar switches to weeks or months, a short one back.\n 'statusBar.rangeTimeframe',\n // On the chart: the indicators' rows, the panes' buttons, the navigation.\n 'indicatorLegend.values', 'indicatorLegend.visibility', 'indicatorLegend.settings', 'indicatorLegend.remove',\n 'indicatorLegend.more', 'pane.move', 'pane.collapse', 'pane.maximize',\n 'navigation.zoom', 'navigation.scroll', 'navigation.reset',\n // Menus: a right-click on the chart (and the \"+\" by the price axis), and on a drawing.\n 'menu.chart', 'menu.chart.alert', 'menu.chart.order', 'menu.chart.orderTicket', 'menu.chart.horizontalLine',\n 'menu.chart.resetView', 'menu.chart.drawings', 'menu.chart.exportData', 'menu.chart.settings',\n 'menu.chart.scale', 'menu.chart.goToDate', 'menu.chart.paneScale', 'menu.priceAxisAdd',\n 'menu.chart.indicators', 'menu.chart.timezone',\n 'menu.drawing', 'menu.drawing.settings', 'menu.drawing.alert', 'menu.drawing.order', 'menu.drawing.group',\n 'menu.drawing.lock', 'menu.drawing.hide', 'menu.drawing.duplicate', 'menu.drawing.delete',\n // The toolbar that appears over a selected drawing.\n 'selectionToolbar',\n // Keys.\n 'hotkeys.commandPalette', 'hotkeys.symbolSearch', 'hotkeys.save', 'hotkeys.tools', 'hotkeys.invertScale',\n 'hotkeys.goToDate', 'hotkeys.help', 'hotkeys.resetView',\n] as const;\n\nexport type WidgetFeature = (typeof WIDGET_FEATURES)[number];\n/** Switches to turn on (`true`) or off (`false`), by name. */\nexport type WidgetFeatures = Partial<Record<WidgetFeature, boolean>>;\n/** Every switch, on or off. */\nexport type WidgetFeatureState = Readonly<Record<WidgetFeature, boolean>>;\n\nconst KNOWN: ReadonlySet<string> = new Set(WIDGET_FEATURES);\n\n/** The widget's older on/off options, each the switches it stands for. */\nexport const LEGACY_FEATURE_OPTIONS = {\n toolbar: ['toolbar'],\n drawingTools: ['sidebar', 'drawingSettings', 'hotkeys.tools', 'menu.chart.horizontalLine'],\n settings: ['settings'],\n statusBar: ['statusBar', 'goToDate'],\n rangeBar: ['statusBar.range', 'statusBar.rangeTimeframe', 'goToDate'],\n indicatorLegend: ['indicatorLegend'],\n fullscreen: ['fullscreen'],\n alerts: ['alerts'],\n objectTree: ['objectTree'],\n accountPanel: ['accountPanel', 'orderTicket'],\n indicatorTemplates: ['indicatorTemplates'],\n intervalTyping: ['intervalTyping'],\n symbolInfo: ['symbolInfo'],\n navigation: ['navigation'],\n dragDropImport: ['dragDropImport'],\n customTimeframes: ['customTimeframes'],\n} as const satisfies Record<string, readonly WidgetFeature[]>;\n\ntype LegacyOptions = { readonly [K in keyof typeof LEGACY_FEATURE_OPTIONS]?: unknown };\n\n/** The switches each chart menu entry needs on (the right-click menu and the \"+\" by the price axis). */\nexport const CHART_MENU_FEATURES: Readonly<Record<ChartMenuAction, readonly WidgetFeature[]>> = {\n alert: ['alerts', 'menu.chart.alert'],\n buyLimit: ['menu.chart.order'],\n buyStop: ['menu.chart.order'],\n sellLimit: ['menu.chart.order'],\n sellStop: ['menu.chart.order'],\n orderTicket: ['orderTicket', 'menu.chart.orderTicket'],\n horizontalLine: ['menu.chart.horizontalLine'],\n resetView: ['menu.chart.resetView'],\n paste: ['menu.chart.drawings'],\n hideDrawings: ['menu.chart.drawings'],\n showDrawings: ['menu.chart.drawings'],\n removeDrawings: ['menu.chart.drawings'],\n removeIndicators: ['menu.chart.indicators'],\n settings: ['settings', 'menu.chart.settings'],\n exportData: ['menu.chart.exportData'],\n resetPriceScale: ['menu.chart.scale'],\n autoScale: ['menu.chart.scale'],\n invertScale: ['menu.chart.scale'],\n leftScale: ['menu.chart.scale'],\n regularScale: ['menu.chart.scale'],\n logScale: ['menu.chart.scale'],\n percentScale: ['menu.chart.scale'],\n indexedScale: ['menu.chart.scale'],\n labels: ['menu.chart.scale'],\n indicatorValueLabels: ['menu.chart.scale'],\n alignAxisLabels: ['menu.chart.scale'],\n barCountdown: ['menu.chart.scale'],\n lines: ['menu.chart.scale'],\n highLowLines: ['menu.chart.scale'],\n lastPriceLine: ['menu.chart.scale'],\n goToDate: ['goToDate', 'menu.chart.goToDate'],\n timezone: ['menu.chart.timezone'],\n paneLog: ['menu.chart.paneScale'],\n paneInvert: ['menu.chart.paneScale'],\n panePercent: ['menu.chart.paneScale'],\n};\n\n/** The switches each entry of a drawing's menu needs on. */\nexport const DRAWING_MENU_FEATURES: Readonly<Record<DrawingMenuAction, readonly WidgetFeature[]>> = {\n settings: ['drawingSettings', 'menu.drawing.settings'],\n alert: ['alerts', 'menu.drawing.alert'],\n front: ['menu.drawing.order'],\n forward: ['menu.drawing.order'],\n backward: ['menu.drawing.order'],\n back: ['menu.drawing.order'],\n group: ['menu.drawing.group'],\n ungroup: ['menu.drawing.group'],\n lock: ['menu.drawing.lock'],\n unlock: ['menu.drawing.lock'],\n hide: ['menu.drawing.hide'],\n duplicate: ['menu.drawing.duplicate'],\n delete: ['menu.drawing.delete'],\n};\n\n/** The switch each command of the command palette needs on (by its action id). */\nexport const COMMAND_FEATURES: Readonly<Record<string, WidgetFeature>> = {\n symbolSearch: 'symbolSearch',\n compare: 'compare',\n goToDate: 'goToDate',\n saveLayout: 'layouts',\n alerts: 'alerts',\n objectTree: 'objectTree',\n hotkeys: 'hotkeySheet',\n screenshot: 'screenshot',\n copyImage: 'copyImage',\n toggleTheme: 'themeToggle',\n settings: 'settings',\n shareView: 'shareView',\n autoFib: 'autoFib',\n dataWindow: 'dataWindow',\n symbolInfo: 'symbolInfo',\n};\n\n/**\n * Switches as given (an option, a `setFeatures` call): known names set to\n * `true` or `false`. Anything else is dropped, with a warning.\n */\nexport function readWidgetFeatures(value: unknown): WidgetFeatures {\n if (typeof value !== 'object' || value === null || Array.isArray(value)) return {};\n const out: WidgetFeatures = {};\n const dropped: string[] = [];\n for (const [name, on] of Object.entries(value)) {\n if (KNOWN.has(name) && typeof on === 'boolean') out[name as WidgetFeature] = on;\n else dropped.push(name);\n }\n if (dropped.length > 0) {\n console.warn(`[ChartWidget] Unknown or non-boolean feature switches left out: ${dropped.join(', ')}.`);\n }\n return out;\n}\n\n/** Every switch at the start: on, then off where an older option says `false`, then as `features` says. */\nexport function resolveWidgetFeatures(options: LegacyOptions & { readonly features?: unknown }): WidgetFeatureState {\n const state = Object.fromEntries(WIDGET_FEATURES.map((name) => [name, true])) as Record<WidgetFeature, boolean>;\n for (const [option, names] of Object.entries(LEGACY_FEATURE_OPTIONS)) {\n if (options[option as keyof LegacyOptions] !== false) continue;\n for (const name of names) state[name] = false;\n }\n return { ...state, ...readWidgetFeatures(options.features) };\n}\n\n/** The switches that are off, space apart (the root's `data-tcw-off`). */\nexport function offFeatures(state: WidgetFeatureState): string {\n return WIDGET_FEATURES.filter((name) => !state[name]).join(' ');\n}\n\n/** A divider with nothing shown on one side of it. */\nconst DIVIDER_OFF = 'tcw-divider-off';\n\n/** Holders whose every part can be switched off: they go too, rather than show empty. */\nconst GROUPED_PARTS: readonly { names: readonly WidgetFeature[]; selector: string }[] = [\n { names: ['navigation.zoom', 'navigation.scroll', 'navigation.reset'], selector: '.tcw-nav' },\n { names: ['pane.move', 'pane.collapse', 'pane.maximize'], selector: '.tcw-pane-controls' },\n {\n names: ['indicatorLegend.visibility', 'indicatorLegend.settings', 'indicatorLegend.more', 'indicatorLegend.remove'],\n selector: '.tcw-ind-legend-actions',\n },\n];\n\n/** Hides every part (`data-tcw-part`) whose switch is off on its widget, and the dividers left with nothing to divide. */\nexport function widgetFeatureCss(): string {\n return [\n ...WIDGET_FEATURES.map((name) => `.tcw-root[data-tcw-off~=\"${name}\"] [data-tcw-part~=\"${name}\"]{display:none!important}`),\n ...GROUPED_PARTS.map(({ names, selector }) =>\n `.tcw-root${names.map((name) => `[data-tcw-off~=\"${name}\"]`).join('')} ${selector}{display:none!important}`),\n `.${DIVIDER_OFF}{display:none!important}`,\n ].join('\\n');\n}\n\n/** Marks an element as a part of the switches named: it is hidden while any of them is off. */\nexport function markPart(el: HTMLElement, ...names: WidgetFeature[]): void {\n el.dataset.tcwPart = names.join(' ');\n}\n\n/** The same mark as an attribute, for markup built as text. */\nexport function partAttr(...names: WidgetFeature[]): string {\n return `data-tcw-part=\"${names.join(' ')}\"`;\n}\n\n/** The switch a command of the command palette needs on, if it has one. */\nexport function commandFeature(id: string): WidgetFeature | undefined {\n return Object.prototype.hasOwnProperty.call(COMMAND_FEATURES, id) ? COMMAND_FEATURES[id] : undefined;\n}\n\n/**\n * Hides each divider among `container`'s children with nothing shown between\n * it and the edge, a boundary (a spacer) or the divider before it.\n */\nexport function tidyDividers(container: HTMLElement, dividerClass: string, boundaryClass?: string): void {\n const children = [...container.children] as HTMLElement[];\n const isDivider = (el: HTMLElement) => el.classList.contains(dividerClass);\n for (const el of children) if (isDivider(el)) el.classList.remove(DIVIDER_OFF);\n const shown = (el: HTMLElement) => !el.hidden && getComputedStyle(el).display !== 'none';\n // An empty holder (for a host's buttons, say) shows nothing.\n const isItem = (el: HTMLElement) => shown(el) && (el instanceof HTMLButtonElement || el.childElementCount > 0 || el.textContent !== '');\n let itemSince = false;\n let pending: HTMLElement | null = null;\n for (const el of children) {\n if (boundaryClass !== undefined && el.classList.contains(boundaryClass)) {\n pending?.classList.add(DIVIDER_OFF);\n pending = null;\n itemSince = false;\n } else if (isDivider(el)) {\n if (!shown(el)) continue;\n if (!itemSince) {\n el.classList.add(DIVIDER_OFF);\n } else {\n pending = el;\n itemSince = false;\n }\n } else if (isItem(el)) {\n itemSince = true;\n pending = null;\n }\n }\n pending?.classList.add(DIVIDER_OFF);\n}\n\n/**\n * A menu's entries with those whose switches are off left out, in its\n * submenus too (a submenu with nothing left goes), and no separator at\n * either end or next to another.\n */\nexport function filterMenuEntries<Id extends string>(\n entries: readonly ContextMenuEntry[],\n featuresOf: Readonly<Record<Id, readonly WidgetFeature[]>>,\n state: WidgetFeatureState,\n): ContextMenuEntry[] {\n const kept = entries.flatMap((entry): ContextMenuEntry[] => {\n if (entry === 'separator') return [entry];\n const names = (featuresOf as Readonly<Record<string, readonly WidgetFeature[]>>)[entry.id] ?? [];\n if (!names.every((name) => state[name])) return [];\n if (!entry.submenu) return [entry];\n const submenu = filterMenuEntries(entry.submenu, featuresOf, state);\n return submenu.length > 0 ? [{ ...entry, submenu }] : [];\n });\n return kept.filter((entry, i) => {\n if (entry !== 'separator') return true;\n const before = kept.slice(0, i).some((e) => e !== 'separator');\n const next = kept[i + 1];\n return before && next !== undefined && next !== 'separator';\n });\n}\n"],"mappings":"AAYA,IAAa,EAAkB,omEA0C9B,CAQK,EAA6B,IAAI,IAAI,EAAgB,CAG9C,EAAyB,CACpC,QAAS,CAAC,UAAU,CACpB,aAAc,CAAC,UAAW,kBAAmB,gBAAiB,4BAA4B,CAC1F,SAAU,CAAC,WAAW,CACtB,UAAW,CAAC,YAAa,WAAW,CACpC,SAAU,CAAC,kBAAmB,2BAA4B,WAAW,CACrE,gBAAiB,CAAC,kBAAkB,CACpC,WAAY,CAAC,aAAa,CAC1B,OAAQ,CAAC,SAAS,CAClB,WAAY,CAAC,aAAa,CAC1B,aAAc,CAAC,eAAgB,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GACZ,EAA8B,KAClC,IAAK,IAAM,KAAM,EACf,GAAI,IAAkB,IAAA,IAAa,EAAG,UAAU,SAAS,EAAc,CACrE,GAAS,UAAU,IAAI,EAAY,CACnC,EAAU,KACV,EAAY,WACH,EAAU,EAAG,CAAE,CACxB,GAAI,CAAC,EAAM,EAAG,CAAE,SACX,GAGH,EAAU,EACV,EAAY,IAHZ,EAAG,UAAU,IAAI,EAAY,MAKtB,EAAO,EAAG,GACnB,EAAY,GACZ,EAAU,MAGd,GAAS,UAAU,IAAI,EAAY,CAQrC,SAAgB,EACd,EACA,EACA,EACoB,CACpB,IAAM,EAAO,EAAQ,QAAS,GAA8B,CAC1D,GAAI,IAAU,YAAa,MAAO,CAAC,EAAM,CAEzC,GAAI,EADW,EAAkE,EAAM,KAAO,EAAE,EACrF,MAAO,GAAS,EAAM,GAAM,CAAE,MAAO,EAAE,CAClD,GAAI,CAAC,EAAM,QAAS,MAAO,CAAC,EAAM,CAClC,IAAM,EAAU,EAAkB,EAAM,QAAS,EAAY,EAAM,CACnE,OAAO,EAAQ,OAAS,EAAI,CAAC,CAAE,GAAG,EAAO,UAAS,CAAC,CAAG,EAAE,EACxD,CACF,OAAO,EAAK,QAAQ,EAAO,IAAM,CAC/B,GAAI,IAAU,YAAa,MAAO,GAClC,IAAM,EAAS,EAAK,MAAM,EAAG,EAAE,CAAC,KAAM,GAAM,IAAM,YAAY,CACxD,EAAO,EAAK,EAAI,GACtB,OAAO,GAAU,IAAS,IAAA,IAAa,IAAS,aAChD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tradecanvas/chart",
|
|
3
|
-
"version": "1.72.
|
|
3
|
+
"version": "1.72.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "High-performance canvas trading chart with built-in indicators, drawing tools, and real-time streaming. Zero external dependencies.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -63,8 +63,8 @@
|
|
|
63
63
|
"README.md"
|
|
64
64
|
],
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"@tradecanvas/commons": "1.72.
|
|
67
|
-
"@tradecanvas/core": "1.72.
|
|
66
|
+
"@tradecanvas/commons": "1.72.1",
|
|
67
|
+
"@tradecanvas/core": "1.72.1"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
70
|
"jsdom": "^25.0.1",
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const e=require(`./widgetFeatures-Cy0fs3Nl.cjs`),t=require(`./focusTrap-B8OoGwHb.cjs`);var n=[`date`,`range`],r=1,i=class{backdrop=null;fieldsEl=null;tabButtons=[];month=null;active=null;values={date:``,time:``,fromDate:``,fromTime:``,toDate:``,toTime:``};start=null;tab=`date`;returnFocus=null;uid=r++;constructor(e,t,n,r){this.layer=e,this.labels=t,this.locale=n,this.onSubmit=r}isOpen(){return this.backdrop!==null}open(e){this.close(!1),this.returnFocus=document.activeElement instanceof HTMLElement?document.activeElement:null,this.start=e,this.values={date:e.date.date,time:e.date.time,fromDate:e.range.from.date,fromTime:e.range.from.time,toDate:e.range.to.date,toTime:e.range.to.time},this.build(),this.renderTab(!0)}close(e=!0){if(!this.backdrop)return;this.backdrop.remove(),this.backdrop=this.fieldsEl=this.month=this.active=this.start=null,this.tabButtons=[];let t=this.returnFocus;this.returnFocus=null,e&&t?.isConnected&&t.focus()}destroy(){this.close(!1)}build(){let n=this.labels(),r=document.createElement(`div`);r.className=`tcw-modal-backdrop`;let i=!1;r.addEventListener(`pointerdown`,e=>{i=e.target===r}),r.addEventListener(`click`,e=>{e.target===r&&i&&this.close(),i=!1});let a=document.createElement(`div`);a.className=`tcw-modal tcw-goto`,e.o(a,`goToDate`),a.setAttribute(`role`,`dialog`),a.setAttribute(`aria-modal`,`true`),a.setAttribute(`aria-labelledby`,`tcw-goto-title-${this.uid}`),a.tabIndex=-1,a.addEventListener(`keydown`,e=>{if(e.stopPropagation(),e.key===`Escape`){e.preventDefault(),this.close();return}t.n(e,a)});let o=document.createElement(`div`);o.className=`tcw-modal-header`;let s=document.createElement(`h3`);s.id=`tcw-goto-title-${this.uid}`,s.textContent=n.title;let c=document.createElement(`button`);c.type=`button`,c.className=`tcw-modal-close`,c.setAttribute(`aria-label`,n.close),c.innerHTML=t.i(`x`,16),c.addEventListener(`click`,()=>this.close()),o.append(s,c);let l=document.createElement(`form`);l.className=`tcw-goto-form`,l.noValidate=!0,l.addEventListener(`submit`,e=>{e.preventDefault(),this.submit()});let u=document.createElement(`div`);u.className=`tcw-goto-fields`,u.id=`tcw-goto-panel-${this.uid}`,u.setAttribute(`role`,`tabpanel`);let d=new e.p(n.calendar,this.locale(),e=>this.pickDay(e));d.element.classList.add(`tcw-goto-calendar`),l.append(u,d.element,this.buildFooter(n)),a.append(o,this.buildTabs(n),l),r.appendChild(a),this.layer().appendChild(r),this.backdrop=r,this.fieldsEl=u,this.month=d}buildTabs(e){let t=document.createElement(`div`);return t.className=`tcw-modal-tabs`,t.setAttribute(`role`,`tablist`),t.addEventListener(`keydown`,e=>this.onTabKey(e)),this.tabButtons=n.map(t=>{let n=document.createElement(`button`);return n.type=`button`,n.className=`tcw-modal-tab`,n.id=`tcw-goto-tab-${this.uid}-${t}`,n.dataset.tab=t,n.setAttribute(`role`,`tab`),n.setAttribute(`aria-controls`,`tcw-goto-panel-${this.uid}`),n.textContent=t===`date`?e.date:e.range,n.addEventListener(`click`,()=>this.select(t,!1)),n}),t.append(...this.tabButtons),t}buildFooter(e){let t=document.createElement(`button`);t.type=`button`,t.className=`tcw-footer-cancel`,t.dataset.act=`cancel`,t.textContent=e.cancel,t.addEventListener(`click`,()=>this.close());let n=document.createElement(`button`);n.type=`submit`,n.className=`tcw-done-btn`,n.dataset.act=`go`,n.textContent=e.submit;let r=document.createElement(`div`);r.className=`tcw-footer-end`,r.append(t,n);let i=document.createElement(`div`);return i.className=`tcw-modal-footer`,i.appendChild(r),i}select(e,t){this.tab=e,this.renderTab(!t),t&&this.tabButtons.find(t=>t.dataset.tab===e)?.focus()}renderTab(e){let t=this.fieldsEl,n=this.start;if(!t||!n)return;for(let e of this.tabButtons){let t=e.dataset.tab===this.tab;e.setAttribute(`aria-selected`,String(t)),e.classList.toggle(`tcw-active`,t),e.tabIndex=t?0:-1}t.setAttribute(`aria-labelledby`,`tcw-goto-tab-${this.uid}-${this.tab}`);let r=this.labels();t.replaceChildren(...this.tab===`date`?[this.row(null,`date`,`time`,r)]:[this.row(r.from,`fromDate`,`fromTime`,r),this.row(r.to,`toDate`,`toTime`,r)]);let i=t.querySelector(`input[type="date"]`);this.setActive(i),e&&i?.focus()}row(e,t,n,r){let i=document.createElement(`div`);if(i.className=`tcw-goto-row`,e){let t=document.createElement(`span`);t.className=`tcw-goto-label`,t.textContent=e,i.appendChild(t)}let a=e?`${e} · `:``,o=this.input(`date`,t,`${a}${r.date}`);return o.required=!0,o.dataset.tcwCalendar=`inline`,this.start?.max&&(o.max=this.start.max),o.addEventListener(`focus`,()=>this.setActive(o)),o.addEventListener(`input`,()=>{o.removeAttribute(`aria-invalid`),this.active===o&&this.showMonth()}),i.appendChild(o),this.start?.withTime&&i.appendChild(this.input(`time`,n,`${a}${r.time}`)),i}input(e,t,n){let r=document.createElement(`input`);return r.type=e,r.className=`tcw-goto-input`,r.dataset.field=t,r.value=this.values[t],r.setAttribute(`aria-label`,n),r.addEventListener(`input`,()=>{this.values[t]=r.value}),r}setActive(e){this.active=e,this.showMonth()}showMonth(){this.active&&this.month?.show(this.active.value,{max:this.start?.max,today:this.start?.today})}pickDay(e){let t=this.active;if(!t)return;let n=this.month?.element.contains(document.activeElement)??!1;t.value=e,t.dispatchEvent(new Event(`input`,{bubbles:!0})),t.dispatchEvent(new Event(`change`,{bubbles:!0}));let r=t.dataset.field===`fromDate`?this.fieldsEl?.querySelector(`[data-field="toDate"]`):null;if(r){r.focus(),this.setActive(r);return}this.showMonth(),n&&this.month?.focusGrid()}submit(){let e=[...this.fieldsEl?.querySelectorAll(`[data-field]`)??[]];for(let t of e)this.values[t.dataset.field]=t.value;let t=this.start?.max,n=e.find(e=>e.type===`date`&&(!e.value||t!==void 0&&e.value>t));if(n){n.setAttribute(`aria-invalid`,`true`),n.focus();return}let r=this.values,i=this.start?.withTime??!1,a=e=>i?e:``,o;if(this.tab===`date`){if(!r.date)return;o={kind:`date`,date:r.date,time:a(r.time)}}else{if(!r.fromDate||!r.toDate)return;o={kind:`range`,from:{date:r.fromDate,time:a(r.fromTime)},to:{date:r.toDate,time:a(r.toTime)}}}this.close(),this.onSubmit(o)}onTabKey(e){let t=n.indexOf(this.tab),[r,i]=this.backdrop?.closest(`[dir]`)?.getAttribute(`dir`)===`rtl`?[`ArrowLeft`,`ArrowRight`]:[`ArrowRight`,`ArrowLeft`],a=e.key===r?(t+1)%n.length:e.key===i?(t-1+n.length)%n.length:e.key===`Home`?0:e.key===`End`?n.length-1:-1;a<0||(e.preventDefault(),this.select(n[a],!0))}};exports.WidgetGoToDate=i;
|
|
2
|
-
//# sourceMappingURL=WidgetGoToDate-CPzfStIm.cjs.map
|