@allurereport/web-commons 3.0.0-beta.18 → 3.0.0-beta.19

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,3 +1,5 @@
1
- import type { SeverityLevel, TestStatus } from "@allurereport/core-api";
1
+ import type { NewKey, RemovedKey, SeverityLevel, TestStatus } from "@allurereport/core-api";
2
2
  export declare const statusColors: Record<TestStatus, string>;
3
3
  export declare const severityColors: Record<SeverityLevel, string>;
4
+ export declare const statusChangeColors: Record<NewKey<TestStatus> | RemovedKey<TestStatus>, string>;
5
+ export declare const resolveCSSVarColor: (value: string, el?: Element) => string;
@@ -12,3 +12,26 @@ export const severityColors = {
12
12
  minor: "var(--bg-support-rau)",
13
13
  trivial: "var(--bg-support-skat)",
14
14
  };
15
+ export const statusChangeColors = {
16
+ newFailed: "var(--bg-support-capella)",
17
+ newBroken: "var(--bg-support-atlas)",
18
+ newPassed: "var(--bg-support-castor)",
19
+ newSkipped: "var(--bg-support-rau)",
20
+ newUnknown: "var(--bg-support-skat)",
21
+ removedFailed: "color-mix(in srgb, var(--bg-support-capella) 80%, black)",
22
+ removedBroken: "color-mix(in srgb, var(--bg-support-atlas) 80%, black)",
23
+ removedPassed: "color-mix(in srgb, var(--bg-support-castor) 80%, black)",
24
+ removedSkipped: "color-mix(in srgb, var(--bg-support-rau) 80%, black)",
25
+ removedUnknown: "color-mix(in srgb, var(--bg-support-skat) 80%, black)",
26
+ };
27
+ export const resolveCSSVarColor = (value, el = document.documentElement) => {
28
+ if (value.startsWith("var(")) {
29
+ const match = value.match(/var\((--[^),\s]+)/);
30
+ if (match) {
31
+ const cssVarName = match[1];
32
+ const resolved = getComputedStyle(el).getPropertyValue(cssVarName).trim();
33
+ return resolved || value;
34
+ }
35
+ }
36
+ return value;
37
+ };
@@ -1,4 +1,5 @@
1
- import type { BaseTrendSliceMetadata, ChartDataType, ChartId, ChartMode, ChartType, PieSlice, TrendPointId, TrendSlice, TrendSliceId } from "@allurereport/core-api";
1
+ import type { BarChartType, BarGroup, BarGroupMode, BaseTrendSliceMetadata, ChartDataType, ChartId, ChartMode, ChartType, HeatMapSerie, PieSlice, TreeMapChartType, TreeMapNode, TrendPointId, TrendSlice, TrendSliceId } from "@allurereport/core-api";
2
+ export type TreeMapTooltipAccessor = <T>(node: T) => string[];
2
3
  export interface Point {
3
4
  x: Date | string | number;
4
5
  y: number;
@@ -19,17 +20,38 @@ export interface ResponseTrendChartData<SeriesType extends string = string, Meta
19
20
  slices: Record<TrendSliceId, TrendSlice<Metadata>>;
20
21
  series: Record<SeriesType, TrendPointId[]>;
21
22
  }
22
- export type ChartsResponse<SeriesType extends string = string, Metadata extends BaseTrendSliceMetadata = BaseTrendSliceMetadata> = Record<ChartId, ResponseTrendChartData<SeriesType, Metadata>>;
23
23
  export interface ResponsePieChartData {
24
24
  type: ChartType.Pie;
25
25
  title?: string;
26
26
  percentage: number;
27
27
  slices: PieSlice[];
28
28
  }
