@hanzo/ui 8.27.8 → 8.27.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/dist/backends/gui/3d-card.cjs +100 -0
- package/dist/backends/gui/3d-card.d.ts +59 -0
- package/dist/backends/gui/3d-card.d.ts.map +1 -0
- package/dist/backends/gui/3d-card.js +92 -0
- package/dist/backends/gui/3d-card.js.map +1 -0
- package/dist/backends/gui/3d-marquee.cjs +225 -0
- package/dist/backends/gui/3d-marquee.d.ts +114 -0
- package/dist/backends/gui/3d-marquee.d.ts.map +1 -0
- package/dist/backends/gui/3d-marquee.js +190 -0
- package/dist/backends/gui/3d-marquee.js.map +1 -0
- package/dist/backends/gui/3d-pin.cjs +51 -0
- package/dist/backends/gui/3d-pin.d.ts +14 -0
- package/dist/backends/gui/3d-pin.d.ts.map +1 -0
- package/dist/backends/gui/3d-pin.js +49 -0
- package/dist/backends/gui/3d-pin.js.map +1 -0
- package/dist/backends/gui/advanced-chart.cjs +61 -0
- package/dist/backends/gui/advanced-chart.d.ts +38 -0
- package/dist/backends/gui/advanced-chart.d.ts.map +1 -0
- package/dist/backends/gui/advanced-chart.js +59 -0
- package/dist/backends/gui/advanced-chart.js.map +1 -0
- package/dist/backends/gui/alert.cjs +106 -0
- package/dist/backends/gui/alert.d.ts +39 -0
- package/dist/backends/gui/alert.d.ts.map +1 -0
- package/dist/backends/gui/alert.js +102 -0
- package/dist/backends/gui/alert.js.map +1 -0
- package/dist/backends/gui/android.cjs +52 -0
- package/dist/backends/gui/android.d.ts +16 -0
- package/dist/backends/gui/android.d.ts.map +1 -0
- package/dist/backends/gui/android.js +50 -0
- package/dist/backends/gui/android.js.map +1 -0
- package/dist/backends/gui/animated-beam.cjs +97 -0
- package/dist/backends/gui/animated-beam.d.ts +57 -0
- package/dist/backends/gui/animated-beam.d.ts.map +1 -0
- package/dist/backends/gui/animated-beam.js +62 -0
- package/dist/backends/gui/animated-beam.js.map +1 -0
- package/dist/backends/gui/animated-cursor.cjs +183 -0
- package/dist/backends/gui/animated-cursor.d.ts +42 -0
- package/dist/backends/gui/animated-cursor.d.ts.map +1 -0
- package/dist/backends/gui/animated-cursor.js +181 -0
- package/dist/backends/gui/animated-cursor.js.map +1 -0
- package/dist/backends/gui/animated-testimonials.cjs +109 -0
- package/dist/backends/gui/animated-testimonials.d.ts +23 -0
- package/dist/backends/gui/animated-testimonials.d.ts.map +1 -0
- package/dist/backends/gui/animated-testimonials.js +74 -0
- package/dist/backends/gui/animated-testimonials.js.map +1 -0
- package/dist/backends/gui/animated-tooltip.cjs +100 -0
- package/dist/backends/gui/animated-tooltip.d.ts +15 -0
- package/dist/backends/gui/animated-tooltip.d.ts.map +1 -0
- package/dist/backends/gui/animated-tooltip.js +65 -0
- package/dist/backends/gui/animated-tooltip.js.map +1 -0
- package/dist/backends/gui/announcement.cjs +54 -0
- package/dist/backends/gui/announcement.d.ts +26 -0
- package/dist/backends/gui/announcement.d.ts.map +1 -0
- package/dist/backends/gui/announcement.js +52 -0
- package/dist/backends/gui/announcement.js.map +1 -0
- package/dist/backends/gui/apple-cards-carousel.cjs +198 -0
- package/dist/backends/gui/apple-cards-carousel.d.ts +45 -0
- package/dist/backends/gui/apple-cards-carousel.d.ts.map +1 -0
- package/dist/backends/gui/apple-cards-carousel.js +162 -0
- package/dist/backends/gui/apple-cards-carousel.js.map +1 -0
- package/dist/backends/gui/apple-hello-effect.cjs +38 -0
- package/dist/backends/gui/apple-hello-effect.d.ts +9 -0
- package/dist/backends/gui/apple-hello-effect.d.ts.map +1 -0
- package/dist/backends/gui/apple-hello-effect.js +36 -0
- package/dist/backends/gui/apple-hello-effect.js.map +1 -0
- package/dist/backends/gui/banner.cjs +108 -0
- package/dist/backends/gui/banner.d.ts +33 -0
- package/dist/backends/gui/banner.d.ts.map +1 -0
- package/dist/backends/gui/banner.js +106 -0
- package/dist/backends/gui/banner.js.map +1 -0
- package/dist/backends/gui/calendar.cjs +152 -0
- package/dist/backends/gui/calendar.d.ts +41 -0
- package/dist/backends/gui/calendar.d.ts.map +1 -0
- package/dist/backends/gui/calendar.js +151 -0
- package/dist/backends/gui/calendar.js.map +1 -0
- package/dist/backends/gui/choicebox.cjs +50 -0
- package/dist/backends/gui/choicebox.d.ts +33 -0
- package/dist/backends/gui/choicebox.d.ts.map +1 -0
- package/dist/backends/gui/choicebox.js +49 -0
- package/dist/backends/gui/choicebox.js.map +1 -0
- package/dist/backends/gui/code-block.cjs +120 -0
- package/dist/backends/gui/code-block.d.ts +22 -0
- package/dist/backends/gui/code-block.d.ts.map +1 -0
- package/dist/backends/gui/code-block.js +118 -0
- package/dist/backends/gui/code-block.js.map +1 -0
- package/dist/backends/gui/code-editor.cjs +195 -0
- package/dist/backends/gui/code-editor.d.ts +43 -0
- package/dist/backends/gui/code-editor.d.ts.map +1 -0
- package/dist/backends/gui/code-editor.js +160 -0
- package/dist/backends/gui/code-editor.js.map +1 -0
- package/dist/backends/gui/code-tabs.cjs +21 -0
- package/dist/backends/gui/code-tabs.d.ts +22 -0
- package/dist/backends/gui/code-tabs.d.ts.map +1 -0
- package/dist/backends/gui/code-tabs.js +19 -0
- package/dist/backends/gui/code-tabs.js.map +1 -0
- package/dist/backends/gui/color-picker.cjs +141 -0
- package/dist/backends/gui/color-picker.d.ts +25 -0
- package/dist/backends/gui/color-picker.d.ts.map +1 -0
- package/dist/backends/gui/color-picker.js +139 -0
- package/dist/backends/gui/color-picker.js.map +1 -0
- package/dist/backends/gui/combobox.cjs +42 -0
- package/dist/backends/gui/combobox.d.ts +39 -0
- package/dist/backends/gui/combobox.d.ts.map +1 -0
- package/dist/backends/gui/combobox.js +40 -0
- package/dist/backends/gui/combobox.js.map +1 -0
- package/dist/backends/gui/company-profile.cjs +43 -0
- package/dist/backends/gui/company-profile.d.ts +33 -0
- package/dist/backends/gui/company-profile.d.ts.map +1 -0
- package/dist/backends/gui/company-profile.js +41 -0
- package/dist/backends/gui/company-profile.js.map +1 -0
- package/dist/backends/gui/comparison.cjs +43 -0
- package/dist/backends/gui/comparison.d.ts +16 -0
- package/dist/backends/gui/comparison.d.ts.map +1 -0
- package/dist/backends/gui/comparison.js +41 -0
- package/dist/backends/gui/comparison.js.map +1 -0
- package/dist/backends/gui/credit-card.cjs +80 -0
- package/dist/backends/gui/credit-card.d.ts +21 -0
- package/dist/backends/gui/credit-card.d.ts.map +1 -0
- package/dist/backends/gui/credit-card.js +78 -0
- package/dist/backends/gui/credit-card.js.map +1 -0
- package/dist/backends/gui/crypto-market.cjs +128 -0
- package/dist/backends/gui/crypto-market.d.ts +52 -0
- package/dist/backends/gui/crypto-market.d.ts.map +1 -0
- package/dist/backends/gui/crypto-market.js +126 -0
- package/dist/backends/gui/crypto-market.js.map +1 -0
- package/dist/backends/gui/crypto-screener.cjs +55 -0
- package/dist/backends/gui/crypto-screener.d.ts +42 -0
- package/dist/backends/gui/crypto-screener.d.ts.map +1 -0
- package/dist/backends/gui/crypto-screener.js +53 -0
- package/dist/backends/gui/crypto-screener.js.map +1 -0
- package/dist/backends/gui/cursor.cjs +40 -0
- package/dist/backends/gui/cursor.d.ts +16 -0
- package/dist/backends/gui/cursor.d.ts.map +1 -0
- package/dist/backends/gui/cursor.js +38 -0
- package/dist/backends/gui/cursor.js.map +1 -0
- package/dist/backends/gui/data-table.cjs +211 -0
- package/dist/backends/gui/data-table.d.ts +71 -0
- package/dist/backends/gui/data-table.d.ts.map +1 -0
- package/dist/backends/gui/data-table.js +175 -0
- package/dist/backends/gui/data-table.js.map +1 -0
- package/dist/backends/gui/date-picker.cjs +66 -0
- package/dist/backends/gui/date-picker.d.ts +29 -0
- package/dist/backends/gui/date-picker.d.ts.map +1 -0
- package/dist/backends/gui/date-picker.js +64 -0
- package/dist/backends/gui/date-picker.js.map +1 -0
- package/dist/backends/gui/desktop-spotlight.cjs +46 -0
- package/dist/backends/gui/desktop-spotlight.d.ts +34 -0
- package/dist/backends/gui/desktop-spotlight.d.ts.map +1 -0
- package/dist/backends/gui/desktop-spotlight.js +44 -0
- package/dist/backends/gui/desktop-spotlight.js.map +1 -0
- package/dist/backends/gui/desktop-window.cjs +180 -0
- package/dist/backends/gui/desktop-window.d.ts +51 -0
- package/dist/backends/gui/desktop-window.d.ts.map +1 -0
- package/dist/backends/gui/desktop-window.js +177 -0
- package/dist/backends/gui/desktop-window.js.map +1 -0
- package/dist/backends/gui/desktop.cjs +238 -0
- package/dist/backends/gui/desktop.d.ts +109 -0
- package/dist/backends/gui/desktop.d.ts.map +1 -0
- package/dist/backends/gui/desktop.js +199 -0
- package/dist/backends/gui/desktop.js.map +1 -0
- package/dist/backends/gui/dialog-stack.cjs +26 -0
- package/dist/backends/gui/dialog-stack.d.ts +23 -0
- package/dist/backends/gui/dialog-stack.d.ts.map +1 -0
- package/dist/backends/gui/dialog-stack.js +24 -0
- package/dist/backends/gui/dialog-stack.js.map +1 -0
- package/dist/backends/gui/dock.cjs +99 -0
- package/dist/backends/gui/dock.d.ts +41 -0
- package/dist/backends/gui/dock.d.ts.map +1 -0
- package/dist/backends/gui/dock.js +96 -0
- package/dist/backends/gui/dock.js.map +1 -0
- package/dist/backends/gui/dropzone.cjs +142 -0
- package/dist/backends/gui/dropzone.d.ts +12 -0
- package/dist/backends/gui/dropzone.d.ts.map +1 -0
- package/dist/backends/gui/dropzone.js +140 -0
- package/dist/backends/gui/dropzone.js.map +1 -0
- package/dist/backends/gui/editor.cjs +80 -0
- package/dist/backends/gui/editor.d.ts +23 -0
- package/dist/backends/gui/editor.d.ts.map +1 -0
- package/dist/backends/gui/editor.js +45 -0
- package/dist/backends/gui/editor.js.map +1 -0
- package/dist/backends/gui/empty.cjs +71 -0
- package/dist/backends/gui/empty.d.ts +43 -0
- package/dist/backends/gui/empty.d.ts.map +1 -0
- package/dist/backends/gui/empty.js +63 -0
- package/dist/backends/gui/empty.js.map +1 -0
- package/dist/backends/gui/financials.cjs +45 -0
- package/dist/backends/gui/financials.d.ts +36 -0
- package/dist/backends/gui/financials.d.ts.map +1 -0
- package/dist/backends/gui/financials.js +43 -0
- package/dist/backends/gui/financials.js.map +1 -0
- package/dist/backends/gui/forex-market.cjs +21 -0
- package/dist/backends/gui/forex-market.d.ts +17 -0
- package/dist/backends/gui/forex-market.d.ts.map +1 -0
- package/dist/backends/gui/forex-market.js +19 -0
- package/dist/backends/gui/forex-market.js.map +1 -0
- package/dist/backends/gui/forex-screener.cjs +57 -0
- package/dist/backends/gui/forex-screener.d.ts +45 -0
- package/dist/backends/gui/forex-screener.d.ts.map +1 -0
- package/dist/backends/gui/forex-screener.js +55 -0
- package/dist/backends/gui/forex-screener.js.map +1 -0
- package/dist/backends/gui/gantt.cjs +50 -0
- package/dist/backends/gui/gantt.d.ts +19 -0
- package/dist/backends/gui/gantt.d.ts.map +1 -0
- package/dist/backends/gui/gantt.js +49 -0
- package/dist/backends/gui/gantt.js.map +1 -0
- package/dist/backends/gui/index.cjs +108 -1
- package/dist/backends/gui/index.d.ts +41 -0
- package/dist/backends/gui/index.d.ts.map +1 -1
- package/dist/backends/gui/index.js +41 -0
- package/dist/backends/gui/index.js.map +1 -1
- package/dist/canvas.cjs +3 -3
- package/dist/canvas.js +3 -3
- package/dist/canvas.js.map +1 -1
- package/dist/gallery.html +2 -2
- package/dist/grid.cjs +19 -43
- package/dist/grid.d.ts +36 -1
- package/dist/grid.d.ts.map +1 -1
- package/dist/grid.js +19 -43
- package/dist/grid.js.map +1 -1
- package/dist/index.cjs +70 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/index.node.cjs +70 -1
- package/dist/index.node.js +3 -0
- package/dist/product/ChunkGuard.cjs +58 -0
- package/dist/product/ChunkGuard.d.ts +7 -0
- package/dist/product/ChunkGuard.d.ts.map +1 -0
- package/dist/product/ChunkGuard.js +56 -0
- package/dist/product/ChunkGuard.js.map +1 -0
- package/dist/product/DetailPane.cjs +46 -0
- package/dist/product/DetailPane.d.ts +47 -0
- package/dist/product/DetailPane.d.ts.map +1 -0
- package/dist/product/DetailPane.js +43 -0
- package/dist/product/DetailPane.js.map +1 -0
- package/dist/product/Fact.cjs +19 -0
- package/dist/product/Fact.d.ts +23 -0
- package/dist/product/Fact.d.ts.map +1 -0
- package/dist/product/Fact.js +17 -0
- package/dist/product/Fact.js.map +1 -0
- package/dist/product/chunkGuard.logic.cjs +54 -0
- package/dist/product/chunkGuard.logic.d.ts +26 -0
- package/dist/product/chunkGuard.logic.d.ts.map +1 -0
- package/dist/product/chunkGuard.logic.js +49 -0
- package/dist/product/chunkGuard.logic.js.map +1 -0
- package/dist/product/index.cjs +10 -0
- package/dist/product/index.d.ts +3 -0
- package/dist/product/index.d.ts.map +1 -1
- package/dist/product/index.js +10 -0
- package/dist/product/index.js.map +1 -1
- package/package.json +5 -3
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
'use client';"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
exports.Editor = Editor;
|
|
38
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
39
|
+
/**
|
|
40
|
+
* Editor — a rich-text surface: a toolbar of bold/italic/bulleted-list/numbered-list
|
|
41
|
+
* toggles above a contentEditable region, reporting its HTML back on every edit.
|
|
42
|
+
*
|
|
43
|
+
* Formatting a live selection is a browser primitive with no cross-platform
|
|
44
|
+
* equivalent in gui, so this wraps the two platform primitives directly —
|
|
45
|
+
* `contentEditable` for the surface, `document.execCommand` for the commands —
|
|
46
|
+
* inside a gui frame for layout and theming. It is web-only for that reason;
|
|
47
|
+
* native has no selection to format.
|
|
48
|
+
*/
|
|
49
|
+
const gui_1 = require("@hanzo/gui");
|
|
50
|
+
const lucide_icons_2_1 = require("@hanzogui/lucide-icons-2");
|
|
51
|
+
const React = __importStar(require("react"));
|
|
52
|
+
const button_1 = require("./button.cjs");
|
|
53
|
+
const slot_1 = require("./slot.cjs");
|
|
54
|
+
function Editor({ value, onChange, placeholder = 'Start typing...', readOnly = false, ...props }) {
|
|
55
|
+
const surface = React.useRef(null);
|
|
56
|
+
const [empty, setEmpty] = React.useState(!value);
|
|
57
|
+
// A controlled value is written into the surface only when it changes out
|
|
58
|
+
// from under the caller (e.g. a reset button) — writing it on every render
|
|
59
|
+
// would fight the surface's own DOM as the user types and jump the caret.
|
|
60
|
+
React.useEffect(() => {
|
|
61
|
+
const el = surface.current;
|
|
62
|
+
if (el && value !== undefined && value !== el.innerHTML)
|
|
63
|
+
el.innerHTML = value;
|
|
64
|
+
}, [value]);
|
|
65
|
+
const report = React.useCallback(() => {
|
|
66
|
+
const el = surface.current;
|
|
67
|
+
if (!el)
|
|
68
|
+
return;
|
|
69
|
+
setEmpty(el.textContent === '');
|
|
70
|
+
onChange?.(el.innerHTML);
|
|
71
|
+
}, [onChange]);
|
|
72
|
+
const command = (name) => () => {
|
|
73
|
+
document.execCommand(name);
|
|
74
|
+
surface.current?.focus();
|
|
75
|
+
report();
|
|
76
|
+
};
|
|
77
|
+
return ((0, jsx_runtime_1.jsxs)(gui_1.YStack, { ...(0, slot_1.slot)('editor'), gap: "$2", ...props, children: [(0, jsx_runtime_1.jsxs)(gui_1.XStack, { ...(0, slot_1.slot)('editor-toolbar'), gap: "$1", borderBottomWidth: 1, borderColor: "$borderColor", pb: "$2", children: [(0, jsx_runtime_1.jsx)(button_1.Button, { ...(0, slot_1.slot)('editor-bold'), variant: "ghost", size: "icon-sm", type: "button", onClick: command('bold'), "aria-label": "Bold", children: (0, jsx_runtime_1.jsx)(lucide_icons_2_1.Bold, { size: 16 }) }), (0, jsx_runtime_1.jsx)(button_1.Button, { ...(0, slot_1.slot)('editor-italic'), variant: "ghost", size: "icon-sm", type: "button", onClick: command('italic'), "aria-label": "Italic", children: (0, jsx_runtime_1.jsx)(lucide_icons_2_1.Italic, { size: 16 }) }), (0, jsx_runtime_1.jsx)(button_1.Button, { ...(0, slot_1.slot)('editor-bullet-list'), variant: "ghost", size: "icon-sm", type: "button", onClick: command('insertUnorderedList'), "aria-label": "Bulleted list", children: (0, jsx_runtime_1.jsx)(lucide_icons_2_1.List, { size: 16 }) }), (0, jsx_runtime_1.jsx)(button_1.Button, { ...(0, slot_1.slot)('editor-ordered-list'), variant: "ghost", size: "icon-sm", type: "button", onClick: command('insertOrderedList'), "aria-label": "Numbered list", children: (0, jsx_runtime_1.jsx)(lucide_icons_2_1.ListOrdered, { size: 16 }) })] }), (0, jsx_runtime_1.jsx)(gui_1.YStack, { ...(0, slot_1.slot)('editor-surface'), ref: surface,
|
|
78
|
+
// @ts-expect-error — contentEditable is a DOM attribute gui does not type; it forwards unknown props on web and drops them on native
|
|
79
|
+
contentEditable: !readOnly, suppressContentEditableWarning: true, "data-placeholder": placeholder, "data-empty": empty || undefined, minH: 200, borderWidth: 1, borderColor: "$borderColor", rounded: "$3", p: "$4", onInput: report, dangerouslySetInnerHTML: value === undefined ? { __html: '' } : undefined, style: { outline: 'none' } })] }));
|
|
80
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Editor — a rich-text surface: a toolbar of bold/italic/bulleted-list/numbered-list
|
|
3
|
+
* toggles above a contentEditable region, reporting its HTML back on every edit.
|
|
4
|
+
*
|
|
5
|
+
* Formatting a live selection is a browser primitive with no cross-platform
|
|
6
|
+
* equivalent in gui, so this wraps the two platform primitives directly —
|
|
7
|
+
* `contentEditable` for the surface, `document.execCommand` for the commands —
|
|
8
|
+
* inside a gui frame for layout and theming. It is web-only for that reason;
|
|
9
|
+
* native has no selection to format.
|
|
10
|
+
*/
|
|
11
|
+
import { type YStackProps } from '@hanzo/gui';
|
|
12
|
+
import * as React from 'react';
|
|
13
|
+
/** The four formatting commands the toolbar issues via `document.execCommand`. */
|
|
14
|
+
export type EditorCommand = 'bold' | 'italic' | 'insertUnorderedList' | 'insertOrderedList';
|
|
15
|
+
export interface EditorProps extends Omit<YStackProps, 'children' | 'onChange'> {
|
|
16
|
+
/** A controlled value; omit it and edit freely to let the surface own its HTML. */
|
|
17
|
+
value?: string;
|
|
18
|
+
onChange?: (value: string) => void;
|
|
19
|
+
placeholder?: string;
|
|
20
|
+
readOnly?: boolean;
|
|
21
|
+
}
|
|
22
|
+
export declare function Editor({ value, onChange, placeholder, readOnly, ...props }: EditorProps): React.JSX.Element;
|
|
23
|
+
//# sourceMappingURL=editor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../src/backends/gui/editor.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AACH,OAAO,EAAkB,KAAK,WAAW,EAAE,MAAM,YAAY,CAAA;AAE7D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAK9B,kFAAkF;AAClF,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,QAAQ,GAAG,qBAAqB,GAAG,mBAAmB,CAAA;AAE3F,MAAM,WAAW,WAAY,SAAQ,IAAI,CAAC,WAAW,EAAE,UAAU,GAAG,UAAU,CAAC;IAC7E,mFAAmF;IACnF,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IAClC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED,wBAAgB,MAAM,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,WAA+B,EAAE,QAAgB,EAAE,GAAG,KAAK,EAAE,EAAE,WAAW,qBA0EnH"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
/**
|
|
4
|
+
* Editor — a rich-text surface: a toolbar of bold/italic/bulleted-list/numbered-list
|
|
5
|
+
* toggles above a contentEditable region, reporting its HTML back on every edit.
|
|
6
|
+
*
|
|
7
|
+
* Formatting a live selection is a browser primitive with no cross-platform
|
|
8
|
+
* equivalent in gui, so this wraps the two platform primitives directly —
|
|
9
|
+
* `contentEditable` for the surface, `document.execCommand` for the commands —
|
|
10
|
+
* inside a gui frame for layout and theming. It is web-only for that reason;
|
|
11
|
+
* native has no selection to format.
|
|
12
|
+
*/
|
|
13
|
+
import { XStack, YStack } from '@hanzo/gui';
|
|
14
|
+
import { Bold, Italic, List, ListOrdered } from '@hanzogui/lucide-icons-2';
|
|
15
|
+
import * as React from 'react';
|
|
16
|
+
import { Button } from './button.js';
|
|
17
|
+
import { slot } from './slot.js';
|
|
18
|
+
export function Editor({ value, onChange, placeholder = 'Start typing...', readOnly = false, ...props }) {
|
|
19
|
+
const surface = React.useRef(null);
|
|
20
|
+
const [empty, setEmpty] = React.useState(!value);
|
|
21
|
+
// A controlled value is written into the surface only when it changes out
|
|
22
|
+
// from under the caller (e.g. a reset button) — writing it on every render
|
|
23
|
+
// would fight the surface's own DOM as the user types and jump the caret.
|
|
24
|
+
React.useEffect(() => {
|
|
25
|
+
const el = surface.current;
|
|
26
|
+
if (el && value !== undefined && value !== el.innerHTML)
|
|
27
|
+
el.innerHTML = value;
|
|
28
|
+
}, [value]);
|
|
29
|
+
const report = React.useCallback(() => {
|
|
30
|
+
const el = surface.current;
|
|
31
|
+
if (!el)
|
|
32
|
+
return;
|
|
33
|
+
setEmpty(el.textContent === '');
|
|
34
|
+
onChange?.(el.innerHTML);
|
|
35
|
+
}, [onChange]);
|
|
36
|
+
const command = (name) => () => {
|
|
37
|
+
document.execCommand(name);
|
|
38
|
+
surface.current?.focus();
|
|
39
|
+
report();
|
|
40
|
+
};
|
|
41
|
+
return (_jsxs(YStack, { ...slot('editor'), gap: "$2", ...props, children: [_jsxs(XStack, { ...slot('editor-toolbar'), gap: "$1", borderBottomWidth: 1, borderColor: "$borderColor", pb: "$2", children: [_jsx(Button, { ...slot('editor-bold'), variant: "ghost", size: "icon-sm", type: "button", onClick: command('bold'), "aria-label": "Bold", children: _jsx(Bold, { size: 16 }) }), _jsx(Button, { ...slot('editor-italic'), variant: "ghost", size: "icon-sm", type: "button", onClick: command('italic'), "aria-label": "Italic", children: _jsx(Italic, { size: 16 }) }), _jsx(Button, { ...slot('editor-bullet-list'), variant: "ghost", size: "icon-sm", type: "button", onClick: command('insertUnorderedList'), "aria-label": "Bulleted list", children: _jsx(List, { size: 16 }) }), _jsx(Button, { ...slot('editor-ordered-list'), variant: "ghost", size: "icon-sm", type: "button", onClick: command('insertOrderedList'), "aria-label": "Numbered list", children: _jsx(ListOrdered, { size: 16 }) })] }), _jsx(YStack, { ...slot('editor-surface'), ref: surface,
|
|
42
|
+
// @ts-expect-error — contentEditable is a DOM attribute gui does not type; it forwards unknown props on web and drops them on native
|
|
43
|
+
contentEditable: !readOnly, suppressContentEditableWarning: true, "data-placeholder": placeholder, "data-empty": empty || undefined, minH: 200, borderWidth: 1, borderColor: "$borderColor", rounded: "$3", p: "$4", onInput: report, dangerouslySetInnerHTML: value === undefined ? { __html: '' } : undefined, style: { outline: 'none' } })] }));
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=editor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editor.js","sourceRoot":"","sources":["../../../src/backends/gui/editor.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ;;;;;;;;;GASG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,EAAoB,MAAM,YAAY,CAAA;AAC7D,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AAC1E,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAa7B,MAAM,UAAU,MAAM,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,GAAG,iBAAiB,EAAE,QAAQ,GAAG,KAAK,EAAE,GAAG,KAAK,EAAe;IAClH,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAiB,IAAI,CAAC,CAAA;IAClD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,CAA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KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,GAC1B,IACK,CACV,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
'use client';"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.EmptyContent = exports.EmptyDescription = exports.EmptyTitle = exports.EmptyMedia = exports.EmptyHeader = exports.Empty = void 0;
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
/**
|
|
7
|
+
* Empty — a placeholder for the absence of data: a header (media, title,
|
|
8
|
+
* description) above a content slot for a call to action.
|
|
9
|
+
*
|
|
10
|
+
* `EmptyMedia` carries the one variant that matters here — a bare icon versus
|
|
11
|
+
* one boxed into a rounded tile — through a styled context, the same split
|
|
12
|
+
* Badge uses for its frame/text pair.
|
|
13
|
+
*/
|
|
14
|
+
const gui_1 = require("@hanzo/gui");
|
|
15
|
+
const ink_1 = require("./ink.cjs");
|
|
16
|
+
const slot_1 = require("./slot.cjs");
|
|
17
|
+
const EmptyFrame = (0, gui_1.styled)(gui_1.YStack, {
|
|
18
|
+
name: 'Empty',
|
|
19
|
+
flex: 1,
|
|
20
|
+
minW: 0,
|
|
21
|
+
items: 'center',
|
|
22
|
+
justify: 'center',
|
|
23
|
+
gap: '$6',
|
|
24
|
+
p: '$6',
|
|
25
|
+
rounded: '$6',
|
|
26
|
+
borderStyle: 'dashed',
|
|
27
|
+
});
|
|
28
|
+
const HeaderFrame = (0, gui_1.styled)(gui_1.YStack, {
|
|
29
|
+
name: 'EmptyHeader',
|
|
30
|
+
maxW: 384,
|
|
31
|
+
items: 'center',
|
|
32
|
+
gap: '$2',
|
|
33
|
+
});
|
|
34
|
+
const MediaContext = /* @__PURE__ */ (0, gui_1.createStyledContext)({ variant: 'default' });
|
|
35
|
+
const MediaFrame = (0, gui_1.styled)(gui_1.YStack, {
|
|
36
|
+
name: 'EmptyMedia',
|
|
37
|
+
context: MediaContext,
|
|
38
|
+
shrink: 0,
|
|
39
|
+
items: 'center',
|
|
40
|
+
justify: 'center',
|
|
41
|
+
mb: '$2',
|
|
42
|
+
variants: {
|
|
43
|
+
variant: {
|
|
44
|
+
default: { bg: 'transparent' },
|
|
45
|
+
icon: { bg: '$hover', width: 40, height: 40, rounded: '$3' },
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
defaultVariants: { variant: 'default' },
|
|
49
|
+
});
|
|
50
|
+
const TitleFrame = (0, gui_1.styled)(gui_1.SizableText, { name: 'EmptyTitle', size: '$4', fontWeight: '500' });
|
|
51
|
+
const DescriptionFrame = (0, gui_1.styled)(gui_1.SizableText, { name: 'EmptyDescription', size: '$2', color: '$quiet' });
|
|
52
|
+
const ContentFrame = (0, gui_1.styled)(gui_1.YStack, {
|
|
53
|
+
name: 'EmptyContent',
|
|
54
|
+
width: '100%',
|
|
55
|
+
minW: 0,
|
|
56
|
+
maxW: 384,
|
|
57
|
+
items: 'center',
|
|
58
|
+
gap: '$4',
|
|
59
|
+
});
|
|
60
|
+
const Empty = (p) => (0, jsx_runtime_1.jsx)(EmptyFrame, { ...(0, slot_1.slot)('empty'), ...p });
|
|
61
|
+
exports.Empty = Empty;
|
|
62
|
+
const EmptyHeader = (p) => (0, jsx_runtime_1.jsx)(HeaderFrame, { ...(0, slot_1.slot)('empty-header'), ...p });
|
|
63
|
+
exports.EmptyHeader = EmptyHeader;
|
|
64
|
+
const EmptyMedia = ({ variant = 'default', ...p }) => ((0, jsx_runtime_1.jsx)(MediaFrame, { ...(0, slot_1.slot)('empty-icon'), "data-variant": variant, variant: variant, ...p }));
|
|
65
|
+
exports.EmptyMedia = EmptyMedia;
|
|
66
|
+
const EmptyTitle = ({ children, ...p }) => ((0, jsx_runtime_1.jsx)(TitleFrame, { ...(0, slot_1.slot)('empty-title'), ...p, children: (0, ink_1.ink)(children) }));
|
|
67
|
+
exports.EmptyTitle = EmptyTitle;
|
|
68
|
+
const EmptyDescription = ({ children, ...p }) => ((0, jsx_runtime_1.jsx)(DescriptionFrame, { ...(0, slot_1.slot)('empty-description'), ...p, children: (0, ink_1.ink)(children) }));
|
|
69
|
+
exports.EmptyDescription = EmptyDescription;
|
|
70
|
+
const EmptyContent = ({ children, ...p }) => ((0, jsx_runtime_1.jsx)(ContentFrame, { ...(0, slot_1.slot)('empty-content'), ...p, children: (0, ink_1.ink)(children) }));
|
|
71
|
+
exports.EmptyContent = EmptyContent;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { ComponentProps } from 'react';
|
|
2
|
+
declare const EmptyFrame: 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 HeaderFrame: 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
|
+
export type EmptyMediaVariant = 'default' | 'icon';
|
|
11
|
+
declare const MediaFrame: import("@hanzogui/web").GuiComponent<import("@hanzogui/web").TamaDefer, import("@hanzogui/web").GuiElement, import("@hanzogui/core").RNGuiViewNonStyleProps, import("@hanzogui/web").StackStyleBase, {
|
|
12
|
+
elevation?: number | import("@hanzogui/web").SizeTokens | undefined;
|
|
13
|
+
fullscreen?: boolean | undefined;
|
|
14
|
+
variant?: "default" | "icon" | undefined;
|
|
15
|
+
}, import("@hanzogui/web").StaticConfigPublic>;
|
|
16
|
+
declare const TitleFrame: import("@hanzogui/web").GuiComponent<import("@hanzogui/web").TamaDefer, import("@hanzogui/web").GuiTextElement, import("@hanzogui/web").TextNonStyleProps, import("@hanzogui/web").TextStylePropsBase, {
|
|
17
|
+
unstyled?: boolean | undefined;
|
|
18
|
+
size?: import("@hanzogui/web").FontSizeTokens | undefined;
|
|
19
|
+
}, import("@hanzogui/web").StaticConfigPublic>;
|
|
20
|
+
declare const DescriptionFrame: import("@hanzogui/web").GuiComponent<import("@hanzogui/web").TamaDefer, import("@hanzogui/web").GuiTextElement, import("@hanzogui/web").TextNonStyleProps, import("@hanzogui/web").TextStylePropsBase, {
|
|
21
|
+
unstyled?: boolean | undefined;
|
|
22
|
+
size?: import("@hanzogui/web").FontSizeTokens | undefined;
|
|
23
|
+
}, import("@hanzogui/web").StaticConfigPublic>;
|
|
24
|
+
declare const ContentFrame: import("@hanzogui/web").GuiComponent<import("@hanzogui/web").TamaDefer, import("@hanzogui/web").GuiElement, import("@hanzogui/core").RNGuiViewNonStyleProps, import("@hanzogui/web").StackStyleBase, {
|
|
25
|
+
elevation?: number | import("@hanzogui/web").SizeTokens | undefined;
|
|
26
|
+
fullscreen?: boolean | undefined;
|
|
27
|
+
}, import("@hanzogui/web").StaticConfigPublic>;
|
|
28
|
+
export type EmptyProps = ComponentProps<typeof EmptyFrame>;
|
|
29
|
+
export type EmptyHeaderProps = ComponentProps<typeof HeaderFrame>;
|
|
30
|
+
export type EmptyMediaProps = ComponentProps<typeof MediaFrame> & {
|
|
31
|
+
variant?: EmptyMediaVariant;
|
|
32
|
+
};
|
|
33
|
+
export type EmptyTitleProps = ComponentProps<typeof TitleFrame>;
|
|
34
|
+
export type EmptyDescriptionProps = ComponentProps<typeof DescriptionFrame>;
|
|
35
|
+
export type EmptyContentProps = ComponentProps<typeof ContentFrame>;
|
|
36
|
+
export declare const Empty: (p: EmptyProps) => import("react").JSX.Element;
|
|
37
|
+
export declare const EmptyHeader: (p: EmptyHeaderProps) => import("react").JSX.Element;
|
|
38
|
+
export declare const EmptyMedia: ({ variant, ...p }: EmptyMediaProps) => import("react").JSX.Element;
|
|
39
|
+
export declare const EmptyTitle: ({ children, ...p }: EmptyTitleProps) => import("react").JSX.Element;
|
|
40
|
+
export declare const EmptyDescription: ({ children, ...p }: EmptyDescriptionProps) => import("react").JSX.Element;
|
|
41
|
+
export declare const EmptyContent: ({ children, ...p }: EmptyContentProps) => import("react").JSX.Element;
|
|
42
|
+
export {};
|
|
43
|
+
//# sourceMappingURL=empty.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"empty.d.ts","sourceRoot":"","sources":["../../../src/backends/gui/empty.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAI3C,QAAA,MAAM,UAAU;;;8CAUd,CAAA;AAEF,QAAA,MAAM,WAAW;;;8CAKf,CAAA;AAEF,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,MAAM,CAAA;AAIlD,QAAA,MAAM,UAAU;;;;8CAgBd,CAAA;AAEF,QAAA,MAAM,UAAU;;;8CAA6E,CAAA;AAC7F,QAAA,MAAM,gBAAgB;;;8CAAiF,CAAA;AAEvG,QAAA,MAAM,YAAY;;;8CAOhB,CAAA;AAEF,MAAM,MAAM,UAAU,GAAG,cAAc,CAAC,OAAO,UAAU,CAAC,CAAA;AAC1D,MAAM,MAAM,gBAAgB,GAAG,cAAc,CAAC,OAAO,WAAW,CAAC,CAAA;AACjE,MAAM,MAAM,eAAe,GAAG,cAAc,CAAC,OAAO,UAAU,CAAC,GAAG;IAAE,OAAO,CAAC,EAAE,iBAAiB,CAAA;CAAE,CAAA;AACjG,MAAM,MAAM,eAAe,GAAG,cAAc,CAAC,OAAO,UAAU,CAAC,CAAA;AAC/D,MAAM,MAAM,qBAAqB,GAAG,cAAc,CAAC,OAAO,gBAAgB,CAAC,CAAA;AAC3E,MAAM,MAAM,iBAAiB,GAAG,cAAc,CAAC,OAAO,YAAY,CAAC,CAAA;AAEnE,eAAO,MAAM,KAAK,MAAO,UAAU,gCAA6C,CAAA;AAEhF,eAAO,MAAM,WAAW,MAAO,gBAAgB,gCAAqD,CAAA;AAEpG,eAAO,MAAM,UAAU,sBAAmC,eAAe,gCAExE,CAAA;AAED,eAAO,MAAM,UAAU,uBAAwB,eAAe,gCAE7D,CAAA;AAED,eAAO,MAAM,gBAAgB,uBAAwB,qBAAqB,gCAEzE,CAAA;AAED,eAAO,MAAM,YAAY,uBAAwB,iBAAiB,gCAEjE,CAAA"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
/**
|
|
4
|
+
* Empty — a placeholder for the absence of data: a header (media, title,
|
|
5
|
+
* description) above a content slot for a call to action.
|
|
6
|
+
*
|
|
7
|
+
* `EmptyMedia` carries the one variant that matters here — a bare icon versus
|
|
8
|
+
* one boxed into a rounded tile — through a styled context, the same split
|
|
9
|
+
* Badge uses for its frame/text pair.
|
|
10
|
+
*/
|
|
11
|
+
import { SizableText, YStack, createStyledContext, styled } from '@hanzo/gui';
|
|
12
|
+
import { ink } from './ink.js';
|
|
13
|
+
import { slot } from './slot.js';
|
|
14
|
+
const EmptyFrame = styled(YStack, {
|
|
15
|
+
name: 'Empty',
|
|
16
|
+
flex: 1,
|
|
17
|
+
minW: 0,
|
|
18
|
+
items: 'center',
|
|
19
|
+
justify: 'center',
|
|
20
|
+
gap: '$6',
|
|
21
|
+
p: '$6',
|
|
22
|
+
rounded: '$6',
|
|
23
|
+
borderStyle: 'dashed',
|
|
24
|
+
});
|
|
25
|
+
const HeaderFrame = styled(YStack, {
|
|
26
|
+
name: 'EmptyHeader',
|
|
27
|
+
maxW: 384,
|
|
28
|
+
items: 'center',
|
|
29
|
+
gap: '$2',
|
|
30
|
+
});
|
|
31
|
+
const MediaContext = /* @__PURE__ */ createStyledContext({ variant: 'default' });
|
|
32
|
+
const MediaFrame = styled(YStack, {
|
|
33
|
+
name: 'EmptyMedia',
|
|
34
|
+
context: MediaContext,
|
|
35
|
+
shrink: 0,
|
|
36
|
+
items: 'center',
|
|
37
|
+
justify: 'center',
|
|
38
|
+
mb: '$2',
|
|
39
|
+
variants: {
|
|
40
|
+
variant: {
|
|
41
|
+
default: { bg: 'transparent' },
|
|
42
|
+
icon: { bg: '$hover', width: 40, height: 40, rounded: '$3' },
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
defaultVariants: { variant: 'default' },
|
|
46
|
+
});
|
|
47
|
+
const TitleFrame = styled(SizableText, { name: 'EmptyTitle', size: '$4', fontWeight: '500' });
|
|
48
|
+
const DescriptionFrame = styled(SizableText, { name: 'EmptyDescription', size: '$2', color: '$quiet' });
|
|
49
|
+
const ContentFrame = styled(YStack, {
|
|
50
|
+
name: 'EmptyContent',
|
|
51
|
+
width: '100%',
|
|
52
|
+
minW: 0,
|
|
53
|
+
maxW: 384,
|
|
54
|
+
items: 'center',
|
|
55
|
+
gap: '$4',
|
|
56
|
+
});
|
|
57
|
+
export const Empty = (p) => _jsx(EmptyFrame, { ...slot('empty'), ...p });
|
|
58
|
+
export const EmptyHeader = (p) => _jsx(HeaderFrame, { ...slot('empty-header'), ...p });
|
|
59
|
+
export const EmptyMedia = ({ variant = 'default', ...p }) => (_jsx(MediaFrame, { ...slot('empty-icon'), "data-variant": variant, variant: variant, ...p }));
|
|
60
|
+
export const EmptyTitle = ({ children, ...p }) => (_jsx(TitleFrame, { ...slot('empty-title'), ...p, children: ink(children) }));
|
|
61
|
+
export const EmptyDescription = ({ children, ...p }) => (_jsx(DescriptionFrame, { ...slot('empty-description'), ...p, children: ink(children) }));
|
|
62
|
+
export const EmptyContent = ({ children, ...p }) => (_jsx(ContentFrame, { ...slot('empty-content'), ...p, children: ink(children) }));
|
|
63
|
+
//# sourceMappingURL=empty.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"empty.js","sourceRoot":"","sources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;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,EAAE,QAAQ,EAAE,GAAG,CAAC,EAAyB,EAAE,EAAE,CAAC,CAC7E,KAAC,gBAAgB,OAAK,IAAI,CAAC,mBAAmB,CAAC,KAAM,CAAC,YAAG,GAAG,CAAC,QAAQ,CAAC,GAAoB,CAC3F,CAAA;AAED,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,EAAE,QAAQ,EAAE,GAAG,CAAC,EAAqB,EAAE,EAAE,CAAC,CACrE,KAAC,YAAY,OAAK,IAAI,CAAC,eAAe,CAAC,KAAM,CAAC,YAAG,GAAG,CAAC,QAAQ,CAAC,GAAgB,CAC/E,CAAA"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
'use client';"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.Financials = void 0;
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
/**
|
|
7
|
+
* Financials — a TradingView financial-statements widget for one symbol, in a
|
|
8
|
+
* gui frame.
|
|
9
|
+
*
|
|
10
|
+
* The statements, ratios and estimates are TradingView's, drawn inside
|
|
11
|
+
* TradingView's own document, so the widget is an `<iframe>` and nothing here
|
|
12
|
+
* draws a row of it. What this owns is the frame around it and the settings it
|
|
13
|
+
* opens with — symbol, display mode, theme — written into the iframe's address
|
|
14
|
+
* the way TradingView's own embed script writes them:
|
|
15
|
+
* `/embed-widget/financials/?locale=…#<settings as JSON>`. Nothing is fetched
|
|
16
|
+
* or injected at mount, so the markup is the same on the server and in the
|
|
17
|
+
* browser, and the frame has its height before the widget arrives.
|
|
18
|
+
*
|
|
19
|
+
* The iframe is keyed on that address. A browser treats a `src` that differs
|
|
20
|
+
* only in its fragment as a same-document navigation and does not reload, so
|
|
21
|
+
* without the key a new `symbol` would change the URL and leave the old
|
|
22
|
+
* widget on screen.
|
|
23
|
+
*/
|
|
24
|
+
const gui_1 = require("@hanzo/gui");
|
|
25
|
+
const slot_1 = require("./slot.cjs");
|
|
26
|
+
const EMBED = 'https://www.tradingview-widget.com/embed-widget/financials/?locale=';
|
|
27
|
+
/** The settings TradingView reads, with the documented defaults filled in. */
|
|
28
|
+
const settings = ({ symbol = 'NASDAQ:AAPL', width = '100%', height = 800, colorTheme = 'dark', isTransparent = false, displayMode = 'adaptive', largeChartUrl = '', }) => ({
|
|
29
|
+
symbol,
|
|
30
|
+
width,
|
|
31
|
+
height,
|
|
32
|
+
colorTheme,
|
|
33
|
+
isTransparent,
|
|
34
|
+
displayMode,
|
|
35
|
+
largeChartUrl,
|
|
36
|
+
});
|
|
37
|
+
const Financials = ({ symbol, width, height, locale = 'en', colorTheme, isTransparent, displayMode, largeChartUrl, ...props }) => {
|
|
38
|
+
const s = settings({ symbol, width, height, colorTheme, isTransparent, displayMode, largeChartUrl });
|
|
39
|
+
const src = EMBED + encodeURIComponent(locale) + '#' + encodeURIComponent(JSON.stringify(s));
|
|
40
|
+
return ((0, jsx_runtime_1.jsx)(gui_1.YStack, { ...(0, slot_1.slot)('financials'), "data-symbol": s.symbol, "data-display-mode": s.displayMode,
|
|
41
|
+
// The documented size is TradingView's — a number or a percent string —
|
|
42
|
+
// and gui declares a narrower one; on web both reach CSS as written.
|
|
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: `${s.symbol} financials`, loading: "lazy", scrolling: "no", allowFullScreen: true, style: { display: 'block', width: '100%', height: '100%', border: 0 } }, src)) }));
|
|
44
|
+
};
|
|
45
|
+
exports.Financials = Financials;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Financials — a TradingView financial-statements widget for one symbol, in a
|
|
3
|
+
* gui frame.
|
|
4
|
+
*
|
|
5
|
+
* The statements, ratios and estimates are TradingView's, drawn inside
|
|
6
|
+
* TradingView's own document, so the widget is an `<iframe>` and nothing here
|
|
7
|
+
* draws a row of it. What this owns is the frame around it and the settings it
|
|
8
|
+
* opens with — symbol, display mode, theme — written into the iframe's address
|
|
9
|
+
* the way TradingView's own embed script writes them:
|
|
10
|
+
* `/embed-widget/financials/?locale=…#<settings as JSON>`. Nothing is fetched
|
|
11
|
+
* or injected at mount, so the markup is the same on the server and in the
|
|
12
|
+
* browser, and the frame has its height before the widget arrives.
|
|
13
|
+
*
|
|
14
|
+
* The iframe is keyed on that address. A browser treats a `src` that differs
|
|
15
|
+
* only in its fragment as a same-document navigation and does not reload, so
|
|
16
|
+
* without the key a new `symbol` would change the URL and leave the old
|
|
17
|
+
* widget on screen.
|
|
18
|
+
*/
|
|
19
|
+
import { type YStackProps } from '@hanzo/gui';
|
|
20
|
+
export type FinancialsDisplayMode = 'adaptive' | 'regular' | 'compact';
|
|
21
|
+
export type FinancialsTheme = 'light' | 'dark';
|
|
22
|
+
export interface FinancialsProps extends Omit<YStackProps, 'width' | 'height' | 'theme'> {
|
|
23
|
+
/** The symbol to report on, exchange-qualified. */
|
|
24
|
+
symbol?: string;
|
|
25
|
+
width?: string | number;
|
|
26
|
+
height?: string | number;
|
|
27
|
+
locale?: string;
|
|
28
|
+
/** The widget's own palette; independent of the surrounding gui theme. */
|
|
29
|
+
colorTheme?: FinancialsTheme;
|
|
30
|
+
isTransparent?: boolean;
|
|
31
|
+
displayMode?: FinancialsDisplayMode;
|
|
32
|
+
largeChartUrl?: string;
|
|
33
|
+
}
|
|
34
|
+
declare const Financials: ({ symbol, width, height, locale, colorTheme, isTransparent, displayMode, largeChartUrl, ...props }: FinancialsProps) => import("react").JSX.Element;
|
|
35
|
+
export { Financials };
|
|
36
|
+
//# sourceMappingURL=financials.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"financials.d.ts","sourceRoot":"","sources":["../../../src/backends/gui/financials.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAiB,KAAK,WAAW,EAAE,MAAM,YAAY,CAAA;AAG5D,MAAM,MAAM,qBAAqB,GAAG,UAAU,GAAG,SAAS,GAAG,SAAS,CAAA;AAEtE,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,MAAM,CAAA;AAE9C,MAAM,WAAW,eAAgB,SAAQ,IAAI,CAAC,WAAW,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;IACtF,mDAAmD;IACnD,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACvB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACxB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,0EAA0E;IAC1E,UAAU,CAAC,EAAE,eAAe,CAAA;IAC5B,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,WAAW,CAAC,EAAE,qBAAqB,CAAA;IACnC,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB;AAuBD,QAAA,MAAM,UAAU,uGAUb,eAAe,gCA8BjB,CAAA;AAED,OAAO,EAAE,UAAU,EAAE,CAAA"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
/**
|
|
4
|
+
* Financials — a TradingView financial-statements widget for one symbol, in a
|
|
5
|
+
* gui frame.
|
|
6
|
+
*
|
|
7
|
+
* The statements, ratios and estimates are TradingView's, drawn inside
|
|
8
|
+
* TradingView's own document, so the widget is an `<iframe>` and nothing here
|
|
9
|
+
* draws a row of it. What this owns is the frame around it and the settings it
|
|
10
|
+
* opens with — symbol, display mode, theme — written into the iframe's address
|
|
11
|
+
* the way TradingView's own embed script writes them:
|
|
12
|
+
* `/embed-widget/financials/?locale=…#<settings as JSON>`. Nothing is fetched
|
|
13
|
+
* or injected at mount, so the markup is the same on the server and in the
|
|
14
|
+
* browser, and the frame has its height before the widget arrives.
|
|
15
|
+
*
|
|
16
|
+
* The iframe is keyed on that address. A browser treats a `src` that differs
|
|
17
|
+
* only in its fragment as a same-document navigation and does not reload, so
|
|
18
|
+
* without the key a new `symbol` would change the URL and leave the old
|
|
19
|
+
* widget on screen.
|
|
20
|
+
*/
|
|
21
|
+
import { YStack, isWeb } from '@hanzo/gui';
|
|
22
|
+
import { slot } from './slot.js';
|
|
23
|
+
const EMBED = 'https://www.tradingview-widget.com/embed-widget/financials/?locale=';
|
|
24
|
+
/** The settings TradingView reads, with the documented defaults filled in. */
|
|
25
|
+
const settings = ({ symbol = 'NASDAQ:AAPL', width = '100%', height = 800, colorTheme = 'dark', isTransparent = false, displayMode = 'adaptive', largeChartUrl = '', }) => ({
|
|
26
|
+
symbol,
|
|
27
|
+
width,
|
|
28
|
+
height,
|
|
29
|
+
colorTheme,
|
|
30
|
+
isTransparent,
|
|
31
|
+
displayMode,
|
|
32
|
+
largeChartUrl,
|
|
33
|
+
});
|
|
34
|
+
const Financials = ({ symbol, width, height, locale = 'en', colorTheme, isTransparent, displayMode, largeChartUrl, ...props }) => {
|
|
35
|
+
const s = settings({ symbol, width, height, colorTheme, isTransparent, displayMode, largeChartUrl });
|
|
36
|
+
const src = EMBED + encodeURIComponent(locale) + '#' + encodeURIComponent(JSON.stringify(s));
|
|
37
|
+
return (_jsx(YStack, { ...slot('financials'), "data-symbol": s.symbol, "data-display-mode": s.displayMode,
|
|
38
|
+
// The documented size is TradingView's — a number or a percent string —
|
|
39
|
+
// and gui declares a narrower one; on web both reach CSS as written.
|
|
40
|
+
width: s.width, height: s.height, overflow: "hidden", position: "relative", bg: "$panel", ...props, children: isWeb && (_jsx("iframe", { src: src, title: `${s.symbol} financials`, loading: "lazy", scrolling: "no", allowFullScreen: true, style: { display: 'block', width: '100%', height: '100%', border: 0 } }, src)) }));
|
|
41
|
+
};
|
|
42
|
+
export { Financials };
|
|
43
|
+
//# sourceMappingURL=financials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"financials.js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E,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,CAAC,CAAC,MAAM,aAAa,EAC/B,OAAO,EAAC,MAAM,EACd,SAAS,EAAC,IAAI,EACd,eAAe,QACf,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,IANhE,GAAG,CAOR,CACH,GACM,CACV,CAAA;AACH,CAAC,CAAA;AAED,OAAO,EAAE,UAAU,EAAE,CAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use client';"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.ForexMarket = ForexMarket;
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
/**
|
|
7
|
+
* ForexMarket — the forex-flavored opening of the TradingView market-overview
|
|
8
|
+
* table that `./crypto-market` already renders.
|
|
9
|
+
*
|
|
10
|
+
* `market-overview.tsx`, `crypto-market.tsx`, `forex-market.tsx` and
|
|
11
|
+
* `stock-market.tsx` are four doc pages for ONE upstream widget, told apart
|
|
12
|
+
* only by which tab it opens on — crypto, forex, indices. Duplicating the
|
|
13
|
+
* iframe address, the preset table and the settings object under a second
|
|
14
|
+
* name would give the table two places to drift out of sync with itself, so
|
|
15
|
+
* this file holds none of that: it is `MarketOverview` with its `tabs` default
|
|
16
|
+
* turned from `['crypto']` to `['forex']`, nothing else.
|
|
17
|
+
*/
|
|
18
|
+
const crypto_market_1 = require("./crypto-market.cjs");
|
|
19
|
+
function ForexMarket({ tabs = ['forex'], ...props }) {
|
|
20
|
+
return (0, jsx_runtime_1.jsx)(crypto_market_1.MarketOverview, { tabs: tabs, ...props });
|
|
21
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ForexMarket — the forex-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 `['forex']`, nothing else.
|
|
12
|
+
*/
|
|
13
|
+
import { type MarketOverviewProps } from './crypto-market.js';
|
|
14
|
+
export type { MarketOverviewPreset as ForexMarketPreset, MarketOverviewSymbol as ForexMarketSymbol, MarketOverviewTab as ForexMarketTab, MarketOverviewTheme as ForexMarketTheme, } from './crypto-market.js';
|
|
15
|
+
export type ForexMarketProps = MarketOverviewProps;
|
|
16
|
+
export declare function ForexMarket({ tabs, ...props }: ForexMarketProps): import("react").JSX.Element;
|
|
17
|
+
//# sourceMappingURL=forex-market.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"forex-market.d.ts","sourceRoot":"","sources":["../../../src/backends/gui/forex-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,IAAgB,EAAE,GAAG,KAAK,EAAE,EAAE,gBAAgB,+BAE3E"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
/**
|
|
4
|
+
* ForexMarket — the forex-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 `['forex']`, nothing else.
|
|
14
|
+
*/
|
|
15
|
+
import { MarketOverview } from './crypto-market.js';
|
|
16
|
+
export function ForexMarket({ tabs = ['forex'], ...props }) {
|
|
17
|
+
return _jsx(MarketOverview, { tabs: tabs, ...props });
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=forex-market.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"forex-market.js","sourceRoot":"","sources":["../../../src/backends/gui/forex-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,OAAO,CAAC,EAAE,GAAG,KAAK,EAAoB;IAC1E,OAAO,KAAC,cAAc,IAAC,IAAI,EAAE,IAAI,KAAM,KAAK,GAAI,CAAA;AAClD,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
'use client';"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.ForexScreener = void 0;
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
/**
|
|
7
|
+
* ForexScreener — a TradingView currency-pair 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
|
+
/** `forex` is the one short name; every other market is its own screener_type. */
|
|
25
|
+
const screenerType = (market) => market === 'forex' ? 'forex_mkt' : market;
|
|
26
|
+
const EMBED = 'https://www.tradingview-widget.com/embed-widget/screener/?locale=';
|
|
27
|
+
/** The settings TradingView reads, with the documented defaults filled in. */
|
|
28
|
+
const settings = ({ market = 'forex', defaultColumn = 'overview', defaultScreen = 'general', showToolbar = true, colorTheme = 'dark', isTransparent = false, locale = 'en', width = '100%', height = 550, }) => ({
|
|
29
|
+
defaultColumn,
|
|
30
|
+
defaultScreen,
|
|
31
|
+
screener_type: screenerType(market),
|
|
32
|
+
showToolbar,
|
|
33
|
+
colorTheme,
|
|
34
|
+
isTransparent,
|
|
35
|
+
locale,
|
|
36
|
+
width,
|
|
37
|
+
height,
|
|
38
|
+
});
|
|
39
|
+
const ForexScreener = ({ market, defaultColumn, defaultScreen, showToolbar, colorTheme, isTransparent, locale, width, height, ...props }) => {
|
|
40
|
+
const s = settings({
|
|
41
|
+
market,
|
|
42
|
+
defaultColumn,
|
|
43
|
+
defaultScreen,
|
|
44
|
+
showToolbar,
|
|
45
|
+
colorTheme,
|
|
46
|
+
isTransparent,
|
|
47
|
+
locale,
|
|
48
|
+
width,
|
|
49
|
+
height,
|
|
50
|
+
});
|
|
51
|
+
const src = `${EMBED}${s.locale}#${encodeURIComponent(JSON.stringify(s))}`;
|
|
52
|
+
return ((0, jsx_runtime_1.jsx)(gui_1.YStack, { ...(0, slot_1.slot)('forex-screener'), "data-market": market ?? 'forex', "data-color-theme": s.colorTheme,
|
|
53
|
+
// The documented size is TradingView's — a number or a percent string —
|
|
54
|
+
// and gui declares a narrower one; on web both reach CSS as written.
|
|
55
|
+
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 ?? 'forex'} screener`, loading: "lazy", scrolling: "no", style: { display: 'block', width: '100%', height: '100%', border: 0 } }, src)) }));
|
|
56
|
+
};
|
|
57
|
+
exports.ForexScreener = ForexScreener;
|