@blueprint-chart/lib 1.1.0 → 1.3.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/dist/embed-DxKuPk6P.js +315 -0
- package/dist/embed.d.ts +3 -0
- package/dist/embed.js +8 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +622 -6812
- package/dist/lib/lib.iife.js +77 -3
- package/dist/render-bpc-CnZB0sa5.js +6278 -0
- package/dist/runtime/chart-css.d.ts +1 -1
- package/dist/runtime/index.d.ts +1 -0
- package/dist/runtime/messages.d.ts +10 -0
- package/dist/runtime/runtime.d.ts +8 -0
- package/dist/runtime.d.ts +2 -0
- package/dist/runtime.js +52 -0
- package/package.json +13 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const CHART_CSS = "\n/* Blueprint Chart \u2014 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}\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 \u2014 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() \u2014 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.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";
|
|
1
|
+
export declare const CHART_CSS = "\n/* Blueprint Chart \u2014 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}\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 \u2014 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() \u2014 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.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";
|
package/dist/runtime/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { initBlueprint } from './runtime';
|
|
2
2
|
export { initBlueprint };
|
|
3
|
+
export { renderBpc } from '../render/render-bpc';
|
|
3
4
|
export { createSceneController, createStepController } from './scenes';
|
|
4
5
|
export type { SceneDefinition, SceneController, StepDefinition, StepController } from './scenes';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const RESIZE_MESSAGE = "blueprint-chart-resize";
|
|
2
|
+
export declare const ERROR_MESSAGE = "blueprint-chart-error";
|
|
3
|
+
/**
|
|
4
|
+
* Validate a `message` event payload as a resize notification and return the
|
|
5
|
+
* measured height, or null if the payload is not a well-formed resize message.
|
|
6
|
+
* Callers must still confirm the event originated from their own iframe.
|
|
7
|
+
*/
|
|
8
|
+
export declare function readResizeHeight(data: unknown): number | null;
|
|
9
|
+
/** True when the payload is a well-formed render-error notification. */
|
|
10
|
+
export declare function isErrorMessage(data: unknown): boolean;
|
|
@@ -1,2 +1,10 @@
|
|
|
1
1
|
export declare function initBlueprint(): void;
|
|
2
2
|
export declare function teardownBlueprint(): void;
|
|
3
|
+
/**
|
|
4
|
+
* CSS-variable overrides applied to the chart frame inside the iframe, so a
|
|
5
|
+
* host can theme the chart chrome (background, text, axis, grid) to match its
|
|
6
|
+
* own surface. Omit for the default light chrome. Data-mark colors come from
|
|
7
|
+
* the chart's palette and are not affected.
|
|
8
|
+
*/
|
|
9
|
+
export type EmbedTheme = 'light' | 'dark';
|
|
10
|
+
export declare function buildSrcdoc(dsl: string, runtimeUrl: string, theme?: EmbedTheme): string;
|
package/dist/runtime.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { i as p } from "./embed-DxKuPk6P.js";
|
|
2
|
+
import { r as b } from "./render-bpc-CnZB0sa5.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
|
+
};
|
|
44
|
+
}
|
|
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
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blueprint-chart/lib",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "DSL-driven charting library built on D3. Define charts as text, render them anywhere.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"chart",
|
|
@@ -37,8 +37,19 @@
|
|
|
37
37
|
"browser": "./dist/node-backend/browser.js",
|
|
38
38
|
"default": "./dist/node-backend/browser.js"
|
|
39
39
|
},
|
|
40
|
+
"./embed": {
|
|
41
|
+
"types": "./dist/embed.d.ts",
|
|
42
|
+
"import": "./dist/embed.js",
|
|
43
|
+
"default": "./dist/embed.js"
|
|
44
|
+
},
|
|
45
|
+
"./runtime": {
|
|
46
|
+
"types": "./dist/runtime/index.d.ts",
|
|
47
|
+
"import": "./dist/runtime.js",
|
|
48
|
+
"default": "./dist/runtime.js"
|
|
49
|
+
},
|
|
40
50
|
"./charts.scss": "./src/charts/chart.scss",
|
|
41
|
-
"./src/charts/chart.scss": "./src/charts/chart.scss"
|
|
51
|
+
"./src/charts/chart.scss": "./src/charts/chart.scss",
|
|
52
|
+
"./embed-runtime.js": "./dist/lib/lib.iife.js"
|
|
42
53
|
},
|
|
43
54
|
"files": [
|
|
44
55
|
"dist",
|