@sentropic/dataviz-svelte 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 +41 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +42 -0
- package/dist/index.js.map +1 -0
- package/package.json +40 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @sentropic/dataviz-svelte
|
|
3
|
+
*
|
|
4
|
+
* Svelte 5 adapter for the framework-agnostic dataviz-core store. It bridges the
|
|
5
|
+
* core's `getState`/`subscribe` contract onto Svelte's `Readable` store contract
|
|
6
|
+
* so the dashboard state can be consumed with `$store` syntax. All presentation
|
|
7
|
+
* comes from `@sentropic/design-system-svelte`; this package only wires state.
|
|
8
|
+
*/
|
|
9
|
+
import { type DashboardState, type DashboardStore, type DashboardStoreConfig } from '@sentropic/dataviz-core';
|
|
10
|
+
export * from '@sentropic/dataviz-core';
|
|
11
|
+
export type { BarChartTone } from '@sentropic/design-system-svelte';
|
|
12
|
+
export type { TenantTheme } from '@sentropic/design-system-themes';
|
|
13
|
+
/** Minimal Svelte `Readable` contract (avoids a hard dep on `svelte/store`). */
|
|
14
|
+
export interface SvelteReadable<T> {
|
|
15
|
+
subscribe(run: (value: T) => void): () => void;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Wrap a core {@link DashboardStore} as a Svelte `Readable<DashboardState>`.
|
|
19
|
+
*
|
|
20
|
+
* Following the Svelte store contract, `subscribe(run)` calls `run` immediately
|
|
21
|
+
* with the current state, then again after every core notification, and returns
|
|
22
|
+
* an unsubscribe function.
|
|
23
|
+
*/
|
|
24
|
+
export declare function toSvelteStore(store: DashboardStore): SvelteReadable<DashboardState>;
|
|
25
|
+
/** Result of {@link createDashboard}: the core store plus its Svelte view. */
|
|
26
|
+
export interface SvelteDashboard {
|
|
27
|
+
/** The underlying core store (use its mutators: setFilter, toggleSelection…). */
|
|
28
|
+
store: DashboardStore;
|
|
29
|
+
/** Svelte-readable snapshot, usable with `$state` in a component. */
|
|
30
|
+
state: SvelteReadable<DashboardState>;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Create a dashboard store and its Svelte-readable view in one call.
|
|
34
|
+
*/
|
|
35
|
+
export declare function createDashboard(config: DashboardStoreConfig): SvelteDashboard;
|
|
36
|
+
/**
|
|
37
|
+
* Canonical adapter hook (parity with React/Vue `useDashboard`).
|
|
38
|
+
* Returns the Svelte-readable state for a given core store.
|
|
39
|
+
*/
|
|
40
|
+
export declare function useDashboard(store: DashboardStore): SvelteReadable<DashboardState>;
|
|
41
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,oBAAoB,EAC1B,MAAM,yBAAyB,CAAC;AAGjC,cAAc,yBAAyB,CAAC;AAIxC,YAAY,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAEpE,YAAY,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAEnE,gFAAgF;AAChF,MAAM,WAAW,cAAc,CAAC,CAAC;IAC/B,SAAS,CAAC,GAAG,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;CAChD;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,cAAc,GAAG,cAAc,CAAC,cAAc,CAAC,CAQnF;AAED,8EAA8E;AAC9E,MAAM,WAAW,eAAe;IAC9B,iFAAiF;IACjF,KAAK,EAAE,cAAc,CAAC;IACtB,qEAAqE;IACrE,KAAK,EAAE,cAAc,CAAC,cAAc,CAAC,CAAC;CACvC;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,oBAAoB,GAAG,eAAe,CAG7E;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,cAAc,GAAG,cAAc,CAAC,cAAc,CAAC,CAElF"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @sentropic/dataviz-svelte
|
|
3
|
+
*
|
|
4
|
+
* Svelte 5 adapter for the framework-agnostic dataviz-core store. It bridges the
|
|
5
|
+
* core's `getState`/`subscribe` contract onto Svelte's `Readable` store contract
|
|
6
|
+
* so the dashboard state can be consumed with `$store` syntax. All presentation
|
|
7
|
+
* comes from `@sentropic/design-system-svelte`; this package only wires state.
|
|
8
|
+
*/
|
|
9
|
+
import { createDashboardStore, } from '@sentropic/dataviz-core';
|
|
10
|
+
// Re-export the full core surface so consumers need a single import.
|
|
11
|
+
export * from '@sentropic/dataviz-core';
|
|
12
|
+
/**
|
|
13
|
+
* Wrap a core {@link DashboardStore} as a Svelte `Readable<DashboardState>`.
|
|
14
|
+
*
|
|
15
|
+
* Following the Svelte store contract, `subscribe(run)` calls `run` immediately
|
|
16
|
+
* with the current state, then again after every core notification, and returns
|
|
17
|
+
* an unsubscribe function.
|
|
18
|
+
*/
|
|
19
|
+
export function toSvelteStore(store) {
|
|
20
|
+
return {
|
|
21
|
+
subscribe(run) {
|
|
22
|
+
run(store.getState());
|
|
23
|
+
const off = store.subscribe(() => run(store.getState()));
|
|
24
|
+
return off;
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Create a dashboard store and its Svelte-readable view in one call.
|
|
30
|
+
*/
|
|
31
|
+
export function createDashboard(config) {
|
|
32
|
+
const store = createDashboardStore(config);
|
|
33
|
+
return { store, state: toSvelteStore(store) };
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Canonical adapter hook (parity with React/Vue `useDashboard`).
|
|
37
|
+
* Returns the Svelte-readable state for a given core store.
|
|
38
|
+
*/
|
|
39
|
+
export function useDashboard(store) {
|
|
40
|
+
return toSvelteStore(store);
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,oBAAoB,GAIrB,MAAM,yBAAyB,CAAC;AAEjC,qEAAqE;AACrE,cAAc,yBAAyB,CAAC;AAaxC;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,KAAqB;IACjD,OAAO;QACL,SAAS,CAAC,GAAoC;YAC5C,GAAG,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;YACtB,MAAM,GAAG,GAAG,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;YACzD,OAAO,GAAG,CAAC;QACb,CAAC;KACF,CAAC;AACJ,CAAC;AAUD;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,MAA4B;IAC1D,MAAM,KAAK,GAAG,oBAAoB,CAAC,MAAM,CAAC,CAAC;IAC3C,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC;AAChD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,KAAqB;IAChD,OAAO,aAAa,CAAC,KAAK,CAAC,CAAC;AAC9B,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sentropic/dataviz-svelte",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Svelte 5 adapter for @sentropic/dataviz-core, built on @sentropic/design-system-svelte.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/rhanka/dataviz.git",
|
|
10
|
+
"directory": "packages/dataviz-svelte"
|
|
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 src"
|
|
28
|
+
},
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@sentropic/dataviz-core": "0.1.0",
|
|
31
|
+
"@sentropic/design-system-svelte": "0.21.0",
|
|
32
|
+
"@sentropic/design-system-themes": "0.11.0"
|
|
33
|
+
},
|
|
34
|
+
"peerDependencies": {
|
|
35
|
+
"svelte": "^5"
|
|
36
|
+
},
|
|
37
|
+
"publishConfig": {
|
|
38
|
+
"access": "public"
|
|
39
|
+
}
|
|
40
|
+
}
|