@bysages/charts 0.0.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/LICENSE +21 -0
- package/README.md +54 -0
- package/dist/index.d.mts +31 -0
- package/dist/index.mjs +28 -0
- package/dist/react/chart.d.mts +2 -0
- package/dist/react/chart.mjs +6 -0
- package/dist/solid/chart.d.mts +2 -0
- package/dist/solid/chart.mjs +6 -0
- package/dist/svelte/chart.d.mts +2 -0
- package/dist/svelte/chart.mjs +6 -0
- package/dist/theme-CCf9S1Jc.mjs +41 -0
- package/dist/vue/chart.d.mts +2 -0
- package/dist/vue/chart.mjs +6 -0
- package/package.json +89 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 By Sages
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# @bysages/charts
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+

|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
> Token-themed charts for By Sages Elements — [TanStack Charts](https://tanstack.com/charts) re-exported per framework, with the palette and surface variables bridged onto the paper-and-ink tokens.
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
- 🎨 **Tokens as ink** — marks carry `var(--bs-color-*)` straight through paint attributes; `var()` resolves against the live theme, so mode, accent, and scene retune the ink with no redraw
|
|
12
|
+
- 🖌️ **A fixed pigment palette** — ink → danger → success → warning → info, the system's semantic order, handed to series that don't name their own colors
|
|
13
|
+
- 🪟 **Paper vessels** — tooltips dress like every other popup vessel (surface, hairline, elevation), crosshairs and focus takes the primary ink
|
|
14
|
+
- 🧩 **The full grammar** — marks, transforms, scales, and `defineChart` pass through from TanStack Charts, one entry per framework (`/vue`, `/react`, `/solid`, `/svelte`)
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
# pnpm
|
|
20
|
+
pnpm add @bysages/charts @bysages/core @bysages/tokens
|
|
21
|
+
|
|
22
|
+
# npm
|
|
23
|
+
npm install @bysages/charts @bysages/core @bysages/tokens
|
|
24
|
+
|
|
25
|
+
# yarn
|
|
26
|
+
yarn add @bysages/charts @bysages/core @bysages/tokens
|
|
27
|
+
|
|
28
|
+
# bun
|
|
29
|
+
bun add @bysages/charts @bysages/core @bysages/tokens
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Quick Start
|
|
33
|
+
|
|
34
|
+
```vue
|
|
35
|
+
<script setup lang="ts">
|
|
36
|
+
import { Chart } from "@bysages/charts/vue";
|
|
37
|
+
import { bar } from "@tanstack/charts";
|
|
38
|
+
|
|
39
|
+
const definition = {
|
|
40
|
+
axis: ["Region", "Units"],
|
|
41
|
+
series: [{ type: bar(), label: "Sales", data: [42, 87, 63] }],
|
|
42
|
+
} as const;
|
|
43
|
+
</script>
|
|
44
|
+
|
|
45
|
+
<template>
|
|
46
|
+
<Chart :definition="definition" />
|
|
47
|
+
</template>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
The module side-effects bridge the theme once on import — no setup call of its own.
|
|
51
|
+
|
|
52
|
+
## License
|
|
53
|
+
|
|
54
|
+
- [MIT](../../LICENSE) © [By Sages](https://www.bysages.com/)
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export * from "@tanstack/charts";
|
|
2
|
+
//#region src/theme.d.ts
|
|
3
|
+
/** Bridge the chart engine's surface variables onto the paper-and-ink
|
|
4
|
+
* tokens: its tooltip dresses like every other popup vessel, and its
|
|
5
|
+
* crosshair and focus takes the primary ink. The marks themselves carry
|
|
6
|
+
* tokens straight through paint attributes — var() resolves against the
|
|
7
|
+
* live theme, so mode, accent, and scene retune the ink with no redraw. */
|
|
8
|
+
export declare const chartThemeCss = "\n.ts-chart {\n --ts-chart-tooltip-background: var(--bs-color-surface-2);\n --ts-chart-tooltip-border: 1px solid var(--bs-color-border);\n --ts-chart-tooltip-border-radius: var(--bs-radius-lg);\n --ts-chart-tooltip-color: var(--bs-color-text-primary);\n --ts-chart-tooltip-font: var(--bs-font-size-sm) / var(--bs-line-height-relaxed)\n var(--bs-font-sans);\n --ts-chart-tooltip-max-width: 18rem;\n --ts-chart-tooltip-padding: var(--bs-space-2) var(--bs-space-3);\n --ts-chart-tooltip-shadow: var(--bs-elevation-3);\n --ts-chart-tooltip-active-row-background: var(--bs-color-surface-0);\n --ts-chart-tooltip-active-row-border-radius: var(--bs-radius-sm);\n --ts-chart-tooltip-active-row-font-weight: var(--bs-font-weight-medium);\n --ts-chart-tooltip-active-row-shadow: none;\n --ts-chart-crosshair-marker-fill: var(--bs-color-primary);\n --ts-chart-crosshair-label-halo: var(--bs-color-surface-1);\n --ts-chart-focus-fill: var(--bs-color-primary);\n}\n";
|
|
9
|
+
/** Inject the chart theme bridge (plus the token layer on first use).
|
|
10
|
+
* Idempotent; SSR is a no-op. */
|
|
11
|
+
export declare function injectChartTheme(): void;
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region src/palette.d.ts
|
|
14
|
+
/** The semantic pigments as paint. Marks take these strings directly —
|
|
15
|
+
* the SVG renderer writes them as paint attributes, and var() inside a
|
|
16
|
+
* paint attribute resolves against the live theme. Ink leads; the fixed
|
|
17
|
+
* pigments follow in reading order, so any series can carry any hue and
|
|
18
|
+
* the chart never presumes an industry. */
|
|
19
|
+
export declare const chartColors: {
|
|
20
|
+
readonly ink: "var(--bs-color-primary)";
|
|
21
|
+
readonly danger: "var(--bs-color-danger)";
|
|
22
|
+
readonly success: "var(--bs-color-success)";
|
|
23
|
+
readonly warning: "var(--bs-color-warning)";
|
|
24
|
+
readonly info: "var(--bs-color-info)";
|
|
25
|
+
};
|
|
26
|
+
/** Series order for categorical paint — hand this to an ordinal scale's
|
|
27
|
+
* range (`scaleOrdinal().range(chartSeriesRange)`). */
|
|
28
|
+
export declare const chartSeriesRange: string[];
|
|
29
|
+
/** The quiet ink for grids, guides, and secondary marks. */
|
|
30
|
+
export declare const chartHairline = "var(--bs-color-border)";
|
|
31
|
+
//#endregion
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { n as injectChartTheme, t as chartThemeCss } from "./theme-CCf9S1Jc.mjs";
|
|
2
|
+
export * from "@tanstack/charts";
|
|
3
|
+
//#region src/palette.ts
|
|
4
|
+
/** The semantic pigments as paint. Marks take these strings directly —
|
|
5
|
+
* the SVG renderer writes them as paint attributes, and var() inside a
|
|
6
|
+
* paint attribute resolves against the live theme. Ink leads; the fixed
|
|
7
|
+
* pigments follow in reading order, so any series can carry any hue and
|
|
8
|
+
* the chart never presumes an industry. */
|
|
9
|
+
const chartColors = {
|
|
10
|
+
ink: "var(--bs-color-primary)",
|
|
11
|
+
danger: "var(--bs-color-danger)",
|
|
12
|
+
success: "var(--bs-color-success)",
|
|
13
|
+
warning: "var(--bs-color-warning)",
|
|
14
|
+
info: "var(--bs-color-info)"
|
|
15
|
+
};
|
|
16
|
+
/** Series order for categorical paint — hand this to an ordinal scale's
|
|
17
|
+
* range (`scaleOrdinal().range(chartSeriesRange)`). */
|
|
18
|
+
const chartSeriesRange = [
|
|
19
|
+
chartColors.ink,
|
|
20
|
+
chartColors.danger,
|
|
21
|
+
chartColors.success,
|
|
22
|
+
chartColors.warning,
|
|
23
|
+
chartColors.info
|
|
24
|
+
];
|
|
25
|
+
/** The quiet ink for grids, guides, and secondary marks. */
|
|
26
|
+
const chartHairline = "var(--bs-color-border)";
|
|
27
|
+
//#endregion
|
|
28
|
+
export { chartColors, chartHairline, chartSeriesRange, chartThemeCss, injectChartTheme };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { injectTokens } from "@bysages/core";
|
|
2
|
+
//#region src/theme.ts
|
|
3
|
+
/** Bridge the chart engine's surface variables onto the paper-and-ink
|
|
4
|
+
* tokens: its tooltip dresses like every other popup vessel, and its
|
|
5
|
+
* crosshair and focus takes the primary ink. The marks themselves carry
|
|
6
|
+
* tokens straight through paint attributes — var() resolves against the
|
|
7
|
+
* live theme, so mode, accent, and scene retune the ink with no redraw. */
|
|
8
|
+
const chartThemeCss = `
|
|
9
|
+
.ts-chart {
|
|
10
|
+
--ts-chart-tooltip-background: var(--bs-color-surface-2);
|
|
11
|
+
--ts-chart-tooltip-border: 1px solid var(--bs-color-border);
|
|
12
|
+
--ts-chart-tooltip-border-radius: var(--bs-radius-lg);
|
|
13
|
+
--ts-chart-tooltip-color: var(--bs-color-text-primary);
|
|
14
|
+
--ts-chart-tooltip-font: var(--bs-font-size-sm) / var(--bs-line-height-relaxed)
|
|
15
|
+
var(--bs-font-sans);
|
|
16
|
+
--ts-chart-tooltip-max-width: 18rem;
|
|
17
|
+
--ts-chart-tooltip-padding: var(--bs-space-2) var(--bs-space-3);
|
|
18
|
+
--ts-chart-tooltip-shadow: var(--bs-elevation-3);
|
|
19
|
+
--ts-chart-tooltip-active-row-background: var(--bs-color-surface-0);
|
|
20
|
+
--ts-chart-tooltip-active-row-border-radius: var(--bs-radius-sm);
|
|
21
|
+
--ts-chart-tooltip-active-row-font-weight: var(--bs-font-weight-medium);
|
|
22
|
+
--ts-chart-tooltip-active-row-shadow: none;
|
|
23
|
+
--ts-chart-crosshair-marker-fill: var(--bs-color-primary);
|
|
24
|
+
--ts-chart-crosshair-label-halo: var(--bs-color-surface-1);
|
|
25
|
+
--ts-chart-focus-fill: var(--bs-color-primary);
|
|
26
|
+
}
|
|
27
|
+
`;
|
|
28
|
+
let injected = false;
|
|
29
|
+
/** Inject the chart theme bridge (plus the token layer on first use).
|
|
30
|
+
* Idempotent; SSR is a no-op. */
|
|
31
|
+
function injectChartTheme() {
|
|
32
|
+
if (injected || typeof document === "undefined") return;
|
|
33
|
+
injectTokens();
|
|
34
|
+
const style = document.createElement("style");
|
|
35
|
+
style.dataset.bsStyles = "chart-theme";
|
|
36
|
+
style.textContent = chartThemeCss;
|
|
37
|
+
document.head.append(style);
|
|
38
|
+
injected = true;
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
41
|
+
export { injectChartTheme as n, chartThemeCss as t };
|
package/package.json
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@bysages/charts",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"description": "Token-themed charts for By Sages Elements — TanStack Charts dressed in the paper-and-ink system: one token bridge plus thin framework adapters",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"charts",
|
|
7
|
+
"components",
|
|
8
|
+
"data-visualization",
|
|
9
|
+
"dataviz",
|
|
10
|
+
"design-system",
|
|
11
|
+
"design-tokens",
|
|
12
|
+
"theming",
|
|
13
|
+
"ui",
|
|
14
|
+
"vue"
|
|
15
|
+
],
|
|
16
|
+
"homepage": "https://github.com/bysages/elements#readme",
|
|
17
|
+
"bugs": {
|
|
18
|
+
"url": "https://github.com/bysages/elements/issues"
|
|
19
|
+
},
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"author": {
|
|
22
|
+
"name": "By Sages",
|
|
23
|
+
"email": "contact@bysages.com",
|
|
24
|
+
"url": "https://www.bysages.com/"
|
|
25
|
+
},
|
|
26
|
+
"repository": {
|
|
27
|
+
"type": "git",
|
|
28
|
+
"url": "git+https://github.com/bysages/elements"
|
|
29
|
+
},
|
|
30
|
+
"files": [
|
|
31
|
+
"dist"
|
|
32
|
+
],
|
|
33
|
+
"type": "module",
|
|
34
|
+
"exports": {
|
|
35
|
+
".": {
|
|
36
|
+
"types": "./dist/index.d.mts",
|
|
37
|
+
"import": "./dist/index.mjs"
|
|
38
|
+
},
|
|
39
|
+
"./vue": {
|
|
40
|
+
"types": "./dist/vue/chart.d.mts",
|
|
41
|
+
"import": "./dist/vue/chart.mjs"
|
|
42
|
+
},
|
|
43
|
+
"./react": {
|
|
44
|
+
"types": "./dist/react/chart.d.mts",
|
|
45
|
+
"import": "./dist/react/chart.mjs"
|
|
46
|
+
},
|
|
47
|
+
"./solid": {
|
|
48
|
+
"types": "./dist/solid/chart.d.mts",
|
|
49
|
+
"import": "./dist/solid/chart.mjs"
|
|
50
|
+
},
|
|
51
|
+
"./svelte": {
|
|
52
|
+
"types": "./dist/svelte/chart.d.mts",
|
|
53
|
+
"import": "./dist/svelte/chart.mjs"
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"dependencies": {
|
|
57
|
+
"@tanstack/charts": "0.18.0",
|
|
58
|
+
"@bysages/core": "0.0.0"
|
|
59
|
+
},
|
|
60
|
+
"peerDependencies": {
|
|
61
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
62
|
+
"solid-js": ">=1.8",
|
|
63
|
+
"svelte": "^5.20.0",
|
|
64
|
+
"vue": "^3.5.0"
|
|
65
|
+
},
|
|
66
|
+
"peerDependenciesMeta": {
|
|
67
|
+
"react": {
|
|
68
|
+
"optional": true
|
|
69
|
+
},
|
|
70
|
+
"solid-js": {
|
|
71
|
+
"optional": true
|
|
72
|
+
},
|
|
73
|
+
"svelte": {
|
|
74
|
+
"optional": true
|
|
75
|
+
},
|
|
76
|
+
"vue": {
|
|
77
|
+
"optional": true
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
"devDependencies": {
|
|
81
|
+
"@sveltejs/vite-plugin-svelte": "7.3.0",
|
|
82
|
+
"rollup-plugin-svelte": "7.2.3",
|
|
83
|
+
"svelte": "5.57.0"
|
|
84
|
+
},
|
|
85
|
+
"scripts": {
|
|
86
|
+
"dev": "basis build --stub",
|
|
87
|
+
"build": "vp pack"
|
|
88
|
+
}
|
|
89
|
+
}
|