@funnest/charts-ui 0.0.0-stage → 0.1.0
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/LICENSE +202 -0
- package/NOTICE +4 -0
- package/README.md +29 -2
- package/dist/components/chart-type-menu.d.ts +5 -0
- package/dist/components/drawing-toolbar.d.ts +10 -0
- package/dist/components/indicator-dialogs.d.ts +4 -0
- package/dist/components/interval-picker.d.ts +9 -0
- package/dist/components/overlay.d.ts +5 -0
- package/dist/components/settings-dialog.d.ts +8 -0
- package/dist/components/slot.d.ts +7 -0
- package/dist/components/symbol-avatar.d.ts +7 -0
- package/dist/components/symbol-search.d.ts +9 -0
- package/dist/components/toolbar.d.ts +5 -0
- package/dist/context.d.ts +74 -0
- package/dist/i18n.d.ts +197 -0
- package/dist/icons.d.ts +39 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +3005 -0
- package/dist/storage.d.ts +10 -0
- package/dist/store.d.ts +10 -0
- package/dist/styles.d.ts +1 -0
- package/dist/trading-chart.d.ts +83 -0
- package/package.json +51 -3
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Small persistence helper for UI preferences (favorite intervals, recent searches).
|
|
3
|
+
* Uses localStorage under `prefix:` when available; `prefix: null` keeps everything in memory
|
|
4
|
+
* (e.g. when the host app syncs preferences to its own account storage via callbacks).
|
|
5
|
+
*/
|
|
6
|
+
export interface WidgetStorage {
|
|
7
|
+
get<T>(key: string, fallback: T): T;
|
|
8
|
+
set(key: string, value: unknown): void;
|
|
9
|
+
}
|
|
10
|
+
export declare function createStorage(prefix: string | null): WidgetStorage;
|
package/dist/store.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Minimal observable state shared by the toolbar and overlay render roots. */
|
|
2
|
+
export declare class Store<T extends object> {
|
|
3
|
+
private state;
|
|
4
|
+
private readonly listeners;
|
|
5
|
+
constructor(state: T);
|
|
6
|
+
get(): T;
|
|
7
|
+
set(patch: Partial<T>): void;
|
|
8
|
+
subscribe(listener: () => void): () => void;
|
|
9
|
+
}
|
|
10
|
+
export declare function useStore<T extends object>(store: Store<T>): T;
|
package/dist/styles.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function injectStyles(doc?: Document): void;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/** @jsxImportSource preact */
|
|
2
|
+
import { type Chart, type ChartOptions, type ChartType, type Datafeed, type Locale, type ChartState, type Resolution, type ThemeTokens } from '@funnest/charts';
|
|
3
|
+
import type { IntervalGroup, SearchCategory } from './context';
|
|
4
|
+
/** Interval menu: 분 | 시간 | 일. '12M' is shown as 1년. */
|
|
5
|
+
export declare const DEFAULT_INTERVAL_GROUPS: readonly IntervalGroup[];
|
|
6
|
+
/** Toolbar chips until the user stars their own. */
|
|
7
|
+
export declare const DEFAULT_FAVORITE_INTERVALS: readonly Resolution[];
|
|
8
|
+
/** Symbol search tabs, derived from `SymbolInfo.type` / `country`. */
|
|
9
|
+
export declare const DEFAULT_SEARCH_CATEGORIES: readonly SearchCategory[];
|
|
10
|
+
export interface TradingChartOptions extends Omit<ChartOptions, 'datafeed'> {
|
|
11
|
+
datafeed: Datafeed;
|
|
12
|
+
symbol: string;
|
|
13
|
+
/** Default '1D'. */
|
|
14
|
+
resolution?: Resolution;
|
|
15
|
+
/** Interval menu groups (분 | 시간 | 일). */
|
|
16
|
+
intervalGroups?: readonly IntervalGroup[];
|
|
17
|
+
/** Initial toolbar chips; the user changes them with ★. Default: 1분 5분 15분 1시간 4시간 일. */
|
|
18
|
+
favoriteIntervals?: readonly Resolution[];
|
|
19
|
+
/** Called when the user stars/unstars an interval (e.g. to sync to their account). */
|
|
20
|
+
onFavoriteIntervalsChange?: (intervals: Resolution[]) => void;
|
|
21
|
+
/** Symbol search tabs. */
|
|
22
|
+
searchCategories?: readonly SearchCategory[];
|
|
23
|
+
/**
|
|
24
|
+
* localStorage key prefix for UI preferences (favorite intervals, recent searches).
|
|
25
|
+
* Default 'funnest-charts'. Pass null to keep them in memory only.
|
|
26
|
+
*/
|
|
27
|
+
storageKey?: string | null;
|
|
28
|
+
/** Ctrl/⌘ + K opens symbol search. Default true. */
|
|
29
|
+
searchHotkey?: boolean;
|
|
30
|
+
/** Show symbol logos (SymbolInfo.logoUrl, or an initial avatar). Default true. */
|
|
31
|
+
symbolLogo?: boolean;
|
|
32
|
+
/** Show the left drawing tool bar. Default true. */
|
|
33
|
+
drawingToolbar?: boolean;
|
|
34
|
+
/** Initial chart type. Default 'candles'. */
|
|
35
|
+
chartType?: ChartType;
|
|
36
|
+
/**
|
|
37
|
+
* Funnest logo badge in the bottom-left corner of the chart, linking to charts.funnest.xyz.
|
|
38
|
+
* Default true. Free to turn off (Apache-2.0); keeping it on is how you say thanks.
|
|
39
|
+
*/
|
|
40
|
+
attribution?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Base palette. 'system' (default) follows the OS light/dark setting and switches live.
|
|
43
|
+
* `theme` overrides are applied on top of whichever base is active.
|
|
44
|
+
*/
|
|
45
|
+
colorScheme?: ColorScheme;
|
|
46
|
+
}
|
|
47
|
+
export type ColorScheme = 'light' | 'dark' | 'system';
|
|
48
|
+
/**
|
|
49
|
+
* Empty elements inside the widget layout where the host app mounts its own UI (any framework):
|
|
50
|
+
* market stats, account info, status bars… They inherit the widget's `--fnc-*` theme variables
|
|
51
|
+
* and collapse when empty.
|
|
52
|
+
*/
|
|
53
|
+
export interface TradingChartSlots {
|
|
54
|
+
/** In the toolbar row, after the interval buttons. */
|
|
55
|
+
readonly toolbar: HTMLElement;
|
|
56
|
+
/** Right end of the toolbar, next to the settings (gear) button — for extra icon buttons. */
|
|
57
|
+
readonly toolbarEnd: HTMLElement;
|
|
58
|
+
/** A full-width row under the toolbar. */
|
|
59
|
+
readonly belowToolbar: HTMLElement;
|
|
60
|
+
/** A full-width row under the chart. */
|
|
61
|
+
readonly footer: HTMLElement;
|
|
62
|
+
}
|
|
63
|
+
export interface TradingChart {
|
|
64
|
+
/** The underlying engine, for anything the widget doesn't wrap. */
|
|
65
|
+
readonly chart: Chart;
|
|
66
|
+
readonly slots: TradingChartSlots;
|
|
67
|
+
setSymbol(symbol: string, resolution?: Resolution): Promise<void>;
|
|
68
|
+
setResolution(resolution: Resolution): Promise<void>;
|
|
69
|
+
setLocale(locale: Locale): void;
|
|
70
|
+
/** Override theme tokens (kept across light/dark switches). */
|
|
71
|
+
setTheme(theme: Partial<ThemeTokens>): void;
|
|
72
|
+
setColorScheme(scheme: ColorScheme): void;
|
|
73
|
+
/** Layout snapshot (symbol, interval, chart type, settings, indicators, drawings, view). */
|
|
74
|
+
save(): ChartState;
|
|
75
|
+
/** Restores a layout from `save()` / stored JSON. */
|
|
76
|
+
load(state: ChartState | unknown): Promise<void>;
|
|
77
|
+
destroy(): void;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Full trading chart widget: toolbar (symbol search, intervals, screenshot, fullscreen),
|
|
81
|
+
* legend, navigation controls and the canvas engine. Framework-agnostic: mount into any element.
|
|
82
|
+
*/
|
|
83
|
+
export declare function createTradingChart(container: HTMLElement, options: TradingChartOptions): TradingChart;
|
package/package.json
CHANGED
|
@@ -1,6 +1,54 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@funnest/charts-ui",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Pro trading UI (toolbar, drawing tools, sheets) for Funnest Charts. Framework-agnostic.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"chart",
|
|
7
|
+
"trading",
|
|
8
|
+
"widget",
|
|
9
|
+
"toolbar",
|
|
10
|
+
"drawing-tools",
|
|
11
|
+
"indicators",
|
|
12
|
+
"candlestick"
|
|
13
|
+
],
|
|
14
|
+
"license": "Apache-2.0",
|
|
15
|
+
"author": "Funnest",
|
|
16
|
+
"homepage": "https://charts.funnest.xyz",
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://github.com/funnest-xyz/funnest-charts.git",
|
|
20
|
+
"directory": "packages/ui"
|
|
21
|
+
},
|
|
22
|
+
"bugs": {
|
|
23
|
+
"url": "https://github.com/funnest-xyz/funnest-charts/issues"
|
|
24
|
+
},
|
|
25
|
+
"publishConfig": {
|
|
26
|
+
"access": "public"
|
|
27
|
+
},
|
|
28
|
+
"type": "module",
|
|
29
|
+
"main": "./dist/index.js",
|
|
30
|
+
"types": "./dist/index.d.ts",
|
|
31
|
+
"exports": {
|
|
32
|
+
".": {
|
|
33
|
+
"funnest-source": "./src/index.ts",
|
|
34
|
+
"types": "./dist/index.d.ts",
|
|
35
|
+
"import": "./dist/index.js"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"files": [
|
|
39
|
+
"dist",
|
|
40
|
+
"README.md",
|
|
41
|
+
"LICENSE",
|
|
42
|
+
"NOTICE"
|
|
43
|
+
],
|
|
44
|
+
"dependencies": {
|
|
45
|
+
"@funnest/charts": "0.1.0"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"preact": "^11.2.0"
|
|
49
|
+
},
|
|
50
|
+
"scripts": {
|
|
51
|
+
"build": "tsup && tsc -p tsconfig.build.json",
|
|
52
|
+
"typecheck": "tsc -p tsconfig.json"
|
|
53
|
+
}
|
|
6
54
|
}
|