29
+ export interface ResponseBarChartData {
30
+ type: ChartType.Bar;
31
+ dataType: BarChartType;
32
+ mode: ChartMode;
33
+ title?: string;
34
+ data: BarGroup<string, string>[];
35
+ keys: readonly string[];
36
+ indexBy: string;
37
+ groupMode: BarGroupMode;
38
+ }
29
39
  export interface ResponseComingSoonChartData {
30
- type: ChartType.HeatMap | ChartType.Bar | ChartType.Funnel | ChartType.TreeMap;
40
+ type: ChartType.ComingSoon;
41
+ title?: string;
42
+ }
43
+ export interface ResponseTreeMapChartData {
44
+ type: ChartType.TreeMap;
45
+ dataType: TreeMapChartType;
31
46
  title?: string;
47
+ treeMap: TreeMapNode;
32
48
  }
49
+ export interface ResponseHeatMapChartData {
50
+ type: ChartType.HeatMap;
51
+ title?: string;
52
+ data: HeatMapSerie[];
53
+ }
54
+ export type ChartsResponse<SeriesType extends string = string, Metadata extends BaseTrendSliceMetadata = BaseTrendSliceMetadata> = Record<ChartId, ResponseTrendChartData<SeriesType, Metadata> | ResponsePieChartData | ResponseBarChartData | ResponseComingSoonChartData | ResponseTreeMapChartData | ResponseHeatMapChartData>;
33
55
  export interface UITrendChartData<Metadata extends BaseTrendSliceMetadata = BaseTrendSliceMetadata> {
34
56
  type: ChartType.Trend;
35
57
  dataType: ChartDataType;
@@ -41,8 +63,20 @@ export interface UITrendChartData<Metadata extends BaseTrendSliceMetadata = Base
41
63
  title?: string;
42
64
  }
43
65
  export type UIPieChartData = ResponsePieChartData;
66
+ export interface UIBarChartData extends ResponseBarChartData {
67
+ colors: Record<string, string>;
68
+ }
44
69
  export type UIComingSoonChartData = ResponseComingSoonChartData;
45
- export type ChartData<SeriesType extends string = string, Metadata extends BaseTrendSliceMetadata = BaseTrendSliceMetadata> = ResponseTrendChartData<SeriesType, Metadata> | ResponsePieChartData | ResponseComingSoonChartData;
46
- export type UIChartData<Metadata extends BaseTrendSliceMetadata = BaseTrendSliceMetadata> = UITrendChartData<Metadata> | UIPieChartData | UIComingSoonChartData;
70
+ export interface UITreeMapChartData extends ResponseTreeMapChartData {
71
+ colors: (value: number, domain?: number[]) => string;
72
+ formatLegend?: (value: number) => string;
73
+ legendDomain?: number[];
74
+ tooltipRows?: TreeMapTooltipAccessor;
75
+ }
76
+ export interface UIHeatMapChartData extends ResponseHeatMapChartData {
77
+ colors: (value: number, domain?: number[]) => string;
78
+ }
79
+ export type ChartData<SeriesType extends string = string, Metadata extends BaseTrendSliceMetadata = BaseTrendSliceMetadata> = ResponseTrendChartData<SeriesType, Metadata> | ResponsePieChartData | ResponseBarChartData | ResponseComingSoonChartData | ResponseTreeMapChartData | ResponseHeatMapChartData;
80
+ export type UIChartData<Metadata extends BaseTrendSliceMetadata = BaseTrendSliceMetadata> = UITrendChartData<Metadata> | UIPieChartData | UIBarChartData | UIComingSoonChartData | UITreeMapChartData | UIHeatMapChartData;
47
81
  export type ChartsData<SeriesType extends string = string, Metadata extends BaseTrendSliceMetadata = BaseTrendSliceMetadata> = Record<ChartId, ChartData<SeriesType, Metadata>>;
48
82
  export type UIChartsData<Metadata extends BaseTrendSliceMetadata = BaseTrendSliceMetadata> = Record<ChartId, UIChartData<Metadata>>;
@@ -1,7 +1,19 @@
1
1
  import type { ChartId, SeverityLevel, TestStatus } from "@allurereport/core-api";
