@cardenelabs/dragon 0.34.0 → 0.35.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 (127) hide show
  1. package/README.md +39 -720
  2. package/dist/cli.cjs +4529 -0
  3. package/dist/cli.cjs.map +1 -0
  4. package/dist/cli.js +4523 -0
  5. package/dist/cli.js.map +1 -0
  6. package/dist/export.cjs +3912 -0
  7. package/dist/export.cjs.map +1 -0
  8. package/dist/export.d.cts +36 -0
  9. package/dist/export.d.ts +36 -0
  10. package/dist/export.js +3907 -0
  11. package/dist/export.js.map +1 -0
  12. package/dist/fonts.cjs +7 -0
  13. package/dist/fonts.cjs.map +1 -0
  14. package/dist/fonts.js +4 -0
  15. package/dist/fonts.js.map +1 -0
  16. package/dist/index.cjs +4105 -20356
  17. package/dist/index.cjs.map +1 -1
  18. package/dist/index.d.cts +227 -5522
  19. package/dist/index.d.ts +227 -5522
  20. package/dist/index.js +4091 -20283
  21. package/dist/index.js.map +1 -1
  22. package/dist/player.global.js +2 -0
  23. package/dist/schema-BBWfniwH.d.cts +112 -0
  24. package/dist/schema-BBWfniwH.d.ts +112 -0
  25. package/package.json +39 -24
  26. package/src/cli.ts +237 -0
  27. package/src/export/capture.ts +277 -0
  28. package/src/export/fonts.ts +68 -0
  29. package/src/export/html.ts +32 -0
  30. package/src/export/index.ts +146 -0
  31. package/src/field-messages.ts +104 -0
  32. package/src/figure-text.ts +42 -0
  33. package/src/index.ts +30 -283
  34. package/src/layout/architecture.ts +381 -0
  35. package/src/layout/measure.ts +21 -0
  36. package/src/layout/scene.ts +353 -0
  37. package/src/layout/sequence.ts +189 -0
  38. package/src/load-fonts.ts +8 -0
  39. package/src/look/fonts.ts +33 -0
  40. package/src/look/palettes.json +209 -0
  41. package/src/look/values.ts +155 -0
  42. package/src/markdown.ts +35 -0
  43. package/src/messages.ts +122 -0
  44. package/src/parser.ts +342 -310
  45. package/src/player-global.ts +4 -0
  46. package/src/player.ts +271 -0
  47. package/src/printer.ts +76 -0
  48. package/src/render/icons.ts +41 -0
  49. package/src/render/motion.ts +106 -0
  50. package/src/render/parts.ts +279 -0
  51. package/src/render/svg.ts +341 -0
  52. package/src/schema.ts +161 -16
  53. package/src/schemas/diagram.schema.json +150 -0
  54. package/src/schemas/validate-diagram.d.ts +12 -0
  55. package/src/schemas/validate-diagram.js +8 -0
  56. package/src/timeline.ts +166 -0
  57. package/src/tokenize.ts +20 -281
  58. package/src/version.ts +55 -0
  59. package/src/view.ts +16 -0
  60. package/src/words.ts +79 -0
  61. package/examples/quick-start.md +0 -142
  62. package/src/canvas-bounds.ts +0 -52
  63. package/src/color.ts +0 -197
  64. package/src/compile/actor-ids.ts +0 -297
  65. package/src/compile/actor-option-notice.ts +0 -379
  66. package/src/compile/actors.ts +0 -103
  67. package/src/compile/c4.ts +0 -74
  68. package/src/compile/chain.ts +0 -93
  69. package/src/compile/chart-fields.ts +0 -193
  70. package/src/compile/deep-rewrite.ts +0 -30
  71. package/src/compile/derived-source.ts +0 -18
  72. package/src/compile/direction.ts +0 -102
  73. package/src/compile/edge-option-notice.ts +0 -112
  74. package/src/compile/er-relation.ts +0 -200
  75. package/src/compile/flow.ts +0 -54
  76. package/src/compile/flowchart.ts +0 -344
  77. package/src/compile/funnel.ts +0 -87
  78. package/src/compile/gantt.ts +0 -337
  79. package/src/compile/generic.ts +0 -696
  80. package/src/compile/hierarchy.ts +0 -92
  81. package/src/compile/journey.ts +0 -93
  82. package/src/compile/kinds.ts +0 -139
  83. package/src/compile/lanes.ts +0 -138
  84. package/src/compile/metro.ts +0 -271
  85. package/src/compile/mind.ts +0 -393
  86. package/src/compile/node-title.ts +0 -24
  87. package/src/compile/notice.ts +0 -141
  88. package/src/compile/order.ts +0 -57
  89. package/src/compile/parts-lookup.ts +0 -17
  90. package/src/compile/parts.ts +0 -2709
  91. package/src/compile/placement-apply.ts +0 -689
  92. package/src/compile/placement.ts +0 -15
  93. package/src/compile/quadrant.ts +0 -265
  94. package/src/compile/record.ts +0 -75
  95. package/src/compile/row-marks.ts +0 -128
  96. package/src/compile/rows.ts +0 -40
  97. package/src/compile/sequence.ts +0 -305
  98. package/src/compile/slug.ts +0 -37
  99. package/src/compile/stages.ts +0 -247
  100. package/src/compile/subtitle.ts +0 -35
  101. package/src/compile/swimlane-marks.ts +0 -87
  102. package/src/compile/swimlane.ts +0 -82
  103. package/src/compile/timeline.ts +0 -213
  104. package/src/compile/topology.ts +0 -44
  105. package/src/compile/tree.ts +0 -69
  106. package/src/compile/value-chart.ts +0 -337
  107. package/src/compile/values.ts +0 -432
  108. package/src/compile/word-state.ts +0 -82
  109. package/src/compile.ts +0 -3168
  110. package/src/focus.ts +0 -46
  111. package/src/input-size.ts +0 -181
  112. package/src/json-line-map.ts +0 -30
  113. package/src/json-parser.ts +0 -4306
  114. package/src/keywords.ts +0 -417
  115. package/src/near-name.ts +0 -42
  116. package/src/notation-lint.ts +0 -342
  117. package/src/relative-pos.ts +0 -251
  118. package/src/schemas/diagram.json +0 -3088
  119. package/src/types.ts +0 -1009
  120. package/src/v05/index.ts +0 -9
  121. package/src/v05/input-table.generated.ts +0 -138
  122. package/src/v05/parser-types.ts +0 -32
  123. package/src/v05/parser.ts +0 -6668
  124. package/src/v05/readout-table.generated.ts +0 -1088
  125. package/src/v05/removed-syntax.ts +0 -115
  126. package/src/value-syntax.ts +0 -313
  127. package/src/write-position.ts +0 -270
