nmrium 2.6.0 → 2.7.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/lib/component/1d/ApodizationLine.js +2 -2
- package/lib/component/1d/ApodizationLine.js.map +1 -1
- package/lib/component/1d/Line.js +2 -2
- package/lib/component/1d/Line.js.map +1 -1
- package/lib/component/1d/SVGContent1D.d.ts.map +1 -1
- package/lib/component/1d/SVGContent1D.js +4 -1
- package/lib/component/1d/SVGContent1D.js.map +1 -1
- package/lib/component/1d/baseline/BaselinePreview.js +2 -2
- package/lib/component/1d/baseline/BaselinePreview.js.map +1 -1
- package/lib/component/1d/database/DatabaseSpectrum.js +2 -2
- package/lib/component/1d/database/DatabaseSpectrum.js.map +1 -1
- package/lib/component/1d/database/ResurrectedDatabaseRanges.js +2 -2
- package/lib/component/1d/database/ResurrectedDatabaseRanges.js.map +1 -1
- package/lib/component/1d/matrix/Boxplot.js +5 -5
- package/lib/component/1d/matrix/Boxplot.js.map +1 -1
- package/lib/component/1d/matrix/Stocsy.js +2 -2
- package/lib/component/1d/matrix/Stocsy.js.map +1 -1
- package/lib/component/1d/peaks/PeakAnnotationsSpreadMode.d.ts.map +1 -1
- package/lib/component/1d/peaks/PeakAnnotationsSpreadMode.js +12 -3
- package/lib/component/1d/peaks/PeakAnnotationsSpreadMode.js.map +1 -1
- package/lib/component/1d/peaks/usePeakShapesPath.js +2 -2
- package/lib/component/1d/peaks/usePeakShapesPath.js.map +1 -1
- package/lib/component/1d/plugin_svg_chart.d.ts +2 -0
- package/lib/component/1d/plugin_svg_chart.d.ts.map +1 -0
- package/lib/component/1d/plugin_svg_chart.js +43 -0
- package/lib/component/1d/plugin_svg_chart.js.map +1 -0
- package/lib/component/1d-2d/components/RangeIndicator.d.ts.map +1 -1
- package/lib/component/1d-2d/components/RangeIndicator.js +1 -7
- package/lib/component/1d-2d/components/RangeIndicator.js.map +1 -1
- package/lib/component/2d/1d-tracer/HorizontalSliceChart.js +2 -2
- package/lib/component/2d/1d-tracer/HorizontalSliceChart.js.map +1 -1
- package/lib/component/2d/1d-tracer/Left1DChart.js +2 -2
- package/lib/component/2d/1d-tracer/Left1DChart.js.map +1 -1
- package/lib/component/2d/1d-tracer/Top1DChart.js +2 -2
- package/lib/component/2d/1d-tracer/Top1DChart.js.map +1 -1
- package/lib/component/2d/1d-tracer/VerticalSliceChart.js +2 -2
- package/lib/component/2d/1d-tracer/VerticalSliceChart.js.map +1 -1
- package/lib/component/2d/1d-tracer/phase-correction-traces/SpectrumPhaseTrace.js +3 -3
- package/lib/component/2d/1d-tracer/phase-correction-traces/SpectrumPhaseTrace.js.map +1 -1
- package/lib/component/2d/ft/Contours.js +2 -2
- package/lib/component/2d/ft/Contours.js.map +1 -1
- package/lib/component/context/ScaleContext.d.ts +1 -1
- package/lib/component/context/ScaleContext.d.ts.map +1 -1
- package/lib/component/elements/D3Axis.d.ts.map +1 -1
- package/lib/component/elements/D3Axis.js +15 -32
- package/lib/component/elements/D3Axis.js.map +1 -1
- package/lib/component/elements/export/ExportContent.d.ts.map +1 -1
- package/lib/component/elements/export/ExportContent.js +2 -2
- package/lib/component/elements/export/ExportContent.js.map +1 -1
- package/lib/component/elements/export/ExportOptionsModal.d.ts.map +1 -1
- package/lib/component/elements/export/ExportOptionsModal.js +9 -3
- package/lib/component/elements/export/ExportOptionsModal.js.map +1 -1
- package/lib/component/elements/export/useExportConfigurer.d.ts +1 -0
- package/lib/component/elements/export/useExportConfigurer.d.ts.map +1 -1
- package/lib/component/elements/export/useExportConfigurer.js +5 -0
- package/lib/component/elements/export/useExportConfigurer.js.map +1 -1
- package/lib/component/elements/print/PrintContent.d.ts.map +1 -1
- package/lib/component/elements/print/PrintContent.js +6 -25
- package/lib/component/elements/print/PrintContent.js.map +1 -1
- package/lib/component/elements/utilities/transferStyles.d.ts +2 -0
- package/lib/component/elements/utilities/transferStyles.d.ts.map +1 -0
- package/lib/component/elements/utilities/transferStyles.js +29 -0
- package/lib/component/elements/utilities/transferStyles.js.map +1 -0
- package/lib/component/hooks/useIntegralPath.js +2 -2
- package/lib/component/hooks/useIntegralPath.js.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/errors/context.d.ts +106 -105
- package/lib/component/modal/setting/tanstack_general_settings/errors/context.d.ts.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/errors/renderer.d.ts +106 -105
- package/lib/component/modal/setting/tanstack_general_settings/errors/renderer.d.ts.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_body.d.ts +106 -105
- package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_body.d.ts.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_footer.d.ts +91 -90
- package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_footer.d.ts.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_header.d.ts +91 -90
- package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_header.d.ts.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/hooks/use_safe_workspace.d.ts +15 -15
- package/lib/component/modal/setting/tanstack_general_settings/tabs/auto_processing_tab.d.ts +91 -90
- package/lib/component/modal/setting/tanstack_general_settings/tabs/auto_processing_tab.d.ts.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/tabs/axis_tab.d.ts +91 -90
- package/lib/component/modal/setting/tanstack_general_settings/tabs/axis_tab.d.ts.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/tabs/database_tab.d.ts +91 -90
- package/lib/component/modal/setting/tanstack_general_settings/tabs/database_tab.d.ts.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/tabs/export_tab.d.ts +91 -90
- package/lib/component/modal/setting/tanstack_general_settings/tabs/export_tab.d.ts.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/tabs/export_tab.fields.d.ts +12 -10
- package/lib/component/modal/setting/tanstack_general_settings/tabs/export_tab.fields.d.ts.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/tabs/export_tab.fields.js +32 -40
- package/lib/component/modal/setting/tanstack_general_settings/tabs/export_tab.fields.js.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/tabs/external_api_tab.d.ts +91 -90
- package/lib/component/modal/setting/tanstack_general_settings/tabs/external_api_tab.d.ts.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/tabs/general_tab.d.ts +91 -90
- package/lib/component/modal/setting/tanstack_general_settings/tabs/general_tab.d.ts.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/tabs/import_filters_tab.d.ts +91 -90
- package/lib/component/modal/setting/tanstack_general_settings/tabs/import_filters_tab.d.ts.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/tabs/nuclei_tab.d.ts +91 -90
- package/lib/component/modal/setting/tanstack_general_settings/tabs/nuclei_tab.d.ts.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/tabs/panels_tab.d.ts +91 -90
- package/lib/component/modal/setting/tanstack_general_settings/tabs/panels_tab.d.ts.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/tabs/spectra_colors_tab.d.ts +91 -90
- package/lib/component/modal/setting/tanstack_general_settings/tabs/spectra_colors_tab.d.ts.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/tabs/spectra_label_tab.d.ts +91 -90
- package/lib/component/modal/setting/tanstack_general_settings/tabs/spectra_label_tab.d.ts.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/tabs/title_block_tab.d.ts +91 -90
- package/lib/component/modal/setting/tanstack_general_settings/tabs/title_block_tab.d.ts.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/tabs/tools_tab.d.ts +91 -90
- package/lib/component/modal/setting/tanstack_general_settings/tabs/tools_tab.d.ts.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/validation/export_tab_validation.d.ts +61 -17
- package/lib/component/modal/setting/tanstack_general_settings/validation/export_tab_validation.d.ts.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/validation/export_tab_validation.js +79 -28
- package/lib/component/modal/setting/tanstack_general_settings/validation/export_tab_validation.js.map +1 -1
- package/lib/component/modal/setting/tanstack_general_settings/validation.d.ts +15 -15
- package/lib/component/panels/filtersPanel/processings_sections_panel.js +1 -1
- package/lib/component/panels/filtersPanel/processings_sections_panel.js.map +1 -1
- package/lib/component/panels/multipleAnalysisPanel/AlignSpectra.d.ts +3 -3
- package/lib/component/panels/multipleAnalysisPanel/AlignSpectra.d.ts.map +1 -1
- package/lib/component/panels/multipleAnalysisPanel/AlignSpectra.js +69 -56
- package/lib/component/panels/multipleAnalysisPanel/AlignSpectra.js.map +1 -1
- package/lib/component/panels/multipleAnalysisPanel/MultipleSpectraAnalysisPanel.js +1 -1
- package/lib/component/panels/multipleAnalysisPanel/MultipleSpectraAnalysisPanel.js.map +1 -1
- package/lib/component/toolbar/nmr_toolbar.js +1 -1
- package/lib/component/toolbar/nmr_toolbar.js.map +1 -1
- package/lib/component/utility/core_slots/core_operator_chart_svg.d.ts +8 -0
- package/lib/component/utility/core_slots/core_operator_chart_svg.d.ts.map +1 -0
- package/lib/component/utility/core_slots/core_operator_chart_svg.js +23 -0
- package/lib/component/utility/core_slots/core_operator_chart_svg.js.map +1 -0
- package/lib/component/utility/core_slots/core_operator_panel_tool.d.ts +2 -8
- package/lib/component/utility/core_slots/core_operator_panel_tool.d.ts.map +1 -1
- package/lib/component/utility/core_slots/core_operator_panel_tool.js +8 -6
- package/lib/component/utility/core_slots/core_operator_panel_tool.js.map +1 -1
- package/lib/component/utility/core_slots/core_operator_tool.commons.d.ts +11 -0
- package/lib/component/utility/core_slots/core_operator_tool.commons.d.ts.map +1 -0
- package/lib/component/utility/core_slots/core_operator_tool.commons.js +30 -0
- package/lib/component/utility/core_slots/core_operator_tool.commons.js.map +1 -0
- package/lib/component/utility/core_slots/core_operator_tool.d.ts +2 -8
- package/lib/component/utility/core_slots/core_operator_tool.d.ts.map +1 -1
- package/lib/component/utility/core_slots/core_operator_tool.js +8 -6
- package/lib/component/utility/core_slots/core_operator_tool.js.map +1 -1
- package/lib/component/utility/export.d.ts +5 -0
- package/lib/component/utility/export.d.ts.map +1 -1
- package/lib/component/utility/export.js +22 -0
- package/lib/component/utility/export.js.map +1 -1
- package/lib/data/data2d/Spectrum2D/contours.d.ts.map +1 -1
- package/lib/data/data2d/Spectrum2D/contours.js +23 -10
- package/lib/data/data2d/Spectrum2D/contours.js.map +1 -1
- package/lib/data/data2d/Spectrum2D/findBestMinContour/estimateNoiseLevel.d.ts +13 -0
- package/lib/data/data2d/Spectrum2D/findBestMinContour/estimateNoiseLevel.d.ts.map +1 -0
- package/lib/data/data2d/Spectrum2D/findBestMinContour/estimateNoiseLevel.js +40 -0
- package/lib/data/data2d/Spectrum2D/findBestMinContour/estimateNoiseLevel.js.map +1 -0
- package/lib/data/data2d/Spectrum2D/findBestMinContour/evaluation.d.ts +27 -0
- package/lib/data/data2d/Spectrum2D/findBestMinContour/evaluation.d.ts.map +1 -0
- package/lib/data/data2d/Spectrum2D/findBestMinContour/evaluation.js +230 -0
- package/lib/data/data2d/Spectrum2D/findBestMinContour/evaluation.js.map +1 -0
- package/lib/data/data2d/Spectrum2D/findBestMinContour/findAutomaticContourLevels.d.ts +227 -0
- package/lib/data/data2d/Spectrum2D/findBestMinContour/findAutomaticContourLevels.d.ts.map +1 -0
- package/lib/data/data2d/Spectrum2D/findBestMinContour/findAutomaticContourLevels.js +67 -0
- package/lib/data/data2d/Spectrum2D/findBestMinContour/findAutomaticContourLevels.js.map +1 -0
- package/lib/data/data2d/Spectrum2D/findBestMinContour/math.d.ts +4 -0
- package/lib/data/data2d/Spectrum2D/findBestMinContour/math.d.ts.map +1 -0
- package/lib/data/data2d/Spectrum2D/findBestMinContour/math.js +42 -0
- package/lib/data/data2d/Spectrum2D/findBestMinContour/math.js.map +1 -0
- package/lib/data/utilities/calculateSanPlot.d.ts +3 -1
- package/lib/data/utilities/calculateSanPlot.d.ts.map +1 -1
- package/lib/data/utilities/calculateSanPlot.js +2 -2
- package/lib/data/utilities/calculateSanPlot.js.map +1 -1
- package/lib/versionInfo.js +1 -1
- package/package.json +5 -5
- package/src/component/1d/ApodizationLine.tsx +2 -2
- package/src/component/1d/Line.tsx +2 -2
- package/src/component/1d/SVGContent1D.tsx +6 -0
- package/src/component/1d/baseline/BaselinePreview.tsx +2 -2
- package/src/component/1d/database/DatabaseSpectrum.tsx +2 -2
- package/src/component/1d/database/ResurrectedDatabaseRanges.tsx +2 -2
- package/src/component/1d/matrix/Boxplot.tsx +5 -5
- package/src/component/1d/matrix/Stocsy.tsx +2 -2
- package/src/component/1d/peaks/PeakAnnotationsSpreadMode.tsx +17 -3
- package/src/component/1d/peaks/usePeakShapesPath.ts +2 -2
- package/src/component/1d/plugin_svg_chart.tsx +60 -0
- package/src/component/1d-2d/components/RangeIndicator.tsx +8 -9
- package/src/component/2d/1d-tracer/HorizontalSliceChart.tsx +2 -2
- package/src/component/2d/1d-tracer/Left1DChart.tsx +2 -2
- package/src/component/2d/1d-tracer/Top1DChart.tsx +2 -2
- package/src/component/2d/1d-tracer/VerticalSliceChart.tsx +2 -2
- package/src/component/2d/1d-tracer/phase-correction-traces/SpectrumPhaseTrace.tsx +3 -3
- package/src/component/2d/ft/Contours.tsx +2 -2
- package/src/component/context/ScaleContext.tsx +1 -1
- package/src/component/elements/D3Axis.tsx +49 -67
- package/src/component/elements/export/ExportContent.tsx +3 -2
- package/src/component/elements/export/ExportOptionsModal.tsx +32 -1
- package/src/component/elements/export/useExportConfigurer.tsx +6 -0
- package/src/component/elements/print/PrintContent.tsx +6 -27
- package/src/component/elements/utilities/transferStyles.ts +32 -0
- package/src/component/hooks/useIntegralPath.ts +2 -2
- package/src/component/modal/setting/tanstack_general_settings/tabs/export_tab.fields.tsx +47 -57
- package/src/component/modal/setting/tanstack_general_settings/validation/export_tab_validation.ts +100 -28
- package/src/component/panels/filtersPanel/processings_sections_panel.tsx +1 -1
- package/src/component/panels/multipleAnalysisPanel/AlignSpectra.tsx +128 -98
- package/src/component/panels/multipleAnalysisPanel/MultipleSpectraAnalysisPanel.tsx +1 -1
- package/src/component/toolbar/nmr_toolbar.tsx +1 -1
- package/src/component/utility/core_slots/core_operator_chart_svg.tsx +61 -0
- package/src/component/utility/core_slots/core_operator_panel_tool.tsx +9 -27
- package/src/component/utility/core_slots/core_operator_tool.commons.ts +63 -0
- package/src/component/utility/core_slots/core_operator_tool.tsx +9 -27
- package/src/component/utility/export.ts +34 -0
- package/src/data/data2d/Spectrum2D/contours.ts +40 -14
- package/src/data/data2d/Spectrum2D/findBestMinContour/estimateNoiseLevel.ts +67 -0
- package/src/data/data2d/Spectrum2D/findBestMinContour/evaluation.ts +432 -0
- package/src/data/data2d/Spectrum2D/findBestMinContour/findAutomaticContourLevels.ts +431 -0
- package/src/data/data2d/Spectrum2D/findBestMinContour/math.ts +59 -0
- package/src/data/utilities/calculateSanPlot.ts +2 -1
- package/src/versionInfo.ts +1 -1
- package/lib/component/elements/export/utilities/transferDocumentStyles.d.ts +0 -2
- package/lib/component/elements/export/utilities/transferDocumentStyles.d.ts.map +0 -1
- package/lib/component/elements/export/utilities/transferDocumentStyles.js +0 -21
- package/lib/component/elements/export/utilities/transferDocumentStyles.js.map +0 -1
- package/lib/component/utility/PathBuilder.d.ts +0 -10
- package/lib/component/utility/PathBuilder.d.ts.map +0 -1
- package/lib/component/utility/PathBuilder.js +0 -38
- package/lib/component/utility/PathBuilder.js.map +0 -1
- package/src/component/elements/export/utilities/transferDocumentStyles.ts +0 -21
- package/src/component/utility/PathBuilder.ts +0 -41
|
@@ -0,0 +1,431 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createThresholdIndex,
|
|
3
|
+
evaluateFallbackThreshold,
|
|
4
|
+
evaluateThreshold,
|
|
5
|
+
findRidgeFreeThresholdTopDown,
|
|
6
|
+
generateCandidateSigmaLevels,
|
|
7
|
+
maxPoolAbsolute,
|
|
8
|
+
} from './evaluation.js';
|
|
9
|
+
import { validateInput } from './math.js';
|
|
10
|
+
|
|
11
|
+
interface AutoContourDiagnostics {
|
|
12
|
+
recommended: ThresholdDiagnostics;
|
|
13
|
+
ridgeFree: ThresholdDiagnostics;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
interface ThresholdDiagnostics {
|
|
17
|
+
sigmaMultiplier: number;
|
|
18
|
+
minLevel: number;
|
|
19
|
+
|
|
20
|
+
occupancy: number;
|
|
21
|
+
fdr: number;
|
|
22
|
+
persistence: number;
|
|
23
|
+
|
|
24
|
+
verticalRidgeScore: number;
|
|
25
|
+
horizontalRidgeScore: number;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export type AutoContourResult<TDiagnostics extends boolean = boolean> = {
|
|
29
|
+
/**
|
|
30
|
+
* Recommended minimum contour level.
|
|
31
|
+
*/
|
|
32
|
+
minLevel: number;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Minimum contour level at which detected directional
|
|
36
|
+
* ridge structures (e.g. t1-noise) are no longer present.
|
|
37
|
+
*/
|
|
38
|
+
minLevelWithoutT1Noise: number;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* True when directional ridge structures were detected
|
|
42
|
+
* at the recommended minimum.
|
|
43
|
+
*/
|
|
44
|
+
hasT1Noise: boolean;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Same values expressed in multiples of the noise level.
|
|
48
|
+
*/
|
|
49
|
+
sigmaMultiplier: number;
|
|
50
|
+
sigmaMultiplierWithoutT1Noise: number;
|
|
51
|
+
/**
|
|
52
|
+
* Maximum absolute value in the analysis matrix used for contour level selection.
|
|
53
|
+
*/
|
|
54
|
+
maxAbsoluteValue: number;
|
|
55
|
+
} & (TDiagnostics extends true
|
|
56
|
+
? {
|
|
57
|
+
diagnostics: AutoContourDiagnostics;
|
|
58
|
+
}
|
|
59
|
+
: {
|
|
60
|
+
diagnostics?: AutoContourDiagnostics;
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
export interface AutoContourOptions {
|
|
64
|
+
/**
|
|
65
|
+
* Multiplicative ratio between consecutive contour levels.
|
|
66
|
+
*
|
|
67
|
+
* The contour levels are generated as:
|
|
68
|
+
*
|
|
69
|
+
* Lₙ = L₀ × contourRatioⁿ
|
|
70
|
+
*
|
|
71
|
+
* Must be greater than 1.
|
|
72
|
+
*
|
|
73
|
+
* A smaller value produces more closely spaced contour levels,
|
|
74
|
+
* while a larger value produces fewer, more widely spaced levels.
|
|
75
|
+
*
|
|
76
|
+
* @default 1.4
|
|
77
|
+
*/
|
|
78
|
+
contourRatio?: number;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Maximum acceptable false discovery rate (FDR) for the
|
|
82
|
+
* automatically selected minimum contour level.
|
|
83
|
+
*
|
|
84
|
+
* The FDR estimates the fraction of pixels above the selected
|
|
85
|
+
* threshold that could be explained by Gaussian noise, assuming
|
|
86
|
+
* the supplied noiseLevel is accurate.
|
|
87
|
+
*
|
|
88
|
+
* Smaller values produce a cleaner visualization but may suppress
|
|
89
|
+
* weak peaks.
|
|
90
|
+
*
|
|
91
|
+
* @default 0.05
|
|
92
|
+
*/
|
|
93
|
+
maxFdr?: number;
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Maximum fraction of the spectrum that may be above the
|
|
97
|
+
* automatically selected minimum contour level.
|
|
98
|
+
*
|
|
99
|
+
* This prevents very low thresholds from producing contours over
|
|
100
|
+
* a large fraction of the spectrum.
|
|
101
|
+
*
|
|
102
|
+
* Expressed as a fraction in the range [0, 1].
|
|
103
|
+
*
|
|
104
|
+
* For example, 0.02 means that at most 2% of pixels may be above
|
|
105
|
+
* the minimum contour threshold.
|
|
106
|
+
*
|
|
107
|
+
* @default 0.02
|
|
108
|
+
*/
|
|
109
|
+
maxOccupancy?: number;
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Minimum persistence required for spectral structures across
|
|
113
|
+
* successive exponential contour levels.
|
|
114
|
+
*
|
|
115
|
+
* Persistence measures how much of the active spectral structure
|
|
116
|
+
* remains when moving from one contour level to the next.
|
|
117
|
+
*
|
|
118
|
+
* Higher values favor stable, coherent peaks and reject fragmented
|
|
119
|
+
* noise structures more aggressively.
|
|
120
|
+
*
|
|
121
|
+
* Expressed as a fraction in the range [0, 1].
|
|
122
|
+
*
|
|
123
|
+
* @default 0.35
|
|
124
|
+
*/
|
|
125
|
+
minPersistence?: number;
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Maximum acceptable score for vertical ridge-like structures.
|
|
129
|
+
*
|
|
130
|
+
* This is primarily intended to detect structured artifacts such
|
|
131
|
+
* as t1 noise, which often appears as elongated structures along
|
|
132
|
+
* the F1 dimension.
|
|
133
|
+
*
|
|
134
|
+
* Smaller values make the ridge-free threshold more conservative.
|
|
135
|
+
*
|
|
136
|
+
* @default 0.25
|
|
137
|
+
*/
|
|
138
|
+
maxVerticalRidgeScore?: number;
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Maximum acceptable score for horizontal ridge-like structures.
|
|
142
|
+
*
|
|
143
|
+
* This can detect horizontal streaks or other structured artifacts
|
|
144
|
+
* extending predominantly along the F2 dimension.
|
|
145
|
+
*
|
|
146
|
+
* Smaller values make the ridge-free threshold more conservative.
|
|
147
|
+
*
|
|
148
|
+
* @default 0.25
|
|
149
|
+
*/
|
|
150
|
+
maxHorizontalRidgeScore?: number;
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Fraction of a row or column that must be occupied by active
|
|
154
|
+
* contour pixels for the row or column to be considered
|
|
155
|
+
* ridge-like.
|
|
156
|
+
*
|
|
157
|
+
* For vertical ridge detection, a column is considered suspicious
|
|
158
|
+
* when the fraction of active pixels along F1 is greater than or
|
|
159
|
+
* equal to this value.
|
|
160
|
+
*
|
|
161
|
+
* For horizontal ridge detection, the same criterion is applied
|
|
162
|
+
* along F2.
|
|
163
|
+
*
|
|
164
|
+
* Expressed as a fraction in the range [0, 1].
|
|
165
|
+
*
|
|
166
|
+
* Lower values make ridge detection more sensitive.
|
|
167
|
+
*
|
|
168
|
+
* @default 0.5
|
|
169
|
+
*/
|
|
170
|
+
ridgeCoverageThreshold?: number;
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Lowest threshold considered by the automatic contour search,
|
|
174
|
+
* expressed as a multiple of the supplied noise level.
|
|
175
|
+
*
|
|
176
|
+
* For example, minSigma = 2 means that thresholds below 2 ×
|
|
177
|
+
* noiseLevel are never considered.
|
|
178
|
+
*
|
|
179
|
+
* Lower values can preserve weaker peaks but increase the risk
|
|
180
|
+
* of including noise.
|
|
181
|
+
*
|
|
182
|
+
* @default 2
|
|
183
|
+
*/
|
|
184
|
+
minSigma?: number;
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Exponent used to determine the spacing between candidate
|
|
188
|
+
* minimum contour levels.
|
|
189
|
+
*
|
|
190
|
+
* Candidate thresholds are generated multiplicatively using:
|
|
191
|
+
*
|
|
192
|
+
* candidateStep = contourRatio ** candidateRatioExponent
|
|
193
|
+
*
|
|
194
|
+
* For example, with contourRatio = 1.4 and exponent = 0.5:
|
|
195
|
+
*
|
|
196
|
+
* candidateStep = sqrt(1.4)
|
|
197
|
+
*
|
|
198
|
+
* A value of 1 evaluates candidates directly on the contour-level
|
|
199
|
+
* hierarchy. Smaller values provide finer threshold resolution
|
|
200
|
+
* while increasing the amount of analysis.
|
|
201
|
+
*
|
|
202
|
+
* @default 0.5
|
|
203
|
+
*/
|
|
204
|
+
candidateRatioExponent?: number;
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Number of successive contour levels used when evaluating
|
|
208
|
+
* spectral persistence.
|
|
209
|
+
*
|
|
210
|
+
* A larger value requires spectral structures to remain stable
|
|
211
|
+
* across more contour levels and therefore produces a more
|
|
212
|
+
* conservative threshold.
|
|
213
|
+
*
|
|
214
|
+
* @default 4
|
|
215
|
+
*/
|
|
216
|
+
persistenceLevels?: number;
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Maximum dimension used for spatial analysis.
|
|
220
|
+
*
|
|
221
|
+
* Large input matrices are reduced using max pooling before
|
|
222
|
+
* calculating occupancy, persistence, and ridge metrics.
|
|
223
|
+
*
|
|
224
|
+
* The original matrix is not modified.
|
|
225
|
+
*
|
|
226
|
+
* Max pooling is used instead of averaging so that narrow,
|
|
227
|
+
* high-intensity spectral features are preserved during analysis.
|
|
228
|
+
*
|
|
229
|
+
* Larger values improve spatial resolution but increase
|
|
230
|
+
* computational cost and memory usage.
|
|
231
|
+
*
|
|
232
|
+
* @default 384
|
|
233
|
+
*/
|
|
234
|
+
maxAnalysisDimension?: number;
|
|
235
|
+
/**
|
|
236
|
+
* Whether diagnostic information should be returned.
|
|
237
|
+
*
|
|
238
|
+
* Diagnostics include the selected thresholds, FDR, occupancy,
|
|
239
|
+
* persistence, vertical and horizontal ridge scores, and the
|
|
240
|
+
* individual criteria used by the automatic threshold selection.
|
|
241
|
+
*
|
|
242
|
+
* Disable this when diagnostics are not needed and the smallest
|
|
243
|
+
* possible result object is preferred.
|
|
244
|
+
*
|
|
245
|
+
* @default true
|
|
246
|
+
*/
|
|
247
|
+
diagnostics?: boolean;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
export function findAutomaticContourLevels(
|
|
251
|
+
matrix: ArrayLike<number>,
|
|
252
|
+
rows: number,
|
|
253
|
+
cols: number,
|
|
254
|
+
noiseLevel: number,
|
|
255
|
+
options: AutoContourOptions & { diagnostics: true },
|
|
256
|
+
): AutoContourResult<true>;
|
|
257
|
+
export function findAutomaticContourLevels(
|
|
258
|
+
matrix: ArrayLike<number>,
|
|
259
|
+
rows: number,
|
|
260
|
+
cols: number,
|
|
261
|
+
noiseLevel: number,
|
|
262
|
+
options?: AutoContourOptions,
|
|
263
|
+
): AutoContourResult<true>;
|
|
264
|
+
export function findAutomaticContourLevels(
|
|
265
|
+
matrix: ArrayLike<number>,
|
|
266
|
+
rows: number,
|
|
267
|
+
cols: number,
|
|
268
|
+
noiseLevel: number,
|
|
269
|
+
options: AutoContourOptions & { diagnostics: false },
|
|
270
|
+
): AutoContourResult<false>;
|
|
271
|
+
|
|
272
|
+
export function findAutomaticContourLevels(
|
|
273
|
+
matrix: ArrayLike<number>,
|
|
274
|
+
rows: number,
|
|
275
|
+
cols: number,
|
|
276
|
+
noiseLevel: number,
|
|
277
|
+
options: AutoContourOptions = {},
|
|
278
|
+
): AutoContourResult<boolean> {
|
|
279
|
+
validateInput(matrix, rows, cols, noiseLevel);
|
|
280
|
+
|
|
281
|
+
const {
|
|
282
|
+
contourRatio = 1.4,
|
|
283
|
+
maxFdr = 0.05,
|
|
284
|
+
maxOccupancy = 0.02,
|
|
285
|
+
minPersistence = 0.35,
|
|
286
|
+
maxVerticalRidgeScore = 0.25,
|
|
287
|
+
maxHorizontalRidgeScore = 0.25,
|
|
288
|
+
ridgeCoverageThreshold = 0.5,
|
|
289
|
+
minSigma = 5,
|
|
290
|
+
candidateRatioExponent = 0.5,
|
|
291
|
+
persistenceLevels = 4,
|
|
292
|
+
maxAnalysisDimension = 384,
|
|
293
|
+
diagnostics = true,
|
|
294
|
+
} = options;
|
|
295
|
+
|
|
296
|
+
if (contourRatio <= 1) {
|
|
297
|
+
throw new Error('contourRatio must be > 1');
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
const analysis = maxPoolAbsolute(matrix, rows, cols, maxAnalysisDimension);
|
|
301
|
+
const {
|
|
302
|
+
values,
|
|
303
|
+
rows: analysisRows,
|
|
304
|
+
cols: analysisCols,
|
|
305
|
+
maxAbsoluteValue,
|
|
306
|
+
} = analysis;
|
|
307
|
+
const thresholdIndex = createThresholdIndex(values);
|
|
308
|
+
|
|
309
|
+
const maxSigmaInData = maxAbsoluteValue / noiseLevel;
|
|
310
|
+
const candidates = generateCandidateSigmaLevels(
|
|
311
|
+
minSigma,
|
|
312
|
+
maxSigmaInData,
|
|
313
|
+
contourRatio,
|
|
314
|
+
candidateRatioExponent,
|
|
315
|
+
);
|
|
316
|
+
|
|
317
|
+
const evaluations: Array<ReturnType<typeof evaluateThreshold>> = [];
|
|
318
|
+
let recommended: ReturnType<typeof evaluateThreshold> | undefined;
|
|
319
|
+
|
|
320
|
+
for (const sigmaMultiplier of candidates) {
|
|
321
|
+
const evaluation = evaluateThreshold(
|
|
322
|
+
values,
|
|
323
|
+
analysisRows,
|
|
324
|
+
analysisCols,
|
|
325
|
+
noiseLevel,
|
|
326
|
+
sigmaMultiplier,
|
|
327
|
+
contourRatio,
|
|
328
|
+
persistenceLevels,
|
|
329
|
+
ridgeCoverageThreshold,
|
|
330
|
+
false,
|
|
331
|
+
thresholdIndex,
|
|
332
|
+
);
|
|
333
|
+
evaluations.push(evaluation);
|
|
334
|
+
|
|
335
|
+
const passed =
|
|
336
|
+
evaluation.fdr <= maxFdr &&
|
|
337
|
+
evaluation.occupancy <= maxOccupancy &&
|
|
338
|
+
evaluation.persistence >= minPersistence;
|
|
339
|
+
|
|
340
|
+
if (passed) {
|
|
341
|
+
recommended = evaluation;
|
|
342
|
+
break;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
if (!recommended) {
|
|
347
|
+
recommended = evaluateFallbackThreshold(
|
|
348
|
+
evaluations,
|
|
349
|
+
maxFdr,
|
|
350
|
+
maxOccupancy,
|
|
351
|
+
minPersistence,
|
|
352
|
+
);
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
const ridgeFreeLevel = findRidgeFreeThresholdTopDown(
|
|
356
|
+
values,
|
|
357
|
+
analysisRows,
|
|
358
|
+
analysisCols,
|
|
359
|
+
noiseLevel,
|
|
360
|
+
recommended.sigmaMultiplier * noiseLevel,
|
|
361
|
+
maxAbsoluteValue,
|
|
362
|
+
contourRatio,
|
|
363
|
+
maxVerticalRidgeScore,
|
|
364
|
+
maxHorizontalRidgeScore,
|
|
365
|
+
ridgeCoverageThreshold,
|
|
366
|
+
);
|
|
367
|
+
|
|
368
|
+
const hasT1Noise =
|
|
369
|
+
recommended.verticalRidgeScore > maxVerticalRidgeScore ||
|
|
370
|
+
recommended.horizontalRidgeScore > maxHorizontalRidgeScore;
|
|
371
|
+
|
|
372
|
+
const result: AutoContourResult<boolean> = {
|
|
373
|
+
maxAbsoluteValue,
|
|
374
|
+
minLevel: recommended.sigmaMultiplier * noiseLevel,
|
|
375
|
+
minLevelWithoutT1Noise: ridgeFreeLevel,
|
|
376
|
+
hasT1Noise,
|
|
377
|
+
|
|
378
|
+
sigmaMultiplier: recommended.sigmaMultiplier,
|
|
379
|
+
sigmaMultiplierWithoutT1Noise: ridgeFreeLevel / noiseLevel,
|
|
380
|
+
};
|
|
381
|
+
|
|
382
|
+
if (diagnostics) {
|
|
383
|
+
const recommendedDiagnostics = evaluateThreshold(
|
|
384
|
+
values,
|
|
385
|
+
analysisRows,
|
|
386
|
+
analysisCols,
|
|
387
|
+
noiseLevel,
|
|
388
|
+
recommended.sigmaMultiplier,
|
|
389
|
+
contourRatio,
|
|
390
|
+
persistenceLevels,
|
|
391
|
+
ridgeCoverageThreshold,
|
|
392
|
+
true,
|
|
393
|
+
thresholdIndex,
|
|
394
|
+
);
|
|
395
|
+
const ridgeFree = evaluateThreshold(
|
|
396
|
+
values,
|
|
397
|
+
analysisRows,
|
|
398
|
+
analysisCols,
|
|
399
|
+
noiseLevel,
|
|
400
|
+
ridgeFreeLevel / noiseLevel,
|
|
401
|
+
contourRatio,
|
|
402
|
+
1,
|
|
403
|
+
ridgeCoverageThreshold,
|
|
404
|
+
true,
|
|
405
|
+
thresholdIndex,
|
|
406
|
+
);
|
|
407
|
+
|
|
408
|
+
result.diagnostics = {
|
|
409
|
+
recommended: {
|
|
410
|
+
sigmaMultiplier: recommendedDiagnostics.sigmaMultiplier,
|
|
411
|
+
minLevel: recommendedDiagnostics.sigmaMultiplier * noiseLevel,
|
|
412
|
+
occupancy: recommendedDiagnostics.occupancy,
|
|
413
|
+
fdr: recommendedDiagnostics.fdr,
|
|
414
|
+
persistence: recommendedDiagnostics.persistence,
|
|
415
|
+
verticalRidgeScore: recommendedDiagnostics.verticalRidgeScore,
|
|
416
|
+
horizontalRidgeScore: recommendedDiagnostics.horizontalRidgeScore,
|
|
417
|
+
},
|
|
418
|
+
ridgeFree: {
|
|
419
|
+
sigmaMultiplier: ridgeFree.sigmaMultiplier,
|
|
420
|
+
minLevel: ridgeFreeLevel,
|
|
421
|
+
occupancy: ridgeFree.occupancy,
|
|
422
|
+
fdr: ridgeFree.fdr,
|
|
423
|
+
persistence: ridgeFree.persistence,
|
|
424
|
+
verticalRidgeScore: ridgeFree.verticalRidgeScore,
|
|
425
|
+
horizontalRidgeScore: ridgeFree.horizontalRidgeScore,
|
|
426
|
+
},
|
|
427
|
+
};
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
return result;
|
|
431
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export function gaussianTwoSidedTail(k: number): number {
|
|
2
|
+
return erfc(k / Math.SQRT2);
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Approximation of the complementary error function.
|
|
7
|
+
* @TODO it would be replaced by the same implementation from ml-spectra-processing.
|
|
8
|
+
*/
|
|
9
|
+
function erfc(x: number): number {
|
|
10
|
+
const sign = x < 0 ? -1 : 1;
|
|
11
|
+
const ax = Math.abs(x);
|
|
12
|
+
|
|
13
|
+
const p = 0.3275911;
|
|
14
|
+
|
|
15
|
+
const a1 = 0.254829592;
|
|
16
|
+
const a2 = -0.284496736;
|
|
17
|
+
const a3 = 1.421413741;
|
|
18
|
+
const a4 = -1.453152027;
|
|
19
|
+
const a5 = 1.061405429;
|
|
20
|
+
|
|
21
|
+
const t = 1 / (1 + p * ax);
|
|
22
|
+
|
|
23
|
+
const polynomial = ((((a5 * t + a4) * t + a3) * t + a2) * t + a1) * t;
|
|
24
|
+
|
|
25
|
+
const result = polynomial * Math.exp(-ax * ax);
|
|
26
|
+
|
|
27
|
+
return sign >= 0 ? result : 2 - result;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function violation(value: number, limit: number): number {
|
|
31
|
+
if (limit === 0) {
|
|
32
|
+
return value === 0 ? 0 : 1;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return Math.max(0, value / limit - 1);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function validateInput(
|
|
39
|
+
matrix: ArrayLike<number>,
|
|
40
|
+
rows: number,
|
|
41
|
+
cols: number,
|
|
42
|
+
noiseLevel: number,
|
|
43
|
+
): void {
|
|
44
|
+
if (!Number.isInteger(rows) || rows <= 0) {
|
|
45
|
+
throw new Error('rows must be a positive integer');
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (!Number.isInteger(cols) || cols <= 0) {
|
|
49
|
+
throw new Error('cols must be a positive integer');
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (matrix.length !== rows * cols) {
|
|
53
|
+
throw new Error('matrix.length must equal rows * cols');
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (!Number.isFinite(noiseLevel) || noiseLevel <= 0) {
|
|
57
|
+
throw new Error('noiseLevel must be a positive finite number');
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -4,13 +4,14 @@ import { xNoiseSanPlot } from 'ml-spectra-processing';
|
|
|
4
4
|
export function calculateSanPlot<T extends '1D' | '2D'>(
|
|
5
5
|
dimension: T,
|
|
6
6
|
data: T extends '1D' ? NmrData1D : NmrData2DFt['rr'],
|
|
7
|
+
options?: { magnitudeMode?: boolean },
|
|
7
8
|
) {
|
|
8
9
|
const input =
|
|
9
10
|
dimension === '1D'
|
|
10
11
|
? prepare1DData(data as NmrData1D)
|
|
11
12
|
: prepare2DData(data as NmrData2DFt['rr']);
|
|
12
13
|
|
|
13
|
-
return xNoiseSanPlot(input);
|
|
14
|
+
return xNoiseSanPlot(input, options);
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
function prepare1DData(data: NmrData1D) {
|
package/src/versionInfo.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default { version: 'v2.
|
|
1
|
+
export default { version: 'v2.7.0' };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transferDocumentStyles.d.ts","sourceRoot":"","sources":["../../../../../src/component/elements/export/utilities/transferDocumentStyles.ts"],"names":[],"mappings":"AAAA,wBAAgB,sBAAsB,CAAC,cAAc,EAAE,QAAQ,QAoB9D"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export function transferDocumentStyles(targetDocument) {
|
|
2
|
-
// Copy the style from the main page and inject it inside the iframe
|
|
3
|
-
const styleSheets = Array.from(document.styleSheets);
|
|
4
|
-
const targetHead = targetDocument.head;
|
|
5
|
-
for (const styleSheet of styleSheets) {
|
|
6
|
-
try {
|
|
7
|
-
if (styleSheet.cssRules) {
|
|
8
|
-
const newStyleEl = document.createElement('style');
|
|
9
|
-
const cssRules = Array.from(styleSheet.cssRules);
|
|
10
|
-
const cssText = cssRules.map((rule) => rule.cssText).join('\n');
|
|
11
|
-
newStyleEl.append(document.createTextNode(cssText));
|
|
12
|
-
targetHead.append(newStyleEl);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
catch (error) {
|
|
16
|
-
// eslint-disable-next-line no-console
|
|
17
|
-
console.error('Error transferring styles:', error);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
//# sourceMappingURL=transferDocumentStyles.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transferDocumentStyles.js","sourceRoot":"","sources":["../../../../../src/component/elements/export/utilities/transferDocumentStyles.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,sBAAsB,CAAC,cAAwB;IAC7D,oEAAoE;IACpE,MAAM,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;IACrD,MAAM,UAAU,GAAG,cAAc,CAAC,IAAI,CAAC;IAEvC,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE,CAAC;QACrC,IAAI,CAAC;YACH,IAAI,UAAU,CAAC,QAAQ,EAAE,CAAC;gBACxB,MAAM,UAAU,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;gBACnD,MAAM,QAAQ,GAAG,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;gBACjD,MAAM,OAAO,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBAEhE,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;gBACpD,UAAU,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;YAChC,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,sCAAsC;YACtC,OAAO,CAAC,KAAK,CAAC,4BAA4B,EAAE,KAAK,CAAC,CAAC;QACrD,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export declare class PathBuilder {
|
|
2
|
-
private path;
|
|
3
|
-
private appendPath;
|
|
4
|
-
moveTo(x: number, y: number): void;
|
|
5
|
-
lineTo(x: number, y: number): void;
|
|
6
|
-
closePath(): void;
|
|
7
|
-
toString(): string;
|
|
8
|
-
concatPath(pathBuilder: PathBuilder): string;
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=PathBuilder.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PathBuilder.d.ts","sourceRoot":"","sources":["../../../src/component/utility/PathBuilder.ts"],"names":[],"mappings":"AAAA,qBAAa,WAAW;IACtB,OAAO,CAAC,IAAI,CAAM;IAElB,OAAO,CAAC,UAAU;IAIX,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM;IAM3B,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM;IAM3B,SAAS;IAIT,QAAQ;IAIR,UAAU,CAAC,WAAW,EAAE,WAAW;CAG3C"}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
export class PathBuilder {
|
|
2
|
-
path = '';
|
|
3
|
-
appendPath(segment) {
|
|
4
|
-
this.path += `${segment} `;
|
|
5
|
-
}
|
|
6
|
-
moveTo(x, y) {
|
|
7
|
-
x = clamp(x);
|
|
8
|
-
y = clamp(y);
|
|
9
|
-
this.appendPath(`M ${x} ${y}`);
|
|
10
|
-
}
|
|
11
|
-
lineTo(x, y) {
|
|
12
|
-
x = clamp(x);
|
|
13
|
-
y = clamp(y);
|
|
14
|
-
this.appendPath(`L ${x} ${y}`);
|
|
15
|
-
}
|
|
16
|
-
closePath() {
|
|
17
|
-
if (this.path.length > 0)
|
|
18
|
-
this.appendPath('Z');
|
|
19
|
-
}
|
|
20
|
-
toString() {
|
|
21
|
-
return this.path.trim();
|
|
22
|
-
}
|
|
23
|
-
concatPath(pathBuilder) {
|
|
24
|
-
return (this.path + pathBuilder.path).trim();
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Clamp values to avoid rendering issues of the SVG.
|
|
29
|
-
* This assumes that the viewport has pixel coordinates (so the max values are outside of the visible area)
|
|
30
|
-
*/
|
|
31
|
-
function clamp(value) {
|
|
32
|
-
if (value < -1e5)
|
|
33
|
-
return -1e5;
|
|
34
|
-
if (value > 1e5)
|
|
35
|
-
return 1e5;
|
|
36
|
-
return value;
|
|
37
|
-
}
|
|
38
|
-
//# sourceMappingURL=PathBuilder.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PathBuilder.js","sourceRoot":"","sources":["../../../src/component/utility/PathBuilder.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,WAAW;IACd,IAAI,GAAG,EAAE,CAAC;IAEV,UAAU,CAAC,OAAe;QAChC,IAAI,CAAC,IAAI,IAAI,GAAG,OAAO,GAAG,CAAC;IAC7B,CAAC;IAEM,MAAM,CAAC,CAAS,EAAE,CAAS;QAChC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACb,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACb,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACjC,CAAC;IAEM,MAAM,CAAC,CAAS,EAAE,CAAS;QAChC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACb,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACb,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACjC,CAAC;IAEM,SAAS;QACd,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC;YAAE,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;IACjD,CAAC;IAEM,QAAQ;QACb,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;IAC1B,CAAC;IAEM,UAAU,CAAC,WAAwB;QACxC,OAAO,CAAC,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;IAC/C,CAAC;CACF;AAED;;;GAGG;AACH,SAAS,KAAK,CAAC,KAAa;IAC1B,IAAI,KAAK,GAAG,CAAC,GAAG;QAAE,OAAO,CAAC,GAAG,CAAC;IAC9B,IAAI,KAAK,GAAG,GAAG;QAAE,OAAO,GAAG,CAAC;IAC5B,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export function transferDocumentStyles(targetDocument: Document) {
|
|
2
|
-
// Copy the style from the main page and inject it inside the iframe
|
|
3
|
-
const styleSheets = Array.from(document.styleSheets);
|
|
4
|
-
const targetHead = targetDocument.head;
|
|
5
|
-
|
|
6
|
-
for (const styleSheet of styleSheets) {
|
|
7
|
-
try {
|
|
8
|
-
if (styleSheet.cssRules) {
|
|
9
|
-
const newStyleEl = document.createElement('style');
|
|
10
|
-
const cssRules = Array.from(styleSheet.cssRules);
|
|
11
|
-
const cssText = cssRules.map((rule) => rule.cssText).join('\n');
|
|
12
|
-
|
|
13
|
-
newStyleEl.append(document.createTextNode(cssText));
|
|
14
|
-
targetHead.append(newStyleEl);
|
|
15
|
-
}
|
|
16
|
-
} catch (error) {
|
|
17
|
-
// eslint-disable-next-line no-console
|
|
18
|
-
console.error('Error transferring styles:', error);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
export class PathBuilder {
|
|
2
|
-
private path = '';
|
|
3
|
-
|
|
4
|
-
private appendPath(segment: string) {
|
|
5
|
-
this.path += `${segment} `;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
public moveTo(x: number, y: number) {
|
|
9
|
-
x = clamp(x);
|
|
10
|
-
y = clamp(y);
|
|
11
|
-
this.appendPath(`M ${x} ${y}`);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
public lineTo(x: number, y: number) {
|
|
15
|
-
x = clamp(x);
|
|
16
|
-
y = clamp(y);
|
|
17
|
-
this.appendPath(`L ${x} ${y}`);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
public closePath() {
|
|
21
|
-
if (this.path.length > 0) this.appendPath('Z');
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
public toString() {
|
|
25
|
-
return this.path.trim();
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
public concatPath(pathBuilder: PathBuilder) {
|
|
29
|
-
return (this.path + pathBuilder.path).trim();
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Clamp values to avoid rendering issues of the SVG.
|
|
35
|
-
* This assumes that the viewport has pixel coordinates (so the max values are outside of the visible area)
|
|
36
|
-
*/
|
|
37
|
-
function clamp(value: number) {
|
|
38
|
-
if (value < -1e5) return -1e5;
|
|
39
|
-
if (value > 1e5) return 1e5;
|
|
40
|
-
return value;
|
|
41
|
-
}
|