2
- import type { ChartsData, ChartsResponse, ResponseTrendChartData, UIChartData, UITrendChartData } from "./types.js";
3
- export declare const createTrendChartData: <T extends TestStatus | SeverityLevel>(getChart: () => ResponseTrendChartData | undefined, getGroups: () => readonly T[], getColor: (group: T) => string) => UITrendChartData | undefined;
2
+ import type { ChartsData, ChartsResponse, ResponseBarChartData, ResponseHeatMapChartData, ResponseTreeMapChartData, ResponseTrendChartData, TreeMapTooltipAccessor, UIBarChartData, UIChartData, UIHeatMapChartData, UITreeMapChartData, UITrendChartData } from "./types.js";
3
+ export declare const createTrendChartDataGeneric: <T extends TestStatus | SeverityLevel>(getChart: () => ResponseTrendChartData | undefined, getGroups: () => readonly T[], getColor: (group: T) => string) => UITrendChartData | undefined;
4
+ export declare const createBarChartDataGeneric: <T extends string>(getChart: () => ResponseBarChartData | undefined, getColors: () => Record<T, string>) => UIBarChartData | undefined;
5
+ export declare const createTreeMapChartDataGeneric: (getChart: () => ResponseTreeMapChartData | undefined, colors: (value: number, domain?: number[]) => string, formatLegend?: (value: number) => string, legendDomain?: number[], tooltipRows?: TreeMapTooltipAccessor) => UITreeMapChartData | undefined;
6
+ export declare const createHeatMapChartDataGeneric: (getChart: () => ResponseHeatMapChartData | undefined, colors: (value: number, domain?: number[]) => string) => UIHeatMapChartData | undefined;
4
7
  export declare const createStatusTrendChartData: (chartId: ChartId, res: ChartsResponse) => UITrendChartData | undefined;
5
8
  export declare const createSeverityTrendChartData: (chartId: ChartId, res: ChartsResponse) => UITrendChartData | undefined;
9
+ export declare const createStatusBySeverityBarChartData: (chartId: ChartId, res: ChartsResponse) => UIBarChartData | undefined;
10
+ export declare const createStatusTrendBarChartData: (chartId: ChartId, res: ChartsResponse) => UIBarChartData | undefined;
11
+ export declare const createStatusChangeTrendBarChartData: (chartId: ChartId, res: ChartsResponse) => UIBarChartData | undefined;
12
+ export declare const createSuccessRateDistributionTreeMapChartData: (chartId: ChartId, res: ChartsResponse) => UITreeMapChartData | undefined;
13
+ export declare const createCoverageDiffTreeMapChartData: (chartId: ChartId, res: ChartsResponse) => UITreeMapChartData | undefined;
14
+ export declare const createProblemsDistributionHeatMapChartData: (chartId: ChartId, res: ChartsResponse) => UIHeatMapChartData | undefined;
6
15
  export declare const createaTrendChartData: (chartId: string, chartData: ResponseTrendChartData, res: ChartsData) => UITrendChartData | undefined;
16
+ export declare const createBarChartData: (chartId: string, chartData: ResponseBarChartData, res: ChartsData) => UIBarChartData | undefined;
17
+ export declare const createTreeMapChartData: (chartId: ChartId, chartData: ResponseTreeMapChartData, res: ChartsResponse) => UITreeMapChartData | undefined;
18
+ export declare const createHeatMapChartData: (chartId: ChartId, res: ChartsResponse) => UIHeatMapChartData | undefined;
7
19
  export declare const createCharts: (res: ChartsData) => Record<ChartId, UIChartData>;
