@x-cmd/draw 0.5.6 → 0.5.7
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/render/calendar.js
CHANGED
|
@@ -2,10 +2,12 @@ import { dayIso, daysInMonth, firstWeekday, isoDay, isoParts, isoWeekday } from
|
|
|
2
2
|
import { TAB, card } from '../theme.js';
|
|
3
3
|
import { esc, r2, svgDoc, TAG_RESERVE, textW, titleBlock, topLegend, trunc } from './svg.js';
|
|
4
4
|
import { footerUnit, headerMeta, tipHeight, tipUnit } from './units.js';
|
|
5
|
+
import { BASELINE } from '../styles/baseline.js';
|
|
5
6
|
const PAD = 24;
|
|
6
7
|
const HEAD_FS = 12;
|
|
7
8
|
const NUM_FS = 13;
|
|
8
|
-
|
|
9
|
+
// 事件名/节日名:跟基准表走(13 —— 读者上了年纪,12 读不清)
|
|
10
|
+
const EV_FS = BASELINE.eventName;
|
|
9
11
|
/** 事件类别 → 色板序号 + 名字(中英) */
|
|
10
12
|
const KINDS = {
|
|
11
13
|
work: { c: 1, zh: '工作', en: 'Work' },
|
package/dist/render/svg.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { FONT, TAB } from '../theme.js';
|
|
3
3
|
import { ticks as d3Ticks, tickStep } from 'd3-array';
|
|
4
4
|
import { ApiError } from '../specs/base.js';
|
|
5
|
+
import { BASELINE } from '../styles/baseline.js';
|
|
5
6
|
import { INTER_WIDTHS } from '../styles/inter.js';
|
|
6
7
|
import { isSlot } from '../styles/types.js';
|
|
7
8
|
export function esc(s) {
|
|
@@ -123,7 +124,7 @@ export function topLegend(items, x, y, anchor = 'right', shape = 'circle') {
|
|
|
123
124
|
for (const it of items) {
|
|
124
125
|
const w = textW(it.name, 12);
|
|
125
126
|
parts.push(swatch(cx, it.color, it.index));
|
|
126
|
-
parts.push(`<text x="${r2(cx + gap)}" y="${r2(y)}" font-size="
|
|
127
|
+
parts.push(`<text x="${r2(cx + gap)}" y="${r2(y)}" font-size="${BASELINE.legend}" font-weight="500" fill="var(--d-text)"${lg(it.index)}>${esc(it.name)}</text>`);
|
|
127
128
|
parts.push(hit(cx - 10, gap + w + 16, it.index));
|
|
128
129
|
cx += gap + w + 26;
|
|
129
130
|
}
|
|
@@ -134,7 +135,7 @@ export function topLegend(items, x, y, anchor = 'right', shape = 'circle') {
|
|
|
134
135
|
const it = items[i];
|
|
135
136
|
const w = textW(it.name, 12);
|
|
136
137
|
const swatchX = cx - w - (shape === 'square' ? 18 : 10);
|
|
137
|
-
parts.push(`<text x="${r2(cx)}" y="${r2(y)}" text-anchor="end" font-size="
|
|
138
|
+
parts.push(`<text x="${r2(cx)}" y="${r2(y)}" text-anchor="end" font-size="${BASELINE.legend}" font-weight="500" fill="var(--d-text)"${lg(it.index)}>${esc(it.name)}</text>`);
|
|
138
139
|
parts.push(swatch(swatchX, it.color, it.index));
|
|
139
140
|
parts.push(hit(swatchX - 8, w + (shape === 'square' ? 18 : 10) + 14, it.index));
|
|
140
141
|
cx -= w + 28 + (shape === 'square' ? 8 : 0);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@x-cmd/draw",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.7",
|
|
4
4
|
"description": "SVG chart rendering as a service, a library, and a CLI — pie/bar/hbar/line/area/radar/gauge/scatter/combo/sankey/qr, same params everywhere",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|