directus-extension-texttoanything 1.1.2 → 1.1.3
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/api.js +21330 -2
- package/dist/app.js +1235 -1
- package/package.json +1 -6
package/dist/app.js
CHANGED
|
@@ -1 +1,1235 @@
|
|
|
1
|
-
import{defineOperationApp as e,useApi as t,useStores as a,defineModule as n,defineInterface as l}from"@directus/extensions-sdk";import{resolveComponent as o,openBlock as i,createBlock as r,withCtx as s,createVNode as d,createCommentVNode as c,defineComponent as u,ref as p,computed as m,onMounted as g,watch as f,createTextVNode as v,unref as h,createElementBlock as T,createElementVNode as x,toDisplayString as b,resolveDynamicComponent as w,normalizeStyle as _,Fragment as A,pushScopeId as y,popScopeId as S,inject as k}from"vue";var V=e({id:"ttabarcode",name:"TTA generate barcode",icon:"box",description:"Generate a barcode trough Text to anything!",overview:({barcodeContent:e})=>[{label:"barcode content",text:e}],options:[{field:"barcodeContent",name:"content",type:"string",meta:{width:"full",interface:"input"}},{field:"barcodeType",name:"type",type:"dropdown",meta:{interface:"select-dropdown",options:{choices:["auspost","azteccode","azteccodecompact","aztecrune","bc412","channelcode","codablockf","code11","code128","code16k","code2of5","code32","code39","code39ext","code49","code93","code93ext","codeone","coop2of5","daft","databarexpanded","databarexpandedcomposite","databarexpandedstacked","databarexpandedstackedcomposite","databarlimited","databarlimitedcomposite","databaromni","databaromnicomposite","databarstacked","databarstackedcomposite","databarstackedomni","databarstackedomnicomposite","databartruncated","databartruncatedcomposite","datalogic2of5","datamatrix","datamatrixrectangular","datamatrixrectangularextension","dotcode","ean13","ean13composite","ean14","ean2","ean5","ean8","ean8composite","flattermarken","gs1-128","gs1-128composite","gs1-cc","gs1datamatrix","gs1datamatrixrectangular","gs1dldatamatrix","gs1dlqrcode","gs1dotcode","gs1northamericancoupon","gs1qrcode","hanxin","hibcazteccode","hibccodablockf","hibccode128","hibccode39","hibcdatamatrix","hibcdatamatrixrectangular","hibcmicropdf417","hibcpdf417","hibcqrcode","iata2of5","identcode","industrial2of5","interleaved2of5","isbn","ismn","issn","itf14","japanpost","kix","leitcode","mailmark","mands","matrix2of5","maxicode","micropdf417","microqrcode","msi","onecode","pdf417","pdf417compact","pharmacode","pharmacode2","planet","plessey","posicode","postnet","pzn","qrcode","rationalizedCodabar","raw","rectangularmicroqrcode","royalmail","sscc18","swissqrcode","symbol","telepen","telepennumeric","ultracode","upca","upcacomposite","upce","upcecomposite"].map((e=>({text:e,value:e})))}}},{field:"scale",name:"scale",type:"number",meta:{width:"full",interface:"input"}},{field:"height",name:"height",type:"number",meta:{width:"full",interface:"input"}},{field:"includetext",name:"include text",type:"boolean",meta:{width:"full",interface:"boolean"}}]}),$=e({id:"ttapdf",name:"TTA generate PDF",icon:"box",description:"Generate a PDF trough Text to anything!",overview:({filename:e})=>[{label:"File name",text:e}],options:[{field:"filename",name:"File name",type:"string",meta:{width:"full",interface:"input"}},{field:"pdfoptions",name:"Options",type:"json",meta:{width:"full",interface:"input-code",options:{language:"json",placeholder:JSON.stringify({html:"<h1>Hello world!</h1>",format:"A4",landscape:!1,margin:10,marginRight:5,marginLeft:5},null,2),template:JSON.stringify({html:"<h1>Hello world!</h1>",format:"A4",landscape:!1,margin:10,marginRight:5,marginLeft:5},null,2)}}}]}),C=e({id:"ttapdftemplate",name:"TTA generate PDF from template",icon:"box",description:"Generate a PDF based on a template trough Text to anything!",overview:({filename:e})=>[{label:"File name",text:e}],options:[{field:"filename",name:"File name",type:"string",meta:{width:"full",interface:"input"}},{field:"template",name:"Template",type:"string",meta:{interface:"TTA-pdf-template-selector",options:{}}},{field:"templatevariables",name:"Template variables",type:"json",meta:{width:"full",interface:"input-code",options:{language:"json"}}}]}),F=e({id:"ttaqrcode",name:"TTA generate QRcode",icon:"box",description:"Generate a QRcode trough Text to anything!",overview:({content:e})=>[{label:"QRCode content",text:e}],options:[{field:"content",name:"QRCode content",type:"string",meta:{width:"full",interface:"input"}},{field:"lightColor",name:"Light color",type:"string",meta:{width:"full",interface:"input"}},{field:"darkColor",name:"Dark color",type:"string",meta:{width:"full",interface:"input"}},{field:"margin",name:"Margin",type:"integer",meta:{width:"half",interface:"input"}},{field:"width",name:"Width",type:"integer",meta:{width:"half",interface:"input"}}]});const P=String.raw`[A-Za-z][^/\s>]*`,q=String.raw`(?<!\w)"(?:\\[^<>\n]|[^\\"<>\n])*"(?!\w)`,U=String.raw`(?<!\w)'(?:\\[^<>\n]|[^\\'<>\n])*'(?!\w)`,D=String.raw`${q}|${U}`,I=String.raw`"(?<quotedAttrValue>[^"]*)"`,j=String.raw`'(?<singleQuotedAttrValue>[^']*)'`,R=String.raw`(?<unquotedAttrValue>[^\s"'\`=<>]+)`,E=String.raw`[^=\s>/"']+(?=[=>\s]|$)`,L=String.raw`${I}|${j}|${R}`,N=String.raw`(?<attrName>${E})(?:\s*=\s*(?:${L}))?`,z=String.raw`${D}|[^\s>]*[^\s>/]|[^\s>]*/(?!\s*>)`,O=String.raw`(?<attrSpace>\s*)(?:${N}|(?<attrText>${z}))`,Q={comment:String.raw`<!--.*?-->`,dtd:String.raw`<![^>]+>`,startTag:String.raw`<(?<startTagName>${P})(?<attrs>(?:${O})*)\s*(?<closingSlash>/?)\s*>`,endTag:String.raw`</(?<endTagName>${P})\s*>`,space:String.raw`\s+`,text:String.raw`[^<\s"']+|${D}|['"]`,wildcard:String.raw`.`},G=Object.entries(Q).map((([e,t])=>`(?<${e}>${t})`)).join("|");const B=new Set(["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"]);function H(e,t=" ",a=80){const n=new RegExp(G,"gys"),l=new RegExp(O,"gy"),o=[];let i=null,r=0,s=0,d="",c=0,u="";const p=()=>{if(u&&"\n"!=u){const e=d.indexOf("\n"),t=-1==e?d.length:e;s+u.length+t>a&&(u="\n")}const e="\n"==u&&d?t.repeat(c):"",n=`${u}${e}${d}`;if(n){const e=n.lastIndexOf("\n");-1==e?s+=n.length:s=n.length-e-1,o.push(n)}d=u=""},m=(...e)=>{for(const t of e)!i&&/^\s+$/.test(t)?(p(),u=t):(d||(c=r),d+=t)};for(const t of function*(e,t){let a,{lastIndex:n}=e;for(;a=e.exec(t);)yield a,({lastIndex:n}=e);if(n!=t.length)throw new Error("Failed to parse string")}(n,e)){if(H.__strict&&t.groups.wildcard)throw new Error("Unexpected wildcard");if(t.groups.endTag){const e=t.groups.endTagName.toLowerCase();e==i&&(i=null),i||(--r,m(`</${e}>`))}if(i)m(t[0]);else if(t.groups.space)m(...t[0].match(/\n/g)?.slice(0,2)??[" "]);else if(t.groups.comment||t.groups.dtd||t.groups.text||t.groups.wildcard)m(t[0]);else if(t.groups.startTag){const e=t.groups.startTagName.toLowerCase();if(m(`<${e}`),++r,t.groups.attrs){let e,a,{lastIndex:n}=l;for(;e=l.exec(t.groups.attrs);){if(({lastIndex:n}=l),H.__strict&&e.groups.attrText)throw new Error("Unexpected attr text");e.groups.attrText?(e.groups.attrSpace&&m(/\n/.test(e.groups.attrSpace)?"\n":" "),m(e.groups.attrText)):(!e.groups.attrSpace&&a?.groups.attrText||m(/\n/.test(e.groups.attrSpace)?"\n":" "),m(`${e.groups.attrName}${e.groups.quotedAttrValue?`="${e.groups.quotedAttrValue}"`:e.groups.singleQuotedAttrValue?`='${e.groups.singleQuotedAttrValue}'`:e.groups.unquotedAttrValue?`=${e.groups.unquotedAttrValue}`:""}`)),a=e}if(n!=t.groups.attrs.length)throw new Error("Failed to parse attributes")}const a=Boolean(t.groups.closingSlash);m(a?" />":">"),a||B.has(e)?--r:["pre","textarea","script","style"].includes(e)&&(i=e)}}p();let g=!1;for(;/^\s+$/.test(o[o.length-1]);){const e=o.pop();/\n/.test(e)&&(g=!0)}return g&&o.push("\n"),o.join("")}H.default=H;var M=H;const J={render:function(e,t){const a=o("v-icon"),n=o("v-list-item-icon"),l=o("v-text-overflow"),u=o("v-list-item-content"),p=o("v-list-item"),m=o("v-list");return i(),r(m,{nav:""},{default:s((()=>[d(p,{to:"/tta_settings/templates"},{default:s((()=>[d(n,null,{default:s((()=>[d(a,{name:"code"})])),_:1}),d(u,null,{default:s((()=>[d(l,{text:"Templates"})])),_:1})])),_:1}),d(p,{to:"/tta_settings/settings"},{default:s((()=>[d(n,null,{default:s((()=>[d(a,{name:"settings"})])),_:1}),d(u,null,{default:s((()=>[d(l,{text:"Settings"})])),_:1})])),_:1}),c(' <v-list-item to="/tta_settings/usage">\n <v-list-item-icon><v-icon name="bar_chart" /></v-list-item-icon>\n <v-list-item-content>\n <v-text-overflow text="Usage" />\n </v-list-item-content>\n </v-list-item> ')])),_:1})},__file:"settingsmodule/src/TTAnav.vue"},K={key:0,class:"TTA-popup"},Y={class:"TTA-toolbar"},W={class:"right-side"},Z={class:"setwidth"},X={class:"TTA-action"},ee={class:"TTA-wapper"},te=["src"];var ae=u({__name:"templates",setup(e){const n=p([]),l=p(!1),u=p(!1),A=p(50),y=m((()=>100-A.value)),S=m((()=>100-y.value)),k=t(),V=p({template:"",id:-1,name:"",description:"",collection:"",format:"A4",orientation:"portrait"}),{useCollectionsStore:$}=a(),C=$(),F=m((()=>C.collections.filter((e=>"TTA_htmltemplates"!=e.collection)).map((e=>({text:e.name,value:e.collection}))))),P=m((()=>{const e=new Blob([V.value.template],{type:"text/html"});return URL.createObjectURL(e)}));async function q(){const e=await k.get("/items/TTA_htmltemplates",{params:{limit:-1}});n.value=e.data.data}async function U(){console.log(V.value),-1==V.value.id?await k.post("/items/TTA_htmltemplates",{...V.value,id:void 0}):await k.patch("/items/TTA_htmltemplates/"+V.value.id,{...V.value,id:void 0}),l.value=!1,q()}function D({item:e}){console.log(e),V.value=e,u.value=!0}function I(){V.value={template:"",id:-1,name:"",description:"",collection:"",format:"A4",orientation:"portrait"},u.value=!1}function j(){V.value.template=M(V.value.template)}return g((async()=>{A.value=parseInt(localStorage.getItem("TTA-widthPartition")||"50"),q()})),f((()=>A.value),(e=>localStorage.setItem("TTA-widthPartition",e+""))),(e,t)=>{const a=o("v-icon"),p=o("v-button"),m=o("v-card-title"),g=o("v-input"),f=o("v-list-item-content"),k=o("v-list-item"),$=o("v-select"),C=o("v-list"),q=o("v-card-text"),R=o("v-card-actions"),E=o("v-card"),L=o("v-dialog"),N=o("v-slider"),z=o("v-table"),O=o("private-view");return i(),r(O,{title:"Templates"},{navigation:s((()=>[d(J)])),actions:s((()=>[d(p,{rounded:"",icon:"",onClick:t[0]||(t[0]=e=>l.value=!0)},{default:s((()=>[d(a,{name:"add"})])),_:1}),d(L,{modelValue:l.value,"onUpdate:modelValue":t[7]||(t[7]=e=>l.value=e),persistent:!0},{default:s((()=>[d(E,null,{default:s((()=>[d(m,null,{default:s((()=>[v("Create a new HTML template")])),_:1}),d(q,null,{default:s((()=>[d(C,null,{default:s((()=>[d(k,null,{default:s((()=>[d(f,null,{default:s((()=>[d(g,{modelValue:V.value.name,"onUpdate:modelValue":t[1]||(t[1]=e=>V.value.name=e),placeholder:"Template name"},null,8,["modelValue"])])),_:1})])),_:1}),d(k,null,{default:s((()=>[d(f,null,{default:s((()=>[d(g,{modelValue:V.value.description,"onUpdate:modelValue":t[2]||(t[2]=e=>V.value.description=e),placeholder:"Description"},null,8,["modelValue"])])),_:1})])),_:1}),d(k,null,{default:s((()=>[d(f,null,{default:s((()=>[d($,{modelValue:V.value.format,"onUpdate:modelValue":t[3]||(t[3]=e=>V.value.format=e),placeholder:"Size",items:["A1","A2","A3","A4","A5","A6","Letter","Legal","Tabloid","Ledger"].map((e=>({text:e,value:e})))},null,8,["modelValue","items"])])),_:1})])),_:1}),d(k,null,{default:s((()=>[d(f,null,{default:s((()=>[d($,{modelValue:V.value.orientation,"onUpdate:modelValue":t[4]||(t[4]=e=>V.value.orientation=e),placeholder:"Orientation",items:["portrait","landscape"].map((e=>({text:e,value:e})))},null,8,["modelValue","items"])])),_:1})])),_:1}),d(k,null,{default:s((()=>[d(f,null,{default:s((()=>[d($,{modelValue:V.value.collection,"onUpdate:modelValue":t[5]||(t[5]=e=>V.value.collection=e),items:h(F),placeholder:"Collection"},null,8,["modelValue","items"])])),_:1})])),_:1})])),_:1})])),_:1}),d(R,null,{default:s((()=>[d(p,{secondary:"",onClick:t[6]||(t[6]=e=>l.value=!1)},{default:s((()=>[v(" Cancel ")])),_:1}),d(p,{disabled:!V.value.collection||!V.value.name||!V.value.format,onClick:U},{default:s((()=>[v(" Save ")])),_:1},8,["disabled"])])),_:1})])),_:1})])),_:1},8,["modelValue"])])),default:s((()=>[u.value?(i(),T("div",K,[x("div",Y,[x("div",{onClick:t[8]||(t[8]=e=>l.value=!0),class:"TTA-template-title"},[v(b(V.value.name)+" ",1),d(a,{name:"edit"})]),x("div",W,[x("div",{class:"TTA-action",onClick:j},[d(a,{name:"vertical_align_center"})]),x("div",{class:"TTA-action",onClick:U},[d(a,{name:"save"})]),x("div",Z,[d(N,{modelValue:A.value,"onUpdate:modelValue":t[9]||(t[9]=e=>A.value=e),min:10,max:90,class:"TTA-slider"},null,8,["modelValue"])]),x("div",X,[d(a,{name:"close",onClick:I})])])]),x("div",ee,[(i(),r(w("interface-input-code"),{class:"TTA-editor",value:V.value.template,language:"htmlmixed",onInput:t[10]||(t[10]=e=>V.value.template=e),style:_("width: "+h(S)+"%")},null,40,["value","style"])),x("iframe",{class:"TTA-preview",src:h(P),style:_("width: "+h(y)+"%")},null,12,te)])])):c("v-if",!0),d(z,{headers:[{text:"Name",value:"name"},{text:"Description",value:"description"},{text:"Collection",value:"collection"},{text:"Format",value:"format"}],"onClick:row":D,items:n.value},null,8,["items"])])),_:1})}}}),ne=[],le=[];function oe(e,t){if(e&&"undefined"!=typeof document){var a,n=!0===t.prepend?"prepend":"append",l=!0===t.singleTag,o="string"==typeof t.container?document.querySelector(t.container):document.getElementsByTagName("head")[0];if(l){var i=ne.indexOf(o);-1===i&&(i=ne.push(o)-1,le[i]={}),a=le[i]&&le[i][n]?le[i][n]:le[i][n]=r()}else a=r();65279===e.charCodeAt(0)&&(e=e.substring(1)),a.styleSheet?a.styleSheet.cssText+=e:a.appendChild(document.createTextNode(e))}function r(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),t.attributes)for(var a=Object.keys(t.attributes),l=0;l<a.length;l++)e.setAttribute(a[l],t.attributes[a[l]]);var i="prepend"===n?"afterbegin":"beforeend";return o.insertAdjacentElement(i,e),e}}oe("\n.TTA-popup {\n position: fixed;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n z-index: 100;\n display: flex;\n flex-direction: column;\n background-color: var(--background-subdued);\n}\n.TTA-toolbar {\n background-color: var(--background-subdued);\n display: flex;\n justify-content: space-between;\n}\n.TTA-toolbar .right-side {\n display: flex;\n gap: 5px;\n}\n.TTA-toolbar .TTA-slider {\n padding-top: 5px;\n}\n.TTA-toolbar .TTA-action {\n padding: 5px;\n cursor: pointer;\n}\n.TTA-toolbar .setwidth {\n display: flex;\n gap: 10px;\n padding-top: 6px;\n}\n.TTA-toolbar .TTA-template-title {\n margin: auto 0;\n font-size: 18px;\n cursor: pointer;\n padding-right: 5px;\n padding-left: 20px;\n border-bottom: 1px solid var(--v-list-item-border-color);\n}\n.TTA-toolbar .TTA-template-title i {\n padding-left: 5px;\n}\n.TTA-wapper {\n display: flex;\n flex-grow: 1;\n overflow: hidden;\n}\n.TTA-preview {\n flex-grow: 1;\n background-color: white;\n border: 0;\n}\n.TTA-editor {\n flex-grow: 1;\n height: 100%;\n}\n.TTA-editor > div {\n height: 100% !important;\n border-radius: 0 !important;\n}\n.TTA-editor .CodeMirror {\n height: 100%;\n}\n",{}),ae.__file="settingsmodule/src/templates.vue";const ie=e=>(y("data-v-014dce90"),e=e(),S(),e),re={class:"px-5"},se=ie((()=>x("span",{class:"field-name"},"RapidAPI token",-1)));var de=u({__name:"settings",setup(e){const a=p(""),n=p(!1),l=t(),c=p([]);async function u(){n.value=!0,await l.patch("/settings",{TTA_KEY:a.value}),setTimeout((()=>{n.value=!1}),500)}return g((async()=>{const e=await l.get("/settings");a.value=e.data.data.TTA_KEY;const t=await l.get("/folders");c.value=t.data.data.map((e=>({text:e.name,value:e.id})))})),(e,t)=>{const l=o("v-card-title"),c=o("v-input"),p=o("v-card-text"),m=o("v-icon"),g=o("v-button"),f=o("v-progress-circular"),h=o("v-card-actions"),b=o("v-card"),w=o("private-view");return i(),r(w,{title:"Settings"},{navigation:s((()=>[d(J)])),default:s((()=>[x("div",re,[d(b,{class:"w-full"},{default:s((()=>[d(l,null,{default:s((()=>[v("API settings")])),_:1}),d(p,{class:"fields-spacing"},{default:s((()=>[x("div",null,[se,d(c,{modelValue:a.value,"onUpdate:modelValue":t[0]||(t[0]=e=>a.value=e)},null,8,["modelValue"])])])),_:1}),d(h,null,{default:s((()=>[d(g,{href:"https://rapidapi.com/Attacler/api/text-to-anything",target:"_blank"},{default:s((()=>[d(m,{name:"open_in_new"}),v(" Get RapidAPI token ")])),_:1}),d(g,{onClick:u,disabled:n.value},{default:s((()=>[n.value?(i(),r(f,{key:1,small:!0,indeterminate:""})):(i(),T(A,{key:0},[v(" Save ")],64))])),_:1},8,["disabled"])])),_:1})])),_:1})])])),_:1})}}});oe("\n.w-full[data-v-014dce90] {\n width: 100%;\n}\n.px-5[data-v-014dce90] {\n padding: 0 2.5rem;\n}\n.fields-spacing[data-v-014dce90] {\n display: flex;\n flex-direction: column;\n gap: 10px;\n}\n",{}),de.__scopeId="data-v-014dce90",de.__file="settingsmodule/src/settings.vue";var ce=u({__name:"usage",setup:e=>(e,t)=>{const a=o("private-view");return i(),r(a,{title:"Usage"},{navigation:s((()=>[d(J)])),default:s((()=>[v(" Comming soon! ")])),_:1})}});ce.__file="settingsmodule/src/usage.vue";var ue=n({id:"tta_settings",name:"Text to anything settings",icon:"text_fields",routes:[{path:"",redirect:"/tta_settings/templates"},{path:"templates",component:ae},{path:"settings",component:de},{path:"usage",component:ce}]}),pe=u({__name:"interface",props:["value"],emits:["input"],setup(e,{emit:t}){const a=e,n=k("api"),l=p(""),s=p([]);return g((async()=>{l.value=a.value,f((()=>l.value),((e,a)=>{e!=a&&t("input",e)}));const e=await n.get("/items/TTA_htmltemplates");s.value=e.data.data.map((e=>({text:e.name,value:e.id})))})),(e,t)=>{const a=o("v-select");return i(),r(a,{modelValue:l.value,"onUpdate:modelValue":t[0]||(t[0]=e=>l.value=e),items:s.value},null,8,["modelValue","items"])}}});pe.__file="PDFTemplateSelector/src/interface.vue";var me=l({id:"TTA-pdf-template-selector",name:"PDF template selector",icon:"box",description:"Selector for a PDF template for Text To Anything",component:pe,options:null,types:["string"]}),ge=u({__name:"interface",props:["value"],emits:["input"],setup(e,{emit:t}){const a=e,n=k("api"),l=p(""),o=p([]);return g((async()=>{l.value=a.value,f((()=>l.value),((e,a)=>{e!=a&&t("input",e)}));const e=await n.get("/items/TTA_htmltemplates");o.value=e.data.data.map((e=>({text:e.name,value:e.id})))})),(e,t)=>(i(),r(w("interface-select-dropdown-m2o"),{template:"{{ name }}",enableCreate:!1,enableSelect:!0}))}});ge.__file="PreviewPDF/src/interface.vue";const fe=[me,l({id:"TTA-pdf-template-selector",name:"PDF template selector",icon:"box",description:"Selector for a PDF template for Text To Anything",component:ge,options:null,types:["string"]})],ve=[],he=[],Te=[ue],xe=[],be=[V,$,C,F];export{ve as displays,fe as interfaces,he as layouts,Te as modules,be as operations,xe as panels};
|
|
1
|
+
import { defineOperationApp, useApi, useStores, defineModule, defineInterface } from '@directus/extensions-sdk';
|
|
2
|
+
import { resolveComponent, openBlock, createBlock, withCtx, createVNode, createCommentVNode, defineComponent, ref, computed, onMounted, watch, createTextVNode, unref, createElementBlock, createElementVNode, toDisplayString, normalizeStyle, resolveDynamicComponent, Fragment, pushScopeId, popScopeId, inject } from 'vue';
|
|
3
|
+
|
|
4
|
+
const types = [
|
|
5
|
+
"auspost",
|
|
6
|
+
"azteccode",
|
|
7
|
+
"azteccodecompact",
|
|
8
|
+
"aztecrune",
|
|
9
|
+
"bc412",
|
|
10
|
+
"channelcode",
|
|
11
|
+
"codablockf",
|
|
12
|
+
"code11",
|
|
13
|
+
"code128",
|
|
14
|
+
"code16k",
|
|
15
|
+
"code2of5",
|
|
16
|
+
"code32",
|
|
17
|
+
"code39",
|
|
18
|
+
"code39ext",
|
|
19
|
+
"code49",
|
|
20
|
+
"code93",
|
|
21
|
+
"code93ext",
|
|
22
|
+
"codeone",
|
|
23
|
+
"coop2of5",
|
|
24
|
+
"daft",
|
|
25
|
+
"databarexpanded",
|
|
26
|
+
"databarexpandedcomposite",
|
|
27
|
+
"databarexpandedstacked",
|
|
28
|
+
"databarexpandedstackedcomposite",
|
|
29
|
+
"databarlimited",
|
|
30
|
+
"databarlimitedcomposite",
|
|
31
|
+
"databaromni",
|
|
32
|
+
"databaromnicomposite",
|
|
33
|
+
"databarstacked",
|
|
34
|
+
"databarstackedcomposite",
|
|
35
|
+
"databarstackedomni",
|
|
36
|
+
"databarstackedomnicomposite",
|
|
37
|
+
"databartruncated",
|
|
38
|
+
"databartruncatedcomposite",
|
|
39
|
+
"datalogic2of5",
|
|
40
|
+
"datamatrix",
|
|
41
|
+
"datamatrixrectangular",
|
|
42
|
+
"datamatrixrectangularextension",
|
|
43
|
+
"dotcode",
|
|
44
|
+
"ean13",
|
|
45
|
+
"ean13composite",
|
|
46
|
+
"ean14",
|
|
47
|
+
"ean2",
|
|
48
|
+
"ean5",
|
|
49
|
+
"ean8",
|
|
50
|
+
"ean8composite",
|
|
51
|
+
"flattermarken",
|
|
52
|
+
"gs1-128",
|
|
53
|
+
"gs1-128composite",
|
|
54
|
+
"gs1-cc",
|
|
55
|
+
"gs1datamatrix",
|
|
56
|
+
"gs1datamatrixrectangular",
|
|
57
|
+
"gs1dldatamatrix",
|
|
58
|
+
"gs1dlqrcode",
|
|
59
|
+
"gs1dotcode",
|
|
60
|
+
"gs1northamericancoupon",
|
|
61
|
+
"gs1qrcode",
|
|
62
|
+
"hanxin",
|
|
63
|
+
"hibcazteccode",
|
|
64
|
+
"hibccodablockf",
|
|
65
|
+
"hibccode128",
|
|
66
|
+
"hibccode39",
|
|
67
|
+
"hibcdatamatrix",
|
|
68
|
+
"hibcdatamatrixrectangular",
|
|
69
|
+
"hibcmicropdf417",
|
|
70
|
+
"hibcpdf417",
|
|
71
|
+
"hibcqrcode",
|
|
72
|
+
"iata2of5",
|
|
73
|
+
"identcode",
|
|
74
|
+
"industrial2of5",
|
|
75
|
+
"interleaved2of5",
|
|
76
|
+
"isbn",
|
|
77
|
+
"ismn",
|
|
78
|
+
"issn",
|
|
79
|
+
"itf14",
|
|
80
|
+
"japanpost",
|
|
81
|
+
"kix",
|
|
82
|
+
"leitcode",
|
|
83
|
+
"mailmark",
|
|
84
|
+
"mands",
|
|
85
|
+
"matrix2of5",
|
|
86
|
+
"maxicode",
|
|
87
|
+
"micropdf417",
|
|
88
|
+
"microqrcode",
|
|
89
|
+
"msi",
|
|
90
|
+
"onecode",
|
|
91
|
+
"pdf417",
|
|
92
|
+
"pdf417compact",
|
|
93
|
+
"pharmacode",
|
|
94
|
+
"pharmacode2",
|
|
95
|
+
"planet",
|
|
96
|
+
"plessey",
|
|
97
|
+
"posicode",
|
|
98
|
+
"postnet",
|
|
99
|
+
"pzn",
|
|
100
|
+
"qrcode",
|
|
101
|
+
"rationalizedCodabar",
|
|
102
|
+
"raw",
|
|
103
|
+
"rectangularmicroqrcode",
|
|
104
|
+
"royalmail",
|
|
105
|
+
"sscc18",
|
|
106
|
+
"swissqrcode",
|
|
107
|
+
"symbol",
|
|
108
|
+
"telepen",
|
|
109
|
+
"telepennumeric",
|
|
110
|
+
"ultracode",
|
|
111
|
+
"upca",
|
|
112
|
+
"upcacomposite",
|
|
113
|
+
"upce",
|
|
114
|
+
"upcecomposite"
|
|
115
|
+
];
|
|
116
|
+
var e0 = defineOperationApp({
|
|
117
|
+
id: "ttabarcode",
|
|
118
|
+
name: "TTA generate barcode",
|
|
119
|
+
icon: "box",
|
|
120
|
+
description: "Generate a barcode trough Text to anything!",
|
|
121
|
+
overview: ({ barcodeContent }) => [
|
|
122
|
+
{
|
|
123
|
+
label: "barcode content",
|
|
124
|
+
text: barcodeContent
|
|
125
|
+
}
|
|
126
|
+
],
|
|
127
|
+
options: [
|
|
128
|
+
{
|
|
129
|
+
field: "barcodeContent",
|
|
130
|
+
name: "content",
|
|
131
|
+
type: "string",
|
|
132
|
+
meta: {
|
|
133
|
+
width: "full",
|
|
134
|
+
interface: "input"
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
field: "barcodeType",
|
|
139
|
+
name: "type",
|
|
140
|
+
type: "dropdown",
|
|
141
|
+
meta: {
|
|
142
|
+
interface: "select-dropdown",
|
|
143
|
+
options: {
|
|
144
|
+
choices: types.map((e) => ({ text: e, value: e }))
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
field: "scale",
|
|
150
|
+
name: "scale",
|
|
151
|
+
type: "number",
|
|
152
|
+
meta: {
|
|
153
|
+
width: "full",
|
|
154
|
+
interface: "input"
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
field: "height",
|
|
159
|
+
name: "height",
|
|
160
|
+
type: "number",
|
|
161
|
+
meta: {
|
|
162
|
+
width: "full",
|
|
163
|
+
interface: "input"
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
field: "includetext",
|
|
168
|
+
name: "include text",
|
|
169
|
+
type: "boolean",
|
|
170
|
+
meta: {
|
|
171
|
+
width: "full",
|
|
172
|
+
interface: "boolean"
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
]
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
var e1 = defineOperationApp({
|
|
179
|
+
id: "ttapdf",
|
|
180
|
+
name: "TTA generate PDF",
|
|
181
|
+
icon: "box",
|
|
182
|
+
description: "Generate a PDF trough Text to anything!",
|
|
183
|
+
overview: ({ filename }) => [
|
|
184
|
+
{
|
|
185
|
+
label: "File name",
|
|
186
|
+
text: filename
|
|
187
|
+
}
|
|
188
|
+
],
|
|
189
|
+
options: [
|
|
190
|
+
{
|
|
191
|
+
field: "filename",
|
|
192
|
+
name: "File name",
|
|
193
|
+
type: "string",
|
|
194
|
+
meta: {
|
|
195
|
+
width: "full",
|
|
196
|
+
interface: "input"
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
field: "pdfoptions",
|
|
201
|
+
name: "Options",
|
|
202
|
+
type: "json",
|
|
203
|
+
meta: {
|
|
204
|
+
width: "full",
|
|
205
|
+
interface: "input-code",
|
|
206
|
+
options: {
|
|
207
|
+
language: "json",
|
|
208
|
+
placeholder: JSON.stringify(
|
|
209
|
+
{
|
|
210
|
+
html: "<h1>Hello world!</h1>",
|
|
211
|
+
format: "A4",
|
|
212
|
+
landscape: false,
|
|
213
|
+
margin: 10,
|
|
214
|
+
marginRight: 5,
|
|
215
|
+
marginLeft: 5
|
|
216
|
+
},
|
|
217
|
+
null,
|
|
218
|
+
2
|
|
219
|
+
),
|
|
220
|
+
template: JSON.stringify(
|
|
221
|
+
{
|
|
222
|
+
html: "<h1>Hello world!</h1>",
|
|
223
|
+
format: "A4",
|
|
224
|
+
landscape: false,
|
|
225
|
+
margin: 10,
|
|
226
|
+
marginRight: 5,
|
|
227
|
+
marginLeft: 5
|
|
228
|
+
},
|
|
229
|
+
null,
|
|
230
|
+
2
|
|
231
|
+
)
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
]
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
var e2 = defineOperationApp({
|
|
239
|
+
id: "ttapdftemplate",
|
|
240
|
+
name: "TTA generate PDF from template",
|
|
241
|
+
icon: "box",
|
|
242
|
+
description: "Generate a PDF based on a template trough Text to anything!",
|
|
243
|
+
overview: ({ filename }) => [
|
|
244
|
+
{
|
|
245
|
+
label: "File name",
|
|
246
|
+
text: filename
|
|
247
|
+
}
|
|
248
|
+
],
|
|
249
|
+
options: [
|
|
250
|
+
{
|
|
251
|
+
field: "filename",
|
|
252
|
+
name: "File name",
|
|
253
|
+
type: "string",
|
|
254
|
+
meta: {
|
|
255
|
+
width: "full",
|
|
256
|
+
interface: "input"
|
|
257
|
+
}
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
field: "template",
|
|
261
|
+
name: "Template",
|
|
262
|
+
type: "string",
|
|
263
|
+
meta: {
|
|
264
|
+
interface: "TTA-pdf-template-selector",
|
|
265
|
+
options: {}
|
|
266
|
+
}
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
field: "templatevariables",
|
|
270
|
+
name: "Template variables",
|
|
271
|
+
type: "json",
|
|
272
|
+
meta: {
|
|
273
|
+
width: "full",
|
|
274
|
+
interface: "input-code",
|
|
275
|
+
options: {
|
|
276
|
+
language: "json"
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
]
|
|
281
|
+
});
|
|
282
|
+
|
|
283
|
+
var e3 = defineOperationApp({
|
|
284
|
+
id: "ttaqrcode",
|
|
285
|
+
name: "TTA generate QRcode",
|
|
286
|
+
icon: "box",
|
|
287
|
+
description: "Generate a QRcode trough Text to anything!",
|
|
288
|
+
overview: ({ content }) => [
|
|
289
|
+
{
|
|
290
|
+
label: "QRCode content",
|
|
291
|
+
text: content
|
|
292
|
+
}
|
|
293
|
+
],
|
|
294
|
+
options: [
|
|
295
|
+
{
|
|
296
|
+
field: "content",
|
|
297
|
+
name: "QRCode content",
|
|
298
|
+
type: "string",
|
|
299
|
+
meta: {
|
|
300
|
+
width: "full",
|
|
301
|
+
interface: "input"
|
|
302
|
+
}
|
|
303
|
+
},
|
|
304
|
+
{
|
|
305
|
+
field: "lightColor",
|
|
306
|
+
name: "Light color",
|
|
307
|
+
type: "string",
|
|
308
|
+
meta: {
|
|
309
|
+
width: "full",
|
|
310
|
+
interface: "input"
|
|
311
|
+
}
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
field: "darkColor",
|
|
315
|
+
name: "Dark color",
|
|
316
|
+
type: "string",
|
|
317
|
+
meta: {
|
|
318
|
+
width: "full",
|
|
319
|
+
interface: "input"
|
|
320
|
+
}
|
|
321
|
+
},
|
|
322
|
+
{
|
|
323
|
+
field: "margin",
|
|
324
|
+
name: "Margin",
|
|
325
|
+
type: "integer",
|
|
326
|
+
meta: {
|
|
327
|
+
width: "half",
|
|
328
|
+
interface: "input"
|
|
329
|
+
}
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
field: "width",
|
|
333
|
+
name: "Width",
|
|
334
|
+
type: "integer",
|
|
335
|
+
meta: {
|
|
336
|
+
width: "half",
|
|
337
|
+
interface: "input"
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
]
|
|
341
|
+
});
|
|
342
|
+
|
|
343
|
+
const tagName = String.raw`[A-Za-z][^/\s>]*`;
|
|
344
|
+
|
|
345
|
+
// Preserve strings in templates and such
|
|
346
|
+
// Avoid apostrophes and unintentional captures
|
|
347
|
+
const doubleQuotedString = String.raw`(?<!\w)"(?:\\[^<>\n]|[^\\"<>\n])*"(?!\w)`;
|
|
348
|
+
const singleQuotedString = String.raw`(?<!\w)'(?:\\[^<>\n]|[^\\'<>\n])*'(?!\w)`;
|
|
349
|
+
const quotedString = String.raw`${doubleQuotedString}|${singleQuotedString}`;
|
|
350
|
+
|
|
351
|
+
const quotedAttrValue = String.raw`"(?<quotedAttrValue>[^"]*)"`;
|
|
352
|
+
const singleQuotedAttrValue = String.raw`'(?<singleQuotedAttrValue>[^']*)'`;
|
|
353
|
+
// https://mothereff.in/unquoted-attributes
|
|
354
|
+
const unquotedAttrValue = String.raw`(?<unquotedAttrValue>[^\s"'\`=<>]+)`;
|
|
355
|
+
|
|
356
|
+
const attrName = String.raw`[^=\s>/"']+(?=[=>\s]|$)`;
|
|
357
|
+
const attrValue = String.raw`${quotedAttrValue}|${singleQuotedAttrValue}|${unquotedAttrValue}`;
|
|
358
|
+
const attrNameValue = String.raw`(?<attrName>${attrName})(?:\s*=\s*(?:${attrValue}))?`;
|
|
359
|
+
|
|
360
|
+
// Make sure not to swallow the closing slash if one exists
|
|
361
|
+
const attrText = String.raw`${quotedString}|[^\s>]*[^\s>/]|[^\s>]*/(?!\s*>)`;
|
|
362
|
+
|
|
363
|
+
const attr = String.raw`(?<attrSpace>\s*)(?:${attrNameValue}|(?<attrText>${attrText}))`;
|
|
364
|
+
|
|
365
|
+
const tokens = {
|
|
366
|
+
comment: String.raw`<!--.*?-->`,
|
|
367
|
+
dtd: String.raw`<![^>]+>`,
|
|
368
|
+
startTag: String.raw`<(?<startTagName>${tagName})(?<attrs>(?:${attr})*)\s*(?<closingSlash>/?)\s*>`,
|
|
369
|
+
endTag: String.raw`</(?<endTagName>${tagName})\s*>`,
|
|
370
|
+
space: String.raw`\s+`,
|
|
371
|
+
text: String.raw`[^<\s"']+|${quotedString}|['"]`,
|
|
372
|
+
wildcard: String.raw`.`,
|
|
373
|
+
};
|
|
374
|
+
|
|
375
|
+
const grammar = Object.entries(tokens)
|
|
376
|
+
.map(([k, v]) => `(?<${k}>${v})`)
|
|
377
|
+
.join("|");
|
|
378
|
+
|
|
379
|
+
/**
|
|
380
|
+
*
|
|
381
|
+
* @param {RegExp} lexer
|
|
382
|
+
* @param {string} s
|
|
383
|
+
*/
|
|
384
|
+
function* getTokens(lexer, s) {
|
|
385
|
+
let res;
|
|
386
|
+
let { lastIndex } = lexer;
|
|
387
|
+
while ((res = lexer.exec(s))) {
|
|
388
|
+
yield /** @type {RegExpExecArray & { groups: Record<string, string> }} */ (
|
|
389
|
+
res
|
|
390
|
+
);
|
|
391
|
+
({ lastIndex } = lexer);
|
|
392
|
+
}
|
|
393
|
+
if (lastIndex != s.length) throw new Error("Failed to parse string");
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
const voidTags = new Set([
|
|
397
|
+
"area",
|
|
398
|
+
"base",
|
|
399
|
+
"basefont",
|
|
400
|
+
"bgsound",
|
|
401
|
+
"br",
|
|
402
|
+
"col",
|
|
403
|
+
"command",
|
|
404
|
+
"embed",
|
|
405
|
+
"frame",
|
|
406
|
+
"hr",
|
|
407
|
+
"image",
|
|
408
|
+
"img",
|
|
409
|
+
"input",
|
|
410
|
+
"keygen",
|
|
411
|
+
"link",
|
|
412
|
+
"meta",
|
|
413
|
+
"param",
|
|
414
|
+
"source",
|
|
415
|
+
"track",
|
|
416
|
+
"wbr",
|
|
417
|
+
]);
|
|
418
|
+
|
|
419
|
+
function format(/** @type {string} */ html, indent = " ", width = 80) {
|
|
420
|
+
const lexer = new RegExp(grammar, "gys");
|
|
421
|
+
const attrLexer = new RegExp(attr, "gy");
|
|
422
|
+
|
|
423
|
+
/** @type {string[]} */
|
|
424
|
+
const output = [];
|
|
425
|
+
|
|
426
|
+
/** @type {string | null} */
|
|
427
|
+
let specialElement = null;
|
|
428
|
+
let level = 0;
|
|
429
|
+
|
|
430
|
+
let lineLength = 0;
|
|
431
|
+
let span = "";
|
|
432
|
+
let spanLevel = 0;
|
|
433
|
+
let lastSpace = "";
|
|
434
|
+
|
|
435
|
+
const flushOutput = () => {
|
|
436
|
+
if (lastSpace && lastSpace != "\n") {
|
|
437
|
+
const newline = span.indexOf("\n");
|
|
438
|
+
const len = newline == -1 ? span.length : newline;
|
|
439
|
+
if (lineLength + lastSpace.length + len > width) lastSpace = "\n";
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
const ind = lastSpace == "\n" && span ? indent.repeat(spanLevel) : "";
|
|
443
|
+
const out = `${lastSpace}${ind}${span}`;
|
|
444
|
+
|
|
445
|
+
if (out) {
|
|
446
|
+
const pos = out.lastIndexOf("\n");
|
|
447
|
+
if (pos == -1) lineLength += out.length;
|
|
448
|
+
else lineLength = out.length - pos - 1;
|
|
449
|
+
output.push(out);
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
span = lastSpace = "";
|
|
453
|
+
};
|
|
454
|
+
|
|
455
|
+
const addOutput = (/** @type {string[]} */ ...args) => {
|
|
456
|
+
for (const s of args) {
|
|
457
|
+
if (!specialElement && /^\s+$/.test(s)) {
|
|
458
|
+
flushOutput();
|
|
459
|
+
lastSpace = s;
|
|
460
|
+
} else {
|
|
461
|
+
if (!span) spanLevel = level;
|
|
462
|
+
span += s;
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
};
|
|
466
|
+
|
|
467
|
+
for (const token of getTokens(lexer, html)) {
|
|
468
|
+
// For testing
|
|
469
|
+
if (/** @type {any} */ (format).__strict && token.groups.wildcard)
|
|
470
|
+
throw new Error("Unexpected wildcard");
|
|
471
|
+
|
|
472
|
+
if (token.groups.endTag) {
|
|
473
|
+
const tagName = token.groups.endTagName.toLowerCase();
|
|
474
|
+
if (tagName == specialElement) specialElement = null;
|
|
475
|
+
if (!specialElement) {
|
|
476
|
+
--level;
|
|
477
|
+
addOutput(`</${tagName}>`);
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
if (!specialElement) {
|
|
482
|
+
if (token.groups.space) {
|
|
483
|
+
addOutput(...(token[0].match(/\n/g)?.slice(0, 2) ?? [" "]));
|
|
484
|
+
} else if (
|
|
485
|
+
token.groups.comment ||
|
|
486
|
+
token.groups.dtd ||
|
|
487
|
+
token.groups.text ||
|
|
488
|
+
token.groups.wildcard
|
|
489
|
+
) {
|
|
490
|
+
addOutput(token[0]);
|
|
491
|
+
} else if (token.groups.startTag) {
|
|
492
|
+
const tagName = token.groups.startTagName.toLowerCase();
|
|
493
|
+
|
|
494
|
+
addOutput(`<${tagName}`);
|
|
495
|
+
|
|
496
|
+
++level;
|
|
497
|
+
|
|
498
|
+
if (token.groups.attrs) {
|
|
499
|
+
let { lastIndex } = attrLexer;
|
|
500
|
+
let attrToken;
|
|
501
|
+
let lastToken;
|
|
502
|
+
while (
|
|
503
|
+
(attrToken =
|
|
504
|
+
/** @type {RegExpExecArray & { groups: Record<string, string> }} */ (
|
|
505
|
+
attrLexer.exec(token.groups.attrs)
|
|
506
|
+
))
|
|
507
|
+
) {
|
|
508
|
+
({ lastIndex } = attrLexer);
|
|
509
|
+
|
|
510
|
+
// For testing
|
|
511
|
+
if (
|
|
512
|
+
/** @type {any} */ (format).__strict &&
|
|
513
|
+
attrToken.groups.attrText
|
|
514
|
+
)
|
|
515
|
+
throw new Error("Unexpected attr text");
|
|
516
|
+
|
|
517
|
+
if (attrToken.groups.attrText) {
|
|
518
|
+
if (attrToken.groups.attrSpace)
|
|
519
|
+
addOutput(/\n/.test(attrToken.groups.attrSpace) ? "\n" : " ");
|
|
520
|
+
addOutput(attrToken.groups.attrText);
|
|
521
|
+
} else {
|
|
522
|
+
if (attrToken.groups.attrSpace || !lastToken?.groups.attrText)
|
|
523
|
+
addOutput(/\n/.test(attrToken.groups.attrSpace) ? "\n" : " ");
|
|
524
|
+
addOutput(
|
|
525
|
+
`${attrToken.groups.attrName}${
|
|
526
|
+
attrToken.groups.quotedAttrValue
|
|
527
|
+
? `="${attrToken.groups.quotedAttrValue}"`
|
|
528
|
+
: attrToken.groups.singleQuotedAttrValue
|
|
529
|
+
? `='${attrToken.groups.singleQuotedAttrValue}'`
|
|
530
|
+
: attrToken.groups.unquotedAttrValue
|
|
531
|
+
? `=${attrToken.groups.unquotedAttrValue}`
|
|
532
|
+
: ""
|
|
533
|
+
}`
|
|
534
|
+
);
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
lastToken = attrToken;
|
|
538
|
+
}
|
|
539
|
+
if (lastIndex != token.groups.attrs.length)
|
|
540
|
+
throw new Error("Failed to parse attributes");
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
const hasClosingSlash = Boolean(token.groups.closingSlash);
|
|
544
|
+
|
|
545
|
+
addOutput(hasClosingSlash ? " />" : ">");
|
|
546
|
+
|
|
547
|
+
if (hasClosingSlash || voidTags.has(tagName)) --level;
|
|
548
|
+
else if (["pre", "textarea", "script", "style"].includes(tagName))
|
|
549
|
+
specialElement = tagName;
|
|
550
|
+
}
|
|
551
|
+
} else addOutput(token[0]);
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
// Flush remaining output
|
|
555
|
+
flushOutput();
|
|
556
|
+
|
|
557
|
+
let newline = false;
|
|
558
|
+
while (/^\s+$/.test(output[output.length - 1])) {
|
|
559
|
+
const last = /** @type {string} */ (output.pop());
|
|
560
|
+
if (/\n/.test(last)) newline = true;
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
if (newline) output.push("\n");
|
|
564
|
+
|
|
565
|
+
return output.join("");
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
format.default = format;
|
|
569
|
+
var htmlFormat = format;
|
|
570
|
+
|
|
571
|
+
function render(_ctx, _cache) {
|
|
572
|
+
const _component_v_icon = resolveComponent("v-icon");
|
|
573
|
+
const _component_v_list_item_icon = resolveComponent("v-list-item-icon");
|
|
574
|
+
const _component_v_text_overflow = resolveComponent("v-text-overflow");
|
|
575
|
+
const _component_v_list_item_content = resolveComponent("v-list-item-content");
|
|
576
|
+
const _component_v_list_item = resolveComponent("v-list-item");
|
|
577
|
+
const _component_v_list = resolveComponent("v-list");
|
|
578
|
+
|
|
579
|
+
return (openBlock(), createBlock(_component_v_list, { nav: "" }, {
|
|
580
|
+
default: withCtx(() => [
|
|
581
|
+
createVNode(_component_v_list_item, { to: "/tta_settings/templates" }, {
|
|
582
|
+
default: withCtx(() => [
|
|
583
|
+
createVNode(_component_v_list_item_icon, null, {
|
|
584
|
+
default: withCtx(() => [
|
|
585
|
+
createVNode(_component_v_icon, { name: "code" })
|
|
586
|
+
]),
|
|
587
|
+
_: 1 /* STABLE */
|
|
588
|
+
}),
|
|
589
|
+
createVNode(_component_v_list_item_content, null, {
|
|
590
|
+
default: withCtx(() => [
|
|
591
|
+
createVNode(_component_v_text_overflow, { text: "Templates" })
|
|
592
|
+
]),
|
|
593
|
+
_: 1 /* STABLE */
|
|
594
|
+
})
|
|
595
|
+
]),
|
|
596
|
+
_: 1 /* STABLE */
|
|
597
|
+
}),
|
|
598
|
+
createVNode(_component_v_list_item, { to: "/tta_settings/settings" }, {
|
|
599
|
+
default: withCtx(() => [
|
|
600
|
+
createVNode(_component_v_list_item_icon, null, {
|
|
601
|
+
default: withCtx(() => [
|
|
602
|
+
createVNode(_component_v_icon, { name: "settings" })
|
|
603
|
+
]),
|
|
604
|
+
_: 1 /* STABLE */
|
|
605
|
+
}),
|
|
606
|
+
createVNode(_component_v_list_item_content, null, {
|
|
607
|
+
default: withCtx(() => [
|
|
608
|
+
createVNode(_component_v_text_overflow, { text: "Settings" })
|
|
609
|
+
]),
|
|
610
|
+
_: 1 /* STABLE */
|
|
611
|
+
})
|
|
612
|
+
]),
|
|
613
|
+
_: 1 /* STABLE */
|
|
614
|
+
}),
|
|
615
|
+
createCommentVNode(" <v-list-item to=\"/tta_settings/usage\">\n <v-list-item-icon><v-icon name=\"bar_chart\" /></v-list-item-icon>\n <v-list-item-content>\n <v-text-overflow text=\"Usage\" />\n </v-list-item-content>\n </v-list-item> ")
|
|
616
|
+
]),
|
|
617
|
+
_: 1 /* STABLE */
|
|
618
|
+
}))
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
const script$4 = {};
|
|
622
|
+
|
|
623
|
+
|
|
624
|
+
script$4.render = render;
|
|
625
|
+
script$4.__file = "settingsmodule/src/TTAnav.vue";
|
|
626
|
+
|
|
627
|
+
const _hoisted_1$1 = {
|
|
628
|
+
key: 0,
|
|
629
|
+
class: "TTA-popup"
|
|
630
|
+
};
|
|
631
|
+
const _hoisted_2$1 = { class: "TTA-toolbar" };
|
|
632
|
+
const _hoisted_3 = { class: "right-side" };
|
|
633
|
+
const _hoisted_4 = { class: "setwidth" };
|
|
634
|
+
const _hoisted_5 = { class: "TTA-action" };
|
|
635
|
+
const _hoisted_6 = { class: "TTA-wapper" };
|
|
636
|
+
const _hoisted_7 = { id: "partSelect" };
|
|
637
|
+
const _hoisted_8 = ["src"];
|
|
638
|
+
var script$3 = /* @__PURE__ */ defineComponent({
|
|
639
|
+
__name: "templates",
|
|
640
|
+
setup(__props) {
|
|
641
|
+
const templates = ref([]), templateDetails = ref(false), editTemplate = ref(false), currentPart = ref("Body");
|
|
642
|
+
const widthPartition = ref(50);
|
|
643
|
+
const previewWidth = computed(() => {
|
|
644
|
+
return 100 - widthPartition.value;
|
|
645
|
+
});
|
|
646
|
+
const editorWidth = computed(() => {
|
|
647
|
+
return 100 - previewWidth.value;
|
|
648
|
+
});
|
|
649
|
+
const currentHTML = computed(() => {
|
|
650
|
+
if (currentPart.value == "Header")
|
|
651
|
+
return currentTemplate.value.header;
|
|
652
|
+
if (currentPart.value == "Body")
|
|
653
|
+
return currentTemplate.value.template;
|
|
654
|
+
return currentTemplate.value.footer;
|
|
655
|
+
});
|
|
656
|
+
function changeHTML(html) {
|
|
657
|
+
if (currentPart.value == "Header")
|
|
658
|
+
currentTemplate.value.header = html;
|
|
659
|
+
else if (currentPart.value == "Body")
|
|
660
|
+
currentTemplate.value.template = html;
|
|
661
|
+
else
|
|
662
|
+
currentTemplate.value.footer = html;
|
|
663
|
+
}
|
|
664
|
+
const api = useApi();
|
|
665
|
+
const defaultTemplate = {
|
|
666
|
+
template: "<h1>Hello world!</h1>",
|
|
667
|
+
id: -1,
|
|
668
|
+
name: "",
|
|
669
|
+
description: "",
|
|
670
|
+
collection: "",
|
|
671
|
+
format: "A4",
|
|
672
|
+
orientation: "portrait",
|
|
673
|
+
header: "<!-- Any content/styling here is seperated from the body on render-->\n<style> \n #header, #footer { \n margin: 0 !important; \n padding: 0 !important; \n font-size: 9px; \n -webkit-print-color-adjust: exact;\n }\n</style>\n<div style='width:100%'>\n <span class='date'></span>\n <span class='title' style='float:right'></span>\n</div>",
|
|
674
|
+
footer: "<!-- Any content/styling here is seperated from the body on render-->\n<style> \n #header, #footer { \n margin: 0 !important; \n padding: 0 !important; \n font-size: 9px; -webkit-print-color-adjust: exact;\n }\n</style>\n<div\n style=\u2018width:100%\u2019>\n <div style=\u2018float:right\u2019><span\n class='pageNumber'></span> / <span class='totalPages'></span>\n </div>\n</div>"
|
|
675
|
+
};
|
|
676
|
+
const currentTemplate = ref(structuredClone(defaultTemplate));
|
|
677
|
+
const { useCollectionsStore } = useStores();
|
|
678
|
+
const collectionsStore = useCollectionsStore();
|
|
679
|
+
const collections = computed(() => {
|
|
680
|
+
return collectionsStore.collections.filter((e) => e.collection != "TTA_htmltemplates").map((e) => ({
|
|
681
|
+
text: e.name,
|
|
682
|
+
value: e.collection
|
|
683
|
+
}));
|
|
684
|
+
});
|
|
685
|
+
const computedTemplate = computed(() => {
|
|
686
|
+
const blob = new Blob(
|
|
687
|
+
[
|
|
688
|
+
`<style>
|
|
689
|
+
.date:before{content: "Date here";font-style: italic; }
|
|
690
|
+
.title:before{content: "Title here";font-style: italic; }
|
|
691
|
+
.pageNumber:before{content: "Pagenumber";font-style: italic; }
|
|
692
|
+
.totalPages:before{content: "Total pages";font-style: italic; }
|
|
693
|
+
</style>` + (currentTemplate.value.header || "") + (currentTemplate.value.template || "") + (currentTemplate.value.footer || "")
|
|
694
|
+
],
|
|
695
|
+
{
|
|
696
|
+
type: "text/html"
|
|
697
|
+
}
|
|
698
|
+
);
|
|
699
|
+
const objectUrl = URL.createObjectURL(blob);
|
|
700
|
+
return objectUrl;
|
|
701
|
+
});
|
|
702
|
+
onMounted(async () => {
|
|
703
|
+
widthPartition.value = parseInt(
|
|
704
|
+
localStorage.getItem("TTA-widthPartition") || "50"
|
|
705
|
+
);
|
|
706
|
+
fetchTemplates();
|
|
707
|
+
});
|
|
708
|
+
watch(
|
|
709
|
+
() => widthPartition.value,
|
|
710
|
+
(newval) => localStorage.setItem("TTA-widthPartition", newval + "")
|
|
711
|
+
);
|
|
712
|
+
async function fetchTemplates() {
|
|
713
|
+
const getTemplates = await api.get("/items/TTA_htmltemplates", {
|
|
714
|
+
params: {
|
|
715
|
+
limit: -1
|
|
716
|
+
}
|
|
717
|
+
});
|
|
718
|
+
templates.value = getTemplates.data.data;
|
|
719
|
+
}
|
|
720
|
+
async function saveTemplate() {
|
|
721
|
+
if (currentTemplate.value.id == -1) {
|
|
722
|
+
await api.post("/items/TTA_htmltemplates", {
|
|
723
|
+
...currentTemplate.value,
|
|
724
|
+
id: void 0
|
|
725
|
+
});
|
|
726
|
+
} else {
|
|
727
|
+
await api.patch("/items/TTA_htmltemplates/" + currentTemplate.value.id, {
|
|
728
|
+
...currentTemplate.value,
|
|
729
|
+
id: void 0
|
|
730
|
+
});
|
|
731
|
+
}
|
|
732
|
+
templateDetails.value = false;
|
|
733
|
+
fetchTemplates();
|
|
734
|
+
}
|
|
735
|
+
function openTemplate({ item }) {
|
|
736
|
+
currentTemplate.value = item;
|
|
737
|
+
editTemplate.value = true;
|
|
738
|
+
}
|
|
739
|
+
function closeEditor() {
|
|
740
|
+
currentTemplate.value = structuredClone(defaultTemplate);
|
|
741
|
+
editTemplate.value = false;
|
|
742
|
+
}
|
|
743
|
+
function alignHTML() {
|
|
744
|
+
currentTemplate.value.template = htmlFormat(currentTemplate.value.template);
|
|
745
|
+
currentTemplate.value.footer = htmlFormat(currentTemplate.value.footer);
|
|
746
|
+
currentTemplate.value.header = htmlFormat(currentTemplate.value.header);
|
|
747
|
+
}
|
|
748
|
+
return (_ctx, _cache) => {
|
|
749
|
+
const _component_v_icon = resolveComponent("v-icon");
|
|
750
|
+
const _component_v_button = resolveComponent("v-button");
|
|
751
|
+
const _component_v_card_title = resolveComponent("v-card-title");
|
|
752
|
+
const _component_v_input = resolveComponent("v-input");
|
|
753
|
+
const _component_v_list_item_content = resolveComponent("v-list-item-content");
|
|
754
|
+
const _component_v_list_item = resolveComponent("v-list-item");
|
|
755
|
+
const _component_v_select = resolveComponent("v-select");
|
|
756
|
+
const _component_v_list = resolveComponent("v-list");
|
|
757
|
+
const _component_v_card_text = resolveComponent("v-card-text");
|
|
758
|
+
const _component_v_card_actions = resolveComponent("v-card-actions");
|
|
759
|
+
const _component_v_card = resolveComponent("v-card");
|
|
760
|
+
const _component_v_dialog = resolveComponent("v-dialog");
|
|
761
|
+
const _component_v_slider = resolveComponent("v-slider");
|
|
762
|
+
const _component_v_table = resolveComponent("v-table");
|
|
763
|
+
const _component_private_view = resolveComponent("private-view");
|
|
764
|
+
return openBlock(), createBlock(_component_private_view, { title: "Templates" }, {
|
|
765
|
+
navigation: withCtx(() => [
|
|
766
|
+
createVNode(script$4)
|
|
767
|
+
]),
|
|
768
|
+
actions: withCtx(() => [
|
|
769
|
+
createVNode(_component_v_button, {
|
|
770
|
+
rounded: "",
|
|
771
|
+
icon: "",
|
|
772
|
+
onClick: _cache[0] || (_cache[0] = ($event) => templateDetails.value = true)
|
|
773
|
+
}, {
|
|
774
|
+
default: withCtx(() => [
|
|
775
|
+
createVNode(_component_v_icon, { name: "add" })
|
|
776
|
+
]),
|
|
777
|
+
_: 1
|
|
778
|
+
}),
|
|
779
|
+
createVNode(_component_v_dialog, {
|
|
780
|
+
modelValue: templateDetails.value,
|
|
781
|
+
"onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => templateDetails.value = $event),
|
|
782
|
+
persistent: true
|
|
783
|
+
}, {
|
|
784
|
+
default: withCtx(() => [
|
|
785
|
+
createVNode(_component_v_card, null, {
|
|
786
|
+
default: withCtx(() => [
|
|
787
|
+
createVNode(_component_v_card_title, null, {
|
|
788
|
+
default: withCtx(() => [
|
|
789
|
+
createTextVNode("Create a new HTML template")
|
|
790
|
+
]),
|
|
791
|
+
_: 1
|
|
792
|
+
}),
|
|
793
|
+
createVNode(_component_v_card_text, null, {
|
|
794
|
+
default: withCtx(() => [
|
|
795
|
+
createVNode(_component_v_list, null, {
|
|
796
|
+
default: withCtx(() => [
|
|
797
|
+
createVNode(_component_v_list_item, null, {
|
|
798
|
+
default: withCtx(() => [
|
|
799
|
+
createVNode(_component_v_list_item_content, null, {
|
|
800
|
+
default: withCtx(() => [
|
|
801
|
+
createVNode(_component_v_input, {
|
|
802
|
+
modelValue: currentTemplate.value.name,
|
|
803
|
+
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => currentTemplate.value.name = $event),
|
|
804
|
+
placeholder: "Template name"
|
|
805
|
+
}, null, 8, ["modelValue"])
|
|
806
|
+
]),
|
|
807
|
+
_: 1
|
|
808
|
+
})
|
|
809
|
+
]),
|
|
810
|
+
_: 1
|
|
811
|
+
}),
|
|
812
|
+
createVNode(_component_v_list_item, null, {
|
|
813
|
+
default: withCtx(() => [
|
|
814
|
+
createVNode(_component_v_list_item_content, null, {
|
|
815
|
+
default: withCtx(() => [
|
|
816
|
+
createVNode(_component_v_input, {
|
|
817
|
+
modelValue: currentTemplate.value.description,
|
|
818
|
+
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => currentTemplate.value.description = $event),
|
|
819
|
+
placeholder: "Description"
|
|
820
|
+
}, null, 8, ["modelValue"])
|
|
821
|
+
]),
|
|
822
|
+
_: 1
|
|
823
|
+
})
|
|
824
|
+
]),
|
|
825
|
+
_: 1
|
|
826
|
+
}),
|
|
827
|
+
createVNode(_component_v_list_item, null, {
|
|
828
|
+
default: withCtx(() => [
|
|
829
|
+
createVNode(_component_v_list_item_content, null, {
|
|
830
|
+
default: withCtx(() => [
|
|
831
|
+
createVNode(_component_v_select, {
|
|
832
|
+
modelValue: currentTemplate.value.format,
|
|
833
|
+
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => currentTemplate.value.format = $event),
|
|
834
|
+
placeholder: "Size",
|
|
835
|
+
items: [
|
|
836
|
+
"A1",
|
|
837
|
+
"A2",
|
|
838
|
+
"A3",
|
|
839
|
+
"A4",
|
|
840
|
+
"A5",
|
|
841
|
+
"A6",
|
|
842
|
+
"Letter",
|
|
843
|
+
"Legal",
|
|
844
|
+
"Tabloid",
|
|
845
|
+
"Ledger"
|
|
846
|
+
].map((e) => ({ text: e, value: e }))
|
|
847
|
+
}, null, 8, ["modelValue", "items"])
|
|
848
|
+
]),
|
|
849
|
+
_: 1
|
|
850
|
+
})
|
|
851
|
+
]),
|
|
852
|
+
_: 1
|
|
853
|
+
}),
|
|
854
|
+
createVNode(_component_v_list_item, null, {
|
|
855
|
+
default: withCtx(() => [
|
|
856
|
+
createVNode(_component_v_list_item_content, null, {
|
|
857
|
+
default: withCtx(() => [
|
|
858
|
+
createVNode(_component_v_select, {
|
|
859
|
+
modelValue: currentTemplate.value.orientation,
|
|
860
|
+
"onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => currentTemplate.value.orientation = $event),
|
|
861
|
+
placeholder: "Orientation",
|
|
862
|
+
items: ["portrait", "landscape"].map((e) => ({
|
|
863
|
+
text: e,
|
|
864
|
+
value: e
|
|
865
|
+
}))
|
|
866
|
+
}, null, 8, ["modelValue", "items"])
|
|
867
|
+
]),
|
|
868
|
+
_: 1
|
|
869
|
+
})
|
|
870
|
+
]),
|
|
871
|
+
_: 1
|
|
872
|
+
}),
|
|
873
|
+
createVNode(_component_v_list_item, null, {
|
|
874
|
+
default: withCtx(() => [
|
|
875
|
+
createVNode(_component_v_list_item_content, null, {
|
|
876
|
+
default: withCtx(() => [
|
|
877
|
+
createVNode(_component_v_select, {
|
|
878
|
+
modelValue: currentTemplate.value.collection,
|
|
879
|
+
"onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => currentTemplate.value.collection = $event),
|
|
880
|
+
items: unref(collections),
|
|
881
|
+
placeholder: "Collection"
|
|
882
|
+
}, null, 8, ["modelValue", "items"])
|
|
883
|
+
]),
|
|
884
|
+
_: 1
|
|
885
|
+
})
|
|
886
|
+
]),
|
|
887
|
+
_: 1
|
|
888
|
+
})
|
|
889
|
+
]),
|
|
890
|
+
_: 1
|
|
891
|
+
})
|
|
892
|
+
]),
|
|
893
|
+
_: 1
|
|
894
|
+
}),
|
|
895
|
+
createVNode(_component_v_card_actions, null, {
|
|
896
|
+
default: withCtx(() => [
|
|
897
|
+
createVNode(_component_v_button, {
|
|
898
|
+
secondary: "",
|
|
899
|
+
onClick: _cache[6] || (_cache[6] = ($event) => templateDetails.value = false)
|
|
900
|
+
}, {
|
|
901
|
+
default: withCtx(() => [
|
|
902
|
+
createTextVNode(" Cancel ")
|
|
903
|
+
]),
|
|
904
|
+
_: 1
|
|
905
|
+
}),
|
|
906
|
+
createVNode(_component_v_button, {
|
|
907
|
+
disabled: !currentTemplate.value.collection || !currentTemplate.value.name || !currentTemplate.value.format,
|
|
908
|
+
onClick: saveTemplate
|
|
909
|
+
}, {
|
|
910
|
+
default: withCtx(() => [
|
|
911
|
+
createTextVNode(" Save ")
|
|
912
|
+
]),
|
|
913
|
+
_: 1
|
|
914
|
+
}, 8, ["disabled"])
|
|
915
|
+
]),
|
|
916
|
+
_: 1
|
|
917
|
+
})
|
|
918
|
+
]),
|
|
919
|
+
_: 1
|
|
920
|
+
})
|
|
921
|
+
]),
|
|
922
|
+
_: 1
|
|
923
|
+
}, 8, ["modelValue"])
|
|
924
|
+
]),
|
|
925
|
+
default: withCtx(() => [
|
|
926
|
+
editTemplate.value ? (openBlock(), createElementBlock("div", _hoisted_1$1, [
|
|
927
|
+
createElementVNode("div", _hoisted_2$1, [
|
|
928
|
+
createElementVNode("div", {
|
|
929
|
+
onClick: _cache[8] || (_cache[8] = ($event) => templateDetails.value = true),
|
|
930
|
+
class: "TTA-template-title"
|
|
931
|
+
}, [
|
|
932
|
+
createTextVNode(toDisplayString(currentTemplate.value.name) + " ", 1),
|
|
933
|
+
createVNode(_component_v_icon, { name: "edit" })
|
|
934
|
+
]),
|
|
935
|
+
createElementVNode("div", _hoisted_3, [
|
|
936
|
+
createElementVNode("div", {
|
|
937
|
+
class: "TTA-action",
|
|
938
|
+
onClick: alignHTML
|
|
939
|
+
}, [
|
|
940
|
+
createVNode(_component_v_icon, { name: "vertical_align_center" })
|
|
941
|
+
]),
|
|
942
|
+
createElementVNode("div", {
|
|
943
|
+
class: "TTA-action",
|
|
944
|
+
onClick: saveTemplate
|
|
945
|
+
}, [
|
|
946
|
+
createVNode(_component_v_icon, { name: "save" })
|
|
947
|
+
]),
|
|
948
|
+
createElementVNode("div", _hoisted_4, [
|
|
949
|
+
createVNode(_component_v_slider, {
|
|
950
|
+
modelValue: widthPartition.value,
|
|
951
|
+
"onUpdate:modelValue": _cache[9] || (_cache[9] = ($event) => widthPartition.value = $event),
|
|
952
|
+
min: 10,
|
|
953
|
+
max: 90,
|
|
954
|
+
class: "TTA-slider"
|
|
955
|
+
}, null, 8, ["modelValue"])
|
|
956
|
+
]),
|
|
957
|
+
createElementVNode("div", _hoisted_5, [
|
|
958
|
+
createVNode(_component_v_icon, {
|
|
959
|
+
name: "close",
|
|
960
|
+
onClick: closeEditor
|
|
961
|
+
})
|
|
962
|
+
])
|
|
963
|
+
])
|
|
964
|
+
]),
|
|
965
|
+
createElementVNode("div", _hoisted_6, [
|
|
966
|
+
createElementVNode("div", {
|
|
967
|
+
style: normalizeStyle("width: " + unref(editorWidth) + "%"),
|
|
968
|
+
class: "TTA-editor-wrapper"
|
|
969
|
+
}, [
|
|
970
|
+
(openBlock(), createBlock(resolveDynamicComponent("interface-input-code"), {
|
|
971
|
+
class: "TTA-editor",
|
|
972
|
+
value: unref(currentHTML),
|
|
973
|
+
language: "htmlmixed",
|
|
974
|
+
onInput: changeHTML
|
|
975
|
+
}, null, 40, ["value"])),
|
|
976
|
+
createElementVNode("div", _hoisted_7, [
|
|
977
|
+
createVNode(_component_v_select, {
|
|
978
|
+
modelValue: currentPart.value,
|
|
979
|
+
"onUpdate:modelValue": _cache[10] || (_cache[10] = ($event) => currentPart.value = $event),
|
|
980
|
+
items: [
|
|
981
|
+
{ value: "Header", text: "Header" },
|
|
982
|
+
{ value: "Body", text: "Body" },
|
|
983
|
+
{ value: "Footer", text: "Footer" }
|
|
984
|
+
]
|
|
985
|
+
}, null, 8, ["modelValue"])
|
|
986
|
+
])
|
|
987
|
+
], 4),
|
|
988
|
+
createElementVNode("iframe", {
|
|
989
|
+
class: "TTA-preview",
|
|
990
|
+
src: unref(computedTemplate),
|
|
991
|
+
style: normalizeStyle("width: " + unref(previewWidth) + "%")
|
|
992
|
+
}, null, 12, _hoisted_8)
|
|
993
|
+
])
|
|
994
|
+
])) : createCommentVNode("v-if", true),
|
|
995
|
+
createVNode(_component_v_table, {
|
|
996
|
+
headers: [
|
|
997
|
+
{
|
|
998
|
+
text: "Name",
|
|
999
|
+
value: "name"
|
|
1000
|
+
},
|
|
1001
|
+
{
|
|
1002
|
+
text: "Description",
|
|
1003
|
+
value: "description"
|
|
1004
|
+
},
|
|
1005
|
+
{
|
|
1006
|
+
text: "Collection",
|
|
1007
|
+
value: "collection"
|
|
1008
|
+
},
|
|
1009
|
+
{
|
|
1010
|
+
text: "Format",
|
|
1011
|
+
value: "format"
|
|
1012
|
+
}
|
|
1013
|
+
],
|
|
1014
|
+
"onClick:row": openTemplate,
|
|
1015
|
+
items: templates.value
|
|
1016
|
+
}, null, 8, ["items"])
|
|
1017
|
+
]),
|
|
1018
|
+
_: 1
|
|
1019
|
+
});
|
|
1020
|
+
};
|
|
1021
|
+
}
|
|
1022
|
+
});
|
|
1023
|
+
|
|
1024
|
+
var e=[],t=[];function n(n,r){if(n&&"undefined"!=typeof document){var a,s=!0===r.prepend?"prepend":"append",d=!0===r.singleTag,i="string"==typeof r.container?document.querySelector(r.container):document.getElementsByTagName("head")[0];if(d){var u=e.indexOf(i);-1===u&&(u=e.push(i)-1,t[u]={}),a=t[u]&&t[u][s]?t[u][s]:t[u][s]=c();}else a=c();65279===n.charCodeAt(0)&&(n=n.substring(1)),a.styleSheet?a.styleSheet.cssText+=n:a.appendChild(document.createTextNode(n));}function c(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),r.attributes)for(var t=Object.keys(r.attributes),n=0;n<t.length;n++)e.setAttribute(t[n],r.attributes[t[n]]);var a="prepend"===s?"afterbegin":"beforeend";return i.insertAdjacentElement(a,e),e}}
|
|
1025
|
+
|
|
1026
|
+
var css$1 = "\n.TTA-popup {\n position: fixed;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n z-index: 100;\n display: flex;\n flex-direction: column;\n background-color: var(--background-subdued);\n}\n.TTA-toolbar {\n background-color: var(--background-subdued);\n display: flex;\n justify-content: space-between;\n}\n.TTA-toolbar .right-side {\n display: flex;\n gap: 5px;\n}\n.TTA-toolbar .TTA-slider {\n padding-top: 5px;\n}\n.TTA-toolbar .TTA-action {\n padding: 5px;\n cursor: pointer;\n}\n.TTA-toolbar .setwidth {\n display: flex;\n gap: 10px;\n padding-top: 6px;\n}\n.TTA-toolbar .TTA-template-title {\n margin: auto 0;\n font-size: 18px;\n cursor: pointer;\n padding-right: 5px;\n padding-left: 20px;\n border-bottom: 1px solid var(--v-list-item-border-color);\n}\n.TTA-toolbar .TTA-template-title i {\n padding-left: 5px;\n}\n.TTA-wapper {\n display: flex;\n flex-grow: 1;\n overflow: hidden;\n position: relative;\n}\n.TTA-preview {\n flex-grow: 1;\n background-color: white;\n border: 0;\n}\n.TTA-editor {\n flex-grow: 1;\n height: 100%;\n width: 100%;\n}\n.TTA-wapper .TTA-editor-wrapper {\n position: relative;\n}\n.TTA-editor > div {\n height: 100% !important;\n border-radius: 0 !important;\n}\n.TTA-editor .CodeMirror {\n height: 100%;\n}\n.TTA-wapper #partSelect {\n position: absolute;\n right: 0;\n top: 0;\n width: 200px;\n}\n";
|
|
1027
|
+
n(css$1,{});
|
|
1028
|
+
|
|
1029
|
+
script$3.__file = "settingsmodule/src/templates.vue";
|
|
1030
|
+
|
|
1031
|
+
const _withScopeId = (n) => (pushScopeId("data-v-014dce90"), n = n(), popScopeId(), n);
|
|
1032
|
+
const _hoisted_1 = { class: "px-5" };
|
|
1033
|
+
const _hoisted_2 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("span", { class: "field-name" }, "RapidAPI token", -1));
|
|
1034
|
+
var script$2 = /* @__PURE__ */ defineComponent({
|
|
1035
|
+
__name: "settings",
|
|
1036
|
+
setup(__props) {
|
|
1037
|
+
const rapidKey = ref("");
|
|
1038
|
+
const saving = ref(false);
|
|
1039
|
+
const api = useApi();
|
|
1040
|
+
const folder = ref([]);
|
|
1041
|
+
onMounted(async () => {
|
|
1042
|
+
const settings = await api.get("/settings");
|
|
1043
|
+
rapidKey.value = settings.data.data.TTA_KEY;
|
|
1044
|
+
const folders = await api.get("/folders");
|
|
1045
|
+
folder.value = folders.data.data.map((e) => ({
|
|
1046
|
+
text: e.name,
|
|
1047
|
+
value: e.id
|
|
1048
|
+
}));
|
|
1049
|
+
});
|
|
1050
|
+
async function saveSettings() {
|
|
1051
|
+
saving.value = true;
|
|
1052
|
+
await api.patch("/settings", {
|
|
1053
|
+
TTA_KEY: rapidKey.value
|
|
1054
|
+
});
|
|
1055
|
+
setTimeout(() => {
|
|
1056
|
+
saving.value = false;
|
|
1057
|
+
}, 500);
|
|
1058
|
+
}
|
|
1059
|
+
return (_ctx, _cache) => {
|
|
1060
|
+
const _component_v_card_title = resolveComponent("v-card-title");
|
|
1061
|
+
const _component_v_input = resolveComponent("v-input");
|
|
1062
|
+
const _component_v_card_text = resolveComponent("v-card-text");
|
|
1063
|
+
const _component_v_icon = resolveComponent("v-icon");
|
|
1064
|
+
const _component_v_button = resolveComponent("v-button");
|
|
1065
|
+
const _component_v_progress_circular = resolveComponent("v-progress-circular");
|
|
1066
|
+
const _component_v_card_actions = resolveComponent("v-card-actions");
|
|
1067
|
+
const _component_v_card = resolveComponent("v-card");
|
|
1068
|
+
const _component_private_view = resolveComponent("private-view");
|
|
1069
|
+
return openBlock(), createBlock(_component_private_view, { title: "Settings" }, {
|
|
1070
|
+
navigation: withCtx(() => [
|
|
1071
|
+
createVNode(script$4)
|
|
1072
|
+
]),
|
|
1073
|
+
default: withCtx(() => [
|
|
1074
|
+
createElementVNode("div", _hoisted_1, [
|
|
1075
|
+
createVNode(_component_v_card, { class: "w-full" }, {
|
|
1076
|
+
default: withCtx(() => [
|
|
1077
|
+
createVNode(_component_v_card_title, null, {
|
|
1078
|
+
default: withCtx(() => [
|
|
1079
|
+
createTextVNode("API settings")
|
|
1080
|
+
]),
|
|
1081
|
+
_: 1
|
|
1082
|
+
}),
|
|
1083
|
+
createVNode(_component_v_card_text, { class: "fields-spacing" }, {
|
|
1084
|
+
default: withCtx(() => [
|
|
1085
|
+
createElementVNode("div", null, [
|
|
1086
|
+
_hoisted_2,
|
|
1087
|
+
createVNode(_component_v_input, {
|
|
1088
|
+
modelValue: rapidKey.value,
|
|
1089
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => rapidKey.value = $event)
|
|
1090
|
+
}, null, 8, ["modelValue"])
|
|
1091
|
+
])
|
|
1092
|
+
]),
|
|
1093
|
+
_: 1
|
|
1094
|
+
}),
|
|
1095
|
+
createVNode(_component_v_card_actions, null, {
|
|
1096
|
+
default: withCtx(() => [
|
|
1097
|
+
createVNode(_component_v_button, {
|
|
1098
|
+
href: "https://rapidapi.com/Attacler/api/text-to-anything",
|
|
1099
|
+
target: "_blank"
|
|
1100
|
+
}, {
|
|
1101
|
+
default: withCtx(() => [
|
|
1102
|
+
createVNode(_component_v_icon, { name: "open_in_new" }),
|
|
1103
|
+
createTextVNode(" Get RapidAPI token ")
|
|
1104
|
+
]),
|
|
1105
|
+
_: 1
|
|
1106
|
+
}),
|
|
1107
|
+
createVNode(_component_v_button, {
|
|
1108
|
+
onClick: saveSettings,
|
|
1109
|
+
disabled: saving.value
|
|
1110
|
+
}, {
|
|
1111
|
+
default: withCtx(() => [
|
|
1112
|
+
!saving.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
1113
|
+
createTextVNode(" Save ")
|
|
1114
|
+
], 64)) : (openBlock(), createBlock(_component_v_progress_circular, {
|
|
1115
|
+
key: 1,
|
|
1116
|
+
small: true,
|
|
1117
|
+
indeterminate: ""
|
|
1118
|
+
}))
|
|
1119
|
+
]),
|
|
1120
|
+
_: 1
|
|
1121
|
+
}, 8, ["disabled"])
|
|
1122
|
+
]),
|
|
1123
|
+
_: 1
|
|
1124
|
+
})
|
|
1125
|
+
]),
|
|
1126
|
+
_: 1
|
|
1127
|
+
})
|
|
1128
|
+
])
|
|
1129
|
+
]),
|
|
1130
|
+
_: 1
|
|
1131
|
+
});
|
|
1132
|
+
};
|
|
1133
|
+
}
|
|
1134
|
+
});
|
|
1135
|
+
|
|
1136
|
+
var css = "\n.w-full[data-v-014dce90] {\n width: 100%;\n}\n.px-5[data-v-014dce90] {\n padding: 0 2.5rem;\n}\n.fields-spacing[data-v-014dce90] {\n display: flex;\n flex-direction: column;\n gap: 10px;\n}\n";
|
|
1137
|
+
n(css,{});
|
|
1138
|
+
|
|
1139
|
+
script$2.__scopeId = "data-v-014dce90";
|
|
1140
|
+
script$2.__file = "settingsmodule/src/settings.vue";
|
|
1141
|
+
|
|
1142
|
+
var script$1 = /* @__PURE__ */ defineComponent({
|
|
1143
|
+
__name: "usage",
|
|
1144
|
+
setup(__props) {
|
|
1145
|
+
return (_ctx, _cache) => {
|
|
1146
|
+
const _component_private_view = resolveComponent("private-view");
|
|
1147
|
+
return openBlock(), createBlock(_component_private_view, { title: "Usage" }, {
|
|
1148
|
+
navigation: withCtx(() => [
|
|
1149
|
+
createVNode(script$4)
|
|
1150
|
+
]),
|
|
1151
|
+
default: withCtx(() => [
|
|
1152
|
+
createTextVNode(" Comming soon! ")
|
|
1153
|
+
]),
|
|
1154
|
+
_: 1
|
|
1155
|
+
});
|
|
1156
|
+
};
|
|
1157
|
+
}
|
|
1158
|
+
});
|
|
1159
|
+
|
|
1160
|
+
script$1.__file = "settingsmodule/src/usage.vue";
|
|
1161
|
+
|
|
1162
|
+
var e4 = defineModule({
|
|
1163
|
+
id: "tta_settings",
|
|
1164
|
+
name: "Text to anything settings",
|
|
1165
|
+
icon: "text_fields",
|
|
1166
|
+
routes: [
|
|
1167
|
+
{
|
|
1168
|
+
path: "",
|
|
1169
|
+
redirect: "/tta_settings/templates"
|
|
1170
|
+
},
|
|
1171
|
+
{
|
|
1172
|
+
path: "templates",
|
|
1173
|
+
component: script$3
|
|
1174
|
+
},
|
|
1175
|
+
{
|
|
1176
|
+
path: "settings",
|
|
1177
|
+
component: script$2
|
|
1178
|
+
},
|
|
1179
|
+
{
|
|
1180
|
+
path: "usage",
|
|
1181
|
+
component: script$1
|
|
1182
|
+
}
|
|
1183
|
+
]
|
|
1184
|
+
});
|
|
1185
|
+
|
|
1186
|
+
var script = /* @__PURE__ */ defineComponent({
|
|
1187
|
+
__name: "interface",
|
|
1188
|
+
props: ["value"],
|
|
1189
|
+
emits: ["input"],
|
|
1190
|
+
setup(__props, { emit }) {
|
|
1191
|
+
const props = __props;
|
|
1192
|
+
const api = inject("api");
|
|
1193
|
+
const value = ref(""), templates = ref([]);
|
|
1194
|
+
onMounted(async () => {
|
|
1195
|
+
value.value = props.value;
|
|
1196
|
+
watch(
|
|
1197
|
+
() => value.value,
|
|
1198
|
+
(newval, oldval) => {
|
|
1199
|
+
if (newval != oldval) {
|
|
1200
|
+
emit("input", newval);
|
|
1201
|
+
}
|
|
1202
|
+
}
|
|
1203
|
+
);
|
|
1204
|
+
const getTemplates = await api.get("/items/TTA_htmltemplates");
|
|
1205
|
+
templates.value = getTemplates.data.data.map((e) => ({
|
|
1206
|
+
text: e.name,
|
|
1207
|
+
value: e.id
|
|
1208
|
+
}));
|
|
1209
|
+
});
|
|
1210
|
+
return (_ctx, _cache) => {
|
|
1211
|
+
const _component_v_select = resolveComponent("v-select");
|
|
1212
|
+
return openBlock(), createBlock(_component_v_select, {
|
|
1213
|
+
modelValue: value.value,
|
|
1214
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => value.value = $event),
|
|
1215
|
+
items: templates.value
|
|
1216
|
+
}, null, 8, ["modelValue", "items"]);
|
|
1217
|
+
};
|
|
1218
|
+
}
|
|
1219
|
+
});
|
|
1220
|
+
|
|
1221
|
+
script.__file = "PDFTemplateSelector/src/interface.vue";
|
|
1222
|
+
|
|
1223
|
+
var e5 = defineInterface({
|
|
1224
|
+
id: "TTA-pdf-template-selector",
|
|
1225
|
+
name: "PDF template selector",
|
|
1226
|
+
icon: "box",
|
|
1227
|
+
description: "Selector for a PDF template for Text To Anything",
|
|
1228
|
+
component: script,
|
|
1229
|
+
options: null,
|
|
1230
|
+
types: ["string"]
|
|
1231
|
+
});
|
|
1232
|
+
|
|
1233
|
+
const interfaces = [e5];const displays = [];const layouts = [];const modules = [e4];const panels = [];const operations = [e0,e1,e2,e3];
|
|
1234
|
+
|
|
1235
|
+
export { displays, interfaces, layouts, modules, operations, panels };
|