nmrium 2.3.0 → 2.4.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.
Files changed (176) hide show
  1. package/lib/component/1d/peaks/PeakEditionManager.d.ts +1 -1
  2. package/lib/component/1d-2d/tools/BrushXY.js +6 -6
  3. package/lib/component/1d-2d/tools/BrushXY.js.map +1 -1
  4. package/lib/component/2d/1d-tracer/Left1DChart.d.ts.map +1 -1
  5. package/lib/component/2d/1d-tracer/Left1DChart.js +6 -2
  6. package/lib/component/2d/1d-tracer/Left1DChart.js.map +1 -1
  7. package/lib/component/2d/1d-tracer/Ranges1D.d.ts +9 -0
  8. package/lib/component/2d/1d-tracer/Ranges1D.d.ts.map +1 -0
  9. package/lib/component/2d/1d-tracer/Ranges1D.js +76 -0
  10. package/lib/component/2d/1d-tracer/Ranges1D.js.map +1 -0
  11. package/lib/component/2d/1d-tracer/Signals1D.d.ts +11 -0
  12. package/lib/component/2d/1d-tracer/Signals1D.d.ts.map +1 -0
  13. package/lib/component/2d/1d-tracer/Signals1D.js +90 -0
  14. package/lib/component/2d/1d-tracer/Signals1D.js.map +1 -0
  15. package/lib/component/2d/1d-tracer/Top1DChart.d.ts.map +1 -1
  16. package/lib/component/2d/1d-tracer/Top1DChart.js +6 -2
  17. package/lib/component/2d/1d-tracer/Top1DChart.js.map +1 -1
  18. package/lib/component/2d/ft/FTContainer.d.ts.map +1 -1
  19. package/lib/component/2d/ft/FTContainer.js.map +1 -1
  20. package/lib/component/AnchorSVG.d.ts +37 -0
  21. package/lib/component/AnchorSVG.d.ts.map +1 -0
  22. package/lib/component/AnchorSVG.js +137 -0
  23. package/lib/component/AnchorSVG.js.map +1 -0
  24. package/lib/component/EventsTrackers/BrushTracker.d.ts.map +1 -1
  25. package/lib/component/EventsTrackers/BrushTracker.js +4 -0
  26. package/lib/component/EventsTrackers/BrushTracker.js.map +1 -1
  27. package/lib/component/context/KeyModifierContext.d.ts +1 -0
  28. package/lib/component/context/KeyModifierContext.d.ts.map +1 -1
  29. package/lib/component/context/KeyModifierContext.js +4 -0
  30. package/lib/component/context/KeyModifierContext.js.map +1 -1
  31. package/lib/component/elements/DraggableDialog.d.ts.map +1 -1
  32. package/lib/component/elements/DraggableDialog.js +1 -2
  33. package/lib/component/elements/DraggableDialog.js.map +1 -1
  34. package/lib/component/elements/Sections.d.ts +3 -3
  35. package/lib/component/elements/Sections.d.ts.map +1 -1
  36. package/lib/component/elements/Sections.js +1 -1
  37. package/lib/component/elements/Sections.js.map +1 -1
  38. package/lib/component/elements/export/ExportOptionsModal.js +2 -5
  39. package/lib/component/elements/export/ExportOptionsModal.js.map +1 -1
  40. package/lib/component/header/Header.d.ts.map +1 -1
  41. package/lib/component/header/Header.js +2 -4
  42. package/lib/component/header/Header.js.map +1 -1
  43. package/lib/component/hooks/useSaveSettings.d.ts.map +1 -1
  44. package/lib/component/hooks/useSaveSettings.js +3 -6
  45. package/lib/component/hooks/useSaveSettings.js.map +1 -1
  46. package/lib/component/modal/PublicationStringModal.d.ts.map +1 -1
  47. package/lib/component/modal/PublicationStringModal.js +2 -6
  48. package/lib/component/modal/PublicationStringModal.js.map +1 -1
  49. package/lib/component/modal/SaveAsModal.js +3 -6
  50. package/lib/component/modal/SaveAsModal.js.map +1 -1
  51. package/lib/component/modal/aboutUs/AboutUsModal.d.ts.map +1 -1
  52. package/lib/component/modal/aboutUs/AboutUsModal.js +2 -4
  53. package/lib/component/modal/aboutUs/AboutUsModal.js.map +1 -1
  54. package/lib/component/modal/editRange/forms/components/NewSignalTab.d.ts.map +1 -1
  55. package/lib/component/modal/editRange/forms/components/NewSignalTab.js +38 -36
  56. package/lib/component/modal/editRange/forms/components/NewSignalTab.js.map +1 -1
  57. package/lib/component/modal/setting/tanstack_general_settings/errors/context.d.ts +24 -24
  58. package/lib/component/modal/setting/tanstack_general_settings/errors/renderer.d.ts +24 -24
  59. package/lib/component/modal/setting/tanstack_general_settings/general_settings.d.ts.map +1 -1
  60. package/lib/component/modal/setting/tanstack_general_settings/general_settings.js +9 -12
  61. package/lib/component/modal/setting/tanstack_general_settings/general_settings.js.map +1 -1
  62. package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_body.d.ts +24 -24
  63. package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_footer.d.ts +24 -24
  64. package/lib/component/modal/setting/tanstack_general_settings/general_settings_dialog_header.d.ts +24 -24
  65. package/lib/component/modal/setting/tanstack_general_settings/hooks/use_safe_workspace.d.ts +4 -4
  66. package/lib/component/modal/setting/tanstack_general_settings/tabs/auto_processing_tab.d.ts +24 -24
  67. package/lib/component/modal/setting/tanstack_general_settings/tabs/axis_tab.d.ts +24 -24
  68. package/lib/component/modal/setting/tanstack_general_settings/tabs/database_tab.d.ts +24 -24
  69. package/lib/component/modal/setting/tanstack_general_settings/tabs/export_tab.d.ts +24 -24
  70. package/lib/component/modal/setting/tanstack_general_settings/tabs/external_api_tab.d.ts +24 -24
  71. package/lib/component/modal/setting/tanstack_general_settings/tabs/general_tab.d.ts +24 -24
  72. package/lib/component/modal/setting/tanstack_general_settings/tabs/import_filters_tab.d.ts +24 -24
  73. package/lib/component/modal/setting/tanstack_general_settings/tabs/nuclei_tab.d.ts +24 -24
  74. package/lib/component/modal/setting/tanstack_general_settings/tabs/panels_tab.d.ts +24 -24
  75. package/lib/component/modal/setting/tanstack_general_settings/tabs/spectra_colors_tab.d.ts +24 -24
  76. package/lib/component/modal/setting/tanstack_general_settings/tabs/spectra_label_tab.d.ts +24 -24
  77. package/lib/component/modal/setting/tanstack_general_settings/tabs/title_block_tab.d.ts +24 -24
  78. package/lib/component/modal/setting/tanstack_general_settings/tabs/tools_tab.d.ts +24 -24
  79. package/lib/component/panels/PeaksPanel/PeaksPanel.d.ts.map +1 -1
  80. package/lib/component/panels/PeaksPanel/PeaksPanel.js +1 -9
  81. package/lib/component/panels/PeaksPanel/PeaksPanel.js.map +1 -1
  82. package/lib/component/panels/PeaksPanel/PeaksPreferences.js +1 -1
  83. package/lib/component/panels/PeaksPanel/PeaksPreferences.js.map +1 -1
  84. package/lib/component/panels/PeaksPanel/PeaksTable.d.ts.map +1 -1
  85. package/lib/component/panels/PeaksPanel/PeaksTable.js +9 -9
  86. package/lib/component/panels/PeaksPanel/PeaksTable.js.map +1 -1
  87. package/lib/component/panels/SummaryPanel/SummaryPanel.d.ts.map +1 -1
  88. package/lib/component/panels/SummaryPanel/SummaryPanel.js +7 -0
  89. package/lib/component/panels/SummaryPanel/SummaryPanel.js.map +1 -1
  90. package/lib/component/panels/filtersPanel/FilterPanel.d.ts.map +1 -1
  91. package/lib/component/panels/filtersPanel/FilterPanel.js +5 -2
  92. package/lib/component/panels/filtersPanel/FilterPanel.js.map +1 -1
  93. package/lib/component/panels/filtersPanel/Filters/base/BaseApodizationOptions.js +1 -1
  94. package/lib/component/panels/filtersPanel/Filters/base/BaseApodizationOptions.js.map +1 -1
  95. package/lib/component/panels/filtersPanel/processings_sections_panel.d.ts +2 -0
  96. package/lib/component/panels/filtersPanel/processings_sections_panel.d.ts.map +1 -0
  97. package/lib/component/panels/filtersPanel/processings_sections_panel.js +144 -0
  98. package/lib/component/panels/filtersPanel/processings_sections_panel.js.map +1 -0
  99. package/lib/component/reducer/Reducer.d.ts.map +1 -1
  100. package/lib/component/reducer/Reducer.js +2 -0
  101. package/lib/component/reducer/Reducer.js.map +1 -1
  102. package/lib/component/reducer/actions/CorrelationsActions.js +1 -1
  103. package/lib/component/reducer/actions/CorrelationsActions.js.map +1 -1
  104. package/lib/component/reducer/actions/MoleculeActions.d.ts +9 -0
  105. package/lib/component/reducer/actions/MoleculeActions.d.ts.map +1 -1
  106. package/lib/component/reducer/actions/RangesActions.d.ts +11 -2
  107. package/lib/component/reducer/actions/RangesActions.d.ts.map +1 -1
  108. package/lib/component/reducer/actions/RangesActions.js +23 -5
  109. package/lib/component/reducer/actions/RangesActions.js.map +1 -1
  110. package/lib/component/reducer/actions/ToolsActions.d.ts.map +1 -1
  111. package/lib/component/reducer/actions/ToolsActions.js +5 -17
  112. package/lib/component/reducer/actions/ToolsActions.js.map +1 -1
  113. package/lib/component/reducer/helper/getTraceSpectrumID.d.ts +5 -0
  114. package/lib/component/reducer/helper/getTraceSpectrumID.d.ts.map +1 -0
  115. package/lib/component/reducer/helper/getTraceSpectrumID.js +14 -0
  116. package/lib/component/reducer/helper/getTraceSpectrumID.js.map +1 -0
  117. package/lib/component/toolbar/nmr_toolbar.d.ts.map +1 -1
  118. package/lib/component/toolbar/nmr_toolbar.js +3 -1
  119. package/lib/component/toolbar/nmr_toolbar.js.map +1 -1
  120. package/lib/component/utility/CoreSlot.d.ts +27 -0
  121. package/lib/component/utility/CoreSlot.d.ts.map +1 -0
  122. package/lib/component/utility/CoreSlot.js +56 -0
  123. package/lib/component/utility/CoreSlot.js.map +1 -0
  124. package/lib/data/data1d/Spectrum1D/peaks/autoPeakPicking.d.ts.map +1 -1
  125. package/lib/data/data1d/Spectrum1D/peaks/autoPeakPicking.js +1 -0
  126. package/lib/data/data1d/Spectrum1D/peaks/autoPeakPicking.js.map +1 -1
  127. package/lib/data/data1d/Spectrum1D/peaks/optimizePeaks.d.ts.map +1 -1
  128. package/lib/data/data1d/Spectrum1D/peaks/optimizePeaks.js +35 -30
  129. package/lib/data/data1d/Spectrum1D/peaks/optimizePeaks.js.map +1 -1
  130. package/lib/data/data1d/Spectrum1D/ranges/detectSignalsByMultipletAnalysis.d.ts.map +1 -1
  131. package/lib/data/data1d/Spectrum1D/ranges/detectSignalsByMultipletAnalysis.js +1 -0
  132. package/lib/data/data1d/Spectrum1D/ranges/detectSignalsByMultipletAnalysis.js.map +1 -1
  133. package/lib/versionInfo.js +1 -1
  134. package/package.json +25 -24
  135. package/src/component/1d-2d/tools/BrushXY.tsx +8 -8
  136. package/src/component/2d/1d-tracer/Left1DChart.tsx +24 -1
  137. package/src/component/2d/1d-tracer/Ranges1D.tsx +134 -0
  138. package/src/component/2d/1d-tracer/Signals1D.tsx +145 -0
  139. package/src/component/2d/1d-tracer/Top1DChart.tsx +29 -2
  140. package/src/component/2d/ft/FTContainer.tsx +1 -0
  141. package/src/component/AnchorSVG.tsx +370 -0
  142. package/src/component/EventsTrackers/BrushTracker.tsx +6 -0
  143. package/src/component/context/KeyModifierContext.tsx +5 -0
  144. package/src/component/elements/DraggableDialog.tsx +1 -2
  145. package/src/component/elements/Sections.tsx +4 -4
  146. package/src/component/elements/export/ExportOptionsModal.tsx +22 -31
  147. package/src/component/header/Header.tsx +2 -4
  148. package/src/component/hooks/useSaveSettings.tsx +4 -15
  149. package/src/component/modal/PublicationStringModal.tsx +5 -11
  150. package/src/component/modal/SaveAsModal.tsx +41 -50
  151. package/src/component/modal/aboutUs/AboutUsModal.tsx +5 -4
  152. package/src/component/modal/editRange/forms/components/NewSignalTab.tsx +57 -57
  153. package/src/component/modal/setting/tanstack_general_settings/general_settings.tsx +23 -29
  154. package/src/component/panels/PeaksPanel/PeaksPanel.tsx +1 -8
  155. package/src/component/panels/PeaksPanel/PeaksPreferences.tsx +1 -1
  156. package/src/component/panels/PeaksPanel/PeaksTable.tsx +11 -9
  157. package/src/component/panels/SummaryPanel/SummaryPanel.tsx +13 -11
  158. package/src/component/panels/filtersPanel/FilterPanel.tsx +10 -0
  159. package/src/component/panels/filtersPanel/Filters/base/BaseApodizationOptions.tsx +1 -0
  160. package/src/component/panels/filtersPanel/processings_sections_panel.tsx +324 -0
  161. package/src/component/reducer/Reducer.ts +2 -0
  162. package/src/component/reducer/actions/CorrelationsActions.ts +1 -1
  163. package/src/component/reducer/actions/RangesActions.ts +39 -5
  164. package/src/component/reducer/actions/ToolsActions.ts +5 -21
  165. package/src/component/reducer/helper/getTraceSpectrumID.tsx +25 -0
  166. package/src/component/toolbar/nmr_toolbar.tsx +3 -2
  167. package/src/component/utility/CoreSlot.tsx +126 -0
  168. package/src/data/data1d/Spectrum1D/peaks/autoPeakPicking.ts +1 -0
  169. package/src/data/data1d/Spectrum1D/peaks/optimizePeaks.ts +35 -30
  170. package/src/data/data1d/Spectrum1D/ranges/detectSignalsByMultipletAnalysis.ts +1 -0
  171. package/src/versionInfo.ts +1 -1
  172. package/lib/component/utility/renderCoreSlot.d.ts +0 -11
  173. package/lib/component/utility/renderCoreSlot.d.ts.map +0 -1
  174. package/lib/component/utility/renderCoreSlot.js +0 -13
  175. package/lib/component/utility/renderCoreSlot.js.map +0 -1
  176. package/src/component/utility/renderCoreSlot.tsx +0 -21
