@hanzo/ui 8.27.10 → 8.27.11
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/backends/gui/comparison.cjs +17 -21
- package/dist/backends/gui/comparison.d.ts +4 -5
- package/dist/backends/gui/comparison.d.ts.map +1 -1
- package/dist/backends/gui/comparison.js +18 -22
- package/dist/backends/gui/comparison.js.map +1 -1
- package/dist/backends/gui/crypto-screener.cjs +21 -31
- package/dist/backends/gui/crypto-screener.d.ts +20 -24
- package/dist/backends/gui/crypto-screener.d.ts.map +1 -1
- package/dist/backends/gui/crypto-screener.js +21 -31
- package/dist/backends/gui/crypto-screener.js.map +1 -1
- package/dist/backends/gui/cursor.cjs +15 -18
- package/dist/backends/gui/cursor.d.ts +4 -3
- package/dist/backends/gui/cursor.d.ts.map +1 -1
- package/dist/backends/gui/cursor.js +15 -18
- package/dist/backends/gui/cursor.js.map +1 -1
- package/dist/backends/gui/data-table.cjs +144 -184
- package/dist/backends/gui/data-table.d.ts +64 -44
- package/dist/backends/gui/data-table.d.ts.map +1 -1
- package/dist/backends/gui/data-table.js +146 -152
- package/dist/backends/gui/data-table.js.map +1 -1
- package/dist/backends/gui/dock.cjs +1 -1
- package/dist/backends/gui/dock.d.ts.map +1 -1
- package/dist/backends/gui/dock.js +1 -1
- package/dist/backends/gui/dock.js.map +1 -1
- package/dist/backends/gui/editor.cjs +35 -31
- package/dist/backends/gui/editor.d.ts +11 -11
- package/dist/backends/gui/editor.d.ts.map +1 -1
- package/dist/backends/gui/editor.js +35 -31
- package/dist/backends/gui/editor.js.map +1 -1
- package/dist/backends/gui/field.cjs +132 -0
- package/dist/backends/gui/field.d.ts +74 -0
- package/dist/backends/gui/field.d.ts.map +1 -0
- package/dist/backends/gui/field.js +121 -0
- package/dist/backends/gui/field.js.map +1 -0
- package/dist/backends/gui/gantt.cjs +17 -19
- package/dist/backends/gui/gantt.d.ts +4 -5
- package/dist/backends/gui/gantt.d.ts.map +1 -1
- package/dist/backends/gui/gantt.js +18 -21
- package/dist/backends/gui/gantt.js.map +1 -1
- package/dist/backends/gui/glimpse.cjs +88 -0
- package/dist/backends/gui/glimpse.d.ts +57 -0
- package/dist/backends/gui/glimpse.d.ts.map +1 -0
- package/dist/backends/gui/glimpse.js +81 -0
- package/dist/backends/gui/glimpse.js.map +1 -0
- package/dist/backends/gui/grid-pattern.cjs +119 -0
- package/dist/backends/gui/grid-pattern.d.ts +96 -0
- package/dist/backends/gui/grid-pattern.d.ts.map +1 -0
- package/dist/backends/gui/grid-pattern.js +84 -0
- package/dist/backends/gui/grid-pattern.js.map +1 -0
- package/dist/backends/gui/image-crop.cjs +35 -0
- package/dist/backends/gui/image-crop.d.ts +20 -0
- package/dist/backends/gui/image-crop.d.ts.map +1 -0
- package/dist/backends/gui/image-crop.js +33 -0
- package/dist/backends/gui/image-crop.js.map +1 -0
- package/dist/backends/gui/image-zoom.cjs +58 -0
- package/dist/backends/gui/image-zoom.d.ts +16 -0
- package/dist/backends/gui/image-zoom.d.ts.map +1 -0
- package/dist/backends/gui/image-zoom.js +56 -0
- package/dist/backends/gui/image-zoom.js.map +1 -0
- package/dist/backends/gui/index.cjs +159 -1
- package/dist/backends/gui/index.d.ts +49 -0
- package/dist/backends/gui/index.d.ts.map +1 -1
- package/dist/backends/gui/index.js +49 -0
- package/dist/backends/gui/index.js.map +1 -1
- package/dist/backends/gui/interactive-grid-pattern.cjs +61 -0
- package/dist/backends/gui/interactive-grid-pattern.d.ts +28 -0
- package/dist/backends/gui/interactive-grid-pattern.d.ts.map +1 -0
- package/dist/backends/gui/interactive-grid-pattern.js +26 -0
- package/dist/backends/gui/interactive-grid-pattern.js.map +1 -0
- package/dist/backends/gui/iphone-15-pro.cjs +83 -0
- package/dist/backends/gui/iphone-15-pro.d.ts +16 -0
- package/dist/backends/gui/iphone-15-pro.d.ts.map +1 -0
- package/dist/backends/gui/iphone-15-pro.js +81 -0
- package/dist/backends/gui/iphone-15-pro.js.map +1 -0
- package/dist/backends/gui/item.cjs +154 -0
- package/dist/backends/gui/item.d.ts +72 -0
- package/dist/backends/gui/item.d.ts.map +1 -0
- package/dist/backends/gui/item.js +143 -0
- package/dist/backends/gui/item.js.map +1 -0
- package/dist/backends/gui/kanban.cjs +247 -0
- package/dist/backends/gui/kanban.d.ts +37 -0
- package/dist/backends/gui/kanban.d.ts.map +1 -0
- package/dist/backends/gui/kanban.js +212 -0
- package/dist/backends/gui/kanban.js.map +1 -0
- package/dist/backends/gui/kbd.cjs +45 -0
- package/dist/backends/gui/kbd.d.ts +8 -0
- package/dist/backends/gui/kbd.d.ts.map +1 -0
- package/dist/backends/gui/kbd.js +42 -0
- package/dist/backends/gui/kbd.js.map +1 -0
- package/dist/backends/gui/limelight-nav.cjs +201 -0
- package/dist/backends/gui/limelight-nav.d.ts +20 -0
- package/dist/backends/gui/limelight-nav.d.ts.map +1 -0
- package/dist/backends/gui/limelight-nav.js +166 -0
- package/dist/backends/gui/limelight-nav.js.map +1 -0
- package/dist/backends/gui/list.cjs +26 -0
- package/dist/backends/gui/list.d.ts +15 -0
- package/dist/backends/gui/list.d.ts.map +1 -0
- package/dist/backends/gui/list.js +23 -0
- package/dist/backends/gui/list.js.map +1 -0
- package/dist/backends/gui/macos-dock.cjs +84 -0
- package/dist/backends/gui/macos-dock.d.ts +30 -0
- package/dist/backends/gui/macos-dock.d.ts.map +1 -0
- package/dist/backends/gui/macos-dock.js +82 -0
- package/dist/backends/gui/macos-dock.js.map +1 -0
- package/dist/backends/gui/magnetic.cjs +40 -0
- package/dist/backends/gui/magnetic.d.ts +12 -0
- package/dist/backends/gui/magnetic.d.ts.map +1 -0
- package/dist/backends/gui/magnetic.js +38 -0
- package/dist/backends/gui/magnetic.js.map +1 -0
- package/dist/backends/gui/marquee.cjs +110 -0
- package/dist/backends/gui/marquee.d.ts +44 -0
- package/dist/backends/gui/marquee.d.ts.map +1 -0
- package/dist/backends/gui/marquee.js +75 -0
- package/dist/backends/gui/marquee.js.map +1 -0
- package/dist/backends/gui/menu-dock.cjs +64 -0
- package/dist/backends/gui/menu-dock.d.ts +21 -0
- package/dist/backends/gui/menu-dock.d.ts.map +1 -0
- package/dist/backends/gui/menu-dock.js +62 -0
- package/dist/backends/gui/menu-dock.js.map +1 -0
- package/dist/backends/gui/menubar.cjs +227 -0
- package/dist/backends/gui/menubar.d.ts +106 -0
- package/dist/backends/gui/menubar.d.ts.map +1 -0
- package/dist/backends/gui/menubar.js +177 -0
- package/dist/backends/gui/menubar.js.map +1 -0
- package/dist/backends/gui/message-dock.cjs +111 -0
- package/dist/backends/gui/message-dock.d.ts +22 -0
- package/dist/backends/gui/message-dock.d.ts.map +1 -0
- package/dist/backends/gui/message-dock.js +110 -0
- package/dist/backends/gui/message-dock.js.map +1 -0
- package/dist/backends/gui/mini-calendar.cjs +25 -0
- package/dist/backends/gui/mini-calendar.d.ts +22 -0
- package/dist/backends/gui/mini-calendar.d.ts.map +1 -0
- package/dist/backends/gui/mini-calendar.js +24 -0
- package/dist/backends/gui/mini-calendar.js.map +1 -0
- package/dist/backends/gui/minimal-tiptap.cjs +56 -0
- package/dist/backends/gui/minimal-tiptap.d.ts +20 -0
- package/dist/backends/gui/minimal-tiptap.d.ts.map +1 -0
- package/dist/backends/gui/minimal-tiptap.js +21 -0
- package/dist/backends/gui/minimal-tiptap.js.map +1 -0
- package/dist/backends/gui/motion-highlight.cjs +83 -0
- package/dist/backends/gui/motion-highlight.d.ts +27 -0
- package/dist/backends/gui/motion-highlight.d.ts.map +1 -0
- package/dist/backends/gui/motion-highlight.js +48 -0
- package/dist/backends/gui/motion-highlight.js.map +1 -0
- package/dist/backends/gui/navigation-bar.cjs +47 -0
- package/dist/backends/gui/navigation-bar.d.ts +48 -0
- package/dist/backends/gui/navigation-bar.d.ts.map +1 -0
- package/dist/backends/gui/navigation-bar.js +45 -0
- package/dist/backends/gui/navigation-bar.js.map +1 -0
- package/dist/backends/gui/news-timeline.cjs +47 -0
- package/dist/backends/gui/news-timeline.d.ts +39 -0
- package/dist/backends/gui/news-timeline.d.ts.map +1 -0
- package/dist/backends/gui/news-timeline.js +45 -0
- package/dist/backends/gui/news-timeline.js.map +1 -0
- package/dist/backends/gui/order-entry.cjs +53 -0
- package/dist/backends/gui/order-entry.d.ts +21 -0
- package/dist/backends/gui/order-entry.d.ts.map +1 -0
- package/dist/backends/gui/order-entry.js +52 -0
- package/dist/backends/gui/order-entry.js.map +1 -0
- package/dist/backends/gui/orders-history.cjs +102 -0
- package/dist/backends/gui/orders-history.d.ts +24 -0
- package/dist/backends/gui/orders-history.d.ts.map +1 -0
- package/dist/backends/gui/orders-history.js +67 -0
- package/dist/backends/gui/orders-history.js.map +1 -0
- package/dist/backends/gui/pagination.cjs +51 -0
- package/dist/backends/gui/pagination.d.ts +52 -0
- package/dist/backends/gui/pagination.d.ts.map +1 -0
- package/dist/backends/gui/pagination.js +42 -0
- package/dist/backends/gui/pagination.js.map +1 -0
- package/dist/backends/gui/particles-background.cjs +135 -0
- package/dist/backends/gui/particles-background.d.ts +24 -0
- package/dist/backends/gui/particles-background.d.ts.map +1 -0
- package/dist/backends/gui/particles-background.js +133 -0
- package/dist/backends/gui/particles-background.js.map +1 -0
- package/dist/backends/gui/particles.cjs +145 -0
- package/dist/backends/gui/particles.d.ts +25 -0
- package/dist/backends/gui/particles.d.ts.map +1 -0
- package/dist/backends/gui/particles.js +143 -0
- package/dist/backends/gui/particles.js.map +1 -0
- package/dist/backends/gui/pill.cjs +82 -0
- package/dist/backends/gui/pill.d.ts +12 -0
- package/dist/backends/gui/pill.d.ts.map +1 -0
- package/dist/backends/gui/pill.js +78 -0
- package/dist/backends/gui/pill.js.map +1 -0
- package/dist/backends/gui/pin-list.cjs +82 -0
- package/dist/backends/gui/pin-list.d.ts +42 -0
- package/dist/backends/gui/pin-list.d.ts.map +1 -0
- package/dist/backends/gui/pin-list.js +80 -0
- package/dist/backends/gui/pin-list.js.map +1 -0
- package/dist/backends/gui/pixel-image.cjs +63 -0
- package/dist/backends/gui/pixel-image.d.ts +21 -0
- package/dist/backends/gui/pixel-image.d.ts.map +1 -0
- package/dist/backends/gui/pixel-image.js +61 -0
- package/dist/backends/gui/pixel-image.js.map +1 -0
- package/dist/backends/gui/positions-list.cjs +60 -0
- package/dist/backends/gui/positions-list.d.ts +14 -0
- package/dist/backends/gui/positions-list.d.ts.map +1 -0
- package/dist/backends/gui/positions-list.js +58 -0
- package/dist/backends/gui/positions-list.js.map +1 -0
- package/dist/backends/gui/qr-code.cjs +438 -0
- package/dist/backends/gui/qr-code.d.ts +42 -0
- package/dist/backends/gui/qr-code.d.ts.map +1 -0
- package/dist/backends/gui/qr-code.js +402 -0
- package/dist/backends/gui/qr-code.js.map +1 -0
- package/dist/backends/gui/relative-time.cjs +167 -0
- package/dist/backends/gui/relative-time.d.ts +10 -0
- package/dist/backends/gui/relative-time.d.ts.map +1 -0
- package/dist/backends/gui/relative-time.js +132 -0
- package/dist/backends/gui/relative-time.js.map +1 -0
- package/dist/backends/gui/safari.cjs +65 -0
- package/dist/backends/gui/safari.d.ts +23 -0
- package/dist/backends/gui/safari.d.ts.map +1 -0
- package/dist/backends/gui/safari.js +63 -0
- package/dist/backends/gui/safari.js.map +1 -0
- package/dist/backends/gui/snippet.cjs +144 -0
- package/dist/backends/gui/snippet.d.ts +38 -0
- package/dist/backends/gui/snippet.d.ts.map +1 -0
- package/dist/backends/gui/snippet.js +141 -0
- package/dist/backends/gui/snippet.js.map +1 -0
- package/dist/backends/gui/stars-scrolling-wheel.cjs +106 -0
- package/dist/backends/gui/stars-scrolling-wheel.d.ts +24 -0
- package/dist/backends/gui/stars-scrolling-wheel.d.ts.map +1 -0
- package/dist/backends/gui/stars-scrolling-wheel.js +104 -0
- package/dist/backends/gui/stars-scrolling-wheel.js.map +1 -0
- package/dist/backends/gui/status.cjs +79 -0
- package/dist/backends/gui/status.d.ts +15 -0
- package/dist/backends/gui/status.d.ts.map +1 -0
- package/dist/backends/gui/status.js +77 -0
- package/dist/backends/gui/status.js.map +1 -0
- package/dist/backends/gui/stock-market.cjs +21 -0
- package/dist/backends/gui/stock-market.d.ts +17 -0
- package/dist/backends/gui/stock-market.d.ts.map +1 -0
- package/dist/backends/gui/stock-market.js +19 -0
- package/dist/backends/gui/stock-market.js.map +1 -0
- package/dist/backends/gui/stock-screener.cjs +55 -0
- package/dist/backends/gui/stock-screener.d.ts +41 -0
- package/dist/backends/gui/stock-screener.d.ts.map +1 -0
- package/dist/backends/gui/stock-screener.js +53 -0
- package/dist/backends/gui/stock-screener.js.map +1 -0
- package/dist/backends/gui/symbol-info.cjs +46 -0
- package/dist/backends/gui/symbol-info.d.ts +36 -0
- package/dist/backends/gui/symbol-info.d.ts.map +1 -0
- package/dist/backends/gui/symbol-info.js +44 -0
- package/dist/backends/gui/symbol-info.js.map +1 -0
- package/dist/backends/gui/table.cjs +104 -0
- package/dist/backends/gui/table.d.ts +57 -0
- package/dist/backends/gui/table.d.ts.map +1 -0
- package/dist/backends/gui/table.js +95 -0
- package/dist/backends/gui/table.js.map +1 -0
- package/dist/backends/gui/tags.cjs +22 -0
- package/dist/backends/gui/tags.d.ts +22 -0
- package/dist/backends/gui/tags.d.ts.map +1 -0
- package/dist/backends/gui/tags.js +20 -0
- package/dist/backends/gui/tags.js.map +1 -0
- package/dist/backends/gui/technical-analysis.cjs +58 -0
- package/dist/backends/gui/technical-analysis.d.ts +41 -0
- package/dist/backends/gui/technical-analysis.d.ts.map +1 -0
- package/dist/backends/gui/technical-analysis.js +56 -0
- package/dist/backends/gui/technical-analysis.js.map +1 -0
- package/dist/backends/gui/terminal.cjs +266 -0
- package/dist/backends/gui/terminal.d.ts +38 -0
- package/dist/backends/gui/terminal.d.ts.map +1 -0
- package/dist/backends/gui/terminal.js +231 -0
- package/dist/backends/gui/terminal.js.map +1 -0
- package/dist/backends/gui/ticker.cjs +79 -0
- package/dist/backends/gui/ticker.d.ts +19 -0
- package/dist/backends/gui/ticker.d.ts.map +1 -0
- package/dist/backends/gui/ticker.js +44 -0
- package/dist/backends/gui/ticker.js.map +1 -0
- package/dist/backends/gui/timeline.cjs +154 -0
- package/dist/backends/gui/timeline.d.ts +42 -0
- package/dist/backends/gui/timeline.d.ts.map +1 -0
- package/dist/backends/gui/timeline.js +118 -0
- package/dist/backends/gui/timeline.js.map +1 -0
- package/dist/backends/gui/toggle.cjs +96 -0
- package/dist/backends/gui/toggle.d.ts +29 -0
- package/dist/backends/gui/toggle.d.ts.map +1 -0
- package/dist/backends/gui/toggle.js +95 -0
- package/dist/backends/gui/toggle.js.map +1 -0
- package/dist/backends/gui/video-player.cjs +383 -0
- package/dist/backends/gui/video-player.d.ts +54 -0
- package/dist/backends/gui/video-player.d.ts.map +1 -0
- package/dist/backends/gui/video-player.js +348 -0
- package/dist/backends/gui/video-player.js.map +1 -0
- package/dist/chat/Composer.cjs +10 -10
- package/dist/chat/Composer.d.ts +16 -17
- package/dist/chat/Composer.d.ts.map +1 -1
- package/dist/chat/Composer.js +11 -11
- package/dist/chat/Composer.js.map +1 -1
- package/dist/gallery.cjs +180 -1
- package/dist/gallery.d.ts.map +1 -1
- package/dist/gallery.html +391 -3
- package/dist/gallery.js +181 -2
- package/dist/gallery.js.map +1 -1
- package/dist/index.cjs +110 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.node.cjs +110 -1
- package/dist/index.node.js +1 -1
- package/dist/styles.css +356 -0
- package/package.json +1 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* StockMarket — the indices-flavored opening of the TradingView market-overview
|
|
3
|
+
* table that `./crypto-market` already renders.
|
|
4
|
+
*
|
|
5
|
+
* `market-overview.tsx`, `crypto-market.tsx`, `forex-market.tsx` and
|
|
6
|
+
* `stock-market.tsx` are four doc pages for ONE upstream widget, told apart
|
|
7
|
+
* only by which tab it opens on — crypto, forex, indices. Duplicating the
|
|
8
|
+
* iframe address, the preset table and the settings object under a second
|
|
9
|
+
* name would give the table two places to drift out of sync with itself, so
|
|
10
|
+
* this file holds none of that: it is `MarketOverview` with its `tabs` default
|
|
11
|
+
* turned from `['crypto']` to `['indices']`, nothing else.
|
|
12
|
+
*/
|
|
13
|
+
import { type MarketOverviewProps } from './crypto-market.js';
|
|
14
|
+
export type { MarketOverviewPreset as StockMarketPreset, MarketOverviewSymbol as StockMarketSymbol, MarketOverviewTab as StockMarketTab, MarketOverviewTheme as StockMarketTheme, } from './crypto-market.js';
|
|
15
|
+
export type StockMarketProps = MarketOverviewProps;
|
|
16
|
+
export declare function StockMarket({ tabs, ...props }: StockMarketProps): import("react").JSX.Element;
|
|
17
|
+
//# sourceMappingURL=stock-market.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stock-market.d.ts","sourceRoot":"","sources":["../../../src/backends/gui/stock-market.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AACH,OAAO,EAAkB,KAAK,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAE1E,YAAY,EACV,oBAAoB,IAAI,iBAAiB,EACzC,oBAAoB,IAAI,iBAAiB,EACzC,iBAAiB,IAAI,cAAc,EACnC,mBAAmB,IAAI,gBAAgB,GACxC,MAAM,iBAAiB,CAAA;AAExB,MAAM,MAAM,gBAAgB,GAAG,mBAAmB,CAAA;AAElD,wBAAgB,WAAW,CAAC,EAAE,IAAkB,EAAE,GAAG,KAAK,EAAE,EAAE,gBAAgB,+BAE7E"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
/**
|
|
4
|
+
* StockMarket — the indices-flavored opening of the TradingView market-overview
|
|
5
|
+
* table that `./crypto-market` already renders.
|
|
6
|
+
*
|
|
7
|
+
* `market-overview.tsx`, `crypto-market.tsx`, `forex-market.tsx` and
|
|
8
|
+
* `stock-market.tsx` are four doc pages for ONE upstream widget, told apart
|
|
9
|
+
* only by which tab it opens on — crypto, forex, indices. Duplicating the
|
|
10
|
+
* iframe address, the preset table and the settings object under a second
|
|
11
|
+
* name would give the table two places to drift out of sync with itself, so
|
|
12
|
+
* this file holds none of that: it is `MarketOverview` with its `tabs` default
|
|
13
|
+
* turned from `['crypto']` to `['indices']`, nothing else.
|
|
14
|
+
*/
|
|
15
|
+
import { MarketOverview } from './crypto-market.js';
|
|
16
|
+
export function StockMarket({ tabs = ['indices'], ...props }) {
|
|
17
|
+
return _jsx(MarketOverview, { tabs: tabs, ...props });
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=stock-market.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stock-market.js","sourceRoot":"","sources":["../../../src/backends/gui/stock-market.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,cAAc,EAA4B,MAAM,iBAAiB,CAAA;AAW1E,MAAM,UAAU,WAAW,CAAC,EAAE,IAAI,GAAG,CAAC,SAAS,CAAC,EAAE,GAAG,KAAK,EAAoB;IAC5E,OAAO,KAAC,cAAc,IAAC,IAAI,EAAE,IAAI,KAAM,KAAK,GAAI,CAAA;AAClD,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
'use client';"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.StockScreener = void 0;
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
/**
|
|
7
|
+
* StockScreener — a TradingView equity 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 and preset screen it opens on, 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
|
+
const EMBED = 'https://www.tradingview-widget.com/embed-widget/screener/?locale=';
|
|
25
|
+
/** The settings TradingView reads, with the documented defaults filled in. */
|
|
26
|
+
const settings = ({ market = 'america', defaultColumn = 'overview', defaultScreen = 'general', showToolbar = true, colorTheme = 'dark', isTransparent = false, locale = 'en', width = '100%', height = 500, }) => ({
|
|
27
|
+
defaultColumn,
|
|
28
|
+
defaultScreen,
|
|
29
|
+
screener_type: market,
|
|
30
|
+
showToolbar,
|
|
31
|
+
colorTheme,
|
|
32
|
+
isTransparent,
|
|
33
|
+
locale,
|
|
34
|
+
width,
|
|
35
|
+
height,
|
|
36
|
+
});
|
|
37
|
+
const StockScreener = ({ market, defaultColumn, defaultScreen, showToolbar, colorTheme, isTransparent, locale, width, height, ...props }) => {
|
|
38
|
+
const s = settings({
|
|
39
|
+
market,
|
|
40
|
+
defaultColumn,
|
|
41
|
+
defaultScreen,
|
|
42
|
+
showToolbar,
|
|
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)('stock-screener'), "data-market": market ?? 'america', "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 ?? 'america'} screener`, loading: "lazy", scrolling: "no", style: { display: 'block', width: '100%', height: '100%', border: 0 } }, src)) }));
|
|
54
|
+
};
|
|
55
|
+
exports.StockScreener = StockScreener;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* StockScreener — a TradingView equity 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 and preset screen it opens on, 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
|
+
/** The market the table screens — TradingView's own `screener_type` values (`america`, `india`, `germany`, …). */
|
|
19
|
+
export type StockScreenerMarket = 'america' | (string & {});
|
|
20
|
+
export type StockScreenerColumn = 'overview' | 'performance' | 'oscillators' | 'moving_averages';
|
|
21
|
+
export type StockScreenerScreen = 'general' | 'top_gainers' | 'top_losers' | 'most_volatile' | (string & {});
|
|
22
|
+
export type StockScreenerTheme = 'light' | 'dark';
|
|
23
|
+
export interface StockScreenerProps extends Omit<YStackProps, 'width' | 'height' | 'theme'> {
|
|
24
|
+
/** Which market the table screens. */
|
|
25
|
+
market?: StockScreenerMarket;
|
|
26
|
+
/** Which column set the table opens on. */
|
|
27
|
+
defaultColumn?: StockScreenerColumn;
|
|
28
|
+
/** Which preset screen the table opens filtered to. */
|
|
29
|
+
defaultScreen?: StockScreenerScreen;
|
|
30
|
+
/** Whether the toolbar (screen picker, column picker) is shown. */
|
|
31
|
+
showToolbar?: boolean;
|
|
32
|
+
/** The table's own palette; independent of the surrounding gui theme. */
|
|
33
|
+
colorTheme?: StockScreenerTheme;
|
|
34
|
+
isTransparent?: boolean;
|
|
35
|
+
locale?: string;
|
|
36
|
+
width?: string | number;
|
|
37
|
+
height?: string | number;
|
|
38
|
+
}
|
|
39
|
+
declare const StockScreener: ({ market, defaultColumn, defaultScreen, showToolbar, colorTheme, isTransparent, locale, width, height, ...props }: StockScreenerProps) => import("react").JSX.Element;
|
|
40
|
+
export { StockScreener };
|
|
41
|
+
//# sourceMappingURL=stock-screener.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stock-screener.d.ts","sourceRoot":"","sources":["../../../src/backends/gui/stock-screener.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAiB,KAAK,WAAW,EAAE,MAAM,YAAY,CAAA;AAG5D,kHAAkH;AAClH,MAAM,MAAM,mBAAmB,GAAG,SAAS,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAA;AAE3D,MAAM,MAAM,mBAAmB,GAC3B,UAAU,GACV,aAAa,GACb,aAAa,GACb,iBAAiB,CAAA;AAErB,MAAM,MAAM,mBAAmB,GAC3B,SAAS,GACT,aAAa,GACb,YAAY,GACZ,eAAe,GACf,CAAC,MAAM,GAAG,EAAE,CAAC,CAAA;AAEjB,MAAM,MAAM,kBAAkB,GAAG,OAAO,GAAG,MAAM,CAAA;AAEjD,MAAM,WAAW,kBAAmB,SAAQ,IAAI,CAAC,WAAW,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;IACzF,sCAAsC;IACtC,MAAM,CAAC,EAAE,mBAAmB,CAAA;IAC5B,2CAA2C;IAC3C,aAAa,CAAC,EAAE,mBAAmB,CAAA;IACnC,uDAAuD;IACvD,aAAa,CAAC,EAAE,mBAAmB,CAAA;IACnC,mEAAmE;IACnE,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,yEAAyE;IACzE,UAAU,CAAC,EAAE,kBAAkB,CAAA;IAC/B,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;AA2BD,QAAA,MAAM,aAAa,sHAWhB,kBAAkB,gCAuCpB,CAAA;AAED,OAAO,EAAE,aAAa,EAAE,CAAA"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
/**
|
|
4
|
+
* StockScreener — a TradingView equity 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 and preset screen it opens on, 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
|
+
const EMBED = 'https://www.tradingview-widget.com/embed-widget/screener/?locale=';
|
|
22
|
+
/** The settings TradingView reads, with the documented defaults filled in. */
|
|
23
|
+
const settings = ({ market = 'america', defaultColumn = 'overview', defaultScreen = 'general', showToolbar = true, colorTheme = 'dark', isTransparent = false, locale = 'en', width = '100%', height = 500, }) => ({
|
|
24
|
+
defaultColumn,
|
|
25
|
+
defaultScreen,
|
|
26
|
+
screener_type: market,
|
|
27
|
+
showToolbar,
|
|
28
|
+
colorTheme,
|
|
29
|
+
isTransparent,
|
|
30
|
+
locale,
|
|
31
|
+
width,
|
|
32
|
+
height,
|
|
33
|
+
});
|
|
34
|
+
const StockScreener = ({ market, defaultColumn, defaultScreen, showToolbar, colorTheme, isTransparent, locale, width, height, ...props }) => {
|
|
35
|
+
const s = settings({
|
|
36
|
+
market,
|
|
37
|
+
defaultColumn,
|
|
38
|
+
defaultScreen,
|
|
39
|
+
showToolbar,
|
|
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('stock-screener'), "data-market": market ?? 'america', "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 ?? 'america'} screener`, loading: "lazy", scrolling: "no", style: { display: 'block', width: '100%', height: '100%', border: 0 } }, src)) }));
|
|
51
|
+
};
|
|
52
|
+
export { StockScreener };
|
|
53
|
+
//# sourceMappingURL=stock-screener.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stock-screener.js","sourceRoot":"","sources":["../../../src/backends/gui/stock-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;AAqC7B,MAAM,KAAK,GAAG,mEAAmE,CAAA;AAEjF,8EAA8E;AAC9E,MAAM,QAAQ,GAAG,CAAC,EAChB,MAAM,GAAG,SAAS,EAClB,aAAa,GAAG,UAAU,EAC1B,aAAa,GAAG,SAAS,EACzB,WAAW,GAAG,IAAI,EAClB,UAAU,GAAG,MAAM,EACnB,aAAa,GAAG,KAAK,EACrB,MAAM,GAAG,IAAI,EACb,KAAK,GAAG,MAAM,EACd,MAAM,GAAG,GAAG,GACO,EAAE,EAAE,CAAC,CAAC;IACzB,aAAa;IACb,aAAa;IACb,aAAa,EAAE,MAAM;IACrB,WAAW;IACX,UAAU;IACV,aAAa;IACb,MAAM;IACN,KAAK;IACL,MAAM;CACP,CAAC,CAAA;AAEF,MAAM,aAAa,GAAG,CAAC,EACrB,MAAM,EACN,aAAa,EACb,aAAa,EACb,WAAW,EACX,UAAU,EACV,aAAa,EACb,MAAM,EACN,KAAK,EACL,MAAM,EACN,GAAG,KAAK,EACW,EAAE,EAAE;IACvB,MAAM,CAAC,GAAG,QAAQ,CAAC;QACjB,MAAM;QACN,aAAa;QACb,aAAa;QACb,WAAW;QACX,UAAU;QACV,aAAa;QACb,MAAM;QACN,KAAK;QACL,MAAM;KACP,CAAC,CAAA;IACF,MAAM,GAAG,GAAG,GAAG,KAAK,GAAG,CAAC,CAAC,MAAM,IAAI,kBAAkB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;IAC1E,OAAO,CACL,KAAC,MAAM,OACD,IAAI,CAAC,gBAAgB,CAAC,iBACb,MAAM,IAAI,SAAS,sBACd,CAAC,CAAC,UAAU;QAC9B,wEAAwE;QACxE,qEAAqE;QACrE,KAAK,EAAE,CAAC,CAAC,KAA6B,EACtC,MAAM,EAAE,CAAC,CAAC,MAA+B,EACzC,QAAQ,EAAC,QAAQ,EACjB,QAAQ,EAAC,UAAU,EACnB,EAAE,EAAC,QAAQ,KACP,KAAK,YAER,KAAK,IAAI,CACR,iBAEE,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,GAAG,MAAM,IAAI,SAAS,WAAW,EACxC,OAAO,EAAC,MAAM,EACd,SAAS,EAAC,IAAI,EACd,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,IALhE,GAAG,CAMR,CACH,GACM,CACV,CAAA;AACH,CAAC,CAAA;AAED,OAAO,EAAE,aAAa,EAAE,CAAA"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
'use client';"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.SymbolInfo = void 0;
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
/**
|
|
7
|
+
* SymbolInfo — a TradingView symbol-info widget for one symbol, in a gui
|
|
8
|
+
* frame.
|
|
9
|
+
*
|
|
10
|
+
* The price and the key stats beside it are TradingView's, drawn inside
|
|
11
|
+
* TradingView's own document, so the widget is an `<iframe>` and nothing here
|
|
12
|
+
* draws a pixel of it. What this owns is the frame around it and the settings
|
|
13
|
+
* it opens with — symbol, locale, theme — written into the iframe's address
|
|
14
|
+
* the way TradingView's own embed script writes them:
|
|
15
|
+
* `/embed-widget/symbol-info/?locale=…#<settings as JSON>`. Nothing is
|
|
16
|
+
* fetched or injected at mount, so the markup is the same on the server and
|
|
17
|
+
* in the browser, and the frame has its height before the widget arrives.
|
|
18
|
+
*
|
|
19
|
+
* The widget sizes its own height from its content, so unlike its wider
|
|
20
|
+
* siblings (Financials, CompanyProfile) this frame takes no `height` prop —
|
|
21
|
+
* only the documented `width`.
|
|
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 new `symbol` would change the URL and leave the old
|
|
26
|
+
* widget on screen.
|
|
27
|
+
*/
|
|
28
|
+
const gui_1 = require("@hanzo/gui");
|
|
29
|
+
const slot_1 = require("./slot.cjs");
|
|
30
|
+
const EMBED = 'https://www.tradingview-widget.com/embed-widget/symbol-info/?locale=';
|
|
31
|
+
/** The settings TradingView reads, with the documented defaults filled in. */
|
|
32
|
+
const settings = ({ symbol = 'NASDAQ:AAPL', width = '100%', colorTheme = 'dark', isTransparent = false, }) => ({
|
|
33
|
+
symbol,
|
|
34
|
+
width,
|
|
35
|
+
colorTheme,
|
|
36
|
+
isTransparent,
|
|
37
|
+
});
|
|
38
|
+
const SymbolInfo = ({ symbol, width, locale = 'en', colorTheme, isTransparent, ...props }) => {
|
|
39
|
+
const s = settings({ symbol, width, colorTheme, isTransparent });
|
|
40
|
+
const src = `${EMBED}${locale}#${encodeURIComponent(JSON.stringify(s))}`;
|
|
41
|
+
return ((0, jsx_runtime_1.jsx)(gui_1.YStack, { ...(0, slot_1.slot)('symbol-info'), "data-symbol": s.symbol, "data-color-theme": s.colorTheme,
|
|
42
|
+
// The documented size is TradingView's — a number or a percent string —
|
|
43
|
+
// and gui declares a narrower one; on web both reach CSS as written.
|
|
44
|
+
width: s.width, overflow: "hidden", position: "relative", bg: "$panel", ...props, children: gui_1.isWeb && ((0, jsx_runtime_1.jsx)("iframe", { src: src, title: `${s.symbol} symbol info`, loading: "lazy", scrolling: "no", style: { display: 'block', width: '100%', border: 0 } }, src)) }));
|
|
45
|
+
};
|
|
46
|
+
exports.SymbolInfo = SymbolInfo;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SymbolInfo — a TradingView symbol-info widget for one symbol, in a gui
|
|
3
|
+
* frame.
|
|
4
|
+
*
|
|
5
|
+
* The price and the key stats beside it are TradingView's, drawn inside
|
|
6
|
+
* TradingView's own document, so the widget is an `<iframe>` and nothing here
|
|
7
|
+
* draws a pixel of it. What this owns is the frame around it and the settings
|
|
8
|
+
* it opens with — symbol, locale, theme — written into the iframe's address
|
|
9
|
+
* the way TradingView's own embed script writes them:
|
|
10
|
+
* `/embed-widget/symbol-info/?locale=…#<settings as JSON>`. Nothing is
|
|
11
|
+
* fetched or injected at mount, so the markup is the same on the server and
|
|
12
|
+
* in the browser, and the frame has its height before the widget arrives.
|
|
13
|
+
*
|
|
14
|
+
* The widget sizes its own height from its content, so unlike its wider
|
|
15
|
+
* siblings (Financials, CompanyProfile) this frame takes no `height` prop —
|
|
16
|
+
* only the documented `width`.
|
|
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 new `symbol` would change the URL and leave the old
|
|
21
|
+
* widget on screen.
|
|
22
|
+
*/
|
|
23
|
+
import { type YStackProps } from '@hanzo/gui';
|
|
24
|
+
export type SymbolInfoTheme = 'light' | 'dark';
|
|
25
|
+
export interface SymbolInfoProps extends Omit<YStackProps, 'width' | 'colorTheme'> {
|
|
26
|
+
/** The symbol to describe, exchange-qualified. */
|
|
27
|
+
symbol?: string;
|
|
28
|
+
width?: string | number;
|
|
29
|
+
locale?: string;
|
|
30
|
+
/** The widget's own palette; independent of the surrounding gui theme. */
|
|
31
|
+
colorTheme?: SymbolInfoTheme;
|
|
32
|
+
isTransparent?: boolean;
|
|
33
|
+
}
|
|
34
|
+
declare const SymbolInfo: ({ symbol, width, locale, colorTheme, isTransparent, ...props }: SymbolInfoProps) => import("react").JSX.Element;
|
|
35
|
+
export { SymbolInfo };
|
|
36
|
+
//# sourceMappingURL=symbol-info.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"symbol-info.d.ts","sourceRoot":"","sources":["../../../src/backends/gui/symbol-info.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,EAAiB,KAAK,WAAW,EAAE,MAAM,YAAY,CAAA;AAG5D,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,MAAM,CAAA;AAE9C,MAAM,WAAW,eAAgB,SAAQ,IAAI,CAAC,WAAW,EAAE,OAAO,GAAG,YAAY,CAAC;IAChF,kDAAkD;IAClD,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACvB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,0EAA0E;IAC1E,UAAU,CAAC,EAAE,eAAe,CAAA;IAC5B,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB;AAiBD,QAAA,MAAM,UAAU,mEAA2E,eAAe,gCA4BzG,CAAA;AAED,OAAO,EAAE,UAAU,EAAE,CAAA"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
/**
|
|
4
|
+
* SymbolInfo — a TradingView symbol-info widget for one symbol, in a gui
|
|
5
|
+
* frame.
|
|
6
|
+
*
|
|
7
|
+
* The price and the key stats beside it are TradingView's, drawn inside
|
|
8
|
+
* TradingView's own document, so the widget is an `<iframe>` and nothing here
|
|
9
|
+
* draws a pixel of it. What this owns is the frame around it and the settings
|
|
10
|
+
* it opens with — symbol, locale, theme — written into the iframe's address
|
|
11
|
+
* the way TradingView's own embed script writes them:
|
|
12
|
+
* `/embed-widget/symbol-info/?locale=…#<settings as JSON>`. Nothing is
|
|
13
|
+
* fetched or injected at mount, so the markup is the same on the server and
|
|
14
|
+
* in the browser, and the frame has its height before the widget arrives.
|
|
15
|
+
*
|
|
16
|
+
* The widget sizes its own height from its content, so unlike its wider
|
|
17
|
+
* siblings (Financials, CompanyProfile) this frame takes no `height` prop —
|
|
18
|
+
* only the documented `width`.
|
|
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 new `symbol` would change the URL and leave the old
|
|
23
|
+
* widget on screen.
|
|
24
|
+
*/
|
|
25
|
+
import { YStack, isWeb } from '@hanzo/gui';
|
|
26
|
+
import { slot } from './slot.js';
|
|
27
|
+
const EMBED = 'https://www.tradingview-widget.com/embed-widget/symbol-info/?locale=';
|
|
28
|
+
/** The settings TradingView reads, with the documented defaults filled in. */
|
|
29
|
+
const settings = ({ symbol = 'NASDAQ:AAPL', width = '100%', colorTheme = 'dark', isTransparent = false, }) => ({
|
|
30
|
+
symbol,
|
|
31
|
+
width,
|
|
32
|
+
colorTheme,
|
|
33
|
+
isTransparent,
|
|
34
|
+
});
|
|
35
|
+
const SymbolInfo = ({ symbol, width, locale = 'en', colorTheme, isTransparent, ...props }) => {
|
|
36
|
+
const s = settings({ symbol, width, colorTheme, isTransparent });
|
|
37
|
+
const src = `${EMBED}${locale}#${encodeURIComponent(JSON.stringify(s))}`;
|
|
38
|
+
return (_jsx(YStack, { ...slot('symbol-info'), "data-symbol": s.symbol, "data-color-theme": s.colorTheme,
|
|
39
|
+
// The documented size is TradingView's — a number or a percent string —
|
|
40
|
+
// and gui declares a narrower one; on web both reach CSS as written.
|
|
41
|
+
width: s.width, overflow: "hidden", position: "relative", bg: "$panel", ...props, children: isWeb && (_jsx("iframe", { src: src, title: `${s.symbol} symbol info`, loading: "lazy", scrolling: "no", style: { display: 'block', width: '100%', border: 0 } }, src)) }));
|
|
42
|
+
};
|
|
43
|
+
export { SymbolInfo };
|
|
44
|
+
//# sourceMappingURL=symbol-info.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"symbol-info.js","sourceRoot":"","sources":["../../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AS,EAAC,IAAI,EACd,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,IALhD,GAAG,CAMR,CACH,GACM,CACV,CAAA;AACH,CAAC,CAAA;AAED,OAAO,EAAE,UAAU,EAAE,CAAA"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
'use client';"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.Table = Table;
|
|
5
|
+
exports.TableHeader = TableHeader;
|
|
6
|
+
exports.TableBody = TableBody;
|
|
7
|
+
exports.TableFooter = TableFooter;
|
|
8
|
+
exports.TableRow = TableRow;
|
|
9
|
+
exports.TableHead = TableHead;
|
|
10
|
+
exports.TableCell = TableCell;
|
|
11
|
+
exports.TableCaption = TableCaption;
|
|
12
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
13
|
+
/**
|
|
14
|
+
* Table — a real `<table>` and its sections/rows/cells, laid out with the
|
|
15
|
+
* host's native table algorithm (each part keeps its matching `display: table-*`)
|
|
16
|
+
* rather than a flex or grid stand-in, so `colSpan`/`rowSpan` and column-width
|
|
17
|
+
* alignment across rows work the way the browser already does them for free.
|
|
18
|
+
* It is the semantic counterpart to `DataTable` (sorting/filtering/pagination
|
|
19
|
+
* over a grid): this one is markup for tabular content someone else already
|
|
20
|
+
* shaped, the way a changelog or an invoice line-item list is markup, not a
|
|
21
|
+
* data structure.
|
|
22
|
+
*
|
|
23
|
+
* `display: table-*` and a couple of CSS properties gui does not model as
|
|
24
|
+
* typed style props (`overflow: auto`, `transition`, `text-align`) go through
|
|
25
|
+
* the plain `style` object every host element accepts, the same escape hatch
|
|
26
|
+
* `calendar.tsx` uses for `textAlign` — the styled() variant surface stays
|
|
27
|
+
* limited to the tokens gui actually knows.
|
|
28
|
+
*
|
|
29
|
+
* The scrolling frame is a separate part from the table itself so a caption,
|
|
30
|
+
* header, body and footer all scroll together as one unit on a narrow
|
|
31
|
+
* viewport.
|
|
32
|
+
*/
|
|
33
|
+
const gui_1 = require("@hanzo/gui");
|
|
34
|
+
const slot_1 = require("./slot.cjs");
|
|
35
|
+
const TableScroll = (0, gui_1.styled)(gui_1.XStack, {
|
|
36
|
+
name: 'TableScroll',
|
|
37
|
+
position: 'relative',
|
|
38
|
+
width: '100%',
|
|
39
|
+
});
|
|
40
|
+
const TableFrame = (0, gui_1.styled)(gui_1.YStack, {
|
|
41
|
+
name: 'TableFrame',
|
|
42
|
+
width: '100%',
|
|
43
|
+
});
|
|
44
|
+
const TableHeaderFrame = (0, gui_1.styled)(gui_1.YStack, {
|
|
45
|
+
name: 'TableHeaderFrame',
|
|
46
|
+
});
|
|
47
|
+
const TableBodyFrame = (0, gui_1.styled)(gui_1.YStack, {
|
|
48
|
+
name: 'TableBodyFrame',
|
|
49
|
+
});
|
|
50
|
+
const TableFooterFrame = (0, gui_1.styled)(gui_1.YStack, {
|
|
51
|
+
name: 'TableFooterFrame',
|
|
52
|
+
borderTopWidth: 1,
|
|
53
|
+
borderTopColor: '$borderColor',
|
|
54
|
+
bg: '$panel',
|
|
55
|
+
});
|
|
56
|
+
const TableRowFrame = (0, gui_1.styled)(gui_1.YStack, {
|
|
57
|
+
name: 'TableRowFrame',
|
|
58
|
+
borderBottomWidth: 1,
|
|
59
|
+
borderBottomColor: '$borderColor',
|
|
60
|
+
hoverStyle: { bg: '$hover' },
|
|
61
|
+
variants: {
|
|
62
|
+
selected: {
|
|
63
|
+
true: { bg: '$hover' },
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
const TableHeadFrame = (0, gui_1.styled)(gui_1.YStack, {
|
|
68
|
+
name: 'TableHeadFrame',
|
|
69
|
+
height: 48,
|
|
70
|
+
px: '$3',
|
|
71
|
+
});
|
|
72
|
+
const TableCellFrame = (0, gui_1.styled)(gui_1.YStack, {
|
|
73
|
+
name: 'TableCellFrame',
|
|
74
|
+
p: '$3',
|
|
75
|
+
});
|
|
76
|
+
const TableCaptionFrame = (0, gui_1.styled)(gui_1.YStack, {
|
|
77
|
+
name: 'TableCaptionFrame',
|
|
78
|
+
mt: '$4',
|
|
79
|
+
});
|
|
80
|
+
function Table({ children, ...props }) {
|
|
81
|
+
return ((0, jsx_runtime_1.jsx)(TableScroll, { ...(0, slot_1.slot)('table-scroll'), style: { overflow: 'auto' }, children: (0, jsx_runtime_1.jsx)(TableFrame, { ...(0, slot_1.slot)('table'), render: "table", style: { borderCollapse: 'collapse', captionSide: 'bottom', display: 'table' }, ...props, children: children }) }));
|
|
82
|
+
}
|
|
83
|
+
function TableHeader({ children, ...props }) {
|
|
84
|
+
return ((0, jsx_runtime_1.jsx)(TableHeaderFrame, { ...(0, slot_1.slot)('table-header'), render: "thead", style: { display: 'table-header-group' }, ...props, children: children }));
|
|
85
|
+
}
|
|
86
|
+
function TableBody({ children, ...props }) {
|
|
87
|
+
return ((0, jsx_runtime_1.jsx)(TableBodyFrame, { ...(0, slot_1.slot)('table-body'), render: "tbody", style: { display: 'table-row-group' }, ...props, children: children }));
|
|
88
|
+
}
|
|
89
|
+
function TableFooter({ children, ...props }) {
|
|
90
|
+
return ((0, jsx_runtime_1.jsx)(TableFooterFrame, { ...(0, slot_1.slot)('table-footer'), render: "tfoot", style: { display: 'table-footer-group' }, ...props, children: children }));
|
|
91
|
+
}
|
|
92
|
+
function TableRow({ children, selected = false, ...props }) {
|
|
93
|
+
return ((0, jsx_runtime_1.jsx)(TableRowFrame, { ...(0, slot_1.slot)('table-row'), "data-state": selected ? 'selected' : undefined, selected: selected, render: "tr", style: { display: 'table-row', transition: 'background-color 0.15s ease' }, ...props, children: children }));
|
|
94
|
+
}
|
|
95
|
+
function TableHead({ children, ...props }) {
|
|
96
|
+
return ((0, jsx_runtime_1.jsx)(TableHeadFrame, { ...(0, slot_1.slot)('table-head'), render: "th", style: { display: 'table-cell', textAlign: 'left', verticalAlign: 'middle' }, ...props, children: (0, jsx_runtime_1.jsx)(gui_1.SizableText, { size: "$2", fontWeight: "500", color: "$quiet", children: children }) }));
|
|
97
|
+
}
|
|
98
|
+
function TableCell({ children, colSpan, rowSpan, ...props }) {
|
|
99
|
+
const cellAttrs = { colSpan, rowSpan };
|
|
100
|
+
return ((0, jsx_runtime_1.jsx)(TableCellFrame, { ...(0, slot_1.slot)('table-cell'), render: "td", style: { display: 'table-cell', verticalAlign: 'middle' }, ...props, ...cellAttrs, children: (0, jsx_runtime_1.jsx)(gui_1.SizableText, { size: "$2", children: children }) }));
|
|
101
|
+
}
|
|
102
|
+
function TableCaption({ children, ...props }) {
|
|
103
|
+
return ((0, jsx_runtime_1.jsx)(TableCaptionFrame, { ...(0, slot_1.slot)('table-caption'), render: "caption", style: { display: 'table-caption' }, ...props, children: (0, jsx_runtime_1.jsx)(gui_1.SizableText, { size: "$2", color: "$quiet", children: children }) }));
|
|
104
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type * as React from 'react';
|
|
2
|
+
declare const TableFrame: import("@hanzogui/web").GuiComponent<import("@hanzogui/web").TamaDefer, import("@hanzogui/web").GuiElement, import("@hanzogui/core").RNGuiViewNonStyleProps, import("@hanzogui/web").StackStyleBase, {
|
|
3
|
+
elevation?: number | import("@hanzogui/web").SizeTokens | undefined;
|
|
4
|
+
fullscreen?: boolean | undefined;
|
|
5
|
+
}, import("@hanzogui/web").StaticConfigPublic>;
|
|
6
|
+
declare const TableHeaderFrame: import("@hanzogui/web").GuiComponent<import("@hanzogui/web").TamaDefer, import("@hanzogui/web").GuiElement, import("@hanzogui/core").RNGuiViewNonStyleProps, import("@hanzogui/web").StackStyleBase, {
|
|
7
|
+
elevation?: number | import("@hanzogui/web").SizeTokens | undefined;
|
|
8
|
+
fullscreen?: boolean | undefined;
|
|
9
|
+
}, import("@hanzogui/web").StaticConfigPublic>;
|
|
10
|
+
declare const TableBodyFrame: import("@hanzogui/web").GuiComponent<import("@hanzogui/web").TamaDefer, import("@hanzogui/web").GuiElement, import("@hanzogui/core").RNGuiViewNonStyleProps, import("@hanzogui/web").StackStyleBase, {
|
|
11
|
+
elevation?: number | import("@hanzogui/web").SizeTokens | undefined;
|
|
12
|
+
fullscreen?: boolean | undefined;
|
|
13
|
+
}, import("@hanzogui/web").StaticConfigPublic>;
|
|
14
|
+
declare const TableFooterFrame: import("@hanzogui/web").GuiComponent<import("@hanzogui/web").TamaDefer, import("@hanzogui/web").GuiElement, import("@hanzogui/core").RNGuiViewNonStyleProps, import("@hanzogui/web").StackStyleBase, {
|
|
15
|
+
elevation?: number | import("@hanzogui/web").SizeTokens | undefined;
|
|
16
|
+
fullscreen?: boolean | undefined;
|
|
17
|
+
}, import("@hanzogui/web").StaticConfigPublic>;
|
|
18
|
+
declare const TableRowFrame: import("@hanzogui/web").GuiComponent<import("@hanzogui/web").TamaDefer, import("@hanzogui/web").GuiElement, import("@hanzogui/core").RNGuiViewNonStyleProps, import("@hanzogui/web").StackStyleBase, {
|
|
19
|
+
elevation?: number | import("@hanzogui/web").SizeTokens | undefined;
|
|
20
|
+
fullscreen?: boolean | undefined;
|
|
21
|
+
selected?: boolean | undefined;
|
|
22
|
+
}, import("@hanzogui/web").StaticConfigPublic>;
|
|
23
|
+
declare const TableHeadFrame: import("@hanzogui/web").GuiComponent<import("@hanzogui/web").TamaDefer, import("@hanzogui/web").GuiElement, import("@hanzogui/core").RNGuiViewNonStyleProps, import("@hanzogui/web").StackStyleBase, {
|
|
24
|
+
elevation?: number | import("@hanzogui/web").SizeTokens | undefined;
|
|
25
|
+
fullscreen?: boolean | undefined;
|
|
26
|
+
}, import("@hanzogui/web").StaticConfigPublic>;
|
|
27
|
+
declare const TableCellFrame: import("@hanzogui/web").GuiComponent<import("@hanzogui/web").TamaDefer, import("@hanzogui/web").GuiElement, import("@hanzogui/core").RNGuiViewNonStyleProps, import("@hanzogui/web").StackStyleBase, {
|
|
28
|
+
elevation?: number | import("@hanzogui/web").SizeTokens | undefined;
|
|
29
|
+
fullscreen?: boolean | undefined;
|
|
30
|
+
}, import("@hanzogui/web").StaticConfigPublic>;
|
|
31
|
+
declare const TableCaptionFrame: import("@hanzogui/web").GuiComponent<import("@hanzogui/web").TamaDefer, import("@hanzogui/web").GuiElement, import("@hanzogui/core").RNGuiViewNonStyleProps, import("@hanzogui/web").StackStyleBase, {
|
|
32
|
+
elevation?: number | import("@hanzogui/web").SizeTokens | undefined;
|
|
33
|
+
fullscreen?: boolean | undefined;
|
|
34
|
+
}, import("@hanzogui/web").StaticConfigPublic>;
|
|
35
|
+
export type TableProps = React.ComponentProps<typeof TableFrame>;
|
|
36
|
+
export type TableHeaderProps = React.ComponentProps<typeof TableHeaderFrame>;
|
|
37
|
+
export type TableBodyProps = React.ComponentProps<typeof TableBodyFrame>;
|
|
38
|
+
export type TableFooterProps = React.ComponentProps<typeof TableFooterFrame>;
|
|
39
|
+
export type TableRowProps = React.ComponentProps<typeof TableRowFrame> & {
|
|
40
|
+
selected?: boolean;
|
|
41
|
+
};
|
|
42
|
+
export type TableHeadProps = React.ComponentProps<typeof TableHeadFrame>;
|
|
43
|
+
export type TableCellProps = React.ComponentProps<typeof TableCellFrame> & {
|
|
44
|
+
colSpan?: number;
|
|
45
|
+
rowSpan?: number;
|
|
46
|
+
};
|
|
47
|
+
export type TableCaptionProps = React.ComponentProps<typeof TableCaptionFrame>;
|
|
48
|
+
export declare function Table({ children, ...props }: TableProps): React.JSX.Element;
|
|
49
|
+
export declare function TableHeader({ children, ...props }: TableHeaderProps): React.JSX.Element;
|
|
50
|
+
export declare function TableBody({ children, ...props }: TableBodyProps): React.JSX.Element;
|
|
51
|
+
export declare function TableFooter({ children, ...props }: TableFooterProps): React.JSX.Element;
|
|
52
|
+
export declare function TableRow({ children, selected, ...props }: TableRowProps): React.JSX.Element;
|
|
53
|
+
export declare function TableHead({ children, ...props }: TableHeadProps): React.JSX.Element;
|
|
54
|
+
export declare function TableCell({ children, colSpan, rowSpan, ...props }: TableCellProps): React.JSX.Element;
|
|
55
|
+
export declare function TableCaption({ children, ...props }: TableCaptionProps): React.JSX.Element;
|
|
56
|
+
export {};
|
|
57
|
+
//# sourceMappingURL=table.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../../src/backends/gui/table.tsx"],"names":[],"mappings":"AAuBA,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAA;AASnC,QAAA,MAAM,UAAU;;;8CAGd,CAAA;AAEF,QAAA,MAAM,gBAAgB;;;8CAEpB,CAAA;AAEF,QAAA,MAAM,cAAc;;;8CAElB,CAAA;AAEF,QAAA,MAAM,gBAAgB;;;8CAKpB,CAAA;AAEF,QAAA,MAAM,aAAa;;;;8CAWjB,CAAA;AAEF,QAAA,MAAM,cAAc;;;8CAIlB,CAAA;AAEF,QAAA,MAAM,cAAc;;;8CAGlB,CAAA;AAEF,QAAA,MAAM,iBAAiB;;;8CAGrB,CAAA;AAEF,MAAM,MAAM,UAAU,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,UAAU,CAAC,CAAA;AAChE,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,gBAAgB,CAAC,CAAA;AAC5E,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,CAAA;AACxE,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,gBAAgB,CAAC,CAAA;AAC5E,MAAM,MAAM,aAAa,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,aAAa,CAAC,GAAG;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,CAAA;AAC/F,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,CAAA;AACxE,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,GAAG;IACzE,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA;AACD,MAAM,MAAM,iBAAiB,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,iBAAiB,CAAC,CAAA;AAE9E,wBAAgB,KAAK,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,UAAU,qBAavD;AAED,wBAAgB,WAAW,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,gBAAgB,qBAWnE;AAED,wBAAgB,SAAS,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,qBAW/D;AAED,wBAAgB,WAAW,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,gBAAgB,qBAWnE;AAED,wBAAgB,QAAQ,CAAC,EAAE,QAAQ,EAAE,QAAgB,EAAE,GAAG,KAAK,EAAE,EAAE,aAAa,qBAa/E;AAED,wBAAgB,SAAS,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,qBAa/D;AAED,wBAAgB,SAAS,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,qBAajF;AAED,wBAAgB,YAAY,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,iBAAiB,qBAarE"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
/**
|
|
4
|
+
* Table — a real `<table>` and its sections/rows/cells, laid out with the
|
|
5
|
+
* host's native table algorithm (each part keeps its matching `display: table-*`)
|
|
6
|
+
* rather than a flex or grid stand-in, so `colSpan`/`rowSpan` and column-width
|
|
7
|
+
* alignment across rows work the way the browser already does them for free.
|
|
8
|
+
* It is the semantic counterpart to `DataTable` (sorting/filtering/pagination
|
|
9
|
+
* over a grid): this one is markup for tabular content someone else already
|
|
10
|
+
* shaped, the way a changelog or an invoice line-item list is markup, not a
|
|
11
|
+
* data structure.
|
|
12
|
+
*
|
|
13
|
+
* `display: table-*` and a couple of CSS properties gui does not model as
|
|
14
|
+
* typed style props (`overflow: auto`, `transition`, `text-align`) go through
|
|
15
|
+
* the plain `style` object every host element accepts, the same escape hatch
|
|
16
|
+
* `calendar.tsx` uses for `textAlign` — the styled() variant surface stays
|
|
17
|
+
* limited to the tokens gui actually knows.
|
|
18
|
+
*
|
|
19
|
+
* The scrolling frame is a separate part from the table itself so a caption,
|
|
20
|
+
* header, body and footer all scroll together as one unit on a narrow
|
|
21
|
+
* viewport.
|
|
22
|
+
*/
|
|
23
|
+
import { SizableText, XStack, YStack, styled } from '@hanzo/gui';
|
|
24
|
+
import { slot } from './slot.js';
|
|
25
|
+
const TableScroll = styled(XStack, {
|
|
26
|
+
name: 'TableScroll',
|
|
27
|
+
position: 'relative',
|
|
28
|
+
width: '100%',
|
|
29
|
+
});
|
|
30
|
+
const TableFrame = styled(YStack, {
|
|
31
|
+
name: 'TableFrame',
|
|
32
|
+
width: '100%',
|
|
33
|
+
});
|
|
34
|
+
const TableHeaderFrame = styled(YStack, {
|
|
35
|
+
name: 'TableHeaderFrame',
|
|
36
|
+
});
|
|
37
|
+
const TableBodyFrame = styled(YStack, {
|
|
38
|
+
name: 'TableBodyFrame',
|
|
39
|
+
});
|
|
40
|
+
const TableFooterFrame = styled(YStack, {
|
|
41
|
+
name: 'TableFooterFrame',
|
|
42
|
+
borderTopWidth: 1,
|
|
43
|
+
borderTopColor: '$borderColor',
|
|
44
|
+
bg: '$panel',
|
|
45
|
+
});
|
|
46
|
+
const TableRowFrame = styled(YStack, {
|
|
47
|
+
name: 'TableRowFrame',
|
|
48
|
+
borderBottomWidth: 1,
|
|
49
|
+
borderBottomColor: '$borderColor',
|
|
50
|
+
hoverStyle: { bg: '$hover' },
|
|
51
|
+
variants: {
|
|
52
|
+
selected: {
|
|
53
|
+
true: { bg: '$hover' },
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
const TableHeadFrame = styled(YStack, {
|
|
58
|
+
name: 'TableHeadFrame',
|
|
59
|
+
height: 48,
|
|
60
|
+
px: '$3',
|
|
61
|
+
});
|
|
62
|
+
const TableCellFrame = styled(YStack, {
|
|
63
|
+
name: 'TableCellFrame',
|
|
64
|
+
p: '$3',
|
|
65
|
+
});
|
|
66
|
+
const TableCaptionFrame = styled(YStack, {
|
|
67
|
+
name: 'TableCaptionFrame',
|
|
68
|
+
mt: '$4',
|
|
69
|
+
});
|
|
70
|
+
export function Table({ children, ...props }) {
|
|
71
|
+
return (_jsx(TableScroll, { ...slot('table-scroll'), style: { overflow: 'auto' }, children: _jsx(TableFrame, { ...slot('table'), render: "table", style: { borderCollapse: 'collapse', captionSide: 'bottom', display: 'table' }, ...props, children: children }) }));
|
|
72
|
+
}
|
|
73
|
+
export function TableHeader({ children, ...props }) {
|
|
74
|
+
return (_jsx(TableHeaderFrame, { ...slot('table-header'), render: "thead", style: { display: 'table-header-group' }, ...props, children: children }));
|
|
75
|
+
}
|
|
76
|
+
export function TableBody({ children, ...props }) {
|
|
77
|
+
return (_jsx(TableBodyFrame, { ...slot('table-body'), render: "tbody", style: { display: 'table-row-group' }, ...props, children: children }));
|
|
78
|
+
}
|
|
79
|
+
export function TableFooter({ children, ...props }) {
|
|
80
|
+
return (_jsx(TableFooterFrame, { ...slot('table-footer'), render: "tfoot", style: { display: 'table-footer-group' }, ...props, children: children }));
|
|
81
|
+
}
|
|
82
|
+
export function TableRow({ children, selected = false, ...props }) {
|
|
83
|
+
return (_jsx(TableRowFrame, { ...slot('table-row'), "data-state": selected ? 'selected' : undefined, selected: selected, render: "tr", style: { display: 'table-row', transition: 'background-color 0.15s ease' }, ...props, children: children }));
|
|
84
|
+
}
|
|
85
|
+
export function TableHead({ children, ...props }) {
|
|
86
|
+
return (_jsx(TableHeadFrame, { ...slot('table-head'), render: "th", style: { display: 'table-cell', textAlign: 'left', verticalAlign: 'middle' }, ...props, children: _jsx(SizableText, { size: "$2", fontWeight: "500", color: "$quiet", children: children }) }));
|
|
87
|
+
}
|
|
88
|
+
export function TableCell({ children, colSpan, rowSpan, ...props }) {
|
|
89
|
+
const cellAttrs = { colSpan, rowSpan };
|
|
90
|
+
return (_jsx(TableCellFrame, { ...slot('table-cell'), render: "td", style: { display: 'table-cell', verticalAlign: 'middle' }, ...props, ...cellAttrs, children: _jsx(SizableText, { size: "$2", children: children }) }));
|
|
91
|
+
}
|
|
92
|
+
export function TableCaption({ children, ...props }) {
|
|
93
|
+
return (_jsx(TableCaptionFrame, { ...slot('table-caption'), render: "caption", style: { display: 'table-caption' }, ...props, children: _jsx(SizableText, { size: "$2", color: "$quiet", children: children }) }));
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=table.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table.js","sourceRoot":"","sources":["../../../src/backends/gui/table.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAEhE,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAE7B,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE;IACjC,IAAI,EAAE,aAAa;IACnB,QAAQ,EAAE,UAAU;IACpB,KAAK,EAAE,MAAM;CACd,CAAC,CAAA;AAEF,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE;IAChC,IAAI,EAAE,YAAY;IAClB,KAAK,EAAE,MAAM;CACd,CAAC,CAAA;AAEF,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE;IACtC,IAAI,EAAE,kBAAkB;CACzB,CAAC,CAAA;AAEF,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE;IACpC,IAAI,EAAE,gBAAgB;CACvB,CAAC,CAAA;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