@sentropic/dataviz-react 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,27 @@
1
+ /**
2
+ * @sentropic/dataviz-react
3
+ *
4
+ * React adapter for the framework-agnostic dataviz-core store. Exposes
5
+ * `useDashboard`, which subscribes a component to the store via React's
6
+ * `useSyncExternalStore` (concurrent-safe, SSR-safe). All presentation comes
7
+ * from `@sentropic/design-system-react`; this package only wires state.
8
+ */
9
+ import { type DashboardState, type DashboardStore } from '@sentropic/dataviz-core';
10
+ export * from '@sentropic/dataviz-core';
11
+ export type { ButtonProps } from '@sentropic/design-system-react';
12
+ export type { TenantTheme } from '@sentropic/design-system-themes';
13
+ /**
14
+ * Subscribe a React component to a dashboard store.
15
+ *
16
+ * Without a selector it returns the whole {@link DashboardState} snapshot.
17
+ * With a `selector` it returns a derived value; the component re-renders only
18
+ * when that derived value changes by `Object.is` (the standard
19
+ * `useSyncExternalStore` semantics). Because the core hands out a new frozen
20
+ * state object on every mutation, identity comparison is reliable.
21
+ *
22
+ * The same `subscribe` reference is used for the server snapshot, so this is
23
+ * SSR/hydration safe.
24
+ */
25
+ export declare function useDashboard(store: DashboardStore): DashboardState;
26
+ export declare function useDashboard<T>(store: DashboardStore, selector: (state: DashboardState) => T): T;
27
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,cAAc,EACpB,MAAM,yBAAyB,CAAC;AAGjC,cAAc,yBAAyB,CAAC;AAGxC,YAAY,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAClE,YAAY,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAEnE;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,cAAc,GAAG,cAAc,CAAC;AACpE,wBAAgB,YAAY,CAAC,CAAC,EAAE,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,CAAC,GAAG,CAAC,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,20 @@
1
+ /**
2
+ * @sentropic/dataviz-react
3
+ *
4
+ * React adapter for the framework-agnostic dataviz-core store. Exposes
5
+ * `useDashboard`, which subscribes a component to the store via React's
6
+ * `useSyncExternalStore` (concurrent-safe, SSR-safe). All presentation comes
7
+ * from `@sentropic/design-system-react`; this package only wires state.
8
+ */
9
+ import { useSyncExternalStore } from 'react';
10
+ import {} from '@sentropic/dataviz-core';
11
+ // Re-export the full core surface so consumers need a single import.
12
+ export * from '@sentropic/dataviz-core';
13
+ export function useDashboard(store, selector) {
14
+ const getSnapshot = () => {
15
+ const state = store.getState();
16
+ return selector ? selector(state) : state;
17
+ };
18
+ return useSyncExternalStore(store.subscribe, getSnapshot, getSnapshot);
19
+ }
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAC7C,OAAO,EAGN,MAAM,yBAAyB,CAAC;AAEjC,qEAAqE;AACrE,cAAc,yBAAyB,CAAC;AAoBxC,MAAM,UAAU,YAAY,CAC1B,KAAqB,EACrB,QAAuC;IAEvC,MAAM,WAAW,GAAG,GAAG,EAAE;QACvB,MAAM,KAAK,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC;QAC/B,OAAO,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IAC5C,CAAC,CAAC;IACF,OAAO,oBAAoB,CAAC,KAAK,CAAC,SAAS,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC;AACzE,CAAC"}
package/package.json ADDED
@@ -0,0 +1,49 @@
1
+ {
2
+ "name": "@sentropic/dataviz-react",
3
+ "version": "0.1.0",
4
+ "description": "React adapter for @sentropic/dataviz-core, built on @sentropic/design-system-react.",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/rhanka/dataviz.git",
10
+ "directory": "packages/dataviz-react"
11
+ },
12
+ "files": [
13
+ "dist"
14
+ ],
15
+ "exports": {
16
+ ".": {
17
+ "types": "./dist/index.d.ts",
18
+ "import": "./dist/index.js"
19
+ }
20
+ },
21
+ "types": "./dist/index.d.ts",
22
+ "main": "./dist/index.js",
23
+ "sideEffects": false,
24
+ "scripts": {
25
+ "build": "tsc -p tsconfig.json",
26
+ "check": "tsc -p tsconfig.json --noEmit",
27
+ "test": "vitest run"
28
+ },
29
+ "dependencies": {
30
+ "@sentropic/dataviz-core": "0.1.0",
31
+ "@sentropic/design-system-react": "0.16.0",
32
+ "@sentropic/design-system-themes": "0.11.0"
33
+ },
34
+ "peerDependencies": {
35
+ "react": "^19"
36
+ },
37
+ "devDependencies": {
38
+ "@testing-library/react": "^16.3.2",
39
+ "@types/react": "^19.2.17",
40
+ "@types/react-dom": "^19.2.3",
41
+ "@vitejs/plugin-react": "^6.0.2",
42
+ "jsdom": "^29.1.1",
43
+ "react": "^19.2.7",
44
+ "react-dom": "^19.2.7"
45
+ },
46
+ "publishConfig": {
47
+ "access": "public"
48
+ }
49
+ }