@m2s2/vue-lib 2.5.3 → 2.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index25.cjs +1 -1
- package/dist/index25.mjs +1 -1
- package/dist/index27.cjs +2 -2
- package/dist/index27.mjs +198 -156
- package/dist/index29.cjs +1 -1
- package/dist/index29.mjs +1 -1
- package/dist/index31.cjs +1 -1
- package/dist/index31.mjs +1 -1
- package/dist/index77.cjs +1 -59
- package/dist/index77.mjs +5 -1149
- package/dist/index78.cjs +59 -1
- package/dist/index78.mjs +1146 -18
- package/dist/index79.cjs +1 -5
- package/dist/index79.mjs +22 -19
- package/dist/index80.cjs +5 -1
- package/dist/index80.mjs +19 -4
- package/dist/index81.cjs +1 -1
- package/dist/index81.mjs +3 -5
- package/dist/vue-lib/src/components/BlogEditor/BlogEditor.vue.d.ts +9 -0
- package/dist/vue-lib/src/components/BlogEditor/BlogEditor.vue.d.ts.map +1 -1
- package/dist/vue-lib.css +1 -1
- package/package.json +1 -1
package/dist/index25.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("vue"),o=require("./
|
|
1
|
+
"use strict";const e=require("vue"),o=require("./index79.cjs"),n={class:"m2s2-blog-card"},a={class:"bc-cover"},i=["src","alt"],s={key:1,class:"bc-cover-placeholder"},l={class:"bc-cover-tag"},r={class:"bc-inner"},d={class:"bc-meta"},m=["dateTime"],g={key:0,class:"bc-reading-time"},f={class:"bc-title"},h=["href"],k={class:"bc-summary"},u={class:"bc-tags"},E=e.defineComponent({__name:"BlogCard",props:{config:{}},setup(t){return(b,B)=>(e.openBlock(),e.createElementBlock("div",n,[e.createElementVNode("div",a,[t.config.coverImage?(e.openBlock(),e.createElementBlock("img",{key:0,src:t.config.coverImage,alt:t.config.title,class:"bc-cover-img",loading:"lazy"},null,8,i)):(e.openBlock(),e.createElementBlock("div",s,[e.createElementVNode("span",l,e.toDisplayString(t.config.tags[0]),1)]))]),e.createElementVNode("div",r,[e.createElementVNode("div",d,[e.createElementVNode("time",{dateTime:t.config.date},e.toDisplayString(e.unref(o.formatBlogDate)(t.config.date)),9,m),t.config.readingTime?(e.openBlock(),e.createElementBlock("span",g,e.toDisplayString(t.config.readingTime)+" min read",1)):e.createCommentVNode("",!0)]),e.createElementVNode("h2",f,[e.createElementVNode("a",{href:`/blog/${t.config.slug}`},e.toDisplayString(t.config.title),9,h)]),e.createElementVNode("p",k,e.toDisplayString(t.config.summary),1),e.createElementVNode("div",u,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.config.tags,c=>(e.openBlock(),e.createElementBlock("span",{key:c,class:"bc-tag"},e.toDisplayString(c),1))),128))])])]))}});module.exports=E;
|
package/dist/index25.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent as n, openBlock as c, createElementBlock as s, createElementVNode as t, toDisplayString as o, unref as a, createCommentVNode as d, Fragment as l, renderList as g } from "vue";
|
|
2
|
-
import { formatBlogDate as r } from "./
|
|
2
|
+
import { formatBlogDate as r } from "./index79.mjs";
|
|
3
3
|
const m = { class: "m2s2-blog-card" }, f = { class: "bc-cover" }, h = ["src", "alt"], b = {
|
|
4
4
|
key: 1,
|
|
5
5
|
class: "bc-cover-placeholder"
|
package/dist/index27.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const e=require("vue"),
|
|
2
|
-
`,l-1)+1;
|
|
1
|
+
"use strict";const e=require("vue"),se=require("./index78.cjs"),N=require("./index79.cjs"),re=require("./index80.cjs"),de={class:"be-root"},ue={class:"be-meta"},ce={class:"be-field be-field--full"},ve=["value"],me={class:"be-field"},be={class:"be-field"},pe={class:"be-field be-field--full"},fe={class:"be-field be-field--full"},ge={class:"be-field"},Ee={class:"be-tags"},Ve=["aria-label","onClick"],Ne={class:"be-field"},_e={class:"be-field be-field--cover"},ke={class:"be-cover"},xe=["src"],we={class:"be-cover__pick"},ye={class:"be-field be-field--full"},Te=["value"],Pe=["value"],Se={class:"be-field"},Be={class:"be-field"},Ce={key:1,class:"be-field be-field--narrow-pair"},he={class:"be-editor"},De={class:"be-toolbar",role:"toolbar","aria-label":"Formatting"},Ie=["title","onClick"],Ue={class:"be-panes"},Me={class:"be-pane be-pane--write"},Le=["value"],Re={class:"be-pane be-pane--preview"},Fe=["innerHTML"],qe={class:"be-footer"},Oe={class:"be-footer__meta"},Ae=["disabled"],Ke=e.defineComponent({__name:"BlogEditor",props:{initialPost:{default:void 0},coverImageUrl:{default:void 0},existingSeries:{default:()=>[]}},emits:["publish","coverImageSelected"],setup(S,{emit:X}){var D,I,U,M,L,R,F,q,O,A,K,$,H,G,W,j,z;const n=S,B=X,u=e.ref(((D=n.initialPost)==null?void 0:D.title)??""),v=e.ref(((I=n.initialPost)==null?void 0:I.slug)??""),_=e.ref(((U=n.initialPost)==null?void 0:U.date)??N.todayAsIsoDate()),m=e.ref(((M=n.initialPost)==null?void 0:M.summary)??""),k=e.ref(((L=n.initialPost)==null?void 0:L.excerpt)??""),i=e.ref([...((R=n.initialPost)==null?void 0:R.tags)??[]]),c=e.ref(((F=n.initialPost)==null?void 0:F.readingTime)??1),r=e.ref(((q=n.initialPost)==null?void 0:q.content)??""),x=e.ref((O=n.initialPost)==null?void 0:O.coverImage),b=e.ref(""),T=e.ref(!!n.initialPost),C=e.ref(null),d=e.ref("none"),p=e.ref(((K=(A=n.initialPost)==null?void 0:A.series)==null?void 0:K.id)??""),f=e.ref(((H=($=n.initialPost)==null?void 0:$.series)==null?void 0:H.title)??""),g=e.ref(((W=(G=n.initialPost)==null?void 0:G.series)==null?void 0:W.part)??1),E=e.ref(((z=(j=n.initialPost)==null?void 0:j.series)==null?void 0:z.total)??1);e.watch(()=>n.initialPost,a=>{var t,l,o,s;a&&(u.value=a.title,v.value=a.slug,_.value=a.date,m.value=a.summary,k.value=a.excerpt??"",i.value=[...a.tags],c.value=a.readingTime??1,r.value=a.content,x.value=a.coverImage,p.value=((t=a.series)==null?void 0:t.id)??"",f.value=((l=a.series)==null?void 0:l.title)??"",g.value=((o=a.series)==null?void 0:o.part)??1,E.value=((s=a.series)==null?void 0:s.total)??1,T.value=!0)}),e.watch([()=>n.initialPost,()=>n.existingSeries],([a,t])=>{if(!(a!=null&&a.series)){d.value="none";return}const l=t.some(o=>o.id===a.series.id);d.value=l?a.series.id:"__new__"});const Y=e.computed(()=>se.marked.parse(r.value)),h=e.computed(()=>u.value.trim().length>0&&m.value.trim().length>0&&r.value.trim().length>0),P=e.computed(()=>x.value??n.coverImageUrl);function Z(a){const t=a.target.value;if(d.value=t,t!=="none"&&t!=="__new__"){const l=n.existingSeries.find(o=>o.id===t);l&&(p.value=l.id,f.value=l.title)}}function ee(a){u.value=a.target.value,T.value||(v.value=N.generateSlug(u.value)),c.value=N.calcReadingTime(r.value)}function te(a){r.value=a.target.value,c.value=N.calcReadingTime(r.value)}function le(a){if(a.key==="Enter"||a.key===","){a.preventDefault();const t=b.value.trim().replace(/,/g,"").toLowerCase();t&&!i.value.includes(t)&&(i.value=[...i.value,t]),b.value=""}a.key==="Backspace"&&!b.value&&i.value.length&&(i.value=i.value.slice(0,-1))}function ae(a){i.value=i.value.filter(t=>t!==a)}function ne(a){var o;const t=(o=a.target.files)==null?void 0:o[0];if(!t)return;B("coverImageSelected",t);const l=new FileReader;l.onload=()=>{x.value=l.result},l.readAsDataURL(t)}function oe(a){const t=C.value;if(!t)return;const l=t.selectionStart,o=t.selectionEnd,s=r.value;let w,y;if(a.wrap){const[V,J]=a.wrap,Q=s.slice(l,o)||"text";w=s.slice(0,l)+V+Q+J+s.slice(o),y=l+V.length+Q.length+J.length}else if(a.prefix){const V=s.lastIndexOf(`
|
|
2
|
+
`,l-1)+1;w=s.slice(0,V)+a.prefix+s.slice(V),y=l+a.prefix.length}else if(a.block)w=s.slice(0,l)+a.block+s.slice(o),y=l+a.block.length;else return;r.value=w,setTimeout(()=>{t.selectionStart=t.selectionEnd=y,t.focus()},0)}function ie(){if(!h.value)return;let a;if(d.value==="__new__"){const t=p.value.trim();a=t?{id:t,title:f.value.trim()||t,part:g.value,total:E.value}:void 0}else if(d.value!=="none"){const t=n.existingSeries.find(l=>l.id===d.value);a=t?{id:t.id,title:t.title,part:g.value,total:E.value}:void 0}B("publish",{title:u.value,slug:v.value||N.generateSlug(u.value),date:_.value,summary:m.value,excerpt:k.value||void 0,tags:i.value,readingTime:c.value,content:r.value,coverImage:n.coverImageUrl??x.value,series:a})}return(a,t)=>(e.openBlock(),e.createElementBlock("div",de,[e.createElementVNode("section",ue,[e.createElementVNode("div",ce,[t[11]||(t[11]=e.createElementVNode("label",{class:"be-label"},[e.createTextVNode("Title "),e.createElementVNode("span",{class:"be-required"},"*")],-1)),e.createElementVNode("input",{class:"be-input",type:"text",value:u.value,placeholder:"Post title…",onInput:ee},null,40,ve)]),e.createElementVNode("div",me,[t[12]||(t[12]=e.createElementVNode("label",{class:"be-label"},"Slug",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":t[0]||(t[0]=l=>v.value=l),class:"be-input",type:"text",placeholder:"post-slug",onInput:t[1]||(t[1]=l=>T.value=!0)},null,544),[[e.vModelText,v.value]])]),e.createElementVNode("div",be,[t[13]||(t[13]=e.createElementVNode("label",{class:"be-label"},"Date",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":t[2]||(t[2]=l=>_.value=l),class:"be-input",type:"date"},null,512),[[e.vModelText,_.value]])]),e.createElementVNode("div",pe,[t[14]||(t[14]=e.createElementVNode("label",{class:"be-label"},[e.createTextVNode("Summary "),e.createElementVNode("span",{class:"be-required"},"*")],-1)),e.withDirectives(e.createElementVNode("textarea",{"onUpdate:modelValue":t[3]||(t[3]=l=>m.value=l),class:"be-input be-input--textarea",rows:"2",placeholder:"Short description shown in blog listings…"},null,512),[[e.vModelText,m.value]])]),e.createElementVNode("div",fe,[t[15]||(t[15]=e.createElementVNode("label",{class:"be-label"},[e.createTextVNode("Excerpt "),e.createElementVNode("span",{class:"be-optional"},"(optional)")],-1)),e.withDirectives(e.createElementVNode("textarea",{"onUpdate:modelValue":t[4]||(t[4]=l=>k.value=l),class:"be-input be-input--textarea",rows:"2",placeholder:"Longer teaser for social previews…"},null,512),[[e.vModelText,k.value]])]),e.createElementVNode("div",ge,[t[16]||(t[16]=e.createElementVNode("label",{class:"be-label"},"Tags",-1)),e.createElementVNode("div",Ee,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,l=>(e.openBlock(),e.createElementBlock("span",{key:l,class:"be-tag"},[e.createTextVNode(e.toDisplayString(l)+" ",1),e.createElementVNode("button",{type:"button",class:"be-tag__remove","aria-label":`Remove tag ${l}`,onClick:o=>ae(l)},"×",8,Ve)]))),128)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":t[5]||(t[5]=l=>b.value=l),class:"be-tag-input",type:"text",placeholder:"Add tag, press Enter…",onKeydown:le},null,544),[[e.vModelText,b.value]])])]),e.createElementVNode("div",Ne,[t[17]||(t[17]=e.createElementVNode("label",{class:"be-label"},"Reading time (min)",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":t[6]||(t[6]=l=>c.value=l),class:"be-input be-input--narrow",type:"number",min:"1"},null,512),[[e.vModelText,c.value,void 0,{number:!0}]])]),e.createElementVNode("div",_e,[t[18]||(t[18]=e.createElementVNode("label",{class:"be-label"},"Cover Image",-1)),e.createElementVNode("div",ke,[P.value?(e.openBlock(),e.createElementBlock("img",{key:0,class:"be-cover__preview",src:P.value,alt:"Cover preview"},null,8,xe)):e.createCommentVNode("",!0),e.createElementVNode("label",we,[e.createTextVNode(e.toDisplayString(P.value?"Replace":"Choose image")+" ",1),e.createElementVNode("input",{type:"file",accept:"image/*",hidden:"",onChange:ne},null,32)])])]),t[26]||(t[26]=e.createElementVNode("div",{class:"be-field-group-label"},[e.createTextVNode(" Series "),e.createElementVNode("span",{class:"be-optional"},"(optional)")],-1)),e.createElementVNode("div",ye,[t[21]||(t[21]=e.createElementVNode("label",{class:"be-label"},"Series",-1)),e.createElementVNode("select",{class:"be-input be-input--select",value:d.value,onChange:Z},[t[19]||(t[19]=e.createElementVNode("option",{value:"none"},"— None —",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(S.existingSeries,l=>(e.openBlock(),e.createElementBlock("option",{key:l.id,value:l.id},e.toDisplayString(l.title),9,Pe))),128)),t[20]||(t[20]=e.createElementVNode("option",{value:"__new__"},"+ New series…",-1))],40,Te)]),d.value==="__new__"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("div",Se,[t[22]||(t[22]=e.createElementVNode("label",{class:"be-label"},"Series ID",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":t[7]||(t[7]=l=>p.value=l),class:"be-input",type:"text",placeholder:"e.g. go-backend"},null,512),[[e.vModelText,p.value]])]),e.createElementVNode("div",Be,[t[23]||(t[23]=e.createElementVNode("label",{class:"be-label"},"Series Title",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":t[8]||(t[8]=l=>f.value=l),class:"be-input",type:"text",placeholder:"e.g. Go Backend Series"},null,512),[[e.vModelText,f.value]])])],64)):e.createCommentVNode("",!0),d.value!=="none"?(e.openBlock(),e.createElementBlock("div",Ce,[e.createElementVNode("div",null,[t[24]||(t[24]=e.createElementVNode("label",{class:"be-label"},"Part",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":t[9]||(t[9]=l=>g.value=l),class:"be-input be-input--narrow",type:"number",min:"1"},null,512),[[e.vModelText,g.value,void 0,{number:!0}]])]),e.createElementVNode("div",null,[t[25]||(t[25]=e.createElementVNode("label",{class:"be-label"},"Total Parts",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":t[10]||(t[10]=l=>E.value=l),class:"be-input be-input--narrow",type:"number",min:"1"},null,512),[[e.vModelText,E.value,void 0,{number:!0}]])])])):e.createCommentVNode("",!0)]),e.createElementVNode("section",he,[e.createElementVNode("div",De,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(re.BLOG_EDITOR_TOOLBAR),l=>(e.openBlock(),e.createElementBlock("button",{key:l.label,type:"button",class:"be-toolbar__btn",title:l.label,onClick:o=>oe(l)},e.toDisplayString(l.icon),9,Ie))),128))]),e.createElementVNode("div",Ue,[e.createElementVNode("div",Me,[t[27]||(t[27]=e.createElementVNode("div",{class:"be-pane__label"}," Markdown ",-1)),e.createElementVNode("textarea",{ref_key:"textareaEl",ref:C,class:"be-pane__textarea",value:r.value,placeholder:"Write your post in markdown…",spellcheck:"true",onInput:te},null,40,Le)]),e.createElementVNode("div",Re,[t[28]||(t[28]=e.createElementVNode("div",{class:"be-pane__label"}," Preview ",-1)),e.createElementVNode("div",{class:"be-pane__preview prose",innerHTML:Y.value},null,8,Fe)])])]),e.createElementVNode("footer",qe,[e.createElementVNode("span",Oe,"~"+e.toDisplayString(c.value)+" min read",1),e.createElementVNode("button",{type:"button",class:"be-publish",disabled:!h.value,onClick:ie}," Publish Post ",8,Ae)])]))}});module.exports=Ke;
|
package/dist/index27.mjs
CHANGED
|
@@ -1,92 +1,117 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { marked as
|
|
3
|
-
import { todayAsIsoDate as
|
|
4
|
-
import { BLOG_EDITOR_TOOLBAR as
|
|
5
|
-
const
|
|
1
|
+
import { defineComponent as we, ref as i, watch as oe, computed as B, openBlock as d, createElementBlock as v, createElementVNode as l, createTextVNode as g, withDirectives as b, vModelText as c, Fragment as L, renderList as N, toDisplayString as T, createCommentVNode as O, unref as xe } from "vue";
|
|
2
|
+
import { marked as ke } from "./index78.mjs";
|
|
3
|
+
import { todayAsIsoDate as Pe, generateSlug as ue, calcReadingTime as re } from "./index79.mjs";
|
|
4
|
+
import { BLOG_EDITOR_TOOLBAR as Se } from "./index80.mjs";
|
|
5
|
+
const Ce = { class: "be-root" }, Te = { class: "be-meta" }, Ie = { class: "be-field be-field--full" }, Ue = ["value"], Ve = { class: "be-field" }, he = { class: "be-field" }, Ee = { class: "be-field be-field--full" }, Le = { class: "be-field be-field--full" }, De = { class: "be-field" }, Re = { class: "be-tags" }, Be = ["aria-label", "onClick"], Ne = { class: "be-field" }, Oe = { class: "be-field be-field--cover" }, Ae = { class: "be-cover" }, Fe = ["src"], Ke = { class: "be-cover__pick" }, Me = { class: "be-field be-field--full" }, $e = ["value"], He = ["value"], qe = { class: "be-field" }, Ge = { class: "be-field" }, We = {
|
|
6
|
+
key: 1,
|
|
7
|
+
class: "be-field be-field--narrow-pair"
|
|
8
|
+
}, je = { class: "be-editor" }, ze = {
|
|
6
9
|
class: "be-toolbar",
|
|
7
10
|
role: "toolbar",
|
|
8
11
|
"aria-label": "Formatting"
|
|
9
|
-
},
|
|
12
|
+
}, Je = ["title", "onClick"], Qe = { class: "be-panes" }, Xe = { class: "be-pane be-pane--write" }, Ye = ["value"], Ze = { class: "be-pane be-pane--preview" }, el = ["innerHTML"], ll = { class: "be-footer" }, tl = { class: "be-footer__meta" }, sl = ["disabled"], ul = /* @__PURE__ */ we({
|
|
10
13
|
__name: "BlogEditor",
|
|
11
14
|
props: {
|
|
12
15
|
initialPost: { default: void 0 },
|
|
13
|
-
coverImageUrl: { default: void 0 }
|
|
16
|
+
coverImageUrl: { default: void 0 },
|
|
17
|
+
existingSeries: { default: () => [] }
|
|
14
18
|
},
|
|
15
19
|
emits: ["publish", "coverImageSelected"],
|
|
16
|
-
setup(
|
|
17
|
-
var
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
var e, t,
|
|
21
|
-
|
|
20
|
+
setup(A, { emit: de }) {
|
|
21
|
+
var $, H, q, G, W, j, z, J, Q, X, Y, Z, ee, le, te, se, ae;
|
|
22
|
+
const a = A, F = de, f = i((($ = a.initialPost) == null ? void 0 : $.title) ?? ""), _ = i(((H = a.initialPost) == null ? void 0 : H.slug) ?? ""), I = i(((q = a.initialPost) == null ? void 0 : q.date) ?? Pe()), y = i(((G = a.initialPost) == null ? void 0 : G.summary) ?? ""), U = i(((W = a.initialPost) == null ? void 0 : W.excerpt) ?? ""), o = i([...((j = a.initialPost) == null ? void 0 : j.tags) ?? []]), m = i(((z = a.initialPost) == null ? void 0 : z.readingTime) ?? 1), r = i(((J = a.initialPost) == null ? void 0 : J.content) ?? ""), V = i((Q = a.initialPost) == null ? void 0 : Q.coverImage), w = i(""), D = i(!!a.initialPost), K = i(null), p = i("none"), x = i(((Y = (X = a.initialPost) == null ? void 0 : X.series) == null ? void 0 : Y.id) ?? ""), k = i(((ee = (Z = a.initialPost) == null ? void 0 : Z.series) == null ? void 0 : ee.title) ?? ""), P = i(((te = (le = a.initialPost) == null ? void 0 : le.series) == null ? void 0 : te.part) ?? 1), S = i(((ae = (se = a.initialPost) == null ? void 0 : se.series) == null ? void 0 : ae.total) ?? 1);
|
|
23
|
+
oe(() => a.initialPost, (s) => {
|
|
24
|
+
var e, t, n, u;
|
|
25
|
+
s && (f.value = s.title, _.value = s.slug, I.value = s.date, y.value = s.summary, U.value = s.excerpt ?? "", o.value = [...s.tags], m.value = s.readingTime ?? 1, r.value = s.content, V.value = s.coverImage, x.value = ((e = s.series) == null ? void 0 : e.id) ?? "", k.value = ((t = s.series) == null ? void 0 : t.title) ?? "", P.value = ((n = s.series) == null ? void 0 : n.part) ?? 1, S.value = ((u = s.series) == null ? void 0 : u.total) ?? 1, D.value = !0);
|
|
26
|
+
}), oe([() => a.initialPost, () => a.existingSeries], ([s, e]) => {
|
|
27
|
+
if (!(s != null && s.series)) {
|
|
28
|
+
p.value = "none";
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
const t = e.some((n) => n.id === s.series.id);
|
|
32
|
+
p.value = t ? s.series.id : "__new__";
|
|
22
33
|
});
|
|
23
|
-
const
|
|
24
|
-
function
|
|
25
|
-
|
|
34
|
+
const ve = B(() => ke.parse(r.value)), M = B(() => f.value.trim().length > 0 && y.value.trim().length > 0 && r.value.trim().length > 0), R = B(() => V.value ?? a.coverImageUrl);
|
|
35
|
+
function be(s) {
|
|
36
|
+
const e = s.target.value;
|
|
37
|
+
if (p.value = e, e !== "none" && e !== "__new__") {
|
|
38
|
+
const t = a.existingSeries.find((n) => n.id === e);
|
|
39
|
+
t && (x.value = t.id, k.value = t.title);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function ce(s) {
|
|
43
|
+
f.value = s.target.value, D.value || (_.value = ue(f.value)), m.value = re(r.value);
|
|
26
44
|
}
|
|
27
|
-
function
|
|
28
|
-
r.value =
|
|
45
|
+
function pe(s) {
|
|
46
|
+
r.value = s.target.value, m.value = re(r.value);
|
|
29
47
|
}
|
|
30
|
-
function
|
|
31
|
-
if (
|
|
32
|
-
|
|
33
|
-
const e =
|
|
34
|
-
e && !
|
|
48
|
+
function fe(s) {
|
|
49
|
+
if (s.key === "Enter" || s.key === ",") {
|
|
50
|
+
s.preventDefault();
|
|
51
|
+
const e = w.value.trim().replace(/,/g, "").toLowerCase();
|
|
52
|
+
e && !o.value.includes(e) && (o.value = [...o.value, e]), w.value = "";
|
|
35
53
|
}
|
|
36
|
-
|
|
54
|
+
s.key === "Backspace" && !w.value && o.value.length && (o.value = o.value.slice(0, -1));
|
|
37
55
|
}
|
|
38
|
-
function
|
|
39
|
-
|
|
56
|
+
function me(s) {
|
|
57
|
+
o.value = o.value.filter((e) => e !== s);
|
|
40
58
|
}
|
|
41
|
-
function
|
|
42
|
-
var
|
|
43
|
-
const e = (
|
|
59
|
+
function ge(s) {
|
|
60
|
+
var n;
|
|
61
|
+
const e = (n = s.target.files) == null ? void 0 : n[0];
|
|
44
62
|
if (!e) return;
|
|
45
|
-
|
|
63
|
+
F("coverImageSelected", e);
|
|
46
64
|
const t = new FileReader();
|
|
47
65
|
t.onload = () => {
|
|
48
|
-
|
|
66
|
+
V.value = t.result;
|
|
49
67
|
}, t.readAsDataURL(e);
|
|
50
68
|
}
|
|
51
|
-
function
|
|
52
|
-
const e =
|
|
69
|
+
function _e(s) {
|
|
70
|
+
const e = K.value;
|
|
53
71
|
if (!e) return;
|
|
54
|
-
const t = e.selectionStart,
|
|
55
|
-
let
|
|
56
|
-
if (
|
|
57
|
-
const [
|
|
58
|
-
|
|
59
|
-
} else if (
|
|
60
|
-
const
|
|
72
|
+
const t = e.selectionStart, n = e.selectionEnd, u = r.value;
|
|
73
|
+
let h, E;
|
|
74
|
+
if (s.wrap) {
|
|
75
|
+
const [C, ie] = s.wrap, ne = u.slice(t, n) || "text";
|
|
76
|
+
h = u.slice(0, t) + C + ne + ie + u.slice(n), E = t + C.length + ne.length + ie.length;
|
|
77
|
+
} else if (s.prefix) {
|
|
78
|
+
const C = u.lastIndexOf(`
|
|
61
79
|
`, t - 1) + 1;
|
|
62
|
-
|
|
63
|
-
} else if (
|
|
64
|
-
|
|
80
|
+
h = u.slice(0, C) + s.prefix + u.slice(C), E = t + s.prefix.length;
|
|
81
|
+
} else if (s.block)
|
|
82
|
+
h = u.slice(0, t) + s.block + u.slice(n), E = t + s.block.length;
|
|
65
83
|
else
|
|
66
84
|
return;
|
|
67
|
-
r.value =
|
|
68
|
-
e.selectionStart = e.selectionEnd =
|
|
85
|
+
r.value = h, setTimeout(() => {
|
|
86
|
+
e.selectionStart = e.selectionEnd = E, e.focus();
|
|
69
87
|
}, 0);
|
|
70
88
|
}
|
|
71
|
-
function
|
|
72
|
-
if (!
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
89
|
+
function ye() {
|
|
90
|
+
if (!M.value) return;
|
|
91
|
+
let s;
|
|
92
|
+
if (p.value === "__new__") {
|
|
93
|
+
const e = x.value.trim();
|
|
94
|
+
s = e ? { id: e, title: k.value.trim() || e, part: P.value, total: S.value } : void 0;
|
|
95
|
+
} else if (p.value !== "none") {
|
|
96
|
+
const e = a.existingSeries.find((t) => t.id === p.value);
|
|
97
|
+
s = e ? { id: e.id, title: e.title, part: P.value, total: S.value } : void 0;
|
|
98
|
+
}
|
|
99
|
+
F("publish", {
|
|
100
|
+
title: f.value,
|
|
101
|
+
slug: _.value || ue(f.value),
|
|
102
|
+
date: I.value,
|
|
103
|
+
summary: y.value,
|
|
104
|
+
excerpt: U.value || void 0,
|
|
105
|
+
tags: o.value,
|
|
106
|
+
readingTime: m.value,
|
|
82
107
|
content: r.value,
|
|
83
|
-
coverImage:
|
|
84
|
-
series:
|
|
108
|
+
coverImage: a.coverImageUrl ?? V.value,
|
|
109
|
+
series: s
|
|
85
110
|
});
|
|
86
111
|
}
|
|
87
|
-
return (
|
|
112
|
+
return (s, e) => (d(), v("div", Ce, [
|
|
88
113
|
l("section", Te, [
|
|
89
|
-
l("div",
|
|
114
|
+
l("div", Ie, [
|
|
90
115
|
e[11] || (e[11] = l("label", { class: "be-label" }, [
|
|
91
116
|
g("Title "),
|
|
92
117
|
l("span", { class: "be-required" }, "*")
|
|
@@ -94,228 +119,245 @@ const ke = { class: "be-root" }, Te = { class: "be-meta" }, Ce = { class: "be-fi
|
|
|
94
119
|
l("input", {
|
|
95
120
|
class: "be-input",
|
|
96
121
|
type: "text",
|
|
97
|
-
value:
|
|
122
|
+
value: f.value,
|
|
98
123
|
placeholder: "Post title…",
|
|
99
|
-
onInput:
|
|
100
|
-
}, null, 40,
|
|
124
|
+
onInput: ce
|
|
125
|
+
}, null, 40, Ue)
|
|
101
126
|
]),
|
|
102
|
-
l("div",
|
|
127
|
+
l("div", Ve, [
|
|
103
128
|
e[12] || (e[12] = l("label", { class: "be-label" }, "Slug", -1)),
|
|
104
|
-
|
|
105
|
-
"onUpdate:modelValue": e[0] || (e[0] = (t) =>
|
|
129
|
+
b(l("input", {
|
|
130
|
+
"onUpdate:modelValue": e[0] || (e[0] = (t) => _.value = t),
|
|
106
131
|
class: "be-input",
|
|
107
132
|
type: "text",
|
|
108
133
|
placeholder: "post-slug",
|
|
109
|
-
onInput: e[1] || (e[1] = (t) =>
|
|
134
|
+
onInput: e[1] || (e[1] = (t) => D.value = !0)
|
|
110
135
|
}, null, 544), [
|
|
111
|
-
[
|
|
136
|
+
[c, _.value]
|
|
112
137
|
])
|
|
113
138
|
]),
|
|
114
|
-
l("div",
|
|
139
|
+
l("div", he, [
|
|
115
140
|
e[13] || (e[13] = l("label", { class: "be-label" }, "Date", -1)),
|
|
116
|
-
|
|
117
|
-
"onUpdate:modelValue": e[2] || (e[2] = (t) =>
|
|
141
|
+
b(l("input", {
|
|
142
|
+
"onUpdate:modelValue": e[2] || (e[2] = (t) => I.value = t),
|
|
118
143
|
class: "be-input",
|
|
119
144
|
type: "date"
|
|
120
145
|
}, null, 512), [
|
|
121
|
-
[
|
|
146
|
+
[c, I.value]
|
|
122
147
|
])
|
|
123
148
|
]),
|
|
124
|
-
l("div",
|
|
149
|
+
l("div", Ee, [
|
|
125
150
|
e[14] || (e[14] = l("label", { class: "be-label" }, [
|
|
126
151
|
g("Summary "),
|
|
127
152
|
l("span", { class: "be-required" }, "*")
|
|
128
153
|
], -1)),
|
|
129
|
-
|
|
130
|
-
"onUpdate:modelValue": e[3] || (e[3] = (t) =>
|
|
154
|
+
b(l("textarea", {
|
|
155
|
+
"onUpdate:modelValue": e[3] || (e[3] = (t) => y.value = t),
|
|
131
156
|
class: "be-input be-input--textarea",
|
|
132
157
|
rows: "2",
|
|
133
158
|
placeholder: "Short description shown in blog listings…"
|
|
134
159
|
}, null, 512), [
|
|
135
|
-
[
|
|
160
|
+
[c, y.value]
|
|
136
161
|
])
|
|
137
162
|
]),
|
|
138
|
-
l("div",
|
|
163
|
+
l("div", Le, [
|
|
139
164
|
e[15] || (e[15] = l("label", { class: "be-label" }, [
|
|
140
165
|
g("Excerpt "),
|
|
141
166
|
l("span", { class: "be-optional" }, "(optional)")
|
|
142
167
|
], -1)),
|
|
143
|
-
|
|
144
|
-
"onUpdate:modelValue": e[4] || (e[4] = (t) =>
|
|
168
|
+
b(l("textarea", {
|
|
169
|
+
"onUpdate:modelValue": e[4] || (e[4] = (t) => U.value = t),
|
|
145
170
|
class: "be-input be-input--textarea",
|
|
146
171
|
rows: "2",
|
|
147
172
|
placeholder: "Longer teaser for social previews…"
|
|
148
173
|
}, null, 512), [
|
|
149
|
-
[
|
|
174
|
+
[c, U.value]
|
|
150
175
|
])
|
|
151
176
|
]),
|
|
152
|
-
l("div",
|
|
177
|
+
l("div", De, [
|
|
153
178
|
e[16] || (e[16] = l("label", { class: "be-label" }, "Tags", -1)),
|
|
154
|
-
l("div",
|
|
155
|
-
(
|
|
179
|
+
l("div", Re, [
|
|
180
|
+
(d(!0), v(L, null, N(o.value, (t) => (d(), v("span", {
|
|
156
181
|
key: t,
|
|
157
182
|
class: "be-tag"
|
|
158
183
|
}, [
|
|
159
|
-
g(
|
|
184
|
+
g(T(t) + " ", 1),
|
|
160
185
|
l("button", {
|
|
161
186
|
type: "button",
|
|
162
187
|
class: "be-tag__remove",
|
|
163
188
|
"aria-label": `Remove tag ${t}`,
|
|
164
|
-
onClick: (
|
|
165
|
-
}, "×", 8,
|
|
189
|
+
onClick: (n) => me(t)
|
|
190
|
+
}, "×", 8, Be)
|
|
166
191
|
]))), 128)),
|
|
167
|
-
|
|
168
|
-
"onUpdate:modelValue": e[5] || (e[5] = (t) =>
|
|
192
|
+
b(l("input", {
|
|
193
|
+
"onUpdate:modelValue": e[5] || (e[5] = (t) => w.value = t),
|
|
169
194
|
class: "be-tag-input",
|
|
170
195
|
type: "text",
|
|
171
196
|
placeholder: "Add tag, press Enter…",
|
|
172
|
-
onKeydown:
|
|
197
|
+
onKeydown: fe
|
|
173
198
|
}, null, 544), [
|
|
174
|
-
[
|
|
199
|
+
[c, w.value]
|
|
175
200
|
])
|
|
176
201
|
])
|
|
177
202
|
]),
|
|
178
|
-
l("div",
|
|
203
|
+
l("div", Ne, [
|
|
179
204
|
e[17] || (e[17] = l("label", { class: "be-label" }, "Reading time (min)", -1)),
|
|
180
|
-
|
|
181
|
-
"onUpdate:modelValue": e[6] || (e[6] = (t) =>
|
|
205
|
+
b(l("input", {
|
|
206
|
+
"onUpdate:modelValue": e[6] || (e[6] = (t) => m.value = t),
|
|
182
207
|
class: "be-input be-input--narrow",
|
|
183
208
|
type: "number",
|
|
184
209
|
min: "1"
|
|
185
210
|
}, null, 512), [
|
|
186
211
|
[
|
|
187
|
-
|
|
188
|
-
|
|
212
|
+
c,
|
|
213
|
+
m.value,
|
|
189
214
|
void 0,
|
|
190
215
|
{ number: !0 }
|
|
191
216
|
]
|
|
192
217
|
])
|
|
193
218
|
]),
|
|
194
|
-
l("div",
|
|
219
|
+
l("div", Oe, [
|
|
195
220
|
e[18] || (e[18] = l("label", { class: "be-label" }, "Cover Image", -1)),
|
|
196
|
-
l("div",
|
|
197
|
-
|
|
221
|
+
l("div", Ae, [
|
|
222
|
+
R.value ? (d(), v("img", {
|
|
198
223
|
key: 0,
|
|
199
224
|
class: "be-cover__preview",
|
|
200
|
-
src:
|
|
225
|
+
src: R.value,
|
|
201
226
|
alt: "Cover preview"
|
|
202
|
-
}, null, 8,
|
|
203
|
-
l("label",
|
|
204
|
-
g(
|
|
227
|
+
}, null, 8, Fe)) : O("", !0),
|
|
228
|
+
l("label", Ke, [
|
|
229
|
+
g(T(R.value ? "Replace" : "Choose image") + " ", 1),
|
|
205
230
|
l("input", {
|
|
206
231
|
type: "file",
|
|
207
232
|
accept: "image/*",
|
|
208
233
|
hidden: "",
|
|
209
|
-
onChange:
|
|
234
|
+
onChange: ge
|
|
210
235
|
}, null, 32)
|
|
211
236
|
])
|
|
212
237
|
])
|
|
213
238
|
]),
|
|
214
|
-
e[
|
|
239
|
+
e[26] || (e[26] = l("div", { class: "be-field-group-label" }, [
|
|
215
240
|
g(" Series "),
|
|
216
241
|
l("span", { class: "be-optional" }, "(optional)")
|
|
217
242
|
], -1)),
|
|
218
243
|
l("div", Me, [
|
|
219
|
-
e[
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
244
|
+
e[21] || (e[21] = l("label", { class: "be-label" }, "Series", -1)),
|
|
245
|
+
l("select", {
|
|
246
|
+
class: "be-input be-input--select",
|
|
247
|
+
value: p.value,
|
|
248
|
+
onChange: be
|
|
249
|
+
}, [
|
|
250
|
+
e[19] || (e[19] = l("option", { value: "none" }, "— None —", -1)),
|
|
251
|
+
(d(!0), v(L, null, N(A.existingSeries, (t) => (d(), v("option", {
|
|
252
|
+
key: t.id,
|
|
253
|
+
value: t.id
|
|
254
|
+
}, T(t.title), 9, He))), 128)),
|
|
255
|
+
e[20] || (e[20] = l("option", { value: "__new__" }, "+ New series…", -1))
|
|
256
|
+
], 40, $e)
|
|
228
257
|
]),
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
"
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
258
|
+
p.value === "__new__" ? (d(), v(L, { key: 0 }, [
|
|
259
|
+
l("div", qe, [
|
|
260
|
+
e[22] || (e[22] = l("label", { class: "be-label" }, "Series ID", -1)),
|
|
261
|
+
b(l("input", {
|
|
262
|
+
"onUpdate:modelValue": e[7] || (e[7] = (t) => x.value = t),
|
|
263
|
+
class: "be-input",
|
|
264
|
+
type: "text",
|
|
265
|
+
placeholder: "e.g. go-backend"
|
|
266
|
+
}, null, 512), [
|
|
267
|
+
[c, x.value]
|
|
268
|
+
])
|
|
269
|
+
]),
|
|
270
|
+
l("div", Ge, [
|
|
271
|
+
e[23] || (e[23] = l("label", { class: "be-label" }, "Series Title", -1)),
|
|
272
|
+
b(l("input", {
|
|
273
|
+
"onUpdate:modelValue": e[8] || (e[8] = (t) => k.value = t),
|
|
274
|
+
class: "be-input",
|
|
275
|
+
type: "text",
|
|
276
|
+
placeholder: "e.g. Go Backend Series"
|
|
277
|
+
}, null, 512), [
|
|
278
|
+
[c, k.value]
|
|
279
|
+
])
|
|
238
280
|
])
|
|
239
|
-
]),
|
|
240
|
-
|
|
281
|
+
], 64)) : O("", !0),
|
|
282
|
+
p.value !== "none" ? (d(), v("div", We, [
|
|
241
283
|
l("div", null, [
|
|
242
|
-
e[
|
|
243
|
-
|
|
244
|
-
"onUpdate:modelValue": e[9] || (e[9] = (t) =>
|
|
284
|
+
e[24] || (e[24] = l("label", { class: "be-label" }, "Part", -1)),
|
|
285
|
+
b(l("input", {
|
|
286
|
+
"onUpdate:modelValue": e[9] || (e[9] = (t) => P.value = t),
|
|
245
287
|
class: "be-input be-input--narrow",
|
|
246
288
|
type: "number",
|
|
247
289
|
min: "1"
|
|
248
290
|
}, null, 512), [
|
|
249
291
|
[
|
|
250
|
-
|
|
251
|
-
|
|
292
|
+
c,
|
|
293
|
+
P.value,
|
|
252
294
|
void 0,
|
|
253
295
|
{ number: !0 }
|
|
254
296
|
]
|
|
255
297
|
])
|
|
256
298
|
]),
|
|
257
299
|
l("div", null, [
|
|
258
|
-
e[
|
|
259
|
-
|
|
260
|
-
"onUpdate:modelValue": e[10] || (e[10] = (t) =>
|
|
300
|
+
e[25] || (e[25] = l("label", { class: "be-label" }, "Total Parts", -1)),
|
|
301
|
+
b(l("input", {
|
|
302
|
+
"onUpdate:modelValue": e[10] || (e[10] = (t) => S.value = t),
|
|
261
303
|
class: "be-input be-input--narrow",
|
|
262
304
|
type: "number",
|
|
263
305
|
min: "1"
|
|
264
306
|
}, null, 512), [
|
|
265
307
|
[
|
|
266
|
-
|
|
267
|
-
|
|
308
|
+
c,
|
|
309
|
+
S.value,
|
|
268
310
|
void 0,
|
|
269
311
|
{ number: !0 }
|
|
270
312
|
]
|
|
271
313
|
])
|
|
272
314
|
])
|
|
273
|
-
])
|
|
315
|
+
])) : O("", !0)
|
|
274
316
|
]),
|
|
275
|
-
l("section",
|
|
276
|
-
l("div",
|
|
277
|
-
(
|
|
317
|
+
l("section", je, [
|
|
318
|
+
l("div", ze, [
|
|
319
|
+
(d(!0), v(L, null, N(xe(Se), (t) => (d(), v("button", {
|
|
278
320
|
key: t.label,
|
|
279
321
|
type: "button",
|
|
280
322
|
class: "be-toolbar__btn",
|
|
281
323
|
title: t.label,
|
|
282
|
-
onClick: (
|
|
283
|
-
},
|
|
324
|
+
onClick: (n) => _e(t)
|
|
325
|
+
}, T(t.icon), 9, Je))), 128))
|
|
284
326
|
]),
|
|
285
|
-
l("div",
|
|
286
|
-
l("div",
|
|
287
|
-
e[
|
|
327
|
+
l("div", Qe, [
|
|
328
|
+
l("div", Xe, [
|
|
329
|
+
e[27] || (e[27] = l("div", { class: "be-pane__label" }, " Markdown ", -1)),
|
|
288
330
|
l("textarea", {
|
|
289
331
|
ref_key: "textareaEl",
|
|
290
|
-
ref:
|
|
332
|
+
ref: K,
|
|
291
333
|
class: "be-pane__textarea",
|
|
292
334
|
value: r.value,
|
|
293
335
|
placeholder: "Write your post in markdown…",
|
|
294
336
|
spellcheck: "true",
|
|
295
|
-
onInput:
|
|
296
|
-
}, null, 40,
|
|
337
|
+
onInput: pe
|
|
338
|
+
}, null, 40, Ye)
|
|
297
339
|
]),
|
|
298
|
-
l("div",
|
|
299
|
-
e[
|
|
340
|
+
l("div", Ze, [
|
|
341
|
+
e[28] || (e[28] = l("div", { class: "be-pane__label" }, " Preview ", -1)),
|
|
300
342
|
l("div", {
|
|
301
343
|
class: "be-pane__preview prose",
|
|
302
|
-
innerHTML:
|
|
303
|
-
}, null, 8,
|
|
344
|
+
innerHTML: ve.value
|
|
345
|
+
}, null, 8, el)
|
|
304
346
|
])
|
|
305
347
|
])
|
|
306
348
|
]),
|
|
307
|
-
l("footer",
|
|
308
|
-
l("span",
|
|
349
|
+
l("footer", ll, [
|
|
350
|
+
l("span", tl, "~" + T(m.value) + " min read", 1),
|
|
309
351
|
l("button", {
|
|
310
352
|
type: "button",
|
|
311
353
|
class: "be-publish",
|
|
312
|
-
disabled: !
|
|
313
|
-
onClick:
|
|
314
|
-
}, " Publish Post ", 8,
|
|
354
|
+
disabled: !M.value,
|
|
355
|
+
onClick: ye
|
|
356
|
+
}, " Publish Post ", 8, sl)
|
|
315
357
|
])
|
|
316
358
|
]));
|
|
317
359
|
}
|
|
318
360
|
});
|
|
319
361
|
export {
|
|
320
|
-
|
|
362
|
+
ul as default
|
|
321
363
|
};
|