@blueprint-chart/lib 1.6.0 → 1.8.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,84 @@
1
+ //#region src/runtime/chart-css.ts
2
+ var e = "blueprint-chart-resize", t = "blueprint-chart-error";
3
+ function n(e) {
4
+ return typeof e == "object" && e && e.type === "blueprint-chart-resize" && typeof e.height == "number" ? e.height : null;
5
+ }
6
+ function r(e) {
7
+ return typeof e == "object" && !!e && e.type === "blueprint-chart-error";
8
+ }
9
+ //#endregion
10
+ //#region src/runtime/runtime.ts
11
+ var i = a();
12
+ function a() {
13
+ try {
14
+ if (typeof globalThis < "u") {
15
+ let e = globalThis.BLUEPRINT_CHART_RUNTIME_URL;
16
+ if (typeof e == "string" && e) return e;
17
+ }
18
+ return typeof document > "u" ? "" : document.currentScript?.src ?? "";
19
+ } catch {
20
+ return "";
21
+ }
22
+ }
23
+ var o = /* @__PURE__ */ new Map(), s = null;
24
+ function c() {
25
+ s || (s = (e) => {
26
+ for (let [t, n] of o) if (e.source === t.contentWindow) {
27
+ n(e);
28
+ return;
29
+ }
30
+ }, window.addEventListener("message", s));
31
+ }
32
+ function l() {
33
+ c(), document.querySelectorAll("script[type=\"application/blueprint-chart\"]").forEach(u);
34
+ }
35
+ function u(e) {
36
+ let t = e.textContent?.trim();
37
+ if (!t) return;
38
+ let a = document.createElement("iframe");
39
+ a.className = "blueprint-chart-iframe", a.style.cssText = "border: none; width: 100%; display: block;", a.setAttribute("sandbox", "allow-scripts"), a.setAttribute("title", "Blueprint Chart"), e.parentNode?.insertBefore(a, e), a.srcdoc = d(t, i), o.set(a, (e) => {
40
+ let t = n(e.data);
41
+ if (t !== null) {
42
+ a.style.height = `${t}px`;
43
+ return;
44
+ }
45
+ r(e.data) && console.warn("Blueprint Chart: could not render embed.", e.data.message);
46
+ });
47
+ }
48
+ function d(n, r, i) {
49
+ let a = r ? `<script src="${p(r)}"><\/script>` : "", o = i === "dark" ? "<html data-bs-theme=\"dark\">" : "<html>", s = r ? [
50
+ "try {",
51
+ " window.BlueprintChart.renderBpc(document.getElementById(\"chart\"), __BPC_SRC__);",
52
+ "}",
53
+ "catch (e) {",
54
+ ` parent.postMessage({ type: "${t}", message: String(e) }, "*");`,
55
+ "}"
56
+ ] : [`parent.postMessage({ type: "${t}", message: "Blueprint Chart runtime URL unavailable" }, "*");`];
57
+ return [
58
+ "<!DOCTYPE html>",
59
+ `${o}<head>`,
60
+ "<style>\n/* Blueprint Chart — Runtime Embed Styles\n CSS custom properties with baked-in defaults for standalone iframe usage. */\n\n.bc-frame {\n --bc-frame-font-family: system-ui, -apple-system, sans-serif;\n --bc-frame-padding: 0;\n --bc-frame-bg: #fff;\n --bc-text-color: #333;\n font-family: var(--bc-frame-font-family);\n background: var(--bc-frame-bg);\n /* currentColor marks (e.g. above-bar value labels) follow the theme text\n colour, not the ambient document colour. */\n color: var(--bc-text-color, #333);\n}\n\n/* Keeps the SVG's baked-in background rect (applyCanvasBackground) in sync\n with the frame background; transparentBackground sets the var to\n transparent at runtime. */\n.bc-frame .bc-canvas-bg {\n fill: var(--bc-frame-bg, #fff);\n}\n\n.bc-frame-header {\n padding: var(--bc-frame-padding) var(--bc-frame-padding) 0;\n background: var(--bc-frame-header-bg, transparent);\n border-bottom: var(--bc-frame-header-border-bottom, none);\n margin-bottom: var(--bc-frame-header-margin-bottom, 0);\n}\n\n.bc-frame-body {\n padding: 0 var(--bc-frame-padding);\n}\n\n.bc-frame-title {\n --bc-frame-title-color: var(--bc-text-color, #333);\n --bc-frame-title-font-size: 1.25rem;\n color: var(--bc-frame-title-color);\n font-size: var(--bc-frame-title-font-size);\n font-weight: bold;\n margin: 0;\n}\n\n.bc-frame-description {\n --bc-frame-description-color: var(--bc-text-color, #555);\n --bc-frame-description-font-size: 0.875rem;\n color: var(--bc-frame-description-color);\n font-size: var(--bc-frame-description-font-size);\n margin: 0.25rem 0 0;\n}\n\n.bc-frame-footer {\n margin-top: 0.5rem;\n gap: 0.25rem 1rem;\n padding: var(--bc-frame-footer-padding-top, 0) var(--bc-frame-padding) var(--bc-frame-padding);\n background: var(--bc-frame-footer-bg, transparent);\n border-top: var(--bc-frame-footer-border-top, none);\n}\n\n.bc-frame-footer-left {\n display: flex;\n align-items: baseline;\n flex-wrap: wrap;\n gap: 0.25rem 0.75rem;\n}\n\n.bc-frame-footer-left > :not(:first-child)::before {\n content: \"\\00B7\";\n margin-right: 0.5rem;\n color: var(--bc-text-color, #888);\n}\n\n.bc-frame-footer-right {\n display: flex;\n align-items: center;\n}\n\n.bc-frame-note {\n --bc-frame-note-color: var(--bc-text-color, #888);\n --bc-frame-note-font-size: 0.75rem;\n font-style: italic;\n color: var(--bc-frame-note-color);\n font-size: var(--bc-frame-note-font-size);\n margin: 0;\n padding: 0 var(--bc-frame-padding);\n}\n\n.bc-frame-byline,\n.bc-frame-source {\n --bc-frame-meta-color: var(--bc-text-color, #888);\n --bc-frame-meta-font-size: 0.75rem;\n color: var(--bc-frame-meta-color);\n font-size: var(--bc-frame-meta-font-size);\n}\n\n.bc-frame-credit {\n --bc-frame-credit-color: var(--bc-text-color, #666);\n --bc-frame-credit-font-size: 0.75rem;\n color: var(--bc-frame-credit-color);\n font-size: var(--bc-frame-credit-font-size);\n font-weight: 600;\n display: inline-flex;\n align-items: center;\n text-decoration: none;\n}\n\n.bc-frame-source-link {\n color: inherit;\n text-decoration: underline;\n}\n\n.bc-axis .domain {\n stroke: var(--bc-axis-color, #333);\n}\n\n.bc-axis .tick text {\n fill: var(--bc-axis-color, #333);\n font-size: 10px;\n}\n\n.bc-axis .tick line {\n stroke: var(--bc-axis-color, #333);\n}\n\n.bc-grid-line {\n stroke: var(--bc-grid-color, #e0e0e0);\n stroke-width: 1;\n}\n\n.bc-zero-baseline {\n stroke: #666;\n stroke-width: 1;\n}\n\n.bc-bar {\n /* fill is set via D3 .attr() from data-bound colors — do not override */\n}\n\n.bc-line {\n fill: none;\n stroke-width: 2;\n}\n\n.bc-value-label {\n font-size: 11px;\n /* fill is set via D3 .attr() — do not override */\n}\n\n.bc-direct-label {\n font-size: 12px;\n font-weight: 600;\n}\n\n.bc-tooltip {\n position: absolute;\n pointer-events: none;\n background: var(--bc-tooltip-bg, #fff);\n color: var(--bc-tooltip-color, #212529);\n border: 1px solid var(--bc-tooltip-border-color, #dee2e6);\n border-radius: 4px;\n padding: 6px 10px;\n font-size: 13px;\n box-shadow: 0 2px 8px rgba(0,0,0,0.12);\n z-index: 9999;\n display: none;\n}\n\n.bc-crosshair {\n stroke: #999;\n stroke-width: 1;\n pointer-events: none;\n}\n\n.bc-arc-label-line {\n fill: none;\n stroke: #999;\n stroke-width: 1;\n}\n\n.bc-theme-blueprint-framed {\n --bc-frame-header-border-bottom: 1px solid #e0e0e0;\n --bc-frame-header-margin-bottom: 0.5rem;\n --bc-frame-footer-bg: #f8f8f8;\n --bc-frame-footer-border-top: 1px solid #e0e0e0;\n --bc-frame-footer-padding-top: 0.625rem;\n}\n\n[data-bs-theme=\"dark\"] .bc-frame.bc-theme-blueprint-bold {\n --bc-frame-bg: #000000;\n --bc-text-color: rgba(255, 255, 255, 0.95);\n --bc-axis-color: rgba(255, 255, 255, 0.7);\n --bc-grid-color: rgba(255, 255, 255, 0.12);\n}\n\n.blueprint-chart-error {\n color: red;\n padding: 1em;\n border: 1px solid red;\n}\n\nbody {\n margin: 0;\n overflow: hidden;\n}\n\n/* Dark theme: activated by data-bs-theme=\"dark\" on the document (matching the\n editor's convention). The chart owns these colors; the dark frame background\n also drives the renderer's resolveBackgroundColor, so data-mark colors and\n contrast labels adapt at render time. Scoped to .bc-frame so these override\n the frame's own light --bc-frame-bg / --bc-text-color declarations (which are\n set on .bc-frame and would otherwise shadow a document-level override). */\n[data-bs-theme=\"dark\"] body {\n /* color themes above-bar value labels (fill: currentColor). */\n background: #1c1c1c;\n color: rgba(255, 255, 255, 0.9);\n}\n\n[data-bs-theme=\"dark\"] .bc-frame {\n --bc-frame-bg: #1c1c1c;\n --bc-text-color: rgba(255, 255, 255, 0.9);\n --bc-axis-color: rgba(255, 255, 255, 0.6);\n --bc-grid-color: #333;\n\n color: rgba(255, 255, 255, 0.9);\n}\n</style>",
61
+ "</head><body>",
62
+ "<div id=\"chart\" class=\"blueprint-chart-container\"></div>",
63
+ a,
64
+ "<script>",
65
+ `var __BPC_SRC__ = ${f(n)};`,
66
+ "function notifySize() {",
67
+ " var h = document.documentElement.scrollHeight;",
68
+ ` parent.postMessage({ type: "${e}", height: h }, "*");`,
69
+ "}",
70
+ ...s,
71
+ "notifySize();",
72
+ "new ResizeObserver(notifySize).observe(document.body);",
73
+ "<\/script>",
74
+ "</body></html>"
75
+ ].filter(Boolean).join("\n");
76
+ }
77
+ function f(e) {
78
+ return JSON.stringify(e).replace(/</g, "\\u003c").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
79
+ }
80
+ function p(e) {
81
+ return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
82
+ }
83
+ //#endregion
84
+ export { r as a, e as i, l as n, n as o, t as r, d as t };
package/dist/runtime.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export * from './runtime/index'
1
+ export * from './runtime/index.js'
2
2
  export {}
