ztd-charts-cli 0.11.2 → 0.12.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.
Files changed (49) hide show
  1. package/dist/api.d.ts +32 -32
  2. package/dist/api.js +1 -1
  3. package/dist/{chunk-6RWRYJ22.js → chunk-KNBUVTZ2.js} +55 -31
  4. package/dist/cli.js +7 -2
  5. package/dist/client/area.js +5 -5
  6. package/dist/client/bar.js +9 -9
  7. package/dist/client/barRace.js +5 -5
  8. package/dist/client/beeswarm.js +5 -5
  9. package/dist/client/box.js +9 -9
  10. package/dist/client/bubble.js +7 -7
  11. package/dist/client/bullet.js +4 -4
  12. package/dist/client/bump.js +6 -6
  13. package/dist/client/calendar.js +5 -5
  14. package/dist/client/candlestick.js +6 -6
  15. package/dist/client/chord.js +5 -5
  16. package/dist/client/choropleth.js +4 -4
  17. package/dist/client/donut.js +6 -6
  18. package/dist/client/dumbbell.js +5 -5
  19. package/dist/client/flowMap.js +5 -5
  20. package/dist/client/funnel.js +9 -9
  21. package/dist/client/gauge.js +3 -3
  22. package/dist/client/heatmap.js +5 -5
  23. package/dist/client/histogram.js +5 -5
  24. package/dist/client/line.js +5 -5
  25. package/dist/client/lollipop.js +1 -1
  26. package/dist/client/marimekko.js +6 -6
  27. package/dist/client/network.js +8 -8
  28. package/dist/client/parallel.js +6 -6
  29. package/dist/client/pareto.js +1 -1
  30. package/dist/client/pie.js +6 -6
  31. package/dist/client/radar.js +7 -7
  32. package/dist/client/radialBar.js +1 -1
  33. package/dist/client/ridgeline.js +4 -4
  34. package/dist/client/sankey.js +10 -10
  35. package/dist/client/scatter.js +10 -10
  36. package/dist/client/segmented.js +5 -5
  37. package/dist/client/skyline.js +9 -9
  38. package/dist/client/slope.js +6 -6
  39. package/dist/client/sparkline.js +6 -6
  40. package/dist/client/stream.js +6 -6
  41. package/dist/client/sunburst.js +4 -4
  42. package/dist/client/symbolMap.js +3 -3
  43. package/dist/client/tileMap.js +4 -4
  44. package/dist/client/timeline.js +8 -8
  45. package/dist/client/tree.js +2 -2
  46. package/dist/client/treemap.js +3 -3
  47. package/dist/client/waffle.js +5 -5
  48. package/dist/client/waterfall.js +4 -4
  49. package/package.json +2 -2
package/dist/api.d.ts CHANGED
@@ -21,8 +21,8 @@ interface ChartSummary {
21
21
  }
22
22
  declare function summarize(def: ChartDef): ChartSummary;
23
23
  /**
24
- * 차트 목록. group, level은 id("flow", "basic")나 영어, 한글 이름("흐름", "기본") 어느 것으로도 걸러요.
25
- * locale이 "ko"면 이름과 설명이 한글, 기본 영어
24
+ * Chart list. Filters group and level by id ("flow", "basic") or by English or Korean name ("흐름", "기본").
25
+ * With locale "ko", names and descriptions are in Korean; English by default
26
26
  */
