@blueprint-chart/lib 1.1.0 → 1.2.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.
@@ -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,3 @@
1
1
  export declare function initBlueprint(): void;
2
2
  export declare function teardownBlueprint(): void;
3
+ export declare function buildSrcdoc(dsl: string, runtimeUrl: string): string;
@@ -0,0 +1,2 @@
1
+ export * from './runtime/index'
2
+ export {}
@@ -0,0 +1,52 @@
1
+ import { i as p } from "./embed-WUb0NtY5.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.1.0",
3
+ "version": "1.2.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",