@hanzo/ui 8.27.10 → 8.27.12
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/gallery.html +249 -249
- package/dist/gui-config.cjs +5 -0
- package/dist/gui-config.d.ts +18 -3
- package/dist/gui-config.d.ts.map +1 -1
- package/dist/gui-config.js +5 -0
- package/dist/gui-config.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 +124 -124
- package/package.json +1 -1
|
@@ -4,40 +4,36 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
exports.Comparison = Comparison;
|
|
5
5
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
6
|
/**
|
|
7
|
-
* Comparison — a
|
|
7
|
+
* Comparison — a plan/feature grid: one column per plan, one row per feature.
|
|
8
8
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* Layout is `../../grid`'s real CSS grid — equal tracks, one per column — with
|
|
15
|
-
* `YStack`/`XStack` for the card and its rows.
|
|
9
|
+
* Columns are laid out with `Grid`/`Cell` (real CSS grid, tracks owned by the
|
|
10
|
+
* container) rather than a row of stacks, so every column stays the same
|
|
11
|
+
* width regardless of its content. A boolean item renders as a check or an
|
|
12
|
+
* cross; a string item renders as text.
|
|
16
13
|
*/
|
|
17
14
|
const gui_1 = require("@hanzo/gui");
|
|
18
15
|
const lucide_icons_2_1 = require("@hanzogui/lucide-icons-2");
|
|
19
16
|
const grid_1 = require("../../grid.cjs");
|
|
17
|
+
const ink_1 = require("./ink.cjs");
|
|
20
18
|
const slot_1 = require("./slot.cjs");
|
|
21
|
-
const
|
|
22
|
-
const Card = (0, gui_1.styled)(gui_1.YStack, {
|
|
19
|
+
const ColumnFrame = (0, gui_1.styled)(gui_1.YStack, {
|
|
23
20
|
name: 'ComparisonColumn',
|
|
24
|
-
p: '$5',
|
|
25
|
-
rounded: '$4',
|
|
26
21
|
borderWidth: 1,
|
|
27
22
|
borderColor: '$borderColor',
|
|
23
|
+
rounded: '$4',
|
|
24
|
+
p: '$5',
|
|
28
25
|
gap: '$4',
|
|
29
26
|
variants: {
|
|
30
27
|
highlighted: {
|
|
31
|
-
true: {
|
|
32
|
-
borderColor: '$color9',
|
|
33
|
-
shadowColor: '$shadowColor',
|
|
34
|
-
shadowRadius: 12,
|
|
35
|
-
shadowOffset: { width: 0, height: 4 },
|
|
36
|
-
},
|
|
28
|
+
true: { borderColor: '$color', shadowColor: '$shadowColor', shadowRadius: 12, shadowOpacity: 0.15 },
|
|
37
29
|
},
|
|
38
30
|
},
|
|
39
31
|
});
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
32
|
+
const Title = (0, gui_1.styled)(gui_1.SizableText, { name: 'ComparisonTitle', size: '$5', fontWeight: '600' });
|
|
33
|
+
const Label = (0, gui_1.styled)(gui_1.SizableText, { name: 'ComparisonLabel', size: '$2' });
|
|
34
|
+
const Value = (0, gui_1.styled)(gui_1.SizableText, { name: 'ComparisonValue', size: '$2', fontWeight: '600' });
|
|
35
|
+
const Row = (0, gui_1.styled)(gui_1.XStack, { name: 'ComparisonRow', items: 'center', gap: '$3' });
|
|
36
|
+
const mark = (value) => typeof value === 'boolean' ? (value ? ((0, jsx_runtime_1.jsx)(lucide_icons_2_1.Check, { ...(0, slot_1.slot)('comparison-item-check'), size: 18, color: "$green9" })) : ((0, jsx_runtime_1.jsx)(lucide_icons_2_1.X, { ...(0, slot_1.slot)('comparison-item-cross'), size: 18, color: "$red9" }))) : ((0, jsx_runtime_1.jsx)(Value, { children: value }));
|
|
37
|
+
function Comparison({ columns, gap = '$4', ...props }) {
|
|
38
|
+
return ((0, jsx_runtime_1.jsx)(grid_1.Grid, { ...(0, slot_1.slot)('comparison'), columns: columns.length || 1, gap: gap, ...props, children: columns.map((column, i) => ((0, jsx_runtime_1.jsx)(grid_1.Cell, { children: (0, jsx_runtime_1.jsxs)(ColumnFrame, { ...(0, slot_1.slot)('comparison-column'), "data-highlighted": column.highlighted ? '' : undefined, highlighted: column.highlighted, children: [(0, ink_1.ink)(column.title, Title), (0, jsx_runtime_1.jsx)(gui_1.YStack, { gap: "$3", children: column.items.map((item, j) => ((0, jsx_runtime_1.jsxs)(Row, { ...(0, slot_1.slot)('comparison-item'), children: [mark(item.value), (0, jsx_runtime_1.jsx)(Label, { children: item.label })] }, j))) })] }) }, i))) }));
|
|
43
39
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type GridProps } from '../../grid.js';
|
|
1
2
|
export interface ComparisonItem {
|
|
2
3
|
label: string;
|
|
3
4
|
value: boolean | string;
|
|
@@ -5,12 +6,10 @@ export interface ComparisonItem {
|
|
|
5
6
|
export interface ComparisonColumn {
|
|
6
7
|
title: string;
|
|
7
8
|
items: ComparisonItem[];
|
|
8
|
-
/** Marks the plan the table wants to sell: a raised border and shadow. */
|
|
9
9
|
highlighted?: boolean;
|
|
10
10
|
}
|
|
11
|
-
export
|
|
11
|
+
export type ComparisonProps = Omit<GridProps, 'columns' | 'children'> & {
|
|
12
12
|
columns: ComparisonColumn[];
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
export declare function Comparison({ columns }: ComparisonProps): import("react").JSX.Element;
|
|
13
|
+
};
|
|
14
|
+
export declare function Comparison({ columns, gap, ...props }: ComparisonProps): import("react").JSX.Element;
|
|
16
15
|
//# sourceMappingURL=comparison.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"comparison.d.ts","sourceRoot":"","sources":["../../../src/backends/gui/comparison.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"comparison.d.ts","sourceRoot":"","sources":["../../../src/backends/gui/comparison.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAc,KAAK,SAAS,EAAE,MAAM,YAAY,CAAA;AAIvD,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,OAAO,GAAG,MAAM,CAAA;CACxB;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,cAAc,EAAE,CAAA;IACvB,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB;AAkCD,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,SAAS,EAAE,SAAS,GAAG,UAAU,CAAC,GAAG;IACtE,OAAO,EAAE,gBAAgB,EAAE,CAAA;CAC5B,CAAA;AAED,wBAAgB,UAAU,CAAC,EAAE,OAAO,EAAE,GAAU,EAAE,GAAG,KAAK,EAAE,EAAE,eAAe,+BAwB5E"}
|
|
@@ -1,41 +1,37 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
/**
|
|
4
|
-
* Comparison — a
|
|
4
|
+
* Comparison — a plan/feature grid: one column per plan, one row per feature.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* Layout is `../../grid`'s real CSS grid — equal tracks, one per column — with
|
|
12
|
-
* `YStack`/`XStack` for the card and its rows.
|
|
6
|
+
* Columns are laid out with `Grid`/`Cell` (real CSS grid, tracks owned by the
|
|
7
|
+
* container) rather than a row of stacks, so every column stays the same
|
|
8
|
+
* width regardless of its content. A boolean item renders as a check or an
|
|
9
|
+
* cross; a string item renders as text.
|
|
13
10
|
*/
|
|
14
11
|
import { SizableText, YStack, XStack, styled } from '@hanzo/gui';
|
|
15
12
|
import { Check, X } from '@hanzogui/lucide-icons-2';
|
|
16
|
-
import { Grid } from '../../grid.js';
|
|
13
|
+
import { Grid, Cell } from '../../grid.js';
|
|
14
|
+
import { ink } from './ink.js';
|
|
17
15
|
import { slot } from './slot.js';
|
|
18
|
-
const
|
|
19
|
-
const Card = styled(YStack, {
|
|
16
|
+
const ColumnFrame = styled(YStack, {
|
|
20
17
|
name: 'ComparisonColumn',
|
|
21
|
-
p: '$5',
|
|
22
|
-
rounded: '$4',
|
|
23
18
|
borderWidth: 1,
|
|
24
19
|
borderColor: '$borderColor',
|
|
20
|
+
rounded: '$4',
|
|
21
|
+
p: '$5',
|
|
25
22
|
gap: '$4',
|
|
26
23
|
variants: {
|
|
27
24
|
highlighted: {
|
|
28
|
-
true: {
|
|
29
|
-
borderColor: '$color9',
|
|
30
|
-
shadowColor: '$shadowColor',
|
|
31
|
-
shadowRadius: 12,
|
|
32
|
-
shadowOffset: { width: 0, height: 4 },
|
|
33
|
-
},
|
|
25
|
+
true: { borderColor: '$color', shadowColor: '$shadowColor', shadowRadius: 12, shadowOpacity: 0.15 },
|
|
34
26
|
},
|
|
35
27
|
},
|
|
36
28
|
});
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
29
|
+
const Title = styled(SizableText, { name: 'ComparisonTitle', size: '$5', fontWeight: '600' });
|
|
30
|
+
const Label = styled(SizableText, { name: 'ComparisonLabel', size: '$2' });
|
|
31
|
+
const Value = styled(SizableText, { name: 'ComparisonValue', size: '$2', fontWeight: '600' });
|
|
32
|
+
const Row = styled(XStack, { name: 'ComparisonRow', items: 'center', gap: '$3' });
|
|
33
|
+
const mark = (value) => typeof value === 'boolean' ? (value ? (_jsx(Check, { ...slot('comparison-item-check'), size: 18, color: "$green9" })) : (_jsx(X, { ...slot('comparison-item-cross'), size: 18, color: "$red9" }))) : (_jsx(Value, { children: value }));
|
|
34
|
+
export function Comparison({ columns, gap = '$4', ...props }) {
|
|
35
|
+
return (_jsx(Grid, { ...slot('comparison'), columns: columns.length || 1, gap: gap, ...props, children: columns.map((column, i) => (_jsx(Cell, { children: _jsxs(ColumnFrame, { ...slot('comparison-column'), "data-highlighted": column.highlighted ? '' : undefined, highlighted: column.highlighted, children: [ink(column.title, Title), _jsx(YStack, { gap: "$3", children: column.items.map((item, j) => (_jsxs(Row, { ...slot('comparison-item'), children: [mark(item.value), _jsx(Label, { children: item.label })] }, j))) })] }) }, i))) }));
|
|
40
36
|
}
|
|
41
37
|
//# sourceMappingURL=comparison.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"comparison.js","sourceRoot":"","sources":["../../../src/backends/gui/comparison.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ
|
|
1
|
+
{"version":3,"file":"comparison.js","sourceRoot":"","sources":["../../../src/backends/gui/comparison.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ;;;;;;;GAOG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAChE,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,0BAA0B,CAAA;AAEnD,OAAO,EAAE,IAAI,EAAE,IAAI,EAAkB,MAAM,YAAY,CAAA;AACvD,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAC3B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAa7B,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE;IACjC,IAAI,EAAE,kBAAkB;IACxB,WAAW,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AAK,cAAE,KAAK,GAAS,CACvB,CAAA;AAMH,MAAM,UAAU,UAAU,CAAC,EAAE,OAAO,EAAE,GAAG,GAAG,IAAI,EAAE,GAAG,KAAK,EAAmB;IAC3E,OAAO,CACL,KAAC,IAAI,OAAK,IAAI,CAAC,YAAY,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,MAAM,IAAI,CAAC,EAAE,GAAG,EAAE,GAAG,KAAM,KAAK,YAC5E,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC,CAC1B,KAAC,IAAI,cACH,MAAC,WAAW,OACN,IAAI,CAAC,mBAAmB,CAAC,sBACX,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,EACrD,WAAW,EAAE,MAAM,CAAC,WAAW,aAE9B,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,EACzB,KAAC,MAAM,IAAC,GAAG,EAAC,IAAI,YACb,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CAC7B,MAAC,GAAG,OAAa,IAAI,CAAC,iBAAiB,CAAC,aACrC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,EACjB,KAAC,KAAK,cAAE,IAAI,CAAC,KAAK,GAAS,KAFnB,CAAC,CAGL,CACP,CAAC,GACK,IACG,IAfL,CAAC,CAgBL,CACR,CAAC,GACG,CACR,CAAA;AACH,CAAC"}
|
|
@@ -4,30 +4,29 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
exports.CryptoScreener = void 0;
|
|
5
5
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
6
|
/**
|
|
7
|
-
* CryptoScreener —
|
|
7
|
+
* CryptoScreener — TradingView's crypto market screener, in a gui frame.
|
|
8
8
|
*
|
|
9
|
-
* The
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
9
|
+
* The table is TradingView's own document, so it is an `<iframe>` and nothing
|
|
10
|
+
* here draws a row of it. What this owns is the frame around it and the
|
|
11
|
+
* settings the screener opens with — the column set, the display currency,
|
|
12
|
+
* the theme — written into the iframe's address the way TradingView's own
|
|
13
|
+
* embed script writes them:
|
|
14
|
+
* `/embed-widget/screener/?locale=…#<settings as JSON>`. Nothing is fetched or
|
|
15
|
+
* injected at mount, so the markup is the same on the server and in the
|
|
16
|
+
* browser, and the frame has its height before the table arrives.
|
|
17
17
|
*
|
|
18
|
-
* The iframe is keyed on that address
|
|
19
|
-
* only in its fragment as a same-document navigation and does not
|
|
20
|
-
* without the key a
|
|
18
|
+
* The iframe is keyed on that address, because a browser treats a `src` that
|
|
19
|
+
* differs only in its fragment as a same-document navigation and does not
|
|
20
|
+
* reload — without the key a new `defaultColumn` would change the URL and
|
|
21
|
+
* leave the old table on screen.
|
|
21
22
|
*/
|
|
22
23
|
const gui_1 = require("@hanzo/gui");
|
|
23
24
|
const slot_1 = require("./slot.cjs");
|
|
24
|
-
|
|
25
|
-
const screenerType = (market) => market === 'crypto' ? 'crypto_mkt' : market;
|
|
26
|
-
const EMBED = 'https://www.tradingview-widget.com/embed-widget/screener/?locale=';
|
|
25
|
+
const EMBED = 'https://www.tradingview-widget.com/embed-widget/screener/?locale=en#';
|
|
27
26
|
/** The settings TradingView reads, with the documented defaults filled in. */
|
|
28
|
-
const settings = ({
|
|
27
|
+
const settings = ({ defaultColumn = 'overview', displayCurrency = 'USD', colorTheme = 'dark', isTransparent = false, locale = 'en', width = '100%', height = 550, }) => ({
|
|
29
28
|
defaultColumn,
|
|
30
|
-
screener_type:
|
|
29
|
+
screener_type: 'crypto_mkt',
|
|
31
30
|
displayCurrency,
|
|
32
31
|
colorTheme,
|
|
33
32
|
isTransparent,
|
|
@@ -35,21 +34,12 @@ const settings = ({ market = 'crypto', defaultColumn = 'overview', displayCurren
|
|
|
35
34
|
width,
|
|
36
35
|
height,
|
|
37
36
|
});
|
|
38
|
-
const CryptoScreener = ({ market, defaultColumn, displayCurrency, colorTheme, isTransparent, locale, width, height, ...props }) => {
|
|
39
|
-
const s = settings({
|
|
40
|
-
|
|
41
|
-
|
|
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,
|
|
37
|
+
const CryptoScreener = ({ market: _market, defaultColumn, displayCurrency, colorTheme, isTransparent, locale, width, height, ...props }) => {
|
|
38
|
+
const s = settings({ defaultColumn, displayCurrency, colorTheme, isTransparent, locale, width, height });
|
|
39
|
+
const src = EMBED + encodeURIComponent(JSON.stringify(s));
|
|
40
|
+
return ((0, jsx_runtime_1.jsx)(gui_1.YStack, { ...(0, slot_1.slot)('crypto-screener'), "data-column": s.defaultColumn, "data-color-theme": s.colorTheme,
|
|
51
41
|
// The documented size is TradingView's — a number or a percent string —
|
|
52
42
|
// 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:
|
|
43
|
+
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: "Crypto screener", loading: "lazy", scrolling: "no", style: { display: 'block', width: '100%', height: '100%', border: 0 } }, src)) }));
|
|
54
44
|
};
|
|
55
45
|
exports.CryptoScreener = CryptoScreener;
|
|
@@ -1,42 +1,38 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* CryptoScreener —
|
|
2
|
+
* CryptoScreener — TradingView's crypto market screener, in a gui frame.
|
|
3
3
|
*
|
|
4
|
-
* The
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
4
|
+
* The table is TradingView's own document, so it is an `<iframe>` and nothing
|
|
5
|
+
* here draws a row of it. What this owns is the frame around it and the
|
|
6
|
+
* settings the screener opens with — the column set, the display currency,
|
|
7
|
+
* the theme — written into the iframe's address the way TradingView's own
|
|
8
|
+
* embed script writes them:
|
|
9
|
+
* `/embed-widget/screener/?locale=…#<settings as JSON>`. Nothing is fetched or
|
|
10
|
+
* injected at mount, so the markup is the same on the server and in the
|
|
11
|
+
* browser, and the frame has its height before the table arrives.
|
|
12
12
|
*
|
|
13
|
-
* The iframe is keyed on that address
|
|
14
|
-
* only in its fragment as a same-document navigation and does not
|
|
15
|
-
* without the key a
|
|
13
|
+
* The iframe is keyed on that address, because a browser treats a `src` that
|
|
14
|
+
* differs only in its fragment as a same-document navigation and does not
|
|
15
|
+
* reload — without the key a new `defaultColumn` would change the URL and
|
|
16
|
+
* leave the old table on screen.
|
|
16
17
|
*/
|
|
17
18
|
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';
|
|
19
|
+
export type CryptoScreenerColumn = 'overview' | 'performance' | 'oscillators' | 'moving_averages';
|
|
25
20
|
export type CryptoScreenerTheme = 'light' | 'dark';
|
|
21
|
+
export type CryptoScreenerMarket = 'crypto';
|
|
26
22
|
export interface CryptoScreenerProps extends Omit<YStackProps, 'width' | 'height' | 'theme'> {
|
|
27
|
-
/**
|
|
23
|
+
/** The market the screener lists; TradingView's crypto table. */
|
|
28
24
|
market?: CryptoScreenerMarket;
|
|
29
|
-
/** Which column set the
|
|
25
|
+
/** Which column set opens first; the toolbar still switches it live. */
|
|
30
26
|
defaultColumn?: CryptoScreenerColumn;
|
|
31
|
-
/** The currency prices and
|
|
27
|
+
/** The currency prices and market caps are shown in. */
|
|
32
28
|
displayCurrency?: string;
|
|
33
|
-
/** The
|
|
29
|
+
/** The screener's own palette; independent of the surrounding gui theme. */
|
|
34
30
|
colorTheme?: CryptoScreenerTheme;
|
|
35
31
|
isTransparent?: boolean;
|
|
36
32
|
locale?: string;
|
|
37
33
|
width?: string | number;
|
|
38
34
|
height?: string | number;
|
|
39
35
|
}
|
|
40
|
-
declare const CryptoScreener: ({ market, defaultColumn, displayCurrency, colorTheme, isTransparent, locale, width, height, ...props }: CryptoScreenerProps) => import("react").JSX.Element;
|
|
36
|
+
declare const CryptoScreener: ({ market: _market, defaultColumn, displayCurrency, colorTheme, isTransparent, locale, width, height, ...props }: CryptoScreenerProps) => import("react").JSX.Element;
|
|
41
37
|
export { CryptoScreener };
|
|
42
38
|
//# sourceMappingURL=crypto-screener.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crypto-screener.d.ts","sourceRoot":"","sources":["../../../src/backends/gui/crypto-screener.tsx"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"crypto-screener.d.ts","sourceRoot":"","sources":["../../../src/backends/gui/crypto-screener.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAiB,KAAK,WAAW,EAAE,MAAM,YAAY,CAAA;AAG5D,MAAM,MAAM,oBAAoB,GAAG,UAAU,GAAG,aAAa,GAAG,aAAa,GAAG,iBAAiB,CAAA;AACjG,MAAM,MAAM,mBAAmB,GAAG,OAAO,GAAG,MAAM,CAAA;AAClD,MAAM,MAAM,oBAAoB,GAAG,QAAQ,CAAA;AAE3C,MAAM,WAAW,mBAAoB,SAAQ,IAAI,CAAC,WAAW,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;IAC1F,iEAAiE;IACjE,MAAM,CAAC,EAAE,oBAAoB,CAAA;IAC7B,wEAAwE;IACxE,aAAa,CAAC,EAAE,oBAAoB,CAAA;IACpC,wDAAwD;IACxD,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,4EAA4E;IAC5E,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;AAwBD,QAAA,MAAM,cAAc,oHAUjB,mBAAmB,gCA6BrB,CAAA;AAED,OAAO,EAAE,cAAc,EAAE,CAAA"}
|
|
@@ -1,30 +1,29 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
/**
|
|
4
|
-
* CryptoScreener —
|
|
4
|
+
* CryptoScreener — TradingView's crypto market screener, in a gui frame.
|
|
5
5
|
*
|
|
6
|
-
* The
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
6
|
+
* The table is TradingView's own document, so it is an `<iframe>` and nothing
|
|
7
|
+
* here draws a row of it. What this owns is the frame around it and the
|
|
8
|
+
* settings the screener opens with — the column set, the display currency,
|
|
9
|
+
* the theme — written into the iframe's address the way TradingView's own
|
|
10
|
+
* embed script writes them:
|
|
11
|
+
* `/embed-widget/screener/?locale=…#<settings as JSON>`. Nothing is fetched or
|
|
12
|
+
* injected at mount, so the markup is the same on the server and in the
|
|
13
|
+
* browser, and the frame has its height before the table arrives.
|
|
14
14
|
*
|
|
15
|
-
* The iframe is keyed on that address
|
|
16
|
-
* only in its fragment as a same-document navigation and does not
|
|
17
|
-
* without the key a
|
|
15
|
+
* The iframe is keyed on that address, because a browser treats a `src` that
|
|
16
|
+
* differs only in its fragment as a same-document navigation and does not
|
|
17
|
+
* reload — without the key a new `defaultColumn` would change the URL and
|
|
18
|
+
* leave the old table on screen.
|
|
18
19
|
*/
|
|
19
20
|
import { YStack, isWeb } from '@hanzo/gui';
|
|
20
21
|
import { slot } from './slot.js';
|
|
21
|
-
|
|
22
|
-
const screenerType = (market) => market === 'crypto' ? 'crypto_mkt' : market;
|
|
23
|
-
const EMBED = 'https://www.tradingview-widget.com/embed-widget/screener/?locale=';
|
|
22
|
+
const EMBED = 'https://www.tradingview-widget.com/embed-widget/screener/?locale=en#';
|
|
24
23
|
/** The settings TradingView reads, with the documented defaults filled in. */
|
|
25
|
-
const settings = ({
|
|
24
|
+
const settings = ({ defaultColumn = 'overview', displayCurrency = 'USD', colorTheme = 'dark', isTransparent = false, locale = 'en', width = '100%', height = 550, }) => ({
|
|
26
25
|
defaultColumn,
|
|
27
|
-
screener_type:
|
|
26
|
+
screener_type: 'crypto_mkt',
|
|
28
27
|
displayCurrency,
|
|
29
28
|
colorTheme,
|
|
30
29
|
isTransparent,
|
|
@@ -32,22 +31,13 @@ const settings = ({ market = 'crypto', defaultColumn = 'overview', displayCurren
|
|
|
32
31
|
width,
|
|
33
32
|
height,
|
|
34
33
|
});
|
|
35
|
-
const CryptoScreener = ({ market, defaultColumn, displayCurrency, colorTheme, isTransparent, locale, width, height, ...props }) => {
|
|
36
|
-
const s = settings({
|
|
37
|
-
|
|
38
|
-
|
|
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,
|
|
34
|
+
const CryptoScreener = ({ market: _market, defaultColumn, displayCurrency, colorTheme, isTransparent, locale, width, height, ...props }) => {
|
|
35
|
+
const s = settings({ defaultColumn, displayCurrency, colorTheme, isTransparent, locale, width, height });
|
|
36
|
+
const src = EMBED + encodeURIComponent(JSON.stringify(s));
|
|
37
|
+
return (_jsx(YStack, { ...slot('crypto-screener'), "data-column": s.defaultColumn, "data-color-theme": s.colorTheme,
|
|
48
38
|
// The documented size is TradingView's — a number or a percent string —
|
|
49
39
|
// 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:
|
|
40
|
+
width: s.width, height: s.height, overflow: "hidden", position: "relative", bg: "$panel", ...props, children: isWeb && (_jsx("iframe", { src: src, title: "Crypto screener", loading: "lazy", scrolling: "no", style: { display: 'block', width: '100%', height: '100%', border: 0 } }, src)) }));
|
|
51
41
|
};
|
|
52
42
|
export { CryptoScreener };
|
|
53
43
|
//# sourceMappingURL=crypto-screener.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crypto-screener.js","sourceRoot":"","sources":["../../../src/backends/gui/crypto-screener.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ
|
|
1
|
+
{"version":3,"file":"crypto-screener.js","sourceRoot":"","sources":["../../../src/backends/gui/crypto-screener.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,MAAM,EAAE,KAAK,EAAoB,MAAM,YAAY,CAAA;AAC5D,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAqB7B,MAAM,KAAK,GAAG,sEAAsE,CAAA;AAEpF,8EAA8E;A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AM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,IALhE,GAAG,CAMR,CACH,GACM,CACV,CAAA;AACH,CAAC,CAAA;AAED,OAAO,EAAE,cAAc,EAAE,CAAA"}
|
|
@@ -4,15 +4,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
exports.Cursor = Cursor;
|
|
5
5
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
6
|
/**
|
|
7
|
-
* Cursor — a
|
|
8
|
-
*
|
|
7
|
+
* Cursor — a container that replaces the pointer with a small round follower
|
|
8
|
+
* while the pointer sits over it.
|
|
9
9
|
*
|
|
10
|
-
*
|
|
11
|
-
* frame's own
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* frame
|
|
10
|
+
* A `mousemove` on the frame turns the client point into a position relative
|
|
11
|
+
* to the frame's own box (`getBoundingClientRect`), so the follower is placed
|
|
12
|
+
* with plain `left`/`top` inside a `position: relative` parent — no fixed
|
|
13
|
+
* positioning, no document listener, and nothing rendered before the pointer
|
|
14
|
+
* has actually entered. `cursorText` draws a label inside the dot; leaving it
|
|
15
|
+
* unset draws a bare dot. The frame hides the native cursor for its own box
|
|
16
|
+
* only (`cursor: none`), so the effect is local to whatever the caller wraps,
|
|
17
|
+
* unlike a page-wide replacement.
|
|
16
18
|
*/
|
|
17
19
|
const gui_1 = require("@hanzo/gui");
|
|
18
20
|
const react_1 = require("react");
|
|
@@ -21,20 +23,15 @@ const slot_1 = require("./slot.cjs");
|
|
|
21
23
|
function Cursor({ children, cursorText, cursorSize = 20, className }) {
|
|
22
24
|
const [position, setPosition] = (0, react_1.useState)({ x: 0, y: 0 });
|
|
23
25
|
const [isHovered, setIsHovered] = (0, react_1.useState)(false);
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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',
|
|
26
|
+
return ((0, jsx_runtime_1.jsxs)(gui_1.YStack, { ...(0, slot_1.slot)('cursor'), position: "relative", style: gui_1.isWeb ? { cursor: 'none' } : undefined, ...(0, sx_1.sx)(className), onMouseMove: (e) => {
|
|
27
|
+
const rect = e.currentTarget.getBoundingClientRect();
|
|
28
|
+
setPosition({ x: e.clientX - rect.left, y: e.clientY - rect.top });
|
|
29
|
+
}, onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), children: [children, isHovered && ((0, jsx_runtime_1.jsx)(gui_1.YStack, { ...(0, slot_1.slot)('cursor-dot'), position: "absolute", items: "center", justify: "center", rounded: 9999, bg: "$color6", pointerEvents: "none", style: {
|
|
30
30
|
left: position.x,
|
|
31
31
|
top: position.y,
|
|
32
32
|
width: cursorSize,
|
|
33
33
|
height: cursorSize,
|
|
34
|
-
borderRadius: '50%',
|
|
35
34
|
transform: 'translate(-50%, -50%)',
|
|
36
|
-
backgroundColor: 'color-mix(in srgb, var(--color) 20%, transparent)',
|
|
37
|
-
pointerEvents: 'none',
|
|
38
35
|
zIndex: 50,
|
|
39
|
-
}, children: cursorText && ((0, jsx_runtime_1.jsx)(gui_1.SizableText, {
|
|
36
|
+
}, children: cursorText && ((0, jsx_runtime_1.jsx)(gui_1.SizableText, { size: "$1", fontWeight: "500", color: "$color", children: cursorText })) }))] }));
|
|
40
37
|
}
|
|
@@ -4,12 +4,13 @@ export type CursorPosition = {
|
|
|
4
4
|
y: number;
|
|
5
5
|
};
|
|
6
6
|
export type CursorProps = {
|
|
7
|
+
/** Content the cursor effect plays over. */
|
|
7
8
|
children: ReactNode;
|
|
8
|
-
/**
|
|
9
|
+
/** Label drawn inside the follower dot; omit for a bare dot. */
|
|
9
10
|
cursorText?: string;
|
|
10
|
-
/** Diameter of the dot, in px. */
|
|
11
|
+
/** Diameter of the follower dot, in px. */
|
|
11
12
|
cursorSize?: number;
|
|
12
|
-
/** Class notation
|
|
13
|
+
/** Class notation, converted to style props on the frame. */
|
|
13
14
|
className?: string;
|
|
14
15
|
};
|
|
15
16
|
export declare function Cursor({ children, cursorText, cursorSize, className }: CursorProps): import("react").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cursor.d.ts","sourceRoot":"","sources":["../../../src/backends/gui/cursor.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cursor.d.ts","sourceRoot":"","sources":["../../../src/backends/gui/cursor.tsx"],"names":[],"mappings":"AAgBA,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,4CAA4C;IAC5C,QAAQ,EAAE,SAAS,CAAA;IACnB,gEAAgE;IAChE,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,2CAA2C;IAC3C,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,6DAA6D;IAC7D,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,wBAAgB,MAAM,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAe,EAAE,SAAS,EAAE,EAAE,WAAW,+BA6CvF"}
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
/**
|
|
4
|
-
* Cursor — a
|
|
5
|
-
*
|
|
4
|
+
* Cursor — a container that replaces the pointer with a small round follower
|
|
5
|
+
* while the pointer sits over it.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
* frame's own
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* frame
|
|
7
|
+
* A `mousemove` on the frame turns the client point into a position relative
|
|
8
|
+
* to the frame's own box (`getBoundingClientRect`), so the follower is placed
|
|
9
|
+
* with plain `left`/`top` inside a `position: relative` parent — no fixed
|
|
10
|
+
* positioning, no document listener, and nothing rendered before the pointer
|
|
11
|
+
* has actually entered. `cursorText` draws a label inside the dot; leaving it
|
|
12
|
+
* unset draws a bare dot. The frame hides the native cursor for its own box
|
|
13
|
+
* only (`cursor: none`), so the effect is local to whatever the caller wraps,
|
|
14
|
+
* unlike a page-wide replacement.
|
|
13
15
|
*/
|
|
14
16
|
import { SizableText, YStack, isWeb } from '@hanzo/gui';
|
|
15
17
|
import { useState } from 'react';
|
|
@@ -18,21 +20,16 @@ import { slot } from './slot.js';
|
|
|
18
20
|
export function Cursor({ children, cursorText, cursorSize = 20, className }) {
|
|
19
21
|
const [position, setPosition] = useState({ x: 0, y: 0 });
|
|
20
22
|
const [isHovered, setIsHovered] = useState(false);
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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',
|
|
23
|
+
return (_jsxs(YStack, { ...slot('cursor'), position: "relative", style: isWeb ? { cursor: 'none' } : undefined, ...sx(className), onMouseMove: (e) => {
|
|
24
|
+
const rect = e.currentTarget.getBoundingClientRect();
|
|
25
|
+
setPosition({ x: e.clientX - rect.left, y: e.clientY - rect.top });
|
|
26
|
+
}, onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), children: [children, isHovered && (_jsx(YStack, { ...slot('cursor-dot'), position: "absolute", items: "center", justify: "center", rounded: 9999, bg: "$color6", pointerEvents: "none", style: {
|
|
27
27
|
left: position.x,
|
|
28
28
|
top: position.y,
|
|
29
29
|
width: cursorSize,
|
|
30
30
|
height: cursorSize,
|
|
31
|
-
borderRadius: '50%',
|
|
32
31
|
transform: 'translate(-50%, -50%)',
|
|
33
|
-
backgroundColor: 'color-mix(in srgb, var(--color) 20%, transparent)',
|
|
34
|
-
pointerEvents: 'none',
|
|
35
32
|
zIndex: 50,
|
|
36
|
-
}, children: cursorText && (_jsx(SizableText, {
|
|
33
|
+
}, children: cursorText && (_jsx(SizableText, { size: "$1", fontWeight: "500", color: "$color", children: cursorText })) }))] }));
|
|
37
34
|
}
|
|
38
35
|
//# sourceMappingURL=cursor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cursor.js","sourceRoot":"","sources":["../../../src/backends/gui/cursor.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ
|
|
1
|
+
{"version":3,"file":"cursor.js","sourceRoot":"","sources":["../../../src/backends/gui/cursor.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AACvD,OAAO,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAA;AAChD,OAAO,EAAE,EAAE,EAAE,MAAM,UAAU,CAAA;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAe7B,MAAM,UAAU,MAAM,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,GAAG,EAAE,EAAE,SAAS,EAAe;IACtF,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAiB,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,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