@@ -1,6 +1,8 @@
1
- import { ChartDataType, ChartType, severityLevels, statusesList } from "@allurereport/core-api";
2
- import { severityColors, statusColors } from "./colors.js";
3
- export const createTrendChartData = (getChart, getGroups, getColor) => {
1
+ import { BarChartType, ChartDataType, ChartType, TreeMapChartType, severityLevels, statusesList, } from "@allurereport/core-api";
2
+ import { interpolateRgb } from "d3-interpolate";
3
+ import { scaleLinear } from "d3-scale";
4
+ import { resolveCSSVarColor, severityColors, statusChangeColors, statusColors } from "./colors.js";
5
+ export const createTrendChartDataGeneric = (getChart, getGroups, getColor) => {
4
6
  const chart = getChart();
5
7
  if (!chart) {
6
8
  return undefined;
@@ -33,8 +35,94 @@ export const createTrendChartData = (getChart, getGroups, getColor) => {
33
35
  max: chart.max,
34
36
  };
35
37
  };
36
- export const createStatusTrendChartData = (chartId, res) => createTrendChartData(() => res[chartId], () => statusesList, (status) => statusColors[status]);
37
- export const createSeverityTrendChartData = (chartId, res) => createTrendChartData(() => res[chartId], () => severityLevels, (severity) => severityColors[severity]);
38
+ export const createBarChartDataGeneric = (getChart, getColors) => {
39
+ const chart = getChart();
40
+ if (!chart) {
41
+ return undefined;
42
+ }
43
+ return {
44
+ ...chart,
45
+ colors: getColors(),
46
+ };
47
+ };
48
+ export const createTreeMapChartDataGeneric = (getChart, colors, formatLegend, legendDomain, tooltipRows) => {
49
+ const chart = getChart();
50
+ if (!chart) {
51
+ return undefined;
52
+ }
53
+ return {
54
+ ...chart,
55
+ colors,
56
+ formatLegend,
57
+ legendDomain,
58
+ tooltipRows,
59
+ };
60
+ };
61
+ export const createHeatMapChartDataGeneric = (getChart, colors) => {
62
+ const chart = getChart();
63
+ if (!chart) {
64
+ return undefined;
65
+ }
66
+ return {
67
+ ...chart,
68
+ colors,
69
+ };
70
+ };
71
+ export const createStatusTrendChartData = (chartId, res) => createTrendChartDataGeneric(() => res[chartId], () => statusesList, (status) => statusColors[status]);
72
+ export const createSeverityTrendChartData = (chartId, res) => createTrendChartDataGeneric(() => res[chartId], () => severityLevels, (severity) => severityColors[severity]);
73
+ export const createStatusBySeverityBarChartData = (chartId, res) => createBarChartDataGeneric(() => res[chartId], () => statusColors);
74
+ export const createStatusTrendBarChartData = (chartId, res) => createBarChartDataGeneric(() => res[chartId], () => statusColors);
75
+ export const createStatusChangeTrendBarChartData = (chartId, res) => createBarChartDataGeneric(() => res[chartId], () => statusChangeColors);
76
+ export const createSuccessRateDistributionTreeMapChartData = (chartId, res) => {
77
+ const chartColorDomain = [0, 1];
78
+ return createTreeMapChartDataGeneric(() => res[chartId], (value, domain = chartColorDomain) => {
79
+ const scaledRgb = scaleLinear()
80
+ .domain(domain)
81
+ .range([resolveCSSVarColor(statusColors.failed), resolveCSSVarColor(statusColors.passed)])
82
+ .interpolate(interpolateRgb)
83
+ .clamp(true);
84
+ return scaledRgb(value);
85
+ }, (value) => {
86
+ if (value === 1) {
87
+ return "passed";
88
+ }
89
+ return "failed";
90
+ }, chartColorDomain, (node) => {
91
+ return [`passed: ${node.data.passedTests}`, `failed: ${node.data.failedTests}`, `other: ${node.data.otherTests}`];
92
+ });
93
+ };
94
+ export const createCoverageDiffTreeMapChartData = (chartId, res) => {
95
+ const chartColorDomain = [0, 0.5, 1];
96
+ return createTreeMapChartDataGeneric(() => res[chartId], (value, domain = chartColorDomain) => {
97
+ const scaledRgb = scaleLinear()
98
+ .domain(domain)
99
+ .range([resolveCSSVarColor(statusColors.failed), "#fff", resolveCSSVarColor(statusColors.passed)])
100
+ .interpolate(interpolateRgb)
101
+ .clamp(true);
102
+ return scaledRgb(value);
103
+ }, (value) => {
104
+ if (value === 1) {
105
+ return "new";
106
+ }
107
+ return "removed";
108
+ }, chartColorDomain, (node) => {
109
+ const newTotal = node.data.newCount + node.data.enabledCount;
110
+ const deletedTotal = node.data.deletedCount + node.data.disabledCount;
111
+ const unchangedTotal = node.value - newTotal - deletedTotal;
112
+ return [`new: ${newTotal}`, `deleted: ${deletedTotal}`, `unchanged: ${unchangedTotal}`];
113
+ });
114
+ };
115
+ export const createProblemsDistributionHeatMapChartData = (chartId, res) => {
116
+ const chartColorDomain = [0, 1];
117
+ return createHeatMapChartDataGeneric(() => res[chartId], (value, domain = chartColorDomain) => {
118
+ const scaledRgb = scaleLinear()
119
+ .domain(domain)
120
+ .range([resolveCSSVarColor(statusColors.passed), resolveCSSVarColor(statusColors.failed)])
121
+ .interpolate(interpolateRgb)
122
+ .clamp(true);
123
+ return scaledRgb(value);
124
+ });
125
+ };
38
126
  export const createaTrendChartData = (chartId, chartData, res) => {
39
127
  if (chartData.dataType === ChartDataType.Status) {
40
128
  return createStatusTrendChartData(chartId, res);
@@ -43,6 +131,28 @@ export const createaTrendChartData = (chartId, chartData, res) => {
43
131
  return createSeverityTrendChartData(chartId, res);
44
132
  }
45
133
  };
134
+ export const createBarChartData = (chartId, chartData, res) => {
135
+ if (chartData.dataType === BarChartType.StatusBySeverity) {
136
+ return createStatusBySeverityBarChartData(chartId, res);
137
+ }
138
+ else if (chartData.dataType === BarChartType.StatusTrend) {
139
+ return createStatusTrendBarChartData(chartId, res);
140
+ }
141
+ else if (chartData.dataType === BarChartType.StatusChangeTrend) {
142
+ return createStatusChangeTrendBarChartData(chartId, res);
143
+ }
144
+ };
145
+ export const createTreeMapChartData = (chartId, chartData, res) => {
146
+ if (chartData.dataType === TreeMapChartType.SuccessRateDistribution) {
147
+ return createSuccessRateDistributionTreeMapChartData(chartId, res);
148
+ }
149
+ else if (chartData.dataType === TreeMapChartType.CoverageDiff) {
150
+ return createCoverageDiffTreeMapChartData(chartId, res);
151
+ }
152
+ };
153
+ export const createHeatMapChartData = (chartId, res) => {
154
+ return createProblemsDistributionHeatMapChartData(chartId, res);
155
+ };
46
156
  export const createCharts = (res) => {
47
157
  return Object.entries(res).reduce((acc, [chartId, chart]) => {
48
158
  if (chart.type === ChartType.Trend) {
@@ -51,7 +161,25 @@ export const createCharts = (res) => {
51
161
  acc[chartId] = chartData;
52
162
  }
53
163
  }
54
- else if ([ChartType.Pie, ChartType.HeatMap, ChartType.Bar, ChartType.Funnel, ChartType.TreeMap].includes(chart.type)) {
164
+ else if (chart.type === ChartType.Bar) {
165
+ const chartData = createBarChartData(chartId, chart, res);
166
+ if (chartData) {
167
+ acc[chartId] = chartData;
168
+ }
169
+ }
170
+ else if (chart.type === ChartType.TreeMap) {
171
+ const chartData = createTreeMapChartData(chartId, chart, res);
172
+ if (chartData) {
173
+ acc[chartId] = chartData;
174
+ }
175
+ }
176
+ else if (chart.type === ChartType.HeatMap) {
177
+ const chartData = createHeatMapChartData(chartId, res);
178
+ if (chartData) {
179
+ acc[chartId] = chartData;
180
+ }
181
+ }
182
+ else if ([ChartType.Pie, ChartType.ComingSoon].includes(chart.type)) {
55
183
  acc[chartId] = chart;
56
184
  }
57
185
  return acc;
package/dist/data.d.ts CHANGED
@@ -1,8 +1,4 @@
1
1
  export declare const ALLURE_LIVE_RELOAD_HASH_STORAGE_KEY = "__allure_report_live_reload_hash__";
2
- export declare const createReportDataScript: (reportFiles?: {
3
- name: string;
4
- value: string;
5
- }[]) => string;
6
2
  export declare const ensureReportDataReady: () => Promise<unknown>;
7
3
  export declare const loadReportData: (name: string) => Promise<string>;
8
4
  export declare const reportDataUrl: (path: string, contentType?: string, params?: {
package/dist/data.js CHANGED
@@ -1,34 +1,4 @@
1
1
  export const ALLURE_LIVE_RELOAD_HASH_STORAGE_KEY = "__allure_report_live_reload_hash__";
2
- export const createReportDataScript = (reportFiles = []) => {
3
- if (!reportFiles?.length) {
4
- return `
5
- <script async>
6
- window.allureReportDataReady = true;
7
- </script>
8
- `;
9
- }
10
- const reportFilesDeclaration = reportFiles.map(({ name, value }) => `d('${name}','${value}')`).join(",");
11
- return `
12
- <script async>
13
- window.allureReportDataReady = false;
14
- window.allureReportData = window.allureReportData || {};
15
-
16
- function d(name, value){
17
- return new Promise(function (resolve) {
18
- window.allureReportData[name] = value;
19
-
20
- return resolve(true);
21
- });
22
- }
23
- </script>
24
- <script defer>
25
- Promise.allSettled([${reportFilesDeclaration}])
26
- .then(function(){
27
- window.allureReportDataReady = true;
28
- })
29
- </script>
30
- `;
31
- };
32
2
  export const ensureReportDataReady = () => new Promise((resolve) => {
33
3
  const waitForReady = () => {
34
4
  if (globalThis.allureReportDataReady) {
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export * from "./data.js";
2
- export * from "./static.js";
3
2
  export * from "./attachments.js";
4
3
  export * from "./i18n.js";
5
- export * from "./strings.js";
6
4
  export * from "./charts/index.js";
5
+ export * from "./strings.js";
6
+ export * from "./sanitize.js";
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export * from "./data.js";
2
- export * from "./static.js";
3
2
  export * from "./attachments.js";
4
3
  export * from "./i18n.js";
5
- export * from "./strings.js";
6
4
  export * from "./charts/index.js";
5
+ export * from "./strings.js";
6
+ export * from "./sanitize.js";
@@ -0,0 +1,15 @@
1
+ export declare const sanitize: {
2
+ (dirty: string | Node, cfg: import("dompurify").Config & {
3
+ RETURN_TRUSTED_TYPE: true;
4
+ }): import("trusted-types/lib/index.js").TrustedHTML;
5
+ (dirty: Node, cfg: import("dompurify").Config & {
6
+ IN_PLACE: true;
7
+ }): Node;
8
+ (dirty: string | Node, cfg: import("dompurify").Config & {
9
+ RETURN_DOM: true;
10
+ }): Node;
11
+ (dirty: string | Node, cfg: import("dompurify").Config & {
12
+ RETURN_DOM_FRAGMENT: true;
13
+ }): DocumentFragment;
14
+ (dirty: string | Node, cfg?: import("dompurify").Config): string;
15
+ };
@@ -0,0 +1,2 @@
1
+ import DOMPurify from "dompurify";
2
+ export const sanitize = DOMPurify.sanitize.bind(DOMPurify);
package/dist/strings.d.ts CHANGED
@@ -1 +1,12 @@
1
- export declare const capitalize: (str: string) => string | undefined;
1
+ export interface AnsiToHtmlConfig {
2
+ fg?: string;
3
+ bg?: string;
4
+ newline?: boolean;
5
+ escapeXML?: boolean;
6
+ stream?: boolean;
7
+ colors?: string[] | {
8
+ [code: number]: string;
9
+ };
10
+ }
11
+ export declare const isAnsi: (text?: string) => boolean;
12
+ export declare const ansiToHTML: (text: string, config?: AnsiToHtmlConfig) => string;
package/dist/strings.js CHANGED
@@ -1,6 +1,7 @@
1
- export const capitalize = (str) => {
2
- if (!str) {
3
- return;
4
- }
5
- return str.charAt(0).toLocaleUpperCase() + str.slice(1);
6
- };
1
+ import AnsiToHtml from "ansi-to-html";
2
+ const ansiRegex = /\x1B\[[0-9;?]*[ -/]*[@-~]/g;
3
+ export const isAnsi = (text) => typeof text === "string" && new RegExp(ansiRegex).test(text);
4
+ export const ansiToHTML = (text, config) => new AnsiToHtml({
5
+ escapeXML: true,
6
+ ...config,
7
+ }).toHtml(text);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allurereport/web-commons",
3
- "version": "3.0.0-beta.18",
3
+ "version": "3.0.0-beta.19",
4
4
  "description": "Collection of utilities used across the web Allure reports",
5
5
  "keywords": [
6
6
  "allure",
@@ -23,10 +23,16 @@
23
23
  "clean": "rimraf ./dist"
24
24
  },
25
25
  "dependencies": {
26
- "@allurereport/core-api": "3.0.0-beta.18"
26
+ "@allurereport/core-api": "3.0.0-beta.19",
27
+ "ansi-to-html": "^0.7.2",
28
+ "d3-interpolate": "^3.0.1",
29
+ "d3-scale": "^4.0.2",
30
+ "dompurify": "^3.2.6"
27
31
  },
28
32
  "devDependencies": {
29
33
  "@stylistic/eslint-plugin": "^2.6.1",
34
+ "@types/d3-interpolate": "^3.0.4",
35
+ "@types/d3-scale": "^4.0.9",
30
36
  "@types/eslint": "^8.56.11",
31
37
  "@typescript-eslint/eslint-plugin": "^8.0.0",
32
38
  "@typescript-eslint/parser": "^8.0.0",
package/dist/static.d.ts DELETED
@@ -1,8 +0,0 @@
1
- export declare const createScriptTag: (src: string, options?: {
2
- async?: false;
3
- defer?: false;
4
- }) => string;
5
- export declare const createStylesLinkTag: (src: string) => string;
6
- export declare const createFontLinkTag: (src: string) => string;
7
- export declare const createFaviconLinkTag: (src: string) => string;
8
- export declare const createBaseUrlScript: () => string;
package/dist/static.js DELETED
@@ -1,25 +0,0 @@
1
- export const createScriptTag = (src, options) => {
2
- return `<script ${options?.async ? "async" : ""} ${options?.defer ? "defer" : ""} src="${src}"></script>`;
3
- };
4
- export const createStylesLinkTag = (src) => {
5
- return `<link rel="stylesheet" type="text/css" href="${src}">`;
6
- };
7
- export const createFontLinkTag = (src) => {
8
- return `<link rel="preload" href="${src}" as="font" type="font/woff" crossorigin /> `;
9
- };
10
- export const createFaviconLinkTag = (src) => {
11
- return `<link rel="icon" href="${src}">`;
12
- };
13
- export const createBaseUrlScript = () => {
14
- return `
15
- <script>
16
- const { origin, pathname } = window.location;
17
- const url = new URL(pathname, origin);
18
- const baseEl = document.createElement("base");
19
-
20
- baseEl.href = url.toString();
21
-
22
- window.document.head.appendChild(baseEl);
23
- </script>
24
- `;
25
- };