@tabler/charts-bootstrap 0.0.0-stage → 0.1.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.
@@ -0,0 +1,2 @@
1
+ /*! @tabler/charts-bootstrap, Tabler preset | MIT */
2
+ :where(:root,[data-bs-theme],[data-bs-theme-primary],[data-bs-theme-base],[data-bs-theme-font],[data-bs-theme-radius]){--tc-color-1:var(--tblr-primary,#066fd1);--tc-focus-color:var(--tblr-primary,#066fd1);--tc-surface:var(--tblr-bg-surface,#fff);--tc-text-color:var(--tblr-body-color,#0b0b0b);--tc-text-muted:var(--tblr-secondary,#6f6e69);--tc-grid-color:var(--tblr-border-color-translucent,#e1e0d9);--tc-baseline-color:var(--tblr-border-color,#c3c2b7);--tc-hover-color:rgba(var(--tblr-emphasis-color-rgb,11, 11, 11), .05);--tc-tooltip-bg:var(--tblr-tooltip-bg,#0b0b0b);--tc-tooltip-color:var(--tblr-tooltip-color,#fff);--tc-tooltip-muted:rgba(var(--tblr-body-bg-rgb,255, 255, 255), .7);--tc-tooltip-border:rgba(var(--tblr-body-bg-rgb,255, 255, 255), .12);--tc-tooltip-shadow:var(--tblr-box-shadow,0 4px 16px #0b0b0b1f);--tc-tooltip-radius:var(--tblr-border-radius,6px);--tc-font-family:var(--tblr-body-font-family,inherit)}
package/package.json CHANGED
@@ -1,6 +1,79 @@
1
1
  {
2
2
  "name": "@tabler/charts-bootstrap",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.0",
4
+ "description": "Bootstrap 5.3 and Tabler theme mapping (CSS and SCSS) and a data API for @tabler/charts.",
5
+ "keywords": [
6
+ "charts",
7
+ "svg",
8
+ "bootstrap",
9
+ "scss",
10
+ "tabler"
11
+ ],
12
+ "license": "MIT",
13
+ "author": "Paweł Kuna",
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+https://github.com/tabler/tabler-charts.git",
17
+ "directory": "packages/bootstrap"
18
+ },
19
+ "type": "module",
20
+ "sideEffects": [
21
+ "**/*.css",
22
+ "**/*.scss"
23
+ ],
24
+ "main": "./dist/index.cjs",
25
+ "module": "./dist/index.js",
26
+ "types": "./dist/index.d.ts",
27
+ "unpkg": "./dist/tabler-charts-bootstrap.min.js",
28
+ "jsdelivr": "./dist/tabler-charts-bootstrap.min.js",
29
+ "style": "./dist/bootstrap.css",
30
+ "exports": {
31
+ ".": {
32
+ "import": {
33
+ "types": "./dist/index.d.ts",
34
+ "default": "./dist/index.js"
35
+ },
36
+ "require": {
37
+ "types": "./dist/index.d.cts",
38
+ "default": "./dist/index.cjs"
39
+ }
40
+ },
41
+ "./bootstrap.css": "./dist/bootstrap.css",
42
+ "./tabler.css": "./dist/tabler.css",
43
+ "./scss/charts": {
44
+ "sass": "./scss/_charts.scss",
45
+ "default": "./scss/_charts.scss"
46
+ },
47
+ "./scss/tabler": {
48
+ "sass": "./scss/_tabler.scss",
49
+ "default": "./scss/_tabler.scss"
50
+ },
51
+ "./package.json": "./package.json"
52
+ },
53
+ "files": [
54
+ "dist",
55
+ "scss"
56
+ ],
57
+ "peerDependencies": {
58
+ "@tabler/charts": "^0.1.0",
59
+ "bootstrap": ">=5.3"
60
+ },
61
+ "peerDependenciesMeta": {
62
+ "bootstrap": {
63
+ "optional": true
64
+ }
65
+ },
66
+ "devDependencies": {
67
+ "@tabler/charts": "^0.1.0",
68
+ "sass": "^1.105.1"
69
+ },
70
+ "publishConfig": {
71
+ "access": "public"
72
+ },
73
+ "scripts": {
74
+ "build": "tsdown && node scripts/build-css.mjs",
75
+ "dev": "tsdown --watch",
76
+ "typecheck": "tsc -p .",
77
+ "lint:pkg": "publint && attw --pack . --profile node16 --exclude-entrypoints ./bootstrap.css ./tabler.css ./scss/charts ./scss/tabler"
78
+ }
6
79
  }
@@ -0,0 +1,92 @@
1
+ // @tabler/charts-bootstrap: map the chart tokens to Bootstrap 5.3 CSS variables.
2
+ //
3
+ // Load it after `@tabler/charts/style.css` (the plain CSS build is
4
+ // `@tabler/charts-bootstrap/bootstrap.css`). Charts then use the body font and
5
+ // colors, borders, radius and shadow of your theme, the first series takes
6
+ // `primary`, and `data-bs-theme="dark"` switches them with the rest of the page.
7
+ //
8
+ // Override any variable before importing, e.g. in your Bootstrap build:
9
+ //
10
+ // $tc-series-1: var(--#{$prefix}success);
11
+ // @import "@tabler/charts-bootstrap/scss/charts";
12
+
13
+ // Bootstrap's CSS variable prefix (`$prefix` in Bootstrap's own variables).
14
+ $tc-prefix: "bs-" !default;
15
+ // The attribute that selects the color mode, and every element whose
16
+ // attributes can change the variables the mapping reads.
17
+ $tc-theme-attribute: "data-#{$tc-prefix}theme" !default;
18
+ $tc-theme-scopes: ":root, [#{$tc-theme-attribute}]" !default;
19
+
20
+ // Tokens read from the theme. The fallbacks are the chart defaults, so charts
21
+ // still render if a variable is missing (e.g. Bootstrap < 5.3).
22
+ $tc-series-1: var(--#{$tc-prefix}primary, #2a78d6) !default;
23
+ $tc-surface: var(--#{$tc-prefix}body-bg, #fff) !default;
24
+ $tc-text-color: var(--#{$tc-prefix}body-color, #0b0b0b) !default;
25
+ $tc-text-muted: var(--#{$tc-prefix}secondary-color, #6f6e69) !default;
26
+ $tc-grid-color: var(--#{$tc-prefix}border-color-translucent, #e1e0d9) !default;
27
+ $tc-baseline-color: var(--#{$tc-prefix}border-color, #c3c2b7) !default;
28
+ $tc-hover-color: rgba(var(--#{$tc-prefix}emphasis-color-rgb, 11, 11, 11), 0.05) !default;
29
+ // The tooltip takes Bootstrap's tooltip colors: the emphasis color on the body background.
30
+ $tc-tooltip-bg: var(--#{$tc-prefix}emphasis-color, #0b0b0b) !default;
31
+ $tc-tooltip-color: var(--#{$tc-prefix}body-bg, #fff) !default;
32
+ $tc-tooltip-muted: rgba(var(--#{$tc-prefix}body-bg-rgb, 255, 255, 255), 0.7) !default;
33
+ $tc-tooltip-border: rgba(var(--#{$tc-prefix}body-bg-rgb, 255, 255, 255), 0.12) !default;
34
+ $tc-tooltip-shadow: var(--#{$tc-prefix}box-shadow, 0 4px 16px rgb(11 11 11 / 12%)) !default;
35
+ $tc-tooltip-radius: var(--#{$tc-prefix}border-radius, 6px) !default;
36
+ $tc-font-family: var(--#{$tc-prefix}body-font-family, inherit) !default;
37
+
38
+ // Series 2–8 keep the chart palette, validated for color-vision deficiency
39
+ // next to any blue primary; Bootstrap's own orange / yellow / pink are not.
40
+ $tc-palette-light: (
41
+ 2: #eb6834,
42
+ 3: #1baf7a,
43
+ 4: #eda100,
44
+ 5: #e87ba4,
45
+ 6: #008300,
46
+ 7: #4a3aa7,
47
+ 8: #e34948,
48
+ ) !default;
49
+ $tc-palette-dark: (
50
+ 2: #d95926,
51
+ 3: #199e70,
52
+ 4: #c98500,
53
+ 5: #d55181,
54
+ 6: #008300,
55
+ 7: #9085e9,
56
+ 8: #e66767,
57
+ ) !default;
58
+
59
+ // Custom properties are resolved where they are declared, so the mapping is
60
+ // repeated on every element that sets a theme, not only on :root.
61
+ :where(#{$tc-theme-scopes}) {
62
+ --tc-color-1: #{$tc-series-1};
63
+ --tc-focus-color: #{$tc-series-1};
64
+ --tc-surface: #{$tc-surface};
65
+ --tc-text-color: #{$tc-text-color};
66
+ --tc-text-muted: #{$tc-text-muted};
67
+ --tc-grid-color: #{$tc-grid-color};
68
+ --tc-baseline-color: #{$tc-baseline-color};
69
+ --tc-hover-color: #{$tc-hover-color};
70
+ --tc-tooltip-bg: #{$tc-tooltip-bg};
71
+ --tc-tooltip-color: #{$tc-tooltip-color};
72
+ --tc-tooltip-muted: #{$tc-tooltip-muted};
73
+ --tc-tooltip-border: #{$tc-tooltip-border};
74
+ --tc-tooltip-shadow: #{$tc-tooltip-shadow};
75
+ --tc-tooltip-radius: #{$tc-tooltip-radius};
76
+ --tc-font-family: #{$tc-font-family};
77
+ }
78
+
79
+ // Bootstrap picks the theme with data-bs-theme, not with the OS setting, so
80
+ // the palette follows the attribute (this also overrides the chart
81
+ // stylesheet's prefers-color-scheme defaults).
82
+ :where(:root, [#{$tc-theme-attribute}="light"]) {
83
+ @each $slot, $color in $tc-palette-light {
84
+ --tc-color-#{$slot}: #{$color};
85
+ }
86
+ }
87
+
88
+ :where([#{$tc-theme-attribute}="dark"]) {
89
+ @each $slot, $color in $tc-palette-dark {
90
+ --tc-color-#{$slot}: #{$color};
91
+ }
92
+ }
@@ -0,0 +1,28 @@
1
+ // @tabler/charts-bootstrap Tabler preset: the Bootstrap mapping with Tabler's
2
+ // variables. Tabler keeps Bootstrap's color-mode attribute (data-bs-theme)
3
+ // but prefixes its variables with `tblr-`, and sets its theme options
4
+ // (data-bs-theme-primary, -base, -font, -radius) as attributes too.
5
+ //
6
+ // The chart stylesheet already reads --tblr-* variables (with its own colors
7
+ // as fallbacks), so on a Tabler page this preset only adds the theme-option
8
+ // scopes: the mapping is declared again on every element that carries a
9
+ // data-bs-theme-* attribute, so a subtree with its own primary color or
10
+ // radius gets it. Series 2–8 are left to the chart stylesheet, which uses
11
+ // Tabler's named colors. Load it after `@tabler/charts/style.css`; the plain
12
+ // CSS build is `@tabler/charts-bootstrap/tabler.css`.
13
+ //
14
+ // @use "@tabler/charts-bootstrap/scss/tabler";
15
+ // @use "@tabler/charts-bootstrap/scss/tabler" with ($tc-series-1: var(--tblr-green));
16
+
17
+ @forward "charts" with (
18
+ $tc-prefix: "tblr-" !default,
19
+ $tc-theme-attribute: "data-bs-theme" !default,
20
+ $tc-theme-scopes: ":root, [data-bs-theme], [data-bs-theme-primary], [data-bs-theme-base], [data-bs-theme-font], [data-bs-theme-radius]" !default,
21
+ $tc-series-1: var(--tblr-primary, #066fd1) !default,
22
+ $tc-surface: var(--tblr-bg-surface, #fff) !default,
23
+ $tc-tooltip-bg: var(--tblr-tooltip-bg, #0b0b0b) !default,
24
+ $tc-tooltip-color: var(--tblr-tooltip-color, #fff) !default,
25
+ $tc-text-muted: var(--tblr-secondary, #6f6e69) !default,
26
+ $tc-palette-light: () !default,
27
+ $tc-palette-dark: () !default
28
+ );