@funnest/charts 0.6.15 → 0.6.17

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/index.d.ts CHANGED
@@ -5,10 +5,11 @@ export type { ChartContextMenu, ChartEvents, ChartLayout, ChartOptions, ChartPan
5
5
  export type { PriceScaleMode } from './model/price-scale';
6
6
  export type { CrosshairInfo, PaneId } from './render/renderer';
7
7
  export type { Locale } from './model/time-format';
8
+ export { browserLocale } from './model/time-format';
8
9
  export type { IndexRange, TimeScaleOptions } from './model/time-scale';
9
10
  export type { Bar, BarsRequest, BarsResult, Datafeed, Resolution, SymbolInfo, TickSize, Unsubscribe, SymbolType, SymbolSearchResult, Quote, ConnectionState, } from './types';
10
11
  export type { DirectionPreset, ThemeTokens } from './theme';
11
- export { createTheme, darkTheme, lightTheme } from './theme';
12
+ export { createTheme, darkTheme, directionColors, lightTheme } from './theme';
12
13
  export type { FormatPriceOptions } from './price';
13
14
  export { decimalsOf, formatCompact, formatPrice, krxTickSize, resolveTickSize, roundToTick } from './price';
14
15
  export { isIntradayResolution, resolutionToMs } from './resolution';
package/dist/index.js CHANGED
@@ -679,6 +679,11 @@ function niceTicks(min, max, maxCount, minStep = 0) {
679
679
  }
680
680
 
681
681
  // src/model/time-format.ts
682
+ function browserLocale() {
683
+ const nav = typeof navigator === "undefined" ? void 0 : navigator;
684
+ const first = nav?.languages?.[0] ?? nav?.language ?? "";
685
+ return /^ko\b/i.test(first) ? "ko" : "en";
686
+ }
682
687
  var WEEKDAY_INDEX = { Sun: 0, Mon: 1, Tue: 2, Wed: 3, Thu: 4, Fri: 5, Sat: 6 };
683
688
  var WEEKDAYS = {
684
689
  ko: ["\uC77C", "\uC6D4", "\uD654", "\uC218", "\uBAA9", "\uAE08", "\uD1A0"],
@@ -2724,6 +2729,7 @@ var darkTheme = {
2724
2729
  border: "#2C2C35",
2725
2730
  crosshair: "#7E7E87"
2726
2731
  };
2732
+ var directionColors = (preset) => ({ ...DIRECTION_COLORS[preset] });
2727
2733
  function createTheme(base, overrides = {}, direction) {
2728
2734
  return { ...base, ...direction ? DIRECTION_COLORS[direction] : {}, ...overrides };
2729
2735
  }
@@ -2863,7 +2869,7 @@ var Chart = class {
2863
2869
  paneWeightTotal = 1;
2864
2870
  constructor(container, options = {}) {
2865
2871
  this.theme = { ...lightTheme, ...options.theme };
2866
- this.locale = options.locale ?? "ko";
2872
+ this.locale = options.locale ?? browserLocale();
2867
2873
  this.formatter = new TimeFormatter(options.timezone ?? defaultTimeZone(), this.locale);
2868
2874
  this.pricePrecision = options.pricePrecision ?? 2;
2869
2875
  this.tickSize = options.tickSize ?? 0;
@@ -4726,12 +4732,14 @@ export {
4726
4732
  SERIES_COLORS,
4727
4733
  TickAggregator,
4728
4734
  bollinger,
4735
+ browserLocale,
4729
4736
  bucketStart,
4730
4737
  combineDatafeeds,
4731
4738
  createChart,
4732
4739
  createTheme,
4733
4740
  darkTheme,
4734
4741
  decimalsOf,
4742
+ directionColors,
4735
4743
  distToSegment,
4736
4744
  ema,
4737
4745
  fallbackResolution,
@@ -1,6 +1,11 @@
1
1
  import type { Bar } from '../types';
2
2
  import type { TimeScale } from './time-scale';
3
3
  export type Locale = 'ko' | 'en';
4
+ /**
5
+ * The locale when none is given: Korean for a browser set to Korean, English for everyone else
6
+ * (and outside a browser).
7
+ */
8
+ export declare function browserLocale(): Locale;
4
9
  export interface TimeParts {
5
10
  year: number;
6
11
  /** 1–12 */
package/dist/theme.d.ts CHANGED
@@ -21,4 +21,6 @@ export interface ThemeTokens {
21
21
  export type DirectionPreset = 'kr' | 'global';
22
22
  export declare const lightTheme: ThemeTokens;
23
23
  export declare const darkTheme: ThemeTokens;
24
+ /** Up/down candle colors: 'kr' red up · blue down (Korea), 'global' green up · red down. */
25
+ export declare const directionColors: (preset: DirectionPreset) => Pick<ThemeTokens, 'up' | 'down'>;
24
26
  export declare function createTheme(base: ThemeTokens, overrides?: Partial<ThemeTokens>, direction?: DirectionPreset): ThemeTokens;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@funnest/charts",
3
- "version": "0.6.15",
3
+ "version": "0.6.17",
4
4
  "description": "Canvas charting engine for financial charts",
5
5
  "keywords": [
6
6
  "chart",