From c4748c7aa3e06d850c9a20878b085a7c42566322 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christophe=20No=C3=ABl?= Date: Mon, 4 Mar 2024 23:12:42 +0100 Subject: [PATCH] build --- .../build/assets/{index-DJ3FYunF.js => index-B0ChhUNb.js} | 2 +- packages/chord-chart-studio/build/index.html | 2 +- packages/chord-chart-studio/build/sw.js | 2 +- .../chord-chart-studio/src/ui/sideBar/_components/Versions.jsx | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) rename packages/chord-chart-studio/build/assets/{index-DJ3FYunF.js => index-B0ChhUNb.js} (99%) diff --git a/packages/chord-chart-studio/build/assets/index-DJ3FYunF.js b/packages/chord-chart-studio/build/assets/index-B0ChhUNb.js similarity index 99% rename from packages/chord-chart-studio/build/assets/index-DJ3FYunF.js rename to packages/chord-chart-studio/build/assets/index-B0ChhUNb.js index f76155ca..ff27e380 100644 --- a/packages/chord-chart-studio/build/assets/index-DJ3FYunF.js +++ b/packages/chord-chart-studio/build/assets/index-B0ChhUNb.js @@ -50,7 +50,7 @@ She _broke your throne and she _cut your hair And _from your lips she _drew the halle_lujah #c -`;function Yn(){const e=W(),t=e.getState();Z(t).length===0&&(e.dispatch(U("Hallelujah - Leonard Cohen",Kn)),e.dispatch(U("Getting started",Un)))}class Ve extends C.Component{constructor(t){super(t),this.state={error:null,errorInfo:null}}componentDidCatch(t,n){this.setState({error:t,errorInfo:n})}render(){return this.state.errorInfo?r.jsxs("div",{className:"ErrorBoundary",children:[r.jsx("h2",{children:"Something went wrong"}),r.jsxs("details",{style:{whiteSpace:"pre-wrap"},open:!0,children:[this.state.error&&this.state.error.toString(),r.jsx("br",{}),this.state.errorInfo.componentStack]})]}):this.props.children}}Ve.propTypes={children:i.any};let z;function Jn(e,t){const n=document.getElementById("app");z||(z=Ie(n)),z.render(r.jsx(Mt,{store:W(),children:r.jsx(C.StrictMode,{children:r.jsx(Ve,{children:r.jsx(e,{...t})})})}))}const Qn={base:"/app"};let K,Ue;const Xn={init(e){const t=e.map(n=>({...n,path:Qn.base+n.path,action:s=>({Controller:n.action,params:s.params})}));K=new Ot(t,{errorHandler(n,s){console.error(`Error: Cannot find route for path: ${s.pathname}`)}}),Ue=Lt(K,{stringifyQueryParams:Me.stringify})}};function G(e,t=!0){const n=new URL(e,window.location.origin);return K.resolve(n.pathname).then(({Controller:s,params:o}={})=>{if(s){t&&Zn(e);const a=Me.parse(n.search,{ignoreQueryPrefix:!0});Jn(s,{...o,...a})}})}function Ke(e,t){try{return Ue(e,t)}catch(n){console.error(n.toString())}}function Zn(e){window.history.pushState({url:e},null,e)}window.addEventListener("popstate",()=>{const e=window.location.pathname+window.location.search;G(e,!1)});const er="_button_6sdae_1",tr="_buttonContent_6sdae_5",Se={button:er,buttonContent:tr};function nr({children:e,onClick:t}){return r.jsx("div",{className:Se.button,onClick:t,children:r.jsx("div",{className:Se.buttonContent,children:e})})}function rr(){const t=Oe(Z).map(n=>r.jsx(sr,{song:n},n.id));return r.jsxs("div",{children:["Full Library",r.jsx("ul",{children:t}),r.jsx(nr,{children:"My Nice Button"})]})}const sr=({song:e})=>{const t=n=>{n.preventDefault(),G(Ke("songView",{songId:e.id}))};return r.jsx("li",{children:r.jsx("a",{href:`/song/${e.id}`,onClick:t,children:e.title})})},ir=[{name:"library",path:"/library",action:rr}];function or({songId:e}){const t=Oe(s=>ee(s,e)),n=s=>{s.preventDefault(),G(Ke("library"))};return r.jsxs("div",{children:[r.jsx("a",{href:"",onClick:n,children:"Go back to list"}),r.jsx("br",{}),r.jsx("b",{children:t.title}),r.jsx("p",{children:t.content})]})}const ar=[{name:"songView",path:"/songView/:songId",action:or}],Ye=e=>v(D,{mode:e}),lr=()=>v(ke),cr=()=>v(Be),dr="/app/assets/logo-D2B3txiq.svg";function ur(){return r.jsx("div",{className:"logo",children:r.jsx("div",{className:"logo-isExpanded",children:r.jsx("div",{className:"logo-img",children:r.jsxs("svg",{className:"stacked",children:[r.jsx("title",{children:"Chord Chart Studio"}),r.jsx("use",{href:dr+"#stacked"})]})})})})}const pr=C.memo(ur);function Je(e){const{iconName:t}=e,n=["icon","material-icons"];return r.jsx("i",{className:n.join(" "),children:t})}Je.propTypes={iconName:i.string.isRequired};const x=C.memo(Je);function Qe(e){const{label:t,icon:n,editorMode:s,setEditorMode:o,isActive:a,isDisabled:l}=e,c=["mainNavEntry"];a&&c.push("mainNavEntry-isActive"),l&&c.push("mainNavEntry-isDisabled");function d(){l||o(s)}return r.jsxs("li",{className:c.join(" "),onClick:d,children:[r.jsx("span",{className:"mainNavEntry-icon",children:r.jsx(x,{iconName:n})}),t]})}Qe.propTypes={label:i.string.isRequired,icon:i.string.isRequired,editorMode:i.string.isRequired,setEditorMode:i.func.isRequired,isActive:i.bool.isRequired,isDisabled:i.bool.isRequired};const mr=C.memo(Qe);function Xe(e){const{currentMode:t,allEntries:n,setEditorMode:s,selectedId:o}=e;return r.jsx("nav",{className:"mainNav",children:r.jsx("ul",{className:"mainNav-entries",children:n.map((a,l)=>r.jsx(mr,{isActive:!!o&&a.editorMode===t,isDisabled:!o,setEditorMode:s,...a},l))})})}Xe.propTypes={currentMode:i.string.isRequired,setEditorMode:i.func.isRequired,selectedId:i.string,allEntries:i.arrayOf(i.shape({id:i.string.isRequired,label:i.string.isRequired,icon:i.string.isRequired,editorMode:i.string.isRequired}))};const hr=C.memo(Xe),_=({children:e,isDisabled:t,buttonName:n,onClick:s,type:o})=>{const a=["Button"];return o==="primary"&&a.push("Button-primary"),o==="secondary"&&a.push("Button-secondary"),t&&a.push("Button-isDisabled"),r.jsx("button",{className:a.join(" "),disabled:t,type:"button",name:n,onClick:s,children:e})};_.propTypes={children:i.string.isRequired,isDisabled:i.bool,buttonName:i.string.isRequired,type:i.string.isRequired,onClick:i.func.isRequired};_.defaultProps={isDisabled:!1};const gr="https://chord-chart-studio.netlify.app",ie=()=>{const e=()=>{window.open(gr,"_blank").focus()};return r.jsxs("div",{className:"userGuide",children:[r.jsx("div",{className:"userGuide-isCollapsed",children:r.jsx(x,{iconName:"help_outline"})}),r.jsx("div",{className:"userGuide-isExpanded",children:r.jsx(_,{buttonName:"userGuide",type:"primary",onClick:e,children:"User Guide"})})]})};ie.propTypes={};ie.defaultProps={};const fr=C.memo(ie),yr=()=>({"chord-chart-studio":"v0.14.0","chord-symbol":"v4.0.0","chord-mark":"v0.16.2"});function br(){const e=yr();return r.jsx("div",{className:"versions",children:r.jsxs("div",{className:"versions-isExpanded",children:["Chord Chart Studio ",e["chord-chart-studio"],r.jsx("br",{}),"ChordMark ",e["chord-mark"]," ",r.jsx("br",{}),"ChordSymbol ",e["chord-symbol"]," ",r.jsx("br",{}),"Logo by"," ",r.jsx("a",{href:"https://spelling-bee-assistant.app/",target:"_blank",rel:"noreferrer",children:"Dieter Raber"})]})})}const xr=C.memo(br),Cr=e=>e.songImporter.content,jr=e=>e.songImporter.inputFormat,Rr=e=>e.songImporter.title,vr=e=>e.songImporter.isImporting,Fr=e=>e.songImporter.isFromWeb;function oe(e){const{children:t,closeModal:n}=e;return R.useEffect(()=>{const s=o=>{o.key==="Escape"&&n()};return window.addEventListener("keyup",s),()=>{window.removeEventListener("keyup",s)}}),r.jsxs("section",{className:"mod-ModalContainer",children:[r.jsx("div",{className:"mod-Overlay",onClick:n,"data-testid":"modal-overlay"}),r.jsx("div",{className:"mod-ContentContainer",children:t})]})}oe.propTypes={children:i.element.isRequired,closeModal:i.func.isRequired};const Ze=({cancelImport:e,chordMarkContent:t,importFile:n,title:s,content:o,error:a})=>{const l=s?'Import "'+s+'"':"Import song",c=()=>{n(s||"[untitled]",t)};return r.jsxs("div",{className:"sim-Header_Container",children:[r.jsx("div",{className:"sim-Header_Title",children:l}),r.jsxs("div",{className:"sim-Header_Actions",children:[r.jsx(_,{onClick:e,buttonName:"cancel",type:"secondary",children:"CANCEL"}),r.jsx(_,{onClick:c,buttonName:"import",type:"primary",isDisabled:o===""||a!=="",children:"IMPORT"})]})]})};Ze.propTypes={cancelImport:i.func.isRequired,chordMarkContent:i.string,content:i.string,error:i.string,importFile:i.func.isRequired,title:i.string};const et=50*1024,Nr=e=>new Promise((t,n)=>{if(e.length){const s=e[0];Sr(s)?n(_r(s.size)):wr(s)?s.text().then(o=>{t({content:o,title:Tr(s)})}).catch(o=>{n(o)}):n(Er(s))}else n(qr())}),Tr=e=>e.name.substr(0,e.name.lastIndexOf(".")),Sr=e=>e.size>et,wr=e=>e.type.indexOf("text")===0||e.type.length===0,_r=e=>"The selected file is too big: "+ve(e,{round:0})+" (maximum allowed file size is "+ve(et,{round:0})+").",Er=e=>"Cannot import file of type "+e.type+".",qr=()=>"No file selected.",Pr="text/*,.cho,.crd,.chopro,.chord,.pro,.txt,.md",tt=({setContent:e})=>{const t=n=>{Nr(n.target.files).then(s=>{e(s.content,s.title)}).catch(s=>{e(s)})};return r.jsxs("div",{children:[r.jsx("label",{htmlFor:"importSong-Input",className:"Button Button-primary",children:"Select File"}),r.jsx("input",{id:"importSong-Input",name:"importSong-Input",type:"file",className:"sim-InputFile_Input",onChange:t,accept:Pr})]})};tt.propTypes={setContent:i.func.isRequired};function ae(e){const{content:t,setContent:n,isDisabled:s}=e,o=l=>{n(l.target.value)},a=["sim-Input_Textarea"];return s&&a.push("sim-Input_Textarea-Disabled"),r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"sim-Input_Header",children:[r.jsx(x,{iconName:"arrow_drop_down"}),"Copy/paste below",r.jsx(x,{iconName:"arrow_drop_down"})]}),r.jsx("textarea",{className:a.join(" "),onChange:o,value:t,disabled:s,"data-testid":"sim-input"})]})}ae.propTypes={content:i.string.isRequired,isDisabled:i.bool.isRequired,setContent:i.func.isRequired};ae.defaultProps={};function le(e){const{inputFormat:t,error:n}=e;return r.jsxs("div",{className:"sim-Preview_Error",children:[r.jsxs("p",{children:["There was an error when trying to parse the song in the specified input format (",t,").",r.jsx("br",{}),"Please correct the input or try another format.",r.jsx("br",{}),"The error was:"]}),r.jsxs("p",{children:['"',n,'"']}),r.jsx("p",{children:'Hint: most of the time, this is related to an unclosed "[" or "{" or an unsupported ChordPro directive'})]})}le.propTypes={error:i.string,inputFormat:i.string.isRequired};le.defaultProps={};function ce(e){const{setInputFormat:t,inputFormat:n,id:s,label:o,isDisabled:a}=e,l=u=>{a||t(u.target.value)},c=["sim-InputFormat_Entry"],d=["sim-InputFormat_Label"];return a&&(c.push("sim-InputFormat_Entry-Disabled"),d.push("sim-InputFormat_Label-Disabled")),r.jsxs(r.Fragment,{children:[r.jsx("input",{className:c.join(" "),type:"radio",name:"inputFormat",id:s,value:s,onChange:l,checked:n===s}),r.jsx("label",{className:d.join(" "),htmlFor:s,children:o})]})}ce.propTypes={setInputFormat:i.func.isRequired,inputFormat:i.string.isRequired,id:i.string.isRequired,label:i.string.isRequired,isDisabled:i.bool.isRequired};ce.defaultProps={};const Ir=[{id:"auto",label:"Detect"},{id:"chordPro",label:"Bracketed chords (ChordPro)"},{id:"chordsOverLyrics",label:"Chords over lyrics (Ultimate Guitar...)"}];function de(e){const{setInputFormat:t,inputFormat:n,disableAll:s}=e,o=Ir.map(a=>r.jsx(ce,{setInputFormat:t,id:a.id,label:a.label,inputFormat:n,isDisabled:s},a.id));return r.jsxs("div",{className:"sim-InputFormat",children:["Input format:",o]})}de.propTypes={disableAll:i.bool.isRequired,setInputFormat:i.func.isRequired,inputFormat:i.string.isRequired};de.defaultProps={};function ue(e){const{cancelImport:t,content:n,importFile:s,isFromWeb:o,isImporting:a,setContent:l,setInputFormat:c,inputFormat:d,title:u}=e;if(!a)return null;let h="",m="";try{h=kt(n,{inputFormat:d})}catch(f){m=f.message}return r.jsx(oe,{closeModal:t,children:r.jsxs("div",{className:"sim-SongImporterModal_Container","data-testid":"song-importer",children:[r.jsx(Ze,{cancelImport:t,chordMarkContent:h,content:n,error:m,importFile:s,title:u}),r.jsxs("div",{className:"sim-TwoColumns_Container",children:[r.jsx("div",{className:"sim-Column_Container",children:r.jsx(tt,{setContent:l})}),r.jsx("div",{className:"sim-Column_Container",children:r.jsx(de,{inputFormat:d,setInputFormat:c,disableAll:o===!0})})]}),r.jsxs("div",{className:"sim-TwoColumns_Container sim-TwoColumns_Container-autoHeight",children:[r.jsx("div",{className:"sim-Column_Container",children:r.jsx(ae,{content:n,setContent:l,isDisabled:o})}),r.jsxs("div",{className:"sim-Column_Container",children:[r.jsxs("div",{className:"sim-Input_Header",children:[r.jsx(x,{iconName:"arrow_drop_down"}),"ChordMark preview",r.jsx(x,{iconName:"arrow_drop_down"})]}),r.jsx("div",{className:"sim-Preview_Container","data-testid":"sim-preview",children:m?r.jsx(le,{inputFormat:d,error:m}):h})]})]})]})})}ue.propTypes={cancelImport:i.func.isRequired,content:i.string.isRequired,importFile:i.func.isRequired,isFromWeb:i.bool.isRequired,isImporting:i.bool.isRequired,setContent:i.func.isRequired,setInputFormat:i.func.isRequired,inputFormat:i.string.isRequired,title:i.string};ue.defaultProps={};const Mr=T(e=>({content:Cr(e),isFromWeb:Fr(e),isImporting:vr(e),inputFormat:jr(e),title:Rr(e)}),{setContent:On,setInputFormat:Ln,cancelImport:An,importFile:U})(ue),Or=[{id:"edit",label:"Edit",icon:"create",editorMode:"edit"},{id:"play",label:"Screen view",icon:"music_note",editorMode:"play"},{id:"print",label:"Print/PDF Preview",icon:"print",editorMode:"print"},{id:"export",label:"Export Preview",icon:"save_alt",editorMode:"export"}];function pe(e){const{editorMode:t,isLeftBarCollapsed:n,isRightBarCollapsed:s,toggleLeftBar:o,toggleRightBar:a,setEditorMode:l,selectedId:c,leftBar:d,rightBar:u}=e,h=["leftBar"];n&&h.push("leftBar-isCollapsed");const m=["rightBar"];return s&&m.push("rightBar-isCollapsed"),r.jsxs("div",{className:"appLayout-wrapper",children:[r.jsx(Mr,{}),r.jsxs("section",{className:h.join(" "),children:[r.jsxs("div",{className:"leftBar-content",onClick:n?o:null,children:[r.jsx(pr,{}),d]}),r.jsx("div",{className:"leftBar-collapser",onClick:o,"data-testid":"leftBar-collapser",children:r.jsx("span",{className:"leftBar-collapserIcon",children:r.jsx(x,{iconName:"keyboard_arrow_left"})})})]}),r.jsxs("section",{className:"appLayout-main",children:[r.jsx("section",{className:"appLayout-header",children:r.jsx(hr,{allEntries:Or,currentMode:t,setEditorMode:l,selectedId:c})}),r.jsx("section",{className:"appLayout-content",children:e.children})]}),r.jsxs("section",{className:m.join(" "),children:[r.jsx("div",{className:"rightBar-collapser",onClick:a,"data-testid":"rightBar-collapser",children:r.jsx("span",{className:"rightBar-collapserIcon",children:r.jsx(x,{iconName:"keyboard_arrow_right"})})}),r.jsxs("div",{className:"rightBar-content",onClick:s?a:null,children:[r.jsx(fr,{}),u,r.jsx(xr,{})]})]})]})}pe.propTypes={children:i.element,isLeftBarCollapsed:i.bool,isRightBarCollapsed:i.bool,selectedId:i.string,toggleLeftBar:i.func.isRequired,toggleRightBar:i.func.isRequired,editorMode:i.string.isRequired,setEditorMode:i.func.isRequired,leftBar:i.element.isRequired,rightBar:i.element.isRequired};pe.defaultProps={isLeftBarCollapsed:!1,isRightBarCollapsed:!1};const Lr=T(e=>({editorMode:E(e),isLeftBarCollapsed:nn(e),isRightBarCollapsed:rn(e),selectedId:S(e)}),{toggleLeftBar:lr,toggleRightBar:cr,setEditorMode:Ye})(pe),kr=e=>v(re,{id:e}),Br=e=>v(De,{id:e});function Ar(e,t={},n=!1){return rt(e,t,n,"text")}function nt(e,t={},n=!1){return rt(e,t,n,"html")}function rt(e,t,n,s){if(n)switch(t.chartFormat){case"chordmark":{const a=M(e,t);return s==="html"?a:we(a)}case"chordmarkSrc":return s==="html"?V(e):e;case"chordpro":{t.customRenderer=Dt();const a=M(e,t);return s==="html"?V(a):a}case"ultimateGuitar":{t.customRenderer=Fe();const a=M(e,{...t,customRenderer:Fe(),printBarSeparators:"grids",printChordsDuration:"never",printSubBeatDelimiters:!1,printInlineTimeSignatures:!1,chordSymbolRenderer:Bt({customFilters:[At()],useShortNamings:!0,accidentalsType:t.accidentalsType==="auto"?"original":t.accidentalsType,...t})})+` +`;function Yn(){const e=W(),t=e.getState();Z(t).length===0&&(e.dispatch(U("Hallelujah - Leonard Cohen",Kn)),e.dispatch(U("Getting started",Un)))}class Ve extends C.Component{constructor(t){super(t),this.state={error:null,errorInfo:null}}componentDidCatch(t,n){this.setState({error:t,errorInfo:n})}render(){return this.state.errorInfo?r.jsxs("div",{className:"ErrorBoundary",children:[r.jsx("h2",{children:"Something went wrong"}),r.jsxs("details",{style:{whiteSpace:"pre-wrap"},open:!0,children:[this.state.error&&this.state.error.toString(),r.jsx("br",{}),this.state.errorInfo.componentStack]})]}):this.props.children}}Ve.propTypes={children:i.any};let z;function Jn(e,t){const n=document.getElementById("app");z||(z=Ie(n)),z.render(r.jsx(Mt,{store:W(),children:r.jsx(C.StrictMode,{children:r.jsx(Ve,{children:r.jsx(e,{...t})})})}))}const Qn={base:"/app"};let K,Ue;const Xn={init(e){const t=e.map(n=>({...n,path:Qn.base+n.path,action:s=>({Controller:n.action,params:s.params})}));K=new Ot(t,{errorHandler(n,s){console.error(`Error: Cannot find route for path: ${s.pathname}`)}}),Ue=Lt(K,{stringifyQueryParams:Me.stringify})}};function G(e,t=!0){const n=new URL(e,window.location.origin);return K.resolve(n.pathname).then(({Controller:s,params:o}={})=>{if(s){t&&Zn(e);const a=Me.parse(n.search,{ignoreQueryPrefix:!0});Jn(s,{...o,...a})}})}function Ke(e,t){try{return Ue(e,t)}catch(n){console.error(n.toString())}}function Zn(e){window.history.pushState({url:e},null,e)}window.addEventListener("popstate",()=>{const e=window.location.pathname+window.location.search;G(e,!1)});const er="_button_6sdae_1",tr="_buttonContent_6sdae_5",Se={button:er,buttonContent:tr};function nr({children:e,onClick:t}){return r.jsx("div",{className:Se.button,onClick:t,children:r.jsx("div",{className:Se.buttonContent,children:e})})}function rr(){const t=Oe(Z).map(n=>r.jsx(sr,{song:n},n.id));return r.jsxs("div",{children:["Full Library",r.jsx("ul",{children:t}),r.jsx(nr,{children:"My Nice Button"})]})}const sr=({song:e})=>{const t=n=>{n.preventDefault(),G(Ke("songView",{songId:e.id}))};return r.jsx("li",{children:r.jsx("a",{href:`/song/${e.id}`,onClick:t,children:e.title})})},ir=[{name:"library",path:"/library",action:rr}];function or({songId:e}){const t=Oe(s=>ee(s,e)),n=s=>{s.preventDefault(),G(Ke("library"))};return r.jsxs("div",{children:[r.jsx("a",{href:"",onClick:n,children:"Go back to list"}),r.jsx("br",{}),r.jsx("b",{children:t.title}),r.jsx("p",{children:t.content})]})}const ar=[{name:"songView",path:"/songView/:songId",action:or}],Ye=e=>v(D,{mode:e}),lr=()=>v(ke),cr=()=>v(Be),dr="/app/assets/logo-D2B3txiq.svg";function ur(){return r.jsx("div",{className:"logo",children:r.jsx("div",{className:"logo-isExpanded",children:r.jsx("div",{className:"logo-img",children:r.jsxs("svg",{className:"stacked",children:[r.jsx("title",{children:"Chord Chart Studio"}),r.jsx("use",{href:dr+"#stacked"})]})})})})}const pr=C.memo(ur);function Je(e){const{iconName:t}=e,n=["icon","material-icons"];return r.jsx("i",{className:n.join(" "),children:t})}Je.propTypes={iconName:i.string.isRequired};const x=C.memo(Je);function Qe(e){const{label:t,icon:n,editorMode:s,setEditorMode:o,isActive:a,isDisabled:l}=e,c=["mainNavEntry"];a&&c.push("mainNavEntry-isActive"),l&&c.push("mainNavEntry-isDisabled");function d(){l||o(s)}return r.jsxs("li",{className:c.join(" "),onClick:d,children:[r.jsx("span",{className:"mainNavEntry-icon",children:r.jsx(x,{iconName:n})}),t]})}Qe.propTypes={label:i.string.isRequired,icon:i.string.isRequired,editorMode:i.string.isRequired,setEditorMode:i.func.isRequired,isActive:i.bool.isRequired,isDisabled:i.bool.isRequired};const mr=C.memo(Qe);function Xe(e){const{currentMode:t,allEntries:n,setEditorMode:s,selectedId:o}=e;return r.jsx("nav",{className:"mainNav",children:r.jsx("ul",{className:"mainNav-entries",children:n.map((a,l)=>r.jsx(mr,{isActive:!!o&&a.editorMode===t,isDisabled:!o,setEditorMode:s,...a},l))})})}Xe.propTypes={currentMode:i.string.isRequired,setEditorMode:i.func.isRequired,selectedId:i.string,allEntries:i.arrayOf(i.shape({id:i.string.isRequired,label:i.string.isRequired,icon:i.string.isRequired,editorMode:i.string.isRequired}))};const hr=C.memo(Xe),_=({children:e,isDisabled:t,buttonName:n,onClick:s,type:o})=>{const a=["Button"];return o==="primary"&&a.push("Button-primary"),o==="secondary"&&a.push("Button-secondary"),t&&a.push("Button-isDisabled"),r.jsx("button",{className:a.join(" "),disabled:t,type:"button",name:n,onClick:s,children:e})};_.propTypes={children:i.string.isRequired,isDisabled:i.bool,buttonName:i.string.isRequired,type:i.string.isRequired,onClick:i.func.isRequired};_.defaultProps={isDisabled:!1};const gr="https://chord-chart-studio.netlify.app",ie=()=>{const e=()=>{window.open(gr,"_blank").focus()};return r.jsxs("div",{className:"userGuide",children:[r.jsx("div",{className:"userGuide-isCollapsed",children:r.jsx(x,{iconName:"help_outline"})}),r.jsx("div",{className:"userGuide-isExpanded",children:r.jsx(_,{buttonName:"userGuide",type:"primary",onClick:e,children:"User Guide"})})]})};ie.propTypes={};ie.defaultProps={};const fr=C.memo(ie),yr=()=>({"chord-chart-studio":"v0.14.0","chord-symbol":"v4.0.0","chord-mark":"v0.16.2"});function br(){const e=yr();return r.jsx("div",{className:"versions",children:r.jsxs("div",{className:"versions-isExpanded",children:["Chord Chart Studio ",e["chord-chart-studio"],r.jsx("br",{}),"ChordSymbol ",e["chord-symbol"]," ",r.jsx("br",{}),"ChordMark ",e["chord-mark"]," ",r.jsx("br",{}),"Logo by"," ",r.jsx("a",{href:"https://spelling-bee-assistant.app/",target:"_blank",rel:"noreferrer",children:"Dieter Raber"})]})})}const xr=C.memo(br),Cr=e=>e.songImporter.content,jr=e=>e.songImporter.inputFormat,Rr=e=>e.songImporter.title,vr=e=>e.songImporter.isImporting,Fr=e=>e.songImporter.isFromWeb;function oe(e){const{children:t,closeModal:n}=e;return R.useEffect(()=>{const s=o=>{o.key==="Escape"&&n()};return window.addEventListener("keyup",s),()=>{window.removeEventListener("keyup",s)}}),r.jsxs("section",{className:"mod-ModalContainer",children:[r.jsx("div",{className:"mod-Overlay",onClick:n,"data-testid":"modal-overlay"}),r.jsx("div",{className:"mod-ContentContainer",children:t})]})}oe.propTypes={children:i.element.isRequired,closeModal:i.func.isRequired};const Ze=({cancelImport:e,chordMarkContent:t,importFile:n,title:s,content:o,error:a})=>{const l=s?'Import "'+s+'"':"Import song",c=()=>{n(s||"[untitled]",t)};return r.jsxs("div",{className:"sim-Header_Container",children:[r.jsx("div",{className:"sim-Header_Title",children:l}),r.jsxs("div",{className:"sim-Header_Actions",children:[r.jsx(_,{onClick:e,buttonName:"cancel",type:"secondary",children:"CANCEL"}),r.jsx(_,{onClick:c,buttonName:"import",type:"primary",isDisabled:o===""||a!=="",children:"IMPORT"})]})]})};Ze.propTypes={cancelImport:i.func.isRequired,chordMarkContent:i.string,content:i.string,error:i.string,importFile:i.func.isRequired,title:i.string};const et=50*1024,Nr=e=>new Promise((t,n)=>{if(e.length){const s=e[0];Sr(s)?n(_r(s.size)):wr(s)?s.text().then(o=>{t({content:o,title:Tr(s)})}).catch(o=>{n(o)}):n(Er(s))}else n(qr())}),Tr=e=>e.name.substr(0,e.name.lastIndexOf(".")),Sr=e=>e.size>et,wr=e=>e.type.indexOf("text")===0||e.type.length===0,_r=e=>"The selected file is too big: "+ve(e,{round:0})+" (maximum allowed file size is "+ve(et,{round:0})+").",Er=e=>"Cannot import file of type "+e.type+".",qr=()=>"No file selected.",Pr="text/*,.cho,.crd,.chopro,.chord,.pro,.txt,.md",tt=({setContent:e})=>{const t=n=>{Nr(n.target.files).then(s=>{e(s.content,s.title)}).catch(s=>{e(s)})};return r.jsxs("div",{children:[r.jsx("label",{htmlFor:"importSong-Input",className:"Button Button-primary",children:"Select File"}),r.jsx("input",{id:"importSong-Input",name:"importSong-Input",type:"file",className:"sim-InputFile_Input",onChange:t,accept:Pr})]})};tt.propTypes={setContent:i.func.isRequired};function ae(e){const{content:t,setContent:n,isDisabled:s}=e,o=l=>{n(l.target.value)},a=["sim-Input_Textarea"];return s&&a.push("sim-Input_Textarea-Disabled"),r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"sim-Input_Header",children:[r.jsx(x,{iconName:"arrow_drop_down"}),"Copy/paste below",r.jsx(x,{iconName:"arrow_drop_down"})]}),r.jsx("textarea",{className:a.join(" "),onChange:o,value:t,disabled:s,"data-testid":"sim-input"})]})}ae.propTypes={content:i.string.isRequired,isDisabled:i.bool.isRequired,setContent:i.func.isRequired};ae.defaultProps={};function le(e){const{inputFormat:t,error:n}=e;return r.jsxs("div",{className:"sim-Preview_Error",children:[r.jsxs("p",{children:["There was an error when trying to parse the song in the specified input format (",t,").",r.jsx("br",{}),"Please correct the input or try another format.",r.jsx("br",{}),"The error was:"]}),r.jsxs("p",{children:['"',n,'"']}),r.jsx("p",{children:'Hint: most of the time, this is related to an unclosed "[" or "{" or an unsupported ChordPro directive'})]})}le.propTypes={error:i.string,inputFormat:i.string.isRequired};le.defaultProps={};function ce(e){const{setInputFormat:t,inputFormat:n,id:s,label:o,isDisabled:a}=e,l=u=>{a||t(u.target.value)},c=["sim-InputFormat_Entry"],d=["sim-InputFormat_Label"];return a&&(c.push("sim-InputFormat_Entry-Disabled"),d.push("sim-InputFormat_Label-Disabled")),r.jsxs(r.Fragment,{children:[r.jsx("input",{className:c.join(" "),type:"radio",name:"inputFormat",id:s,value:s,onChange:l,checked:n===s}),r.jsx("label",{className:d.join(" "),htmlFor:s,children:o})]})}ce.propTypes={setInputFormat:i.func.isRequired,inputFormat:i.string.isRequired,id:i.string.isRequired,label:i.string.isRequired,isDisabled:i.bool.isRequired};ce.defaultProps={};const Ir=[{id:"auto",label:"Detect"},{id:"chordPro",label:"Bracketed chords (ChordPro)"},{id:"chordsOverLyrics",label:"Chords over lyrics (Ultimate Guitar...)"}];function de(e){const{setInputFormat:t,inputFormat:n,disableAll:s}=e,o=Ir.map(a=>r.jsx(ce,{setInputFormat:t,id:a.id,label:a.label,inputFormat:n,isDisabled:s},a.id));return r.jsxs("div",{className:"sim-InputFormat",children:["Input format:",o]})}de.propTypes={disableAll:i.bool.isRequired,setInputFormat:i.func.isRequired,inputFormat:i.string.isRequired};de.defaultProps={};function ue(e){const{cancelImport:t,content:n,importFile:s,isFromWeb:o,isImporting:a,setContent:l,setInputFormat:c,inputFormat:d,title:u}=e;if(!a)return null;let h="",m="";try{h=kt(n,{inputFormat:d})}catch(f){m=f.message}return r.jsx(oe,{closeModal:t,children:r.jsxs("div",{className:"sim-SongImporterModal_Container","data-testid":"song-importer",children:[r.jsx(Ze,{cancelImport:t,chordMarkContent:h,content:n,error:m,importFile:s,title:u}),r.jsxs("div",{className:"sim-TwoColumns_Container",children:[r.jsx("div",{className:"sim-Column_Container",children:r.jsx(tt,{setContent:l})}),r.jsx("div",{className:"sim-Column_Container",children:r.jsx(de,{inputFormat:d,setInputFormat:c,disableAll:o===!0})})]}),r.jsxs("div",{className:"sim-TwoColumns_Container sim-TwoColumns_Container-autoHeight",children:[r.jsx("div",{className:"sim-Column_Container",children:r.jsx(ae,{content:n,setContent:l,isDisabled:o})}),r.jsxs("div",{className:"sim-Column_Container",children:[r.jsxs("div",{className:"sim-Input_Header",children:[r.jsx(x,{iconName:"arrow_drop_down"}),"ChordMark preview",r.jsx(x,{iconName:"arrow_drop_down"})]}),r.jsx("div",{className:"sim-Preview_Container","data-testid":"sim-preview",children:m?r.jsx(le,{inputFormat:d,error:m}):h})]})]})]})})}ue.propTypes={cancelImport:i.func.isRequired,content:i.string.isRequired,importFile:i.func.isRequired,isFromWeb:i.bool.isRequired,isImporting:i.bool.isRequired,setContent:i.func.isRequired,setInputFormat:i.func.isRequired,inputFormat:i.string.isRequired,title:i.string};ue.defaultProps={};const Mr=T(e=>({content:Cr(e),isFromWeb:Fr(e),isImporting:vr(e),inputFormat:jr(e),title:Rr(e)}),{setContent:On,setInputFormat:Ln,cancelImport:An,importFile:U})(ue),Or=[{id:"edit",label:"Edit",icon:"create",editorMode:"edit"},{id:"play",label:"Screen view",icon:"music_note",editorMode:"play"},{id:"print",label:"Print/PDF Preview",icon:"print",editorMode:"print"},{id:"export",label:"Export Preview",icon:"save_alt",editorMode:"export"}];function pe(e){const{editorMode:t,isLeftBarCollapsed:n,isRightBarCollapsed:s,toggleLeftBar:o,toggleRightBar:a,setEditorMode:l,selectedId:c,leftBar:d,rightBar:u}=e,h=["leftBar"];n&&h.push("leftBar-isCollapsed");const m=["rightBar"];return s&&m.push("rightBar-isCollapsed"),r.jsxs("div",{className:"appLayout-wrapper",children:[r.jsx(Mr,{}),r.jsxs("section",{className:h.join(" "),children:[r.jsxs("div",{className:"leftBar-content",onClick:n?o:null,children:[r.jsx(pr,{}),d]}),r.jsx("div",{className:"leftBar-collapser",onClick:o,"data-testid":"leftBar-collapser",children:r.jsx("span",{className:"leftBar-collapserIcon",children:r.jsx(x,{iconName:"keyboard_arrow_left"})})})]}),r.jsxs("section",{className:"appLayout-main",children:[r.jsx("section",{className:"appLayout-header",children:r.jsx(hr,{allEntries:Or,currentMode:t,setEditorMode:l,selectedId:c})}),r.jsx("section",{className:"appLayout-content",children:e.children})]}),r.jsxs("section",{className:m.join(" "),children:[r.jsx("div",{className:"rightBar-collapser",onClick:a,"data-testid":"rightBar-collapser",children:r.jsx("span",{className:"rightBar-collapserIcon",children:r.jsx(x,{iconName:"keyboard_arrow_right"})})}),r.jsxs("div",{className:"rightBar-content",onClick:s?a:null,children:[r.jsx(fr,{}),u,r.jsx(xr,{})]})]})]})}pe.propTypes={children:i.element,isLeftBarCollapsed:i.bool,isRightBarCollapsed:i.bool,selectedId:i.string,toggleLeftBar:i.func.isRequired,toggleRightBar:i.func.isRequired,editorMode:i.string.isRequired,setEditorMode:i.func.isRequired,leftBar:i.element.isRequired,rightBar:i.element.isRequired};pe.defaultProps={isLeftBarCollapsed:!1,isRightBarCollapsed:!1};const Lr=T(e=>({editorMode:E(e),isLeftBarCollapsed:nn(e),isRightBarCollapsed:rn(e),selectedId:S(e)}),{toggleLeftBar:lr,toggleRightBar:cr,setEditorMode:Ye})(pe),kr=e=>v(re,{id:e}),Br=e=>v(De,{id:e});function Ar(e,t={},n=!1){return rt(e,t,n,"text")}function nt(e,t={},n=!1){return rt(e,t,n,"html")}function rt(e,t,n,s){if(n)switch(t.chartFormat){case"chordmark":{const a=M(e,t);return s==="html"?a:we(a)}case"chordmarkSrc":return s==="html"?V(e):e;case"chordpro":{t.customRenderer=Dt();const a=M(e,t);return s==="html"?V(a):a}case"ultimateGuitar":{t.customRenderer=Fe();const a=M(e,{...t,customRenderer:Fe(),printBarSeparators:"grids",printChordsDuration:"never",printSubBeatDelimiters:!1,printInlineTimeSignatures:!1,chordSymbolRenderer:Bt({customFilters:[At()],useShortNamings:!0,accidentalsType:t.accidentalsType==="auto"?"original":t.accidentalsType,...t})})+` Created with Chord Chart Studio (https://chord-chart-studio.netlify.app)`;return s==="html"?V(a):a}}const o=M(e,{...t,wrapChordLyricLines:!0});return s==="html"?o:we(o)}function M(e,t){try{const n=Wt(e);return Gt(n,{...t})}catch(n){return n.message}}function V(e){return e.split(` `).map(t=>t===""?" ":t).map(t=>`${t}`).join("")}function we(e){return e.match(/(.*?<\/p>)/gm).map(n=>q(n)).map(n=>n===" "?"":n).join(` diff --git a/packages/chord-chart-studio/build/index.html b/packages/chord-chart-studio/build/index.html index a2523640..80b7dee1 100644 --- a/packages/chord-chart-studio/build/index.html +++ b/packages/chord-chart-studio/build/index.html @@ -39,7 +39,7 @@ gtag('config', 'G-EGKBT2J600'); - + diff --git a/packages/chord-chart-studio/build/sw.js b/packages/chord-chart-studio/build/sw.js index 11064595..c2c48be2 100644 --- a/packages/chord-chart-studio/build/sw.js +++ b/packages/chord-chart-studio/build/sw.js @@ -1 +1 @@ -if(!self.define){let e,s={};const n=(n,t)=>(n=new URL(n+".js",t).href,s[n]||new Promise((s=>{if("document"in self){const e=document.createElement("script");e.src=n,e.onload=s,document.head.appendChild(e)}else e=n,importScripts(n),s()})).then((()=>{let e=s[n];if(!e)throw new Error(`Module ${n} didn’t register its module`);return e})));self.define=(t,o)=>{const i=e||("document"in self?document.currentScript.src:"")||location.href;if(s[i])return;let r={};const l=e=>n(e,i),u={module:{uri:i},exports:r,require:l};s[i]=Promise.all(t.map((e=>u[e]||l(e)))).then((e=>(o(...e),r)))}}define(["./workbox-f6d27052"],(function(e){"use strict";self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"assets/index-BmEYkRDe.css",revision:null},{url:"assets/index-DJ3FYunF.js",revision:null},{url:"assets/logo-D2B3txiq.svg",revision:null},{url:"assets/vendor-B9p68kIM.js",revision:null},{url:"assets/vendor-BHpWJQ6D.css",revision:null},{url:"icon.svg",revision:"22be856a58b037f4d448a78f2fc6dee6"},{url:"index.html",revision:"ce53f83969d5c1bb0065ba4adc146d4e"},{url:"registerSW.js",revision:"6a7126f4909d378979bca200ff77879d"}],{}),e.cleanupOutdatedCaches(),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("index.html"))),e.registerRoute(/^https:\/\/fonts\.googleapis\.com/,new e.StaleWhileRevalidate({cacheName:"google-fonts-stylesheets",plugins:[]}),"GET"),e.registerRoute(/^https:\/\/fonts\.gstatic\.com/,new e.StaleWhileRevalidate({cacheName:"google-fonts-webfonts",plugins:[new e.CacheableResponsePlugin({statuses:[0,200]}),new e.ExpirationPlugin({maxAgeSeconds:31536e3,maxEntries:30})]}),"GET")})); +if(!self.define){let e,s={};const n=(n,t)=>(n=new URL(n+".js",t).href,s[n]||new Promise((s=>{if("document"in self){const e=document.createElement("script");e.src=n,e.onload=s,document.head.appendChild(e)}else e=n,importScripts(n),s()})).then((()=>{let e=s[n];if(!e)throw new Error(`Module ${n} didn’t register its module`);return e})));self.define=(t,o)=>{const i=e||("document"in self?document.currentScript.src:"")||location.href;if(s[i])return;let r={};const l=e=>n(e,i),c={module:{uri:i},exports:r,require:l};s[i]=Promise.all(t.map((e=>c[e]||l(e)))).then((e=>(o(...e),r)))}}define(["./workbox-f6d27052"],(function(e){"use strict";self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"assets/index-B0ChhUNb.js",revision:null},{url:"assets/index-BmEYkRDe.css",revision:null},{url:"assets/logo-D2B3txiq.svg",revision:null},{url:"assets/vendor-B9p68kIM.js",revision:null},{url:"assets/vendor-BHpWJQ6D.css",revision:null},{url:"icon.svg",revision:"22be856a58b037f4d448a78f2fc6dee6"},{url:"index.html",revision:"4ae74fa07cc2b5b4dd4094bd13c114bb"},{url:"registerSW.js",revision:"6a7126f4909d378979bca200ff77879d"}],{}),e.cleanupOutdatedCaches(),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("index.html"))),e.registerRoute(/^https:\/\/fonts\.googleapis\.com/,new e.StaleWhileRevalidate({cacheName:"google-fonts-stylesheets",plugins:[]}),"GET"),e.registerRoute(/^https:\/\/fonts\.gstatic\.com/,new e.StaleWhileRevalidate({cacheName:"google-fonts-webfonts",plugins:[new e.CacheableResponsePlugin({statuses:[0,200]}),new e.ExpirationPlugin({maxAgeSeconds:31536e3,maxEntries:30})]}),"GET")})); diff --git a/packages/chord-chart-studio/src/ui/sideBar/_components/Versions.jsx b/packages/chord-chart-studio/src/ui/sideBar/_components/Versions.jsx index dcd14830..a7bf3306 100644 --- a/packages/chord-chart-studio/src/ui/sideBar/_components/Versions.jsx +++ b/packages/chord-chart-studio/src/ui/sideBar/_components/Versions.jsx @@ -10,8 +10,8 @@ function Versions() {
Chord Chart Studio {versions['chord-chart-studio']}
- ChordMark {versions['chord-mark']}
ChordSymbol {versions['chord-symbol']}
+ ChordMark {versions['chord-mark']}
Logo by{' '}