package/dist/runtime.js CHANGED
@@ -1,52 +1,49 @@
1
- import { i as p } from "./embed-D0WZKRQq.js";
2
- import { r as b } from "./render-bpc-CwYPC-oi.js";
3
- function h(m, e, s) {
4
- let t = 0, c = !1;
5
- const n = document.createElement("nav");
6
- n.className = "blueprint-chart-scenes";
7
- const o = document.createElement("button");
8
- o.className = "blueprint-chart-scenes-prev", o.textContent = "Previous";
9
- const a = document.createElement("button");
10
- a.className = "blueprint-chart-scenes-next", a.textContent = "Next";
11
- const l = document.createElement("span");
12
- l.className = "blueprint-chart-scenes-counter", n.appendChild(o), n.appendChild(l), n.appendChild(a), e.length > 0 && m.appendChild(n);
13
- function u() {
14
- if (e.length === 0) {
15
- l.textContent = "";
16
- return;
17
- }
18
- l.textContent = `${t + 1} / ${e.length}`;
19
- }
20
- function r(d) {
21
- if (c || e.length === 0 || !Number.isFinite(d))
22
- return;
23
- const i = (Math.floor(d) % e.length + e.length) % e.length;
24
- t = i, u(), s(e[i], i);
25
- }
26
- return o.addEventListener("click", () => r(t - 1)), a.addEventListener("click", () => r(t + 1)), u(), {
27
- get currentScene() {
28
- return t;
29
- },
30
- get totalScenes() {
31
- return e.length;
32
- },
33
- next() {
34
- r(t + 1);
35
- },
36
- previous() {
37
- r(t - 1);
38
- },
39
- goTo: r,
40
- destroy() {
41
- c || (c = !0, n.remove());
42
- }
43
- };
1
+ import { t as e } from "./render-bpc-Bp2OTJmu.js";
2
+ import { n as t } from "./runtime-BnrDRLyH.js";
3
+ //#region src/runtime/scenes.ts
4
+ function n(e, t, n) {
5
+ let r = 0, i = !1, a = document.createElement("nav");
6
+ a.className = "blueprint-chart-scenes";
7
+ let o = document.createElement("button");
8
+ o.className = "blueprint-chart-scenes-prev", o.textContent = "Previous";
9
+ let s = document.createElement("button");
10
+ s.className = "blueprint-chart-scenes-next", s.textContent = "Next";
11
+ let c = document.createElement("span");
12
+ c.className = "blueprint-chart-scenes-counter", a.appendChild(o), a.appendChild(c), a.appendChild(s), t.length > 0 && e.appendChild(a);
13
+ function l() {
14
+ if (t.length === 0) {
15
+ c.textContent = "";
16
+ return;
17
+ }
18
+ c.textContent = `${r + 1} / ${t.length}`;
19
+ }
20
+ function u(e) {
21
+ if (i || t.length === 0 || !Number.isFinite(e)) return;
22
+ let a = (Math.floor(e) % t.length + t.length) % t.length;
23
+ r = a, l(), n(t[a], a);
24
+ }
25
+ return o.addEventListener("click", () => u(r - 1)), s.addEventListener("click", () => u(r + 1)), l(), {
26
+ get currentScene() {
27
+ return r;
28
+ },
29
+ get totalScenes() {
30
+ return t.length;
31
+ },
32
+ next() {
33
+ u(r + 1);
34
+ },
35
+ previous() {
36
+ u(r - 1);
37
+ },
38
+ goTo: u,
39
+ destroy() {
40
+ i || (i = !0, a.remove());
41
+ }
42
+ };
44
43
  }
45
- const C = h;
46
- document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", p) : p();
47
- export {
48
- h as createSceneController,
49
- C as createStepController,
50
- p as initBlueprint,
51
- b as renderBpc
52
- };
44
+ var r = n;
45
+ //#endregion
46
+ //#region src/runtime/index.ts
47
+ document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", t) : t();
48
+ //#endregion
49
+ export { n as createSceneController, r as createStepController, t as initBlueprint, e as renderBpc };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blueprint-chart/lib",
3
- "version": "1.6.0",
3
+ "version": "1.8.0",
4
4
  "description": "DSL-driven charting library built on D3. Define charts as text, render them anywhere.",
5
5
  "keywords": [
6
6
  "chart",
@@ -62,25 +62,25 @@
62
62
  "provenance": true
63
63
  },
64
64
  "dependencies": {
65
- "@floating-ui/dom": "^1.7.5",
65
+ "@floating-ui/dom": "^1.8.0",
66
66
  "chroma-js": "^3.2.0",
67
- "d3": "^7",
67
+ "d3": "^7.9.0",
68
68
  "d3-blueprint": "^0.1.7",
69
- "d3-transition": "^3",
70
- "dayjs": "^1.11.19"
69
+ "d3-transition": "^3.0.1",
70
+ "dayjs": "^1.11.21"
71
71
  },
72
72
  "devDependencies": {
73
73
  "@types/chroma-js": "^3.1.2",
74
- "@types/d3": "^7",
74
+ "@types/d3": "^7.4.3",
75
75
  "@types/jsdom": "^21.1.7",
76
- "peggy": "^4",
77
- "typescript": "^5.7",
78
- "vite": "^6",
79
- "vite-plugin-dts": "^5.0.0",
80
- "vitest": "^3"
76
+ "peggy": "^5.1.0",
77
+ "typescript": "^5.9.3",
78
+ "vite": "^8.2.1",
79
+ "vite-plugin-dts": "^5.0.3",
80
+ "vitest": "^4.1.10"
81
81
  },
82
82
  "optionalDependencies": {
83
- "@napi-rs/canvas": "^0.1.100",
83
+ "@napi-rs/canvas": "^1.0.3",
84
84
  "@resvg/resvg-js": "^2.6.2",
85
85
  "jsdom": "^26.1.0"
86
86
  },
@@ -1,325 +0,0 @@
1
- const f = `
2
- /* Blueprint Chart — Runtime Embed Styles
3
- CSS custom properties with baked-in defaults for standalone iframe usage. */
4
-
5
- .bc-frame {
6
- --bc-frame-font-family: system-ui, -apple-system, sans-serif;
7
- --bc-frame-padding: 0;
8
- --bc-frame-bg: #fff;
9
- --bc-text-color: #333;
10
- font-family: var(--bc-frame-font-family);
11
- background: var(--bc-frame-bg);
12
- /* currentColor marks (e.g. above-bar value labels) follow the theme text
13
- colour, not the ambient document colour. */
14
- color: var(--bc-text-color, #333);
15
- }
16
-
17
- /* Keeps the SVG's baked-in background rect (applyCanvasBackground) in sync
18
- with the frame background; transparentBackground sets the var to
19
- transparent at runtime. */
20
- .bc-frame .bc-canvas-bg {
21
- fill: var(--bc-frame-bg, #fff);
22
- }
23
-
24
- .bc-frame-header {
25
- padding: var(--bc-frame-padding) var(--bc-frame-padding) 0;
26
- background: var(--bc-frame-header-bg, transparent);
27
- border-bottom: var(--bc-frame-header-border-bottom, none);
28
- margin-bottom: var(--bc-frame-header-margin-bottom, 0);
29
- }
30
-
31
- .bc-frame-body {
32
- padding: 0 var(--bc-frame-padding);
33
- }
34
-
35
- .bc-frame-title {
36
- --bc-frame-title-color: var(--bc-text-color, #333);
37
- --bc-frame-title-font-size: 1.25rem;
38
- color: var(--bc-frame-title-color);
39
- font-size: var(--bc-frame-title-font-size);
40
- font-weight: bold;
41
- margin: 0;
42
- }
43
-
44
- .bc-frame-description {
45
- --bc-frame-description-color: var(--bc-text-color, #555);
46
- --bc-frame-description-font-size: 0.875rem;
47
- color: var(--bc-frame-description-color);
48
- font-size: var(--bc-frame-description-font-size);
49
- margin: 0.25rem 0 0;
50
- }
51
-
52
- .bc-frame-footer {
53
- margin-top: 0.5rem;
54
- gap: 0.25rem 1rem;
55
- padding: var(--bc-frame-footer-padding-top, 0) var(--bc-frame-padding) var(--bc-frame-padding);
56
- background: var(--bc-frame-footer-bg, transparent);
57
- border-top: var(--bc-frame-footer-border-top, none);
58
- }
59
-
60
- .bc-frame-footer-left {
61
- display: flex;
62
- align-items: baseline;
63
- flex-wrap: wrap;
64
- gap: 0.25rem 0.75rem;
65
- }
66
-
67
- .bc-frame-footer-left > :not(:first-child)::before {
68
- content: "\\00B7";
69
- margin-right: 0.5rem;
70
- color: var(--bc-text-color, #888);
71
- }
72
-
73
- .bc-frame-footer-right {
74
- display: flex;
75
- align-items: center;
76
- }
77
-
78
- .bc-frame-note {
79
- --bc-frame-note-color: var(--bc-text-color, #888);
80
- --bc-frame-note-font-size: 0.75rem;
81
- font-style: italic;
82
- color: var(--bc-frame-note-color);
83
- font-size: var(--bc-frame-note-font-size);
84
- margin: 0;
85
- padding: 0 var(--bc-frame-padding);
86
- }
87
-
88
- .bc-frame-byline,
89
- .bc-frame-source {
90
- --bc-frame-meta-color: var(--bc-text-color, #888);
91
- --bc-frame-meta-font-size: 0.75rem;
92
- color: var(--bc-frame-meta-color);
93
- font-size: var(--bc-frame-meta-font-size);
94
- }
95
-
96
- .bc-frame-credit {
97
- --bc-frame-credit-color: var(--bc-text-color, #666);
98
- --bc-frame-credit-font-size: 0.75rem;
99
- color: var(--bc-frame-credit-color);
100
- font-size: var(--bc-frame-credit-font-size);
101
- font-weight: 600;
102
- display: inline-flex;
103
- align-items: center;
104
- text-decoration: none;
105
- }
106
-
107
- .bc-frame-source-link {
108
- color: inherit;
109
- text-decoration: underline;
110
- }
111
-
112
- .bc-axis .domain {
113
- stroke: var(--bc-axis-color, #333);
114
- }
115
-
116
- .bc-axis .tick text {
117
- fill: var(--bc-axis-color, #333);
118
- font-size: 10px;
119
- }
120
-
121
- .bc-axis .tick line {
122
- stroke: var(--bc-axis-color, #333);
123
- }
124
-
125
- .bc-grid-line {
126
- stroke: var(--bc-grid-color, #e0e0e0);
127
- stroke-width: 1;
128
- }
129
-
130
- .bc-zero-baseline {
131
- stroke: #666;
132
- stroke-width: 1;
133
- }
134
-
135
- .bc-bar {
136
- /* fill is set via D3 .attr() from data-bound colors — do not override */
137
- }
138
-
139
- .bc-line {
140
- fill: none;
141
- stroke-width: 2;
142
- }
143
-
144
- .bc-value-label {
145
- font-size: 11px;
146
- /* fill is set via D3 .attr() — do not override */
147
- }
148
-
149
- .bc-direct-label {
150
- font-size: 12px;
151
- font-weight: 600;
152
- }
153
-
154
- .bc-tooltip {
155
- position: absolute;
156
- pointer-events: none;
157
- background: var(--bc-tooltip-bg, #fff);
158
- color: var(--bc-tooltip-color, #212529);
159
- border: 1px solid var(--bc-tooltip-border-color, #dee2e6);
160
- border-radius: 4px;
161
- padding: 6px 10px;
162
- font-size: 13px;
163
- box-shadow: 0 2px 8px rgba(0,0,0,0.12);
164
- z-index: 9999;
165
- display: none;
166
- }
167
-
168
- .bc-crosshair {
169
- stroke: #999;
170
- stroke-width: 1;
171
- pointer-events: none;
172
- }
173
-
174
- .bc-arc-label-line {
175
- fill: none;
176
- stroke: #999;
177
- stroke-width: 1;
178
- }
179
-
180
- .bc-theme-blueprint-framed {
181
- --bc-frame-header-border-bottom: 1px solid #e0e0e0;
182
- --bc-frame-header-margin-bottom: 0.5rem;
183
- --bc-frame-footer-bg: #f8f8f8;
184
- --bc-frame-footer-border-top: 1px solid #e0e0e0;
185
- --bc-frame-footer-padding-top: 0.625rem;
186
- }
187
-
188
- [data-bs-theme="dark"] .bc-frame.bc-theme-blueprint-bold {
189
- --bc-frame-bg: #000000;
190
- --bc-text-color: rgba(255, 255, 255, 0.95);
191
- --bc-axis-color: rgba(255, 255, 255, 0.7);
192
- --bc-grid-color: rgba(255, 255, 255, 0.12);
193
- }
194
-
195
- .blueprint-chart-error {
196
- color: red;
197
- padding: 1em;
198
- border: 1px solid red;
199
- }
200
-
201
- body {
202
- margin: 0;
203
- overflow: hidden;
204
- }
205
-
206
- /* Dark theme: activated by data-bs-theme="dark" on the document (matching the
207
- editor's convention). The chart owns these colors; the dark frame background
208
- also drives the renderer's resolveBackgroundColor, so data-mark colors and
209
- contrast labels adapt at render time. Scoped to .bc-frame so these override
210
- the frame's own light --bc-frame-bg / --bc-text-color declarations (which are
211
- set on .bc-frame and would otherwise shadow a document-level override). */
212
- [data-bs-theme="dark"] body {
213
- /* color themes above-bar value labels (fill: currentColor). */
214
- background: #1c1c1c;
215
- color: rgba(255, 255, 255, 0.9);
216
- }
217
-
218
- [data-bs-theme="dark"] .bc-frame {
219
- --bc-frame-bg: #1c1c1c;
220
- --bc-text-color: rgba(255, 255, 255, 0.9);
221
- --bc-axis-color: rgba(255, 255, 255, 0.6);
222
- --bc-grid-color: #333;
223
-
224
- color: rgba(255, 255, 255, 0.9);
225
- }
226
- `, b = "blueprint-chart-resize", s = "blueprint-chart-error";
227
- function m(e) {
228
- return typeof e == "object" && e !== null && e.type === b && typeof e.height == "number" ? e.height : null;
229
- }
230
- function p(e) {
231
- return typeof e == "object" && e !== null && e.type === s;
232
- }
233
- const g = u();
234
- function u() {
235
- var e;
236
- try {
237
- if (typeof globalThis < "u") {
238
- const r = globalThis.BLUEPRINT_CHART_RUNTIME_URL;
239
- if (typeof r == "string" && r)
240
- return r;
241
- }
242
- return typeof document > "u" ? "" : ((e = document.currentScript) == null ? void 0 : e.src) ?? "";
243
- } catch {
244
- return "";
245
- }
246
- }
247
- const d = /* @__PURE__ */ new Map();
248
- let i = null;
249
- function h() {
250
- i || (i = (e) => {
251
- for (const [r, t] of d)
252
- if (e.source === r.contentWindow) {
253
- t(e);
254
- return;
255
- }
256
- }, window.addEventListener("message", i));
257
- }
258
- function w() {
259
- h(), document.querySelectorAll(
260
- 'script[type="application/blueprint-chart"]'
261
- ).forEach(v);
262
- }
263
- function v(e) {
264
- var o, a;
265
- const r = (o = e.textContent) == null ? void 0 : o.trim();
266
- if (!r)
267
- return;
268
- const t = document.createElement("iframe");
269
- t.className = "blueprint-chart-iframe", t.style.cssText = "border: none; width: 100%; display: block;", t.setAttribute("sandbox", "allow-scripts"), t.setAttribute("title", "Blueprint Chart"), (a = e.parentNode) == null || a.insertBefore(t, e), t.srcdoc = x(r, g);
270
- const c = (n) => {
271
- const l = m(n.data);
272
- if (l !== null) {
273
- t.style.height = `${l}px`;
274
- return;
275
- }
276
- p(n.data) && console.warn("Blueprint Chart: could not render embed.", n.data.message);
277
- };
278
- d.set(t, c);
279
- }
280
- function x(e, r, t) {
281
- const c = r ? `<script src="${k(r)}"><\/script>` : "", o = t === "dark" ? '<html data-bs-theme="dark">' : "<html>", a = r ? [
282
- "try {",
283
- ' window.BlueprintChart.renderBpc(document.getElementById("chart"), __BPC_SRC__);',
284
- "}",
285
- "catch (e) {",
286
- ` parent.postMessage({ type: "${s}", message: String(e) }, "*");`,
287
- "}"
288
- ] : [
289
- `parent.postMessage({ type: "${s}", message: "Blueprint Chart runtime URL unavailable" }, "*");`
290
- ];
291
- return [
292
- "<!DOCTYPE html>",
293
- `${o}<head>`,
294
- `<style>${f}</style>`,
295
- "</head><body>",
296
- '<div id="chart" class="blueprint-chart-container"></div>',
297
- c,
298
- "<script>",
299
- `var __BPC_SRC__ = ${y(e)};`,
300
- "function notifySize() {",
301
- " var h = document.documentElement.scrollHeight;",
302
- ` parent.postMessage({ type: "${b}", height: h }, "*");`,
303
- "}",
304
- ...a,
305
- "notifySize();",
306
- "new ResizeObserver(notifySize).observe(document.body);",
307
- "<\/script>",
308
- "</body></html>"
309
- ].filter(Boolean).join(`
310
- `);
311
- }
312
- function y(e) {
313
- return JSON.stringify(e).replace(/</g, "\\u003c").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
314
- }
315
- function k(e) {
316
- return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
317
- }
318
- export {
319
- s as E,
320
- b as R,
321
- p as a,
322
- x as b,
323
- w as i,
324
- m as r
325
- };
@@ -1,8 +0,0 @@
1
- class s extends Error {
2
- constructor(r) {
3
- super(r), this.name = "MissingNodeRenderDepsError";
4
- }
5
- }
6
- export {
7
- s as M
8
- };