@@ -36,6 +36,9 @@ export function optimizePeaks(
36
36
  groupingFactor: 10,
37
37
  stages: [
38
38
  {
39
+ // Stage 1: local stabilization
40
+ factorLimits: 2,
41
+ maxNumberOfPeaks: 40,
39
42
  optimization: {
40
43
  kind: 'lm',
41
44
  options: { maxIterations: 20, errorTolerance: 1e-3 },
@@ -43,98 +46,100 @@ export function optimizePeaks(
43
46
  parameters: {
44
47
  fwhm: {
45
48
  optimize: true,
46
- min: (peak: any) => (peak.shape?.fwhm ?? 0) / 2,
49
+ min: (peak: any) => (peak.shape?.fwhm ?? 0) * 0.5,
47
50
  max: (peak: any) => (peak.shape?.fwhm ?? 0) * 2,
48
51
  },
49
52
  mu: { optimize: false },
50
53
  x: { optimize: false },
51
54
  y: {
52
55
  optimize: true,
53
- init: (peak: any) => peak.y * 0.8,
56
+ init: (peak: any) => peak.y,
54
57
  },
55
58
  },
56
59
  },
57
60
  {
61
+ factorLimits: 2,
62
+ maxNumberOfPeaks: 40,
58
63
  optimization: {
59
64
  kind: 'lm',
60
- options: { maxIterations: 20, errorTolerance: 5e-4 },
65
+ options: { maxIterations: 20, errorTolerance: 1e-3 },
61
66
  },
62
67
  parameters: {
63
68
  fwhm: {
64
69
  optimize: true,
65
- min: (peak: any) => (peak.shape?.fwhm ?? 0) / 2,
70
+ min: (peak: any) => (peak.shape?.fwhm ?? 0) * 0.5,
66
71
  max: (peak: any) => (peak.shape?.fwhm ?? 0) * 2,
67
72
  },
68
73
  mu: { optimize: false },
69
74
  x: { optimize: false },
70
75
  y: {
71
76
  optimize: true,
77
+ init: (peak: any) => peak.y,
72
78
  },
73
79
  },
74
80
  },
75
81
  {
82
+ // Stage 2: regroup into the real overlapping cluster
83
+ factorLimits: 2,
84
+ maxNumberOfPeaks: 40,
76
85
  optimization: {
77
86
  kind: 'lm',
78
- options: { maxIterations: 20, errorTolerance: 1e-5 },
87
+ options: { maxIterations: 25, errorTolerance: 1e-4 },
79
88
  },
80
89
  parameters: {
81
90
  fwhm: {
82
91
  optimize: true,
83
- min: (peak: any) => (peak.shape?.fwhm ?? 0) / 2,
92
+ min: (peak: any) => (peak.shape?.fwhm ?? 0) * 0.5,
84
93
  max: (peak: any) => (peak.shape?.fwhm ?? 0) * 2,
85
94
  },
86
95
  mu: { optimize: true },
87
96
  x: { optimize: false },
88
- y: {
89
- optimize: true,
90
- },
97
+ y: { optimize: true },
91
98
  },
92
99
  },
93
100
  {
101
+ // Stage 3: final polish
102
+ factorLimits: 2,
103
+ maxNumberOfPeaks: 40,
94
104
  optimization: {
95
105
  kind: 'lm',
96
- options: { maxIterations: 20, errorTolerance: 5e-4 },
106
+ options: { maxIterations: 30, errorTolerance: 1e-5 },
97
107
  },
98
108
  parameters: {
99
109
  fwhm: {
100
110
  optimize: true,
101
- min: (peak: any) => (peak.shape?.fwhm ?? 0) / 3,
102
- max: (peak: any) => (peak.shape?.fwhm ?? 0) * 3,
111
+ min: (peak: any) => (peak.shape?.fwhm ?? 0) * 0.5,
112
+ max: (peak: any) => (peak.shape?.fwhm ?? 0) * 2,
103
113
  },
104
114
  mu: { optimize: true },
105
- x: { optimize: true },
106
- y: { optimize: true },
107
- },
108
- },
109
- {
110
- optimization: {
111
- kind: 'lm',
112
- options: { maxIterations: 20, errorTolerance: 1e-4 },
113
- },
114
- parameters: {
115
- fwhm: {
115
+ x: {
116
116
  optimize: true,
117
- min: (peak: any) => (peak.shape?.fwhm ?? 0) / 2,
118
- max: (peak: any) => (peak.shape?.fwhm ?? 0) * 2,
117
+ min: (peak: any) => peak.x - (peak.shape?.fwhm ?? 0) / 4,
118
+ max: (peak: any) => peak.x + (peak.shape?.fwhm ?? 0) / 4,
119
119
  },
120
- mu: { optimize: false },
121
- x: { optimize: true },
122
120
  y: { optimize: true },
123
121
  },
124
122
  },
125
123
  {
124
+ // Stage 3: final polish
125
+ factorLimits: 2,
126
+ maxNumberOfPeaks: 40,
126
127
  optimization: {
127
128
  kind: 'lm',
128
- options: { maxIterations: 20, errorTolerance: 1e-8 },
129
+ options: { maxIterations: 30, errorTolerance: 1e-5 },
129
130
  },
130
131
  parameters: {
131
132
  fwhm: {
132
133
  optimize: true,
133
- min: (peak: any) => (peak.shape?.fwhm ?? 0) / 2,
134
+ min: (peak: any) => (peak.shape?.fwhm ?? 0) * 0.5,
134
135
  max: (peak: any) => (peak.shape?.fwhm ?? 0) * 2,
135
136
  },
136
137
  mu: { optimize: true },
137
- x: { optimize: true },
138
+ x: {
139
+ optimize: true,
140
+ min: (peak: any) => peak.x - (peak.shape?.fwhm ?? 0) / 4,
141
+ max: (peak: any) => peak.x + (peak.shape?.fwhm ?? 0) / 4,
142
+ },
138
143
  y: { optimize: true },
139
144
  },
140
145
  },
@@ -35,6 +35,7 @@ export function detectSignalsByMultipletAnalysis(
35
35
  to,
36
36
  frequency,
37
37
  minMaxRatio: 0.1,
38
+ maxAbsoluteRatio: 0.1,
38
39
  broadWidth: 0.25,
39
40
  broadRatio: 0.0025,
40
41
  optimize: true,
@@ -1 +1 @@
1
- export default { version: 'v2.3.0' };
1
+ export default { version: 'v2.4.0' };
@@ -1,11 +0,0 @@
1
- import type { NMRiumCore, SupportedUISlot } from '@zakodium/nmrium-core';
2
- import type { ReactNode } from 'react';
3
- /**
4
- * Render all components registered in the given slot.
5
- *
6
- * @param core
7
- * @param slot
8
- * @param fallback - return fallback if no component is registered in the slot
9
- */
10
- export declare function renderCoreSlot(core: NMRiumCore, slot: SupportedUISlot, fallback?: ReactNode): ReactNode;
11
- //# sourceMappingURL=renderCoreSlot.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"renderCoreSlot.d.ts","sourceRoot":"","sources":["../../../src/component/utility/renderCoreSlot.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,eAAe,EACrB,QAAQ,CAAC,EAAE,SAAS,GACnB,SAAS,CAMX"}
@@ -1,13 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- /**
3
- * Render all components registered in the given slot.
4
- *
5
- * @param core
6
- * @param slot
7
- * @param fallback - return fallback if no component is registered in the slot
8
- */
9
- export function renderCoreSlot(core, slot, fallback) {
10
- const jsx = Array.from(core.slot(slot), ([key, Component]) => (_jsx(Component, { slot: slot }, key)));
11
- return jsx.length > 0 ? jsx : fallback;
12
- }
13
- //# sourceMappingURL=renderCoreSlot.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"renderCoreSlot.js","sourceRoot":"","sources":["../../../src/component/utility/renderCoreSlot.tsx"],"names":[],"mappings":";AAGA;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAC5B,IAAgB,EAChB,IAAqB,EACrB,QAAoB;IAEpB,MAAM,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,SAAS,CAAC,EAAE,EAAE,CAAC,CAC5D,KAAC,SAAS,IAAW,IAAI,EAAE,IAAI,IAAf,GAAG,CAAgB,CACpC,CAAC,CAAC;IAEH,OAAO,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC;AACzC,CAAC"}
@@ -1,21 +0,0 @@
1
- import type { NMRiumCore, SupportedUISlot } from '@zakodium/nmrium-core';
2
- import type { ReactNode } from 'react';
3
-
4
- /**
5
- * Render all components registered in the given slot.
6
- *
7
- * @param core
8
- * @param slot
9
- * @param fallback - return fallback if no component is registered in the slot
10
- */
11
- export function renderCoreSlot(
12
- core: NMRiumCore,
13
- slot: SupportedUISlot,
14
- fallback?: ReactNode,
15
- ): ReactNode {
16
- const jsx = Array.from(core.slot(slot), ([key, Component]) => (
17
- <Component key={key} slot={slot} />
18
- ));
19
-
20
- return jsx.length > 0 ? jsx : fallback;
21
- }