@zakodium/nmrium-core 0.1.5 → 0.1.7
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/nmrium-core.d.ts +6 -3
- package/dist/nmrium-core.js +3 -3
- package/package.json +7 -7
package/dist/nmrium-core.d.ts
CHANGED
|
@@ -36,7 +36,7 @@ export declare interface AdvanceExportSettings extends BaseExportSettings {
|
|
|
36
36
|
/**
|
|
37
37
|
* Used by plugins to register UI slots.
|
|
38
38
|
*/
|
|
39
|
-
export declare const ALLOWED_UI_SLOTS: readonly ["topbar.right"];
|
|
39
|
+
export declare const ALLOWED_UI_SLOTS: readonly ["topbar.right", "topbar.about_us.modal"];
|
|
40
40
|
|
|
41
41
|
export declare type AllowedUISlot = (typeof ALLOWED_UI_SLOTS)[number];
|
|
42
42
|
|
|
@@ -625,6 +625,7 @@ export declare interface NMRiumToolBarPreferences {
|
|
|
625
625
|
multipleSpectraAnalysis: boolean;
|
|
626
626
|
exclusionZones: boolean;
|
|
627
627
|
autoRangeAndZonePicking: boolean;
|
|
628
|
+
inset: boolean;
|
|
628
629
|
}
|
|
629
630
|
|
|
630
631
|
/**
|
|
@@ -737,7 +738,7 @@ export declare interface PeaksViewState {
|
|
|
737
738
|
|
|
738
739
|
export declare type PluginUIComponent = (props: PluginUIComponentProps) => ReactNode;
|
|
739
740
|
|
|
740
|
-
export declare type PluginUIComponentProps = PluginUIComponentTopBarRightProps;
|
|
741
|
+
export declare type PluginUIComponentProps = PluginUIComponentTopBarRightProps | PluginUIComponentTopBarAboutUsModalProps;
|
|
741
742
|
|
|
742
743
|
export declare type PluginUIComponentRegistry = Partial<Record<AllowedUISlot, PluginUIComponent>>;
|
|
743
744
|
|
|
@@ -745,6 +746,8 @@ export declare interface PluginUIComponentSlotProps<Slot extends AllowedUISlot>
|
|
|
745
746
|
slot: Slot;
|
|
746
747
|
}
|
|
747
748
|
|
|
749
|
+
export declare type PluginUIComponentTopBarAboutUsModalProps = PluginUIComponentSlotProps<'topbar.about_us.modal'>;
|
|
750
|
+
|
|
748
751
|
export declare type PluginUIComponentTopBarRightProps = PluginUIComponentSlotProps<'topbar.right'>;
|
|
749
752
|
|
|
750
753
|
declare type PosibleInput = string | number | boolean;
|
|
@@ -1026,7 +1029,7 @@ export declare interface SumOptions {
|
|
|
1026
1029
|
* Constraint to doesn't break camelCase when declaring slot in plugin ui props:
|
|
1027
1030
|
* do not use single `top_level_scope` (no dot, no underscore).
|
|
1028
1031
|
*/
|
|
1029
|
-
export declare const SUPPORTED_UI_SLOTS: readonly ["topbar.right"];
|
|
1032
|
+
export declare const SUPPORTED_UI_SLOTS: readonly ["topbar.right", "topbar.about_us.modal"];
|
|
1030
1033
|
|
|
1031
1034
|
/**
|
|
1032
1035
|
* Cache inverted relationship between deprecated and supported.
|
package/dist/nmrium-core.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var ue={NORMAL:"NORMAL",FORMULA:"FORMULA"};var me={RELATIVE:"relative",ABSOLUTE:"absolute",MIN:"min",MAX:"max"};var fe=[{name:"pixels",unit:"px"},{name:"inches",unit:"in"},{name:"feet",unit:"ft"},{name:"yards",unit:"yd"},{name:"centimeters",unit:"cm"},{name:"millimeters",unit:"mm"},{name:"meters",unit:"m"},{name:"points",unit:"pt"},{name:"picas",unit:"pc"}];var P=9;var ge=[{key:"CT",description:"CT from NMR Solutions"}];import{isAnyArray as Se}from"is-any-array";import{xMultiply as j}from"ml-spectra-processing";var de=crypto.randomUUID.bind(crypto),b=de;function N(e){let{id:t=b(),meta:o,peaks:r={},filters:n=[],info:i={},ranges:p={},integrals:s={},selector:a,dependentVariables:l=[],...u}=e,c={id:t,meta:o,filters:n},{data:d=ye(l[0].components)}=e;if(Array.isArray(i.nucleus)&&(i.nucleus=i.nucleus[0]),c.data={x:[],re:[],im:[],...d},"scaleFactor"in i){let{scaleFactor:m}=i,{re:g,im:S}=c.data;j(g,m,{output:g}),S&&j(S,m,{output:S})}a&&(c.selector=a);let f=Se(d.im);if(c.info={phc0:0,phc1:0,nucleus:"1H",isFid:!1,isComplex:f,dimension:1,name:i?.name||t,...i},i.isFid&&i.reverse&&f){let{im:m}=c.data;j(m,-1,{output:m}),c.info.reverse=!1}return c.display={isVisible:!0,isPeaksMarkersVisible:!0,isRealSpectrumVisible:!0,isVisibleInDomain:!0,...e.display},c.peaks={values:[],options:{},...r},c.ranges={values:[],options:{sum:null,isSumConstant:!0,sumAuto:!0},...p},c.integrals={values:[],options:{},...s},{...u,...c}}function ye(e){let t=e[0]?.data?.x||[],o=e[0]?.data?.re||e[0]?.data?.y||[],r=e[0]?.data?.im||e[1]?.data?.y||null;return t.length>0&&t[0]>t[1]&&(t.reverse(),o.reverse(),r&&r.reverse()),{x:t,re:o,im:r}}import{matrixToArray as Pe,xMinMaxValues as xe,xNoiseSanPlot as be}from"ml-spectra-processing";var L={z:[[]],minX:0,minY:0,maxX:0,maxY:0},Ne={re:L,im:L},he={rr:L};function O(e){let{id:t=b(),meta:o={},dependentVariables:r=[],info:n={},filters:i=[],zones:p=[],...s}=e,a={id:t,meta:o,filters:i};a.info={nucleus:["1H","1H"],isFid:!1,isComplex:!1,name:n?.name||b(),...n},a.originalInfo=structuredClone(a.info),a.display={isPositiveVisible:!0,isNegativeVisible:!0,isVisible:!0,dimension:2,...e.display,...e.display};let{data:l=r[0].components}=e;if(a.data={...a.info.isFid?Ne:he,...l},a.originalData=structuredClone(a.data),!("spectrumSize"in n)){let u=n.isFid?"re":"rr",c=a.data[u].z.length,d=c>0?a.data[u].z[0].length:0;a.info.spectrumSize=[d,c]}if(!n.isFid){let u=a.data.rr,c=Pe(u.z),{positive:d,negative:f}=be(c),{min:m,max:g}=xe(c);a.data.rr={...u,minZ:m,maxZ:g},a.info.noise={positive:d,negative:f}}return a.zones={values:[],options:{},...p},{...s,...a}}import{xSequentialFillFromTo as Oe}from"ml-spectra-processing";import{isAnyArray as De}from"is-any-array";function U(e,t=0){if(De(e)){let o=e.at(t);if(o!==void 0)return o;throw new RangeError("An array with a index out of boundaries")}return e}var Re=new Set(["t1ir","T1"]);function J(e){let t=[];for(let o of e){let{info:{pulseSequence:r,isFid:n}}=o,{data:i,info:p,meta:{vdlistValues:s=[]}}=o;if(!(r&&Re.has(r))||s.length===0){t.push(o);continue}let l=n?"re":"rr",u={};for(let y in p)u[y]=U(p[y]);let{z:c,maxX:d,minX:f}=i[l],m=Oe({from:f,to:d,size:c[0].length}),[g,S]=Ce(o);for(let y=0;y<s.length;y++){let h={re:m,x:m};for(let D in i)h[Ie(D)]=i[D].z.at(g*(y+S));t.push(N({data:h,info:{...u,name:`${u.name}_${s[y]}`,dimension:1,vd:s[y]}}))}}return t}function Ie(e){return["rr","re"].includes(e)?"re":["im","ri","ir","ii"].includes(e)?"im":"x"}function Ce(e){let{meta:{PAGE:t}}=e,o=!0;if(t){let r=n=>Number.parseFloat(n.replace(/[F|T]1=/,""));o=r(t[0])>r(t[2])}return o?[-1,1]:[1,0]}var ve=2,Te=1;function we(e){let{spectra:t=[],molecules:o}=e,r=[];for(let n of t){let{info:i}=n;switch(i.dimension){case Te:r.push(N(n));break;case ve:r.push(O(n));break;default:throw new Error("dimension does not supported")}}return{molecules:o,spectra:J(r)}}function R(e,t){e.plugins||(e.plugins={});let o=e.plugins;for(let r of t.values())o[r.id]||(o[r.id]={id:r.id,version:r.version}),o[r.id].id=r.id,o[r.id].version=r.version}function x(e,t){return JSON.parse(JSON.stringify(e),function(r,n){if(r in t){this[t[r]]=n;return}return n})}function V(e){if(e?.version===1)return e;let t={...e,version:1},o={j:"js",signal:"signals",integral:"integration",peak:"peaks",diaID:"diaIDs"};for(let r of t.spectra){if(r.ranges){let n=x(r.ranges,o);r.ranges=Array.isArray(n)?{values:n}:n}else if(r.zones){let n=x(r.zones,o);r.zones=Array.isArray(n)?{values:n}:n}r.peaks&&(r.peaks=Array.isArray(r.peaks)?{values:r.peaks}:r.peaks),r.integrals&&(r.integrals=Array.isArray(r.integrals)?{values:r.integrals}:r.integrals)}return t}function _(e){if(e?.version===2)return e;let t={...e,version:2},o={peaks:{delta:"x",originDelta:"originalX",intensity:"y"},ranges:{atomIDs:"atoms",intensity:"y"}};for(let r of t.spectra)r.peaks?r.peaks=x(r.peaks,o.peaks):r.ranges?r.ranges=x(r.ranges,o.ranges):r.zones&&(r.zones.values=Ae(r.zones.values));return t}function Ae(e){return e.map(t=>(t.signals&&(t.signals=t.signals.map(o=>{if(o.x&&o.y){let{x:{fromTo:r,...n},y:{fromTo:i,...p}}=o;o={...o,x:{...n,...r},y:{...p,...i}}}else{let{fromTo:r,deltaX:n,resolutionX:i,nucleusX:p,deltaY:s,resolutionY:a,nucleusY:l,shiftX:u,shiftY:c,...d}=o;o={...d,x:{from:r[0].from,to:r[0].to,delta:n,resolution:i,nucleus:p},y:{from:r[1].from,to:r[1].to,delta:s,resolution:a,nucleus:l}}}return o},[])),t),[])}var Fe={name:"apodization",label:"Apodization",value:{lineBroadening:1,gaussBroadening:0,lineBroadeningCenter:0}};function z(e){if(e?.version===3)return e;let t={...e,version:3};for(let o of t.spectra)if(Array.isArray(o?.filters)&&o?.filters.length>0){let r=o.filters.findIndex(n=>n.name==="lineBroadening");if(r!==-1){let n={...o.filters[r],...Fe};o.filters[r]=o.filters[r-1],o.filters[r-1]=n}}return t}function B(e){if(e?.version===4)return e;let{version:t,...o}=e,r=[],n={};for(let{source:s,...a}of o.spectra){let l={},{info:u={},display:c={}}=a;if(u?.dimension===2&&!s?.jcampURL)if(u.isFt)l.data={rr:a.data};else continue;if(s?.jcampURL){let{jcampURL:m,jcampSpectrumIndex:g}=s,S=m.match(/(?<baseURL>^\w+:\/{2}\w+\/)(?<relativePath>.*)/);n[m]||(n[m]={baseURL:S?.groups.baseURL||"",relativePath:S?.groups.relativePath||m.replace(/^\.\//,"")}),l.sourceSelector={files:[n[m].relativePath]},g!==void 0&&(l.sourceSelector.jcamp={index:g})}l.filters=Ee(a.filters);let{name:d,...f}=c;d&&(l.info={...u,name:d}),l.display=f,r.push({...a,...l})}let i={data:{...o,spectra:r},version:4},p={entries:Object.values(n)};return p.entries.length>0&&(i.data.source=p),i}function Ee(e=[]){let t=[];for(let o of e){let{name:r,value:n}=o;switch(r){case"zeroFilling":t.push({...o,value:{nbPoints:n}});break;case"shiftX":case"shift2DX":case"shift2DY":t.push({...o,value:{shift:n}});break;default:t.push({...o})}}return t}function K(e){if(e?.version===5)return e;let t={...e,version:5},o={originFrom:"originalFrom",originTo:"originalTo",originDelta:"originalDelta",originX:"originalX",originY:"originalY",originZ:"originalZ"};for(let r of t?.data?.spectra||[])for(let n of["peaks","ranges","zones"])r?.[n]&&(r[n]=x(r[n],o));return t}function X(e){if(e?.version===6)return e;let t={...e,version:6};for(let o of t?.data?.spectra||[]){let{digitalFilter:r,fft:n,phaseCorrection:i}=Me(o);n?.flag&&r?.flag&&i&&Math.floor(r.value.digitalFilterValue)%2>0&&(i.value.ph0-=180)}return t}function Me(e,t=["phaseCorrection","fft","digitalFilter"]){let{filters:o=[]}=e,r={};for(let n of t)r[n]=o.find(i=>i.name===n);return r}function I(e,t="localStorage"){if(e?.version===7)return e;if(t==="nmrium")return H(e);let o={...e,version:7};for(let r in e.workspaces)o.workspaces[r]=H(o.workspaces[r]);return o}function H(e){let{formatting:{nuclei:t,panels:o}={nuclei:null,panels:null},version:r,...n}=e,i={...n};return t&&(i.nuclei=ke(t)),o&&(i.panels=o),i}function ke(e){let t=[],o={name:"nucleus",ppm:"ppmFormat",hz:"hzFormat"};for(let r in e)t.push(x(e[r],o));return t}function Y(e){if(e?.version===7)return e;let t={...e,version:7};return t?.settings&&(t.settings=I(t.settings,"nmrium")),t}function C(e,t="localStorage"){if(e?.version===8)return e;if(t==="nmrium")return Q(e);let o={...e,version:8};for(let r in e.workspaces)o.workspaces[r]=Q(o.workspaces[r]);return o}function Q(e){let{version:t,...o}=e,r={...o};return r.display.panels=je(e),r}function je(e){let t={},o=e.display.panels;for(let r of Object.keys(o)){let{display:n,open:i}=o[r];t[r]={display:n,visible:n,open:i}}return t}function W(e){if(e?.version===8)return e;let t={...e,version:8};t?.settings&&(t.settings=C(t.settings,"nmrium"));for(let o of t?.data?.spectra||[]){let{filters:r=[]}=o;for(let s=0;s<r.length;s++){let{flag:a,isDeleteAllow:l,label:u,...c}=r[s];r[s]={...c,enabled:a}}let n=r.findIndex(s=>s.name==="apodization");if(n!==-1){let s=r[n],{lineBroadening:a,gaussBroadening:l,lineBroadeningCenter:u}=s.value;s.value={exponential:{apply:!0,options:{lineBroadening:l>0?-a:a}}},l>0&&(s.value.gaussian={apply:!0,options:{lineBroadening:.6*l,lineBroadeningCenter:u}}),r[n]=s}let i=r.findIndex(s=>s.name==="apodizationDimension1"),p=r.findIndex(s=>s.name==="apodizationDimension2");if(i!==-1){let s=r[i],{shapes:a}=s.value.compose;s.value=ee(a)}if(p!==-1){let s=r[p],{shapes:a}=s.value.compose;s.value=ee(a)}}return t}function ee(e){let t={};for(let{shape:o}of e){let{kind:r,options:n}=o;if(r==="sineBell"){let{exponent:i,offset:p}=n,s=i===2?"sineSquare":"sineBell";t[s]={apply:!0,options:{offset:p}}}}return t}function $(e){let{version:t,plugins:o,...r}=e;return t===9?e:{version:9,plugins:{},...r}}var Le=[V,_,z,B,K,X,Y,W,$];function te(e,t,o){let r=structuredClone(e),n=Object.entries(e?.plugins??{});for(let[s,{version:a}]of n){let l=o.get(s);if(!(l&&l.version>=a)){if(l){console.warn(`Plugin "${l.id}" is loaded with a version older (${l.version}) than the one used to save the state (${a}).
|
|
2
2
|
NMRium may fail to load the state.
|
|
3
|
-
Please update the plugin to the latest version.`);continue}console.warn(`Plugin "${
|
|
4
|
-
Please consider open this file with the plugin installed.`)}}let
|
|
3
|
+
Please update the plugin to the latest version.`);continue}console.warn(`Plugin "${s}@${a}" is not registered. NMRium may fail to load the state.
|
|
4
|
+
Please consider open this file with the plugin installed.`)}}let i=new Set,p=()=>{let s=r.version;for(let a of o.values())for(let l of a.migrations){if(i.has(l)||s<l.minCore||l.maxCore&&s>l.maxCore)continue;if((r.plugins?.[a.id]?.version||0)===a.version)break;r=l.up(r),i.add(l)}};for(let s=e?.version||0;s<t;s++){let a=Le[s];r=a(r),p()}return p(),R(r,o),r}import{FileCollection as We}from"file-collection";var re={SDF:"sdf",MOL:"mol",NMRIUM:"nmrium",JSON:"json",JCAMP:"jcamp",DX:"dx",JDX:"jdx",JDF:"jdf",NMREDATA:"nmredata",SMILES:"smiles",SMI:"smi"};function v(e){return e.includes(".")?e.replace(/^.*\./,"").toLowerCase():""}function w(e,t={},o){let{data:r,...n}=e;if(!r)return e;let{spectra:i=[]}=r,{keep1D:p=!0,keep2D:s=!0,onlyReal:a}=t,l=a?"ft":t.dataSelection||"both",u=[];for(let c of i){if(!c.info){u.push(c);continue}let{isFid:d,dimension:f,name:m}=c.info;if(!T(f===1&&!p,m,o)&&!T(f===2&&!s,m,o)&&!T(d&&l==="ft",m,o)&&!T(!d&&l==="fid",m,o))if(a&&!d)if(c.info.isComplex=!1,Ue(c)){let{rr:g}=c.data;u.push({...c,data:{rr:g}})}else{let{re:g,x:S}=c.data;u.push({...c,data:{re:g,x:S}})}else u.push(c)}return{data:{...r,spectra:u},...n}}function T(e,t,o){return e?(o?.warn(`Skipping ${t} because it didn't match the import filters.`),!0):!1}function Ue(e){let{info:t}=e;return t?.dimension===2}function A(e){let{nmriumState:t,plugins:o,options:r}=e;for(let n of o.values()){let i=n.onReadProcess?.onProcessing;i&&i(t,r)}}async function F(e,t,o={}){let{sourceSelector:r,converter:n,keepSource:i,logger:p}=o,s=[],a=[];for(let f of t.values()){let{onReadProcess:m}=f;m&&(m?.onFiles&&s.push(f),m?.supportedExtensions?.length&&m?.onFile&&a.push(f))}let l=await Promise.allSettled(s.map(f=>f.onReadProcess.onFiles(e,o))),u=[],c=await Promise.allSettled(e.files.flatMap(f=>{let m=v(f.name).toLowerCase();return a.flatMap(g=>{let{supportedExtensions:S,onFile:y}=g.onReadProcess;return S.includes(m)?(u.push({file:f,plugin:g}),y(f,{logger:p,sourceSelector:r,converter:n,keepSource:i})):[]})})),d={spectra:[],molecules:[]};for(let f=0;f<l.length;f++){let m=l[f];switch(m.status){case"fulfilled":{let{spectra:g=[],molecules:S=[]}=m.value||{};d.spectra.push(...g),d.molecules.push(...S);break}case"rejected":{let g=m.reason,S=s[f];o.logger?.error(`Load file collection with plugin ${S.id}@${S.version} fails with: ${g}`);break}}}for(let f=0;f<c.length;f++){let m=c[f];switch(m.status){case"fulfilled":{let{spectra:g=[],molecules:S=[]}=m.value||{};d.spectra.push(...g),d.molecules.push(...S);break}case"rejected":{let g=m.reason,{file:S,plugin:y}=u[f];o.logger?.error(`Load file ${S.relativePath} with plugin ${y.id}@${y.version} fails with: ${g}`);break}}}return d}import{FileCollection as Ke}from"file-collection";import{FileCollection as Ve}from"file-collection";import oe from"lodash.merge";import{xIsEquallySpaced as _e}from"ml-spectra-processing";async function E(e){let{nmriumObjectInput:t,options:o={},migrator:r,plugins:n}=e,i=r(t),{data:p,...s}=i;if(!p)return{...s};let a={data:{...p,spectra:[]},...s},l=a.data,{source:u,spectra:c,molecules:d}=l,f;u&&(f=await Ve.fromSource(u,{unzip:{zipExtensions:["zip","nmredata"]}}));let m=[];for(let g of p.spectra)if(f){let{sourceSelector:S}=g,y=M({input:f,migrator:r,plugins:n,options:{...o,sourceSelector:S}}).then(h=>{let{nmriumState:{data:D}}=h,{spectra:pe=[],molecules:q=[]}=D||{};q.length>0&&d.length===0&&d.push(...q);for(let ce of pe)c.push(ze(g,Be(ce)))});m.push(y)}else{let{dimension:S}=g.info;if(S===1){if(!_e(g.data)){o.logger?.error('The ".nmrium" file is corrupted; the X-axis values are not equally distant.');continue}c.push(N(g))}else S===2&&c.push(O(g))}return await Promise.allSettled(m),a}function ze(e,t){let{data:o,...r}=e;if("ranges"in t){let{data:n,...i}=t;return{...oe(i,r),data:n}}else if("zones"in t){let{data:n,...i}=t;return{...oe(i,r),data:n}}else return t}function Be(e){return{...e,id:b()}}async function ne(e){let{file:t,options:o={},migrator:r,plugins:n}=e,i=await t.arrayBuffer(),p=await(Ye(i)?Xe(i):t.text());return E({nmriumObjectInput:JSON.parse(p),plugins:n,migrator:r,options:o})}async function Xe(e){let t=await Ke.fromZip(e);if(t.files.length===0)throw new Error("compressed nmrium file is corrupted");return t.files[0].text()}function Ye(e){if(e.byteLength<4)return!1;let t=new Uint8Array(e);return t[0]===80&&t[1]===75&&(t[2]===3||t[2]===5||t[2]===7)&&(t[3]===4||t[3]===6||t[3]===8)}async function M(e){let{options:t={},input:o,migrator:r,plugins:n}=e,i=Ze(await $e(o),t.sourceSelector?.files),p=qe(i);if(p)return{nmriumState:await ne({file:p,migrator:r,plugins:n,options:t}),containsNmrium:!0};let s=await F(i,n,t),a=w({version:9,data:s},t?.sourceSelector?.general,t.logger),{onLoadProcessing:l,experimentalFeatures:u}=t,c={...l,autoProcessing:l?.autoProcessing??!1,experimentalFeatures:u};return A({nmriumState:a,plugins:n,options:c}),{nmriumState:a,containsNmrium:!1}}function $e(e){return Array.isArray(e)?Promise.reject(new Error("For a set of fileCollectionItems pass a FileCollection instance")):Ge(e)?Promise.resolve(e):new We().appendExtendedSource({...e,uuid:crypto.randomUUID()})}function Ge(e){return typeof e=="object"&&"files"in e}function Ze(e,t){if(!t)return e;let o=new Set(t);return e.filter(r=>o.has(r.relativePath))}function qe(e){return e.files.find(t=>v(t.name).toLowerCase()===re.NMRIUM)}function k(e,t){let o={};for(let r in e)t.includes(r)||(o[r]=e[r]);return o}var Je=["data","originalData","info","originalInfo","meta","customInfo"],He=["sourceSelector","originalData","originalInfo"];function ie(e,t,o={}){let{version:r,data:n}=e;if(n.actionType)return e;let i={version:r,plugins:e.plugins},{includeData:p}=o;p!=="noData"&&(i.data=Qe({...n},p));let{includeSettings:s,includeView:a}=o;return s&&(i.settings=e.settings),a&&(i.view=e.view),R(i,t),i}function Qe(e,t="rawData"){let{spectra:o}=e;switch(t){case"dataSource":return et(e);case"rawData":return{...k(e,["source"]),spectra:o.map(rt)};default:return e}}function et(e){let{spectra:t}=e;if(!e.source)throw new Error("source property should exists for dataSource serialization");return{...e,spectra:t.map(tt)}}function tt(e){return k(e,Je)}function rt(e){let{data:t,info:o,originalData:r,originalInfo:n}=e,i=k(e,He);return i.data=r||t,i.info=n||o,i}var ot=["topbar.right","topbar.about_us.modal"],nt=[],Gr=[...ot,...nt],it={},G={};{let e=it,t=G;for(let[o,r]of Object.entries(e))t[r]||(t[r]=[]),t[r]?.push(o)}function*se(e){let{slot:t,plugins:o,supportedToDeprecatedSlots:r=G}=e,n=r[t];for(let[i,p]of o.entries()){let s=p.ui;if(!s)continue;let a=s[t];if(a){yield[i,a];continue}if(n)for(let l of n){let u=p.ui?.[l];if(u){yield[i,u],console.warn(`Plugin ${p.id} used deprecated slot "${l}". Please update this plugin to use "${t}" instead.`);break}}}}import{FileCollection as st}from"file-collection";async function ae(e){let{source:t,plugins:o,options:r={}}=e,{keepSource:n=!0,converter:i,...p}=r,s={source:t,spectra:[],molecules:[]},a=await st.fromSource(t,{unzip:{zipExtensions:["zip","nmredata"]}}),{spectra:l=[],molecules:u=[]}=await F(a,o,{keepSource:n,converter:{...i,bruker:{keepFiles:!0,...Reflect.get(i??{},"bruker")}},...p});s.spectra.push(...l),s.molecules.push(...u);let c=w({version:9,data:s},r?.sourceSelector?.general),{onLoadProcessing:d}=p,f={filters:d?.filters,autoProcessing:d?.autoProcessing??!1,experimentalFeatures:r.experimentalFeatures};return A({nmriumState:c,plugins:o,options:f}),c}var Z=class{version=9;plugins=new Map;registerPlugin(t){if(this.plugins.has(t.id)){console.warn(`Plugin ${t.id} is already registered. skip.`),console.debug("Plugin already registered:",this.plugins.get(t.id)),console.debug("Plugin to register:",t);return}this.plugins.set(t.id,t)}registerPlugins(t){for(let o of t)this.registerPlugin(o)}migrate(t){return te(t,this.version,this.plugins)}read(t,o={}){return M({input:t,migrator:this.migrate.bind(this),plugins:this.plugins,options:o})}readNMRiumObject(t,o){return E({nmriumObjectInput:t,options:o,plugins:this.plugins,migrator:this.migrate.bind(this)})}readFromWebSource(t,o){return ae({source:t,options:o,plugins:this.plugins})}serializeNmriumState(t,o){return ie(t,this.plugins,o)}slot(t){return se({slot:t,plugins:this.plugins})}};function at(e,t){if(t>9)return 0;let o=-1;for(let r=0;r<e.length;r++)if(e[r].version>t){o=r;break}return o}var le=[{version:6,fun:I},{version:7,fun:C}];function lt(e){let{version:t}=e||{},o=at(le,t);if(o===-1)return{...e,version:9};let r=le.slice(o);for(let n of r)e=n.fun(e);return e}export{ue as ANALYSIS_COLUMN_TYPES,me as ANALYSIS_COLUMN_VALUES_KEYS,P as CURRENT_EXPORT_VERSION,ge as EXTERNAL_API_KEYS,Z as NMRiumCore,we as formatSpectra,b as generateID,U as getOneIfArray,lt as migrateSettings,fe as units};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zakodium/nmrium-core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"description": "The core of NMRium: types, state, state migration and plugin system.",
|
|
5
5
|
"author": "Zakodium Sàrl",
|
|
6
6
|
"license": "CC-BY-NC-SA-4.0",
|
|
@@ -24,21 +24,21 @@
|
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@types/lodash.merge": "^4.6.9",
|
|
27
|
-
"@types/node": "^24.0
|
|
27
|
+
"@types/node": "^24.3.0",
|
|
28
28
|
"@types/react": "^18.3.13",
|
|
29
|
-
"@zakodium/nmr-types": "^0.1.
|
|
30
|
-
"esbuild": "^0.25.
|
|
29
|
+
"@zakodium/nmr-types": "^0.1.1",
|
|
30
|
+
"esbuild": "^0.25.9",
|
|
31
31
|
"jest-matcher-deep-close-to": "^3.0.2",
|
|
32
32
|
"rimraf": "^6.0.1",
|
|
33
33
|
"vitest": "^3.2.4"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"cheminfo-types": "^1.8.1",
|
|
37
|
-
"fifo-logger": "^2.0.
|
|
38
|
-
"file-collection": "^5.1.
|
|
37
|
+
"fifo-logger": "^2.0.1",
|
|
38
|
+
"file-collection": "^5.1.1",
|
|
39
39
|
"is-any-array": "^2.0.1",
|
|
40
40
|
"lodash.merge": "^4.6.2",
|
|
41
|
-
"ml-spectra-processing": "^14.
|
|
41
|
+
"ml-spectra-processing": "^14.17.1",
|
|
42
42
|
"nmr-correlation": "^2.3.5"
|
|
43
43
|
},
|
|
44
44
|
"volta": {
|