@venite/components 0.16.9 → 0.16.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- import{r as e,c as t,h as i,H as l,a}from"./p-978e2c6d.js";import{L as n}from"./p-4aa9a6f2.js";import{C as o}from"./p-991c0877.js";import{v as s}from"./p-161be025.js";import{s as d}from"./p-b4bbe638.js";import{g as r}from"./p-0491d1d2.js";import"./p-8f67abb8.js";import"./p-a1729dbd.js";import"./p-5b43e6be.js";import"./p-65d26c45.js";const h={allowMultiple:"Allow multiple options",lookup:"Look this document up from the database.",type:"Type",lectionary:"Lectionary",canticle:"Canticle",category:"Category",slug:"Slug",collect:"Collect",table:"Table",item:"Item",filter:"Filter",seasonal:"Seasonal",evening:"Evening",day:"Day",rotate:"Rotate",isPreference:"Value stored in preference",preference:"Preference",value:"Value"},p={type:"slug"},u=class{constructor(i){e(this,i),this.ldfDocShouldChange=t(this,"ldfDocShouldChange",7)}optionChange(){this.currentLookup=this.lookup}componentWillLoad(){this.currentLookup=this.lookup}toggle(){this.currentLookup?(this.ldfDocShouldChange.emit(new o({path:this.path,op:[{type:"set",oldValue:this.currentLookup,value:void 0}]})),this.currentLookup=void 0):(this.currentLookup=p,this.ldfDocShouldChange.emit(new o({path:this.path,op:[{type:"set",oldValue:void 0,value:p}]})))}toggleIsPreference(e,t){const i=(this.currentLookup||{})[e];t?(this.currentLookup=Object.assign(Object.assign({},this.currentLookup),{[e]:{preference:""}}),this.ldfDocShouldChange.emit(new o({path:`${this.path}/${e}`,op:[{type:"set",oldValue:i,value:{preference:""}}]}))):(this.currentLookup=Object.assign(Object.assign({},this.currentLookup),{[e]:""}),this.ldfDocShouldChange.emit(new o({path:`${this.path}/${e}`,op:[{type:"set",oldValue:i,value:""}]})))}render(){var e,t,a,n,o,s;const d=({label:e,field:t,value:l})=>{const a=l&&"string"!=typeof l;return[i("ion-item",{lines:"none"},i("ion-label",{position:"stacked"},e),i("br",null)),i("ion-item",{lines:"none"},i("ion-label",null,h.isPreference),i("ion-checkbox",{slot:"end",checked:a,onIonChange:e=>this.toggleIsPreference(t,e.detail.checked)})),i("ion-item",null,i("ldf-editable-text",a?{path:`${this.path}/${t}/preference`,short:!0,placeholder:h.preference,text:null==l?void 0:l.preference}:{path:`${this.path}/${t}`,placeholder:h.value,short:!0,text:l}))]};return i(l,null,i("ion-item",null,i("ion-label",null,h.lookup),i("ion-checkbox",{checked:Boolean(this.lookup),onIonChange:()=>this.toggle()})),this.currentLookup&&i("ion-list",null,i("ion-item",null,i("ion-label",{position:"stacked"},h.type),i("ldf-editable-select",{path:this.path,property:"type",options:new Array({value:void 0,label:"—"}).concat(this.types.map((e=>({value:e,label:h[e]||e})))),value:null===(e=this.currentLookup)||void 0===e?void 0:e.type})),i(d,{label:h.table,field:"table",value:null===(t=this.currentLookup)||void 0===t?void 0:t.table}),i(d,{label:h.item,field:"item",value:null===(a=this.currentLookup)||void 0===a?void 0:a.item}),i("ion-item",null,i("ion-label",{position:"stacked"},h.filter),i("ldf-editable-select",{path:this.path,property:"filter",options:[{value:void 0,label:"—"},{value:"seasonal",label:h.seasonal},{value:"evening",label:h.evening},{value:"day",label:h.day}],value:null===(n=this.currentLookup)||void 0===n?void 0:n.filter})),i("ion-item",null,i("ion-label",null,h.rotate),i("ldf-editable-boolean",{slot:"end",path:this.path,property:"rotate",value:null===(o=this.currentLookup)||void 0===o?void 0:o.rotate})),i("ion-item",null,i("ion-label",null,h.allowMultiple),i("ldf-editable-boolean",{slot:"end",path:this.path,property:"allow_multiple",value:null===(s=this.currentLookup)||void 0===s?void 0:s.allow_multiple}))))}static get watchers(){return{lookup:["optionChange"]}}},c={en:{"bible-reading":"Bible Reading",changeable:"Changeable (show 'Change ...')",delay:"Delay before Starting",evening:"Evening Liturgy",heading:"Heading",heading1:"1. Title",heading2:"2. Section Title",heading3:"3. Label",heading4:"4. Sub-Section Label",insert_seasonal_antiphon:"Insert Seasonal Antiphon",insert_gloria:"Insert Gloria Patri",intro:"Introduction",label:"Short Label",latinname:"Latin Name",level:"Level",length:"Length of Meditation",liturgy:"Liturgy",liturgyversions:"Liturgy Versions",localname:"English Name",meditation:"Meditation",none:"None",number:"Psalm Number",omit_antiphon:"Omit Antiphon",omit_gloria:"Omit Gloria Patri",omit_label:"Omit Label",omit_response:"Omit Response",preferences:"Preferences",pronouns:"Pronouns to Replace",psalm:"Psalm",response:"Response",responsive:"Responsive Prayer",rollup:"Roll Up (Remove Whitespace)",slug:"End of URL (venite.app/[church name]/____)",special_preferences:"Special Preferences (not saved)",supplement:"Supplemental Devotion",title:"Settings",text:"Text",gloria:"Gloria Patri",insert_gloria_patri:"Insert the Gloria Patri",antiphon:"Antiphon",left:"Left",center:"Center",right:"Right",align:"Alignment",height:"Height",width:"Width"}};var v;!function(e){e[e.Alignment=0]="Alignment",e[e.String=1]="String",e[e.Bool=2]="Bool",e[e.Number=3]="Number",e[e.StringList=4]="StringList",e[e.BibleReadingIntro=5]="BibleReadingIntro",e[e.TimeInSeconds=6]="TimeInSeconds",e[e.HeadingLevel=7]="HeadingLevel",e[e.Gloria=8]="Gloria",e[e.Antiphon=9]="Antiphon"}(v||(v={}));const b=class{constructor(i){e(this,i),this.ldfDocShouldChange=t(this,"ldfDocShouldChange",7),this.ldfAskForBibleIntros=t(this,"ldfAskForBibleIntros",7),this.ldfShouldAddGloriaPatri=t(this,"ldfShouldAddGloriaPatri",7),this.currentBibleReadingIntros=new Array,this.bibleReadingIntros=new Array}docChanged(e){var t;try{this.obj=d("string"==typeof e?JSON.parse(e):e),this.fields=this.fieldsFromType(null===(t=this.obj)||void 0===t?void 0:t.type),this.fields.find((e=>e.type==v.BibleReadingIntro))&&this.ldfAskForBibleIntros.emit()}catch(e){console.warn(e),this.obj=new n}}introsChanged(){this.currentBibleReadingIntros=[...this.bibleReadingIntros]}async setBibleReadingIntros(e){this.currentBibleReadingIntros="string"==typeof e?JSON.parse(e):e}async componentWillLoad(){this.docChanged(this.doc),this.loadLocaleStrings()}async loadLocaleStrings(){try{this.localeStrings=c[r(this.element)]}catch(e){console.warn(e)}}fieldsFromType(e){switch(e){case"bible-reading":return[{field:"response",type:v.String},{field:"intro",type:v.BibleReadingIntro}];case"heading":return[{field:"level",type:v.HeadingLevel}];case"image":return[{field:"height",type:v.Number,unit:"px"},{field:"width",type:v.Number,unit:"px"},{field:"align",type:v.Alignment}];case"liturgy":return[{field:"label",type:v.String},{field:"slug",type:v.String},{field:"liturgyversions",type:v.StringList},{field:"supplement",type:v.Bool},{field:"evening",type:v.Bool},{field:"pronouns",type:v.StringList}];case"meditation":return[{field:"length",type:v.TimeInSeconds},{field:"delay",type:v.TimeInSeconds}];case"psalm":return[{field:"number",type:v.Number},{field:"localname",type:v.String},{field:"latinname",type:v.String},{field:"omit_antiphon",type:v.Bool},{field:"omit_gloria",type:v.Bool},{field:"insert_seasonal_antiphon",type:v.Bool},{field:"antiphon",type:v.Antiphon},{field:"gloria",type:v.Gloria},{field:"changeable",type:v.Bool}];case"responsive":return[{field:"response",type:v.String}];case"option":case"refrain":case"rubric":return[];case"text":return[{field:"response",type:v.String},{field:"omit_response",type:v.Bool},{field:"omit_label",type:v.Bool},{field:"rollup",type:v.Bool}];default:console.warn("(ldf-editable-metadata-metadata-fields)",e,"is not a recognized type")}}fieldToNodes(e,t){var l,a,n,d,r,h,p,u,c;const b=new Array,f=((null===(l=this.obj)||void 0===l?void 0:l.metadata)||{})[e.field],g=`${this.path}/metadata/${e.field}`,m=t[e.field];let y=!0,_=!0;switch(e.type){case v.BibleReadingIntro:b.push(i("ldf-editable-select",{path:`${this.path}/metadata`,property:e.field,options:[{label:t.none,value:null},...this.currentBibleReadingIntros.map((e=>{var t;return{label:"responsive"===e.type?null===(t=e.value[0].text)||void 0===t?void 0:t.toString():e.value[0].toString(),value:e}}))],value:f}));break;case v.Bool:b.push(i("ldf-editable-boolean",{path:`${this.path}/metadata`,property:e.field,value:f})),_=!1;break;case v.Number:b.push(i("ldf-editable-text",{short:!0,inputType:"number",path:g,placeholder:m,text:f,unit:e.unit}));break;case v.String:b.push(i("ldf-editable-text",{short:!0,path:g,placeholder:m,text:f}));break;case v.StringList:b.push({node:i("ldf-editable-string-list",{path:`${this.path}/metadata`,property:e.field,value:f}),size:12}),y=!1;break;case v.HeadingLevel:b.push(i("ldf-editable-select",{path:`${this.path}/metadata`,property:e.field,options:[{label:t.heading1,value:1},{label:t.heading2,value:2},{label:t.heading3,value:3},{label:t.heading4,value:4}],value:f}));break;case v.TimeInSeconds:b.push(i("ldf-editable-text",{inputType:"number",short:!0,path:g,placeholder:m,text:f}));break;case v.Gloria:y=!1,b.push({node:i("ion-item",{lines:"none"},i("ion-label",null,t.insert_gloria),i("ion-checkbox",{checked:Boolean(null===(n=null===(a=this.obj)||void 0===a?void 0:a.metadata)||void 0===n?void 0:n.gloria),onIonChange:e=>{var t,i,l,a,n,d,r,h,p,u,c,v,b,f;e.detail.checked?(this.ldfShouldAddGloriaPatri.emit({path:this.path,language:null===(t=this.obj)||void 0===t?void 0:t.language,version:s(null===(i=this.obj)||void 0===i?void 0:i.version),oldValue:null===(a=null===(l=this.obj)||void 0===l?void 0:l.metadata)||void 0===a?void 0:a.gloria}),!1!==(null===(d=null===(n=this.obj)||void 0===n?void 0:n.metadata)||void 0===d?void 0:d.omit_gloria)&&this.ldfDocShouldChange.emit(new o({path:`${this.path}/metadata`,op:[{type:"set",index:"omit_gloria",oldValue:null===(h=null===(r=this.obj)||void 0===r?void 0:r.metadata)||void 0===h?void 0:h.omit_gloria,value:!1}]}))):(this.ldfDocShouldChange.emit(new o({path:`${this.path}/metadata`,op:[{type:"deleteAt",index:"gloria",oldValue:null===(u=null===(p=this.obj)||void 0===p?void 0:p.metadata)||void 0===u?void 0:u.gloria}]})),!0!==(null===(v=null===(c=this.obj)||void 0===c?void 0:c.metadata)||void 0===v?void 0:v.omit_gloria)&&this.ldfDocShouldChange.emit(new o({path:`${this.path}/metadata`,op:[{type:"set",index:"omit_gloria",oldValue:null===(f=null===(b=this.obj)||void 0===b?void 0:b.metadata)||void 0===f?void 0:f.omit_gloria,value:!0}]})))}})),size:12});break;case v.Antiphon:y=!1,b.push({node:i("ldf-editable-antiphon-field",{path:this.path,antiphon:null===(r=null===(d=this.obj)||void 0===d?void 0:d.metadata)||void 0===r?void 0:r.antiphon,omit_antiphon:null===(p=null===(h=this.obj)||void 0===h?void 0:h.metadata)||void 0===p?void 0:p.omit_antiphon,insert_antiphon:null===(c=null===(u=this.obj)||void 0===u?void 0:u.metadata)||void 0===c?void 0:c.insert_seasonal_antiphon}),size:12});break;case v.Alignment:b.push(i("ldf-editable-select",{path:`${this.path}/metadata`,property:e.field,options:[{label:t.left,value:"left"},{label:t.center,value:"center"},{label:t.right,value:"right"}],value:f}));break;default:console.warn("(ldf-editable-metadata-metadata-fields)",e.type,"is not a recognized FieldType")}return y?[i("ion-item",{lines:"none"},i("ion-label",_?{position:"stacked"}:null,t[e.field]),b.map((e=>e.hasOwnProperty("size")?i("ion-col",{size:e.size},e.node):i("ion-col",null,e))))]:b}render(){const e=this.localeStrings||{},t=this.fields.map((t=>this.fieldToNodes(t,e)));return(null==t?void 0:t.length)>0&&i("ion-card",null,i("ion-card-header",null,i("ion-card-title",null,e[this.obj.type]," ",e.title)),i("ion-card-content",null,t.map((e=>e.map((e=>e.hasOwnProperty("size")?i("div",null,e.node):i("div",null,e)))))))}get element(){return a(this)}static get watchers(){return{doc:["docChanged"],bibleReadingIntros:["introsChanged"]}}};export{u as ldf_editable_lookup,b as ldf_editable_metadata_metadata_fields}
1
+ import{r as e,c as t,h as i,H as l,a}from"./p-978e2c6d.js";import{L as n}from"./p-4aa9a6f2.js";import{C as o}from"./p-991c0877.js";import{v as s}from"./p-2da3f59d.js";import{s as d}from"./p-c3c99023.js";import{g as r}from"./p-0491d1d2.js";import"./p-8f67abb8.js";import"./p-a1729dbd.js";import"./p-5b43e6be.js";import"./p-65d26c45.js";const h={allowMultiple:"Allow multiple options",lookup:"Look this document up from the database.",type:"Type",lectionary:"Lectionary",canticle:"Canticle",category:"Category",slug:"Slug",collect:"Collect",table:"Table",item:"Item",filter:"Filter",seasonal:"Seasonal",evening:"Evening",day:"Day",rotate:"Rotate",isPreference:"Value stored in preference",preference:"Preference",value:"Value"},p={type:"slug"},u=class{constructor(i){e(this,i),this.ldfDocShouldChange=t(this,"ldfDocShouldChange",7)}optionChange(){this.currentLookup=this.lookup}componentWillLoad(){this.currentLookup=this.lookup}toggle(){this.currentLookup?(this.ldfDocShouldChange.emit(new o({path:this.path,op:[{type:"set",oldValue:this.currentLookup,value:void 0}]})),this.currentLookup=void 0):(this.currentLookup=p,this.ldfDocShouldChange.emit(new o({path:this.path,op:[{type:"set",oldValue:void 0,value:p}]})))}toggleIsPreference(e,t){const i=(this.currentLookup||{})[e];t?(this.currentLookup=Object.assign(Object.assign({},this.currentLookup),{[e]:{preference:""}}),this.ldfDocShouldChange.emit(new o({path:`${this.path}/${e}`,op:[{type:"set",oldValue:i,value:{preference:""}}]}))):(this.currentLookup=Object.assign(Object.assign({},this.currentLookup),{[e]:""}),this.ldfDocShouldChange.emit(new o({path:`${this.path}/${e}`,op:[{type:"set",oldValue:i,value:""}]})))}render(){var e,t,a,n,o,s;const d=({label:e,field:t,value:l})=>{const a=l&&"string"!=typeof l;return[i("ion-item",{lines:"none"},i("ion-label",{position:"stacked"},e),i("br",null)),i("ion-item",{lines:"none"},i("ion-label",null,h.isPreference),i("ion-checkbox",{slot:"end",checked:a,onIonChange:e=>this.toggleIsPreference(t,e.detail.checked)})),i("ion-item",null,i("ldf-editable-text",a?{path:`${this.path}/${t}/preference`,short:!0,placeholder:h.preference,text:null==l?void 0:l.preference}:{path:`${this.path}/${t}`,placeholder:h.value,short:!0,text:l}))]};return i(l,null,i("ion-item",null,i("ion-label",null,h.lookup),i("ion-checkbox",{checked:Boolean(this.lookup),onIonChange:()=>this.toggle()})),this.currentLookup&&i("ion-list",null,i("ion-item",null,i("ion-label",{position:"stacked"},h.type),i("ldf-editable-select",{path:this.path,property:"type",options:new Array({value:void 0,label:"—"}).concat(this.types.map((e=>({value:e,label:h[e]||e})))),value:null===(e=this.currentLookup)||void 0===e?void 0:e.type})),i(d,{label:h.table,field:"table",value:null===(t=this.currentLookup)||void 0===t?void 0:t.table}),i(d,{label:h.item,field:"item",value:null===(a=this.currentLookup)||void 0===a?void 0:a.item}),i("ion-item",null,i("ion-label",{position:"stacked"},h.filter),i("ldf-editable-select",{path:this.path,property:"filter",options:[{value:void 0,label:"—"},{value:"seasonal",label:h.seasonal},{value:"evening",label:h.evening},{value:"day",label:h.day}],value:null===(n=this.currentLookup)||void 0===n?void 0:n.filter})),i("ion-item",null,i("ion-label",null,h.rotate),i("ldf-editable-boolean",{slot:"end",path:this.path,property:"rotate",value:null===(o=this.currentLookup)||void 0===o?void 0:o.rotate})),i("ion-item",null,i("ion-label",null,h.allowMultiple),i("ldf-editable-boolean",{slot:"end",path:this.path,property:"allow_multiple",value:null===(s=this.currentLookup)||void 0===s?void 0:s.allow_multiple}))))}static get watchers(){return{lookup:["optionChange"]}}},c={en:{"bible-reading":"Bible Reading",changeable:"Changeable (show 'Change ...')",delay:"Delay before Starting",evening:"Evening Liturgy",heading:"Heading",heading1:"1. Title",heading2:"2. Section Title",heading3:"3. Label",heading4:"4. Sub-Section Label",insert_seasonal_antiphon:"Insert Seasonal Antiphon",insert_gloria:"Insert Gloria Patri",intro:"Introduction",label:"Short Label",latinname:"Latin Name",level:"Level",length:"Length of Meditation",liturgy:"Liturgy",liturgyversions:"Liturgy Versions",localname:"English Name",meditation:"Meditation",none:"None",number:"Psalm Number",omit_antiphon:"Omit Antiphon",omit_gloria:"Omit Gloria Patri",omit_label:"Omit Label",omit_response:"Omit Response",preferences:"Preferences",pronouns:"Pronouns to Replace",psalm:"Psalm",response:"Response",responsive:"Responsive Prayer",rollup:"Roll Up (Remove Whitespace)",slug:"End of URL (venite.app/[church name]/____)",special_preferences:"Special Preferences (not saved)",supplement:"Supplemental Devotion",title:"Settings",text:"Text",gloria:"Gloria Patri",insert_gloria_patri:"Insert the Gloria Patri",antiphon:"Antiphon",left:"Left",center:"Center",right:"Right",align:"Alignment",height:"Height",width:"Width"}};var v;!function(e){e[e.Alignment=0]="Alignment",e[e.String=1]="String",e[e.Bool=2]="Bool",e[e.Number=3]="Number",e[e.StringList=4]="StringList",e[e.BibleReadingIntro=5]="BibleReadingIntro",e[e.TimeInSeconds=6]="TimeInSeconds",e[e.HeadingLevel=7]="HeadingLevel",e[e.Gloria=8]="Gloria",e[e.Antiphon=9]="Antiphon"}(v||(v={}));const b=class{constructor(i){e(this,i),this.ldfDocShouldChange=t(this,"ldfDocShouldChange",7),this.ldfAskForBibleIntros=t(this,"ldfAskForBibleIntros",7),this.ldfShouldAddGloriaPatri=t(this,"ldfShouldAddGloriaPatri",7),this.currentBibleReadingIntros=new Array,this.bibleReadingIntros=new Array}docChanged(e){var t;try{this.obj=d("string"==typeof e?JSON.parse(e):e),this.fields=this.fieldsFromType(null===(t=this.obj)||void 0===t?void 0:t.type),this.fields.find((e=>e.type==v.BibleReadingIntro))&&this.ldfAskForBibleIntros.emit()}catch(e){console.warn(e),this.obj=new n}}introsChanged(){this.currentBibleReadingIntros=[...this.bibleReadingIntros]}async setBibleReadingIntros(e){this.currentBibleReadingIntros="string"==typeof e?JSON.parse(e):e}async componentWillLoad(){this.docChanged(this.doc),this.loadLocaleStrings()}async loadLocaleStrings(){try{this.localeStrings=c[r(this.element)]}catch(e){console.warn(e)}}fieldsFromType(e){switch(e){case"bible-reading":return[{field:"response",type:v.String},{field:"intro",type:v.BibleReadingIntro}];case"heading":return[{field:"level",type:v.HeadingLevel}];case"image":return[{field:"height",type:v.Number,unit:"px"},{field:"width",type:v.Number,unit:"px"},{field:"align",type:v.Alignment}];case"liturgy":return[{field:"label",type:v.String},{field:"slug",type:v.String},{field:"liturgyversions",type:v.StringList},{field:"supplement",type:v.Bool},{field:"evening",type:v.Bool},{field:"pronouns",type:v.StringList}];case"meditation":return[{field:"length",type:v.TimeInSeconds},{field:"delay",type:v.TimeInSeconds}];case"psalm":return[{field:"number",type:v.Number},{field:"localname",type:v.String},{field:"latinname",type:v.String},{field:"omit_antiphon",type:v.Bool},{field:"omit_gloria",type:v.Bool},{field:"insert_seasonal_antiphon",type:v.Bool},{field:"antiphon",type:v.Antiphon},{field:"gloria",type:v.Gloria},{field:"changeable",type:v.Bool}];case"responsive":return[{field:"response",type:v.String}];case"option":case"refrain":case"rubric":return[];case"text":return[{field:"response",type:v.String},{field:"omit_response",type:v.Bool},{field:"omit_label",type:v.Bool},{field:"rollup",type:v.Bool}];default:console.warn("(ldf-editable-metadata-metadata-fields)",e,"is not a recognized type")}}fieldToNodes(e,t){var l,a,n,d,r,h,p,u,c;const b=new Array,f=((null===(l=this.obj)||void 0===l?void 0:l.metadata)||{})[e.field],g=`${this.path}/metadata/${e.field}`,m=t[e.field];let y=!0,_=!0;switch(e.type){case v.BibleReadingIntro:b.push(i("ldf-editable-select",{path:`${this.path}/metadata`,property:e.field,options:[{label:t.none,value:null},...this.currentBibleReadingIntros.map((e=>{var t;return{label:"responsive"===e.type?null===(t=e.value[0].text)||void 0===t?void 0:t.toString():e.value[0].toString(),value:e}}))],value:f}));break;case v.Bool:b.push(i("ldf-editable-boolean",{path:`${this.path}/metadata`,property:e.field,value:f})),_=!1;break;case v.Number:b.push(i("ldf-editable-text",{short:!0,inputType:"number",path:g,placeholder:m,text:f,unit:e.unit}));break;case v.String:b.push(i("ldf-editable-text",{short:!0,path:g,placeholder:m,text:f}));break;case v.StringList:b.push({node:i("ldf-editable-string-list",{path:`${this.path}/metadata`,property:e.field,value:f}),size:12}),y=!1;break;case v.HeadingLevel:b.push(i("ldf-editable-select",{path:`${this.path}/metadata`,property:e.field,options:[{label:t.heading1,value:1},{label:t.heading2,value:2},{label:t.heading3,value:3},{label:t.heading4,value:4}],value:f}));break;case v.TimeInSeconds:b.push(i("ldf-editable-text",{inputType:"number",short:!0,path:g,placeholder:m,text:f}));break;case v.Gloria:y=!1,b.push({node:i("ion-item",{lines:"none"},i("ion-label",null,t.insert_gloria),i("ion-checkbox",{checked:Boolean(null===(n=null===(a=this.obj)||void 0===a?void 0:a.metadata)||void 0===n?void 0:n.gloria),onIonChange:e=>{var t,i,l,a,n,d,r,h,p,u,c,v,b,f;e.detail.checked?(this.ldfShouldAddGloriaPatri.emit({path:this.path,language:null===(t=this.obj)||void 0===t?void 0:t.language,version:s(null===(i=this.obj)||void 0===i?void 0:i.version),oldValue:null===(a=null===(l=this.obj)||void 0===l?void 0:l.metadata)||void 0===a?void 0:a.gloria}),!1!==(null===(d=null===(n=this.obj)||void 0===n?void 0:n.metadata)||void 0===d?void 0:d.omit_gloria)&&this.ldfDocShouldChange.emit(new o({path:`${this.path}/metadata`,op:[{type:"set",index:"omit_gloria",oldValue:null===(h=null===(r=this.obj)||void 0===r?void 0:r.metadata)||void 0===h?void 0:h.omit_gloria,value:!1}]}))):(this.ldfDocShouldChange.emit(new o({path:`${this.path}/metadata`,op:[{type:"deleteAt",index:"gloria",oldValue:null===(u=null===(p=this.obj)||void 0===p?void 0:p.metadata)||void 0===u?void 0:u.gloria}]})),!0!==(null===(v=null===(c=this.obj)||void 0===c?void 0:c.metadata)||void 0===v?void 0:v.omit_gloria)&&this.ldfDocShouldChange.emit(new o({path:`${this.path}/metadata`,op:[{type:"set",index:"omit_gloria",oldValue:null===(f=null===(b=this.obj)||void 0===b?void 0:b.metadata)||void 0===f?void 0:f.omit_gloria,value:!0}]})))}})),size:12});break;case v.Antiphon:y=!1,b.push({node:i("ldf-editable-antiphon-field",{path:this.path,antiphon:null===(r=null===(d=this.obj)||void 0===d?void 0:d.metadata)||void 0===r?void 0:r.antiphon,omit_antiphon:null===(p=null===(h=this.obj)||void 0===h?void 0:h.metadata)||void 0===p?void 0:p.omit_antiphon,insert_antiphon:null===(c=null===(u=this.obj)||void 0===u?void 0:u.metadata)||void 0===c?void 0:c.insert_seasonal_antiphon}),size:12});break;case v.Alignment:b.push(i("ldf-editable-select",{path:`${this.path}/metadata`,property:e.field,options:[{label:t.left,value:"left"},{label:t.center,value:"center"},{label:t.right,value:"right"}],value:f}));break;default:console.warn("(ldf-editable-metadata-metadata-fields)",e.type,"is not a recognized FieldType")}return y?[i("ion-item",{lines:"none"},i("ion-label",_?{position:"stacked"}:null,t[e.field]),b.map((e=>e.hasOwnProperty("size")?i("ion-col",{size:e.size},e.node):i("ion-col",null,e))))]:b}render(){const e=this.localeStrings||{},t=this.fields.map((t=>this.fieldToNodes(t,e)));return(null==t?void 0:t.length)>0&&i("ion-card",null,i("ion-card-header",null,i("ion-card-title",null,e[this.obj.type]," ",e.title)),i("ion-card-content",null,t.map((e=>e.map((e=>e.hasOwnProperty("size")?i("div",null,e.node):i("div",null,e)))))))}get element(){return a(this)}static get watchers(){return{doc:["docChanged"],bibleReadingIntros:["introsChanged"]}}};export{u as ldf_editable_lookup,b as ldf_editable_metadata_metadata_fields}
@@ -1 +1 @@
1
- import{r as i,c as t,h as e,H as a,a as l}from"./p-978e2c6d.js";import{L as n}from"./p-4aa9a6f2.js";import{C as o}from"./p-991c0877.js";import{s}from"./p-b4bbe638.js";import{g as r}from"./p-0491d1d2.js";import"./p-8f67abb8.js";import"./p-a1729dbd.js";import"./p-161be025.js";import"./p-5b43e6be.js";import"./p-65d26c45.js";const d={en:{abbreviated:"Abbreviated",advanced:"Advanced Settings",antiphon:"Antiphon","authorized-prayers":"Prayers & Thanksgivings","bible-reading":"Bible Reading",canticle:"Canticle",category:"Category",citation:"Biblical Citation",collect:"Collect",condition:"Condition",default:"Default",delete:"Delete",display_format:"Display Format",gloria:"Gloria",halfverse:"By Half-Verse",heading:"Heading",invitatory:"Invitatory",label:"Label",language:"Language",lectionary:"Lectionary",litany:"Litany",liturgy:"Liturgy",long:"Long",markdown:"Rich Text (Markdown)",meditation:"Meditation",modalTitle:"Edit Settings",normal:"Normal",omit:"Omit Text",option:"Option",prayer:"Prayer",preces:"Preces",psalm:"Psalm",refrain:"Refrain",responsive:"Responsive Prayer",rubric:"Rubric",settings:"Settings",short:"Short",slug:"Slug","source/source":"Source","source/citation":"Citation within Source",style:"Style",text:"Text",title:"General Settings",tradition:"Tradition",type:"Type",unison:"Unison",version:"Version",version_label:"Version Label",wholeverse:"By Whole Verse"}},c=class{constructor(e){i(this,e),this.ldfDocShouldChange=t(this,"ldfDocShouldChange",7),this.showAdvanced=!1}docChanged(i){try{this.obj=s("string"==typeof i?JSON.parse(i):i)}catch(i){console.warn(i),this.obj=new n}}componentWillLoad(){this.docChanged(this.doc),this.collapsedState=this.collapsed,this.loadLocaleStrings(),this.initializeMetadata()}async loadLocaleStrings(){try{this.localeStrings=d[r(this.element)]}catch(i){console.warn(i)}}initializeMetadata(){this.obj.metadata||(this.obj.metadata={},this.ldfDocShouldChange.emit(new o({path:`${this.path}/metadata`,op:[{type:"set",value:{}}]}))),this.obj.source||(this.obj.source={api:"",source:"",citation:""},this.ldfDocShouldChange.emit(new o({path:`${this.path}/source`,op:[{type:"set",value:{api:"",source:"",citation:""}}]})))}render(){var i,t;const l=this.localeStrings||{},o=this.obj.availableTypes()||[],r=this.obj.availableStyles()||[],d=this.obj.availableDisplayFormats()||[],c=({field:i,types:t,onChange:a})=>e("ion-item",{lines:"none"},e("ion-label",{"arial-label":l[i],position:"stacked"},l[i]),e("ldf-editable-select",{id:i,path:this.path,property:i,value:this.obj[i],options:t.map((i=>({value:i,label:l[i]||i}))),onLdfChange:i=>a(i.detail)})),h=({name:i})=>{const t=i.includes("/"),a=i.split("/"),n=t?(this.obj[a[0]]||{})[a[1]]:this.obj[i];return e("ion-item",{lines:"none"},e("ion-label",{"aria-label":l[i],position:"stacked"},l[i]),e("ldf-editable-text",{id:i,short:!0,path:`${this.path}/${i}`,text:n,placeholder:l[i]}))};return e(a,null,e("ion-header",null,e("ion-toolbar",null,e("ion-title",null,l.modalTitle),e("ion-buttons",{slot:"primary"},e("ion-button",{onClick:()=>this.modal.dismiss(null)},e("ion-icon",{slot:"icon-only",name:"close"}))))),e("ion-content",null,e("form",{class:{metadata:!0,hidden:this.collapsedState,visible:!this.collapsedState}},e("ldf-editable-metadata-metadata-fields",{path:this.path,doc:this.obj}),e("ion-card",null,e("ion-card-header",null,e("ion-card-title",null,l.title)),e("ion-card",null,e("ion-grid",null,e("ion-row",null,e("ion-col",null,e(h,{name:"label"})),e("ion-col",null,(null==d?void 0:d.length)>0&&e(c,{field:"display_format",types:d}))),e("ion-row",null,e("ion-col",null,e(h,{name:"source/source"})),e("ion-col",null,e(h,{name:"source/citation"})),e("ion-col",null,e(h,{name:"citation"})))))),e("ion-card",null,e("ion-card-header",{class:"advanced",onClick:()=>this.showAdvanced=!this.showAdvanced},e("ion-buttons",null,e("ion-button",null,!this.showAdvanced&&e("ion-icon",{slot:"icon-only",name:"chevron-forward"}),this.showAdvanced&&e("ion-icon",{slot:"icon-only",name:"chevron-down"}))),e("ion-card-title",null,l.advanced)),this.showAdvanced&&e("ion-card-content",null,e("ion-grid",null,e("ion-row",null,e("ion-col",{size:"4"},e(c,{field:"type",types:o,onChange:i=>this.obj=s(new n(Object.assign(Object.assign({},this.obj),{type:i})))})),e("ion-col",null,(null==r?void 0:r.length)>0&&e(c,{field:"style",types:r}))),e("ion-row",null,e("ion-col",null,e(h,{name:"tradition"})),e("ion-col",null,e(h,{name:"language"})),e("ion-col",null,e(h,{name:"version"}))),e("ion-row",null,e("ion-col",null,e(h,{name:"version_label"})),e("ion-col",null,e(h,{name:"slug"}))),e("ion-row",null,e("ion-col",{size:"12"},e("ldf-editable-string-list",{path:this.path,property:"category",value:this.obj.category}))),e("ion-row",null,e("ion-col",{size:"12"},e("ldf-editable-lookup",{path:`${this.path}/lookup`,lookup:null===(i=this.obj)||void 0===i?void 0:i.lookup,types:null===(t=this.obj)||void 0===t?void 0:t.availableLookupTypes()})))))))))}get element(){return l(this)}static get watchers(){return{doc:["docChanged"]}}};c.style=".metadata.sc-ldf-editable-metadata fieldset.sc-ldf-editable-metadata{border:0;display:flex;flex-direction:row}.metadata.sc-ldf-editable-metadata fieldset.sc-ldf-editable-metadata ion-item.sc-ldf-editable-metadata{min-width:100px}.visible.sc-ldf-editable-metadata{opacity:1;transition:0.25s;visibility:visible}.hidden.sc-ldf-editable-metadata{opacity:0;transition:0.25s;visibility:hidden}.metadata.visible.sc-ldf-editable-metadata{height:auto;transition:0.75s;visiblity:visible}.metadata.hidden.sc-ldf-editable-metadata{height:0;opacity:1;transition:0.125s}ion-card-header.advanced.sc-ldf-editable-metadata{display:flex;flex-direction:row}";export{c as ldf_editable_metadata}
1
+ import{r as i,c as t,h as e,H as a,a as l}from"./p-978e2c6d.js";import{L as n}from"./p-4aa9a6f2.js";import{C as o}from"./p-991c0877.js";import{s}from"./p-c3c99023.js";import{g as r}from"./p-0491d1d2.js";import"./p-8f67abb8.js";import"./p-a1729dbd.js";import"./p-2da3f59d.js";import"./p-5b43e6be.js";import"./p-65d26c45.js";const d={en:{abbreviated:"Abbreviated",advanced:"Advanced Settings",antiphon:"Antiphon","authorized-prayers":"Prayers & Thanksgivings","bible-reading":"Bible Reading",canticle:"Canticle",category:"Category",citation:"Biblical Citation",collect:"Collect",condition:"Condition",default:"Default",delete:"Delete",display_format:"Display Format",gloria:"Gloria",halfverse:"By Half-Verse",heading:"Heading",invitatory:"Invitatory",label:"Label",language:"Language",lectionary:"Lectionary",litany:"Litany",liturgy:"Liturgy",long:"Long",markdown:"Rich Text (Markdown)",meditation:"Meditation",modalTitle:"Edit Settings",normal:"Normal",omit:"Omit Text",option:"Option",prayer:"Prayer",preces:"Preces",psalm:"Psalm",refrain:"Refrain",responsive:"Responsive Prayer",rubric:"Rubric",settings:"Settings",short:"Short",slug:"Slug","source/source":"Source","source/citation":"Citation within Source",style:"Style",text:"Text",title:"General Settings",tradition:"Tradition",type:"Type",unison:"Unison",version:"Version",version_label:"Version Label",wholeverse:"By Whole Verse"}},c=class{constructor(e){i(this,e),this.ldfDocShouldChange=t(this,"ldfDocShouldChange",7),this.showAdvanced=!1}docChanged(i){try{this.obj=s("string"==typeof i?JSON.parse(i):i)}catch(i){console.warn(i),this.obj=new n}}componentWillLoad(){this.docChanged(this.doc),this.collapsedState=this.collapsed,this.loadLocaleStrings(),this.initializeMetadata()}async loadLocaleStrings(){try{this.localeStrings=d[r(this.element)]}catch(i){console.warn(i)}}initializeMetadata(){this.obj.metadata||(this.obj.metadata={},this.ldfDocShouldChange.emit(new o({path:`${this.path}/metadata`,op:[{type:"set",value:{}}]}))),this.obj.source||(this.obj.source={api:"",source:"",citation:""},this.ldfDocShouldChange.emit(new o({path:`${this.path}/source`,op:[{type:"set",value:{api:"",source:"",citation:""}}]})))}render(){var i,t;const l=this.localeStrings||{},o=this.obj.availableTypes()||[],r=this.obj.availableStyles()||[],d=this.obj.availableDisplayFormats()||[],c=({field:i,types:t,onChange:a})=>e("ion-item",{lines:"none"},e("ion-label",{"arial-label":l[i],position:"stacked"},l[i]),e("ldf-editable-select",{id:i,path:this.path,property:i,value:this.obj[i],options:t.map((i=>({value:i,label:l[i]||i}))),onLdfChange:i=>a(i.detail)})),h=({name:i})=>{const t=i.includes("/"),a=i.split("/"),n=t?(this.obj[a[0]]||{})[a[1]]:this.obj[i];return e("ion-item",{lines:"none"},e("ion-label",{"aria-label":l[i],position:"stacked"},l[i]),e("ldf-editable-text",{id:i,short:!0,path:`${this.path}/${i}`,text:n,placeholder:l[i]}))};return e(a,null,e("ion-header",null,e("ion-toolbar",null,e("ion-title",null,l.modalTitle),e("ion-buttons",{slot:"primary"},e("ion-button",{onClick:()=>this.modal.dismiss(null)},e("ion-icon",{slot:"icon-only",name:"close"}))))),e("ion-content",null,e("form",{class:{metadata:!0,hidden:this.collapsedState,visible:!this.collapsedState}},e("ldf-editable-metadata-metadata-fields",{path:this.path,doc:this.obj}),e("ion-card",null,e("ion-card-header",null,e("ion-card-title",null,l.title)),e("ion-card",null,e("ion-grid",null,e("ion-row",null,e("ion-col",null,e(h,{name:"label"})),e("ion-col",null,(null==d?void 0:d.length)>0&&e(c,{field:"display_format",types:d}))),e("ion-row",null,e("ion-col",null,e(h,{name:"source/source"})),e("ion-col",null,e(h,{name:"source/citation"})),e("ion-col",null,e(h,{name:"citation"})))))),e("ion-card",null,e("ion-card-header",{class:"advanced",onClick:()=>this.showAdvanced=!this.showAdvanced},e("ion-buttons",null,e("ion-button",null,!this.showAdvanced&&e("ion-icon",{slot:"icon-only",name:"chevron-forward"}),this.showAdvanced&&e("ion-icon",{slot:"icon-only",name:"chevron-down"}))),e("ion-card-title",null,l.advanced)),this.showAdvanced&&e("ion-card-content",null,e("ion-grid",null,e("ion-row",null,e("ion-col",{size:"4"},e(c,{field:"type",types:o,onChange:i=>this.obj=s(new n(Object.assign(Object.assign({},this.obj),{type:i})))})),e("ion-col",null,(null==r?void 0:r.length)>0&&e(c,{field:"style",types:r}))),e("ion-row",null,e("ion-col",null,e(h,{name:"tradition"})),e("ion-col",null,e(h,{name:"language"})),e("ion-col",null,e(h,{name:"version"}))),e("ion-row",null,e("ion-col",null,e(h,{name:"version_label"})),e("ion-col",null,e(h,{name:"slug"}))),e("ion-row",null,e("ion-col",{size:"12"},e("ldf-editable-string-list",{path:this.path,property:"category",value:this.obj.category}))),e("ion-row",null,e("ion-col",{size:"12"},e("ldf-editable-lookup",{path:`${this.path}/lookup`,lookup:null===(i=this.obj)||void 0===i?void 0:i.lookup,types:null===(t=this.obj)||void 0===t?void 0:t.availableLookupTypes()})))))))))}get element(){return l(this)}static get watchers(){return{doc:["docChanged"]}}};c.style=".metadata.sc-ldf-editable-metadata fieldset.sc-ldf-editable-metadata{border:0;display:flex;flex-direction:row}.metadata.sc-ldf-editable-metadata fieldset.sc-ldf-editable-metadata ion-item.sc-ldf-editable-metadata{min-width:100px}.visible.sc-ldf-editable-metadata{opacity:1;transition:0.25s;visibility:visible}.hidden.sc-ldf-editable-metadata{opacity:0;transition:0.25s;visibility:hidden}.metadata.visible.sc-ldf-editable-metadata{height:auto;transition:0.75s;visiblity:visible}.metadata.hidden.sc-ldf-editable-metadata{height:0;opacity:1;transition:0.125s}ion-card-header.advanced.sc-ldf-editable-metadata{display:flex;flex-direction:row}";export{c as ldf_editable_metadata}
@@ -1 +1 @@
1
- import{M as e,P as r,B as s,R as a,a as n,L as t}from"./p-8f67abb8.js";import{H as i}from"./p-a1729dbd.js";import{O as o}from"./p-161be025.js";import{R as u}from"./p-5b43e6be.js";import{T as c}from"./p-65d26c45.js";function p(p){switch(p.type){case"liturgy":return new t(p);case"heading":return new i(p);case"option":return new o(p);case"refrain":return new u(p);case"rubric":return new n(p);case"text":return new c(p);case"responsive":return new a(p);case"bible-reading":return new s(p);case"psalm":return new r(p);case"meditation":return new e(p);default:return p}}export{p as s}
1
+ import{M as e,P as r,B as a,R as s,a as n,L as t}from"./p-8f67abb8.js";import{H as i}from"./p-a1729dbd.js";import{O as o}from"./p-2da3f59d.js";import{R as u}from"./p-5b43e6be.js";import{T as c}from"./p-65d26c45.js";function p(p){switch(p.type){case"liturgy":return new t(p);case"heading":return new i(p);case"option":return new o(p);case"refrain":return new u(p);case"rubric":return new n(p);case"text":return new c(p);case"responsive":return new s(p);case"bible-reading":return new a(p);case"psalm":return new r(p);case"meditation":return new e(p);default:return p}}export{p as s}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@venite/components",
3
- "version": "0.16.9",
3
+ "version": "0.16.10",
4
4
  "description": "Rendering components for the Venite.app Liturgical Document Format (LDF)",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.js",
