@hanzo/ui 8.27.8 → 8.27.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.
Files changed (253) hide show
  1. package/README.md +2 -1
  2. package/dist/backends/gui/3d-card.cjs +100 -0
  3. package/dist/backends/gui/3d-card.d.ts +59 -0
  4. package/dist/backends/gui/3d-card.d.ts.map +1 -0
  5. package/dist/backends/gui/3d-card.js +92 -0
  6. package/dist/backends/gui/3d-card.js.map +1 -0
  7. package/dist/backends/gui/3d-marquee.cjs +225 -0
  8. package/dist/backends/gui/3d-marquee.d.ts +114 -0
  9. package/dist/backends/gui/3d-marquee.d.ts.map +1 -0
  10. package/dist/backends/gui/3d-marquee.js +190 -0
  11. package/dist/backends/gui/3d-marquee.js.map +1 -0
  12. package/dist/backends/gui/3d-pin.cjs +51 -0
  13. package/dist/backends/gui/3d-pin.d.ts +14 -0
  14. package/dist/backends/gui/3d-pin.d.ts.map +1 -0
  15. package/dist/backends/gui/3d-pin.js +49 -0
  16. package/dist/backends/gui/3d-pin.js.map +1 -0
  17. package/dist/backends/gui/advanced-chart.cjs +61 -0
  18. package/dist/backends/gui/advanced-chart.d.ts +38 -0
  19. package/dist/backends/gui/advanced-chart.d.ts.map +1 -0
  20. package/dist/backends/gui/advanced-chart.js +59 -0
  21. package/dist/backends/gui/advanced-chart.js.map +1 -0
  22. package/dist/backends/gui/alert.cjs +106 -0
  23. package/dist/backends/gui/alert.d.ts +39 -0
  24. package/dist/backends/gui/alert.d.ts.map +1 -0
  25. package/dist/backends/gui/alert.js +102 -0
  26. package/dist/backends/gui/alert.js.map +1 -0
  27. package/dist/backends/gui/android.cjs +52 -0
  28. package/dist/backends/gui/android.d.ts +16 -0
  29. package/dist/backends/gui/android.d.ts.map +1 -0
  30. package/dist/backends/gui/android.js +50 -0
  31. package/dist/backends/gui/android.js.map +1 -0
  32. package/dist/backends/gui/animated-beam.cjs +97 -0
  33. package/dist/backends/gui/animated-beam.d.ts +57 -0
  34. package/dist/backends/gui/animated-beam.d.ts.map +1 -0
  35. package/dist/backends/gui/animated-beam.js +62 -0
  36. package/dist/backends/gui/animated-beam.js.map +1 -0
  37. package/dist/backends/gui/animated-cursor.cjs +183 -0
  38. package/dist/backends/gui/animated-cursor.d.ts +42 -0
  39. package/dist/backends/gui/animated-cursor.d.ts.map +1 -0
  40. package/dist/backends/gui/animated-cursor.js +181 -0
  41. package/dist/backends/gui/animated-cursor.js.map +1 -0
  42. package/dist/backends/gui/animated-testimonials.cjs +109 -0
  43. package/dist/backends/gui/animated-testimonials.d.ts +23 -0
  44. package/dist/backends/gui/animated-testimonials.d.ts.map +1 -0
  45. package/dist/backends/gui/animated-testimonials.js +74 -0
  46. package/dist/backends/gui/animated-testimonials.js.map +1 -0
  47. package/dist/backends/gui/animated-tooltip.cjs +100 -0
  48. package/dist/backends/gui/animated-tooltip.d.ts +15 -0
  49. package/dist/backends/gui/animated-tooltip.d.ts.map +1 -0
  50. package/dist/backends/gui/animated-tooltip.js +65 -0
  51. package/dist/backends/gui/animated-tooltip.js.map +1 -0
  52. package/dist/backends/gui/announcement.cjs +54 -0
  53. package/dist/backends/gui/announcement.d.ts +26 -0
  54. package/dist/backends/gui/announcement.d.ts.map +1 -0
  55. package/dist/backends/gui/announcement.js +52 -0
  56. package/dist/backends/gui/announcement.js.map +1 -0
  57. package/dist/backends/gui/apple-cards-carousel.cjs +198 -0
  58. package/dist/backends/gui/apple-cards-carousel.d.ts +45 -0
  59. package/dist/backends/gui/apple-cards-carousel.d.ts.map +1 -0
  60. package/dist/backends/gui/apple-cards-carousel.js +162 -0
  61. package/dist/backends/gui/apple-cards-carousel.js.map +1 -0
  62. package/dist/backends/gui/apple-hello-effect.cjs +38 -0
  63. package/dist/backends/gui/apple-hello-effect.d.ts +9 -0
  64. package/dist/backends/gui/apple-hello-effect.d.ts.map +1 -0
  65. package/dist/backends/gui/apple-hello-effect.js +36 -0
  66. package/dist/backends/gui/apple-hello-effect.js.map +1 -0
  67. package/dist/backends/gui/banner.cjs +108 -0
  68. package/dist/backends/gui/banner.d.ts +33 -0
  69. package/dist/backends/gui/banner.d.ts.map +1 -0
  70. package/dist/backends/gui/banner.js +106 -0
  71. package/dist/backends/gui/banner.js.map +1 -0
  72. package/dist/backends/gui/calendar.cjs +152 -0
  73. package/dist/backends/gui/calendar.d.ts +41 -0
  74. package/dist/backends/gui/calendar.d.ts.map +1 -0
  75. package/dist/backends/gui/calendar.js +151 -0
  76. package/dist/backends/gui/calendar.js.map +1 -0
  77. package/dist/backends/gui/choicebox.cjs +50 -0
  78. package/dist/backends/gui/choicebox.d.ts +33 -0
  79. package/dist/backends/gui/choicebox.d.ts.map +1 -0
  80. package/dist/backends/gui/choicebox.js +49 -0
  81. package/dist/backends/gui/choicebox.js.map +1 -0
  82. package/dist/backends/gui/code-block.cjs +120 -0
  83. package/dist/backends/gui/code-block.d.ts +22 -0
  84. package/dist/backends/gui/code-block.d.ts.map +1 -0
  85. package/dist/backends/gui/code-block.js +118 -0
  86. package/dist/backends/gui/code-block.js.map +1 -0
  87. package/dist/backends/gui/code-editor.cjs +195 -0
  88. package/dist/backends/gui/code-editor.d.ts +43 -0
  89. package/dist/backends/gui/code-editor.d.ts.map +1 -0
  90. package/dist/backends/gui/code-editor.js +160 -0
  91. package/dist/backends/gui/code-editor.js.map +1 -0
  92. package/dist/backends/gui/code-tabs.cjs +21 -0
  93. package/dist/backends/gui/code-tabs.d.ts +22 -0
  94. package/dist/backends/gui/code-tabs.d.ts.map +1 -0
  95. package/dist/backends/gui/code-tabs.js +19 -0
  96. package/dist/backends/gui/code-tabs.js.map +1 -0
  97. package/dist/backends/gui/color-picker.cjs +141 -0
  98. package/dist/backends/gui/color-picker.d.ts +25 -0
  99. package/dist/backends/gui/color-picker.d.ts.map +1 -0
  100. package/dist/backends/gui/color-picker.js +139 -0
  101. package/dist/backends/gui/color-picker.js.map +1 -0
  102. package/dist/backends/gui/combobox.cjs +42 -0
  103. package/dist/backends/gui/combobox.d.ts +39 -0
  104. package/dist/backends/gui/combobox.d.ts.map +1 -0
  105. package/dist/backends/gui/combobox.js +40 -0
  106. package/dist/backends/gui/combobox.js.map +1 -0
  107. package/dist/backends/gui/company-profile.cjs +43 -0
  108. package/dist/backends/gui/company-profile.d.ts +33 -0
  109. package/dist/backends/gui/company-profile.d.ts.map +1 -0
  110. package/dist/backends/gui/company-profile.js +41 -0
  111. package/dist/backends/gui/company-profile.js.map +1 -0
  112. package/dist/backends/gui/comparison.cjs +43 -0
  113. package/dist/backends/gui/comparison.d.ts +16 -0
  114. package/dist/backends/gui/comparison.d.ts.map +1 -0
  115. package/dist/backends/gui/comparison.js +41 -0
  116. package/dist/backends/gui/comparison.js.map +1 -0
  117. package/dist/backends/gui/credit-card.cjs +80 -0
  118. package/dist/backends/gui/credit-card.d.ts +21 -0
  119. package/dist/backends/gui/credit-card.d.ts.map +1 -0
  120. package/dist/backends/gui/credit-card.js +78 -0
  121. package/dist/backends/gui/credit-card.js.map +1 -0
  122. package/dist/backends/gui/crypto-market.cjs +128 -0
  123. package/dist/backends/gui/crypto-market.d.ts +52 -0
  124. package/dist/backends/gui/crypto-market.d.ts.map +1 -0
  125. package/dist/backends/gui/crypto-market.js +126 -0
  126. package/dist/backends/gui/crypto-market.js.map +1 -0
  127. package/dist/backends/gui/crypto-screener.cjs +55 -0
  128. package/dist/backends/gui/crypto-screener.d.ts +42 -0
  129. package/dist/backends/gui/crypto-screener.d.ts.map +1 -0
  130. package/dist/backends/gui/crypto-screener.js +53 -0
  131. package/dist/backends/gui/crypto-screener.js.map +1 -0
  132. package/dist/backends/gui/cursor.cjs +40 -0
  133. package/dist/backends/gui/cursor.d.ts +16 -0
  134. package/dist/backends/gui/cursor.d.ts.map +1 -0
  135. package/dist/backends/gui/cursor.js +38 -0
  136. package/dist/backends/gui/cursor.js.map +1 -0
  137. package/dist/backends/gui/data-table.cjs +211 -0
  138. package/dist/backends/gui/data-table.d.ts +71 -0
  139. package/dist/backends/gui/data-table.d.ts.map +1 -0
  140. package/dist/backends/gui/data-table.js +175 -0
  141. package/dist/backends/gui/data-table.js.map +1 -0
  142. package/dist/backends/gui/date-picker.cjs +66 -0
  143. package/dist/backends/gui/date-picker.d.ts +29 -0
  144. package/dist/backends/gui/date-picker.d.ts.map +1 -0
  145. package/dist/backends/gui/date-picker.js +64 -0
  146. package/dist/backends/gui/date-picker.js.map +1 -0
  147. package/dist/backends/gui/desktop-spotlight.cjs +46 -0
  148. package/dist/backends/gui/desktop-spotlight.d.ts +34 -0
  149. package/dist/backends/gui/desktop-spotlight.d.ts.map +1 -0
  150. package/dist/backends/gui/desktop-spotlight.js +44 -0
  151. package/dist/backends/gui/desktop-spotlight.js.map +1 -0
  152. package/dist/backends/gui/desktop-window.cjs +180 -0
  153. package/dist/backends/gui/desktop-window.d.ts +51 -0
  154. package/dist/backends/gui/desktop-window.d.ts.map +1 -0
  155. package/dist/backends/gui/desktop-window.js +177 -0
  156. package/dist/backends/gui/desktop-window.js.map +1 -0
  157. package/dist/backends/gui/desktop.cjs +238 -0
  158. package/dist/backends/gui/desktop.d.ts +109 -0
  159. package/dist/backends/gui/desktop.d.ts.map +1 -0
  160. package/dist/backends/gui/desktop.js +199 -0
  161. package/dist/backends/gui/desktop.js.map +1 -0
  162. package/dist/backends/gui/dialog-stack.cjs +26 -0
  163. package/dist/backends/gui/dialog-stack.d.ts +23 -0
  164. package/dist/backends/gui/dialog-stack.d.ts.map +1 -0
  165. package/dist/backends/gui/dialog-stack.js +24 -0
  166. package/dist/backends/gui/dialog-stack.js.map +1 -0
  167. package/dist/backends/gui/dock.cjs +99 -0
  168. package/dist/backends/gui/dock.d.ts +41 -0
  169. package/dist/backends/gui/dock.d.ts.map +1 -0
  170. package/dist/backends/gui/dock.js +96 -0
  171. package/dist/backends/gui/dock.js.map +1 -0
  172. package/dist/backends/gui/dropzone.cjs +142 -0
  173. package/dist/backends/gui/dropzone.d.ts +12 -0
  174. package/dist/backends/gui/dropzone.d.ts.map +1 -0
  175. package/dist/backends/gui/dropzone.js +140 -0
  176. package/dist/backends/gui/dropzone.js.map +1 -0
  177. package/dist/backends/gui/editor.cjs +80 -0
  178. package/dist/backends/gui/editor.d.ts +23 -0
  179. package/dist/backends/gui/editor.d.ts.map +1 -0
  180. package/dist/backends/gui/editor.js +45 -0
  181. package/dist/backends/gui/editor.js.map +1 -0
  182. package/dist/backends/gui/empty.cjs +71 -0
  183. package/dist/backends/gui/empty.d.ts +43 -0
  184. package/dist/backends/gui/empty.d.ts.map +1 -0
  185. package/dist/backends/gui/empty.js +63 -0
  186. package/dist/backends/gui/empty.js.map +1 -0
  187. package/dist/backends/gui/financials.cjs +45 -0
  188. package/dist/backends/gui/financials.d.ts +36 -0
  189. package/dist/backends/gui/financials.d.ts.map +1 -0
  190. package/dist/backends/gui/financials.js +43 -0
  191. package/dist/backends/gui/financials.js.map +1 -0
  192. package/dist/backends/gui/forex-market.cjs +21 -0
  193. package/dist/backends/gui/forex-market.d.ts +17 -0
  194. package/dist/backends/gui/forex-market.d.ts.map +1 -0
  195. package/dist/backends/gui/forex-market.js +19 -0
  196. package/dist/backends/gui/forex-market.js.map +1 -0
  197. package/dist/backends/gui/forex-screener.cjs +57 -0
  198. package/dist/backends/gui/forex-screener.d.ts +45 -0
  199. package/dist/backends/gui/forex-screener.d.ts.map +1 -0
  200. package/dist/backends/gui/forex-screener.js +55 -0
  201. package/dist/backends/gui/forex-screener.js.map +1 -0
  202. package/dist/backends/gui/gantt.cjs +50 -0
  203. package/dist/backends/gui/gantt.d.ts +19 -0
  204. package/dist/backends/gui/gantt.d.ts.map +1 -0
  205. package/dist/backends/gui/gantt.js +49 -0
  206. package/dist/backends/gui/gantt.js.map +1 -0
  207. package/dist/backends/gui/index.cjs +108 -1
  208. package/dist/backends/gui/index.d.ts +41 -0
  209. package/dist/backends/gui/index.d.ts.map +1 -1
  210. package/dist/backends/gui/index.js +41 -0
  211. package/dist/backends/gui/index.js.map +1 -1
  212. package/dist/canvas.cjs +3 -3
  213. package/dist/canvas.js +3 -3
  214. package/dist/canvas.js.map +1 -1
  215. package/dist/gallery.html +2 -2
  216. package/dist/grid.cjs +19 -43
  217. package/dist/grid.d.ts +36 -1
  218. package/dist/grid.d.ts.map +1 -1
  219. package/dist/grid.js +19 -43
  220. package/dist/grid.js.map +1 -1
  221. package/dist/index.cjs +70 -1
  222. package/dist/index.d.ts +1 -0
  223. package/dist/index.d.ts.map +1 -1
  224. package/dist/index.js +3 -0
  225. package/dist/index.js.map +1 -1
  226. package/dist/index.node.cjs +70 -1
  227. package/dist/index.node.js +3 -0
  228. package/dist/product/ChunkGuard.cjs +58 -0
  229. package/dist/product/ChunkGuard.d.ts +7 -0
  230. package/dist/product/ChunkGuard.d.ts.map +1 -0
  231. package/dist/product/ChunkGuard.js +56 -0
  232. package/dist/product/ChunkGuard.js.map +1 -0
  233. package/dist/product/DetailPane.cjs +46 -0
  234. package/dist/product/DetailPane.d.ts +47 -0
  235. package/dist/product/DetailPane.d.ts.map +1 -0
  236. package/dist/product/DetailPane.js +43 -0
  237. package/dist/product/DetailPane.js.map +1 -0
  238. package/dist/product/Fact.cjs +19 -0
  239. package/dist/product/Fact.d.ts +23 -0
  240. package/dist/product/Fact.d.ts.map +1 -0
  241. package/dist/product/Fact.js +17 -0
  242. package/dist/product/Fact.js.map +1 -0
  243. package/dist/product/chunkGuard.logic.cjs +54 -0
  244. package/dist/product/chunkGuard.logic.d.ts +26 -0
  245. package/dist/product/chunkGuard.logic.d.ts.map +1 -0
  246. package/dist/product/chunkGuard.logic.js +49 -0
  247. package/dist/product/chunkGuard.logic.js.map +1 -0
  248. package/dist/product/index.cjs +10 -0
  249. package/dist/product/index.d.ts +3 -0
  250. package/dist/product/index.d.ts.map +1 -1
  251. package/dist/product/index.js +10 -0
  252. package/dist/product/index.js.map +1 -1
  253. package/package.json +5 -3
