@sentropic/dataviz-vue 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.
- package/dist/index.d.ts +33 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +48 -0
- package/dist/index.js.map +1 -0
- package/package.json +46 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @sentropic/dataviz-vue
|
|
3
|
+
*
|
|
4
|
+
* Vue 3 adapter for the framework-agnostic dataviz-core store. Exposes
|
|
5
|
+
* `useDashboard`, which mirrors the store state into a `shallowRef` (the whole
|
|
6
|
+
* state object is replaced on each mutation, so a shallow ref is exactly right
|
|
7
|
+
* and avoids deep reactivity overhead), plus provide/inject helpers for sharing
|
|
8
|
+
* one store across a component tree. Presentation comes from
|
|
9
|
+
* `@sentropic/design-system-vue`; this package only wires state.
|
|
10
|
+
*/
|
|
11
|
+
import { type InjectionKey, type ShallowRef } from 'vue';
|
|
12
|
+
import { type DashboardState, type DashboardStore } from '@sentropic/dataviz-core';
|
|
13
|
+
export * from '@sentropic/dataviz-core';
|
|
14
|
+
export type { ButtonProps } from '@sentropic/design-system-vue';
|
|
15
|
+
export type { TenantTheme } from '@sentropic/design-system-themes';
|
|
16
|
+
/**
|
|
17
|
+
* Subscribe the current Vue scope to a dashboard store.
|
|
18
|
+
*
|
|
19
|
+
* Returns a read-only `ShallowRef<DashboardState>` updated on every store
|
|
20
|
+
* notification. The subscription is torn down automatically via
|
|
21
|
+
* `onScopeDispose`, so it is safe in `setup()` and in standalone effect scopes.
|
|
22
|
+
*/
|
|
23
|
+
export declare function useDashboard(store: DashboardStore): Readonly<ShallowRef<DashboardState>>;
|
|
24
|
+
/** Injection key carrying a {@link DashboardStore} down a component tree. */
|
|
25
|
+
export declare const DashboardKey: InjectionKey<DashboardStore>;
|
|
26
|
+
/** Provide a dashboard store to descendant components. */
|
|
27
|
+
export declare function provideDashboard(store: DashboardStore): DashboardStore;
|
|
28
|
+
/**
|
|
29
|
+
* Inject the dashboard store provided by an ancestor.
|
|
30
|
+
* Throws if no store was provided (fail fast rather than silently no-op).
|
|
31
|
+
*/
|
|
32
|
+
export declare function injectDashboard(): DashboardStore;
|
|
33
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAKL,KAAK,YAAY,EACjB,KAAK,UAAU,EAChB,MAAM,KAAK,CAAC;AACb,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,cAAc,EACpB,MAAM,yBAAyB,CAAC;AAGjC,cAAc,yBAAyB,CAAC;AAGxC,YAAY,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAChE,YAAY,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAEnE;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,cAAc,GAAG,QAAQ,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC,CAOxF;AAED,6EAA6E;AAC7E,eAAO,MAAM,YAAY,EAAE,YAAY,CAAC,cAAc,CAA+B,CAAC;AAEtF,0DAA0D;AAC1D,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,cAAc,GAAG,cAAc,CAGtE;AAED;;;GAGG;AACH,wBAAgB,eAAe,IAAI,cAAc,CAMhD"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @sentropic/dataviz-vue
|
|
3
|
+
*
|
|
4
|
+
* Vue 3 adapter for the framework-agnostic dataviz-core store. Exposes
|
|
5
|
+
* `useDashboard`, which mirrors the store state into a `shallowRef` (the whole
|
|
6
|
+
* state object is replaced on each mutation, so a shallow ref is exactly right
|
|
7
|
+
* and avoids deep reactivity overhead), plus provide/inject helpers for sharing
|
|
8
|
+
* one store across a component tree. Presentation comes from
|
|
9
|
+
* `@sentropic/design-system-vue`; this package only wires state.
|
|
10
|
+
*/
|
|
11
|
+
import { inject, onScopeDispose, provide, shallowRef, } from 'vue';
|
|
12
|
+
import {} from '@sentropic/dataviz-core';
|
|
13
|
+
// Re-export the full core surface so consumers need a single import.
|
|
14
|
+
export * from '@sentropic/dataviz-core';
|
|
15
|
+
/**
|
|
16
|
+
* Subscribe the current Vue scope to a dashboard store.
|
|
17
|
+
*
|
|
18
|
+
* Returns a read-only `ShallowRef<DashboardState>` updated on every store
|
|
19
|
+
* notification. The subscription is torn down automatically via
|
|
20
|
+
* `onScopeDispose`, so it is safe in `setup()` and in standalone effect scopes.
|
|
21
|
+
*/
|
|
22
|
+
export function useDashboard(store) {
|
|
23
|
+
const state = shallowRef(store.getState());
|
|
24
|
+
const off = store.subscribe(() => {
|
|
25
|
+
state.value = store.getState();
|
|
26
|
+
});
|
|
27
|
+
onScopeDispose(off);
|
|
28
|
+
return state;
|
|
29
|
+
}
|
|
30
|
+
/** Injection key carrying a {@link DashboardStore} down a component tree. */
|
|
31
|
+
export const DashboardKey = Symbol('dataviz-dashboard');
|
|
32
|
+
/** Provide a dashboard store to descendant components. */
|
|
33
|
+
export function provideDashboard(store) {
|
|
34
|
+
provide(DashboardKey, store);
|
|
35
|
+
return store;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Inject the dashboard store provided by an ancestor.
|
|
39
|
+
* Throws if no store was provided (fail fast rather than silently no-op).
|
|
40
|
+
*/
|
|
41
|
+
export function injectDashboard() {
|
|
42
|
+
const store = inject(DashboardKey);
|
|
43
|
+
if (!store) {
|
|
44
|
+
throw new Error('injectDashboard: no DashboardStore provided. Call provideDashboard() first.');
|
|
45
|
+
}
|
|
46
|
+
return store;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EACL,MAAM,EACN,cAAc,EACd,OAAO,EACP,UAAU,GAGX,MAAM,KAAK,CAAC;AACb,OAAO,EAGN,MAAM,yBAAyB,CAAC;AAEjC,qEAAqE;AACrE,cAAc,yBAAyB,CAAC;AAMxC;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAAC,KAAqB;IAChD,MAAM,KAAK,GAAG,UAAU,CAAiB,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC3D,MAAM,GAAG,GAAG,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QAC/B,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC;IACjC,CAAC,CAAC,CAAC;IACH,cAAc,CAAC,GAAG,CAAC,CAAC;IACpB,OAAO,KAAK,CAAC;AACf,CAAC;AAED,6EAA6E;AAC7E,MAAM,CAAC,MAAM,YAAY,GAAiC,MAAM,CAAC,mBAAmB,CAAC,CAAC;AAEtF,0DAA0D;AAC1D,MAAM,UAAU,gBAAgB,CAAC,KAAqB;IACpD,OAAO,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;IAC7B,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,eAAe;IAC7B,MAAM,KAAK,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC;IACnC,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,6EAA6E,CAAC,CAAC;IACjG,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sentropic/dataviz-vue",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Vue 3 adapter for @sentropic/dataviz-core, built on @sentropic/design-system-vue.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/rhanka/dataviz.git",
|
|
10
|
+
"directory": "packages/dataviz-vue"
|
|
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-vue": "0.16.0",
|
|
32
|
+
"@sentropic/design-system-themes": "0.11.0"
|
|
33
|
+
},
|
|
34
|
+
"peerDependencies": {
|
|
35
|
+
"vue": "^3"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@vitejs/plugin-vue": "^6.0.7",
|
|
39
|
+
"@vue/test-utils": "^2.4.11",
|
|
40
|
+
"jsdom": "^29.1.1",
|
|
41
|
+
"vue": "^3.5.35"
|
|
42
|
+
},
|
|
43
|
+
"publishConfig": {
|
|
44
|
+
"access": "public"
|
|
45
|
+
}
|
|
46
|
+
}
|