riksdagsmonitor 0.8.76 → 0.9.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/lib/cia/visualizations.d.ts.map +1 -1
- package/dist/lib/cia/visualizations.js.map +1 -1
- package/dist/lib/dashboards/anomaly-detection.d.ts.map +1 -1
- package/dist/lib/dashboards/anomaly-detection.js +2 -2
- package/dist/lib/dashboards/anomaly-detection.js.map +1 -1
- package/dist/lib/dashboards/coalition-dashboard.d.ts.map +1 -1
- package/dist/lib/dashboards/coalition-dashboard.js +3 -3
- package/dist/lib/dashboards/coalition-dashboard.js.map +1 -1
- package/dist/lib/dashboards/committees-dashboard.d.ts.map +1 -1
- package/dist/lib/dashboards/committees-dashboard.js +8 -12
- package/dist/lib/dashboards/committees-dashboard.js.map +1 -1
- package/dist/lib/dashboards/election-cycle.d.ts.map +1 -1
- package/dist/lib/dashboards/election-cycle.js +1 -1
- package/dist/lib/dashboards/election-cycle.js.map +1 -1
- package/dist/lib/dashboards/ministry-dashboard.d.ts.map +1 -1
- package/dist/lib/dashboards/ministry-dashboard.js.map +1 -1
- package/dist/lib/dashboards/party-dashboard.d.ts.map +1 -1
- package/dist/lib/dashboards/party-dashboard.js.map +1 -1
- package/dist/lib/dashboards/politician-dashboard.d.ts.map +1 -1
- package/dist/lib/dashboards/politician-dashboard.js.map +1 -1
- package/dist/lib/dashboards/pre-election.js.map +1 -1
- package/dist/lib/dashboards/risk-dashboard.js +8 -9
- package/dist/lib/dashboards/risk-dashboard.js.map +1 -1
- package/dist/lib/shared/global-libs.d.ts +48 -0
- package/dist/lib/shared/global-libs.d.ts.map +1 -0
- package/dist/lib/shared/global-libs.js +11 -0
- package/dist/lib/shared/global-libs.js.map +1 -0
- package/dist/lib/shared/index.d.ts +1 -0
- package/dist/lib/shared/index.d.ts.map +1 -1
- package/dist/lib/shared/index.js +1 -0
- package/dist/lib/shared/index.js.map +1 -1
- package/dist/lib/shared/register-globals.d.ts +2 -2
- package/dist/lib/shared/register-globals.js +3 -3
- package/dist/lib/shared/register-globals.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Shared/GlobalLibs
|
|
3
|
+
* @description Type declarations for global libraries loaded via CDN script tags.
|
|
4
|
+
* Provides type-safe access to Chart.js, D3.js, and PapaParse without `any`.
|
|
5
|
+
*
|
|
6
|
+
* @author Hack23 AB
|
|
7
|
+
* @license Apache-2.0
|
|
8
|
+
*/
|
|
9
|
+
import type * as d3Namespace from 'd3';
|
|
10
|
+
import type { Chart as ChartInstance, Defaults } from 'chart.js';
|
|
11
|
+
/** Chart.js constructor interface matching the actual Chart.js API. */
|
|
12
|
+
export interface ChartConstructor {
|
|
13
|
+
new (ctx: HTMLCanvasElement | CanvasRenderingContext2D | null, config: Record<string, unknown>): ChartInstance;
|
|
14
|
+
register(...items: unknown[]): void;
|
|
15
|
+
defaults: Defaults;
|
|
16
|
+
}
|
|
17
|
+
/** PapaParse parse result including errors and meta. */
|
|
18
|
+
export interface PapaParseResult<T = string[]> {
|
|
19
|
+
data: T[];
|
|
20
|
+
errors: Array<{
|
|
21
|
+
message: string;
|
|
22
|
+
type: string;
|
|
23
|
+
code: string;
|
|
24
|
+
row?: number;
|
|
25
|
+
}>;
|
|
26
|
+
meta: {
|
|
27
|
+
delimiter: string;
|
|
28
|
+
linebreak: string;
|
|
29
|
+
aborted: boolean;
|
|
30
|
+
fields?: string[];
|
|
31
|
+
truncated: boolean;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
/** PapaParse interface for CSV parsing. */
|
|
35
|
+
export interface PapaParseStatic {
|
|
36
|
+
parse<T = string[]>(input: string, config?: Record<string, unknown>): PapaParseResult<T>;
|
|
37
|
+
}
|
|
38
|
+
/** D3 library type alias. */
|
|
39
|
+
export type D3Static = typeof d3Namespace;
|
|
40
|
+
/** Interface representing the CDN-loaded globals on globalThis. */
|
|
41
|
+
export interface DashboardGlobals {
|
|
42
|
+
d3: D3Static;
|
|
43
|
+
Chart: ChartConstructor;
|
|
44
|
+
Papa: PapaParseStatic;
|
|
45
|
+
}
|
|
46
|
+
/** Type-safe accessor for CDN-loaded globals. */
|
|
47
|
+
export declare const globals: DashboardGlobals;
|
|
48
|
+
//# sourceMappingURL=global-libs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"global-libs.d.ts","sourceRoot":"","sources":["../../../src/browser/shared/global-libs.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,KAAK,WAAW,MAAM,IAAI,CAAC;AACvC,OAAO,KAAK,EAAE,KAAK,IAAI,aAAa,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEjE,uEAAuE;AACvE,MAAM,WAAW,gBAAgB;IAC/B,KAAK,GAAG,EAAE,iBAAiB,GAAG,wBAAwB,GAAG,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,aAAa,CAAC;IAC/G,QAAQ,CAAC,GAAG,KAAK,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IACpC,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAED,wDAAwD;AACxD,MAAM,WAAW,eAAe,CAAC,CAAC,GAAG,MAAM,EAAE;IAC3C,IAAI,EAAE,CAAC,EAAE,CAAC;IACV,MAAM,EAAE,KAAK,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC7E,IAAI,EAAE;QACJ,SAAS,EAAE,MAAM,CAAC;QAClB,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,OAAO,CAAC;QACjB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;QAClB,SAAS,EAAE,OAAO,CAAC;KACpB,CAAC;CACH;AAED,2CAA2C;AAC3C,MAAM,WAAW,eAAe;IAC9B,KAAK,CAAC,CAAC,GAAG,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,eAAe,CAAC,CAAC,CAAC,CAAC;CAC1F;AAED,6BAA6B;AAC7B,MAAM,MAAM,QAAQ,GAAG,OAAO,WAAW,CAAC;AAE1C,mEAAmE;AACnE,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,QAAQ,CAAC;IACb,KAAK,EAAE,gBAAgB,CAAC;IACxB,IAAI,EAAE,eAAe,CAAC;CACvB;AAED,iDAAiD;AACjD,eAAO,MAAM,OAAO,EAA4B,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Shared/GlobalLibs
|
|
3
|
+
* @description Type declarations for global libraries loaded via CDN script tags.
|
|
4
|
+
* Provides type-safe access to Chart.js, D3.js, and PapaParse without `any`.
|
|
5
|
+
*
|
|
6
|
+
* @author Hack23 AB
|
|
7
|
+
* @license Apache-2.0
|
|
8
|
+
*/
|
|
9
|
+
/** Type-safe accessor for CDN-loaded globals. */
|
|
10
|
+
export const globals = globalThis;
|
|
11
|
+
//# sourceMappingURL=global-libs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"global-libs.js","sourceRoot":"","sources":["../../../src/browser/shared/global-libs.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAwCH,iDAAiD;AACjD,MAAM,CAAC,MAAM,OAAO,GAAG,UAAyC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/browser/shared/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;KAUK;AAEL,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/browser/shared/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;KAUK;AAEL,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC"}
|
package/dist/lib/shared/index.js
CHANGED
|
@@ -16,6 +16,7 @@ export * from './dom-utils.js';
|
|
|
16
16
|
export * from './data-loader.js';
|
|
17
17
|
export * from './fallback-ui.js';
|
|
18
18
|
export * from './error-boundary.js';
|
|
19
|
+
export * from './global-libs.js';
|
|
19
20
|
// Note: chart-factory is intentionally excluded from this barrel export
|
|
20
21
|
// to keep the root entry point free of chart.js type dependencies.
|
|
21
22
|
// Import chart utilities directly: import { createChart } from 'riksdagsmonitor/shared/chart-factory';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/browser/shared/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;KAUK;AAEL,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/browser/shared/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;KAUK;AAEL,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AAEjC,wEAAwE;AACxE,mEAAmE;AACnE,uGAAuG"}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* @module Shared/RegisterGlobals
|
|
3
3
|
* @description Imports Chart.js, D3.js, and Papa Parse as ES modules and registers them on globalThis.
|
|
4
4
|
*
|
|
5
|
-
* Dashboard modules access these libraries via `(globalThis as
|
|
6
|
-
* `(globalThis as
|
|
5
|
+
* Dashboard modules access these libraries via `(globalThis as unknown as { Chart: { new(ctx: HTMLCanvasElement | CanvasRenderingContext2D | null, config: Record<string, unknown>): unknown; register(...items: unknown[]): void } }).Chart`,
|
|
6
|
+
* `(globalThis as unknown as { d3: typeof import('d3') }).d3`, and `(globalThis as unknown as { Papa: { parse(input: string, config?: Record<string, unknown>): { data: string[][] } } }).Papa`. ES module side-effect
|
|
7
7
|
* imports (`import 'chart.js/auto'`) do NOT set globals, so this module must be
|
|
8
8
|
* imported before any dashboard module to ensure the globals are available at
|
|
9
9
|
* module initialization time (when the importing module is first executed).
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* @module Shared/RegisterGlobals
|
|
3
3
|
* @description Imports Chart.js, D3.js, and Papa Parse as ES modules and registers them on globalThis.
|
|
4
4
|
*
|
|
5
|
-
* Dashboard modules access these libraries via `(globalThis as
|
|
6
|
-
* `(globalThis as
|
|
5
|
+
* Dashboard modules access these libraries via `(globalThis as unknown as { Chart: { new(ctx: HTMLCanvasElement | CanvasRenderingContext2D | null, config: Record<string, unknown>): unknown; register(...items: unknown[]): void } }).Chart`,
|
|
6
|
+
* `(globalThis as unknown as { d3: typeof import('d3') }).d3`, and `(globalThis as unknown as { Papa: { parse(input: string, config?: Record<string, unknown>): { data: string[][] } } }).Papa`. ES module side-effect
|
|
7
7
|
* imports (`import 'chart.js/auto'`) do NOT set globals, so this module must be
|
|
8
8
|
* imported before any dashboard module to ensure the globals are available at
|
|
9
9
|
* module initialization time (when the importing module is first executed).
|
|
@@ -14,7 +14,7 @@ import { Chart } from 'chart.js/auto';
|
|
|
14
14
|
import * as d3 from 'd3';
|
|
15
15
|
import Papa from 'papaparse';
|
|
16
16
|
export function registerBrowserGlobals() {
|
|
17
|
-
// Expose on globalThis so dashboard modules can access via (globalThis as
|
|
17
|
+
// Expose on globalThis so dashboard modules can access via (globalThis as unknown as { Chart: { new(ctx: HTMLCanvasElement | CanvasRenderingContext2D | null, config: Record<string, unknown>): unknown; register(...items: unknown[]): void } }).Chart / .d3 / .Papa
|
|
18
18
|
globalThis.Chart = Chart;
|
|
19
19
|
globalThis.d3 = d3;
|
|
20
20
|
globalThis.Papa = Papa;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register-globals.js","sourceRoot":"","sources":["../../../src/browser/shared/register-globals.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,MAAM,UAAU,sBAAsB;IACpC,
|
|
1
|
+
{"version":3,"file":"register-globals.js","sourceRoot":"","sources":["../../../src/browser/shared/register-globals.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,MAAM,UAAU,sBAAsB;IACpC,sQAAsQ;IACrQ,UAAsC,CAAC,KAAK,GAAG,KAAK,CAAC;IACrD,UAAsC,CAAC,EAAE,GAAG,EAAE,CAAC;IAC/C,UAAsC,CAAC,IAAI,GAAG,IAAI,CAAC;AACtD,CAAC;AAED,6EAA6E;AAC7E,yEAAyE;AACzE,4EAA4E;AAC5E,wEAAwE;AACxE,EAAE;AACF,6EAA6E;AAC7E,wEAAwE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "riksdagsmonitor",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Swedish Parliament (Riksdag) intelligence platform — TypeScript utilities for political data visualization, dashboards, and open data analysis with Chart.js and D3.js",
|
|
6
6
|
"main": "dist/lib/shared/index.js",
|