@@ -0,0 +1,128 @@
1
+ 'use client';"use strict";
2
+ 'use client';
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.MarketOverview = void 0;
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ /**
7
+ * MarketOverview — a TradingView multi-tab market table, in a gui frame.
8
+ *
9
+ * The rows are TradingView's, drawn inside TradingView's own document, so the
10
+ * table is an `<iframe>` and nothing here draws a pixel of it. What this owns
11
+ * is the frame around it and the settings the table opens with — which tabs,
12
+ * which symbols fill each one, the date range, the theme — written into the
13
+ * iframe's address the way TradingView's own embed script writes them:
14
+ * `/embed-widget/market-overview/?locale=…#<settings as JSON>`. Nothing is
15
+ * fetched or injected at mount, so the markup is the same on the server and in
16
+ * the browser, and the frame has its height before the table arrives.
17
+ *
18
+ * A tab is named by one of the built-in symbol groups (`crypto`, `indices`,
19
+ * `futures`, `bonds`, `forex`) or spelled out in full as a `{ title, symbols }`
20
+ * pair, so a caller reaches for `tabs={['crypto']}` most of the time and for a
21
+ * custom group only when the built-ins don't cover it.
22
+ *
23
+ * The iframe is keyed on that address. A browser treats a `src` that differs
24
+ * only in its fragment as a same-document navigation and does not reload, so
25
+ * without the key a changed `tabs` would leave the old table on screen.
26
+ */
27
+ const gui_1 = require("@hanzo/gui");
28
+ const slot_1 = require("./slot.cjs");
29
+ const PRESETS = {
30
+ crypto: {
31
+ title: 'Crypto',
32
+ symbols: [
33
+ { s: 'BINANCE:BTCUSDT', d: 'Bitcoin' },
34
+ { s: 'BINANCE:ETHUSDT', d: 'Ethereum' },
35
+ { s: 'BINANCE:SOLUSDT', d: 'Solana' },
36
+ { s: 'BINANCE:BNBUSDT', d: 'BNB' },
37
+ { s: 'BINANCE:XRPUSDT', d: 'XRP' },
38
+ { s: 'BINANCE:ADAUSDT', d: 'Cardano' },
39
+ ],
40
+ },
41
+ indices: {
42
+ title: 'Indices',
43
+ symbols: [
44
+ { s: 'FOREXCOM:SPXUSD', d: 'S&P 500 Index' },
45
+ { s: 'FOREXCOM:NSXUSD', d: 'US 100 Cash CFD' },
46
+ { s: 'FOREXCOM:DJI', d: 'Dow Jones Industrial Average Index' },
47
+ { s: 'INDEX:NKY', d: 'Japan 225' },
48
+ { s: 'INDEX:DEU40', d: 'DAX Index' },
49
+ { s: 'FOREXCOM:UKXGBP', d: 'FTSE 100 Index' },
50
+ ],
51
+ },
52
+ futures: {
53
+ title: 'Futures',
54
+ symbols: [
55
+ { s: 'BMFBOVESPA:ISP1!', d: 'S&P 500' },
56
+ { s: 'BMFBOVESPA:EUR1!', d: 'Euro' },
57
+ { s: 'CMCMARKETS:GOLD', d: 'Gold' },
58
+ { s: 'PYTH:WTI3!', d: 'WTI Crude Oil' },
59
+ { s: 'BMFBOVESPA:CCM1!', d: 'Corn' },
60
+ ],
61
+ },
62
+ bonds: {
63
+ title: 'Bonds',
64
+ symbols: [
65
+ { s: 'EUREX:FGBL1!', d: 'Euro Bund' },
66
+ { s: 'EUREX:FBTP1!', d: 'Euro BTP' },
67
+ { s: 'EUREX:FGBM1!', d: 'Euro BOBL' },
68
+ ],
69
+ },
70
+ forex: {
71
+ title: 'Forex',
72
+ symbols: [
73
+ { s: 'FX:EURUSD', d: 'EUR to USD' },
74
+ { s: 'FX:GBPUSD', d: 'GBP to USD' },
75
+ { s: 'FX:USDJPY', d: 'USD to JPY' },
76
+ { s: 'FX:USDCHF', d: 'USD to CHF' },
77
+ { s: 'FX:AUDUSD', d: 'AUD to USD' },
78
+ { s: 'FX:USDCAD', d: 'USD to CAD' },
79
+ ],
80
+ },
81
+ };
82
+ const resolveTab = (tab) => typeof tab === 'string' ? PRESETS[tab] : tab;
83
+ const EMBED = 'https://www.tradingview-widget.com/embed-widget/market-overview/?locale=';
84
+ /** The settings TradingView reads, with the documented defaults filled in. */
85
+ const settings = ({ tabs = ['crypto'], colorTheme = 'dark', dateRange = '12M', locale = 'en', isTransparent = false, showFloatingTooltip = false, showSymbolLogo = true, showChart = true, width = '100%', height = 550, }) => ({
86
+ colorTheme,
87
+ dateRange,
88
+ locale,
89
+ isTransparent,
90
+ showFloatingTooltip,
91
+ plotLineColorGrowing: 'rgba(41, 98, 255, 1)',
92
+ plotLineColorFalling: 'rgba(41, 98, 255, 1)',
93
+ gridLineColor: 'rgba(240, 243, 250, 0)',
94
+ scaleFontColor: colorTheme === 'dark' ? '#DBDBDB' : '#333333',
95
+ belowLineFillColorGrowing: 'rgba(41, 98, 255, 0.12)',
96
+ belowLineFillColorFalling: 'rgba(41, 98, 255, 0.12)',
97
+ belowLineFillColorGrowingBottom: 'rgba(41, 98, 255, 0)',
98
+ belowLineFillColorFallingBottom: 'rgba(41, 98, 255, 0)',
99
+ symbolActiveColor: 'rgba(41, 98, 255, 0.12)',
100
+ tabs: tabs.map(resolveTab),
101
+ support_host: 'https://www.tradingview.com',
102
+ backgroundColor: colorTheme === 'dark' ? '#0f0f0f' : '#ffffff',
103
+ width,
104
+ height,
105
+ showSymbolLogo,
106
+ showChart,
107
+ });
108
+ const MarketOverview = ({ tabs, colorTheme, dateRange, locale, isTransparent, showFloatingTooltip, showSymbolLogo, showChart, width, height, ...props }) => {
109
+ const s = settings({
110
+ tabs,
111
+ colorTheme,
112
+ dateRange,
113
+ locale,
114
+ isTransparent,
115
+ showFloatingTooltip,
116
+ showSymbolLogo,
117
+ showChart,
118
+ width,
119
+ height,
120
+ });
121
+ const src = `${EMBED}${s.locale}#${encodeURIComponent(JSON.stringify(s))}`;
122
+ const titles = s.tabs.map((t) => t.title).join(', ');
123
+ return ((0, jsx_runtime_1.jsx)(gui_1.YStack, { ...(0, slot_1.slot)('market-overview'), "data-tabs": s.tabs.map((t) => t.title).join(','), "data-color-theme": s.colorTheme,
124
+ // The documented size is TradingView's — a number or a percent string —
125
+ // and gui declares a narrower one; on web both reach CSS as written.
126
+ width: s.width, height: s.height, overflow: "hidden", position: "relative", bg: "$panel", ...props, children: gui_1.isWeb && ((0, jsx_runtime_1.jsx)("iframe", { src: src, title: `${titles} market overview`, loading: "lazy", scrolling: "no", style: { display: 'block', width: '100%', height: '100%', border: 0 } }, src)) }));
127
+ };
128
+ exports.MarketOverview = MarketOverview;
@@ -0,0 +1,52 @@
1
+ /**
2
+ * MarketOverview — a TradingView multi-tab market table, in a gui frame.
3
+ *
4
+ * The rows are TradingView's, drawn inside TradingView's own document, so the
5
+ * table is an `<iframe>` and nothing here draws a pixel of it. What this owns
6
+ * is the frame around it and the settings the table opens with — which tabs,
7
+ * which symbols fill each one, the date range, the theme — written into the
8
+ * iframe's address the way TradingView's own embed script writes them:
9
+ * `/embed-widget/market-overview/?locale=…#<settings as JSON>`. Nothing is
10
+ * fetched or injected at mount, so the markup is the same on the server and in
11
+ * the browser, and the frame has its height before the table arrives.
12
+ *
13
+ * A tab is named by one of the built-in symbol groups (`crypto`, `indices`,
14
+ * `futures`, `bonds`, `forex`) or spelled out in full as a `{ title, symbols }`
15
+ * pair, so a caller reaches for `tabs={['crypto']}` most of the time and for a
16
+ * custom group only when the built-ins don't cover it.
17
+ *
18
+ * The iframe is keyed on that address. A browser treats a `src` that differs
19
+ * only in its fragment as a same-document navigation and does not reload, so
20
+ * without the key a changed `tabs` would leave the old table on screen.
21
+ */
22
+ import { type YStackProps } from '@hanzo/gui';
23
+ export interface MarketOverviewSymbol {
24
+ /** Exchange-qualified ticker, e.g. `BINANCE:BTCUSDT`. */
25
+ s: string;
26
+ /** The label shown in the row. */
27
+ d: string;
28
+ }
29
+ export interface MarketOverviewTab {
30
+ title: string;
31
+ symbols: MarketOverviewSymbol[];
32
+ }
33
+ export type MarketOverviewPreset = 'crypto' | 'indices' | 'futures' | 'bonds' | 'forex';
34
+ export type MarketOverviewTheme = 'light' | 'dark';
35
+ export interface MarketOverviewProps extends Omit<YStackProps, 'width' | 'height' | 'theme'> {
36
+ /** Which tabs the table opens with, a preset name or a spelled-out group. */
37
+ tabs?: (MarketOverviewPreset | MarketOverviewTab)[];
38
+ /** The table's own palette; independent of the surrounding gui theme. */
39
+ colorTheme?: MarketOverviewTheme;
40
+ /** How far back the sparkline in each row reaches. */
41
+ dateRange?: string;
42
+ locale?: string;
43
+ isTransparent?: boolean;
44
+ showFloatingTooltip?: boolean;
45
+ showSymbolLogo?: boolean;
46
+ showChart?: boolean;
47
+ width?: string | number;
48
+ height?: string | number;
49
+ }
50
+ declare const MarketOverview: ({ tabs, colorTheme, dateRange, locale, isTransparent, showFloatingTooltip, showSymbolLogo, showChart, width, height, ...props }: MarketOverviewProps) => import("react").JSX.Element;
51
+ export { MarketOverview };
52
+ //# sourceMappingURL=crypto-market.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"crypto-market.d.ts","sourceRoot":"","sources":["../../../src/backends/gui/crypto-market.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EAAiB,KAAK,WAAW,EAAE,MAAM,YAAY,CAAA;AAG5D,MAAM,WAAW,oBAAoB;IACnC,yDAAyD;IACzD,CAAC,EAAE,MAAM,CAAA;IACT,kCAAkC;IAClC,CAAC,EAAE,MAAM,CAAA;CACV;AAED,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,oBAAoB,EAAE,CAAA;CAChC;AAED,MAAM,MAAM,oBAAoB,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,CAAA;AAEvF,MAAM,MAAM,mBAAmB,GAAG,OAAO,GAAG,MAAM,CAAA;AA2DlD,MAAM,WAAW,mBAAoB,SAAQ,IAAI,CAAC,WAAW,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;IAC1F,6EAA6E;IAC7E,IAAI,CAAC,EAAE,CAAC,oBAAoB,GAAG,iBAAiB,CAAC,EAAE,CAAA;IACnD,yEAAyE;IACzE,UAAU,CAAC,EAAE,mBAAmB,CAAA;IAChC,sDAAsD;IACtD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACvB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CACzB;AAwCD,QAAA,MAAM,cAAc,oIAYjB,mBAAmB,gCAyCrB,CAAA;AAED,OAAO,EAAE,cAAc,EAAE,CAAA"}
@@ -0,0 +1,126 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ /**
4
+ * MarketOverview — a TradingView multi-tab market table, in a gui frame.
5
+ *
6
+ * The rows are TradingView's, drawn inside TradingView's own document, so the
7
+ * table is an `<iframe>` and nothing here draws a pixel of it. What this owns
8
+ * is the frame around it and the settings the table opens with — which tabs,
9
+ * which symbols fill each one, the date range, the theme — written into the
10
+ * iframe's address the way TradingView's own embed script writes them:
11
+ * `/embed-widget/market-overview/?locale=…#<settings as JSON>`. Nothing is
12
+ * fetched or injected at mount, so the markup is the same on the server and in
13
+ * the browser, and the frame has its height before the table arrives.
14
+ *
15
+ * A tab is named by one of the built-in symbol groups (`crypto`, `indices`,
16
+ * `futures`, `bonds`, `forex`) or spelled out in full as a `{ title, symbols }`
17
+ * pair, so a caller reaches for `tabs={['crypto']}` most of the time and for a
18
+ * custom group only when the built-ins don't cover it.
19
+ *
20
+ * The iframe is keyed on that address. A browser treats a `src` that differs
21
+ * only in its fragment as a same-document navigation and does not reload, so
22
+ * without the key a changed `tabs` would leave the old table on screen.
23
+ */
24
+ import { YStack, isWeb } from '@hanzo/gui';
25
+ import { slot } from './slot.js';
26
+ const PRESETS = {
27
+ crypto: {
28
+ title: 'Crypto',
29
+ symbols: [
30
+ { s: 'BINANCE:BTCUSDT', d: 'Bitcoin' },
31
+ { s: 'BINANCE:ETHUSDT', d: 'Ethereum' },
32
+ { s: 'BINANCE:SOLUSDT', d: 'Solana' },
33
+ { s: 'BINANCE:BNBUSDT', d: 'BNB' },
34
+ { s: 'BINANCE:XRPUSDT', d: 'XRP' },
35
+ { s: 'BINANCE:ADAUSDT', d: 'Cardano' },
36
+ ],
37
+ },
38
+ indices: {
39
+ title: 'Indices',
40
+ symbols: [
41
+ { s: 'FOREXCOM:SPXUSD', d: 'S&P 500 Index' },
42
+ { s: 'FOREXCOM:NSXUSD', d: 'US 100 Cash CFD' },
43
+ { s: 'FOREXCOM:DJI', d: 'Dow Jones Industrial Average Index' },
44
+ { s: 'INDEX:NKY', d: 'Japan 225' },
45
+ { s: 'INDEX:DEU40', d: 'DAX Index' },
46
+ { s: 'FOREXCOM:UKXGBP', d: 'FTSE 100 Index' },
47
+ ],
48
+ },
49
+ futures: {
50
+ title: 'Futures',
51
+ symbols: [
52
+ { s: 'BMFBOVESPA:ISP1!', d: 'S&P 500' },
53
+ { s: 'BMFBOVESPA:EUR1!', d: 'Euro' },
54
+ { s: 'CMCMARKETS:GOLD', d: 'Gold' },
55
+ { s: 'PYTH:WTI3!', d: 'WTI Crude Oil' },
56
+ { s: 'BMFBOVESPA:CCM1!', d: 'Corn' },
57
+ ],
58
+ },
59
+ bonds: {
60
+ title: 'Bonds',
61
+ symbols: [
62
+ { s: 'EUREX:FGBL1!', d: 'Euro Bund' },
63
+ { s: 'EUREX:FBTP1!', d: 'Euro BTP' },
64
+ { s: 'EUREX:FGBM1!', d: 'Euro BOBL' },
65
+ ],
66
+ },
67
+ forex: {
68
+ title: 'Forex',
69
+ symbols: [
70
+ { s: 'FX:EURUSD', d: 'EUR to USD' },
71
+ { s: 'FX:GBPUSD', d: 'GBP to USD' },
72
+ { s: 'FX:USDJPY', d: 'USD to JPY' },
73
+ { s: 'FX:USDCHF', d: 'USD to CHF' },
74
+ { s: 'FX:AUDUSD', d: 'AUD to USD' },
75
+ { s: 'FX:USDCAD', d: 'USD to CAD' },
76
+ ],
77
+ },
78
+ };
79
+ const resolveTab = (tab) => typeof tab === 'string' ? PRESETS[tab] : tab;
80
+ const EMBED = 'https://www.tradingview-widget.com/embed-widget/market-overview/?locale=';
81
+ /** The settings TradingView reads, with the documented defaults filled in. */
82
+ const settings = ({ tabs = ['crypto'], colorTheme = 'dark', dateRange = '12M', locale = 'en', isTransparent = false, showFloatingTooltip = false, showSymbolLogo = true, showChart = true, width = '100%', height = 550, }) => ({
83
+ colorTheme,
84
+ dateRange,
85
+ locale,
86
+ isTransparent,
87
+ showFloatingTooltip,
88
+ plotLineColorGrowing: 'rgba(41, 98, 255, 1)',
89
+ plotLineColorFalling: 'rgba(41, 98, 255, 1)',
90
+ gridLineColor: 'rgba(240, 243, 250, 0)',
91
+ scaleFontColor: colorTheme === 'dark' ? '#DBDBDB' : '#333333',
92
+ belowLineFillColorGrowing: 'rgba(41, 98, 255, 0.12)',
93
+ belowLineFillColorFalling: 'rgba(41, 98, 255, 0.12)',
94
+ belowLineFillColorGrowingBottom: 'rgba(41, 98, 255, 0)',
95
+ belowLineFillColorFallingBottom: 'rgba(41, 98, 255, 0)',
96
+ symbolActiveColor: 'rgba(41, 98, 255, 0.12)',
97
+ tabs: tabs.map(resolveTab),
98
+ support_host: 'https://www.tradingview.com',
99
+ backgroundColor: colorTheme === 'dark' ? '#0f0f0f' : '#ffffff',
100
+ width,
101
+ height,
102
+ showSymbolLogo,
103
+ showChart,
104
+ });
105
+ const MarketOverview = ({ tabs, colorTheme, dateRange, locale, isTransparent, showFloatingTooltip, showSymbolLogo, showChart, width, height, ...props }) => {
106
+ const s = settings({
107
+ tabs,
108
+ colorTheme,
109
+ dateRange,
110
+ locale,
111
+ isTransparent,
112
+ showFloatingTooltip,
113
+ showSymbolLogo,
114
+ showChart,
115
+ width,
116
+ height,
117
+ });
118
+ const src = `${EMBED}${s.locale}#${encodeURIComponent(JSON.stringify(s))}`;
119
+ const titles = s.tabs.map((t) => t.title).join(', ');
120
+ return (_jsx(YStack, { ...slot('market-overview'), "data-tabs": s.tabs.map((t) => t.title).join(','), "data-color-theme": s.colorTheme,
121
+ // The documented size is TradingView's — a number or a percent string —
122
+ // and gui declares a narrower one; on web both reach CSS as written.
123
+ width: s.width, height: s.height, overflow: "hidden", position: "relative", bg: "$panel", ...props, children: isWeb && (_jsx("iframe", { src: src, title: `${titles} market overview`, loading: "lazy", scrolling: "no", style: { display: 'block', width: '100%', height: '100%', border: 0 } }, src)) }));
124
+ };
125
+ export { MarketOverview };
126
+ //# sourceMappingURL=crypto-market.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"crypto-market.js","sourceRoot":"","sources":["../../../src/backends/gui/crypto-market.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EAAE,MAAM,EAAE,KAAK,EAAoB,MAAM,YAAY,CAAA;AAC5D,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAkB7B,MAAM,OAAO,GAAoD;IAC/D,MAAM,EAAE;QACN,KAAK,EAAE,QAAQ;QACf,OAAO,EAAE;YACP,EAAE,CAAC,EAAE,iBAAiB,EAAE,CAAC,EAAE,SAAS,EAAE;YACtC,EAAE,CAAC,EAAE,iBAAiB,EAAE,CAAC,EAAE,UAAU,EAAE;YACvC,EAAE,CAAC,EAAE,iBAAiB,EAAE,CAAC,EAAE,QAAQ,EAAE;YACrC,EAAE,CAAC,EAAE,iBAAiB,EAAE,CAAC,EAAE,KAAK,EAAE;YAClC,EAAE,CAAC,EAAE,iBAAiB,EAAE,CAAC,EAAE,KAAK,EAAE;YAClC,EAAE,CAAC,EAAE,iBAAiB,EAAE,CAAC,EAAE,SAAS,EAAE;SACvC;KACF;IACD,OAAO,EAAE;QACP,KAAK,EAAE,SAAS;QAChB,OAAO,EAAE;YACP,EAAE,CAAC,EAAE,iBAAiB,EAAE,CAAC,EAAE,eAAe,EAAE;YAC5C,EAAE,CAAC,EAAE,iBAAiB,EAAE,CAAC,EAAE,iBAAiB,EAAE;YAC9C,EAAE,CAAC,EAAE,cAAc,EAAE,CAAC,EAAE,oCAAoC,EAAE;YAC9D,EAAE,CAAC,EAAE,WAAW,EAAE,C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;AAED,OAAO,EAAE,cAAc,EAAE,CAAA"}
@@ -0,0 +1,55 @@
1
+ 'use client';"use strict";
2
+ 'use client';
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.CryptoScreener = void 0;
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ /**
7
+ * CryptoScreener — a TradingView screener table, in a gui frame.
8
+ *
9
+ * The rows are TradingView's, drawn inside TradingView's own document, so the
10
+ * table is an `<iframe>` and nothing here draws a pixel of it. What this owns
11
+ * is the frame around it and the settings the table opens with — which market
12
+ * it screens, which column set it opens on, the display currency, the theme —
13
+ * written into the iframe's address the way TradingView's own embed script
14
+ * writes them: `/embed-widget/screener/?locale=…#<settings as JSON>`. Nothing
15
+ * is fetched or injected at mount, so the markup is the same on the server and
16
+ * in the browser, and the frame has its height before the table arrives.
17
+ *
18
+ * The iframe is keyed on that address. A browser treats a `src` that differs
19
+ * only in its fragment as a same-document navigation and does not reload, so
20
+ * without the key a changed `market` would leave the old table on screen.
21
+ */
22
+ const gui_1 = require("@hanzo/gui");
23
+ const slot_1 = require("./slot.cjs");
24
+ /** `crypto` is the one short name; every other market is its own screener_type. */
25
+ const screenerType = (market) => market === 'crypto' ? 'crypto_mkt' : market;
26
+ const EMBED = 'https://www.tradingview-widget.com/embed-widget/screener/?locale=';
27
+ /** The settings TradingView reads, with the documented defaults filled in. */
28
+ const settings = ({ market = 'crypto', defaultColumn = 'overview', displayCurrency = 'USD', colorTheme = 'dark', isTransparent = false, locale = 'en', width = '100%', height = 550, }) => ({
29
+ defaultColumn,
30
+ screener_type: screenerType(market),
31
+ displayCurrency,
32
+ colorTheme,
33
+ isTransparent,
34
+ locale,
35
+ width,
36
+ height,
37
+ });
38
+ const CryptoScreener = ({ market, defaultColumn, displayCurrency, colorTheme, isTransparent, locale, width, height, ...props }) => {
39
+ const s = settings({
40
+ market,
41
+ defaultColumn,
42
+ displayCurrency,
43
+ colorTheme,
44
+ isTransparent,
45
+ locale,
46
+ width,
47
+ height,
48
+ });
49
+ const src = `${EMBED}${s.locale}#${encodeURIComponent(JSON.stringify(s))}`;
50
+ return ((0, jsx_runtime_1.jsx)(gui_1.YStack, { ...(0, slot_1.slot)('crypto-screener'), "data-market": market ?? 'crypto', "data-color-theme": s.colorTheme,
51
+ // The documented size is TradingView's — a number or a percent string —
52
+ // and gui declares a narrower one; on web both reach CSS as written.
53
+ width: s.width, height: s.height, overflow: "hidden", position: "relative", bg: "$panel", ...props, children: gui_1.isWeb && ((0, jsx_runtime_1.jsx)("iframe", { src: src, title: `${market ?? 'crypto'} screener`, loading: "lazy", scrolling: "no", style: { display: 'block', width: '100%', height: '100%', border: 0 } }, src)) }));
54
+ };
55
+ exports.CryptoScreener = CryptoScreener;
@@ -0,0 +1,42 @@
1
+ /**
2
+ * CryptoScreener — a TradingView screener table, in a gui frame.
3
+ *
4
+ * The rows are TradingView's, drawn inside TradingView's own document, so the
5
+ * table is an `<iframe>` and nothing here draws a pixel of it. What this owns
6
+ * is the frame around it and the settings the table opens with — which market
7
+ * it screens, which column set it opens on, the display currency, the theme —
8
+ * written into the iframe's address the way TradingView's own embed script
9
+ * writes them: `/embed-widget/screener/?locale=…#<settings as JSON>`. Nothing
10
+ * is fetched or injected at mount, so the markup is the same on the server and
11
+ * in the browser, and the frame has its height before the table arrives.
12
+ *
13
+ * The iframe is keyed on that address. A browser treats a `src` that differs
14
+ * only in its fragment as a same-document navigation and does not reload, so
15
+ * without the key a changed `market` would leave the old table on screen.
16
+ */
17
+ import { type YStackProps } from '@hanzo/gui';
18
+ /**
19
+ * The market the table screens — TradingView's own `screener_type` values
20
+ * (`america`, `india`, `forex_mkt`, `bond_mkt`, …), plus `crypto` as the
21
+ * short name for `crypto_mkt` this component defaults to.
22
+ */
23
+ export type CryptoScreenerMarket = 'crypto' | (string & {});
24
+ export type CryptoScreenerColumn = 'overview' | 'performance' | 'oscillators' | 'moving_averages' | 'valuation';
25
+ export type CryptoScreenerTheme = 'light' | 'dark';
26
+ export interface CryptoScreenerProps extends Omit<YStackProps, 'width' | 'height' | 'theme'> {
27
+ /** Which market the table screens. */
28
+ market?: CryptoScreenerMarket;
29
+ /** Which column set the table opens on. */
30
+ defaultColumn?: CryptoScreenerColumn;
31
+ /** The currency prices and volumes are shown in. */
32
+ displayCurrency?: string;
33
+ /** The table's own palette; independent of the surrounding gui theme. */
34
+ colorTheme?: CryptoScreenerTheme;
35
+ isTransparent?: boolean;
36
+ locale?: string;
37
+ width?: string | number;
38
+ height?: string | number;
39
+ }
40
+ declare const CryptoScreener: ({ market, defaultColumn, displayCurrency, colorTheme, isTransparent, locale, width, height, ...props }: CryptoScreenerProps) => import("react").JSX.Element;
41
+ export { CryptoScreener };
42
+ //# sourceMappingURL=crypto-screener.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"crypto-screener.d.ts","sourceRoot":"","sources":["../../../src/backends/gui/crypto-screener.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAiB,KAAK,WAAW,EAAE,MAAM,YAAY,CAAA;AAG5D;;;;GAIG;AACH,MAAM,MAAM,oBAAoB,GAAG,QAAQ,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAA;AAE3D,MAAM,MAAM,oBAAoB,GAC5B,UAAU,GACV,aAAa,GACb,aAAa,GACb,iBAAiB,GACjB,WAAW,CAAA;AAEf,MAAM,MAAM,mBAAmB,GAAG,OAAO,GAAG,MAAM,CAAA;AAMlD,MAAM,WAAW,mBAAoB,SAAQ,IAAI,CAAC,WAAW,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;IAC1F,sCAAsC;IACtC,MAAM,CAAC,EAAE,oBAAoB,CAAA;IAC7B,2CAA2C;IAC3C,aAAa,CAAC,EAAE,oBAAoB,CAAA;IACpC,oDAAoD;IACpD,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,yEAAyE;IACzE,UAAU,CAAC,EAAE,mBAAmB,CAAA;IAChC,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACvB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CACzB;AAyBD,QAAA,MAAM,cAAc,2GAUjB,mBAAmB,gCAsCrB,CAAA;AAED,OAAO,EAAE,cAAc,EAAE,CAAA"}
@@ -0,0 +1,53 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ /**
4
+ * CryptoScreener — a TradingView screener table, in a gui frame.
5
+ *
6
+ * The rows are TradingView's, drawn inside TradingView's own document, so the
7
+ * table is an `<iframe>` and nothing here draws a pixel of it. What this owns
8
+ * is the frame around it and the settings the table opens with — which market
9
+ * it screens, which column set it opens on, the display currency, the theme —
10
+ * written into the iframe's address the way TradingView's own embed script
11
+ * writes them: `/embed-widget/screener/?locale=…#<settings as JSON>`. Nothing
12
+ * is fetched or injected at mount, so the markup is the same on the server and
13
+ * in the browser, and the frame has its height before the table arrives.
14
+ *
15
+ * The iframe is keyed on that address. A browser treats a `src` that differs
16
+ * only in its fragment as a same-document navigation and does not reload, so
17
+ * without the key a changed `market` would leave the old table on screen.
18
+ */
19
+ import { YStack, isWeb } from '@hanzo/gui';
20
+ import { slot } from './slot.js';
21
+ /** `crypto` is the one short name; every other market is its own screener_type. */
22
+ const screenerType = (market) => market === 'crypto' ? 'crypto_mkt' : market;
23
+ const EMBED = 'https://www.tradingview-widget.com/embed-widget/screener/?locale=';
24
+ /** The settings TradingView reads, with the documented defaults filled in. */
25
+ const settings = ({ market = 'crypto', defaultColumn = 'overview', displayCurrency = 'USD', colorTheme = 'dark', isTransparent = false, locale = 'en', width = '100%', height = 550, }) => ({
26
+ defaultColumn,
27
+ screener_type: screenerType(market),
28
+ displayCurrency,
29
+ colorTheme,
30
+ isTransparent,
31
+ locale,
32
+ width,
33
+ height,
34
+ });
35
+ const CryptoScreener = ({ market, defaultColumn, displayCurrency, colorTheme, isTransparent, locale, width, height, ...props }) => {
36
+ const s = settings({
37
+ market,
38
+ defaultColumn,
39
+ displayCurrency,
40
+ colorTheme,
41
+ isTransparent,
42
+ locale,
43
+ width,
44
+ height,
45
+ });
46
+ const src = `${EMBED}${s.locale}#${encodeURIComponent(JSON.stringify(s))}`;
47
+ return (_jsx(YStack, { ...slot('crypto-screener'), "data-market": market ?? 'crypto', "data-color-theme": s.colorTheme,
48
+ // The documented size is TradingView's — a number or a percent string —
49
+ // and gui declares a narrower one; on web both reach CSS as written.
50
+ width: s.width, height: s.height, overflow: "hidden", position: "relative", bg: "$panel", ...props, children: isWeb && (_jsx("iframe", { src: src, title: `${market ?? 'crypto'} screener`, loading: "lazy", scrolling: "no", style: { display: 'block', width: '100%', height: '100%', border: 0 } }, src)) }));
51
+ };
52
+ export { CryptoScreener };
53
+ //# sourceMappingURL=crypto-screener.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"crypto-screener.js","sourceRoot":"","sources":["../../../src/backends/gui/crypto-screener.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,MAAM,EAAE,KAAK,EAAoB,MAAM,YAAY,CAAA;AAC5D,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAkB7B,mFAAmF;AACnF,MAAM,YAAY,GAAG,CAAC,MAA4B,EAAE,EAAE,CACpD,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,MAAM,CAAA;AAiB7C,MAAM,KAAK,GAAG,mEAAmE,CAAA;AAEjF,8EAA8E;AAC9E,MAAM,QAAQ,GAAG,CAAC,EAChB,MAAM,GAAG,QAAQ,EACjB,aAAa,GAAG,UAAU,EAC1B,eAAe,GAAG,KAAK,EACvB,UAAU,GAAG,MAAM,EACnB,aAAa,GAAG,KAAK,EACrB,MAAM,GAAG,IAAI,EACb,KAAK,GAAG,MAAM,EACd,MAAM,GAAG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EAAE,cAAc,EAAE,CAAA"}
@@ -0,0 +1,40 @@
1
+ 'use client';"use strict";
2
+ 'use client';
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.Cursor = Cursor;
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ /**
7
+ * Cursor — a custom pointer that replaces the native one only inside its own
8
+ * frame, following the mouse and optionally carrying a short label.
9
+ *
10
+ * Position tracks locally off `getBoundingClientRect`, so the dot sits in the
11
+ * frame's own coordinate space rather than the viewport's, and it renders
12
+ * nothing until the pointer has actually entered — a plain `mouseenter`/
13
+ * `mouseleave` pair, no document listener, since the effect never needs to
14
+ * reach past the frame it is masking. `cursor: none` is scoped to that same
15
+ * frame, so nothing outside it loses its native pointer.
16
+ */
17
+ const gui_1 = require("@hanzo/gui");
18
+ const react_1 = require("react");
19
+ const sx_1 = require("../../sx.cjs");
20
+ const slot_1 = require("./slot.cjs");
21
+ function Cursor({ children, cursorText, cursorSize = 20, className }) {
22
+ const [position, setPosition] = (0, react_1.useState)({ x: 0, y: 0 });
23
+ const [isHovered, setIsHovered] = (0, react_1.useState)(false);
24
+ const handleMouseMove = (e) => {
25
+ const rect = e.currentTarget.getBoundingClientRect();
26
+ setPosition({ x: e.clientX - rect.left, y: e.clientY - rect.top });
27
+ };
28
+ return ((0, jsx_runtime_1.jsxs)(gui_1.YStack, { ...(0, slot_1.slot)('cursor'), position: "relative", style: gui_1.isWeb ? { cursor: 'none' } : undefined, onMouseMove: handleMouseMove, onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), ...(0, sx_1.sx)(className), children: [children, isHovered && ((0, jsx_runtime_1.jsx)(gui_1.YStack, { ...(0, slot_1.slot)('cursor-dot'), items: "center", justify: "center", style: {
29
+ position: 'absolute',
30
+ left: position.x,
31
+ top: position.y,
32
+ width: cursorSize,
33
+ height: cursorSize,
34
+ borderRadius: '50%',
35
+ transform: 'translate(-50%, -50%)',
36
+ backgroundColor: 'color-mix(in srgb, var(--color) 20%, transparent)',
37
+ pointerEvents: 'none',
38
+ zIndex: 50,
39
+ }, children: cursorText && ((0, jsx_runtime_1.jsx)(gui_1.SizableText, { ...(0, slot_1.slot)('cursor-text'), size: "$1", fontWeight: "600", color: "$color", children: cursorText })) }))] }));
40
+ }
@@ -0,0 +1,16 @@
1
+ import { type ReactNode } from 'react';
2
+ export type CursorPosition = {
3
+ x: number;
4
+ y: number;
5
+ };
6
+ export type CursorProps = {
7
+ children: ReactNode;
8
+ /** Short label shown inside the dot. */
9
+ cursorText?: string;
10
+ /** Diameter of the dot, in px. */
11
+ cursorSize?: number;
12
+ /** Class notation for the frame. */
13
+ className?: string;
14
+ };
15
+ export declare function Cursor({ children, cursorText, cursorSize, className }: CursorProps): import("react").JSX.Element;
16
+ //# sourceMappingURL=cursor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cursor.d.ts","sourceRoot":"","sources":["../../../src/backends/gui/cursor.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAIhD,MAAM,MAAM,cAAc,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AAErD,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,EAAE,SAAS,CAAA;IACnB,wCAAwC;IACxC,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,kCAAkC;IAClC,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,oCAAoC;IACpC,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,wBAAgB,MAAM,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAe,EAAE,SAAS,EAAE,EAAE,WAAW,+BA+CvF"}
@@ -0,0 +1,38 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ /**
4
+ * Cursor — a custom pointer that replaces the native one only inside its own
5
+ * frame, following the mouse and optionally carrying a short label.
6
+ *
7
+ * Position tracks locally off `getBoundingClientRect`, so the dot sits in the
8
+ * frame's own coordinate space rather than the viewport's, and it renders
9
+ * nothing until the pointer has actually entered — a plain `mouseenter`/
10
+ * `mouseleave` pair, no document listener, since the effect never needs to
11
+ * reach past the frame it is masking. `cursor: none` is scoped to that same
12
+ * frame, so nothing outside it loses its native pointer.
13
+ */
14
+ import { SizableText, YStack, isWeb } from '@hanzo/gui';
15
+ import { useState } from 'react';
16
+ import { sx } from '../../sx.js';
17
+ import { slot } from './slot.js';
18
+ export function Cursor({ children, cursorText, cursorSize = 20, className }) {
19
+ const [position, setPosition] = useState({ x: 0, y: 0 });
20
+ const [isHovered, setIsHovered] = useState(false);
21
+ const handleMouseMove = (e) => {
22
+ const rect = e.currentTarget.getBoundingClientRect();
23
+ setPosition({ x: e.clientX - rect.left, y: e.clientY - rect.top });
24
+ };
25
+ return (_jsxs(YStack, { ...slot('cursor'), position: "relative", style: isWeb ? { cursor: 'none' } : undefined, onMouseMove: handleMouseMove, onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), ...sx(className), children: [children, isHovered && (_jsx(YStack, { ...slot('cursor-dot'), items: "center", justify: "center", style: {
26
+ position: 'absolute',
27
+ left: position.x,
28
+ top: position.y,
29
+ width: cursorSize,
30
+ height: cursorSize,
31
+ borderRadius: '50%',
32
+ transform: 'translate(-50%, -50%)',
33
+ backgroundColor: 'color-mix(in srgb, var(--color) 20%, transparent)',
34
+ pointerEvents: 'none',
35
+ zIndex: 50,
36
+ }, children: cursorText && (_jsx(SizableText, { ...slot('cursor-text'), size: "$1", fontWeight: "600", color: "$color", children: cursorText })) }))] }));
37
+ }
38
+ //# sourceMappingURL=cursor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cursor.js","sourceRoot":"","sources":["../../../src/backends/gui/cursor.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ;;;;;;;;;;GAUG;AACH,OAAO,EAAE,WAAW,EAAE,MA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