@@ -41,7 +41,7 @@
41
41
  "license": "MIT",
42
42
  "dependencies": {
43
43
  "@ionic/core": "^5.1.0",
44
- "@venite/ldf": "^0.21.11",
44
+ "@venite/ldf": "^0.21.12",
45
45
  "diff-match-patch": "^1.0.4",
46
46
  "query-selector-shadow-dom": "^0.4.6",
47
47
  "showdown": "^1.9.1",
@@ -1 +0,0 @@
1
- import{L as e}from"./p-4aa9a6f2.js";function i(e){return"string"==typeof e?e:JSON.stringify(e)}const l={ip:"IP",bcp1979:"Rite II",bcp1979_psalm:"1979",eow:"EOW",coverdale:"Coverdale",rite_i:"Rite I"};function s(e){return"psalm"===e.type&&"psalm"===e.style&&"bcp1979"===e.version?"bcp1979_psalm":e.version}class t extends e{constructor(e={}){super(e)}availableDisplayFormats(){return[]}uniqueVersions(){return(this.value||[]).map((e=>i(e.version))).reduce(((e,i)=>e.includes(i)?e:[...e,i]),[]).length}uniqueLabels(){return(this.value||[]).map((e=>e.label)).reduce(((e,i)=>e.includes(i)?e:[...e,i]),[]).length}uniqueCitations(){return(this.value||[]).map((e=>e.citation?e.citation.toString():"")).filter((e=>!!e)).reduce(((e,i)=>e.includes(i)?e:[...e,i]),[]).length}uniqueCanticleNumbers(){return Array.from(new Set((this.value||[]).map((e=>{var i;return"canticle"===e.style?null===(i=e.metadata)||void 0===i?void 0:i.number:e.slug||Math.random()})))).length}getVersionLabel(e,t=50){var a,r,n;const o=this.uniqueVersions(),u=this.uniqueLabels(),f=this.uniqueCitations(),p=this.uniqueCanticleNumbers();let c="";if("liturgy"==e.type)c=e.label||e.version_label||"Option";else if("psalm"==e.type&&1==o&&e.label&&((null===(a=e.slug)||void 0===a?void 0:a.match(/psalm_119_/))||(null===(r=e.citation)||void 0===r?void 0:r.toString().match(/Ps[^\d]+119/))))c=e.label;else if("psalm"==e.type&&"psalm"==e.style&&(e.citation||(null===(n=e.metadata)||void 0===n?void 0:n.number))&&1==o)c=e.citation?e.citation.toString():`Psalm ${e.metadata.number}`;else if("bible-reading"==e.type&&f>1&&e.citation&&e.value&&e.value.length>0){const i=e.value.map((e=>e.hasOwnProperty("text")?e.text:e.toString())).join(" "),l="short"==e.style?` (“${i}”)`:"";c=o>1?`${e.citation.toString()} (${e.version})${l}`:`${e.citation.toString()}${l}`}else if("bible-reading"==e.type&&1==f)c=i(e.version);else if("bible-reading"==e.type&&e.citation&&1==o)c=e.citation.toString();else if("bible-reading"==e.type&&e.citation&&o>1)c=`${e.citation.toString()} (${i(e.version)})`;else if(1==o&&"psalm"==e.type&&"canticle"==e.style&&e.metadata&&e.metadata.localname)c=e.metadata.localname;else if(o>1&&1===p)c=l[i(s(e))];else if(o>1&&e.metadata&&e.metadata.hasOwnProperty("localname")&&e.version)c=`${e.metadata.localname} (${l[i(s(e))]})`;else if(e.version_label&&"bcp1979"!==e.version_label)c=e.version_label;else if(e.label&&u>1&&1==o)c=e.label;else if(e.label&&u>1&&o>1)c=`${e.label} (${l[i(s(e))]})`;else if(!e.metadata||!e.metadata.hasOwnProperty("localname")||e.version_label&&"bcp1979"!=e.version_label)if(o>1&&e.version)c=l[i(s(e))];else if(e.citation)c=e.citation.toString();else{if(!e.value)throw`Unable to generate a label from ${JSON.stringify(e)}`;c=`“${JSON.stringify(e.value).replace(/[\[\]\{\}\"\'\:]/g," ").replace(/\\n/g," ").trim()}”`}else c=e.metadata.localname;return c.length>t?c.substring(0,t)+"...":c}}export{t as O,i as v}