@santi020k/lumen-core 0.3.0 → 0.4.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/README.md +22 -0
- package/dist/charts.d.ts +101 -0
- package/dist/charts.d.ts.map +1 -0
- package/dist/charts.js +319 -0
- package/dist/components.d.ts +6 -2
- package/dist/components.d.ts.map +1 -1
- package/dist/components.js +11 -1
- package/dist/icons.d.ts +9 -1
- package/dist/icons.d.ts.map +1 -1
- package/dist/icons.js +41 -8
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/theme.js +1 -1
- package/dist/tokens.d.ts +19 -1
- package/dist/tokens.d.ts.map +1 -1
- package/dist/tokens.js +19 -1
- package/package.json +5 -1
package/README.md
CHANGED
|
@@ -7,6 +7,28 @@ Most consumers should install a framework package such as `@santi020k/lumen-astr
|
|
|
7
7
|
The package exports `lumenColors` and `lumenGlass` for consumers that need to mirror Lumen theme
|
|
8
8
|
tokens outside the shared stylesheet.
|
|
9
9
|
|
|
10
|
+
## Chart Helpers
|
|
11
|
+
|
|
12
|
+
`@santi020k/lumen-core/charts` exports the shared `LumenChartSeries` contract plus deterministic
|
|
13
|
+
domain, tick, scaling, line/area, grouped/stacked bar, and pie/donut geometry helpers. They render
|
|
14
|
+
no DOM and perform no statistical analysis; framework packages use them to keep chart output
|
|
15
|
+
aligned.
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import {
|
|
19
|
+
createLumenLineGeometry,
|
|
20
|
+
type LumenChartSeries
|
|
21
|
+
} from '@santi020k/lumen-core/charts'
|
|
22
|
+
|
|
23
|
+
const series: LumenChartSeries = {
|
|
24
|
+
id: 'views',
|
|
25
|
+
label: 'Views',
|
|
26
|
+
data: [{ x: 'Mon', y: 42 }, { x: 'Tue', y: 68 }]
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
createLumenLineGeometry(series.data)
|
|
30
|
+
```
|
|
31
|
+
|
|
10
32
|
It also exports the Lucide-backed icon map (`lumenIcons`, `lumenIconNames`) and helpers such as
|
|
11
33
|
`renderLumenIconSvg` so framework adapters can render icons by name.
|
|
12
34
|
|
package/dist/charts.d.ts
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
export declare const lumenChartTones: readonly ["series-1", "series-2", "series-3", "series-4", "series-5", "series-6", "series-7", "series-8", "brand", "accent", "success", "warning", "danger", "neutral"];
|
|
2
|
+
export type LumenChartTone = typeof lumenChartTones[number];
|
|
3
|
+
export interface LumenChartDatum {
|
|
4
|
+
label?: string;
|
|
5
|
+
tone?: LumenChartTone;
|
|
6
|
+
x: number | string;
|
|
7
|
+
y: number | null;
|
|
8
|
+
}
|
|
9
|
+
export interface LumenChartSeries {
|
|
10
|
+
data: readonly LumenChartDatum[];
|
|
11
|
+
id: string;
|
|
12
|
+
label: string;
|
|
13
|
+
tone?: LumenChartTone;
|
|
14
|
+
}
|
|
15
|
+
export interface LumenChartDomain {
|
|
16
|
+
max: number;
|
|
17
|
+
min: number;
|
|
18
|
+
}
|
|
19
|
+
export interface LumenChartGeometryPoint extends LumenChartDatum {
|
|
20
|
+
xCoordinate: number;
|
|
21
|
+
yCoordinate: number;
|
|
22
|
+
}
|
|
23
|
+
export interface LumenLineGeometry {
|
|
24
|
+
areaPaths: readonly string[];
|
|
25
|
+
domain: LumenChartDomain;
|
|
26
|
+
path: string;
|
|
27
|
+
points: readonly LumenChartGeometryPoint[];
|
|
28
|
+
}
|
|
29
|
+
export interface LumenLineGeometryOptions {
|
|
30
|
+
domain?: Partial<LumenChartDomain>;
|
|
31
|
+
height?: number;
|
|
32
|
+
includeZero?: boolean;
|
|
33
|
+
padding?: number;
|
|
34
|
+
width?: number;
|
|
35
|
+
}
|
|
36
|
+
export type LumenBarChartLayout = 'grouped' | 'stacked';
|
|
37
|
+
export type LumenChartOrientation = 'horizontal' | 'vertical';
|
|
38
|
+
export interface LumenBarGeometryMark {
|
|
39
|
+
category: number | string;
|
|
40
|
+
height: number;
|
|
41
|
+
seriesId: string;
|
|
42
|
+
seriesLabel: string;
|
|
43
|
+
tone: LumenChartTone;
|
|
44
|
+
value: number;
|
|
45
|
+
width: number;
|
|
46
|
+
x: number;
|
|
47
|
+
y: number;
|
|
48
|
+
}
|
|
49
|
+
export interface LumenBarGeometryCategory {
|
|
50
|
+
label: number | string;
|
|
51
|
+
x: number;
|
|
52
|
+
y: number;
|
|
53
|
+
}
|
|
54
|
+
export interface LumenBarGeometry {
|
|
55
|
+
categories: readonly LumenBarGeometryCategory[];
|
|
56
|
+
domain: LumenChartDomain;
|
|
57
|
+
height: number;
|
|
58
|
+
marks: readonly LumenBarGeometryMark[];
|
|
59
|
+
width: number;
|
|
60
|
+
}
|
|
61
|
+
export interface LumenBarGeometryOptions {
|
|
62
|
+
height?: number;
|
|
63
|
+
layout?: LumenBarChartLayout;
|
|
64
|
+
orientation?: LumenChartOrientation;
|
|
65
|
+
width?: number;
|
|
66
|
+
}
|
|
67
|
+
export type LumenPieChartVariant = 'donut' | 'pie';
|
|
68
|
+
export interface LumenPieGeometrySlice {
|
|
69
|
+
label: string;
|
|
70
|
+
path: string;
|
|
71
|
+
percentage: number;
|
|
72
|
+
tone: LumenChartTone;
|
|
73
|
+
value: number;
|
|
74
|
+
x: number | string;
|
|
75
|
+
}
|
|
76
|
+
export interface LumenPieGeometry {
|
|
77
|
+
center: number;
|
|
78
|
+
innerRadius: number;
|
|
79
|
+
outerRadius: number;
|
|
80
|
+
size: number;
|
|
81
|
+
slices: readonly LumenPieGeometrySlice[];
|
|
82
|
+
total: number;
|
|
83
|
+
}
|
|
84
|
+
export interface LumenPieGeometryOptions {
|
|
85
|
+
padding?: number;
|
|
86
|
+
size?: number;
|
|
87
|
+
variant?: LumenPieChartVariant;
|
|
88
|
+
}
|
|
89
|
+
export declare const hasLumenChartData: (series: readonly LumenChartSeries[]) => boolean;
|
|
90
|
+
export declare const hasLumenPieData: (data: readonly LumenChartDatum[]) => boolean;
|
|
91
|
+
export declare const getLumenChartDomain: (values: readonly (number | null)[], includeZero?: boolean) => LumenChartDomain;
|
|
92
|
+
export declare const scaleLumenChartValue: (value: number, domain: LumenChartDomain, rangeStart: number, rangeEnd: number) => number;
|
|
93
|
+
export declare const getLumenChartTicks: (domain: LumenChartDomain, count?: number) => number[];
|
|
94
|
+
export declare const resolveLumenChartTone: (tone: LumenChartTone | undefined, index?: number) => LumenChartTone;
|
|
95
|
+
export declare const createLumenPieGeometry: (data: readonly LumenChartDatum[], options?: LumenPieGeometryOptions) => LumenPieGeometry;
|
|
96
|
+
export declare const createLumenLineGeometry: (data: readonly LumenChartDatum[], options?: LumenLineGeometryOptions) => LumenLineGeometry;
|
|
97
|
+
export declare const getLumenChartValueRatio: (value: number, domain: LumenChartDomain) => number;
|
|
98
|
+
export declare const getLumenChartCategories: (series: readonly LumenChartSeries[]) => (number | string)[];
|
|
99
|
+
export declare const alignLumenChartSeries: (series: LumenChartSeries, categories: readonly (number | string)[]) => LumenChartSeries;
|
|
100
|
+
export declare const createLumenBarGeometry: (series: readonly LumenChartSeries[], options?: LumenBarGeometryOptions) => LumenBarGeometry;
|
|
101
|
+
//# sourceMappingURL=charts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"charts.d.ts","sourceRoot":"","sources":["../src/charts.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,yKAelB,CAAA;AAEV,MAAM,MAAM,cAAc,GAAG,OAAO,eAAe,CAAC,MAAM,CAAC,CAAA;AAE3D,MAAM,WAAW,eAAe;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,cAAc,CAAA;IACrB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAClB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CACjB;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,SAAS,eAAe,EAAE,CAAA;IAChC,EAAE,EAAE,MAAM,CA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AQ,SAAS,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,EAClC,qBAAkB,KACjB,gBAuBF,CAAA;AAED,eAAO,MAAM,oBAAoB,GAC/B,OAAO,MAAM,EACb,QAAQ,gBAAgB,EACxB,YAAY,MAAM,EAClB,UAAU,MAAM,KACf,MAQF,CAAA;AAED,eAAO,MAAM,kBAAkB,GAC7B,QAAQ,gBAAgB,EACxB,cAAS,KACR,MAAM,EAKR,CAAA;AAED,eAAO,MAAM,qBAAqB,GAChC,MAAM,cAAc,GAAG,SAAS,EAChC,cAAS,KACR,cAAkE,CAAA;AA+FrE,eAAO,MAAM,sBAAsB,GACjC,MAAM,SAAS,eAAe,EAAE,EAChC,UAAS,uBAA4B,KACpC,gBAgDF,CAAA;AAkDD,eAAO,MAAM,uBAAuB,GAClC,MAAM,SAAS,eAAe,EAAE,EAChC,UAAS,wBAA6B,KACrC,iBAqCF,CAAA;AAED,eAAO,MAAM,uBAAuB,GAClC,OAAO,MAAM,EACb,QAAQ,gBAAgB,KACvB,MAIF,CAAA;AAED,eAAO,MAAM,uBAAuB,GAClC,QAAQ,SAAS,gBAAgB,EAAE,KAClC,CAAC,MAAM,GAAG,MAAM,CAAC,EAYnB,CAAA;AAED,eAAO,MAAM,qBAAqB,GAChC,QAAQ,gBAAgB,EACxB,YAAY,SAAS,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,KACvC,gBAKD,CAAA;AAyCF,eAAO,MAAM,sBAAsB,GACjC,QAAQ,SAAS,gBAAgB,EAAE,EACnC,UAAS,uBAA4B,KACpC,gBAiHF,CAAA"}
|
package/dist/charts.js
ADDED
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
export const lumenChartTones = [
|
|
2
|
+
'series-1',
|
|
3
|
+
'series-2',
|
|
4
|
+
'series-3',
|
|
5
|
+
'series-4',
|
|
6
|
+
'series-5',
|
|
7
|
+
'series-6',
|
|
8
|
+
'series-7',
|
|
9
|
+
'series-8',
|
|
10
|
+
'brand',
|
|
11
|
+
'accent',
|
|
12
|
+
'success',
|
|
13
|
+
'warning',
|
|
14
|
+
'danger',
|
|
15
|
+
'neutral'
|
|
16
|
+
];
|
|
17
|
+
const defaultChartSize = 100;
|
|
18
|
+
const defaultChartPadding = 4;
|
|
19
|
+
const finiteValues = (values) => values.filter((value) => value !== null && Number.isFinite(value));
|
|
20
|
+
export const hasLumenChartData = (series) => series.some(item => item.data.some(datum => datum.y !== null && Number.isFinite(datum.y)));
|
|
21
|
+
export const hasLumenPieData = (data) => data.some(datum => datum.y !== null && Number.isFinite(datum.y) && datum.y > 0);
|
|
22
|
+
export const getLumenChartDomain = (values, includeZero = true) => {
|
|
23
|
+
const available = finiteValues(values);
|
|
24
|
+
if (available.length === 0)
|
|
25
|
+
return { max: 1, min: 0 };
|
|
26
|
+
let min = Math.min(...available);
|
|
27
|
+
let max = Math.max(...available);
|
|
28
|
+
if (includeZero) {
|
|
29
|
+
min = Math.min(0, min);
|
|
30
|
+
max = Math.max(0, max);
|
|
31
|
+
}
|
|
32
|
+
if (min === max) {
|
|
33
|
+
const offset = Math.abs(min || 1) * 0.1;
|
|
34
|
+
min -= offset;
|
|
35
|
+
max += offset;
|
|
36
|
+
}
|
|
37
|
+
return { max, min };
|
|
38
|
+
};
|
|
39
|
+
export const scaleLumenChartValue = (value, domain, rangeStart, rangeEnd) => {
|
|
40
|
+
const domainSize = domain.max - domain.min;
|
|
41
|
+
if (!Number.isFinite(value) || domainSize === 0)
|
|
42
|
+
return rangeStart;
|
|
43
|
+
const ratio = (value - domain.min) / domainSize;
|
|
44
|
+
return rangeStart + ratio * (rangeEnd - rangeStart);
|
|
45
|
+
};
|
|
46
|
+
export const getLumenChartTicks = (domain, count = 5) => {
|
|
47
|
+
const safeCount = Math.max(2, Math.round(count));
|
|
48
|
+
const step = (domain.max - domain.min) / (safeCount - 1);
|
|
49
|
+
return Array.from({ length: safeCount }, (_, index) => domain.min + step * index);
|
|
50
|
+
};
|
|
51
|
+
export const resolveLumenChartTone = (tone, index = 0) => tone ?? lumenChartTones[index % 8] ?? 'series-1';
|
|
52
|
+
const polarPoint = (center, radius, angle) => {
|
|
53
|
+
const radians = angle * Math.PI / 180;
|
|
54
|
+
return {
|
|
55
|
+
x: center + Math.cos(radians) * radius,
|
|
56
|
+
y: center + Math.sin(radians) * radius
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
const formatPieCoordinate = (value) => value.toFixed(3);
|
|
60
|
+
const pieArc = (radius, largeArc, sweep, point) => `A ${formatPieCoordinate(radius)} ${formatPieCoordinate(radius)} 0 ${largeArc ? 1 : 0} ${sweep} ${formatPieCoordinate(point.x)} ${formatPieCoordinate(point.y)}`;
|
|
61
|
+
const fullPiePath = (center, outerRadius, innerRadius) => {
|
|
62
|
+
const topOuter = polarPoint(center, outerRadius, -90);
|
|
63
|
+
const bottomOuter = polarPoint(center, outerRadius, 90);
|
|
64
|
+
const outer = [
|
|
65
|
+
`M ${formatPieCoordinate(topOuter.x)} ${formatPieCoordinate(topOuter.y)}`,
|
|
66
|
+
pieArc(outerRadius, true, 1, bottomOuter),
|
|
67
|
+
pieArc(outerRadius, true, 1, topOuter),
|
|
68
|
+
'Z'
|
|
69
|
+
];
|
|
70
|
+
if (innerRadius === 0)
|
|
71
|
+
return outer.join(' ');
|
|
72
|
+
const topInner = polarPoint(center, innerRadius, -90);
|
|
73
|
+
const bottomInner = polarPoint(center, innerRadius, 90);
|
|
74
|
+
return [
|
|
75
|
+
...outer,
|
|
76
|
+
`M ${formatPieCoordinate(topInner.x)} ${formatPieCoordinate(topInner.y)}`,
|
|
77
|
+
pieArc(innerRadius, true, 0, bottomInner),
|
|
78
|
+
pieArc(innerRadius, true, 0, topInner),
|
|
79
|
+
'Z'
|
|
80
|
+
].join(' ');
|
|
81
|
+
};
|
|
82
|
+
const pieSlicePath = (center, outerRadius, innerRadius, startAngle, endAngle) => {
|
|
83
|
+
if (endAngle - startAngle >= 359.999) {
|
|
84
|
+
return fullPiePath(center, outerRadius, innerRadius);
|
|
85
|
+
}
|
|
86
|
+
const outerStart = polarPoint(center, outerRadius, startAngle);
|
|
87
|
+
const outerEnd = polarPoint(center, outerRadius, endAngle);
|
|
88
|
+
const largeArc = endAngle - startAngle > 180;
|
|
89
|
+
if (innerRadius === 0) {
|
|
90
|
+
return [
|
|
91
|
+
`M ${formatPieCoordinate(center)} ${formatPieCoordinate(center)}`,
|
|
92
|
+
`L ${formatPieCoordinate(outerStart.x)} ${formatPieCoordinate(outerStart.y)}`,
|
|
93
|
+
pieArc(outerRadius, largeArc, 1, outerEnd),
|
|
94
|
+
'Z'
|
|
95
|
+
].join(' ');
|
|
96
|
+
}
|
|
97
|
+
const innerStart = polarPoint(center, innerRadius, startAngle);
|
|
98
|
+
const innerEnd = polarPoint(center, innerRadius, endAngle);
|
|
99
|
+
return [
|
|
100
|
+
`M ${formatPieCoordinate(outerStart.x)} ${formatPieCoordinate(outerStart.y)}`,
|
|
101
|
+
pieArc(outerRadius, largeArc, 1, outerEnd),
|
|
102
|
+
`L ${formatPieCoordinate(innerEnd.x)} ${formatPieCoordinate(innerEnd.y)}`,
|
|
103
|
+
pieArc(innerRadius, largeArc, 0, innerStart),
|
|
104
|
+
'Z'
|
|
105
|
+
].join(' ');
|
|
106
|
+
};
|
|
107
|
+
export const createLumenPieGeometry = (data, options = {}) => {
|
|
108
|
+
const size = Math.max(1, options.size ?? 320);
|
|
109
|
+
const padding = Math.max(0, options.padding ?? 12);
|
|
110
|
+
const center = size / 2;
|
|
111
|
+
const outerRadius = Math.max(0, center - padding);
|
|
112
|
+
const innerRadius = options.variant === 'pie' ? 0 : outerRadius * 0.58;
|
|
113
|
+
const available = data.filter((datum) => datum.y !== null && Number.isFinite(datum.y) && datum.y > 0);
|
|
114
|
+
const total = available.reduce((sum, datum) => sum + datum.y, 0);
|
|
115
|
+
let angle = -90;
|
|
116
|
+
const slices = available.map((datum, index) => {
|
|
117
|
+
const percentage = total === 0 ? 0 : datum.y / total;
|
|
118
|
+
const startAngle = angle;
|
|
119
|
+
const endAngle = index === available.length - 1
|
|
120
|
+
? 270
|
|
121
|
+
: startAngle + percentage * 360;
|
|
122
|
+
angle = endAngle;
|
|
123
|
+
return {
|
|
124
|
+
label: datum.label ?? String(datum.x),
|
|
125
|
+
path: pieSlicePath(center, outerRadius, innerRadius, startAngle, endAngle),
|
|
126
|
+
percentage,
|
|
127
|
+
tone: resolveLumenChartTone(datum.tone, index),
|
|
128
|
+
value: datum.y,
|
|
129
|
+
x: datum.x
|
|
130
|
+
};
|
|
131
|
+
});
|
|
132
|
+
return {
|
|
133
|
+
center,
|
|
134
|
+
innerRadius,
|
|
135
|
+
outerRadius,
|
|
136
|
+
size,
|
|
137
|
+
slices,
|
|
138
|
+
total
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
const splitGeometrySegments = (data, domain, width, height, padding) => {
|
|
142
|
+
const drawableWidth = Math.max(0, width - padding * 2);
|
|
143
|
+
const drawableHeight = Math.max(0, height - padding * 2);
|
|
144
|
+
const denominator = Math.max(1, data.length - 1);
|
|
145
|
+
const segments = [];
|
|
146
|
+
let current = [];
|
|
147
|
+
for (const [index, datum] of data.entries()) {
|
|
148
|
+
if (datum.y === null || !Number.isFinite(datum.y)) {
|
|
149
|
+
if (current.length > 0)
|
|
150
|
+
segments.push(current);
|
|
151
|
+
current = [];
|
|
152
|
+
continue;
|
|
153
|
+
}
|
|
154
|
+
current.push({
|
|
155
|
+
...datum,
|
|
156
|
+
xCoordinate: padding + (data.length === 1 ? 0.5 : index / denominator) * drawableWidth,
|
|
157
|
+
yCoordinate: scaleLumenChartValue(datum.y, domain, padding + drawableHeight, padding)
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
if (current.length > 0)
|
|
161
|
+
segments.push(current);
|
|
162
|
+
return segments;
|
|
163
|
+
};
|
|
164
|
+
const segmentPath = (points) => points
|
|
165
|
+
.map((point, index) => `${index === 0 ? 'M' : 'L'} ${point.xCoordinate.toFixed(3)} ${point.yCoordinate.toFixed(3)}`)
|
|
166
|
+
.join(' ');
|
|
167
|
+
export const createLumenLineGeometry = (data, options = {}) => {
|
|
168
|
+
const width = options.width ?? defaultChartSize;
|
|
169
|
+
const height = options.height ?? defaultChartSize;
|
|
170
|
+
const padding = options.padding ?? defaultChartPadding;
|
|
171
|
+
const calculatedDomain = getLumenChartDomain(data.map(datum => datum.y), options.includeZero ?? false);
|
|
172
|
+
const domain = {
|
|
173
|
+
max: options.domain?.max ?? calculatedDomain.max,
|
|
174
|
+
min: options.domain?.min ?? calculatedDomain.min
|
|
175
|
+
};
|
|
176
|
+
const segments = splitGeometrySegments(data, domain, width, height, padding);
|
|
177
|
+
const baseline = scaleLumenChartValue(Math.max(domain.min, Math.min(domain.max, 0)), domain, height - padding, padding);
|
|
178
|
+
return {
|
|
179
|
+
areaPaths: segments.map(points => {
|
|
180
|
+
const first = points[0];
|
|
181
|
+
const last = points[points.length - 1];
|
|
182
|
+
if (!first || !last)
|
|
183
|
+
return '';
|
|
184
|
+
return `${segmentPath(points)} L ${last.xCoordinate.toFixed(3)} ${baseline.toFixed(3)} L ${first.xCoordinate.toFixed(3)} ${baseline.toFixed(3)} Z`;
|
|
185
|
+
}).filter(Boolean),
|
|
186
|
+
domain,
|
|
187
|
+
path: segments.map(segmentPath).join(' '),
|
|
188
|
+
points: segments.flat()
|
|
189
|
+
};
|
|
190
|
+
};
|
|
191
|
+
export const getLumenChartValueRatio = (value, domain) => {
|
|
192
|
+
const ratio = scaleLumenChartValue(value, domain, 0, 1);
|
|
193
|
+
return Math.max(0, Math.min(1, ratio));
|
|
194
|
+
};
|
|
195
|
+
export const getLumenChartCategories = (series) => {
|
|
196
|
+
const categories = new Map();
|
|
197
|
+
for (const item of series) {
|
|
198
|
+
for (const datum of item.data) {
|
|
199
|
+
const key = `${typeof datum.x}:${String(datum.x)}`;
|
|
200
|
+
if (!categories.has(key))
|
|
201
|
+
categories.set(key, datum.x);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
return [...categories.values()];
|
|
205
|
+
};
|
|
206
|
+
export const alignLumenChartSeries = (series, categories) => ({
|
|
207
|
+
...series,
|
|
208
|
+
data: categories.map(category => series.data.find(datum => datum.x === category) ?? { x: category, y: null })
|
|
209
|
+
});
|
|
210
|
+
const getDatumValue = (series, category) => series.data.find(datum => datum.x === category)?.y ?? 0;
|
|
211
|
+
const getStackedDomain = (series, categories) => {
|
|
212
|
+
const totals = categories.flatMap(category => {
|
|
213
|
+
let positive = 0;
|
|
214
|
+
let negative = 0;
|
|
215
|
+
for (const item of series) {
|
|
216
|
+
const value = getDatumValue(item, category);
|
|
217
|
+
if (value >= 0)
|
|
218
|
+
positive += value;
|
|
219
|
+
else
|
|
220
|
+
negative += value;
|
|
221
|
+
}
|
|
222
|
+
return [negative, positive];
|
|
223
|
+
});
|
|
224
|
+
return getLumenChartDomain(totals);
|
|
225
|
+
};
|
|
226
|
+
const getBarStartValue = (layout, value, positiveOffset, negativeOffset) => {
|
|
227
|
+
if (layout !== 'stacked')
|
|
228
|
+
return 0;
|
|
229
|
+
return value >= 0 ? positiveOffset : negativeOffset;
|
|
230
|
+
};
|
|
231
|
+
/* eslint-disable complexity -- Bar geometry deliberately keeps both orientations and layouts in one deterministic pass. */
|
|
232
|
+
export const createLumenBarGeometry = (series, options = {}) => {
|
|
233
|
+
const width = options.width ?? 640;
|
|
234
|
+
const height = options.height ?? 320;
|
|
235
|
+
const orientation = options.orientation ?? 'vertical';
|
|
236
|
+
const layout = options.layout ?? 'grouped';
|
|
237
|
+
const categories = getLumenChartCategories(series);
|
|
238
|
+
const values = series.flatMap(item => item.data.map(datum => datum.y));
|
|
239
|
+
const domain = layout === 'stacked'
|
|
240
|
+
? getStackedDomain(series, categories)
|
|
241
|
+
: getLumenChartDomain(values);
|
|
242
|
+
const margin = orientation === 'horizontal'
|
|
243
|
+
? { bottom: 24, left: 112, right: 20, top: 16 }
|
|
244
|
+
: { bottom: 52, left: 52, right: 16, top: 16 };
|
|
245
|
+
const plotWidth = Math.max(1, width - margin.left - margin.right);
|
|
246
|
+
const plotHeight = Math.max(1, height - margin.top - margin.bottom);
|
|
247
|
+
const categorySize = (orientation === 'horizontal' ? plotHeight : plotWidth) / Math.max(1, categories.length);
|
|
248
|
+
const categoryGap = Math.min(16, categorySize * 0.24);
|
|
249
|
+
const usableCategorySize = Math.max(1, categorySize - categoryGap);
|
|
250
|
+
const seriesSize = usableCategorySize / Math.max(1, series.length);
|
|
251
|
+
const marks = [];
|
|
252
|
+
const categoryPositions = [];
|
|
253
|
+
for (const [categoryIndex, category] of categories.entries()) {
|
|
254
|
+
const categoryStart = (orientation === 'horizontal' ? margin.top : margin.left) + categoryIndex * categorySize + categoryGap / 2;
|
|
255
|
+
let positiveOffset = 0;
|
|
256
|
+
let negativeOffset = 0;
|
|
257
|
+
categoryPositions.push({
|
|
258
|
+
label: category,
|
|
259
|
+
x: orientation === 'horizontal'
|
|
260
|
+
? margin.left - 8
|
|
261
|
+
: categoryStart + usableCategorySize / 2,
|
|
262
|
+
y: orientation === 'horizontal'
|
|
263
|
+
? categoryStart + usableCategorySize / 2
|
|
264
|
+
: height - 20
|
|
265
|
+
});
|
|
266
|
+
for (const [seriesIndex, item] of series.entries()) {
|
|
267
|
+
const value = getDatumValue(item, category);
|
|
268
|
+
const tone = resolveLumenChartTone(item.tone, seriesIndex);
|
|
269
|
+
if (orientation === 'horizontal') {
|
|
270
|
+
const startValue = getBarStartValue(layout, value, positiveOffset, negativeOffset);
|
|
271
|
+
const endValue = startValue + value;
|
|
272
|
+
const start = scaleLumenChartValue(startValue, domain, margin.left, margin.left + plotWidth);
|
|
273
|
+
const end = scaleLumenChartValue(endValue, domain, margin.left, margin.left + plotWidth);
|
|
274
|
+
marks.push({
|
|
275
|
+
category,
|
|
276
|
+
height: layout === 'stacked' ? usableCategorySize : Math.max(1, seriesSize - 2),
|
|
277
|
+
seriesId: item.id,
|
|
278
|
+
seriesLabel: item.label,
|
|
279
|
+
tone,
|
|
280
|
+
value,
|
|
281
|
+
width: Math.abs(end - start),
|
|
282
|
+
x: Math.min(start, end),
|
|
283
|
+
y: categoryStart + (layout === 'stacked' ? 0 : seriesIndex * seriesSize + 1)
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
else {
|
|
287
|
+
const startValue = getBarStartValue(layout, value, positiveOffset, negativeOffset);
|
|
288
|
+
const endValue = startValue + value;
|
|
289
|
+
const start = scaleLumenChartValue(startValue, domain, margin.top + plotHeight, margin.top);
|
|
290
|
+
const end = scaleLumenChartValue(endValue, domain, margin.top + plotHeight, margin.top);
|
|
291
|
+
marks.push({
|
|
292
|
+
category,
|
|
293
|
+
height: Math.abs(end - start),
|
|
294
|
+
seriesId: item.id,
|
|
295
|
+
seriesLabel: item.label,
|
|
296
|
+
tone,
|
|
297
|
+
value,
|
|
298
|
+
width: layout === 'stacked' ? usableCategorySize : Math.max(1, seriesSize - 2),
|
|
299
|
+
x: categoryStart + (layout === 'stacked' ? 0 : seriesIndex * seriesSize + 1),
|
|
300
|
+
y: Math.min(start, end)
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
if (layout === 'stacked') {
|
|
304
|
+
if (value >= 0)
|
|
305
|
+
positiveOffset += value;
|
|
306
|
+
else
|
|
307
|
+
negativeOffset += value;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
return {
|
|
312
|
+
categories: categoryPositions,
|
|
313
|
+
domain,
|
|
314
|
+
height,
|
|
315
|
+
marks,
|
|
316
|
+
width
|
|
317
|
+
};
|
|
318
|
+
};
|
|
319
|
+
/* eslint-enable complexity */
|
package/dist/components.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export declare const lumenComponentNames: readonly ["Accordion", "Alert", "AlertDialog", "Agenda", "AspectRatio", "Attachment", "Autocomplete", "Avatar", "BackToTop", "Badge", "Breadcrumb", "Bubble", "Button", "ButtonGroup", "Calendar", "Callout", "Card", "Carousel", "Chart", "Checkbox", "Collapsible", "Code", "CodeTabs", "Combobox", "Command", "ContextMenu", "ColorPicker", "DataTable", "DatePicker", "DateRangePicker", "Dialog", "Direction", "Drawer", "DropdownMenu", "Empty", "Eyebrow", "Field", "FloatingBadge", "FormattedDate", "HoverCard", "Icon", "Image", "Input", "InputGroup", "InputOTP", "Item", "Kbd", "Label", "Link", "Marker", "Menubar", "Message", "MessageScroller", "NativeSelect", "NavigationMenu", "NumberField", "Pagination", "PhoneInput", "Pill", "Popover", "Progress", "Prose", "RadioGroup", "Resizable", "RichTextEditor", "ScrollArea", "Schedule", "SearchField", "Select", "Separator", "Sheet", "Sidebar", "Skeleton", "SkipLink", "Slider", "Sonner", "Spinner", "Switch", "Table", "Tabs", "TagGroup", "Textarea", "ThemeBuilder", "ThemeToggle", "TimeField", "Toast", "Toggle", "ToggleGroup", "Tooltip", "Tree", "TreeGrid", "Typography", "VirtualList", "LanguageToggle", "Particles", "AnimatedNumber", "RevealGroup", "ScrollReveal", "Stat", "Meter", "Note", "Rating", "Timeline", "AnimatedLogo", "AnimatedPortrait", "ButtonLink", "CoverImage", "GradientDivider", "Stepper", "FileUpload", "Tour", "Anchor", "Segmented", "Toolbar", "Descriptions", "Popconfirm", "Transfer", "Cascader", "TreeSelect", "Mentions", "QRCode", "Watermark", "Affix", "SpeedDial"];
|
|
1
|
+
export declare const lumenComponentNames: readonly ["Accordion", "Alert", "AlertDialog", "Agenda", "AspectRatio", "Attachment", "Autocomplete", "Avatar", "BackToTop", "Badge", "BarChart", "Breadcrumb", "Bubble", "Button", "ButtonGroup", "Calendar", "Callout", "Card", "Carousel", "Chart", "Checkbox", "Collapsible", "Code", "CodeTabs", "Combobox", "Command", "ContextMenu", "ColorPicker", "DataTable", "DatePicker", "DateRangePicker", "Dialog", "Direction", "Drawer", "DropdownMenu", "Empty", "Eyebrow", "Field", "FloatingBadge", "FormattedDate", "HoverCard", "Icon", "Image", "Input", "InputGroup", "InputOTP", "Item", "Kbd", "Label", "Link", "LineChart", "Marker", "Menubar", "Message", "MessageScroller", "NativeSelect", "NavigationMenu", "NumberField", "Pagination", "PhoneInput", "PieChart", "Pill", "Popover", "Progress", "Prose", "RadioGroup", "Resizable", "RichTextEditor", "ScrollArea", "ScrollProgress", "Schedule", "SearchField", "Select", "Separator", "Sheet", "Sidebar", "Skeleton", "SkipLink", "Slider", "Sonner", "Sparkline", "Spinner", "Switch", "Table", "Tabs", "TagGroup", "Textarea", "ThemeBuilder", "ThemeToggle", "TimeField", "Toast", "Toggle", "ToggleGroup", "Tooltip", "Tree", "TreeGrid", "Typography", "VirtualList", "LanguageToggle", "Particles", "AnimatedNumber", "RevealGroup", "ScrollReveal", "Stat", "Meter", "Note", "Rating", "Timeline", "AnimatedLogo", "AnimatedPortrait", "ButtonLink", "CoverImage", "GradientDivider", "Stepper", "FileUpload", "Tour", "Anchor", "Segmented", "Toolbar", "Descriptions", "Popconfirm", "Transfer", "Cascader", "TreeSelect", "Mentions", "QRCode", "Watermark", "Affix", "SpeedDial"];
|
|
2
2
|
export type LumenComponentName = typeof lumenComponentNames[number];
|
|
3
3
|
export interface LumenPackageTarget {
|
|
4
4
|
name: string;
|
|
5
5
|
packageName: string;
|
|
6
|
-
runtime: 'astro' | 'core' | 'elements' | 'react' | 'umbrella';
|
|
6
|
+
runtime: 'astro' | 'core' | 'elements' | 'icons' | 'react' | 'umbrella';
|
|
7
7
|
}
|
|
8
8
|
export declare const lumenPackages: readonly [{
|
|
9
9
|
readonly name: "Lumen";
|
|
@@ -25,5 +25,9 @@ export declare const lumenPackages: readonly [{
|
|
|
25
25
|
readonly name: "Lumen Elements";
|
|
26
26
|
readonly packageName: "@santi020k/lumen-elements";
|
|
27
27
|
readonly runtime: "elements";
|
|
28
|
+
}, {
|
|
29
|
+
readonly name: "Lumen Brand Icons";
|
|
30
|
+
readonly packageName: "@santi020k/lumen-icons-brand";
|
|
31
|
+
readonly runtime: "icons";
|
|
28
32
|
}];
|
|
29
33
|
//# sourceMappingURL=components.d.ts.map
|
package/dist/components.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../src/components.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../src/components.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB,kkDAkItB,CAAA;AAEV,MAAM,MAAM,kBAAkB,GAAG,OAAO,mBAAmB,CAAC,MAAM,CAAC,CAAA;AAEnE,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG,UAAU,GAAG,OAAO,GAAG,OAAO,GAAG,UAAU,CAAA;CACxE;AAED,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;EAWwB,CAAA"}
|
package/dist/components.js
CHANGED
|
@@ -9,6 +9,7 @@ export const lumenComponentNames = [
|
|
|
9
9
|
'Avatar',
|
|
10
10
|
'BackToTop',
|
|
11
11
|
'Badge',
|
|
12
|
+
'BarChart',
|
|
12
13
|
'Breadcrumb',
|
|
13
14
|
'Bubble',
|
|
14
15
|
'Button',
|
|
@@ -48,6 +49,7 @@ export const lumenComponentNames = [
|
|
|
48
49
|
'Kbd',
|
|
49
50
|
'Label',
|
|
50
51
|
'Link',
|
|
52
|
+
'LineChart',
|
|
51
53
|
'Marker',
|
|
52
54
|
'Menubar',
|
|
53
55
|
'Message',
|
|
@@ -57,6 +59,7 @@ export const lumenComponentNames = [
|
|
|
57
59
|
'NumberField',
|
|
58
60
|
'Pagination',
|
|
59
61
|
'PhoneInput',
|
|
62
|
+
'PieChart',
|
|
60
63
|
'Pill',
|
|
61
64
|
'Popover',
|
|
62
65
|
'Progress',
|
|
@@ -65,6 +68,7 @@ export const lumenComponentNames = [
|
|
|
65
68
|
'Resizable',
|
|
66
69
|
'RichTextEditor',
|
|
67
70
|
'ScrollArea',
|
|
71
|
+
'ScrollProgress',
|
|
68
72
|
'Schedule',
|
|
69
73
|
'SearchField',
|
|
70
74
|
'Select',
|
|
@@ -75,6 +79,7 @@ export const lumenComponentNames = [
|
|
|
75
79
|
'SkipLink',
|
|
76
80
|
'Slider',
|
|
77
81
|
'Sonner',
|
|
82
|
+
'Sparkline',
|
|
78
83
|
'Spinner',
|
|
79
84
|
'Switch',
|
|
80
85
|
'Table',
|
|
@@ -129,5 +134,10 @@ export const lumenPackages = [
|
|
|
129
134
|
{ name: 'Lumen Core', packageName: '@santi020k/lumen-core', runtime: 'core' },
|
|
130
135
|
{ name: 'Lumen Astro', packageName: '@santi020k/lumen-astro', runtime: 'astro' },
|
|
131
136
|
{ name: 'Lumen React', packageName: '@santi020k/lumen-react', runtime: 'react' },
|
|
132
|
-
{ name: 'Lumen Elements', packageName: '@santi020k/lumen-elements', runtime: 'elements' }
|
|
137
|
+
{ name: 'Lumen Elements', packageName: '@santi020k/lumen-elements', runtime: 'elements' },
|
|
138
|
+
{
|
|
139
|
+
name: 'Lumen Brand Icons',
|
|
140
|
+
packageName: '@santi020k/lumen-icons-brand',
|
|
141
|
+
runtime: 'icons'
|
|
142
|
+
}
|
|
133
143
|
];
|
package/dist/icons.d.ts
CHANGED
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import { type LucideIconData, type LucideIconNode } from '@lucide/icons';
|
|
2
2
|
export type LumenIconNode = LucideIconNode;
|
|
3
|
-
export type
|
|
3
|
+
export type LumenIconStyle = 'fill' | 'stroke';
|
|
4
|
+
export type LumenIconData = LucideIconData & {
|
|
5
|
+
source?: string;
|
|
6
|
+
style?: LumenIconStyle;
|
|
7
|
+
};
|
|
4
8
|
export type LumenIconName = string;
|
|
9
|
+
export type LumenIconPack = Readonly<Record<string, LumenIconData>>;
|
|
5
10
|
export declare const lumenIcons: Readonly<Record<string, LumenIconData>>;
|
|
6
11
|
export declare const lumenIconNames: readonly string[];
|
|
12
|
+
export declare const registerLumenIconPack: (prefix: string, icons: LumenIconPack) => void;
|
|
13
|
+
export declare const getLumenIconPack: (prefix: string) => LumenIconPack | undefined;
|
|
14
|
+
export declare const getRegisteredLumenIconNames: () => string[];
|
|
7
15
|
export declare const resolveLumenIconName: (name: string) => LumenIconName | undefined;
|
|
8
16
|
export declare const getLumenIcon: (name: string) => LumenIconData | undefined;
|
|
9
17
|
export interface LumenIconSvgOptions {
|
package/dist/icons.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../src/icons.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,cAAc,EACpB,MAAM,eAAe,CAAA;AAEtB,MAAM,MAAM,aAAa,GAAG,cAAc,CAAA;AAC1C,MAAM,MAAM,aAAa,GAAG,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../src/icons.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,cAAc,EACpB,MAAM,eAAe,CAAA;AAEtB,MAAM,MAAM,aAAa,GAAG,cAAc,CAAA;AAC1C,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,QAAQ,CAAA;AAC9C,MAAM,MAAM,aAAa,GAAG,cAAc,GAAG;IAC3C,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,cAAc,CAAA;CACvB,CAAA;AACD,MAAM,MAAM,aAAa,GAAG,MAAM,CAAA;AAClC,MAAM,MAAM,aAAa,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,CAAA;AAyBnE,eAAO,MAAM,UAAU,EAElB,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,CAAA;AAE5C,eAAO,MAAM,cAAc,mBAAgD,CAAA;AAe3E,eAAO,MAAM,qBAAqB,GAAI,QAAQ,MAAM,EAAE,OAAO,aAAa,SAYzE,CAAA;AAED,eAAO,MAAM,gBAAgB,GAAI,QAAQ,MAAM,KAAG,aAAa,GAAG,SACpB,CAAA;AAE9C,eAAO,MAAM,2BAA2B,gBAG7B,CAAA;AAwBX,eAAO,MAAM,oBAAoB,GAAI,MAAM,MAAM,KAAG,aAAa,GAAG,SAQnE,CAAA;AAED,eAAO,MAAM,YAAY,GAAI,MAAM,MAAM,KAAG,aAAa,GAAG,SAQ3D,CAAA;AAED,MAAM,WAAW,mBAAmB;IAClC,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,eAAO,MAAM,kBAAkB,GAAI,MAAM,MAAM,EAAE,UAAS,mBAAwB,WAyBjF,CAAA"}
|
package/dist/icons.js
CHANGED
|
@@ -4,6 +4,7 @@ const toKebabCase = (value) => value.trim()
|
|
|
4
4
|
.replaceAll(/[\s_]+/g, '-')
|
|
5
5
|
.toLowerCase();
|
|
6
6
|
const lucideIconEntries = Object.entries(lucideIcons);
|
|
7
|
+
const registeredIconPacks = new Map();
|
|
7
8
|
const createLumenIconEntries = () => {
|
|
8
9
|
const entries = [];
|
|
9
10
|
for (const [exportName, icon] of lucideIconEntries) {
|
|
@@ -16,6 +17,28 @@ const createLumenIconEntries = () => {
|
|
|
16
17
|
};
|
|
17
18
|
export const lumenIcons = Object.freeze(Object.fromEntries(createLumenIconEntries()));
|
|
18
19
|
export const lumenIconNames = Object.freeze(Object.keys(lumenIcons).sort());
|
|
20
|
+
const parseIconName = (name) => {
|
|
21
|
+
const separatorIndex = name.indexOf(':');
|
|
22
|
+
if (separatorIndex < 0) {
|
|
23
|
+
return { iconName: toKebabCase(name) };
|
|
24
|
+
}
|
|
25
|
+
return {
|
|
26
|
+
iconName: toKebabCase(name.slice(separatorIndex + 1)),
|
|
27
|
+
prefix: toKebabCase(name.slice(0, separatorIndex))
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
export const registerLumenIconPack = (prefix, icons) => {
|
|
31
|
+
const normalizedPrefix = toKebabCase(prefix);
|
|
32
|
+
if (!normalizedPrefix || normalizedPrefix.includes(':')) {
|
|
33
|
+
throw new Error('Lumen icon pack prefixes must be non-empty and cannot contain colons.');
|
|
34
|
+
}
|
|
35
|
+
const normalizedIcons = Object.fromEntries(Object.entries(icons).map(([name, icon]) => [toKebabCase(name), icon]));
|
|
36
|
+
registeredIconPacks.set(normalizedPrefix, Object.freeze(normalizedIcons));
|
|
37
|
+
};
|
|
38
|
+
export const getLumenIconPack = (prefix) => registeredIconPacks.get(toKebabCase(prefix));
|
|
39
|
+
export const getRegisteredLumenIconNames = () => [...registeredIconPacks.entries()]
|
|
40
|
+
.flatMap(([prefix, icons]) => Object.keys(icons).map(name => `${prefix}:${name}`))
|
|
41
|
+
.sort();
|
|
19
42
|
const escapeHtmlAttribute = (value) => value.replaceAll('&', '&')
|
|
20
43
|
.replaceAll('"', '"')
|
|
21
44
|
.replaceAll('<', '<')
|
|
@@ -32,29 +55,39 @@ const renderIconNode = ([tagName, attributes, children]) => {
|
|
|
32
55
|
return `${openingTag}>${children.map(renderIconNode).join('')}</${tagName}>`;
|
|
33
56
|
};
|
|
34
57
|
export const resolveLumenIconName = (name) => {
|
|
35
|
-
const
|
|
36
|
-
|
|
58
|
+
const { iconName, prefix } = parseIconName(name);
|
|
59
|
+
if (!prefix) {
|
|
60
|
+
return lumenIcons[iconName] ? iconName : undefined;
|
|
61
|
+
}
|
|
62
|
+
return registeredIconPacks.get(prefix)?.[iconName] ? `${prefix}:${iconName}` : undefined;
|
|
37
63
|
};
|
|
38
64
|
export const getLumenIcon = (name) => {
|
|
39
65
|
const resolvedName = resolveLumenIconName(name);
|
|
40
|
-
|
|
66
|
+
if (!resolvedName)
|
|
67
|
+
return undefined;
|
|
68
|
+
const { iconName, prefix } = parseIconName(resolvedName);
|
|
69
|
+
return prefix ? registeredIconPacks.get(prefix)?.[iconName] : lumenIcons[iconName];
|
|
41
70
|
};
|
|
42
71
|
export const renderLumenIconSvg = (name, options = {}) => {
|
|
43
72
|
const icon = getLumenIcon(name);
|
|
44
73
|
if (!icon)
|
|
45
74
|
return '';
|
|
46
|
-
const
|
|
75
|
+
const iconStyle = icon.style ?? 'stroke';
|
|
76
|
+
const source = icon.source ?? 'lucide';
|
|
77
|
+
const width = 'size' in icon ? icon.size : icon.width;
|
|
78
|
+
const height = 'size' in icon ? icon.size : icon.height;
|
|
79
|
+
const className = ['ui-icon__svg', `${source}-${icon.name}`, options.className].filter(Boolean).join(' ');
|
|
47
80
|
return `<svg ${renderAttributes({
|
|
48
81
|
'aria-hidden': 'true',
|
|
49
82
|
class: className,
|
|
50
|
-
fill: 'none',
|
|
83
|
+
fill: iconStyle === 'fill' ? 'currentColor' : 'none',
|
|
51
84
|
focusable: 'false',
|
|
52
85
|
height: '1em',
|
|
53
|
-
stroke: 'currentColor',
|
|
86
|
+
stroke: iconStyle === 'stroke' ? 'currentColor' : 'none',
|
|
54
87
|
'stroke-linecap': 'round',
|
|
55
88
|
'stroke-linejoin': 'round',
|
|
56
|
-
'stroke-width': '2',
|
|
57
|
-
viewBox:
|
|
89
|
+
'stroke-width': iconStyle === 'stroke' ? '2' : '0',
|
|
90
|
+
viewBox: `0 0 ${width} ${height}`,
|
|
58
91
|
width: '1em',
|
|
59
92
|
xmlns: 'http://www.w3.org/2000/svg'
|
|
60
93
|
})}>${icon.node.map(renderIconNode).join('')}</svg>`;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
+
export { alignLumenChartSeries, createLumenBarGeometry, createLumenLineGeometry, createLumenPieGeometry, getLumenChartCategories, getLumenChartDomain, getLumenChartTicks, getLumenChartValueRatio, hasLumenChartData, hasLumenPieData, type LumenBarChartLayout, type LumenBarGeometry, type LumenBarGeometryCategory, type LumenBarGeometryMark, type LumenBarGeometryOptions, type LumenChartDatum, type LumenChartDomain, type LumenChartGeometryPoint, type LumenChartOrientation, type LumenChartSeries, type LumenChartTone, lumenChartTones, type LumenLineGeometry, type LumenLineGeometryOptions, type LumenPieChartVariant, type LumenPieGeometry, type LumenPieGeometryOptions, type LumenPieGeometrySlice, resolveLumenChartTone, scaleLumenChartValue } from './charts.js';
|
|
1
2
|
export { type LumenCodeToken, lumenCodeTokenClassNames, type LumenCodeTokenKind, normalizeLumenCode, renderLumenCodeHtml, tokenizeLumenCode } from './code.js';
|
|
2
3
|
export { type LumenComponentName, lumenComponentNames, lumenPackages, type LumenPackageTarget } from './components.js';
|
|
3
4
|
export { applyDataViewState, createDataViewRequestUrl, createDataViewSearchParams, createDataViewServerRequest, createDataViewState, createDataViewStorageKey, filterDataRecords, getVirtualRange, loadDataViewState, type LumenDataRecord, type LumenDataViewServerRequest, type LumenDataViewState, type LumenKeyValueReader, type LumenKeyValueStorage, type LumenKeyValueWriter, type LumenSortDirection, paginateDataRecords, parseDataViewState, pinDataViewColumn, saveDataViewState, serializeDataViewState, sortDataRecords, toggleDataViewSelection, unpinDataViewColumn } from './data.js';
|
|
4
5
|
export { createFigmaVariableName, exportThemeDesignTokens, exportThemeFigmaVariables, hslTokenToFigmaColor, hslTokenToHexColor, type LumenDesignToken, type LumenDesignTokenExport, type LumenDesignTokenType, type LumenEffectDesignToken, type LumenFigmaColorValue, type LumenFigmaVariable, type LumenFigmaVariableCollection, type LumenFigmaVariableExportOptions, type LumenFigmaVariableMode, type LumenStructureDesignToken } from './figma.js';
|
|
5
|
-
export { getLumenIcon, type LumenIconData, type LumenIconName, lumenIconNames, type LumenIconNode, lumenIcons, renderLumenIconSvg, resolveLumenIconName } from './icons.js';
|
|
6
|
+
export { getLumenIcon, getLumenIconPack, getRegisteredLumenIconNames, type LumenIconData, type LumenIconName, lumenIconNames, type LumenIconNode, type LumenIconPack, lumenIcons, type LumenIconStyle, registerLumenIconPack, renderLumenIconSvg, resolveLumenIconName } from './icons.js';
|
|
6
7
|
export { type LumenAstroPropsResult, type LumenClassValue, type LumenGlass, type LumenSurfaceAlias, resolveLumenAstroProps, resolveLumenGlass } from './props.js';
|
|
7
8
|
export { getLumenRichTextShortcut, isLumenRichTextToggleCommand, type LumenRichTextChangeDetail, type LumenRichTextCommandDetail, type LumenRichTextShortcutEvent, type LumenRichTextToggleCommand, lumenRichTextToggleCommands } from './rich-text.js';
|
|
8
9
|
export { canPlaceScheduleEvent, createScheduleSlots, createScheduleStorageKey, expandRecurringScheduleEvent, getScheduleConflicts, loadScheduleEvents, type LumenScheduleConflict, type LumenScheduleEvent, type LumenScheduleKeyValueReader, type LumenScheduleKeyValueStorage, type LumenScheduleKeyValueWriter, type LumenScheduleResizeEdge, type LumenScheduleResizeOptions, type LumenScheduleResource, type LumenScheduleSlot, moveScheduleEvent, parseScheduleEvents, resizeScheduleEvent, resizeScheduleEvents, saveScheduleEvents, scheduleEventsOverlap, serializeScheduleEvents } from './schedule.js';
|
|
9
10
|
export { createThemeFromHue, createThemePalette, exportThemeCss, getContrastRatio, type LumenColorTokenName, lumenColorTokenNames, type LumenContrastScore, type LumenGlassColorTokenName, lumenGlassColorTokenNames, type LumenGlassEffectTokenName, lumenGlassEffectTokenNames, type LumenGlassTokenName, lumenGlassTokenNames, type LumenMotionTokenName, lumenMotionTokenNames, type LumenRadiusTokenName, lumenRadiusTokenNames, type LumenSemanticColorTokenName, lumenSemanticColorTokenNames, type LumenShadowTokenName, lumenShadowTokenNames, type LumenStructureTokenName, lumenStructureTokenNames, type LumenThemeContrastSuggestion, type LumenThemeFromHueOptions, type LumenThemeTokenName, type LumenThemeTokens, lumenTokenNames, type LumenTypographyTokenName, lumenTypographyTokenNames, mergeThemeTokens, parseThemeCss, scoreThemeContrast, suggestReadableInk, tuneThemeContrast } from './theme.js';
|
|
10
11
|
export { coerceThemeBuilderExportFormat, coerceThemeBuilderMode, coerceThemeBuilderScheme, createThemeBuilderTokens, exportThemeBuilderCss, exportThemeBuilderValue, type LumenThemeBuilderExportFormat, type LumenThemeBuilderMode, type LumenThemeBuilderOptions, type LumenThemeBuilderResult, type LumenThemeBuilderScheme, normalizeThemeBuilderHex, normalizeThemeBuilderHue, themeBuilderHexToHsl } from './theme-builder.js';
|
|
11
|
-
export { composeClassName, lumenColors, lumenDarkTheme, lumenFont, lumenGlass, lumenLightTheme, lumenMotion, lumenRadius, lumenShadow, lumenThemeAttribute } from './tokens.js';
|
|
12
|
+
export { composeClassName, lumenChart, lumenColors, lumenDarkTheme, lumenFont, lumenGlass, lumenLightTheme, lumenMotion, lumenRadius, lumenShadow, lumenThemeAttribute } from './tokens.js';
|
|
12
13
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,cAAc,EACnB,wBAAwB,EACxB,KAAK,kBAAkB,EACvB,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EAClB,MAAM,WAAW,CAAA;AAClB,OAAO,EACL,KAAK,kBAAkB,EACvB,mBAAmB,EACnB,aAAa,EACb,KAAK,kBAAkB,EAAC,MAAM,iBAAiB,CAAA;AACjD,OAAO,EACL,kBAAkB,EAClB,wBAAwB,EACxB,0BAA0B,EAC1B,2BAA2B,EAC3B,mBAAmB,EACnB,wBAAwB,EACxB,iBAAiB,EACjB,eAAe,EACf,iBAAiB,EACjB,KAAK,eAAe,EACpB,KAAK,0BAA0B,EAC/B,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,sBAAsB,EACtB,eAAe,EACf,uBAAuB,EACvB,mBAAmB,EAAC,MAAM,WAAW,CAAA;AACvC,OAAO,EACL,uBAAuB,EACvB,uBAAuB,EACvB,yBAAyB,EACzB,oBAAoB,EACpB,kBAAkB,EAClB,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC3B,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,EACxB,oBAAoB,EACpB,KAAK,oBAAoB,EACzB,qBAAqB,EACrB,KAAK,oBAAoB,EACzB,qBAAqB,EACrB,KAAK,2BAA2B,EAChC,4BAA4B,EAC5B,KAAK,oBAAoB,EACzB,qBAAqB,EACrB,KAAK,uBAAuB,EAC5B,wBAAwB,EACxB,KAAK,4BAA4B,EACjC,KAAK,wBAAwB,EAC7B,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,eAAe,EACf,KAAK,wBAAwB,EAC7B,yBAAyB,EACzB,gBAAgB,EAChB,aAAa,EACb,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,YAAY,CAAA;AACnB,OAAO,EACL,8BAA8B,EAC9B,sBAAsB,EACtB,wBAAwB,EACxB,wBAAwB,EACxB,qBAAqB,EACrB,uBAAuB,EACvB,KAAK,6BAA6B,EAClC,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAC5B,wBAAwB,EACxB,wBAAwB,EACxB,oBAAoB,EACrB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EACL,gBAAgB,EAChB,WAAW,EACX,cAAc,EACd,SAAS,EACT,UAAU,EACV,eAAe,EACf,WAAW,EACX,WAAW,EACX,WAAW,EACX,mBAAmB,EACpB,MAAM,aAAa,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,uBAAuB,EACvB,sBAAsB,EACtB,uBAAuB,EACvB,mBAAmB,EACnB,kBAAkB,EAClB,uBAAuB,EACvB,iBAAiB,EACjB,eAAe,EACf,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,KAAK,wBAAwB,EAC7B,KAAK,oBAAoB,EACzB,KAAK,uBAAuB,EAC5B,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,uBAAuB,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B,qBAAqB,EACrB,KAAK,2BAA2B,EAChC,4BAA4B,EAC5B,KAAK,oBAAoB,EACzB,qBAAqB,EACrB,KAAK,uBAAuB,EAC5B,wBAAwB,EACxB,KAAK,4BAA4B,EACjC,KAAK,wBAAwB,EAC7B,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,eAAe,EACf,KAAK,wBAAwB,EAC7B,yBAAyB,EACzB,gBAAgB,EAChB,aAAa,EACb,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,YAAY,CAAA;AACnB,OAAO,EACL,8BAA8B,EAC9B,sBAAsB,EACtB,wBAAwB,EACxB,wBAAwB,EACxB,qBAAqB,EACrB,uBAAuB,EACvB,KAAK,6BAA6B,EAClC,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAC5B,wBAAwB,EACxB,wBAAwB,EACxB,oBAAoB,EACrB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EACL,gBAAgB,EAChB,UAAU,EACV,WAAW,EACX,cAAc,EACd,SAAS,EACT,UAAU,EACV,eAAe,EACf,WAAW,EACX,WAAW,EACX,WAAW,EACX,mBAAmB,EACpB,MAAM,aAAa,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
+
export { alignLumenChartSeries, createLumenBarGeometry, createLumenLineGeometry, createLumenPieGeometry, getLumenChartCategories, getLumenChartDomain, getLumenChartTicks, getLumenChartValueRatio, hasLumenChartData, hasLumenPieData, lumenChartTones, resolveLumenChartTone, scaleLumenChartValue } from './charts.js';
|
|
1
2
|
export { lumenCodeTokenClassNames, normalizeLumenCode, renderLumenCodeHtml, tokenizeLumenCode } from './code.js';
|
|
2
3
|
export { lumenComponentNames, lumenPackages } from './components.js';
|
|
3
4
|
export { applyDataViewState, createDataViewRequestUrl, createDataViewSearchParams, createDataViewServerRequest, createDataViewState, createDataViewStorageKey, filterDataRecords, getVirtualRange, loadDataViewState, paginateDataRecords, parseDataViewState, pinDataViewColumn, saveDataViewState, serializeDataViewState, sortDataRecords, toggleDataViewSelection, unpinDataViewColumn } from './data.js';
|
|
4
5
|
export { createFigmaVariableName, exportThemeDesignTokens, exportThemeFigmaVariables, hslTokenToFigmaColor, hslTokenToHexColor } from './figma.js';
|
|
5
|
-
export { getLumenIcon, lumenIconNames, lumenIcons, renderLumenIconSvg, resolveLumenIconName } from './icons.js';
|
|
6
|
+
export { getLumenIcon, getLumenIconPack, getRegisteredLumenIconNames, lumenIconNames, lumenIcons, registerLumenIconPack, renderLumenIconSvg, resolveLumenIconName } from './icons.js';
|
|
6
7
|
export { resolveLumenAstroProps, resolveLumenGlass } from './props.js';
|
|
7
8
|
export { getLumenRichTextShortcut, isLumenRichTextToggleCommand, lumenRichTextToggleCommands } from './rich-text.js';
|
|
8
9
|
export { canPlaceScheduleEvent, createScheduleSlots, createScheduleStorageKey, expandRecurringScheduleEvent, getScheduleConflicts, loadScheduleEvents, moveScheduleEvent, parseScheduleEvents, resizeScheduleEvent, resizeScheduleEvents, saveScheduleEvents, scheduleEventsOverlap, serializeScheduleEvents } from './schedule.js';
|
|
9
10
|
export { createThemeFromHue, createThemePalette, exportThemeCss, getContrastRatio, lumenColorTokenNames, lumenGlassColorTokenNames, lumenGlassEffectTokenNames, lumenGlassTokenNames, lumenMotionTokenNames, lumenRadiusTokenNames, lumenSemanticColorTokenNames, lumenShadowTokenNames, lumenStructureTokenNames, lumenTokenNames, lumenTypographyTokenNames, mergeThemeTokens, parseThemeCss, scoreThemeContrast, suggestReadableInk, tuneThemeContrast } from './theme.js';
|
|
10
11
|
export { coerceThemeBuilderExportFormat, coerceThemeBuilderMode, coerceThemeBuilderScheme, createThemeBuilderTokens, exportThemeBuilderCss, exportThemeBuilderValue, normalizeThemeBuilderHex, normalizeThemeBuilderHue, themeBuilderHexToHsl } from './theme-builder.js';
|
|
11
|
-
export { composeClassName, lumenColors, lumenDarkTheme, lumenFont, lumenGlass, lumenLightTheme, lumenMotion, lumenRadius, lumenShadow, lumenThemeAttribute } from './tokens.js';
|
|
12
|
+
export { composeClassName, lumenChart, lumenColors, lumenDarkTheme, lumenFont, lumenGlass, lumenLightTheme, lumenMotion, lumenRadius, lumenShadow, lumenThemeAttribute } from './tokens.js';
|
package/dist/theme.js
CHANGED
|
@@ -147,7 +147,7 @@ const lumenRadiusTokens = {
|
|
|
147
147
|
'ui-radius-sm': '0.375rem'
|
|
148
148
|
};
|
|
149
149
|
const lumenTypographyTokens = {
|
|
150
|
-
'ui-font': '
|
|
150
|
+
'ui-font': '"Montserrat", "Avenir Next", "Segoe UI", sans-serif'
|
|
151
151
|
};
|
|
152
152
|
const lumenMotionTokens = {
|
|
153
153
|
'ui-duration': '160ms',
|
package/dist/tokens.d.ts
CHANGED
|
@@ -18,6 +18,24 @@ export declare const lumenColors: {
|
|
|
18
18
|
readonly surfaceStrong: "268 15% 90%";
|
|
19
19
|
readonly warning: "38 92% 50%";
|
|
20
20
|
};
|
|
21
|
+
export declare const lumenChart: {
|
|
22
|
+
readonly axis: "var(--ink-muted)";
|
|
23
|
+
readonly divergingMid: "220 13% 91%";
|
|
24
|
+
readonly divergingNegative: "0 84% 60%";
|
|
25
|
+
readonly divergingPositive: "221 83% 53%";
|
|
26
|
+
readonly grid: "var(--line)";
|
|
27
|
+
readonly sequentialHigh: "221 83% 40%";
|
|
28
|
+
readonly sequentialLow: "218 100% 97%";
|
|
29
|
+
readonly sequentialMid: "221 83% 67%";
|
|
30
|
+
readonly series1: "221 83% 53%";
|
|
31
|
+
readonly series2: "168 76% 36%";
|
|
32
|
+
readonly series3: "280 72% 56%";
|
|
33
|
+
readonly series4: "25 95% 53%";
|
|
34
|
+
readonly series5: "340 82% 55%";
|
|
35
|
+
readonly series6: "190 82% 42%";
|
|
36
|
+
readonly series7: "52 92% 45%";
|
|
37
|
+
readonly series8: "215 16% 47%";
|
|
38
|
+
};
|
|
21
39
|
export declare const lumenGlass: {
|
|
22
40
|
readonly bg: "0 0% 100% / 0.55";
|
|
23
41
|
readonly bgStrong: "0 0% 100% / 0.72";
|
|
@@ -43,7 +61,7 @@ export declare const lumenShadow: {
|
|
|
43
61
|
readonly md: "0 8px 24px hsl(222 47% 11% / 0.08)";
|
|
44
62
|
readonly sm: "0 1px 2px hsl(222 47% 11% / 0.06)";
|
|
45
63
|
};
|
|
46
|
-
export declare const lumenFont: "
|
|
64
|
+
export declare const lumenFont: "\"Montserrat\", \"Avenir Next\", \"Segoe UI\", sans-serif";
|
|
47
65
|
export declare const lumenMotion: {
|
|
48
66
|
readonly duration: "160ms";
|
|
49
67
|
readonly durationFast: "120ms";
|
package/dist/tokens.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../src/tokens.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB,eAAe,CAAA;AAC/C,eAAO,MAAM,cAAc,SAAS,CAAA;AACpC,eAAO,MAAM,eAAe,UAAU,CAAA;AAEtC,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;CAgBd,CAAA;AAEV,eAAO,MAAM,UAAU;;;;;;;;;;;;;;CAcb,CAAA;AAEV,eAAO,MAAM,WAAW;;;;CAId,CAAA;AAEV,eAAO,MAAM,WAAW;;;;CAId,CAAA;AAEV,eAAO,MAAM,SAAS,EACpB,
|
|
1
|
+
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../src/tokens.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB,eAAe,CAAA;AAC/C,eAAO,MAAM,cAAc,SAAS,CAAA;AACpC,eAAO,MAAM,eAAe,UAAU,CAAA;AAEtC,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;CAgBd,CAAA;AAEV,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;CAiBb,CAAA;AAEV,eAAO,MAAM,UAAU;;;;;;;;;;;;;;CAcb,CAAA;AAEV,eAAO,MAAM,WAAW;;;;CAId,CAAA;AAEV,eAAO,MAAM,WAAW;;;;CAId,CAAA;AAEV,eAAO,MAAM,SAAS,EACpB,2DAA8D,CAAA;AAEhE,eAAO,MAAM,WAAW;;;;;;CAMd,CAAA;AAEV,eAAO,MAAM,gBAAgB,GAAI,GAAG,SAAS,CAAC,OAAO,GAAG,IAAI,GAAG,MAAM,GAAG,SAAS,CAAC,EAAE,WACjD,CAAA"}
|
package/dist/tokens.js
CHANGED
|
@@ -18,6 +18,24 @@ export const lumenColors = {
|
|
|
18
18
|
surfaceStrong: '268 15% 90%',
|
|
19
19
|
warning: '38 92% 50%'
|
|
20
20
|
};
|
|
21
|
+
export const lumenChart = {
|
|
22
|
+
axis: 'var(--ink-muted)',
|
|
23
|
+
divergingMid: '220 13% 91%',
|
|
24
|
+
divergingNegative: '0 84% 60%',
|
|
25
|
+
divergingPositive: '221 83% 53%',
|
|
26
|
+
grid: 'var(--line)',
|
|
27
|
+
sequentialHigh: '221 83% 40%',
|
|
28
|
+
sequentialLow: '218 100% 97%',
|
|
29
|
+
sequentialMid: '221 83% 67%',
|
|
30
|
+
series1: '221 83% 53%',
|
|
31
|
+
series2: '168 76% 36%',
|
|
32
|
+
series3: '280 72% 56%',
|
|
33
|
+
series4: '25 95% 53%',
|
|
34
|
+
series5: '340 82% 55%',
|
|
35
|
+
series6: '190 82% 42%',
|
|
36
|
+
series7: '52 92% 45%',
|
|
37
|
+
series8: '215 16% 47%'
|
|
38
|
+
};
|
|
21
39
|
export const lumenGlass = {
|
|
22
40
|
bg: '0 0% 100% / 0.55',
|
|
23
41
|
bgStrong: '0 0% 100% / 0.72',
|
|
@@ -43,7 +61,7 @@ export const lumenShadow = {
|
|
|
43
61
|
md: '0 8px 24px hsl(222 47% 11% / 0.08)',
|
|
44
62
|
sm: '0 1px 2px hsl(222 47% 11% / 0.06)'
|
|
45
63
|
};
|
|
46
|
-
export const lumenFont = '
|
|
64
|
+
export const lumenFont = '"Montserrat", "Avenir Next", "Segoe UI", sans-serif';
|
|
47
65
|
export const lumenMotion = {
|
|
48
66
|
duration: '160ms',
|
|
49
67
|
durationFast: '120ms',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@santi020k/lumen-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -27,6 +27,10 @@
|
|
|
27
27
|
"types": "./dist/code.d.ts",
|
|
28
28
|
"import": "./dist/code.js"
|
|
29
29
|
},
|
|
30
|
+
"./charts": {
|
|
31
|
+
"types": "./dist/charts.d.ts",
|
|
32
|
+
"import": "./dist/charts.js"
|
|
33
|
+
},
|
|
30
34
|
"./data": {
|
|
31
35
|
"types": "./dist/data.d.ts",
|
|
32
36
|
"import": "./dist/data.js"
|