27
27
  declare function listCharts(filter?: {
28
28
  group?: string;
@@ -30,9 +30,9 @@ declare function listCharts(filter?: {
30
30
  locale?: string;
31
31
  }): ChartSummary[];
32
32
  declare function resolveType(type: string): ChartDef | undefined;
33
- /** 전체 또는 차트 하나의 JSON Schema. locale "ko"면 설명이 한글 */
33
+ /** JSON Schema for all charts or for one chart. With locale "ko", descriptions are in Korean */
34
34
  declare function getChartSchema(type?: string, locale?: string): JSONSchema;
35
- /** 차트 하나의 설명, 스키마, 예시, React 코드. locale "ko"면 글과 예시가 한글 */
35
+ /** One chart's description, schema, example and React code. With locale "ko", the text and example are in Korean */
36
36
  declare function getChartInfo(type: string, locale?: string): {
37
37
  why: string;
38
38
  options: {
@@ -44,7 +44,7 @@ declare function getChartInfo(type: string, locale?: string): {
44
44
  schema: JSONSchema | null;
45
45
  example: ChartSpec;
46
46
  react: string;
47
- /** 이름 붙은 꼴: 예시 options 위에 덮어쓰는 옵션, 범위 띠처럼 필드를 더하는 꼴은 encoding도 (ztd-charts example <type> --variant <id>) */
47
+ /** Named variants: options laid over the example's options, plus encoding for variants that add fields, such as a range band (ztd-charts example <type> --variant <id>) */
48
48
  variants: ztd_charts_spec.ChartVariant[];
49
49
  type: string;
50
50
  component: string;
@@ -62,20 +62,20 @@ declare function getChartInfo(type: string, locale?: string): {
62
62
  description: string;
63
63
  }[];
64
64
  };
65
- /** 스펙 검사. locale "ko"면 메시지가 한글 */
65
+ /** Validates a spec. With locale "ko", messages are in Korean */
66
66
  declare function validate(spec: unknown, locale?: string): ValidationResult;
67
- /** 스펙을 React 코드로 (컴포넌트를 직접 쓰는 방식). locale "ko"면 주석이 한글 */
67
+ /** A spec as React code (using the component directly). With locale "ko", the comments are in Korean */
68
68
  declare function reactSnippet(spec: ChartSpec, opts?: {
69
69
  dataVar?: string;
70
70
  inlineData?: boolean;
71
71
  locale?: string;
72
72
  }): string;
73
- /** 스펙 그대로 쓰는 React 코드. ChartSpec 타입을 달아야 card.legend: "auto" 같은 값이 string으로 넓어지지 않아 TS에서 바로 컴파일돼요 */
73
+ /** React code that uses the spec as is. The ChartSpec annotation keeps values such as card.legend: "auto" from widening to string, so it compiles in TS as is */
74
74
  declare function specSnippet(spec: ChartSpec): string;
75
- /** 한글이 들어간 PNG를 위해 쓸 글꼴 파일 */
75
+ /** Font files to use for PNGs that contain Korean text */
76
76
  declare function findFonts(extra?: string[]): string[];
77
77
  interface FetchOptions {
78
- /** false면 데이터 주소가 내부망이나 이 컴퓨터(127.0.0.1, 10.x, 192.168.x, 169.254.169.254 같은 주소)를 가리킬 때 막아요. 기본 true, MCP 서버는 false로 써요 */
78
+ /** When false, blocks data URLs that point to a private network or this machine (addresses such as 127.0.0.1, 10.x, 192.168.x, 169.254.169.254). Default true; the MCP server uses false */
79
79
  allowPrivate?: boolean;
80
80
  }
81
81
  interface RenderOptions extends FetchOptions {
@@ -83,14 +83,14 @@ interface RenderOptions extends FetchOptions {
83
83
  width?: number;
84
84
  height?: number;
85
85
  theme?: "dark" | "light";
86
- /** PNG 배율. 기본 2 */
86
+ /** PNG scale. Default 2 */
87
87
  scale?: number;
88
- /** 카드 틀. 기본: spec.card가 있으면 true */
88
+ /** Card frame. Default: true when spec.card is set */
89
89
  frame?: boolean;
90
- /** HTML에 애니메이션과 인터랙션을 살리는 스크립트를 넣어요 */
90
+ /** Embeds a script in the HTML that brings back animation and interaction */
91
91
  interactive?: boolean;
92
92
  fonts?: string[];
93
- /** 차트 글자, 숫자 형식, 오류 문구의 로캘. "ko"면 한국어(1.2만). 없으면 스펙 options.locale, 그다음 "en-US"(1.2K) */
93
+ /** Locale for chart text, number format and error messages. "ko" gives Korean (1.2만). Without it, the spec's options.locale, then "en-US" (1.2K) */
94
94
  locale?: string;
95
95
  }
96
96
  interface RenderResult {
@@ -100,34 +100,34 @@ interface RenderResult {
100
100
  html?: string;
101
101
  width?: number;
102
102
  height?: number;
103
- /** 그리면서 바꾼 것 (PNG에서 뺀 이모지 등). 경고처럼 보여 줘요 */
103
+ /** What was changed while rendering (such as emoji removed from the PNG). Shown like warnings */
104
104
  notes?: string[];
105
105
  }
106
106
  /**
107
- * PNG로 바꾸기 전에 SVG 글자에서 이모지를 빼요. resvg는 컬러 이모지 글꼴을 못 그려서, 이모지가 든 글자 덩어리 전체가 네모로 나와요.
108
- * 이모지를 뺀 자리의 겹친 공백은 하나로 줄이고 앞뒤 공백은 지워요. 뺀 개수를 돌려줘요
107
+ * Removes emoji from SVG text before converting to PNG. resvg cannot draw color emoji fonts, so a whole text run containing an emoji comes out as boxes.
108
+ * Collapses the doubled spaces left where emoji were removed and trims leading and trailing spaces. Returns the number removed
109
109
  */
110
110
  declare function stripEmoji(svg: string): {
111
111
  svg: string;
112
112
  removed: number;
113
113
  };
114
- /** 데이터 주소를 가져올 때 기다리는 시간과 받는 크기의 한도 */
114
+ /** Time and size limits for fetching a data URL */
115
115
  declare const FETCH_TIMEOUT_MS = 15000;
116
116
  declare const MAX_FETCH_BYTES: number;
117
117
  /**
118
- * http(s) 주소를 시간(FETCH_TIMEOUT_MS)과 크기(MAX_FETCH_BYTES) 한도 안에서 가져와요.
119
- * allowPrivate가 false면 내부망과 이 컴퓨터를 가리키는 주소를 막아요(MCP 서버). 실패하면 주소가 들어간 오류를 던져요.
120
- * 돌려주는 Response는 다 받은 본문과 content-type만 가져요
118
+ * Fetches an http(s) URL within the time (FETCH_TIMEOUT_MS) and size (MAX_FETCH_BYTES) limits.
119
+ * When allowPrivate is false, blocks URLs that point to a private network or this machine (MCP server). On failure, throws an error that includes the URL.
120
+ * The returned Response holds only the fully received body and content-type
121
121
  */
122
122
  declare function fetchUrl(url: string, locale?: string, opts?: FetchOptions): Promise<Response>;
123
123
  /**
124
- * 스펙을 SVG, PNG, HTML로. 스펙을 먼저 검사하고(주소 데이터는 필드 검사 없이), { url } 데이터를 가져온 뒤 행으로 다시 검사해요.
125
- * 가져오기, 검사, 그리기가 같은 로캘(locale, 그다음 스펙 options.locale)을 써요
124
+ * Renders a spec to SVG, PNG or HTML. Validates the spec first (URL data without field checks), fetches { url } data, then validates again with the rows.
125
+ * Fetching, validation and rendering use the same locale (locale, then the spec's options.locale)
126
126
  */
127
127
  declare function render(input: ChartSpec, opts?: RenderOptions): Promise<RenderResult>;
128
128
  /**
129
- * SVG를 PNG로 (resvg). 이모지는 빼고, 뺀 수를 locale 언어로 notes에 알려요.
130
- * MCP는 SVG가 너무 커서 글자로 못 보낼 때 이미 그린 SVG를 이걸로 바꿔 보내요
129
+ * SVG to PNG (resvg). Removes emoji and reports how many in notes, in the locale's language.
130
+ * MCP uses this to convert an already rendered SVG when it is too large to send as text
131
131
  */
132
132
  declare function svgToPng(svg: string, opts?: {
133
133
  scale?: number;
@@ -138,20 +138,20 @@ declare function svgToPng(svg: string, opts?: {
138
138
  notes?: string[];
139
139
  }>;
140
140
  /**
141
- * PNG 한 장의 최대 픽셀 수. 10,000 × 5,000px 또는 2400 × 1000px 차트의 배율 4(약 3,800만)까지 그대로이고, 비트맵은 4바이트씩이라 약 200MB가 상한이에요
141
+ * Maximum pixel count of one PNG. Allows up to 10,000 × 5,000px, or a 2400 × 1000px chart at scale 4 (about 38 million); at 4 bytes per pixel the bitmap tops out at about 200MB
142
142
  */
143
143
  declare const PNG_MAX_PIXELS = 50000000;
144
144
  /**
145
- * PNG 배율. 실제로 그릴 SVG의 바깥 <svg> 크기 × 배율²이 PNG_MAX_PIXELS를 넘으면 넘지 않게 배율을 낮춰요(비트맵을 잡기 전에 정해요).
146
- * 크기는 줄이지 않은 그대로 재요(작은 여러 개, 긴 범례처럼 차트 한 변 한도보다 큰 문서도 있어요).
147
- * 바깥 <svg>에 픽셀 폭과 높이가 없거나 0 이하, 유한하지 않으면 null이라 그리지 않아요(한도를 증명할 수 없어서)
145
+ * PNG scale. When the outer <svg> size of the SVG to render × scale² exceeds PNG_MAX_PIXELS, lowers the scale to stay within it (decided before the bitmap is allocated).
146
+ * The size is measured unshrunk (some documents, such as small multiples or long legends, are larger than the per-side chart limit).
147
+ * null, so nothing is drawn, when the outer <svg> has no pixel width and height, or they are 0 or less, or not finite (the limit cannot be proven)
148
148
  */
149
149
  declare function pngZoom(svg: string, scale: number): number | null;
150
- /** http(s) 주소인지. loadRows, CLI suggest, MCP suggest_chart가 같은 규칙(대소문자 무시)을 써요 */
150
+ /** Whether it is an http(s) URL. loadRows, CLI suggest and MCP suggest_chart use the same rule (case-insensitive) */
151
151
  declare function isHttpUrl(source: string): boolean;
152
- /** 파일 경로나 URL, CSV/JSON 문자열을 행 배열로 */
152
+ /** A file path, URL, or CSV/JSON string to an array of rows */
153
153
  declare function loadRows(source: string, locale?: string, opts?: FetchOptions): Promise<Record<string, unknown>[]>;
154
- /** 데이터로 차트 추천. locale "ko"면 이유와 카드 글이 한글 */
154
+ /** Chart suggestions from data. With locale "ko", the reasons and card text are in Korean */
155
155
  declare function suggest(rows: Record<string, unknown>[], opts?: {
156
156
  limit?: number;
157
157
  locale?: string;
package/dist/api.js CHANGED
@@ -20,7 +20,7 @@ import {
20
20
  summarize,
21
21
  svgToPng,
22
22
  validate
23
- } from "./chunk-6RWRYJ22.js";
23
+ } from "./chunk-KNBUVTZ2.js";
24
24
  export {
25
25
  CHARTS,
26
26
  FETCH_TIMEOUT_MS,
@@ -9,32 +9,45 @@ import { langOf, mapExportName, renderSpecToHTML, renderSpecToSVG, resolveDef, r
9
9
 
10
10
  // src/messages.ts
11
11
  import { plural } from "ztd-charts/server";
12
- var VERSION = "0.11.2";
12
+ var VERSION = "0.12.0";
13
13
  var SCHEMA_URL = "https://unpkg.com/ztd-charts/schema/chart-spec.schema.json";
14
+ var enUsage = {
15
+ list: " ztd-charts list [--group proportion] [--level basic] [--json]",
16
+ info: " ztd-charts info <type> [--json] Chart description, options, example spec, React code",
17
+ schema: " ztd-charts schema [type] [--out file] JSON Schema (all charts or one)",
18
+ example: ` ztd-charts example <type> [--variant id] [--out file]
19
+ Example spec JSON (a named variant with --variant)`,
20
+ validate: " ztd-charts validate <spec.json> [--json]",
21
+ render: ` ztd-charts render <spec.json> --out chart.svg|chart.png|chart.html
22
+ [--width 720] [--height 240] [--theme dark|light] [--scale 2]
23
+ [--no-frame] [--interactive] [--font path.otf]`,
24
+ init: " ztd-charts init [dir] [--type pie] [--force]",
25
+ suggest: " ztd-charts suggest <data.csv|data.json|URL> [--limit 5] [--json] [--out-dir dir]",
26
+ snippet: " ztd-charts snippet <spec.json> React code for the spec"
27
+ };
28
+ var COMMANDS = Object.keys(enUsage);
29
+ var enEvery = `Every command
30
+ --locale <code> Language of messages and chart text, and number format: en (default) or ko`;
14
31
  var en = {
15
32
  help: `ztd-charts ${VERSION} CLI for 44 React chart types
16
33
 
17
34
  Usage
18
- ztd-charts list [--group proportion] [--level basic] [--json]
19
- ztd-charts info <type> [--json] Chart description, options, example spec, React code
20
- ztd-charts schema [type] [--out file] JSON Schema (all charts or one)
21
- ztd-charts example <type> [--variant id] [--out file]
22
- Example spec JSON (a named variant with --variant)
23
- ztd-charts validate <spec.json> [--json]
24
- ztd-charts render <spec.json> --out chart.svg|chart.png|chart.html
25
- [--width 720] [--height 240] [--theme dark|light] [--scale 2]
26
- [--no-frame] [--interactive] [--font path.otf]
27
- ztd-charts init [dir] [--type pie] [--force]
28
- ztd-charts suggest <data.csv|data.json|URL> [--limit 5] [--json] [--out-dir dir]
35
+ ${Object.values(enUsage).join("\n")}
29
36
 
30
- Every command
31
- --locale <code> Language of messages and chart text, and number format: en (default) or ko
37
+ ${enEvery}
32
38
 
33
39
  Examples
34
40
  ztd-charts init
35
41
  ztd-charts suggest charts/sales.csv --out-dir charts
36
42
  ztd-charts render charts/01-line.json --out line.png --theme light
37
43
  ztd-charts render charts/01-line.json --out line.svg --locale ko
44
+ `,
45
+ commandHelp: (cmd) => `Usage
46
+ ${enUsage[cmd]}
47
+
48
+ ${enEvery}
49
+
50
+ All commands: ztd-charts --help
38
51
  `,
39
52
  needSpec: "Missing the spec file path",
40
53
  noFile: (f) => `File not found: ${f}`,
@@ -48,7 +61,7 @@ Examples
48
61
  badOut: (file) => `Can't save ${file}: end the file name with .svg, .png or .html`,
49
62
  unknownFilter: (flag, v, choices) => `--${flag} takes one of: ${choices.join(", ")}. Got: ${v}`,
50
63
  error: (m) => `Error: ${m}`,
51
- /** list 표 머리와 칸 너비 */
64
+ /** list table headers and column widths */
52
65
  listHead: ["type", "name", "level", "group", "summary"],
53
66
  listWidths: [12, 22, 14, 14],
54
67
  listFoot: (n) => `
@@ -77,14 +90,14 @@ ${n} charts. Details: ztd-charts info <type>`,
77
90
  `,
78
91
  noFit: "No chart fits this data. Check the column names and formats",
79
92
  score: "score",
80
- /** 데이터 주소 가져오기 (render의 data.url, suggest의 URL) */
93
+ /** Fetching a data URL (render's data.url, suggest's URL) */
81
94
  fetchFailed: (url, m) => `Couldn't load data from ${url}: ${m}`,
82
95
  httpOnly: "only http:// and https:// addresses can be fetched",
83
96
  timeout: (s) => `no response within ${s} seconds`,
84
97
  tooLarge: (mb) => `the response is larger than ${mb} MB`,
85
98
  privateUrl: "the address points to a private or local network, which is blocked. To allow it, run the MCP server with ZTD_CHARTS_ALLOW_PRIVATE_URLS=1",
86
99
  tooManyRedirects: "too many redirects",
87
- /** ztd-charts init이 만드는 예시 파일 */
100
+ /** Example files that ztd-charts init creates */
88
101
  init: (type) => ({
89
102
  "charts/sales.csv": "month,channel,revenue\n2025-01,Search,120\n2025-01,Social,64\n2025-02,Search,128\n2025-02,Social,75\n2025-03,Search,131\n2025-03,Social,92\n2025-04,Search,140\n2025-04,Social,104\n",
90
103
  "charts/Dashboard.tsx": dashboard(type, {
@@ -103,29 +116,39 @@ ${n} charts. Details: ztd-charts info <type>`,
103
116
  `
104
117
  })
105
118
  };
119
+ var koUsage = {
120
+ list: " ztd-charts list [--group \uBE44\uC728] [--level \uAE30\uBCF8] [--json]",
121
+ info: " ztd-charts info <type> [--json] \uCC28\uD2B8 \uC124\uBA85, \uC635\uC158, \uC608\uC2DC \uC2A4\uD399, React \uCF54\uB4DC",
122
+ schema: " ztd-charts schema [type] [--out file] JSON Schema (\uC804\uCCB4 \uB610\uB294 \uCC28\uD2B8 \uD558\uB098)",
123
+ example: ` ztd-charts example <type> [--variant id] [--out file]
124
+ \uC608\uC2DC \uC2A4\uD399 JSON (--variant\uB85C \uC774\uB984 \uBD99\uC740 \uBCC0\uD615)`,
125
+ validate: enUsage.validate,
126
+ render: enUsage.render,
127
+ init: enUsage.init,
128
+ suggest: enUsage.suggest,
129
+ snippet: " ztd-charts snippet <spec.json> \uC2A4\uD399\uC744 \uADF8\uB9AC\uB294 React \uCF54\uB4DC"
130
+ };
131
+ var koEvery = `\uBAA8\uB4E0 \uBA85\uB839
132
+ --locale <code> \uC548\uB0B4 \uBB38\uAD6C, \uCC28\uD2B8 \uAE00\uC790, \uC22B\uC790 \uD615\uC2DD\uC758 \uC5B8\uC5B4: en(\uAE30\uBCF8) \uB610\uB294 ko`;
106
133
  var ko = {
107
134
  help: `ztd-charts ${VERSION} React \uCC28\uD2B8 44\uC885\uC744 \uC704\uD55C CLI
108
135
 
109
136
  \uC0AC\uC6A9\uBC95
110
- ztd-charts list [--group \uBE44\uC728] [--level \uAE30\uBCF8] [--json]
111
- ztd-charts info <type> [--json] \uCC28\uD2B8 \uC124\uBA85, \uC635\uC158, \uC608\uC2DC \uC2A4\uD399, React \uCF54\uB4DC
112
- ztd-charts schema [type] [--out file] JSON Schema (\uC804\uCCB4 \uB610\uB294 \uCC28\uD2B8 \uD558\uB098)
113
- ztd-charts example <type> [--variant id] [--out file]
114
- \uC608\uC2DC \uC2A4\uD399 JSON (--variant\uB85C \uC774\uB984 \uBD99\uC740 \uBCC0\uD615)
115
- ztd-charts validate <spec.json> [--json]
116
- ztd-charts render <spec.json> --out chart.svg|chart.png|chart.html
117
- [--width 720] [--height 240] [--theme dark|light] [--scale 2]
118
- [--no-frame] [--interactive] [--font path.otf]
119
- ztd-charts init [dir] [--type pie] [--force]
120
- ztd-charts suggest <data.csv|data.json|URL> [--limit 5] [--json] [--out-dir dir]
137
+ ${Object.values(koUsage).join("\n")}
121
138
 
122
- \uBAA8\uB4E0 \uBA85\uB839
123
- --locale <code> \uC548\uB0B4 \uBB38\uAD6C, \uCC28\uD2B8 \uAE00\uC790, \uC22B\uC790 \uD615\uC2DD\uC758 \uC5B8\uC5B4: en(\uAE30\uBCF8) \uB610\uB294 ko
139
+ ${koEvery}
124
140
 
125
141
  \uC608\uC2DC
126
142
  ztd-charts init --locale ko
127
143
  ztd-charts suggest charts/sales.csv --out-dir charts --locale ko
128
144
  ztd-charts render charts/01-line.json --out line.png --theme light --locale ko
145
+ `,
146
+ commandHelp: (cmd) => `\uC0AC\uC6A9\uBC95
147
+ ${koUsage[cmd]}
148
+
149
+ ${koEvery}
150
+
151
+ \uBAA8\uB4E0 \uBA85\uB839 \uBCF4\uAE30: ztd-charts --help
129
152
  `,
130
153
  needSpec: "\uC2A4\uD399 \uD30C\uC77C \uACBD\uB85C\uB97C \uB123\uC5B4 \uC8FC\uC138\uC694",
131
154
  noFile: (f) => `\uD30C\uC77C\uC774 \uC5C6\uC5B4\uC694: ${f}`,
@@ -264,7 +287,7 @@ function getChartInfo(type, locale) {
264
287
  schema: schemaForIn(def.type, lang),
265
288
  example: def.example,
266
289
  react: reactSnippet(def.example, { locale }),
267
- /** 이름 붙은 꼴: 예시 options 위에 덮어쓰는 옵션, 범위 띠처럼 필드를 더하는 꼴은 encoding도 (ztd-charts example <type> --variant <id>) */
290
+ /** Named variants: options laid over the example's options, plus encoding for variants that add fields, such as a range band (ztd-charts example <type> --variant <id>) */
268
291
  variants: variantsIn(def.type, lang)
269
292
  };
270
293
  }
@@ -514,6 +537,7 @@ function suggest(rows, opts = {}) {
514
537
  export {
515
538
  VERSION,
516
539
  SCHEMA_URL,
540
+ COMMANDS,
517
541
  CLI_TEXT,
518
542
  CHARTS,
519
543
  summarize,
package/dist/cli.js CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  CLI_TEXT,
4
+ COMMANDS,
4
5
  SCHEMA_URL,
5
6
  VERSION,
6
7
  getChartInfo,
@@ -13,7 +14,7 @@ import {
13
14
  resolveType,
14
15
  suggest,
15
16
  validate
16
- } from "./chunk-6RWRYJ22.js";
17
+ } from "./chunk-KNBUVTZ2.js";
17
18
 
18
19
  // src/cli.ts
19
20
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
@@ -81,6 +82,10 @@ async function main(argv0) {
81
82
  `);
82
83
  return;
83
84
  }
85
+ if (COMMANDS.includes(cmd) && rest.some((a) => a === "--help" || a === "-h")) {
86
+ process.stdout.write(t.commandHelp(cmd));
87
+ return;
88
+ }
84
89
  const { values: f, positionals: pos } = parseArgs({
85
90
  args: rest,
86
91
  allowPositionals: true,
@@ -189,7 +194,7 @@ ${info.react}`);
189
194
  const scale = numberFlag(f, "scale");
190
195
  const res = await render(spec, {
191
196
  format,
192
- // 한 변은 MAX_CHART_SIZE(10,000px)까지. 넘으면 줄여서 그려요
197
+ // Each side goes up to MAX_CHART_SIZE (10,000px). Larger sizes are reduced to it
193
198
  width: capChartSize(numberFlag(f, "width")),
194
199
  height: capChartSize(numberFlag(f, "height")),
195
200
  theme,