@@ -1,337 +0,0 @@
1
- import { diagram } from "@cardenelabs/cdl";
2
- import type { CdlDiagram } from "@cardenelabs/cdl";
3
- import type { DslDocument } from "../types";
4
- import type { DslShape } from "../keywords";
5
- import { parseChartValue, 数の欄から参照できる名前, 参照する名前, 図表の大きさを読む } from "./chart-fields";
6
-
7
- import { 箱の題 } from "./node-title";
8
- import type { CompileNotice } from "./notice";
9
- import { slugify } from "./slug";
10
- import { 図の小見出し } from "./subtitle";
11
- import { truncateForMessage } from "./subtitle";
12
-
13
- /** 記法で受ける円の見せ方と、描画側へ渡す値。 */
14
- export const CHART_PIE_FORM_WORDS: ReadonlyMap<string, "ring" | "arcs" | "table"> = new Map([
15
- ["ring", "ring"],
16
- ["輪", "ring"],
17
- ["arcs", "arcs"],
18
- ["積層の弧", "arcs"],
19
- ["table", "table"],
20
- ["銘板", "table"],
21
- ]);
22
- /*
23
- * 棒 / 折れ線の組立て。 円グラフと **入力の形が同じ**なので 1 つにまとめる。
24
- *
25
- * 3 種とも `- 名前: "45"` の 1 行 1 値で書く。 違うのは描画側の種別と、 値の意味だけ。
26
- *
27
- * | 型 | 種別 | 値の意味 |
28
- * |---|---|---|
29
- * | `pie` | `chart-pie` | 全体に対する取り分 |
30
- * | `bar` | `chart-bar` | 棒の高さ (単位は問わない) |
31
- * | `line` | `chart-line` | 線の高さ。 **書いた順に並ぶ** |
32
- *
33
- * 値を読めない項目は載せず、 まとめて警告に出す。 **黙って 0 にしない** = その項目だけ欠けた
34
- * 図が「正しい図」 として出てしまうため。
35
- *
36
- * 矢印は描けない。 書かれていたら警告に出して捨てる (「書いたのに効かない」 を残さない)。
37
- */
38
-
39
- /**
40
- * 形から描画側の種別を引く (#2657)。
41
- *
42
- * **綴りを繋げて作らない**。 8 つは `chart-<形>` で作れるが、積み上げだけ
43
- * `chart-stacked-bar` で規則から外れる。 繋げて作ると その 1 つが黙って別の種別になる
44
- * (描画側は知らない種別の大きさを引けず、図の組み立てが落ちる)。
45
- */
46
- const 描画側の種別: Readonly<Record<DslShape, CdlDiagram["nodes"][number]["kind"]>> = {
47
- pie: "chart-pie",
48
- bar: "chart-bar",
49
- line: "chart-line",
50
- gauge: "chart-gauge",
51
- radial: "chart-radial",
52
- stat: "chart-stat",
53
- waffle: "chart-waffle",
54
- stacked: "chart-stacked-bar",
55
- slope: "chart-slope",
56
- };
57
-
58
- /**
59
- * 型ごとの札の大きさ。
60
- *
61
- * **横も型で決める**。 縦が中身の大きさを決める型 (`stat` / `waffle` / `radial`) は、
62
- * 横をいくら広げても絵が大きくならない。 描画側の弧は
63
- * `外半径 = min(使える高さ / 2, 弧に使える幅 / 2)` で決まり、格子は行数で高さを使い切る。
64
- * 横を一律 640 にしていた間、余った分は左右の余白になるだけで、`stat` は札の 22%、
65
- * `waffle` は 57%、`radial` は 63% しか使っていなかった (見本帳の実描画を測った値)。
66
- *
67
- * **縦を使わない型を 368 にしない**。 `stacked` は帯 2 本と一覧だけで縦に伸びず、
68
- * 368 だと縦の 39% しか埋まらない。
69
- *
70
- * **横の使用率が既に足りている型は触らない**。 `gauge` は 79%、`bar` と `line` は 85%、
71
- * `slope` は 92% で、狭めても余白が減らず数だけが上がる。
72
- *
73
- * **どちらも 16 の倍数にする**。 描画側は大きさを 16 の倍数へ切り上げるため、
74
- * 外れた値を渡すと下端が格子から外れて全図で位置の警告が出る。
75
- * 棒と折れ線は 360 を切り上げた 368 になる。
76
- *
77
- * 数は見本帳の実描画から測った中身の幅に、その型が描画側で取る左右の余白を足した値。
78
- * **数だけを直しても合っているかは判らない**ので、実描画から使用率を測る検査
79
- * (`apps/playground-spa/tests/chart-card-fill.spec.ts`) が下限を見る。
80
- * 5 型を 640 に戻すと、その検査が 6 件の違反を出して落ちる (実測)。
81
- *
82
- * 組立て API (`cdl` の `chart()`) の既定は 640 のままなので、見本の円は `itemWidth` で
83
- * 揃える。 ずれたら `catalog-source-parity` が落ちる。
84
- */
85
- const 札の大きさ: Readonly<Record<Exclude<DslShape, "pie">, { w: number; h: number }>> = {
86
- // 数値 1 つと名前だけ。 中身は 139 幅 x 137 高
87
- stat: { w: 384, h: 240 },
88
- // 格子 (367 幅) と一覧
89
- waffle: { w: 464, h: 320 },
90
- // 弧 (401 幅) と一覧
91
- radial: { w: 512, h: 320 },
92
- // 半円 (508 幅) と一覧。 横の使用率が 79% で足りているため変えない
93
- gauge: { w: 640, h: 320 },
94
- // 5 本の帯を見本の太さ 32 に近い比で置く。304 高では描画側の算式で 31.4px になる
95
- stacked: { w: 640, h: 304 },
96
- // 横軸を持つ 3 型。 横の使用率が 85% 以上なので変えない
97
- bar: { w: 640, h: 368 },
98
- line: { w: 640, h: 368 },
99
- slope: { w: 640, h: 368 },
100
- };
101
-
102
- /** 描画側の円で使う寸法。`chart-pie.tsx` と同じ意味の値だけをここへ写す。 */
103
- const 円の寸法 = {
104
- 余白: 20,
105
- 弧の一覧の行: 56,
106
- 表の見出し: 40,
107
- 表の行: 52,
108
- } as const;
109
-
110
- const 格子へ切り上げる = (value: number): number => Math.ceil(value / 16) * 16;
111
-
112
- /**
113
- * 輪は、見せ方を書かない既存の円と同じ 480x320 を保つ。
114
- *
115
- * 積層の弧と銘板は、描画側が実際に確保する余白と一覧 1 行ぶんを区分数だけ積む。
116
- * 最後だけ格子に合わせて 16 の倍数へ上げる。
117
- */
118
- export function 円の札の大きさ(
119
- form: "ring" | "arcs" | "table",
120
- 区分数: number,
121
- ): { w: number; h: number } {
122
- if (form === "ring") return { w: 480, h: 320 };
123
-
124
- const 件数 = Math.max(1, 区分数);
125
- const 上下の余白 = 円の寸法.余白 * 2;
126
- const 高さ =
127
- form === "table"
128
- ? 上下の余白 + 円の寸法.表の見出し + 円の寸法.表の行 * 件数
129
- : 上下の余白 + 円の寸法.弧の一覧の行 * 件数;
130
- return { w: 480, h: 格子へ切り上げる(高さ) };
131
- }
132
-
133
- export function compileValueChart(
134
- doc: DslDocument,
135
- 型: DslShape,
136
- onNotice?: (notice: CompileNotice) => void,
137
- ): CdlDiagram {
138
- const kind = 描画側の種別[型];
139
- const b = diagram(slugify(doc.title), { topic: doc.title, type: "chart" });
140
-
141
- const data: NonNullable<CdlDiagram["nodes"][number]["chartData"]> = [];
142
- const 読めない: string[] = [];
143
- const 前が読めない: string[] = [];
144
- let 前が読めない行 = 0;
145
- const 未宣言: string[] = [];
146
- let 未宣言行 = 0;
147
- const 参照できる = 数の欄から参照できる名前(doc);
148
- // 最初に読めなかった行を覚える。 画面が案内できるようにする
149
- let 読めない行 = 0;
150
- for (const a of doc.actors) {
151
- // 値の置き場所は記法で 2 通りある。 略記 (`- TypeScript: "45%"`) は説明文に、
152
- // 縦書きの map (`- SliceA: { kind: card, value: "30%" }`) は値に入る。 両方を読む
153
- const value = parseChartValue(a.value ?? a.subtitle);
154
- // **負を受けるのは折れ線と傾き図だけ**。 どちらも増減を追う図なので、気温や損益のように
155
- // 0 を跨ぐ値が来る。 円は取り分、 棒は高さで、 どちらも負に意味が無い (review 指摘)。
156
- // 状態を読む欄 (`{名前}`) は書いた時点で符号が決まらないため、この検査を通す
157
- if (
158
- value === null ||
159
- (typeof value === "number" && value < 0 && 型 !== "line" && 型 !== "slope")
160
- ) {
161
- // `pos` を持たない経路がある (JSON 経路で組み立てた actor)。 無ければ 0 のまま
162
- if (読めない.length === 0) 読めない行 = a.pos?.line ?? 0;
163
- 読めない.push(a.name);
164
- continue;
165
- }
166
- // 数にならない参照は落とす。 通すと図は出るのに数が入っていない状態になる
167
- const 名前 = 参照する名前(value);
168
- if (名前 !== null && !参照できる.has(名前)) {
169
- if (未宣言.length === 0) 未宣言行 = a.pos?.line ?? 0;
170
- 未宣言.push(a.name);
171
- continue;
172
- }
173
- // 色はそのまま渡す。 箱が 1 つになっても、 書いた色が消えないようにする
174
- // 前の時点の値 (#1450)。 読めない形は黙って捨てず知らせる = 書いたのに 2 本目の帯が
175
- // 出ない状態になり、手掛かりが残らない
176
- const 前 = a.previous === undefined ? null : parseChartValue(a.previous);
177
- if (a.previous !== undefined && 前 === null) {
178
- if (前が読めない.length === 0) 前が読めない行 = a.pos?.line ?? 0;
179
- 前が読めない.push(a.name);
180
- }
181
- data.push({
182
- ...(型 === "slope" || 型 === "stacked" ? { id: slugify(a.name) } : {}),
183
- label: 箱の題(a),
184
- value,
185
- ...(前 === null ? {} : { previous: 前 }),
186
- ...(a.tone !== undefined ? { tone: a.tone } : {}),
187
- ...(a.emphasis !== undefined ? { emphasis: a.emphasis } : {}),
188
- });
189
- }
190
- // 案内の言葉は型ごとに変える。 共通化した時に `pie` の「割合 / 円 / 45%」 が「値 / 図 / 45」 に
191
- // 薄まり、 既存の案内が後退した (review 指摘)。 何を書けばよいかは型ごとに違う
192
- // 何を書けばよいかは型ごとに違う。 まとめると「割合 / 円 / 45%」 が「値 / 図 / 45」 に薄まる
193
- //
194
- // **表で持つ**。 三項の連鎖にすると、型が増えるたびに深さが増え、最後の枝が
195
- // 「それ以外」 になるため型検査が新しい型の漏れを教えてくれない
196
- const 語の表: Record<typeof 型, { 量: string; 図: string; 例: string }> = {
197
- pie: { 量: "割合", 図: "円", 例: '"45%"' },
198
- bar: { 量: "値", 図: "棒", 例: '"420"' },
199
- line: { 量: "値", 図: "折れ線", 例: '"180"' },
200
- gauge: { 量: "値", 図: "半円", 例: '"680"' },
201
- radial: { 量: "値", 図: "弧", 例: '"72"' },
202
- stat: { 量: "値", 図: "大きな数字", 例: '"1200"' },
203
- waffle: { 量: "割合", 図: "100 個の印", 例: '"45%"' },
204
- stacked: { 量: "内訳の値", 図: "帯", 例: '"320"' },
205
- slope: { 量: "値", 図: "傾き図", 例: '"320"' },
206
- };
207
- const 語 = 語の表[型];
208
-
209
- /**
210
- * 利用者に伝える。 **`console.warn` だけにしない**。 エディタは受け取った notice を画面に
211
- * 出す経路を持っており、 log だけだと項目が消えた理由が誰にも見えない (review 指摘)。
212
- */
213
- const 伝える = (種類: CompileNotice["kind"], 名前: string, message: string, line = 0) => {
214
- onNotice?.({ kind: 種類, actor: 名前, line, message });
215
- if (typeof console !== "undefined" && console.warn) console.warn(`[dragon] ${message}`);
216
- };
217
-
218
- const pieForm = doc.form === undefined ? undefined : CHART_PIE_FORM_WORDS.get(doc.form);
219
- if (型 === "pie" && doc.form !== undefined && pieForm === undefined) {
220
- 伝える(
221
- "chart-value-unreadable",
222
- doc.title,
223
- `type: pie で見せ方 (${truncateForMessage(doc.form)}) が読めません (既定の輪で描きます)。 ring / arcs / table または 輪 / 積層の弧 / 銘板 のどれかを書いてください`,
224
- doc.formPos?.line ?? 0,
225
- );
226
- }
227
-
228
- if (読めない.length > 0) {
229
- 伝える(
230
- "chart-value-unreadable",
231
- 読めない[0]!,
232
- `type: ${型} で${語.量}を読めない項目があります (${語.図}に載せません): ${読めない.join(", ")}。` +
233
- ` \`- 名前: ${語.例}\` の形で書いてください`,
234
- 読めない行,
235
- );
236
- }
237
- if (未宣言.length > 0) {
238
- 伝える(
239
- "chart-value-unreadable",
240
- 未宣言[0]!,
241
- `type: ${型} で数にならない値を参照した項目があります (${語.図}に載せません): ${未宣言.join(", ")}。` +
242
- ` \`states:\` にその名前を数で書いてください`,
243
- 未宣言行,
244
- );
245
- }
246
- if (前が読めない.length > 0) {
247
- 伝える(
248
- "chart-value-unreadable",
249
- 前が読めない[0]!,
250
- `type: ${型} で前の時点の値を読めない項目があります (前の値を使いません): ${前が読めない.join(", ")}。` +
251
- " `- 名前: { value: " +
252
- 語.例 +
253
- ", previous: " +
254
- 語.例 +
255
- " }` の形で書いてください",
256
- 前が読めない行,
257
- );
258
- }
259
- if (doc.flow.length > 0) {
260
- 伝える(
261
- "chart-edge-dropped",
262
- doc.flow[0]?.from ?? "",
263
- `type: ${型} では矢印を描けません (${doc.flow.length} 本を無視しました)。` +
264
- ` 関係を描くなら type: flow を使ってください`,
265
- doc.flow[0]?.pos?.line ?? 0,
266
- );
267
- }
268
-
269
- const { w: CHART_W, h: CHART_H } = 図表の大きさを読む(
270
- doc,
271
- 型 === "pie" ? 円の札の大きさ(pieForm ?? "ring", data.length) : 札の大きさ[型],
272
- );
273
- b.lane("chart", { width: CHART_W + 64 });
274
-
275
- b.node(`${slugify(doc.title) || 型}-chart`, {
276
- lane: "chart",
277
- stack: 0,
278
- kind,
279
- title: doc.title,
280
- ...図の小見出し(doc),
281
- w: CHART_W,
282
- h: CHART_H,
283
- chartData: data,
284
- ...(型 === "pie" && pieForm !== undefined ? { chartPieForm: pieForm } : {}),
285
- ...(doc.chartSeriesSkipMuted !== undefined
286
- ? { chartSeriesSkipMuted: doc.chartSeriesSkipMuted }
287
- : {}),
288
- ...(型 === "line" && doc.chartLineSeries !== undefined
289
- ? { chartLineSeries: doc.chartLineSeries }
290
- : {}),
291
- ...(型 === "pie" && doc.chartPieCenterLabel !== undefined
292
- ? { chartPieCenterLabel: doc.chartPieCenterLabel }
293
- : {}),
294
- ...(型 === "pie" && doc.chartPieTableColumns !== undefined
295
- ? { chartPieTableColumns: doc.chartPieTableColumns }
296
- : {}),
297
- ...(型 === "pie" && doc.chartPieRingWidth !== undefined
298
- ? { chartPieRingWidth: doc.chartPieRingWidth }
299
- : {}),
300
- ...(型 === "bar" && doc.chartBarSize !== undefined ? { chartBarSize: doc.chartBarSize } : {}),
301
- ...(型 === "bar" && doc.chartBarShape !== undefined ? { chartBarShape: doc.chartBarShape } : {}),
302
- ...(型 === "line" && doc.chartLineSize !== undefined ? { chartLineSize: doc.chartLineSize } : {}),
303
- ...(型 === "pie" && doc.chartPieSize !== undefined ? { chartPieSize: doc.chartPieSize } : {}),
304
- ...(型 === "waffle" && doc.chartWaffleSize !== undefined ? { chartWaffleSize: doc.chartWaffleSize } : {}),
305
- ...(型 === "slope" && doc.chartSlopeLabelTemplate !== undefined ? { chartSlopeLabelTemplate: doc.chartSlopeLabelTemplate } : {}),
306
- ...(型 === "slope" && doc.chartSlopeSize !== undefined ? { chartSlopeSize: doc.chartSlopeSize } : {}),
307
- ...(型 === "stacked" && doc.chartStackedLayout !== undefined ? { chartStackedLayout: doc.chartStackedLayout } : {}),
308
- ...(型 === "gauge" && doc.chartGaugeSize !== undefined ? { chartGaugeSize: doc.chartGaugeSize } : {}),
309
- ...((型 === "pie" || 型 === "waffle") && doc.terminalDecoration !== undefined ? { terminalDecoration: doc.terminalDecoration } : {}),
310
- ...(型 === "slope" && doc.chartSlopePeriods !== undefined
311
- ? { chartSlopePeriods: doc.chartSlopePeriods }
312
- : {}),
313
- ...(型 === "slope" && doc.chartSlopeEmphasisIds !== undefined
314
- ? { chartSlopeEmphasisIds: doc.chartSlopeEmphasisIds }
315
- : {}),
316
- ...(型 === "slope" && doc.chartSlopeUnit !== undefined
317
- ? { chartSlopeUnit: doc.chartSlopeUnit }
318
- : {}),
319
- ...(型 === "stacked" && doc.chartStackedPeriods !== undefined
320
- ? { chartStackedPeriods: doc.chartStackedPeriods }
321
- : {}),
322
- ...(型 === "stacked" && doc.chartStackedRateId !== undefined
323
- ? { chartStackedRateId: slugify(doc.chartStackedRateId) }
324
- : {}),
325
- ...(型 === "stacked" && doc.chartStackedLegendPosition !== undefined
326
- ? { chartStackedLegendPosition: doc.chartStackedLegendPosition }
327
- : {}),
328
- ...(型 === "gauge" && doc.chartGaugeValue !== undefined
329
- ? { chartGaugeValue: doc.chartGaugeValue }
330
- : {}),
331
- ...(型 === "waffle" && doc.chartWaffleLegendPosition !== undefined
332
- ? { chartWaffleLegendPosition: doc.chartWaffleLegendPosition }
333
- : {}),
334
- });
335
-
336
- return b.build();
337
- }