@oktis-works/admin 0.13.1 → 0.15.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/client/_astro/{ActivityWidget.CCls_jrK.js → ActivityWidget.CedrZ3yN.js} +2 -2
- package/dist/client/_astro/AdminBar.CkfSUzJJ.js +253 -0
- package/dist/client/_astro/ApiKeysManager.ChCtr3J2.js +1 -0
- package/dist/client/_astro/{AtGlanceWidget.DPkp-rxl.js → AtGlanceWidget.DMrAc7qb.js} +3 -3
- package/dist/client/_astro/{BaseLayout.DAkzjMTq.css → BaseLayout.Cp-O10m_.css} +1 -1
- package/dist/client/_astro/CommentsManager.CtiI8mwU.js +21 -0
- package/dist/client/_astro/ContentEditor.BQTSumnU.js +1 -0
- package/dist/client/_astro/ContentEditor.Bl295osh.js +3 -0
- package/dist/client/_astro/ContentTypeWorkspace.xZAsn-ok.js +1 -0
- package/dist/client/_astro/DashboardHome.B7PYDcS1.js +1 -0
- package/dist/client/_astro/{DashboardLayout.astro_astro_type_script_index_0_lang.D2eyDf2o.js → DashboardLayout.astro_astro_type_script_index_0_lang.BFY8jBwE.js} +1 -1
- package/dist/client/_astro/FbIcon.Bn4e_qFb.js +1 -0
- package/dist/client/_astro/FieldGroupEditor.BsV0u51p.js +69 -0
- package/dist/client/_astro/FieldGroupList.CXyFKdsR.js +1 -0
- package/dist/client/_astro/FieldRenderer.2TxRD88c.js +1 -0
- package/dist/client/_astro/FloatingPanel.BetdW5N2.js +1 -0
- package/dist/client/_astro/{Footer.JI2Mqd9V.js → Footer.BKD9_ctB.js} +2 -2
- package/dist/client/_astro/GeneralSettings.Di8ILdOl.js +1 -0
- package/dist/client/_astro/LogsManager.WBGR0Ci2.js +1 -0
- package/dist/client/_astro/MediaLibrary.B5ozN2R7.js +1 -0
- package/dist/client/_astro/MenuManager.9UORktNs.js +1 -0
- package/dist/client/_astro/Modal.CPaZJlDP.js +1 -0
- package/dist/client/_astro/PluginManager._RYLLtJI.js +112 -0
- package/dist/client/_astro/PostTypesManager.B6dDnCOy.js +1 -0
- package/dist/client/_astro/QuickDraftWidget.DCVYrBPm.js +17 -0
- package/dist/client/_astro/ResourceHubs.Cd0KB4Rx.js +1 -0
- package/dist/client/_astro/TaxonomiesManager.9I03xqrR.js +1 -0
- package/dist/client/_astro/TaxonomyTermsManager.btLVdHr-.js +1 -0
- package/dist/client/_astro/ThemeCustomizer.CXg9hm9t.js +49 -0
- package/dist/client/_astro/ThemeManager.BfQh8JJa.js +144 -0
- package/dist/client/_astro/UserCreateForm.BAd11jYs.js +1 -0
- package/dist/client/_astro/UsersManager.gkehfvoP.js +1 -0
- package/dist/client/_astro/WebhooksManager.BCilUaGs.js +1 -0
- package/dist/client/_astro/{api.CYg1SW2X.js → api.B03e8F6d.js} +1 -1
- package/dist/client/_astro/client.ljtU74WL.js +1 -0
- package/dist/client/_astro/extensions.EzvpwBZm.js +1 -0
- package/dist/client/_astro/i18n.LMZI7jyc.js +1 -0
- package/dist/client/_astro/{login.astro_astro_type_script_index_0_lang.F2J3xZhK.js → login.astro_astro_type_script_index_0_lang.BUOUZuDy.js} +1 -1
- package/dist/client/_astro/preload-helper.oCYlU9a4.js +1 -0
- package/dist/client/_astro/pt-BR.CfJP86YC.js +1 -0
- package/dist/client/_astro/solid.Ck4Vtfe4.js +1 -0
- package/dist/client/_astro/src.CYKGYEyR.js +1 -0
- package/dist/client/_astro/store.DJjOMYcw.js +1 -0
- package/dist/client/_astro/web.DD6VKaIp.js +1 -0
- package/dist/server/chunks/{404_C9Eokbcv.mjs → 404_CIlW8Cz9.mjs} +1 -1
- package/dist/server/chunks/{BaseLayout_DgDmTH8p.mjs → BaseLayout_DdN9Gl3i.mjs} +5 -5
- package/dist/server/chunks/ContentEditor_GenRIOIJ.mjs +655 -0
- package/dist/server/chunks/{DashboardLayout_CrxyUavx.mjs → DashboardLayout_BY4AqWC6.mjs} +354 -91
- package/dist/server/chunks/{ContentEditor_VK16JJMh.mjs → FieldRenderer_pM3Tq7vY.mjs} +54 -615
- package/dist/server/chunks/{MediaLibrary_CZuj5byR.mjs → MediaLibrary_woj8kWSK.mjs} +2 -2
- package/dist/server/chunks/{Modal_BfWFiyry.mjs → Modal_BQZlVP1o.mjs} +1 -1
- package/dist/server/chunks/{_id__BYx77RvL.mjs → _id__CIrIQBGk.mjs} +5 -4
- package/dist/server/chunks/{_slug__CR6t9xra.mjs → _slug__DP5cppSD.mjs} +1 -1
- package/dist/server/chunks/{access_Bp3EnO2H.mjs → access_Cr1RkoC8.mjs} +3 -3
- package/dist/server/chunks/{api-keys_Dt87wCbg.mjs → api-keys_DxCfUQiR.mjs} +3 -3
- package/dist/server/chunks/comments_CDCO_DTQ.mjs +208 -0
- package/dist/server/chunks/{custom-fields_CC_ZhBpp.mjs → custom-fields_DUby1Cd7.mjs} +2 -2
- package/dist/server/chunks/customize_DITLWxTB.mjs +233 -0
- package/dist/server/chunks/{edit_VYWajKgt.mjs → edit_6xBPrb1J.mjs} +3 -3
- package/dist/server/chunks/{general_DtYlpwnZ.mjs → general_CA6aT6cZ.mjs} +2 -2
- package/dist/server/chunks/{i18n_B-DWAN0e.mjs → i18n_BBVOgA0q.mjs} +75 -36
- package/dist/server/chunks/{index_CDmqkl48.mjs → index_1C4PfYEy.mjs} +2 -2
- package/dist/server/chunks/{index_ieyhXCVt.mjs → index_CO2SvpwW.mjs} +1 -1
- package/dist/server/chunks/{index_DXmHKYjS.mjs → index_Cn92C8CO.mjs} +2 -2
- package/dist/server/chunks/{index_6a-jaApt.mjs → index_D2ypKpAG.mjs} +111 -62
- package/dist/server/chunks/{index_DgVVWosZ.mjs → index_D_AiNQGl.mjs} +2 -2
- package/dist/server/chunks/{login_DRJNLDt7.mjs → login_vyj4WhBt.mjs} +1 -1
- package/dist/server/chunks/{logs_CaMNxV6h.mjs → logs_BjuW-do3.mjs} +2 -2
- package/dist/server/chunks/{menus_BsV0U5D5.mjs → menus_CPi_m-b8.mjs} +2 -2
- package/dist/server/chunks/{new_BQ2d8AHk.mjs → new_BlENJv6A.mjs} +3 -3
- package/dist/server/chunks/{new_CyBl1PM1.mjs → new_D_pNdD5e.mjs} +2 -2
- package/dist/server/chunks/plugins_sYgOSowJ.mjs +150 -0
- package/dist/server/chunks/{post-types_BBKtACUm.mjs → post-types_Bm8olePm.mjs} +2 -2
- package/dist/server/chunks/{pt-BR_Da5G4GOV.mjs → pt-BR_DYDMLZu_.mjs} +53 -24
- package/dist/server/chunks/{taxonomies_gwfTSCOV.mjs → taxonomies_DbsqX_QZ.mjs} +2 -2
- package/dist/server/chunks/{taxonomy_BKdLzLps.mjs → taxonomy_ByKdjp9j.mjs} +64 -19
- package/dist/server/chunks/{themes_CqOUZiNg.mjs → themes_BKAM_crI.mjs} +27 -129
- package/dist/server/chunks/{upload_keeE9Mn0.mjs → upload_CE4Lbc1u.mjs} +2 -2
- package/dist/server/chunks/{webhooks_sTUPF0Xn.mjs → webhooks_CpruP30e.mjs} +2 -2
- package/dist/server/entry.mjs +104 -50
- package/dist/server/virtual_astro_middleware.mjs +1 -1
- package/package.json +5 -5
- package/dist/client/_astro/AdminBar.BW8zYZI3.js +0 -253
- package/dist/client/_astro/ApiKeysManager.Cj5tsk4N.js +0 -1
- package/dist/client/_astro/ContentEditor.CByEz10Q.js +0 -3
- package/dist/client/_astro/ContentEditor.kdYzULib.js +0 -1
- package/dist/client/_astro/ContentTypeWorkspace.BMVbiGGy.js +0 -1
- package/dist/client/_astro/DashboardHome.BuDu0DuB.js +0 -1
- package/dist/client/_astro/FbIcon.CUNS6rpP.js +0 -1
- package/dist/client/_astro/FieldGroupEditor.DGjV1n67.js +0 -69
- package/dist/client/_astro/FieldGroupList.BJ2TKSgY.js +0 -1
- package/dist/client/_astro/FloatingPanel.BeCEt_JP.js +0 -1
- package/dist/client/_astro/GeneralSettings.BSObhTfM.js +0 -1
- package/dist/client/_astro/LogsManager.B4-BxzoP.js +0 -1
- package/dist/client/_astro/MediaLibrary.BHVM3oJh.js +0 -1
- package/dist/client/_astro/MenuManager.BAn4_w6-.js +0 -1
- package/dist/client/_astro/Modal.BSZ5IjBl.js +0 -1
- package/dist/client/_astro/PluginManager.D_E-lPWP.js +0 -136
- package/dist/client/_astro/PostTypesManager.BHU1d2ta.js +0 -1
- package/dist/client/_astro/QuickDraftWidget.ClSsMYB_.js +0 -17
- package/dist/client/_astro/ResourceHubs.C3suqlP0.js +0 -1
- package/dist/client/_astro/TaxonomiesManager.BXYUiJEA.js +0 -1
- package/dist/client/_astro/TaxonomyTermsManager.obB3lkr3.js +0 -1
- package/dist/client/_astro/ThemeManager.C0TKggfZ.js +0 -176
- package/dist/client/_astro/UserCreateForm.DaIOqr8v.js +0 -1
- package/dist/client/_astro/UsersManager.B5zFoWmR.js +0 -1
- package/dist/client/_astro/WebhooksManager.BRvVuxLt.js +0 -1
- package/dist/client/_astro/client.DU9Dc2oe.js +0 -1
- package/dist/client/_astro/extensions.Brl6zAPA.js +0 -1
- package/dist/client/_astro/i18n.vdBFsiPK.js +0 -1
- package/dist/client/_astro/pt-BR.CKJnipDe.js +0 -1
- package/dist/client/_astro/solid.D49dPDCT.js +0 -1
- package/dist/client/_astro/src.DXVWCoHp.js +0 -1
- package/dist/client/_astro/web.Bqbl_1YR.js +0 -1
- package/dist/server/chunks/plugins_BiaE4So1.mjs +0 -179
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{S as e,a as t,f as n,h as r,l as i,p as a,r as o}from"./solid.Ck4Vtfe4.js";import{_ as s,a as c,f as l,l as u,m as d,o as f,p,s as m,u as h,v as g}from"./web.DD6VKaIp.js";import{a as _,i as v,n as y,o as b,r as x,s as S}from"./i18n.LMZI7jyc.js";import{n as C}from"./api.B03e8F6d.js";import{i as w,n as T,r as E,s as D}from"./src.CYKGYEyR.js";import{t as O}from"./FloatingPanel.BetdW5N2.js";var k=s(`<input type=search class="input tz-select__search">`),A=s(`<div class=tz-select__options>`),j=s(`<div class=tz-select><button type=button class="input tz-select__trigger"aria-haspopup=listbox><span class=tz-select__value></span><span aria-hidden=true></span></button><!$><!/>`),M=s(`<p class=tz-select__empty>—`),N=s(`<button type=button role=option class=tz-select__option>`),P=new Map;function F(e){let t=P.get(e);t||(t=new Intl.DateTimeFormat(`en-US`,{timeZone:e,timeZoneName:`longOffset`}),P.set(e,t));let n=(t.formatToParts(new Date).find(e=>e.type===`timeZoneName`)?.value??`GMT`).match(/GMT([+-])(\d{2}):(\d{2})/);if(!n)return{label:`UTC+00:00`,minutes:0};let r=(n[1]===`-`?-1:1)*(Number(n[2])*60+Number(n[3]));return{label:`UTC${n[1]}${n[2]}:${n[3]}`,minutes:r}}function I(){let e=Intl,t=(typeof e.supportedValuesOf==`function`?e.supportedValuesOf(`timeZone`):[`UTC`]).map(e=>{let{label:t,minutes:n}=F(e);return{tz:e,label:`(UTC${t.slice(3)}) ${e}`,minutes:n}});return t.sort((e,t)=>e.minutes-t.minutes||e.tz.localeCompare(t.tz)),[{tz:`UTC`,label:`(UTC+00:00) UTC`,minutes:0},...t]}var L=e=>e.toLowerCase().replace(/[/_\-]/g,` `);function R(e){let[s,c]=r(!1),[h,_]=r(``),v,[y,b]=r(void 0),x=n(()=>I()),S=n(()=>x().find(t=>t.tz===e.value)),C=n(()=>{let e=L(h().trim());return e?x().filter(t=>L(t.label).includes(e)):x()});return(()=>{var n=f(j),r=n.firstChild,x=r.firstChild,w=x.nextSibling,T=r.nextSibling,[E,D]=m(T.nextSibling),P=v;return typeof P==`function`?g(P,n):v=n,r.$$click=()=>c(!s()),g(b,r),u(x,()=>S()?.label??e.placeholder??``),u(w,()=>s()?`▴`:`▾`),u(n,i(O,{get open(){return s()},get trigger(){return y()},onClose:()=>{c(!1),_(``)},class:`tz-select__panel`,role:`listbox`,minWidth:320,get children(){return[(()=>{var t=f(k);return g(e=>queueMicrotask(()=>e.focus()),t),t.$$input=e=>_(e.currentTarget.value),a(()=>p(t,`placeholder`,e.searchPlaceholder??e.placeholder??``)),a(()=>d(t,`value`,h())),l(),t})(),(()=>{var n=f(A);return u(n,i(t,{get when(){return C().length>0},get fallback(){return f(M)},get children(){return i(o,{get each(){return C()},children:t=>(()=>{var n=f(N);return n.$$click=()=>{e.onChange(t.tz),c(!1),_(``)},u(n,()=>t.label),a(r=>{var i=e.value===t.tz,a=e.value===t.tz;return i!==r.e&&p(n,`aria-selected`,r.e=i),a!==r.t&&n.classList.toggle(`is-selected`,r.t=a),r},{e:void 0,t:void 0}),l(),n})()})}})),n})()]}}),E,D),a(()=>p(r,`aria-expanded`,s())),l(),n})()}c([`click`,`input`]);var z=s(`<div class="notice notice--error">`),B=s(`<div class=notice>`),V=s(`<form><div class=form-grid></div><div class=media-details__actions>`),H=s(`<div class=general-settings><!$><!/><!$><!/><!$><!/>`),U=s(`<p class=muted>`),W=s(`<label class=general-settings__tz><!$><!/><!$><!/>`);function G(){let{t:a}=y(),[o,s]=r({}),[c,l]=r(``),[d,p]=r(!1),[g,O]=r(``),[k,A]=r(``),[j,M]=r(!1),N=n(()=>b.map(e=>({value:e,label:`${v[e]} ${_[e]}`}))),P=n(()=>[{key:`siteTitle`,label:a(`settings.general.fields.siteTitle`),type:`text`,placeholder:a(`settings.general.fields.siteTitlePlaceholder`)},{key:`siteDescription`,label:a(`settings.general.fields.siteDescription`),type:`text`,placeholder:a(`settings.general.fields.siteDescriptionPlaceholder`)},{key:`language`,label:a(`settings.general.fields.language`),type:`select`,options:N()},{key:`timezone`,label:a(`settings.general.fields.timezone`),type:`timezone`,placeholder:a(`settings.general.fields.timezonePlaceholder`)}]);e(async()=>{try{let e=await C.getSettings(`general`),t={};for(let n of e)t[n.key]=typeof n.value==`string`?n.value:JSON.stringify(n.value??``);for(let e of P())t[e.key]===void 0&&(t[e.key]=``);if(!t.timezone)try{t.timezone=Intl.DateTimeFormat().resolvedOptions().timeZone??`UTC`}catch{t.timezone=`UTC`}l(t.language??``),s(t),p(!0)}catch(e){O(e instanceof Error?e.message:String(e))}});let F=async e=>{e.preventDefault(),O(``),A(``),M(!0);try{let e=await C.getSettings(`general`),t=new Map(e.map(e=>[e.key,e]));await C.updateSettings(P().map(e=>{let n=t.get(e.key);return{key:e.key,value:o()[e.key]??``,group:n?.group??`general`,type:n?.type??`string`}}));let n=o().language??``;if(S(n)&&n!==c()){x(n),window.location.reload();return}A(a(`settings.general.saved`))}catch(e){O(e instanceof Error?e.message:String(e))}finally{M(!1)}};return(()=>{var e=f(H),n=e.firstChild,[r,c]=m(n.nextSibling),l=r.nextSibling,[p,_]=m(l.nextSibling),v=p.nextSibling,[y,b]=m(v.nextSibling);return u(e,i(t,{get when(){return g()},get children(){var e=f(z);return u(e,g),e}}),r,c),u(e,i(t,{get when(){return k()},get children(){var e=f(B);return u(e,k),e}}),p,_),u(e,i(t,{get when(){return d()},get fallback(){return(()=>{var e=f(U);return u(e,()=>a(`settings.general.loading`)),e})()},get children(){return i(E,{get children(){var e=f(V),t=e.firstChild,n=t.nextSibling;return e.addEventListener(`submit`,F),u(t,()=>P().map(e=>e.type===`select`?i(D,{get name(){return e.key},get label(){return e.label},get value(){return o()[e.key]??``},get options(){return e.options??[]},onChange:t=>s({...o(),[e.key]:t})}):e.type===`timezone`?(()=>{var t=f(W),n=t.firstChild,[r,a]=m(n.nextSibling),c=r.nextSibling,[l,d]=m(c.nextSibling);return u(t,()=>e.label,r,a),u(t,i(R,{get value(){return o()[e.key]??``},get placeholder(){return e.placeholder??``},get searchPlaceholder(){return e.placeholder??``},onChange:t=>s({...o(),[e.key]:t})}),l,d),t})():i(w,{get name(){return e.key},get label(){return e.label},get placeholder(){return h(()=>`placeholder`in e)()?e.placeholder:``},get value(){return o()[e.key]??``},onInput:t=>s({...o(),[e.key]:t})}))),u(n,i(T,{variant:`primary`,type:`submit`,get disabled(){return j()},get loading(){return j()},get children(){return a(`settings.general.save`)}})),e}})}}),y,b),e})()}export{G as GeneralSettings};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{S as e,a as t,h as n,l as r,p as i,r as a}from"./solid.Ck4Vtfe4.js";import{_ as o,a as s,f as c,l,m as u,o as d,p as f,s as p,u as m}from"./web.DD6VKaIp.js";import{n as h}from"./i18n.LMZI7jyc.js";import{n as g}from"./api.B03e8F6d.js";var _=o(`<div class="notice notice--error">`),v=o(`<div class="notice notice--success">`),y=o(`<div class=table-scroll><table class=table><thead><tr><th></th><th></th><th></th><th></th><th></th><th></th></tr></thead><tbody>`),b=o(`<div class="resource-hub logs-manager"><!$><!/><!$><!/><section class=card><div class=card-header-row><div><h3></h3><p></p></div></div><form class="resource-form logs-retention-form"><label><!$><!/><input class=input type=number min=1 max=3650 required></label><button class="btn btn-primary"type=submit></button></form></section><section class=card><div class=card-header-row><h3></h3><button class=btn type=button></button></div><div class=logs-filters><input class=input><input class=input><button class=btn type=button></button></div><!$><!/>`),x=o(`<p>`),S=o(`<tr><td></td><td><code></code></td><td><!$><!/><!$><!/></td><td></td><td></td><td>`);function C(){let{t:o}=h(),[s,C]=n([]),[w,T]=n(90),[E,D]=n(``),[O,k]=n(``),[A,j]=n(``),[M,N]=n(``),[P,F]=n(!0),I=async()=>{F(!0),j(``);try{let[e,t]=await Promise.all([g.getAuditLogConfig(),g.listAuditLogs({limit:500,action:E()||void 0,resourceType:O()||void 0})]);T(e.retentionDays),C(t.data)}catch(e){j(e instanceof Error?e.message:String(e))}finally{F(!1)}};e(I);let L=async e=>{e.preventDefault();try{let e=await g.updateAuditLogConfig(w());T(e.retentionDays),N(o(`logs.retentionSaved`)),await I()}catch(e){j(e instanceof Error?e.message:String(e))}};return(()=>{var e=d(b),n=e.firstChild,[h,g]=p(n.nextSibling),C=h.nextSibling,[j,N]=p(C.nextSibling),F=j.nextSibling,R=F.firstChild,z=R.firstChild.firstChild,B=z.nextSibling,V=R.nextSibling,H=V.firstChild,U=H.firstChild,[W,ee]=p(U.nextSibling),G=W.nextSibling,te=H.nextSibling,K=F.nextSibling,q=K.firstChild,J=q.firstChild,Y=J.nextSibling,X=q.nextSibling,Z=X.firstChild,Q=Z.nextSibling,$=Q.nextSibling,ne=X.nextSibling,[re,ie]=p(ne.nextSibling);return l(e,r(t,{get when(){return A()},get children(){var e=d(_);return l(e,A),e}}),h,g),l(e,r(t,{get when(){return M()},get children(){var e=d(v);return l(e,M),e}}),j,N),l(z,()=>o(`logs.retentionTitle`)),l(B,()=>o(`logs.retentionDescription`)),V.addEventListener(`submit`,L),l(H,()=>o(`logs.retentionDays`),W,ee),G.$$input=e=>T(Number(e.currentTarget.value)),l(te,()=>o(`common.save`)),l(J,()=>o(`logs.historyTitle`)),Y.$$click=()=>void I(),l(Y,()=>o(`common.refresh`)),Z.$$input=e=>D(e.currentTarget.value),Q.$$input=e=>k(e.currentTarget.value),$.$$click=()=>void I(),l($,()=>o(`common.filter`)),l(K,r(t,{get when(){return!P()},get fallback(){return(()=>{var e=d(x);return l(e,()=>o(`logs.loading`)),e})()},get children(){return r(t,{get when(){return s().length>0},get fallback(){return(()=>{var e=d(x);return l(e,()=>o(`logs.empty`)),e})()},get children(){var e=d(y),t=e.firstChild.firstChild,n=t.firstChild.firstChild,i=n.nextSibling,c=i.nextSibling,u=c.nextSibling,f=u.nextSibling,h=f.nextSibling,g=t.nextSibling;return l(n,()=>o(`logs.columns.date`)),l(i,()=>o(`logs.columns.action`)),l(c,()=>o(`logs.columns.resource`)),l(u,()=>o(`logs.columns.user`)),l(f,()=>o(`logs.columns.status`)),l(h,()=>o(`logs.columns.ip`)),l(g,r(a,{get each(){return s()},children:e=>(()=>{var t=d(S),n=t.firstChild,r=n.nextSibling,i=r.firstChild,a=r.nextSibling,s=a.firstChild,[c,u]=p(s.nextSibling),f=c.nextSibling,[h,g]=p(f.nextSibling),_=a.nextSibling,v=_.nextSibling,y=v.nextSibling;return l(n,(()=>{var t=m(()=>!!e.created_at);return()=>t()?new Date(e.created_at).toLocaleString():`—`})()),l(i,()=>e.action),l(a,()=>e.resourceType,c,u),l(a,(()=>{var t=m(()=>!!e.resourceId);return()=>t()?`:${e.resourceId}`:``})(),h,g),l(_,()=>e.userId??o(`logs.system`)),l(v,()=>String(e.changes?.status??`—`)),l(y,()=>e.ipAddress??`—`),t})()})),e}})}}),re,ie),i(e=>{var t=o(`logs.actionFilter`),n=o(`logs.resourceFilter`);return t!==e.e&&f(Z,`placeholder`,e.e=t),n!==e.t&&f(Q,`placeholder`,e.t=n),e},{e:void 0,t:void 0}),i(()=>u(G,`value`,w())),i(()=>u(Z,`value`,E())),i(()=>u(Q,`value`,O())),c(),e})()}s([`input`,`click`]);export{C as LogsManager};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{S as e,a as t,h as n,l as r,p as i,r as a}from"./solid.Ck4Vtfe4.js";import{_ as o,a as s,f as ee,l as c,m as l,o as u,p as d,s as f,u as p}from"./web.DD6VKaIp.js";import{n as m}from"./i18n.LMZI7jyc.js";import{n as h}from"./api.B03e8F6d.js";import{a as g,i as _,n as v,o as y,s as te}from"./src.CYKGYEyR.js";var ne=o(`<div class="notice notice--error">`),re=o(`<div class=notice>`),ie=o(`<div class=media-grid>`),ae=o(`<div class=media-library><!$><!/><!$><!/><div class=upload-zone><p><strong></strong> ou</p><label class="btn btn-primary"style=cursor:pointer><!$><!/><input type=file multiple style=display:none></label><p class=muted></p></div><div class=toolbar><!$><!/><!$><!/><!$><!/></div><!$><!/><!$><!/><!$><!/>`),oe=o(`<p class=muted>`),se=o(`<img loading=lazy>`,!0,!1,!1),ce=o(`<button type=button class=media-card><div class=media-card__preview></div><div class=media-card__meta><span class=media-card__name></span><span class=muted><!$><!/> · <!$><!/>`),le=o(`<span class=media-card__ext>`),ue=o(`<img>`),de=o(`<video controls>`),fe=o(`<audio controls>`),pe=o(`<iframe>`),me=o(`<div class="media-card__ext media-modal__file-icon">`),he=o(`<dt>`),ge=o(`<dd>`),_e=o(`<div class=media-modal><div class=media-modal__preview><!$><!/><!$><!/><!$><!/><!$><!/><!$><!/></div><div class=media-modal__layout><div class=media-modal__fields><!$><!/><!$><!/><!$><!/><label class=field__label><!$><!/><textarea class="input media-modal__textarea"name=media-description></textarea></label></div><dl class="media-details__list media-modal__facts"><dt></dt><dd></dd><dt></dt><dd></dd><dt></dt><dd></dd><!$><!/><dt></dt><dd></dd><dt></dt><dd class=media-details__url><code></code><button class="btn btn-secondary btn-sm"type=button></button></dd></dl></div><div class=media-modal__replace><label class="btn btn-secondary"style=cursor:pointer><!$><!/><input type=file style=display:none></label><span class=muted></span></div><div class=media-details__actions><!$><!/><!$><!/><!$><!/>`);function ve(e){return Number.isFinite(e)?e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`:`—`}function b(e){return e.mime_type.startsWith(`image/`)}function ye(e){return e.mime_type.startsWith(`video/`)}function be(e){return e.mime_type.startsWith(`audio/`)}function xe(e){return e.mime_type===`application/pdf`}function x(e){return e.title?.trim()||e.filename}function Se(e){let t=e.metadata,n=Number(t?.width),r=Number(t?.height);return n>0&&r>0?`${n} × ${r} px`:null}function S(e){return{title:e.title??e.filename,alt:e.alt??``,caption:e.caption??``,description:e.description??``}}function C(o){let{t:s}=m(),[C,w]=n([]),[Ce,T]=n(0),[E,D]=n(1),[O,we]=n(``),[k,A]=n(``),[j,M]=n(``),[Te,N]=n(``),[Ee,P]=n(!1),[F,I]=n(null),[L,R]=n({title:``,alt:``,caption:``,description:``}),[De,z]=n(!1),[Oe,B]=n(!1),[ke,V]=n(!1),H=e=>h.mediaUrl(e.url),U=async()=>{try{let e=await h.listMedia({page:E(),limit:24,search:O()||void 0,mimeType:k()||void 0});w(e.data??[]),T(e.total??0)}catch(e){M(e instanceof Error?e.message:String(e))}};e(U);let W=async()=>{D(1),await U()},Ae=e=>{I(e),R(S(e)),M(``)},G=async e=>{if(e.length===0)return;P(!0),M(``),N(``);let t=0;for(let n of Array.from(e))try{await h.uploadMedia(n,{alt:``}),t+=1}catch(e){M(`${n.name}: ${e instanceof Error?e.message:String(e)}`)}P(!1),t>0&&(N(s(`media.toasts.uploaded`,{count:t})),D(1),await U())},je=async e=>{if(confirm(s(`media.details.confirmDelete`,{filename:e.filename})))try{await h.deleteMedia(e.id),F()?.id===e.id&&I(null),await U()}catch(e){M(e instanceof Error?e.message:String(e))}},Me=async()=>{let e=F();if(e){B(!0),M(``);try{let t=await h.updateMedia(e.id,L()),n={...e,...t};I(n),R(S(n)),N(s(`media.details.saved`)),await U()}catch(e){M(e instanceof Error?e.message:String(e))}finally{B(!1)}}},Ne=async e=>{let t=F();if(t){V(!0),M(``);try{let n=await h.replaceMediaFile(t.id,e),r={...t,...n};I(r),R(S(r)),N(s(`media.details.replaced`)),await U()}catch(e){M(e instanceof Error?e.message:String(e))}finally{V(!1)}}},Pe=async e=>{try{await navigator.clipboard.writeText(e),N(s(`media.details.copied`))}catch{M(s(`media.details.copyError`))}};return(()=>{var e=u(ae),n=e.firstChild,[m,h]=f(n.nextSibling),S=m.nextSibling,[w,T]=f(S.nextSibling),M=w.nextSibling,N=M.firstChild,P=N.firstChild,B=N.nextSibling,V=B.firstChild,[Fe,Ie]=f(V.nextSibling),K=Fe.nextSibling,Le=B.nextSibling,q=M.nextSibling,Re=q.firstChild,[J,Y]=f(Re.nextSibling),ze=J.nextSibling,[X,Be]=f(ze.nextSibling),Ve=X.nextSibling,[He,Z]=f(Ve.nextSibling),Ue=q.nextSibling,[Q,We]=f(Ue.nextSibling),Ge=Q.nextSibling,[$,Ke]=f(Ge.nextSibling),qe=$.nextSibling,[Je,Ye]=f(qe.nextSibling);return c(e,r(t,{get when(){return j()},get children(){var e=u(ne);return c(e,j),e}}),m,h),c(e,r(t,{get when(){return Te()},get children(){var e=u(re);return c(e,Te),e}}),w,T),M.addEventListener(`drop`,e=>{e.preventDefault(),z(!1),e.dataTransfer&&G(e.dataTransfer.files)}),M.addEventListener(`dragleave`,()=>z(!1)),M.addEventListener(`dragover`,e=>{e.preventDefault(),z(!0)}),c(P,()=>s(`media.upload.dropzone`)),c(B,(()=>{var e=p(()=>!!Ee());return()=>e()?s(`media.upload.uploading`):s(`media.upload.select`)})(),Fe,Ie),K.addEventListener(`change`,e=>{e.currentTarget.files&&G(e.currentTarget.files),e.currentTarget.value=``}),c(Le,()=>s(`media.upload.hint`)),c(q,r(_,{name:`media-search`,get placeholder(){return s(`media.toolbar.search`)},get value(){return O()},onInput:e=>{we(e),W()}}),J,Y),c(q,r(te,{name:`media-mime`,get placeholder(){return s(`media.toolbar.allTypes`)},get value(){return k()},get options(){return[{value:`image/png`,label:s(`media.mimeTypes.png`)},{value:`image/jpeg`,label:s(`media.mimeTypes.jpeg`)},{value:`image/gif`,label:s(`media.mimeTypes.gif`)},{value:`image/webp`,label:s(`media.mimeTypes.webp`)},{value:`image/svg+xml`,label:s(`media.mimeTypes.svg`)},{value:`application/pdf`,label:s(`media.mimeTypes.pdf`)},{value:`video/mp4`,label:s(`media.mimeTypes.mp4`)},{value:`audio/mpeg`,label:s(`media.mimeTypes.mp3`)}]},onChange:e=>{A(e),W()}}),X,Be),c(q,r(v,{variant:`secondary`,onClick:()=>void W(),get children(){return s(`media.toolbar.searchBtn`)}}),He,Z),c(e,r(t,{get when(){return C().length>0},get fallback(){return(()=>{var e=u(oe);return c(e,()=>s(`media.empty`)),e})()},get children(){var e=u(ie);return c(e,r(a,{get each(){return C()},children:e=>(()=>{var n=u(ce),a=n.firstChild,o=a.nextSibling.firstChild,s=o.nextSibling,l=s.firstChild,[p,m]=f(l.nextSibling),h=p.nextSibling.nextSibling,[g,_]=f(h.nextSibling);return n.$$click=()=>Ae(e),c(a,r(t,{get when(){return b(e)},get fallback(){return(()=>{var t=u(le);return c(t,()=>e.mime_type.split(`/`)[1]?.toUpperCase()??`FILE`),t})()},get children(){var t=u(se);return i(n=>{var r=H(e),i=e.alt??x(e);return r!==n.e&&d(t,`src`,n.e=r),i!==n.t&&d(t,`alt`,n.t=i),n},{e:void 0,t:void 0}),t}})),c(o,()=>x(e)),c(s,()=>e.filename,p,m),c(s,()=>ve(e.size),g,_),i(t=>{var r=F()?.id===e.id,i=x(e);return r!==t.e&&n.classList.toggle(`media-card--selected`,t.e=r),i!==t.t&&d(o,`title`,t.t=i),t},{e:void 0,t:void 0}),ee(),n})()})),e}}),Q,We),c(e,r(y,{get page(){return E()},limit:24,get total(){return Ce()},onPageChange:e=>{D(e),U()}}),$,Ke),c(e,r(g,{get open(){return!!F()},get title(){return p(()=>!!F())()?x(F()):s(`media.details.title`)},onClose:()=>I(null),get children(){return r(t,{get when(){return F()},children:e=>(()=>{var n=u(_e),a=n.firstChild,o=a.firstChild,[m,h]=f(o.nextSibling),g=m.nextSibling,[y,te]=f(g.nextSibling),ne=y.nextSibling,[re,ie]=f(ne.nextSibling),ae=re.nextSibling,[oe,se]=f(ae.nextSibling),ce=oe.nextSibling,[le,S]=f(ce.nextSibling),C=a.nextSibling,w=C.firstChild,Ce=w.firstChild,[T,E]=f(Ce.nextSibling),D=T.nextSibling,[O,we]=f(D.nextSibling),k=O.nextSibling,[A,j]=f(k.nextSibling),M=A.nextSibling,Te=M.firstChild,[N,Ee]=f(Te.nextSibling),P=N.nextSibling,F=w.nextSibling,De=F.firstChild,z=De.nextSibling,B=z.nextSibling,V=B.nextSibling,U=V.nextSibling,W=U.nextSibling,Ae=W.nextSibling,[G,Fe]=f(Ae.nextSibling),Ie=G.nextSibling,K=Ie.nextSibling,Le=K.nextSibling,q=Le.nextSibling.firstChild,Re=q.nextSibling,J=C.nextSibling,Y=J.firstChild,ze=Y.firstChild,[X,Be]=f(ze.nextSibling),Ve=X.nextSibling,He=Y.nextSibling,Z=J.nextSibling,Ue=Z.firstChild,[Q,We]=f(Ue.nextSibling),Ge=Q.nextSibling,[$,Ke]=f(Ge.nextSibling),qe=$.nextSibling,[Je,Ye]=f(qe.nextSibling);return c(a,r(t,{get when(){return b(e())},get children(){var t=u(ue);return i(n=>{var r=H(e()),i=L().alt||x(e());return r!==n.e&&d(t,`src`,n.e=r),i!==n.t&&d(t,`alt`,n.t=i),n},{e:void 0,t:void 0}),t}}),m,h),c(a,r(t,{get when(){return ye(e())},get children(){var t=u(de);return i(()=>d(t,`src`,H(e()))),t}}),y,te),c(a,r(t,{get when(){return be(e())},get children(){var t=u(fe);return i(()=>d(t,`src`,H(e()))),t}}),re,ie),c(a,r(t,{get when(){return xe(e())},get children(){var t=u(pe);return i(n=>{var r=x(e()),i=H(e());return r!==n.e&&d(t,`title`,n.e=r),i!==n.t&&d(t,`src`,n.t=i),n},{e:void 0,t:void 0}),t}}),oe,se),c(a,r(t,{get when(){return p(()=>!(b(e())||ye(e())||be(e())))()&&!xe(e())},get children(){var t=u(me);return c(t,()=>e().mime_type.split(`/`)[1]?.toUpperCase()??`FILE`),t}}),le,S),c(w,r(_,{name:`media-title`,get label(){return s(`media.details.titleField`)},get value(){return L().title},onInput:e=>R({...L(),title:e})}),T,E),c(w,r(_,{name:`media-alt`,get label(){return s(`media.details.alt`)},get value(){return L().alt},onInput:e=>R({...L(),alt:e})}),O,we),c(w,r(_,{name:`media-caption`,get label(){return s(`media.details.caption`)},get value(){return L().caption},onInput:e=>R({...L(),caption:e})}),A,j),c(M,()=>s(`media.details.description`),N,Ee),P.$$input=e=>R({...L(),description:e.currentTarget.value}),c(De,()=>s(`media.details.file`)),c(z,()=>e().filename),c(B,()=>s(`media.details.type`)),c(V,()=>e().mime_type),c(U,()=>s(`media.details.size`)),c(W,()=>ve(e().size)),c(F,r(t,{get when(){return Se(e())},get children(){return[(()=>{var e=u(he);return c(e,()=>s(`media.details.dimensions`)),e})(),(()=>{var t=u(ge);return c(t,()=>Se(e())),t})()]}}),G,Fe),c(Ie,()=>s(`media.details.uploaded`)),c(K,(()=>{var t=p(()=>!!e().created_at);return()=>t()?new Date(e().created_at).toLocaleString():`—`})()),c(Le,()=>s(`media.details.url`)),c(q,()=>H(e())),Re.$$click=()=>void Pe(H(e())),c(Re,()=>s(`media.details.copy`)),c(Y,(()=>{var e=p(()=>!!ke());return()=>e()?s(`media.details.replacing`):s(`media.details.replace`)})(),X,Be),Ve.addEventListener(`change`,e=>{let t=e.currentTarget.files?.[0];t&&Ne(t),e.currentTarget.value=``}),c(He,()=>s(`media.details.replaceHint`)),c(Z,r(v,{variant:`primary`,get disabled(){return Oe()},get loading(){return Oe()},onClick:()=>void Me(),get children(){return s(`media.details.save`)}}),Q,We),c(Z,r(v,{variant:`danger`,onClick:()=>void je(e()),get children(){return s(`media.details.delete`)}}),$,Ke),c(Z,r(v,{variant:`secondary`,onClick:()=>I(null),get children(){return s(`media.details.close`)}}),Je,Ye),i(()=>l(Ve,`disabled`,ke())),i(()=>l(P,`value`,L().description)),ee(),n})()})}}),Je,Ye),i(e=>{var t=!!(De()||o.focusUpload),n=Ee();return t!==e.e&&M.classList.toggle(`upload-zone--active`,e.e=t),n!==e.t&&l(K,`disabled`,e.t=n),e},{e:void 0,t:void 0}),e})()}s([`click`,`input`]);export{C as MediaLibrary};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{S as e,a as t,f as n,h as r,l as i,p as a,r as o}from"./solid.Ck4Vtfe4.js";import{_ as s,a as c,f as l,l as u,m as d,o as f,p,s as m,u as h}from"./web.DD6VKaIp.js";import{n as g}from"./i18n.LMZI7jyc.js";import{n as _}from"./api.B03e8F6d.js";var v=s(`<div class=wp-menu-empty-level>`),y=s(`<div class=wp-menu-tree><!$><!/><!$><!/>`),b=s(`<article class=wp-menu-item><div class=wp-menu-item__header><span class=wp-menu-drag draggable=true>⠿⠿⠿</span><span class=wp-menu-item__label><strong></strong><small></small></span><div class=wp-menu-item__actions><button type=button class="btn btn-sm">↑</button><button type=button class="btn btn-sm">↓</button><button type=button class="btn btn-sm">→</button><button type=button class="btn btn-sm">←</button></div></div><details class=wp-menu-item__details><summary></summary><div class=wp-menu-item__fields><label><!$><!/><input class=input></label><label><!$><!/><input class=input></label><label><!$><!/><input class=input></label><label><!$><!/><input class=input></label><label><!$><!/><select class=input><option value=_self></option><option value=_blank></option></select></label><label><!$><!/><input class=input></label><label class=wp-menu-item__wide><!$><!/><textarea class=input rows=2></textarea></label><button type=button class="btn btn-danger btn-sm"></button></div></details><!$><!/>`),x=s(`<p class=muted>`),S=s(`<details class=wp-menu-box><summary></summary><div class=wp-menu-box__body><!$><!/><!$><!/>`),C=s(`<div class="notice notice--error">`),w=s(`<div class=notice>`),T=s(`<div class="menus-manager wp-menus-manager"><!$><!/><!$><!/><!$><!/><style>.wp-menu-editor__top,.wp-structure-heading,.wp-menu-editor__identity,.wp-menu-item__header,.wp-menu-item__actions,.form-actions{display:flex;align-items:center;gap:.7rem}.wp-menu-editor__top,.wp-structure-heading{justify-content:space-between}.wp-menu-editor__top{margin-bottom:1rem}.wp-menu-editor__top h3{margin:.25rem 0 0}.wp-eyebrow{display:block;margin-top:.7rem;font-size:.72rem;text-transform:uppercase;letter-spacing:.08em;color:var(--color-muted)}.wp-menu-editor__identity{margin-bottom:1rem;align-items:end}.wp-menu-editor__identity label{display:grid;gap:.35rem;flex:1}.wp-menu-editor__columns{display:grid;grid-template-columns:330px minmax(0,1fr);gap:1.2rem;align-items:start}.wp-menu-sources,.wp-menu-structure{min-width:0}.wp-menu-sources>h4,.wp-structure-heading h4{margin:0}.wp-menu-box{background:var(--color-surface,#fff);border:1px solid var(--color-border,#ddd);margin-bottom:.7rem}.wp-menu-box summary{cursor:pointer;padding:.8rem;font-weight:600}.wp-menu-box__body{padding:0 .8rem .8rem;display:grid;gap:.6rem}.wp-menu-box__body p{margin:0}.wp-source-list{display:grid;gap:.35rem;max-height:220px;overflow:auto;border:1px solid var(--color-border,#ddd);padding:.45rem}.wp-source-row{display:flex!important;align-items:start;gap:.45rem!important;padding:.3rem}.wp-source-row span,.wp-source-link{display:grid;gap:.12rem;text-align:left}.wp-source-row small,.wp-source-link small,.wp-menu-item__label small{color:var(--color-muted);font-size:.75rem}.wp-source-link{border:0;background:none;color:inherit;padding:.35rem;width:100%;cursor:pointer}.wp-source-link:hover{background:var(--color-surface-muted,#f5f5f5)}.wp-taxonomy-source{display:grid;gap:.2rem;border-top:1px solid var(--color-border,#ddd);padding-top:.5rem}.wp-taxonomy-source:first-child{border-top:0;padding-top:0}.wp-menu-structure{background:var(--color-surface-muted,#f7f7f7);padding:1rem}.wp-menu-structure .wp-structure-heading{margin-bottom:1rem}.wp-menu-tree{display:grid;gap:.55rem}.wp-menu-tree[data-depth="1"]{margin:.55rem 0 0 2rem}.wp-menu-item{background:var(--color-surface,#fff);border:1px solid var(--color-border,#dcdcde);box-shadow:0 1px 1px rgba(0,0,0,.04)}.wp-menu-item__header{padding:.55rem .7rem}.wp-menu-drag{cursor:grab;letter-spacing:-.2rem;width:1.4rem;color:var(--color-muted);user-select:none}.wp-menu-item__label{display:grid;gap:.15rem;flex:1;min-width:0}.wp-menu-item__label small{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.wp-menu-item__actions{margin-left:auto}.wp-menu-item__details{border-top:1px solid var(--color-border,#ddd)}.wp-menu-item__details summary{padding:.5rem .7rem;cursor:pointer;color:var(--color-muted);font-size:.85rem}.wp-menu-item__fields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.7rem;padding:.7rem;border-top:1px solid var(--color-border,#ddd)}.wp-menu-item__fields label{display:grid;gap:.3rem}.wp-menu-item__wide{grid-column:1/-1}.wp-menu-empty,.wp-menu-empty-level{text-align:center;padding:2rem;color:var(--color-muted)}.wp-menu-empty-level{border:1px dashed var(--color-border,#ccc);padding:1rem}.wp-menu-settings{margin-top:1rem}.wp-menu-settings h4{margin-top:0}.wp-menu-settings p{margin-bottom:0}.wp-menus-manager .menu-actions{white-space:nowrap;text-align:right}@media(max-width:850px){.wp-menu-editor__columns{grid-template-columns:1fr}.wp-menu-sources{order:2}.wp-menu-structure{order:1}.wp-menu-editor__identity,.wp-menu-editor__top{align-items:stretch;display:grid}.wp-menu-item__fields{grid-template-columns:1fr}.wp-menu-item__wide{grid-column:auto}}`),E=s(`<div class=skeleton>`),ee=s(`<div class=manager-toolbar><p class=muted></p><button class="btn btn-primary"type=button>+ <!$><!/>`),D=s(`<table class=table><thead><tr><th></th><th></th><th></th><th></th></tr></thead><tbody>`),te=s(`<section class=card>`),O=s(`<p class="muted empty-state">`),k=s(`<tr><td><strong></strong></td><td><code></code></td><td></td><td class=menu-actions><button class="btn btn-secondary btn-sm"type=button></button> <button class="btn btn-danger btn-sm"type=button>`),ne=s(`<input class=input>`),A=s(`<div class=wp-source-list>`),j=s(`<button type=button class="btn btn-secondary btn-sm">`),re=s(`<label><!$><!/><input class=input placeholder=https://>`),ie=s(`<label><!$><!/><input class=input>`),ae=s(`<form class=wp-menu-editor><div class=wp-menu-editor__top><div><button type=button class="btn btn-secondary btn-sm">← <!$><!/></button><span class=wp-eyebrow></span><h3></h3></div><div class=form-actions><button class="btn btn-secondary"type=button></button><button class="btn btn-primary"type=submit></button></div></div><div class="wp-menu-editor__identity card"><label><!$><!/><input class=input required></label><label><!$><!/><input class=input></label></div><div class=wp-menu-editor__columns><aside class=wp-menu-sources><h4></h4><!$><!/><!$><!/><!$><!/><!$><!/><!$><!/><!$><!/><!$><!/></aside><main class=wp-menu-structure><div class=wp-structure-heading><div><h4></h4><p class=muted></p></div><span class=badge><!$><!/> <!$><!/></span></div><!$><!/><section class="card wp-menu-settings"><h4></h4><label class=checkbox-label><input type=checkbox> <!$><!/></label><p class=muted>`),oe=s(`<label class=wp-source-row><input type=checkbox><span><!$><!/><small>/<!$><!/>`),se=s(`<label class=wp-source-row><input type=checkbox><span><!$><!/><small>/post/<!$><!/>`),M=s(`<div class=wp-taxonomy-source><strong></strong><!$><!/>`),N=s(`<button type=button class=wp-source-link><!$><!/><small>/<!$><!/>/<!$><!/>`),ce=s(`<button type=button class=wp-source-link><!$><!/><small>/<!$><!/>`),le=s(`<div class="wp-menu-empty card">`);function P(e){return`${e}_${typeof globalThis.crypto?.randomUUID==`function`?globalThis.crypto.randomUUID():Math.random().toString(36).slice(2)}`}function F(e){return e.toLowerCase().normalize(`NFD`).replace(/[\u0300-\u036f]/g,``).replace(/[^a-z0-9]+/g,`-`).replace(/(^-|-$)/g,``)}function I(e,t=null){let n=e.id||P(`item`);return{...e,id:n,clientId:n,parentId:t??e.parentId??null,children:[]}}function ue(e){let t=(Array.isArray(e)?e:[]).map(e=>I(e)),n=new Map(t.map(e=>[e.id,e])),r=[];for(let e of t){let t=e.parentId?n.get(e.parentId):void 0;t&&t.id!==e.id?t.children.push(e):r.push(e)}let i=e=>(e.sort((e,t)=>(e.order??0)-(t.order??0)),e.forEach(e=>i(e.children)),e);return i(r)}function L(e,t=null){let n=[];return e.forEach((e,r)=>{let{clientId:i,children:a,...o}=e;n.push({...o,id:e.id,parentId:t,order:r}),n.push(...L(a,e.id))}),n}function R(e){return e.map(e=>({...e,children:R(e.children)}))}function z(e,t){return e.id===t||e.children.some(e=>z(e,t))}function B(e,t){let n=e.findIndex(e=>e.id===t);if(n>=0){let t=[...e],[r]=t.splice(n,1);return{items:t,removed:r}}for(let n=0;n<e.length;n+=1){let r=B(e[n].children,t);if(r.removed){let t=[...e];return t[n]={...t[n],children:r.items},{items:t,removed:r.removed}}}return{items:e}}function V(e,t,n){let r=e.findIndex(e=>e.id===t);if(r>=0){let t=[...e];return t.splice(r,0,n),{items:t,inserted:!0}}for(let r=0;r<e.length;r+=1){let i=V(e[r].children,t,n);if(i.inserted){let t=[...e];return t[r]={...t[r],children:i.items},{items:t,inserted:!0}}}return{items:e,inserted:!1}}function H(e,t,n){for(let r=0;r<e.length;r+=1){let i=e[r];if(i.id===t){let t=[...e];return t[r]={...i,children:[...i.children,n]},{items:t,inserted:!0}}let a=H(i.children,t,n);if(a.inserted){let t=[...e];return t[r]={...i,children:a.items},{items:t,inserted:!0}}}return{items:e,inserted:!1}}function U(e,t,n){return e.map(e=>e.id===t?{...e,...n}:{...e,children:U(e.children,t,n)})}function de(e,t){return B(e,t).items}function fe(e,t,n){if(t===n||e.some(e=>e.id===t&&z(e,n)))return e;let r=B(e,t);if(!r.removed)return e;let i=V(r.items,n,r.removed);return i.inserted?i.items:e}function pe(e,t,n){if(t===n||e.some(e=>e.id===t&&z(e,n)))return e;let r=B(e,t);if(!r.removed)return e;let i=H(r.items,n,r.removed);return i.inserted?i.items:e}function W(e,t,n){let r=e.findIndex(e=>e.id===t);if(r>=0)return{siblings:e,index:r,parent:n};for(let n of e){let e=W(n.children,t,n);if(e)return e}return null}function me(e,t,n){let r=R(e),i=W(r,t);if(!i)return e;let a=i.index+n;return a<0||a>=i.siblings.length?e:([i.siblings[i.index],i.siblings[a]]=[i.siblings[a],i.siblings[i.index]],r)}function he(e,t){let n=R(e),r=W(n,t);return!r||r.index===0?e:pe(n,t,r.siblings[r.index-1].id)}function ge(e,t){let n=R(e),r=W(n,t);return r?.parent?fe(n,t,r.parent.id):e}function _e(e){let t=P(`item`);return{id:t,clientId:t,type:e.type,label:e.label,url:e.url,objectId:e.objectId,objectType:e.objectType,parentId:null,order:0,target:`_self`,children:[]}}function ve(e){let[n,s]=r(null);return(()=>{var r=f(y),c=r.firstChild,[h,g]=m(c.nextSibling),_=h.nextSibling,[x,S]=m(_.nextSibling);return u(r,i(o,{get each(){return e.items},children:r=>(()=>{var o=f(b),c=o.firstChild,h=c.firstChild,g=h.nextSibling,_=g.firstChild,v=_.nextSibling,y=g.nextSibling.firstChild,x=y.nextSibling,S=x.nextSibling,C=S.nextSibling,w=c.nextSibling,T=w.firstChild,E=T.nextSibling.firstChild,ee=E.firstChild,[D,te]=m(ee.nextSibling),O=D.nextSibling,k=E.nextSibling,ne=k.firstChild,[A,j]=m(ne.nextSibling),re=A.nextSibling,ie=k.nextSibling,ae=ie.firstChild,[oe,se]=m(ae.nextSibling),M=oe.nextSibling,N=ie.nextSibling,ce=N.firstChild,[le,P]=m(ce.nextSibling),F=le.nextSibling,I=N.nextSibling,ue=I.firstChild,[L,R]=m(ue.nextSibling),z=L.nextSibling,B=z.firstChild,V=B.nextSibling,H=I.nextSibling,pe=H.firstChild,[W,_e]=m(pe.nextSibling),G=W.nextSibling,K=H.nextSibling,q=K.firstChild,[J,ye]=m(q.nextSibling),Y=J.nextSibling,be=K.nextSibling,xe=w.nextSibling,[Se,Ce]=m(xe.nextSibling);return o.addEventListener(`drop`,t=>{t.preventDefault();let i=n()??t.dataTransfer?.getData(`text/plain`);i&&e.onChange(fe(e.items,i,r.id)),s(null)}),o.addEventListener(`dragover`,e=>e.preventDefault()),h.addEventListener(`dragend`,()=>s(null)),h.addEventListener(`dragstart`,e=>{s(r.id),e.dataTransfer?.setData(`text/plain`,r.id)}),u(_,()=>r.label||e.t(`menus.editor.untitled`)),u(v,()=>r.url||e.t(`menus.editor.noUrl`)),y.$$click=()=>e.onChange(me(e.items,r.id,-1)),x.$$click=()=>e.onChange(me(e.items,r.id,1)),S.$$click=()=>e.onChange(he(e.items,r.id)),C.$$click=()=>e.onChange(ge(e.items,r.id)),u(T,()=>e.t(`menus.editor.itemSettings`)),u(E,()=>e.t(`menus.editor.navigationLabel`),D,te),O.$$input=t=>e.onChange(U(e.items,r.id,{label:t.currentTarget.value})),u(k,()=>e.t(`menus.editor.url`),A,j),re.$$input=t=>e.onChange(U(e.items,r.id,{url:t.currentTarget.value})),u(ie,()=>e.t(`menus.editor.titleAttribute`),oe,se),M.$$input=t=>e.onChange(U(e.items,r.id,{attrTitle:t.currentTarget.value})),u(N,()=>e.t(`menus.editor.cssClasses`),le,P),F.$$input=t=>e.onChange(U(e.items,r.id,{cssClasses:t.currentTarget.value})),u(I,()=>e.t(`menus.editor.target`),L,R),z.addEventListener(`change`,t=>e.onChange(U(e.items,r.id,{target:t.currentTarget.value}))),u(B,()=>e.t(`menus.editor.sameWindow`)),u(V,()=>e.t(`menus.editor.newWindow`)),u(H,()=>e.t(`menus.editor.xfn`),W,_e),G.$$input=t=>e.onChange(U(e.items,r.id,{xfn:t.currentTarget.value})),u(K,()=>e.t(`menus.editor.description`),J,ye),Y.$$input=t=>e.onChange(U(e.items,r.id,{description:t.currentTarget.value})),be.$$click=()=>e.onChange(de(e.items,r.id)),u(be,()=>e.t(`menus.editor.remove`)),u(o,i(t,{get when(){return r.children.length>0},get children(){return i(ve,{get items(){return r.children},get depth(){return(e.depth??0)+1},get t(){return e.t},onChange:t=>e.onChange(U(e.items,r.id,{children:t}))})}}),Se,Ce),a(t=>{var n=e.t(`menus.editor.drag`),r=e.t(`menus.editor.up`),i=e.t(`menus.editor.down`),a=e.t(`menus.editor.indent`),o=e.t(`menus.editor.outdent`);return n!==t.e&&p(h,`title`,t.e=n),r!==t.t&&p(y,`title`,t.t=r),i!==t.a&&p(x,`title`,t.a=i),a!==t.o&&p(S,`title`,t.o=a),o!==t.i&&p(C,`title`,t.i=o),t},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),a(()=>d(O,`value`,r.label)),a(()=>d(re,`value`,r.url??``)),a(()=>d(M,`value`,r.attrTitle??``)),a(()=>d(F,`value`,r.cssClasses??``)),a(()=>d(z,`value`,r.target??`_self`)),a(()=>d(G,`value`,r.xfn??``)),a(()=>d(Y,`value`,r.description??``)),l(),o})()}),h,g),u(r,i(t,{get when(){return e.items.length===0},get children(){var t=f(v);return u(t,()=>e.t(`menus.editor.emptyLevel`)),t}}),x,S),a(()=>p(r,`data-depth`,e.depth??0)),r})()}function G(e){return(()=>{var n=f(S),r=n.firstChild,o=r.nextSibling,s=o.firstChild,[c,l]=m(s.nextSibling),p=c.nextSibling,[h,g]=m(p.nextSibling);return u(r,()=>e.title),u(o,i(t,{get when(){return e.description},get children(){var t=f(x);return u(t,()=>e.description),t}}),c,l),u(o,()=>e.children,h,g),a(()=>d(n,`open`,e.open)),n})()}function K(){let{t:s}=g(),[c,v]=r([]),[y,b]=r(null),[x,S]=r([]),[I,R]=r([]),[z,B]=r({}),[V,H]=r([]),[U,de]=r([]),[fe,pe]=r({}),[W,me]=r(``),[he,ge]=r(``),[K,q]=r([]),[J,ye]=r(``),[Y,be]=r(``),[xe,Se]=r(!0),[Ce,we]=r(!1),[Te,X]=r(``),[Ee,Z]=r(``),De=async()=>{Se(!0),X(``);try{let[e,t,n,r,i]=await Promise.all([_.getMenus(),_.getContent({type:`page`,status:`PUBLISHED`,limit:100}),_.getContent({type:`post`,status:`PUBLISHED`,limit:100}),_.getContentTypes(),_.getTaxonomies()]);v(e),S(t.data),R(n.data),H(r),de(i);let a=await Promise.all(r.filter(e=>e.slug!==`page`&&e.slug!==`post`&&!e.singleton).map(async e=>[e.slug,(await _.getContent({type:e.slug,status:`PUBLISHED`,limit:100})).data]));B(Object.fromEntries(a));let o=await Promise.all(i.map(async e=>[e.slug,await _.getTaxonomyTerms(e.slug)]));pe(Object.fromEntries(o))}catch(e){X(e instanceof Error?e.message:String(e))}finally{Se(!1)}};e(De);let Oe=e=>{b({id:e?.id,name:e?.name??``,slug:e?.slug??``,items:ue(e?.items),settings:{...e?.settings??{}}}),q([]),X(``),Z(``)},Q=e=>{let t=y();t&&b({...t,...e})},$=e=>{let t=y();t&&Q({items:[...t.items,_e(e)]})},ke=e=>{let t=new Set(K()),n=y();n&&(Q({items:[...n.items,...e.filter(e=>t.has(e.id)).map(_e)]}),q([]))},Ae=()=>{J().trim()&&Y().trim()&&($({id:P(`custom`),type:`custom`,label:Y().trim(),url:J().trim()}),ye(``),be(``))},je=async e=>{e.preventDefault();let t=y();if(t){if(!t.name.trim()){X(s(`menus.nameRequired`));return}we(!0),X(``);try{let e={name:t.name.trim(),slug:t.slug.trim()||F(t.name),items:L(t.items),settings:t.settings};t.id?await _.updateMenu(t.id,e):await _.createMenu(e),b(null),Z(s(`menus.saved`)),await De()}catch(e){X(e instanceof Error?e.message:String(e))}finally{we(!1)}}},Me=async e=>{if(e.id&&confirm(s(`menus.confirmDelete`,{name:e.name})))try{await _.deleteMenu(e.id),Z(s(`menus.deleted`)),await De()}catch(e){X(e instanceof Error?e.message:String(e))}},Ne=n(()=>x().filter(e=>!W()||`${e.title} ${e.slug}`.toLowerCase().includes(W().toLowerCase()))),Pe=n(()=>I().filter(e=>!he()||`${e.title} ${e.slug}`.toLowerCase().includes(he().toLowerCase()))),Fe=e=>({id:`page:${e.id}`,type:`page`,label:e.title,url:`/${e.slug}`,objectId:e.id,objectType:`page`}),Ie=e=>({id:`post:${e.id}`,type:`post`,label:e.title,url:`/post/${e.slug}`,objectId:e.id,objectType:`post`}),Le=e=>({id:`content:${e.type}:${e.id}`,type:`content`,label:e.title,url:`/${e.type}/${e.slug}`,objectId:e.id,objectType:e.type});return(()=>{var e=f(T),n=e.firstChild,[r,g]=m(n.nextSibling),_=r.nextSibling,[v,x]=m(_.nextSibling),S=v.nextSibling,[P,I]=m(S.nextSibling);return P.nextSibling,u(e,i(t,{get when(){return Te()},get children(){var e=f(C);return u(e,Te),e}}),r,g),u(e,i(t,{get when(){return Ee()},get children(){var e=f(w);return u(e,Ee),e}}),v,x),u(e,i(t,{get when(){return!xe()},get fallback(){return(()=>{var e=f(E);return u(e,()=>s(`common.loading`)),e})()},get children(){return i(t,{get when(){return y()},get fallback(){return[(()=>{var e=f(ee),t=e.firstChild,n=t.nextSibling,r=n.firstChild.nextSibling,[i,a]=m(r.nextSibling);return u(t,()=>s(`menus.hint`)),n.$$click=()=>Oe(),u(n,()=>s(`menus.new`),i,a),l(),e})(),(()=>{var e=f(te);return u(e,i(t,{get when(){return c().length>0},get fallback(){return(()=>{var e=f(O);return u(e,()=>s(`menus.empty`)),e})()},get children(){var e=f(D),t=e.firstChild,n=t.firstChild.firstChild,r=n.nextSibling,a=r.nextSibling,d=t.nextSibling;return u(n,()=>s(`menus.name`)),u(r,()=>s(`menus.slug`)),u(a,()=>s(`menus.items`)),u(d,i(o,{get each(){return c()},children:e=>(()=>{var t=f(k),n=t.firstChild,r=n.firstChild,i=n.nextSibling,a=i.firstChild,o=i.nextSibling,c=o.nextSibling.firstChild,d=c.nextSibling.nextSibling;return u(r,()=>e.name),u(a,()=>e.slug),u(o,()=>e.items?.length??0),c.$$click=()=>Oe(e),u(c,()=>s(`common.edit`)),d.$$click=()=>void Me(e),u(d,()=>s(`common.delete`)),l(),t})()})),e}})),e})()]},children:e=>(()=>{var n=f(ae),r=n.firstChild,c=r.firstChild,g=c.firstChild,_=g.firstChild.nextSibling,[v,y]=m(_.nextSibling),x=g.nextSibling,S=x.nextSibling,C=c.nextSibling.firstChild,w=C.nextSibling,T=r.nextSibling,E=T.firstChild,ee=E.firstChild,[D,te]=m(ee.nextSibling),O=D.nextSibling,k=E.nextSibling,P=k.firstChild,[I,ue]=m(P.nextSibling),L=I.nextSibling,R=T.nextSibling.firstChild,B=R.firstChild,H=B.nextSibling,[de,pe]=m(H.nextSibling),_e=de.nextSibling,[xe,Se]=m(_e.nextSibling),we=xe.nextSibling,[Te,X]=m(we.nextSibling),Ee=Te.nextSibling,[Z,De]=m(Ee.nextSibling),Oe=Z.nextSibling,[Me,Re]=m(Oe.nextSibling),ze=Me.nextSibling,[Be,Ve]=m(ze.nextSibling),He=Be.nextSibling,[Ue,We]=m(He.nextSibling),Ge=R.nextSibling,Ke=Ge.firstChild,qe=Ke.firstChild,Je=qe.firstChild,Ye=Je.nextSibling,Xe=qe.nextSibling,Ze=Xe.firstChild,[Qe,$e]=m(Ze.nextSibling),et=Qe.nextSibling.nextSibling,[tt,nt]=m(et.nextSibling),rt=Ke.nextSibling,[it,at]=m(rt.nextSibling),ot=it.nextSibling.firstChild,st=ot.nextSibling,ct=st.firstChild,lt=ct.nextSibling.nextSibling,[ut,dt]=m(lt.nextSibling),ft=st.nextSibling;return n.addEventListener(`submit`,je),g.$$click=()=>b(null),u(g,()=>s(`menus.back`),v,y),u(x,()=>s(`menus.editor.eyebrow`)),u(S,(()=>{var t=h(()=>!!e().id);return()=>t()?s(`menus.edit`):s(`menus.create`)})()),C.$$click=()=>b(null),u(C,()=>s(`common.cancel`)),u(w,(()=>{var e=h(()=>!!Ce());return()=>e()?s(`common.loading`):s(`common.save`)})()),u(E,()=>s(`menus.name`),D,te),O.$$input=e=>Q({name:e.currentTarget.value}),u(k,()=>s(`menus.slug`),I,ue),L.$$input=e=>Q({slug:e.currentTarget.value}),u(B,()=>s(`menus.editor.addItems`)),u(R,i(G,{get title(){return s(`menus.sources.pages`)},open:!0,get children(){return[(()=>{var e=f(ne);return e.$$input=e=>me(e.currentTarget.value),a(()=>p(e,`placeholder`,s(`menus.editor.search`))),a(()=>d(e,`value`,W())),l(),e})(),(()=>{var e=f(A);return u(e,i(o,{get each(){return Ne()},children:e=>(()=>{var t=f(oe),n=t.firstChild,r=n.nextSibling,i=r.firstChild,[o,s]=m(i.nextSibling),c=o.nextSibling,l=c.firstChild.nextSibling,[p,h]=m(l.nextSibling);return n.addEventListener(`change`,t=>q(t.currentTarget.checked?[...K(),`page:${e.id}`]:K().filter(t=>t!==`page:${e.id}`))),u(r,()=>e.title,o,s),u(c,()=>e.slug,p,h),a(()=>d(n,`checked`,K().includes(`page:${e.id}`))),t})()})),e})(),(()=>{var e=f(j);return e.$$click=()=>ke(Ne().map(Fe)),u(e,()=>s(`menus.editor.addSelected`)),l(),e})()]}}),de,pe),u(R,i(G,{get title(){return s(`menus.sources.posts`)},get children(){return[(()=>{var e=f(ne);return e.$$input=e=>ge(e.currentTarget.value),a(()=>p(e,`placeholder`,s(`menus.editor.search`))),a(()=>d(e,`value`,he())),l(),e})(),(()=>{var e=f(A);return u(e,i(o,{get each(){return Pe()},children:e=>(()=>{var t=f(se),n=t.firstChild,r=n.nextSibling,i=r.firstChild,[o,s]=m(i.nextSibling),c=o.nextSibling,l=c.firstChild.nextSibling,[p,h]=m(l.nextSibling);return n.addEventListener(`change`,t=>q(t.currentTarget.checked?[...K(),`post:${e.id}`]:K().filter(t=>t!==`post:${e.id}`))),u(r,()=>e.title,o,s),u(c,()=>e.slug,p,h),a(()=>d(n,`checked`,K().includes(`post:${e.id}`))),t})()})),e})(),(()=>{var e=f(j);return e.$$click=()=>ke(Pe().map(Ie)),u(e,()=>s(`menus.editor.addSelected`)),l(),e})()]}}),xe,Se),u(R,i(G,{get title(){return s(`menus.sources.contentTypes`)},get children(){return i(o,{get each(){return V().filter(e=>e.slug!==`page`&&e.slug!==`post`&&!e.singleton)},children:e=>(()=>{var t=f(M),n=t.firstChild,r=n.nextSibling,[a,s]=m(r.nextSibling);return u(n,()=>e.pluralLabel),u(t,i(o,{get each(){return z()[e.slug]??[]},children:t=>(()=>{var n=f(N),r=n.firstChild,[i,a]=m(r.nextSibling),o=i.nextSibling,s=o.firstChild.nextSibling,[c,d]=m(s.nextSibling),p=c.nextSibling.nextSibling,[h,g]=m(p.nextSibling);return n.$$click=()=>$(Le(t)),u(n,()=>t.title,i,a),u(o,()=>e.slug,c,d),u(o,()=>t.slug,h,g),l(),n})()}),a,s),t})()})}}),Te,X),u(R,i(G,{get title(){return s(`menus.sources.custom`)},get description(){return s(`menus.sources.customHint`)},get children(){return[(()=>{var e=f(re),t=e.firstChild,[n,r]=m(t.nextSibling),i=n.nextSibling;return u(e,()=>s(`menus.editor.url`),n,r),i.$$input=e=>ye(e.currentTarget.value),a(()=>d(i,`value`,J())),l(),e})(),(()=>{var e=f(ie),t=e.firstChild,[n,r]=m(t.nextSibling),i=n.nextSibling;return u(e,()=>s(`menus.editor.navigationLabel`),n,r),i.$$input=e=>be(e.currentTarget.value),a(()=>d(i,`value`,Y())),l(),e})(),(()=>{var e=f(j);return e.$$click=Ae,u(e,()=>s(`menus.editor.addToMenu`)),l(),e})()]}}),Z,De),u(R,i(G,{get title(){return s(`menus.sources.home`)},get children(){var e=f(j);return e.$$click=()=>$({id:`home`,type:`home`,label:s(`menus.sources.home`),url:`/`}),u(e,()=>s(`menus.editor.addToMenu`)),l(),e}}),Me,Re),u(R,i(G,{get title(){return s(`menus.sources.archives`)},get children(){var e=f(A);return u(e,i(o,{get each(){return V().filter(e=>e.hasArchive)},children:e=>(()=>{var t=f(ce),n=t.firstChild,[r,i]=m(n.nextSibling),a=r.nextSibling,o=a.firstChild.nextSibling,[s,c]=m(o.nextSibling);return t.$$click=()=>$({id:`archive:${e.slug}`,type:`archive`,label:e.pluralLabel,url:`/${e.slug}`,objectType:e.slug}),u(t,()=>e.pluralLabel,r,i),u(a,()=>e.slug,s,c),l(),t})()})),e}}),Be,Ve),u(R,i(G,{get title(){return s(`menus.sources.taxonomies`)},get children(){return i(o,{get each(){return U()},children:e=>(()=>{var t=f(M),n=t.firstChild,r=n.nextSibling,[a,s]=m(r.nextSibling);return u(n,()=>e.name),u(t,i(o,{get each(){return fe()[e.slug]??[]},children:t=>(()=>{var n=f(N),r=n.firstChild,[i,a]=m(r.nextSibling),o=i.nextSibling,s=o.firstChild.nextSibling,[c,d]=m(s.nextSibling),p=c.nextSibling.nextSibling,[h,g]=m(p.nextSibling);return n.$$click=()=>$({id:`term:${e.slug}:${t.slug}`,type:`taxonomy`,label:t.name,url:`/${e.slug}/${t.slug}`,objectId:t.id,objectType:e.slug}),u(n,()=>t.name,i,a),u(o,()=>e.slug,c,d),u(o,()=>t.slug,h,g),l(),n})()}),a,s),t})()})}}),Ue,We),u(Je,()=>s(`menus.editor.structure`)),u(Ye,()=>s(`menus.editor.structureHint`)),u(Xe,()=>e().items.length,Qe,$e),u(Xe,()=>s(`menus.items`),tt,nt),u(Ge,i(t,{get when(){return e().items.length>0},get fallback(){return(()=>{var e=f(le);return u(e,()=>s(`menus.editor.empty`)),e})()},get children(){return i(ve,{get items(){return e().items},t:s,onChange:e=>Q({items:e})})}}),it,at),u(ot,()=>s(`menus.editor.settings`)),ct.addEventListener(`change`,t=>Q({settings:{...e().settings,autoAddNewPages:t.currentTarget.checked}})),u(st,()=>s(`menus.editor.autoAddPages`),ut,dt),u(ft,()=>s(`menus.editor.autoAddPagesHint`)),a(t=>{var n=Ce(),r=F(e().name);return n!==t.e&&d(w,`disabled`,t.e=n),r!==t.t&&p(L,`placeholder`,t.t=r),t},{e:void 0,t:void 0}),a(()=>d(O,`value`,e().name)),a(()=>d(L,`value`,e().slug)),a(()=>d(ct,`checked`,e().settings.autoAddNewPages===!0)),l(),n})()})}}),P,I),e})()}c([`click`,`input`]);export{K as MenuManager};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,d as t,l as n,p as r,x as i}from"./solid.Ck4Vtfe4.js";import{_ as a,a as o,f as s,l as c,o as l,p as u,s as d}from"./web.DD6VKaIp.js";import{n as f}from"./i18n.LMZI7jyc.js";var p=a(`<div class=modal-overlay role=presentation><section class=modal role=dialog aria-modal=true><header class=modal-header><h3></h3><button type=button class=modal-close>×</button></header><!$><!/>`);function m(a){let{t:o}=f();return t(()=>{if(!a.open)return;let e=e=>{e.key===`Escape`&&a.onClose()};document.addEventListener(`keydown`,e),i(()=>document.removeEventListener(`keydown`,e))}),n(e,{get when(){return a.open},get children(){var e=l(p),t=e.firstChild,n=t.firstChild,i=n.firstChild,f=i.nextSibling,m=n.nextSibling,[h,g]=d(m.nextSibling);return e.$$mousedown=e=>{e.target===e.currentTarget&&a.onClose()},c(i,()=>a.title),f.$$click=()=>a.onClose(),c(t,()=>a.children,h,g),r(e=>{var n=a.title,r=o(`common.close`);return n!==e.e&&u(t,`aria-label`,e.e=n),r!==e.t&&u(f,`aria-label`,e.t=r),e},{e:void 0,t:void 0}),s(),e}})}o([`mousedown`,`click`]);export{m as t};
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import{S as e,h as t,l as n,p as r,r as i}from"./solid.Ck4Vtfe4.js";import{_ as a,i as o,l as s,o as c,s as l,u}from"./web.DD6VKaIp.js";import{n as d}from"./i18n.LMZI7jyc.js";import{n as f}from"./api.B03e8F6d.js";var p=a(`<div class=plugin-manager><p class=page-hint></p><!$><!/><!$><!/><!$><!/><style>
|
|
2
|
+
.page-hint {
|
|
3
|
+
margin: 0 0 1.25rem;
|
|
4
|
+
color: var(--color-muted);
|
|
5
|
+
font-size: 0.8125rem;
|
|
6
|
+
}
|
|
7
|
+
.badge-enabled {
|
|
8
|
+
display: inline-block;
|
|
9
|
+
margin-left: 0.5rem;
|
|
10
|
+
padding: 0.125rem 0.375rem;
|
|
11
|
+
font-size: 0.625rem;
|
|
12
|
+
font-weight: 600;
|
|
13
|
+
text-transform: uppercase;
|
|
14
|
+
background: var(--color-success-soft);
|
|
15
|
+
color: var(--color-success);
|
|
16
|
+
border-radius: var(--radius-full);
|
|
17
|
+
}
|
|
18
|
+
.enabled-badge {
|
|
19
|
+
color: var(--color-success);
|
|
20
|
+
font-weight: 500;
|
|
21
|
+
}
|
|
22
|
+
.disabled-badge {
|
|
23
|
+
color: var(--color-muted);
|
|
24
|
+
font-weight: 500;
|
|
25
|
+
}
|
|
26
|
+
.plugins-table-container {
|
|
27
|
+
overflow-x: auto;
|
|
28
|
+
}
|
|
29
|
+
.table {
|
|
30
|
+
width: 100%;
|
|
31
|
+
border-collapse: collapse;
|
|
32
|
+
}
|
|
33
|
+
.table th,
|
|
34
|
+
.table td {
|
|
35
|
+
padding: 0.75rem 1rem;
|
|
36
|
+
text-align: left;
|
|
37
|
+
border-bottom: 1px solid var(--color-border);
|
|
38
|
+
}
|
|
39
|
+
.table th {
|
|
40
|
+
font-weight: 600;
|
|
41
|
+
color: var(--color-text);
|
|
42
|
+
background: var(--color-surface);
|
|
43
|
+
}
|
|
44
|
+
.plugin-row:hover {
|
|
45
|
+
background: var(--color-background);
|
|
46
|
+
}
|
|
47
|
+
.plugin-name {
|
|
48
|
+
display: flex;
|
|
49
|
+
flex-direction: column;
|
|
50
|
+
gap: 0.25rem;
|
|
51
|
+
}
|
|
52
|
+
.plugin-name strong {
|
|
53
|
+
font-weight: 500;
|
|
54
|
+
}
|
|
55
|
+
.plugin-description {
|
|
56
|
+
font-size: 0.75rem;
|
|
57
|
+
color: var(--color-muted);
|
|
58
|
+
}
|
|
59
|
+
.status-badge {
|
|
60
|
+
display: inline-flex;
|
|
61
|
+
align-items: center;
|
|
62
|
+
padding: 0.25rem 0.5rem;
|
|
63
|
+
border-radius: var(--radius-full);
|
|
64
|
+
font-size: 0.6875rem;
|
|
65
|
+
font-weight: 600;
|
|
66
|
+
text-transform: uppercase;
|
|
67
|
+
}
|
|
68
|
+
.status-active {
|
|
69
|
+
background: var(--color-success-soft);
|
|
70
|
+
color: var(--color-success);
|
|
71
|
+
}
|
|
72
|
+
.status-installed {
|
|
73
|
+
background: var(--color-primary-soft);
|
|
74
|
+
color: var(--color-primary);
|
|
75
|
+
}
|
|
76
|
+
.status-inactive {
|
|
77
|
+
background: var(--color-muted-soft);
|
|
78
|
+
color: var(--color-muted);
|
|
79
|
+
}
|
|
80
|
+
.status-quarantined {
|
|
81
|
+
background: var(--color-warning-soft);
|
|
82
|
+
color: var(--color-warning);
|
|
83
|
+
}
|
|
84
|
+
.status-missing {
|
|
85
|
+
background: var(--color-error-soft);
|
|
86
|
+
color: var(--color-error);
|
|
87
|
+
}
|
|
88
|
+
.status-load-failed {
|
|
89
|
+
background: var(--color-error-soft);
|
|
90
|
+
color: var(--color-error);
|
|
91
|
+
}
|
|
92
|
+
.empty-state {
|
|
93
|
+
padding: 2rem;
|
|
94
|
+
text-align: center;
|
|
95
|
+
color: var(--color-muted);
|
|
96
|
+
}
|
|
97
|
+
.alert {
|
|
98
|
+
padding: 0.75rem 1rem;
|
|
99
|
+
border-radius: var(--radius-md);
|
|
100
|
+
margin-bottom: 1rem;
|
|
101
|
+
}
|
|
102
|
+
.alert-error {
|
|
103
|
+
background: var(--color-error-soft);
|
|
104
|
+
color: var(--color-error);
|
|
105
|
+
border: 1px solid var(--color-error);
|
|
106
|
+
}
|
|
107
|
+
.skeleton {
|
|
108
|
+
padding: 2rem;
|
|
109
|
+
text-align: center;
|
|
110
|
+
color: var(--color-muted);
|
|
111
|
+
}
|
|
112
|
+
`),m=a(`<div class="alert alert-error">`),h=a(`<div class=skeleton>Loading...`),g=a(`<div class=plugins-table-container><table class=table><thead><tr><th></th><th></th><th></th><th></th></tr></thead><tbody></tbody></table><!$><!/>`),_=a(`<tr class=plugin-row><td class=plugin-name><strong></strong><!$><!/><!$><!/></td><td></td><td><span></span></td><td>`),v=a(`<span class=plugin-description>`),y=a(`<span class=badge-enabled>`),b=a(`<span class=enabled-badge>`),x=a(`<span class=disabled-badge>`),S=a(`<div class=empty-state>`);function C(){let{t:a}=d(),[C,w]=t([]),[T,E]=t(!0),[D,O]=t(null);e(async()=>{await k()});async function k(){try{E(!0);let e=await f.getPlugins();w(e)}catch{O(a(`plugins.loadError`))}finally{E(!1)}}let A=e=>{switch(e){case`ACTIVE`:case`ACTIVATED`:return a(`plugins.status.active`);case`INSTALLED`:return a(`plugins.status.installed`);case`INACTIVE`:case`DEACTIVATED`:return a(`plugins.status.inactive`);case`QUARANTINED`:return a(`plugins.status.quarantined`);case`MISSING`:return a(`plugins.status.missing`);case`LOAD_FAILED`:return a(`plugins.status.loadFailed`);default:return e}},j=e=>{switch(e){case`ACTIVE`:case`ACTIVATED`:return`status-active`;case`INSTALLED`:return`status-installed`;case`INACTIVE`:case`DEACTIVATED`:return`status-inactive`;case`QUARANTINED`:return`status-quarantined`;case`MISSING`:return`status-missing`;case`LOAD_FAILED`:return`status-load-failed`;default:return``}};return(()=>{var e=c(p),t=e.firstChild,d=t.nextSibling,[f,w]=l(d.nextSibling),E=f.nextSibling,[O,k]=l(E.nextSibling),M=O.nextSibling,[N,P]=l(M.nextSibling);return N.nextSibling,s(t,()=>a(`plugins.directoryHint`)),s(e,(()=>{var e=u(()=>!!D());return()=>e()&&(()=>{var e=c(m);return s(e,D),e})()})(),f,w),s(e,(()=>{var e=u(()=>!!T());return()=>e()&&c(h)})(),O,k),s(e,(()=>{var e=u(()=>!(T()||D()));return()=>e()&&(()=>{var e=c(g),t=e.firstChild,d=t.firstChild,f=d.firstChild.firstChild,p=f.nextSibling,m=p.nextSibling,h=m.nextSibling,w=d.nextSibling,T=t.nextSibling,[E,D]=l(T.nextSibling);return s(f,()=>a(`plugins.columns.name`)),s(p,()=>a(`plugins.columns.version`)),s(m,()=>a(`plugins.columns.status`)),s(h,()=>a(`plugins.columns.enabled`)),s(w,n(i,{get each(){return C()},children:e=>(()=>{var t=c(_),n=t.firstChild,i=n.firstChild,d=i.nextSibling,[f,p]=l(d.nextSibling),m=f.nextSibling,[h,g]=l(m.nextSibling),S=n.nextSibling,C=S.nextSibling,w=C.firstChild,T=C.nextSibling;return s(i,()=>e.name),s(n,(()=>{var t=u(()=>!!e.manifest?.description);return()=>t()&&(()=>{var t=c(v);return s(t,()=>e.manifest.description),t})()})(),f,p),s(n,(()=>{var t=u(()=>!!e.enabled);return()=>t()&&(()=>{var e=c(y);return s(e,()=>a(`plugins.enabledForTenant`)),e})()})(),h,g),s(S,()=>e.version),s(w,()=>A(e.status)),s(T,(()=>{var t=u(()=>!!e.enabled);return()=>t()?(()=>{var e=c(b);return s(e,()=>a(`plugins.enabledYes`)),e})():(()=>{var e=c(x);return s(e,()=>a(`plugins.enabledNo`)),e})()})()),r(()=>o(w,`status-badge ${j(e.status)}`)),t})()})),s(e,(()=>{var e=u(()=>C().length===0);return()=>e()&&(()=>{var e=c(S);return s(e,()=>a(`plugins.empty`)),e})()})(),E,D),e})()})(),N,P),e})()}export{C as PluginManager};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{S as e,a as t,d as n,f as r,h as i,l as a,p as o,r as s,x as c}from"./solid.Ck4Vtfe4.js";import{_ as l,a as u,f as d,h as f,l as p,m,o as h,p as g,s as _,u as v,v as y}from"./web.DD6VKaIp.js";import{n as b}from"./i18n.LMZI7jyc.js";import{n as x}from"./api.B03e8F6d.js";import{t as S}from"./FloatingPanel.BetdW5N2.js";import{t as C}from"./iconsAndAliases.ujTnkhnl.js";var w=l(`<input type=search class="input icon-picker__search">`),T=l(`<div class=icon-picker__viewport><div class=icon-picker__grid role=listbox>`),E=l(`<p class=icon-picker__count>`),D=l(`<div class=icon-picker><button type=button class="input icon-picker__trigger"aria-haspopup=dialog><span class=icon-picker__value><span class=icon-picker__preview aria-hidden=true></span><span class=icon-picker__name></span></span><span class=icon-picker__caret aria-hidden=true></span></button><!$><!/>`),O=l(`<p class=icon-picker__empty>`),k=l(`<button type=button role=option class=icon-picker__cell style=height:56px>`),A=56,j=60,M=300,ee=2,N=Math.ceil(M/j)+4,P=e=>e.replace(/(^|[-_])(\w)/g,(e,t,n)=>n.toUpperCase()),F=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).replace(/([A-Z])([A-Z][a-z])/g,`$1-$2`).toLowerCase(),I=`xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"`,L=e=>Object.entries(e).map(([e,t])=>`${e}="${String(t).replace(/"/g,`"`)}"`).join(` `),R=null,z=()=>(R||=[...new Set(Object.keys(C).map(F))].sort(),R),B=new Map;function te(e){let t=B.get(e);if(t!==void 0)return t;let n=C[P(e)],r=``;return Array.isArray(n)&&(r=`<svg ${I}>${n.map(([e,t])=>`<${e} ${L(t)} />`).join(``)}</svg>`),B.set(e,r),r}var V=e=>e.toLowerCase().replace(/[-_\s]+/g,` `).trim();function H(l){let[u,b]=i(!1),[x,C]=i(``),[P,F]=i(-1),[I,L]=i(0),[R,B]=i(6),[H,ne]=i(void 0),[re,ie]=i(void 0),U,W,ae,G,K=r(()=>{let e=V(x()).split(` `).filter(Boolean),t=z();return e.length===0?t:t.filter(t=>{let n=V(t);return e.every(e=>n.includes(e))})}),q=r(()=>{let e=Math.max(1,R());return K().map((t,n)=>({name:t,index:n,row:Math.floor(n/e),col:n%e}))}),oe=r(()=>Math.max(0,Math.floor(I()/j)-ee)*R()),J=r(()=>{let e=oe();return q().slice(e,e+N*R())}),Y=r(()=>Math.ceil(q().length/Math.max(1,R()))),X=e=>{let t=e?.clientWidth??0;if(t<=0)return;let n=Math.max(3,Math.floor(t/A));B(e=>e===n?e:n)},Z=(e,t=`nearest`)=>{let n=W;if(!n||e<0)return;let r=Math.max(1,R()),i=Math.floor(e/r)*j,a=i+j,o=n.scrollTop;t===`center`?o=i-M/2+j/2:i<n.scrollTop?o=i:a>n.scrollTop+M&&(o=a-M);let s=Math.max(0,Y()*j-M);o=Math.min(Math.max(0,o),s),n.scrollTop=o,L(o)},se=e=>{l.onChange(e),b(!1),C(``)},Q=e=>{let t=K();if(t.length===0)return;let n=P(),r=n<0?e>0?-1:t.length:n,i=Math.min(Math.max(0,r+e),t.length-1);F(i),Z(i)},$=e=>{let t=Math.max(1,R());switch(e.key){case`ArrowDown`:e.preventDefault(),Q(t);break;case`ArrowUp`:e.preventDefault(),Q(-t);break;case`ArrowRight`:e.preventDefault(),Q(1);break;case`ArrowLeft`:e.preventDefault(),Q(-1);break;case`Home`:e.preventDefault(),F(0),Z(0);break;case`End`:e.preventDefault(),F(K().length-1),Z(K().length-1);break;case`Enter`:{e.preventDefault();let t=K()[P()];t&&se(t);break}}};return e(()=>{typeof ResizeObserver<`u`&&(G=new ResizeObserver(e=>{X(e[0]?.target)})),X(H()),c(()=>G?.disconnect())}),n(()=>{let e=H();e&&(X(e),G?.observe(e))}),n(()=>{u()&&(F(-1),queueMicrotask(()=>{let e=K().indexOf(l.value);e>=0&&Z(e,`center`),ae?.focus()}))}),n(()=>{x(),F(-1),W&&(W.scrollTop=0),L(0)}),(()=>{var e=h(D),n=e.firstChild,r=n.firstChild,i=r.firstChild,c=i.nextSibling,A=r.nextSibling,M=n.nextSibling,[ee,N]=_(M.nextSibling),F=U;return typeof F==`function`?y(F,e):U=e,n.$$click=()=>b(!u()),y(ie,n),p(c,()=>l.value||`box`),p(A,()=>u()?`▴`:`▾`),p(e,a(S,{get open(){return u()},get trigger(){return re()},onClose:()=>b(!1),class:`icon-picker__panel`,role:`dialog`,get"aria-label"(){return l.label},minWidth:360,onKeyDown:$,get children(){return[(()=>{var e=h(w);return y(e=>ae=e,e),e.$$input=e=>C(e.currentTarget.value),o(()=>g(e,`placeholder`,l.searchPlaceholder)),o(()=>m(e,`value`,x())),d(),e})(),a(t,{get when(){return K().length>0},get fallback(){return(()=>{var e=h(O);return p(e,()=>l.emptyLabel??`—`),e})()},get children(){var e=h(T),t=e.firstChild;return e.addEventListener(`scroll`,e=>L(e.currentTarget.scrollTop)),y(e=>W=e,e),y(ne,t),p(t,a(s,{get each(){return J()},children:e=>(()=>{var t=h(k);return t.$$click=()=>se(e.name),o(n=>{var r=e.name,i=e.name,a=l.value===e.name,o=l.value===e.name,s=P()===e.index,c=`${e.row*j}px`,u=`${e.col*(100/Math.max(1,R()))}%`,d=`${100/Math.max(1,R())}%`,p=te(e.name);return r!==n.e&&g(t,`title`,n.e=r),i!==n.t&&g(t,`aria-label`,n.t=i),a!==n.a&&g(t,`aria-selected`,n.a=a),o!==n.o&&t.classList.toggle(`is-selected`,n.o=o),s!==n.i&&t.classList.toggle(`is-active`,n.i=s),c!==n.n&&f(t,`top`,n.n=c),u!==n.s&&f(t,`left`,n.s=u),d!==n.h&&f(t,`width`,n.h=d),p!==n.r&&m(t,`innerHTML`,n.r=p),n},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0}),d(),t})()})),o(e=>{var n=l.label,r=`${Y()*j}px`;return n!==e.e&&g(t,`aria-label`,e.e=n),r!==e.t&&f(t,`height`,e.t=r),e},{e:void 0,t:void 0}),e}}),a(t,{get when(){return v(()=>!!l.countLabel)()&&K().length>0},get children(){var e=h(E);return p(e,()=>l.countLabel?.(K().length)),e}})]}}),ee,N),o(e=>{var t=u(),r=te(l.value||`box`);return t!==e.e&&g(n,`aria-expanded`,e.e=t),r!==e.t&&m(i,`innerHTML`,e.t=r),e},{e:void 0,t:void 0}),d(),e})()}u([`click`,`input`]);var ne=l(`<div class="notice notice--error">`),re=l(`<button type=button class="btn btn-secondary">`),ie=l(`<div class=post-types-manager><!$><!/><form class=card><h3></h3><div class=form-grid><label><!$><!/><input class=input required pattern=[a-z0-9_]+></label><label><!$><!/><input class=input required></label><label><!$><!/><input class=input required></label><label class=post-types-manager__icon-field><!$><!/><!$><!/><small class=muted></small></label></div><fieldset class=supports><legend></legend><!$><!/><label><input type=checkbox> <!$><!/></label><label><input type=checkbox> <!$><!/></label></fieldset><button type=submit class="btn btn-primary"></button><!$><!/></form><div class="card settings-table-card"><table class=table><thead><tr><th></th><th></th><th></th><th></th><th></th><th></th><th></th><th></th><th></th></tr></thead><tbody>`),U=l(`<label><input type=checkbox> <!$><!/>`),W=l(`<button type=button class="btn btn-danger">`),ae=l(`<tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td><span class=post-types-manager__icon><span class=post-types-manager__icon-preview aria-hidden=true></span><!$><!/></span></td><td><button type=button class="btn btn-secondary"></button> <!$><!/>`);function G(){let{t:n}=b(),[c,l]=i([]),[u,f]=i(``),[y,S]=i(!1),[C,w]=i(null),T=r(()=>[{value:`title`,label:n(`settings.postTypes.form.supportsOptions.title`)},{value:`editor`,label:n(`settings.postTypes.form.supportsOptions.editor`)},{value:`thumbnail`,label:n(`settings.postTypes.form.supportsOptions.thumbnail`)},{value:`excerpt`,label:n(`settings.postTypes.form.supportsOptions.excerpt`)},{value:`revisions`,label:n(`settings.postTypes.form.supportsOptions.revisions`)}]),[E,D]=i({name:``,slug:``,singularLabel:``,pluralLabel:``,hasArchive:!1,singleton:!1,menuIcon:`box`,supports:[`title`,`editor`]}),O=()=>{w(null),D({name:``,slug:``,singularLabel:``,pluralLabel:``,hasArchive:!1,singleton:!1,menuIcon:`box`,supports:[`title`,`editor`]})},k=async()=>{try{l(await x.getContentTypes())}catch(e){f(e instanceof Error?e.message:String(e))}};e(k);let A=async e=>{e.preventDefault(),f(``),S(!0);try{let e={name:E().name||E().slug,slug:E().slug,singularLabel:E().singularLabel,pluralLabel:E().pluralLabel,hasArchive:E().hasArchive,singleton:E().singleton,menuIcon:E().menuIcon||`box`,supports:E().supports};C()?await x.updateContentType(C(),e):await x.createContentType(e),O(),await k(),window.dispatchEvent(new Event(`okcms:content-models-changed`))}catch(e){f(e instanceof Error?e.message:String(e))}finally{S(!1)}},j=e=>{w(e.slug),D({name:e.name,slug:e.slug,singularLabel:e.singularLabel,pluralLabel:e.pluralLabel,hasArchive:e.hasArchive??!1,singleton:e.singleton??!1,menuIcon:e.menuIcon??`box`,supports:[...e.supports??[`title`,`editor`]]})},M=async e=>{try{await x.deleteContentType(e),await k(),window.dispatchEvent(new Event(`okcms:content-models-changed`))}catch(e){f(e instanceof Error?e.message:String(e))}};return(()=>{var e=h(ie),r=e.firstChild,[i,l]=_(r.nextSibling),f=i.nextSibling,b=f.firstChild,x=b.nextSibling,S=x.firstChild,w=S.firstChild,[k,ee]=_(w.nextSibling),N=k.nextSibling,P=S.nextSibling,F=P.firstChild,[I,L]=_(F.nextSibling),R=I.nextSibling,z=P.nextSibling,B=z.firstChild,[V,G]=_(B.nextSibling),K=V.nextSibling,q=z.nextSibling,oe=q.firstChild,[J,Y]=_(oe.nextSibling),X=J.nextSibling,[Z,se]=_(X.nextSibling),Q=Z.nextSibling,$=x.nextSibling,ce=$.firstChild,le=ce.nextSibling,[ue,de]=_(le.nextSibling),fe=ue.nextSibling,pe=fe.firstChild,me=pe.nextSibling.nextSibling,[he,ge]=_(me.nextSibling),_e=fe.nextSibling,ve=_e.firstChild,ye=ve.nextSibling.nextSibling,[be,xe]=_(ye.nextSibling),Se=$.nextSibling,Ce=Se.nextSibling,[we,Te]=_(Ce.nextSibling),Ee=f.nextSibling.firstChild.firstChild,De=Ee.firstChild.firstChild,Oe=De.nextSibling,ke=Oe.nextSibling,Ae=ke.nextSibling,je=Ae.nextSibling,Me=je.nextSibling,Ne=Me.nextSibling,Pe=Ne.nextSibling,Fe=Ee.nextSibling;return p(e,a(t,{get when(){return u()},get children(){var e=h(ne);return p(e,u),e}}),i,l),f.addEventListener(`submit`,A),p(b,(()=>{var e=v(()=>!!C());return()=>e()?n(`settings.postTypes.form.editTitle`):n(`settings.postTypes.form.title`)})()),p(S,()=>n(`settings.postTypes.form.slug`),k,ee),N.$$input=e=>D({...E(),slug:e.currentTarget.value}),p(P,()=>n(`settings.postTypes.form.singular`),I,L),R.$$input=e=>D({...E(),singularLabel:e.currentTarget.value}),p(z,()=>n(`settings.postTypes.form.plural`),V,G),K.$$input=e=>D({...E(),pluralLabel:e.currentTarget.value}),p(q,()=>n(`settings.postTypes.form.icon`),J,Y),p(q,a(H,{get value(){return E().menuIcon},onChange:e=>D({...E(),menuIcon:e}),get searchPlaceholder(){return n(`settings.postTypes.form.iconSearchPlaceholder`)},get emptyLabel(){return n(`settings.postTypes.form.iconEmpty`)},countLabel:e=>n(`settings.postTypes.form.iconCount`,{count:e}),get label(){return n(`settings.postTypes.form.icon`)}}),Z,se),p(Q,()=>n(`settings.postTypes.form.iconHint`)),p(ce,()=>n(`settings.postTypes.form.supports`)),p($,a(s,{get each(){return T()},children:e=>(()=>{var t=h(U),n=t.firstChild,r=n.nextSibling.nextSibling,[i,a]=_(r.nextSibling);return n.addEventListener(`change`,t=>D({...E(),supports:t.currentTarget.checked?[...E().supports,e.value]:E().supports.filter(t=>t!==e.value)})),p(t,()=>e.label,i,a),o(()=>m(n,`checked`,E().supports.includes(e.value))),t})()}),ue,de),pe.addEventListener(`change`,e=>D({...E(),hasArchive:e.currentTarget.checked})),p(fe,()=>n(`settings.postTypes.form.hasArchive`),he,ge),ve.addEventListener(`change`,e=>D({...E(),singleton:e.currentTarget.checked})),p(_e,()=>n(`settings.postTypes.form.singleton`),be,xe),p(Se,(()=>{var e=v(()=>!!C());return()=>e()?n(`settings.postTypes.form.update`):n(`settings.postTypes.form.create`)})()),p(f,a(t,{get when(){return C()},get children(){var e=h(re);return e.$$click=O,p(e,()=>n(`settings.postTypes.form.cancel`)),d(),e}}),we,Te),p(De,()=>n(`settings.postTypes.table.slug`)),p(Oe,()=>n(`settings.postTypes.table.singular`)),p(ke,()=>n(`settings.postTypes.table.plural`)),p(Ae,()=>n(`settings.postTypes.table.source`)),p(je,()=>n(`settings.postTypes.table.supports`)),p(Me,()=>n(`settings.postTypes.table.archive`)),p(Ne,()=>n(`settings.postTypes.table.mode`)),p(Pe,()=>n(`settings.postTypes.table.icon`)),p(Fe,a(s,{get each(){return c()},children:e=>(()=>{var r=h(ae),i=r.firstChild,s=i.nextSibling,c=s.nextSibling,l=c.nextSibling,u=l.nextSibling,f=u.nextSibling,g=f.nextSibling,y=g.nextSibling,b=y.firstChild,x=b.firstChild,S=x.nextSibling,[C,w]=_(S.nextSibling),T=y.nextSibling,E=T.firstChild,D=E.nextSibling.nextSibling,[O,k]=_(D.nextSibling);return p(i,()=>e.slug),p(s,()=>e.singularLabel),p(c,()=>e.pluralLabel),p(l,()=>e.source??n(`settings.postTypes.sources.admin`)),p(u,()=>(e.supports??[]).join(`, `)),p(f,(()=>{var t=v(()=>!!e.hasArchive);return()=>t()?n(`common.yes`):n(`common.no`)})()),p(g,(()=>{var t=v(()=>!!e.singleton);return()=>t()?n(`settings.postTypes.table.singleton`):n(`settings.postTypes.table.collection`)})()),p(b,()=>e.menuIcon??`box`,C,w),E.$$click=()=>j(e),p(E,()=>n(`settings.postTypes.table.actions.edit`)),p(T,a(t,{get when(){return e.source!==`CORE`},get children(){var t=h(W);return t.$$click=()=>M(e.slug),p(t,()=>n(`settings.postTypes.table.actions.remove`)),d(),t}}),O,k),o(()=>m(x,`innerHTML`,te(e.menuIcon??`box`))),d(),r})()})),o(e=>{var t=n(`settings.postTypes.form.slugHint`),r=y();return t!==e.e&&g(N,`title`,e.e=t),r!==e.t&&m(Se,`disabled`,e.t=r),e},{e:void 0,t:void 0}),o(()=>m(N,`value`,E().slug)),o(()=>m(R,`value`,E().singularLabel)),o(()=>m(K,`value`,E().pluralLabel)),o(()=>m(pe,`checked`,E().hasArchive)),o(()=>m(ve,`checked`,E().singleton)),d(),e})()}u([`input`,`click`]);export{G as PostTypesManager};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import{S as e,h as t,l as n,p as r,r as i}from"./solid.Ck4Vtfe4.js";import{_ as a,a as o,f as s,l as c,m as l,o as u,p as d,s as f,u as p}from"./web.DD6VKaIp.js";import{n as m}from"./i18n.LMZI7jyc.js";import{n as h}from"./api.B03e8F6d.js";import{DashboardWidget as g}from"./AtGlanceWidget.DMrAc7qb.js";var _=a(`<div class=quick-draft-wrapper><div class=quick-draft-content-wrapper>`),v=a(`<style>
|
|
2
|
+
.quick-draft-form { display: flex; flex-direction: column; gap: 1rem; }
|
|
3
|
+
.form-group textarea { min-height: 100px; resize: vertical; font-family: inherit; }
|
|
4
|
+
.drafts-list h4 { margin-bottom: 1rem; }
|
|
5
|
+
.draft-item {
|
|
6
|
+
display: flex; flex-direction: column; gap: 0.5rem;
|
|
7
|
+
padding: 0.75rem; background: var(--color-surface);
|
|
8
|
+
border: 1px solid var(--color-border); border-radius: var(--radius-md);
|
|
9
|
+
text-decoration: none; color: inherit; transition: all 0.15s ease;
|
|
10
|
+
}
|
|
11
|
+
.draft-item:hover { border-color: var(--color-primary); background: var(--color-surface-hover); }
|
|
12
|
+
.draft-info { display: flex; flex-direction: column; gap: 0.25rem; }
|
|
13
|
+
.draft-title { font-weight: 600; color: var(--color-text); }
|
|
14
|
+
.draft-meta { display: flex; gap: 0.5rem; font-size: 0.8125rem; color: var(--color-muted); }
|
|
15
|
+
.status-draft { color: var(--color-warning); font-weight: 500; }
|
|
16
|
+
.draft-date { font-size: 0.75rem; }
|
|
17
|
+
`),y=a(`<div class=skeleton>Loading...`),b=a(`<div class=quick-draft-content><form class=quick-draft-form><div class=form-group><label for=quick-draft-title></label><input type=text id=quick-draft-title class=input required></div><div class=form-group><label for=quick-draft-content></label><textarea id=quick-draft-content class=input rows=4></textarea></div><div class=form-actions><button type=submit class="btn btn-primary"></button><button type=button class="btn btn-secondary"></button></div></form><div class=drafts-section>`),x=a(`<span class=spinner>`),S=a(`<div class=drafts-list><h4></h4><!$><!/>`),C=a(`<a class=draft-item><div class=draft-info><span class=draft-title></span><span class=draft-meta><span class=status-draft></span><span class=draft-date>`),w=a(`<p class=empty-state>`);function T(){let{t:a}=m(),[o,T]=t([]),[E,D]=t(!0),[O,k]=t(!1),[A,j]=t(``),[M,N]=t(``);e(async()=>{try{let e=await h.getContent({type:`post`,status:`DRAFT`,limit:5});T(e.data??[])}catch(e){console.error(`Failed to load drafts:`,e)}finally{D(!1)}});let P=async e=>{if(e.preventDefault(),A().trim()){k(!0);try{let e=await h.createContent({type:`post`,title:A(),slug:A().toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/(^-|-$)/g,``),excerpt:M(),status:`DRAFT`,body:{content:M()}});T([e,...o()]),j(``),N(``)}catch(e){console.error(`Failed to save draft:`,e)}finally{k(!1)}}},F=e=>e?new Date(e).toLocaleDateString(`pt-BR`,{day:`2-digit`,month:`2-digit`,year:`numeric`,hour:`2-digit`,minute:`2-digit`}):``;return n(g,{get title(){return a(`dashboard.widgets.quickDraft.title`)},panelId:`quick-draft`,get children(){return[(()=>{var e=u(_),t=e.firstChild;return c(t,(()=>{var e=p(()=>!!E());return()=>e()?u(y):(()=>{var e=u(b),t=e.firstChild,m=t.firstChild,h=m.firstChild,g=h.nextSibling,_=m.nextSibling,v=_.firstChild,y=v.nextSibling,T=_.nextSibling.firstChild,E=T.nextSibling,D=t.nextSibling;return t.addEventListener(`submit`,P),c(h,()=>a(`dashboard.widgets.quickDraft.heading`)),g.$$input=e=>j(e.currentTarget.value),c(v,()=>a(`dashboard.widgets.quickDraft.content`)),y.$$input=e=>N(e.currentTarget.value),c(T,(()=>{var e=p(()=>!!O());return()=>e()?u(x):a(`dashboard.widgets.quickDraft.save`)})()),E.$$click=()=>{j(``),N(``)},c(E,()=>a(`common.cancel`)),c(D,(()=>{var e=p(()=>o().length>0);return()=>e()?(()=>{var e=u(S),t=e.firstChild,s=t.nextSibling,[l,p]=f(s.nextSibling);return c(t,()=>a(`dashboard.widgets.quickDraft.yourDrafts`)),c(e,n(i,{get each(){return o()},children:e=>(()=>{var t=u(C),n=t.firstChild.firstChild,i=n.nextSibling.firstChild,o=i.nextSibling;return c(n,()=>e.title),c(i,()=>a(`content.list.statuses.draft`)),c(o,()=>F(e.updated_at)),r(()=>d(t,`href`,`/content/${encodeURIComponent(e.type||`post`)}/edit?id=${e.id}`)),t})()}),l,p),e})():(()=>{var e=u(w);return c(e,()=>a(`dashboard.widgets.quickDraft.noDrafts`)),e})()})()),r(e=>{var t=a(`dashboard.widgets.quickDraft.headingPlaceholder`),n=a(`dashboard.widgets.quickDraft.contentPlaceholder`),r=O();return t!==e.e&&d(g,`placeholder`,e.e=t),n!==e.t&&d(y,`placeholder`,e.t=n),r!==e.a&&l(T,`disabled`,e.a=r),e},{e:void 0,t:void 0,a:void 0}),r(()=>l(g,`value`,A())),r(()=>l(y,`value`,M())),s(),e})()})()),e})(),u(v)]}})}o([`input`,`click`]);export{T as QuickDraftWidget};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{S as e,a as t,f as n,h as r,l as i,p as a,r as o}from"./solid.Ck4Vtfe4.js";import{_ as s,a as c,f as l,l as u,m as d,o as f,p,s as m,u as h,v as g}from"./web.DD6VKaIp.js";import{n as _}from"./i18n.LMZI7jyc.js";import{n as v}from"./api.B03e8F6d.js";import{t as y}from"./Modal.CPaZJlDP.js";import{t as b}from"./FloatingPanel.BetdW5N2.js";var x=s(`<input type=search class="input permission-picker__search">`),S=s(`<div class=permission-picker__matrix role=presentation><div class="permission-picker__row permission-picker__row--head"role=presentation><span class=permission-picker__resource></span><!$><!/><!$><!/></div><!$><!/>`),C=s(`<div class=permission-picker__custom><p class=permission-picker__custom-label></p><div class=permission-picker__chips><!$><!/><form class=permission-picker__custom-form><input class="input permission-picker__custom-input"><button class="btn btn-secondary btn-sm"type=submit>`),w=s(`<p class=icon-picker__count>`),T=s(`<div class=permission-picker><button type=button class="input permission-picker__trigger"aria-haspopup=dialog><span class=permission-picker__value></span><span class=icon-picker__caret aria-hidden=true></span></button><!$><!/>`),E=s(`<span class=permission-picker__action-label>`),D=s(`<p class=permission-picker__empty>`),O=s(`<div class=permission-picker__row><span class=permission-picker__resource></span><!$><!/>`),k=s(`<label class=permission-picker__cell><input type=checkbox><span aria-hidden=true>✓`),A=s(`<span class="permission-picker__cell permission-picker__cell--empty">`),ee=s(`<span class=permission-picker__chip><code></code><button type=button>×`),j=[`read`,`create`,`update`,`delete`],M=[`content`,`media`,`category`,`tag`,`menu`,`user`,`roles`,`theme`,`plugin`,`setting`,`webhook`,`tenants`,`audit`,`build`,`system`],N={media:[`upload`]},P=(e,t)=>`${e}:${t}`,F=e=>{let[t,n]=e.split(`:`);return!t||!n?!1:j.includes(t)&&M.includes(n)};function I(e){let{t:s}=_(),[c,h]=r(!1),[v,y]=r(``),[I,L]=r(``),[R,z]=r(void 0),B=n(()=>new Set(e.value)),V=n(()=>e.value.filter(e=>!F(e))),H=n(()=>{let e=v().trim().toLowerCase();return e?M.filter(t=>t.includes(e)||s(`access.resources.${t}`).toLowerCase().includes(e)):M}),U=n(()=>{let e=new Set;for(let t of H())for(let n of N[t]??[])e.add(n);return[...e]}),W=(e,t)=>j.includes(e)||(N[t]??[]).includes(e),G=(t,n)=>{let r=P(t,n);e.onChange(B().has(r)?e.value.filter(e=>e!==r):[...e.value,r])},K=t=>{e.onChange(e.value.filter(e=>e!==t))},q=()=>{let t=I().trim().toLowerCase().replace(/\s+/g,`-`);t&&!B().has(t)&&e.onChange([...e.value,t]),L(``)},J=()=>{let t=e.value.length;if(t===0)return e.placeholder??s(`access.permissionsPlaceholder`);let n=new Set(e.value.map(e=>e.split(`:`)[1]??e));return s(`access.permissionsSummary`,{resources:n.size,count:t})};return(()=>{var n=f(T),r=n.firstChild,_=r.firstChild,M=_.nextSibling,N=r.nextSibling,[F,Y]=m(N.nextSibling);return r.$$click=()=>h(!c()),g(z,r),u(_,J),u(M,()=>c()?`▴`:`▾`),u(n,i(b,{get open(){return c()},get trigger(){return R()},onClose:()=>h(!1),class:`permission-picker__panel`,role:`dialog`,get"aria-label"(){return s(`access.permissions`)},minWidth:440,get children(){return[(()=>{var t=f(x);return t.$$input=e=>y(e.currentTarget.value),a(()=>p(t,`placeholder`,e.searchPlaceholder??s(`access.permissionSearch`))),a(()=>d(t,`value`,v())),l(),t})(),(()=>{var e=f(S),t=e.firstChild,n=t.firstChild.nextSibling,[r,c]=m(n.nextSibling),l=r.nextSibling,[h,g]=m(l.nextSibling),_=t.nextSibling,[v,y]=m(_.nextSibling);return u(t,i(o,{each:j,children:e=>(()=>{var t=f(E);return u(t,e),t})()}),r,c),u(t,i(o,{get each(){return U()},children:e=>(()=>{var t=f(E);return u(t,e),t})()}),h,g),u(e,i(o,{get each(){return H()},get fallback(){return(()=>{var e=f(D);return u(e,()=>s(`access.permissionNoMatches`)),e})()},children:e=>(()=>{var t=f(O),n=t.firstChild,r=n.nextSibling,[c,l]=m(r.nextSibling);return p(n,`title`,e),u(n,()=>s(`access.resources.${e}`)),u(t,i(o,{get each(){return[...j,...U()]},children:t=>W(t,e)?(()=>{var n=f(k),r=n.firstChild;return p(n,`title`,`${t}:${e}`),r.addEventListener(`change`,()=>G(t,e)),a(()=>n.classList.toggle(`is-checked`,!!B().has(P(t,e)))),a(()=>d(r,`checked`,B().has(P(t,e)))),n})():f(A)}),c,l),t})()}),v,y),e})(),(()=>{var e=f(C),t=e.firstChild,n=t.nextSibling,r=n.firstChild,[c,h]=m(r.nextSibling),g=c.nextSibling,_=g.firstChild,v=_.nextSibling;return u(t,()=>s(`access.customPermissions`)),u(n,i(o,{get each(){return V()},children:e=>(()=>{var t=f(ee),n=t.firstChild,r=n.nextSibling;return u(n,e),r.$$click=()=>K(e),a(()=>p(r,`aria-label`,`${s(`common.remove`)}: ${e}`)),l(),t})()}),c,h),g.addEventListener(`submit`,e=>{e.preventDefault(),q()}),_.$$input=e=>L(e.currentTarget.value),u(v,()=>s(`common.add`)),a(()=>p(_,`placeholder`,s(`access.customPermission`))),a(()=>d(_,`value`,I())),l(),e})(),i(t,{get when(){return e.value.length>0},get children(){var t=f(w);return u(t,()=>s(`access.permissionsSelected`,{count:e.value.length})),t}})]}}),F,Y),a(t=>{var n=c(),i=e.value.length===0;return n!==t.e&&p(r,`aria-expanded`,t.e=n),i!==t.t&&_.classList.toggle(`is-empty`,t.t=i),t},{e:void 0,t:void 0}),l(),n})()}c([`click`,`input`]);var L=s(`<div class="notice notice--error">`),R=s(`<div class=resource-hub><!$><!/><div class=access-grid><section class=card><div class=card-header-row><h3></h3><button class="btn btn-primary"type=button>+ <!$><!/></button></div><table class=table><thead><tr><th></th><th></th><th></th><th></th></tr></thead><tbody></tbody></table><!$><!/></section><section class=card><div class=card-header-row><h3></h3><button class="btn btn-primary"type=button>+ <!$><!/></button></div><table class=table><thead><tr><th></th><th></th><th></th><th></th></tr></thead><tbody></tbody></table><!$><!/>`),z=s(`<button class="btn btn-danger btn-sm"type=button>`),B=s(`<tr><td></td><td><code></code></td><td class=access-permissions-cell></td><td class=access-actions><button class="btn btn-secondary btn-sm"type=button></button><!$><!/>`),V=s(`<form class=resource-form><label><span class=resource-form__label></span><input class=input required></label><label><span class=resource-form__label></span><input class=input required></label><div class=resource-form__field><span class=resource-form__label></span><!$><!/></div><div class=form-actions><button class="btn btn-secondary"type=button></button><button class="btn btn-primary"type=submit>`),H=s(`<tr><td></td><td><code></code></td><td></td><td class=access-actions><button class="btn btn-secondary btn-sm"type=button></button><button class="btn btn-danger btn-sm"type=button>`),U=s(`<form class=resource-form><label><span class=resource-form__label></span><input class=input required></label><label><span class=resource-form__label></span><input class=input required></label><label><span class=resource-form__label></span><input class=input></label><div class=form-actions><button class="btn btn-secondary"type=button></button><button class="btn btn-primary"type=submit>`);function W(){let{t:n}=_(),[s,c]=r([]),[g,b]=r([]),[x,S]=r(null),[C,w]=r(null),[T,E]=r(!1),[D,O]=r(``),k=async()=>{try{c(await v.listRoles()),b((await v.listTenants({limit:100})).data??[])}catch(e){O(e instanceof Error?e.message:String(e))}};e(k);let A=e=>{e.preventDefault();let t=x();t&&(E(!0),(t.id?v.updateRole(t.id,t):v.createRole(t)).then(()=>(S(null),k())).catch(e=>O(e instanceof Error?e.message:String(e))).finally(()=>E(!1)))},ee=e=>{e.preventDefault();let t=C();t&&(E(!0),(t.id?v.updateTenant(t.id,t):v.createTenant(t)).then(()=>(w(null),k())).catch(e=>O(e instanceof Error?e.message:String(e))).finally(()=>E(!1)))},j=e=>{let t=e.permissions??[];return t.length===0?`—`:t.slice(0,4).join(`, `)+(t.length>4?` +${t.length-4}`:``)};return(()=>{var e=f(R),r=e.firstChild,[c,_]=m(r.nextSibling),b=c.nextSibling.firstChild,E=b.firstChild,O=E.firstChild,M=O.nextSibling,N=M.firstChild.nextSibling,[P,F]=m(N.nextSibling),W=E.nextSibling,G=W.firstChild,K=G.firstChild.firstChild,q=K.nextSibling,J=q.nextSibling,Y=G.nextSibling,te=W.nextSibling,[ne,re]=m(te.nextSibling),X=b.nextSibling,Z=X.firstChild,Q=Z.firstChild,$=Q.nextSibling,ie=$.firstChild.nextSibling,[ae,oe]=m(ie.nextSibling),se=Z.nextSibling,ce=se.firstChild,le=ce.firstChild.firstChild,ue=le.nextSibling,de=ue.nextSibling,fe=ce.nextSibling,pe=se.nextSibling,[me,he]=m(pe.nextSibling);return u(e,i(t,{get when(){return D()},get children(){var e=f(L);return u(e,D),e}}),c,_),u(O,()=>n(`access.roles`)),M.$$click=()=>S({name:``,slug:``,permissions:[]}),u(M,()=>n(`common.create`),P,F),u(K,()=>n(`resources.name`)),u(q,()=>n(`resources.slug`)),u(J,()=>n(`access.permissions`)),u(Y,i(o,{get each(){return s()},children:e=>(()=>{var r=f(B),o=r.firstChild,s=o.nextSibling,c=s.firstChild,d=s.nextSibling,h=d.nextSibling,g=h.firstChild,_=g.nextSibling,[y,b]=m(_.nextSibling);return u(o,()=>e.name),u(c,()=>e.slug),u(d,()=>j(e)),g.$$click=()=>S({...e,permissions:[...e.permissions??[]]}),u(g,()=>n(`common.edit`)),u(h,i(t,{get when(){return!e.is_system},get children(){var t=f(z);return t.$$click=()=>void v.deleteRole(e.id).then(k),u(t,()=>n(`common.delete`)),l(),t}}),y,b),a(()=>p(d,`title`,(e.permissions??[]).join(`, `))),l(),r})()})),u(b,i(y,{get open(){return x()!==null},onClose:()=>S(null),get title(){return h(()=>!!x()?.id)()?n(`access.editRole`):n(`access.newRole`)},get children(){return i(t,{get when(){return x()},children:e=>(()=>{var t=f(V),r=t.firstChild,o=r.firstChild,s=o.nextSibling,c=r.nextSibling,g=c.firstChild,_=g.nextSibling,v=c.nextSibling,y=v.firstChild,b=y.nextSibling,[x,C]=m(b.nextSibling),w=v.nextSibling.firstChild,E=w.nextSibling;return t.addEventListener(`submit`,A),u(o,()=>n(`resources.name`)),s.$$input=t=>S({...e(),name:t.currentTarget.value}),u(g,()=>n(`resources.slug`)),_.$$input=t=>S({...e(),slug:t.currentTarget.value}),u(y,()=>n(`access.permissions`)),u(v,i(I,{get value(){return e().permissions??[]},onChange:t=>S({...e(),permissions:t})}),x,C),w.$$click=()=>S(null),u(w,()=>n(`common.cancel`)),u(E,(()=>{var e=h(()=>!!T());return()=>e()?n(`common.loading`):n(`common.save`)})()),a(e=>{var t=n(`resources.name`),r=n(`resources.slug`),i=T();return t!==e.e&&p(s,`placeholder`,e.e=t),r!==e.t&&p(_,`placeholder`,e.t=r),i!==e.a&&d(E,`disabled`,e.a=i),e},{e:void 0,t:void 0,a:void 0}),a(()=>d(s,`value`,e().name??``)),a(()=>d(_,`value`,e().slug??``)),l(),t})()})}}),ne,re),u(Q,()=>n(`access.tenants`)),$.$$click=()=>w({name:``,slug:``}),u($,()=>n(`common.create`),ae,oe),u(le,()=>n(`resources.name`)),u(ue,()=>n(`resources.slug`)),u(de,()=>n(`common.status`)),u(fe,i(o,{get each(){return g()},children:e=>(()=>{var t=f(H),r=t.firstChild,i=r.nextSibling,a=i.firstChild,o=i.nextSibling,s=o.nextSibling.firstChild,c=s.nextSibling;return u(r,()=>e.name),u(a,()=>e.slug),u(o,()=>e.status),s.$$click=()=>w({...e}),u(s,()=>n(`common.edit`)),c.$$click=()=>e.id&&void v.deleteTenant(e.id).then(k),u(c,()=>n(`common.delete`)),l(),t})()})),u(X,i(y,{get open(){return C()!==null},onClose:()=>w(null),get title(){return h(()=>!!C()?.id)()?n(`access.editTenant`):n(`access.newTenant`)},get children(){return i(t,{get when(){return C()},children:e=>(()=>{var t=f(U),r=t.firstChild,i=r.firstChild,o=i.nextSibling,s=r.nextSibling,c=s.firstChild,m=c.nextSibling,g=s.nextSibling,_=g.firstChild,v=_.nextSibling,y=g.nextSibling.firstChild,b=y.nextSibling;return t.addEventListener(`submit`,ee),u(i,()=>n(`resources.name`)),o.$$input=t=>w({...e(),name:t.currentTarget.value}),u(c,()=>n(`resources.slug`)),m.$$input=t=>w({...e(),slug:t.currentTarget.value}),u(_,()=>n(`access.domain`)),v.$$input=t=>w({...e(),domain:t.currentTarget.value}),y.$$click=()=>w(null),u(y,()=>n(`common.cancel`)),u(b,(()=>{var e=h(()=>!!T());return()=>e()?n(`common.loading`):n(`common.save`)})()),a(e=>{var t=n(`resources.name`),r=n(`resources.slug`),i=n(`access.domain`),a=T();return t!==e.e&&p(o,`placeholder`,e.e=t),r!==e.t&&p(m,`placeholder`,e.t=r),i!==e.a&&p(v,`placeholder`,e.a=i),a!==e.o&&d(b,`disabled`,e.o=a),e},{e:void 0,t:void 0,a:void 0,o:void 0}),a(()=>d(o,`value`,e().name??``)),a(()=>d(m,`value`,e().slug??``)),a(()=>d(v,`value`,e().domain??``)),l(),t})()})}}),me,he),l(),e})()}c([`click`,`input`]);export{W as AccessManager};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{S as e,a as t,h as n,l as r,p as i,r as a}from"./solid.Ck4Vtfe4.js";import{_ as o,a as s,f as c,l,m as u,o as d,p as f,s as p,u as m}from"./web.DD6VKaIp.js";import{n as h}from"./i18n.LMZI7jyc.js";import{n as g}from"./api.B03e8F6d.js";var _=o(`<div class="notice notice--error">`),v=o(`<div class=taxonomies-manager><!$><!/><form class=card><h3></h3><div class=form-grid><label><!$><!/><input class=input required></label><label><!$><!/><input class=input pattern=[a-z0-9_]*></label><label class=checkbox-label><input type=checkbox> <!$><!/></label></div><fieldset><legend></legend><!$><!/></fieldset><button type=submit class="btn btn-primary"></button></form><div class="card settings-table-card"><table class=table><thead><tr><th></th><th></th><th></th><th></th></tr></thead><tbody>`),y=o(`<label><input type=checkbox> <!$><!/> (<!$><!/>)`),b=o(`<button type=button class="btn btn-danger">`),x=o(`<tr><td><!$><!/> (<!$><!/>)</td><td></td><td></td><td>`),ee=o(`<label style=margin-right:0.75rem><input type=checkbox> <!$><!/>`);function S(){let{t:o}=h(),[s,S]=n([]),[C,w]=n([]),[T,E]=n(``),[D,O]=n(!1),[k,A]=n({name:``,slug:``,hierarchical:!1,attachTo:[]}),j=async()=>{try{let[e,t]=await Promise.all([g.getTaxonomies(),g.getContentTypes()]);S(e),w(t)}catch(e){E(e instanceof Error?e.message:String(e))}};e(j);let M=async e=>{e.preventDefault(),E(``),O(!0);try{await g.createTaxonomy({name:k().name,slug:k().slug||void 0,hierarchical:k().hierarchical,attachTo:k().attachTo,labels:{singular_name:k().name}}),A({name:``,slug:``,hierarchical:!1,attachTo:[]}),await j(),window.dispatchEvent(new Event(`okcms:content-models-changed`))}catch(e){E(e instanceof Error?e.message:String(e))}finally{O(!1)}},N=async(e,t)=>{let n=e.attachTo?.includes(t);try{n?await g.detachTaxonomy(e.slug,t):await g.attachTaxonomy(e.slug,t),await j(),window.dispatchEvent(new Event(`okcms:content-models-changed`))}catch(e){E(e instanceof Error?e.message:String(e))}},P=async e=>{try{await g.deleteTaxonomy(e),await j(),window.dispatchEvent(new Event(`okcms:content-models-changed`))}catch(e){E(e instanceof Error?e.message:String(e))}};return(()=>{var e=d(v),n=e.firstChild,[h,g]=p(n.nextSibling),S=h.nextSibling,w=S.firstChild,E=w.nextSibling,O=E.firstChild,j=O.firstChild,[F,I]=p(j.nextSibling),L=F.nextSibling,R=O.nextSibling,z=R.firstChild,[B,V]=p(z.nextSibling),H=B.nextSibling,U=R.nextSibling,W=U.firstChild,G=W.nextSibling.nextSibling,[K,q]=p(G.nextSibling),J=E.nextSibling,Y=J.firstChild,te=Y.nextSibling,[ne,re]=p(te.nextSibling),X=J.nextSibling,Z=S.nextSibling.firstChild.firstChild,Q=Z.firstChild.firstChild,$=Q.nextSibling,ie=$.nextSibling,ae=Z.nextSibling;return l(e,r(t,{get when(){return T()},get children(){var e=d(_);return l(e,T),e}}),h,g),S.addEventListener(`submit`,M),l(w,()=>o(`settings.taxonomies.form.title`)),l(O,()=>o(`settings.taxonomies.form.name`),F,I),L.$$input=e=>A({...k(),name:e.currentTarget.value}),l(R,()=>o(`settings.taxonomies.form.slug`),B,V),H.$$input=e=>A({...k(),slug:e.currentTarget.value}),W.addEventListener(`change`,e=>A({...k(),hierarchical:e.currentTarget.checked})),l(U,()=>o(`settings.taxonomies.form.hierarchical`),K,q),l(Y,()=>o(`settings.taxonomies.form.attachTo`)),l(J,r(a,{get each(){return C()},children:e=>(()=>{var t=d(y),n=t.firstChild,r=n.nextSibling.nextSibling,[a,o]=p(r.nextSibling),s=a.nextSibling.nextSibling,[c,f]=p(s.nextSibling);return c.nextSibling,n.addEventListener(`change`,t=>A({...k(),attachTo:t.currentTarget.checked?[...k().attachTo,e.slug]:k().attachTo.filter(t=>t!==e.slug)})),l(t,()=>e.pluralLabel,a,o),l(t,()=>e.slug,c,f),i(()=>u(n,`checked`,k().attachTo.includes(e.slug))),t})()}),ne,re),l(X,()=>o(`settings.taxonomies.form.create`)),l(Q,()=>o(`settings.taxonomies.table.taxonomy`)),l($,()=>o(`settings.taxonomies.table.hierarchical`)),l(ie,()=>o(`settings.taxonomies.table.attachedTypes`)),l(ae,r(a,{get each(){return s()},children:e=>(()=>{var n=d(x),s=n.firstChild,f=s.firstChild,[h,g]=p(f.nextSibling),_=h.nextSibling.nextSibling,[v,y]=p(_.nextSibling);v.nextSibling;var S=s.nextSibling,w=S.nextSibling,T=w.nextSibling;return l(s,()=>e.name,h,g),l(s,()=>e.slug,v,y),l(S,(()=>{var t=m(()=>!!e.hierarchical);return()=>t()?o(`common.yes`):o(`common.no`)})()),l(w,r(a,{get each(){return C()},children:t=>(()=>{var n=d(ee),r=n.firstChild,a=r.nextSibling.nextSibling,[o,s]=p(a.nextSibling);return r.addEventListener(`change`,()=>N(e,t.slug)),l(n,()=>t.slug,o,s),i(()=>u(r,`checked`,e.attachTo?.includes(t.slug)??!1)),n})()})),l(T,r(t,{get when(){return e.source!==`CORE`},get children(){var t=d(b);return t.$$click=()=>P(e.slug),l(t,()=>o(`settings.taxonomies.table.actions.remove`)),c(),t}})),n})()})),i(e=>{var t=o(`settings.taxonomies.form.slugHint`),n=D();return t!==e.e&&f(H,`title`,e.e=t),n!==e.t&&u(X,`disabled`,e.t=n),e},{e:void 0,t:void 0}),i(()=>u(L,`value`,k().name)),i(()=>u(H,`value`,k().slug)),i(()=>u(W,`checked`,k().hierarchical)),c(),e})()}s([`input`,`click`]);export{S as TaxonomiesManager};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{S as e,a as t,h as n,l as r,p as i,r as a}from"./solid.Ck4Vtfe4.js";import{_ as o,a as s,f as c,l,m as u,o as d,s as f,u as p}from"./web.DD6VKaIp.js";import{n as m}from"./i18n.LMZI7jyc.js";import{n as h}from"./api.B03e8F6d.js";import{n as g,t as _}from"./FieldRenderer.2TxRD88c.js";var v=o(`<div class="notice notice--error">`),y=o(`<div class=term-meta-fields><h4></h4><!$><!/>`),b=o(`<button class=btn type=button>`),x=o(`<form class="card term-form"><h3></h3><label><!$><!/><input class=input required></label><label><!$><!/><input class=input></label><label><!$><!/><textarea class=input rows=3></textarea></label><!$><!/><div class=form-actions><button class="btn btn-primary"type=submit></button><!$><!/>`),S=o(`<table class=table><thead><tr><th></th><th></th><th></th></tr></thead><tbody>`),C=o(`<div class=card><div class=card-header><div><h3></h3><p class=muted></p></div><span class=badge></span></div><!$><!/>`),w=o(`<div class=terms-panel><!$><!/><!$><!/><!$><!/>`),T=o(`<p class=muted>`),E=o(`<tr><td></td><td></td><td><button class="btn btn-secondary btn-sm"type=button></button> <button class="btn btn-danger btn-sm"type=button>`);function D(o){let{t:s}=m(),[D,O]=n(null),[k,A]=n([]),[j,M]=n(``),[N,P]=n(``),[F,I]=n(``),[L,R]=n(null),[z,B]=n(``),[V,H]=n(!1),[U,W]=n([]),[G,K]=n({}),q=async()=>{if(o.taxonomySlug)try{let[e,t]=await Promise.all([h.getTaxonomies(),h.getTaxonomyTerms(o.taxonomySlug)]);O(e.find(e=>e.slug===o.taxonomySlug)??null),A(t)}catch(e){B(e instanceof Error?e.message:String(e))}},J=async()=>{if(o.taxonomySlug)try{let e=await h.getFieldGroups({taxonomy:o.taxonomySlug}),t=await Promise.all(e.filter(e=>e.active).map(async e=>h.getFieldGroup(e.id)));W(g(t.flatMap(e=>e.fields??[])))}catch{W([])}};e(()=>{q(),J()});let Y=()=>{R(null),M(``),P(``),I(``),K({})},X=e=>{R(e.id??null),M(e.name),P(e.slug),I(e.description??``),K({...e.meta??{}}),B(``)},Z=async e=>{e.preventDefault(),B(``),H(!0);try{let e=k().find(e=>e.id===L())?.meta??{},t={name:j(),slug:N()||void 0,description:F()||void 0,...U().length>0?{meta:{...e,...G()}}:{}};L()?await h.updateTaxonomyTerm(o.taxonomySlug,L(),t):await h.createTaxonomyTerm(o.taxonomySlug,t),Y(),await q()}catch(e){B(e instanceof Error?e.message:String(e))}finally{H(!1)}},Q=async e=>{if(e.id&&confirm(s(`content.taxonomy.confirmDelete`,{name:e.name})))try{await h.deleteTaxonomyTerm(o.taxonomySlug,e.id),await q()}catch(e){B(e instanceof Error?e.message:String(e))}};return(()=>{var e=d(w),n=e.firstChild,[m,h]=f(n.nextSibling),g=m.nextSibling,[O,A]=f(g.nextSibling),R=O.nextSibling,[B,H]=f(R.nextSibling);return l(e,r(t,{get when(){return z()},get children(){var e=d(v);return l(e,z),e}}),m,h),l(e,r(t,{get when(){return p(()=>!D())()&&o.taxonomySlug},get children(){var e=d(v);return l(e,()=>s(`content.taxonomy.notFound`)),e}}),O,A),l(e,r(t,{get when(){return D()},get children(){return[(()=>{var e=d(x),n=e.firstChild,o=n.nextSibling,m=o.firstChild,[h,g]=f(m.nextSibling),v=h.nextSibling,S=o.nextSibling,C=S.firstChild,[w,T]=f(C.nextSibling),E=w.nextSibling,D=S.nextSibling,O=D.firstChild,[k,A]=f(O.nextSibling),R=k.nextSibling,z=D.nextSibling,[B,H]=f(z.nextSibling),W=B.nextSibling,q=W.firstChild,J=q.nextSibling,[X,Q]=f(J.nextSibling);return e.addEventListener(`submit`,Z),l(n,(()=>{var e=p(()=>!!L());return()=>e()?s(`content.taxonomy.editTerm`):s(`content.taxonomy.addTerm`)})()),l(o,()=>s(`content.taxonomy.name`),h,g),v.$$input=e=>M(e.currentTarget.value),l(S,()=>s(`content.taxonomy.slug`),w,T),E.$$input=e=>P(e.currentTarget.value),l(D,()=>s(`content.taxonomy.description`),k,A),R.$$input=e=>I(e.currentTarget.value),l(e,r(t,{get when(){return U().length>0},get children(){var e=d(y),t=e.firstChild,n=t.nextSibling,[i,o]=f(n.nextSibling);return l(t,()=>s(`content.taxonomy.termFields`)),l(e,r(a,{get each(){return U()},children:e=>r(_,{field:e,get values(){return G()},onChange:(e,t)=>K({...G(),[e]:t}),t:s})}),i,o),e}}),B,H),l(q,(()=>{var e=p(()=>!!L());return()=>e()?s(`common.save`):s(`content.taxonomy.add`)})()),l(W,r(t,{get when(){return L()},get children(){var e=d(b);return e.$$click=Y,l(e,()=>s(`common.cancel`)),c(),e}}),X,Q),i(()=>u(q,`disabled`,V())),i(()=>u(v,`value`,j())),i(()=>u(E,`value`,N())),i(()=>u(R,`value`,F())),c(),e})(),(()=>{var e=d(C),n=e.firstChild,i=n.firstChild,u=i.firstChild,m=u.nextSibling,h=i.nextSibling,g=n.nextSibling,[_,v]=f(g.nextSibling);return l(u,()=>D().name),l(m,(()=>{var e=p(()=>!!o.contentType);return()=>e()?`${s(`content.taxonomy.attachedTo`)}: ${o.contentType}`:s(`content.taxonomy.descriptionHint`)})()),l(h,()=>k().length),l(e,r(t,{get when(){return k().length>0},get fallback(){return(()=>{var e=d(T);return l(e,()=>s(`content.taxonomy.empty`)),e})()},get children(){var e=d(S),t=e.firstChild,n=t.firstChild.firstChild,i=n.nextSibling,o=t.nextSibling;return l(n,()=>s(`content.taxonomy.name`)),l(i,()=>s(`content.taxonomy.slug`)),l(o,r(a,{get each(){return k()},children:e=>(()=>{var t=d(E),n=t.firstChild,r=n.nextSibling,i=r.nextSibling.firstChild,a=i.nextSibling.nextSibling;return l(n,()=>e.name),l(r,()=>e.slug),i.$$click=()=>X(e),l(i,()=>s(`common.edit`)),a.$$click=()=>void Q(e),l(a,()=>s(`content.taxonomy.delete`)),c(),t})()})),e}}),_,v),e})()]}}),B,H),e})()}s([`input`,`click`]);export{D as TaxonomyTermsManager};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import{S as e,a as t,f as n,h as r,l as i,p as a,r as o}from"./solid.Ck4Vtfe4.js";import{_ as s,a as c,f as l,l as u,m as d,o as f,p,s as m,u as h}from"./web.DD6VKaIp.js";import{n as g}from"./i18n.LMZI7jyc.js";import{n as _}from"./api.B03e8F6d.js";var v=s(`<p class=muted>`),y=s(`<span class=customizer__saved>`),b=s(`<div class="alert alert-error">`),x=s(`<div class=customizer__layout><aside class=customizer__panel><h3><!$><!/> · <!$><!/></h3><!$><!/><!$><!/><div class=customizer__actions><button class="btn btn-primary"></button><button class="btn btn-secondary"></button><button class="btn btn-secondary"></button></div><!$><!/><!$><!/><p class="muted customizer__hint"></p></aside><section class=customizer__preview><div class=customizer__preview-bar><input class=input placeholder=/></div><iframe class=customizer__frame>`),S=s(`<div class=customizer><!$><!/><style>
|
|
2
|
+
.customizer__layout {
|
|
3
|
+
display: grid;
|
|
4
|
+
grid-template-columns: minmax(280px, 340px) 1fr;
|
|
5
|
+
gap: 1.25rem;
|
|
6
|
+
align-items: start;
|
|
7
|
+
}
|
|
8
|
+
.customizer__panel {
|
|
9
|
+
background: var(--color-surface);
|
|
10
|
+
border: 1px solid var(--color-border);
|
|
11
|
+
border-radius: var(--radius-lg);
|
|
12
|
+
padding: 1.25rem;
|
|
13
|
+
display: flex;
|
|
14
|
+
flex-direction: column;
|
|
15
|
+
gap: 0.85rem;
|
|
16
|
+
position: sticky;
|
|
17
|
+
top: 1rem;
|
|
18
|
+
}
|
|
19
|
+
.customizer__panel h3 { margin: 0; font-size: 1rem; }
|
|
20
|
+
.customizer__field { display: flex; flex-direction: column; gap: 0.3rem; }
|
|
21
|
+
.customizer__field label { font-size: 0.75rem; font-weight: 600; color: var(--color-text); }
|
|
22
|
+
.customizer__color { height: 2.25rem; padding: 0.15rem; }
|
|
23
|
+
.customizer__actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
|
|
24
|
+
.customizer__saved { font-size: 0.75rem; color: var(--color-success); }
|
|
25
|
+
.customizer__hint { font-size: 0.75rem; margin: 0; }
|
|
26
|
+
.customizer__preview {
|
|
27
|
+
display: flex;
|
|
28
|
+
flex-direction: column;
|
|
29
|
+
gap: 0.5rem;
|
|
30
|
+
min-width: 0;
|
|
31
|
+
}
|
|
32
|
+
.customizer__preview-bar { display: flex; gap: 0.5rem; }
|
|
33
|
+
.customizer__frame {
|
|
34
|
+
width: 100%;
|
|
35
|
+
height: min(72vh, 780px);
|
|
36
|
+
border: 1px solid var(--color-border);
|
|
37
|
+
border-radius: var(--radius-md);
|
|
38
|
+
background: var(--color-white);
|
|
39
|
+
}
|
|
40
|
+
.alert-error {
|
|
41
|
+
background: var(--color-error-soft);
|
|
42
|
+
color: var(--color-error);
|
|
43
|
+
border: 1px solid var(--color-error);
|
|
44
|
+
padding: 0.75rem 1rem;
|
|
45
|
+
border-radius: var(--radius-md);
|
|
46
|
+
}
|
|
47
|
+
.empty-state { padding: 3rem; text-align: center; color: var(--color-muted); }
|
|
48
|
+
.skeleton { padding: 2rem; text-align: center; color: var(--color-muted); }
|
|
49
|
+
`),C=s(`<div class=skeleton>Loading...`),w=s(`<div class=empty-state><!$><!/> <a class="btn btn-secondary"href=/themes>`),T=s(`<div class=customizer__field><label></label><!$><!/>`),ee=s(`<textarea class=input rows=3>`),te=s(`<select class=input>`),ne=s(`<option>`),re=s(`<input type=checkbox>`),ie=s(`<input type=color class="input customizer__color">`),ae=s(`<input class=input>`),E=800;function D(e){return e.default===void 0?e.type===`checkbox`?!1:e.type===`number`?0:``:e.default}function oe(e){return typeof e==`string`?e:e.value}function se(e){return typeof e==`string`?e:e.label??e.value}function O(){let{t:s}=g(),[c,O]=r([]),[k,A]=r(!0),[j,M]=r(null),[N,P]=r({}),[F,I]=r({}),[L,R]=r(!1),[ce,z]=r(!1),[B,le]=r(`/`),[V,H]=r(0),U=null,W=n(()=>c().find(e=>e.status===`ACTIVE`)??null),G=n(()=>(W()?.manifest?.settings??[]).filter(e=>!!e&&typeof e.name==`string`)),K=n(()=>JSON.stringify(N())!==JSON.stringify(F()));e(async()=>{await q()});async function q(){M(null);try{A(!0);let e=await _.getThemes();O(e);let t=e.find(e=>e.status===`ACTIVE`)??null,n=t?.config??{};I(n);let r={};for(let e of t?.manifest?.settings??[])r[e.name]=n[e.name]===void 0?D(e):n[e.name];P(r)}catch{M(s(`customizer.loadError`))}finally{A(!1)}}function J(e,t){P({...N(),[e]:t}),z(!1),Y()}function Y(){U&&clearTimeout(U),U=setTimeout(()=>H(e=>e+1),E)}function X(){U&&clearTimeout(U),H(e=>e+1)}function ue(){P({...F()}),z(!1),X()}async function de(){let e=W();if(e){M(null),z(!1),R(!0);try{let t=await _.updateThemeConfig(e.id,N());O(c().map(n=>n.id===e.id?t:n)),I({...N()}),z(!0)}catch{M(s(`customizer.saveError`))}finally{R(!1)}}}let fe=()=>{let e=B()||`/`,t=encodeURIComponent(JSON.stringify(N()));return`${e}${e.includes(`?`)?`&`:`?`}preview_settings=${t}&_=${V()}`};return(()=>{var e=f(S),n=e.firstChild,[r,c]=m(n.nextSibling);return r.nextSibling,u(e,i(t,{get when(){return!k()},get fallback(){return f(C)},get children(){return i(t,{get when(){return W()},get fallback(){return(()=>{var e=f(w),t=e.firstChild,[n,r]=m(t.nextSibling),i=n.nextSibling.nextSibling;return u(e,()=>s(`customizer.noTheme`),n,r),u(i,()=>s(`customizer.goToThemes`)),e})()},get children(){var e=f(x),n=e.firstChild,r=n.firstChild,c=r.firstChild,[g,_]=m(c.nextSibling),S=g.nextSibling.nextSibling,[C,w]=m(S.nextSibling),E=r.nextSibling,[D,O]=m(E.nextSibling),k=D.nextSibling,[A,M]=m(k.nextSibling),P=A.nextSibling,F=P.firstChild,I=F.nextSibling,R=I.nextSibling,z=P.nextSibling,[V,H]=m(z.nextSibling),U=V.nextSibling,[q,Y]=m(U.nextSibling),pe=q.nextSibling,Z=n.nextSibling.firstChild,Q=Z.firstChild,$=Z.nextSibling;return u(r,()=>W().name,g,_),u(r,()=>s(`customizer.title`),C,w),u(n,i(t,{get when(){return G().length===0},get children(){var e=f(v);return u(e,()=>s(`customizer.noSettings`)),e}}),D,O),u(n,i(o,{get each(){return G()},children:e=>(()=>{var t=f(T),n=t.firstChild,r=n.nextSibling,[s,c]=m(r.nextSibling);return u(n,()=>e.label||e.name),u(t,(()=>{var t=h(()=>e.type===`textarea`);return()=>t()?(()=>{var t=f(ee);return t.$$input=t=>J(e.name,t.currentTarget.value),a(()=>p(t,`id`,`customizer-${e.name}`)),a(()=>d(t,`value`,String(N()[e.name]??``))),l(),t})():h(()=>e.type===`select`)()?(()=>{var t=f(te);return t.addEventListener(`change`,t=>J(e.name,t.currentTarget.value)),u(t,i(o,{get each(){return e.options??[]},children:e=>(()=>{var t=f(ne);return u(t,()=>se(e)),a(()=>d(t,`value`,oe(e))),t})()})),a(()=>p(t,`id`,`customizer-${e.name}`)),a(()=>d(t,`value`,String(N()[e.name]??``))),t})():h(()=>e.type===`checkbox`)()?(()=>{var t=f(re);return t.addEventListener(`change`,t=>J(e.name,t.currentTarget.checked)),a(()=>p(t,`id`,`customizer-${e.name}`)),a(()=>d(t,`checked`,!!N()[e.name])),t})():h(()=>e.type===`color`)()?(()=>{var t=f(ie);return t.$$input=t=>J(e.name,t.currentTarget.value),a(()=>p(t,`id`,`customizer-${e.name}`)),a(()=>d(t,`value`,String(N()[e.name]??`#000000`))),l(),t})():(()=>{var t=f(ae);return t.$$input=t=>J(e.name,e.type===`number`?Number(t.currentTarget.value):t.currentTarget.value),a(n=>{var r=`customizer-${e.name}`,i=e.type===`number`?`number`:`text`;return r!==n.e&&p(t,`id`,n.e=r),i!==n.t&&p(t,`type`,n.t=i),n},{e:void 0,t:void 0}),a(()=>d(t,`value`,String(N()[e.name]??``))),l(),t})()})(),s,c),a(()=>p(n,`for`,`customizer-${e.name}`)),t})()}),A,M),F.$$click=de,u(F,(()=>{var e=h(()=>!!L());return()=>e()?s(`customizer.saving`):s(`customizer.save`)})()),I.$$click=ue,u(I,()=>s(`customizer.reset`)),R.$$click=X,u(R,()=>s(`customizer.refreshPreview`)),u(n,i(t,{get when(){return ce()},get children(){var e=f(y);return u(e,()=>s(`customizer.saved`)),e}}),V,H),u(n,i(t,{get when(){return j()},get children(){var e=f(b);return u(e,j),e}}),q,Y),u(pe,()=>s(`customizer.previewHint`)),Q.addEventListener(`change`,e=>{le(e.currentTarget.value||`/`),X()}),a(e=>{var t=L()||!K(),n=!K(),r=s(`customizer.previewPath`),i=s(`customizer.previewTitle`),a=fe();return t!==e.e&&d(F,`disabled`,e.e=t),n!==e.t&&d(I,`disabled`,e.t=n),r!==e.a&&p(Q,`aria-label`,e.a=r),i!==e.o&&p($,`title`,e.o=i),a!==e.i&&p($,`src`,e.i=a),e},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),a(()=>d(Q,`value`,B())),l(),e}})}}),r,c),e})()}c([`click`,`input`]);export{O as ThemeCustomizer};
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import{S as e,a as t,h as n,l as r,p as i,r as a}from"./solid.Ck4Vtfe4.js";import{_ as o,a as s,f as c,i as l,l as u,m as d,o as f,p,s as m,u as h}from"./web.DD6VKaIp.js";import{n as g}from"./i18n.LMZI7jyc.js";import{n as _}from"./api.B03e8F6d.js";var v=o(`<div class=theme-manager><div class=theme-toolbar><p class=page-hint></p><button class="btn btn-refresh"></button></div><!$><!/><!$><!/><!$><!/><!$><!/><style>
|
|
2
|
+
.theme-toolbar {
|
|
3
|
+
display: flex;
|
|
4
|
+
align-items: flex-start;
|
|
5
|
+
justify-content: space-between;
|
|
6
|
+
gap: 1rem;
|
|
7
|
+
margin-bottom: 1.25rem;
|
|
8
|
+
}
|
|
9
|
+
.page-hint {
|
|
10
|
+
margin: 0;
|
|
11
|
+
color: var(--color-muted);
|
|
12
|
+
font-size: 0.8125rem;
|
|
13
|
+
}
|
|
14
|
+
.btn-refresh {
|
|
15
|
+
flex-shrink: 0;
|
|
16
|
+
}
|
|
17
|
+
.themes-grid {
|
|
18
|
+
display: grid;
|
|
19
|
+
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
|
|
20
|
+
gap: 1.5rem;
|
|
21
|
+
}
|
|
22
|
+
.theme-card {
|
|
23
|
+
background: var(--color-surface);
|
|
24
|
+
border: 1px solid var(--color-border);
|
|
25
|
+
border-radius: var(--radius-lg);
|
|
26
|
+
padding: 1.5rem;
|
|
27
|
+
display: flex;
|
|
28
|
+
flex-direction: column;
|
|
29
|
+
gap: 1rem;
|
|
30
|
+
transition: all 0.2s;
|
|
31
|
+
}
|
|
32
|
+
.theme-card:hover {
|
|
33
|
+
border-color: var(--color-primary);
|
|
34
|
+
box-shadow: var(--shadow-md);
|
|
35
|
+
}
|
|
36
|
+
.theme-card.active {
|
|
37
|
+
border-color: var(--color-primary);
|
|
38
|
+
box-shadow: 0 0 0 1px var(--color-primary), var(--shadow-md);
|
|
39
|
+
}
|
|
40
|
+
.theme-preview {
|
|
41
|
+
position: relative;
|
|
42
|
+
}
|
|
43
|
+
.theme-preview__img {
|
|
44
|
+
display: block;
|
|
45
|
+
width: 100%;
|
|
46
|
+
border-radius: var(--radius-md);
|
|
47
|
+
border: 1px solid var(--color-border);
|
|
48
|
+
}
|
|
49
|
+
.theme-badge {
|
|
50
|
+
position: absolute;
|
|
51
|
+
top: 0.5rem;
|
|
52
|
+
right: 0.5rem;
|
|
53
|
+
background: var(--color-primary);
|
|
54
|
+
color: var(--color-primary-contrast);
|
|
55
|
+
padding: 0.25rem 0.5rem;
|
|
56
|
+
border-radius: var(--radius-full);
|
|
57
|
+
font-size: 0.625rem;
|
|
58
|
+
font-weight: 700;
|
|
59
|
+
text-transform: uppercase;
|
|
60
|
+
}
|
|
61
|
+
.theme-info {
|
|
62
|
+
display: flex;
|
|
63
|
+
flex-direction: column;
|
|
64
|
+
gap: 0.5rem;
|
|
65
|
+
}
|
|
66
|
+
.theme-info h3 {
|
|
67
|
+
margin: 0;
|
|
68
|
+
font-size: 1.125rem;
|
|
69
|
+
font-weight: 600;
|
|
70
|
+
}
|
|
71
|
+
.theme-version {
|
|
72
|
+
margin: 0;
|
|
73
|
+
font-size: 0.75rem;
|
|
74
|
+
color: var(--color-muted);
|
|
75
|
+
}
|
|
76
|
+
.theme-desc {
|
|
77
|
+
margin: 0;
|
|
78
|
+
font-size: 0.8125rem;
|
|
79
|
+
color: var(--color-text);
|
|
80
|
+
line-height: 1.5;
|
|
81
|
+
}
|
|
82
|
+
.theme-status {
|
|
83
|
+
display: flex;
|
|
84
|
+
align-items: center;
|
|
85
|
+
gap: 0.5rem;
|
|
86
|
+
}
|
|
87
|
+
.status-badge {
|
|
88
|
+
display: inline-flex;
|
|
89
|
+
align-items: center;
|
|
90
|
+
padding: 0.25rem 0.5rem;
|
|
91
|
+
border-radius: var(--radius-full);
|
|
92
|
+
font-size: 0.625rem;
|
|
93
|
+
font-weight: 600;
|
|
94
|
+
text-transform: uppercase;
|
|
95
|
+
}
|
|
96
|
+
.status-active {
|
|
97
|
+
background: var(--color-success-soft);
|
|
98
|
+
color: var(--color-success);
|
|
99
|
+
}
|
|
100
|
+
.status-installed {
|
|
101
|
+
background: var(--color-primary-soft);
|
|
102
|
+
color: var(--color-primary);
|
|
103
|
+
}
|
|
104
|
+
.status-inactive {
|
|
105
|
+
background: var(--color-muted-soft);
|
|
106
|
+
color: var(--color-muted);
|
|
107
|
+
}
|
|
108
|
+
.theme-actions {
|
|
109
|
+
margin-top: 0.5rem;
|
|
110
|
+
display: flex;
|
|
111
|
+
flex-wrap: wrap;
|
|
112
|
+
gap: 0.5rem;
|
|
113
|
+
}
|
|
114
|
+
.btn-loading {
|
|
115
|
+
opacity: 0.6;
|
|
116
|
+
cursor: wait;
|
|
117
|
+
}
|
|
118
|
+
.empty-state {
|
|
119
|
+
grid-column: 1 / -1;
|
|
120
|
+
padding: 3rem;
|
|
121
|
+
text-align: center;
|
|
122
|
+
color: var(--color-muted);
|
|
123
|
+
}
|
|
124
|
+
.alert {
|
|
125
|
+
padding: 0.75rem 1rem;
|
|
126
|
+
border-radius: var(--radius-md);
|
|
127
|
+
margin-bottom: 1rem;
|
|
128
|
+
}
|
|
129
|
+
.alert-error {
|
|
130
|
+
background: var(--color-error-soft);
|
|
131
|
+
color: var(--color-error);
|
|
132
|
+
border: 1px solid var(--color-error);
|
|
133
|
+
}
|
|
134
|
+
.alert-warning {
|
|
135
|
+
background: var(--color-warning-soft);
|
|
136
|
+
color: var(--color-warning);
|
|
137
|
+
border: 1px solid var(--color-warning);
|
|
138
|
+
}
|
|
139
|
+
.skeleton {
|
|
140
|
+
padding: 2rem;
|
|
141
|
+
text-align: center;
|
|
142
|
+
color: var(--color-muted);
|
|
143
|
+
}
|
|
144
|
+
`),y=o(`<div class="alert alert-error">`),b=o(`<div class="alert alert-warning">`),x=o(`<div class=skeleton>Loading...`),S=o(`<div class=themes-grid><!$><!/><!$><!/>`),C=o(`<img class=theme-preview__img alt loading=lazy>`,!0,!1,!1),w=o(`<div><div class=theme-preview><!$><!/><!$><!/></div><div class=theme-info><h3></h3><p class=theme-version><!$><!/>: <!$><!/></p><p class=theme-status><span></span></p><!$><!/></div><div class=theme-actions><button>`),T=o(`<div class="theme-badge active-badge">`),E=o(`<p class=theme-desc>`),D=o(`<div class=empty-state>`);function O(){let{t:o}=g(),[s,O]=n([]),[k,A]=n(!0),[j,M]=n(null),[N,P]=n(null),[F,I]=n(null);e(async()=>{await L()});async function L(){M(null),P(null);try{A(!0);let e;try{e=await _.syncThemes()}catch{e=await _.getThemes()}O(e)}catch{M(o(`themes.loadError`))}finally{A(!1)}}async function R(e){let t=e.status===`ACTIVE`;if(M(null),P(null),t&&s().length<=1){P(o(`themes.deactivateBlocked`));return}I(e.id);try{let n=t?await _.deactivateTheme(e.id):await _.activateTheme(e.id);O(s().map(t=>t.id===e.id?n:t.status===`ACTIVE`&&n.status===`ACTIVE`?{...t,status:`INACTIVE`}:t))}catch{M(o(t?`themes.deactivateError`:`themes.activateError`))}finally{I(null)}}function z(e){let t=e.manifest?.preview??e.manifest?.screenshots?.[0];return!t||typeof t!=`string`?null:/^(https?:)?\/\//.test(t)||t.startsWith(`/`)?t:`/themes/${encodeURIComponent(e.name)}/${t}`}let B=e=>{switch(e){case`ACTIVE`:return o(`themes.status.active`);case`INSTALLED`:return o(`themes.status.installed`);case`INACTIVE`:return o(`themes.status.inactive`);default:return e}},V=e=>{switch(e){case`ACTIVE`:return`status-active`;case`INSTALLED`:return`status-installed`;case`INACTIVE`:return`status-inactive`;default:return``}};return(()=>{var e=f(v),n=e.firstChild,g=n.firstChild,_=g.nextSibling,O=n.nextSibling,[A,M]=m(O.nextSibling),P=A.nextSibling,[I,H]=m(P.nextSibling),U=I.nextSibling,[W,G]=m(U.nextSibling),K=W.nextSibling,[q,J]=m(K.nextSibling);return q.nextSibling,u(g,()=>o(`themes.directoryHint`)),_.$$click=L,u(_,()=>o(`themes.reload`)),u(e,(()=>{var e=h(()=>!!j());return()=>e()&&(()=>{var e=f(y);return u(e,j),e})()})(),A,M),u(e,(()=>{var e=h(()=>!!N());return()=>e()&&(()=>{var e=f(b);return u(e,N),e})()})(),I,H),u(e,(()=>{var e=h(()=>!!k());return()=>e()&&f(x)})(),W,G),u(e,(()=>{var e=h(()=>!k());return()=>e()&&(()=>{var e=f(S),n=e.firstChild,[g,_]=m(n.nextSibling),v=g.nextSibling,[y,b]=m(v.nextSibling);return u(e,r(a,{get each(){return s()},children:e=>{let n=z(e);return(()=>{var a=f(w),s=a.firstChild,g=s.firstChild,[_,v]=m(g.nextSibling),y=_.nextSibling,[b,x]=m(y.nextSibling),S=s.nextSibling,D=S.firstChild,O=D.nextSibling,k=O.firstChild,[A,j]=m(k.nextSibling),M=A.nextSibling.nextSibling,[N,P]=m(M.nextSibling),I=O.nextSibling,L=I.firstChild,z=I.nextSibling,[H,U]=m(z.nextSibling),W=S.nextSibling.firstChild;return u(s,r(t,{when:n,get children(){var e=f(C);return e.addEventListener(`error`,e=>{e.currentTarget.style.display=`none`}),p(e,`src`,n),e}}),_,v),u(s,(()=>{var t=h(()=>e.status===`ACTIVE`);return()=>t()&&(()=>{var e=f(T);return u(e,()=>o(`themes.active`)),e})()})(),b,x),u(D,()=>e.name),u(O,()=>o(`themes.version`),A,j),u(O,()=>e.version,N,P),u(L,()=>B(e.status)),u(S,(()=>{var t=h(()=>!!e.manifest?.description);return()=>t()&&(()=>{var t=f(E);return u(t,()=>e.manifest.description),t})()})(),H,U),W.$$click=()=>R(e),u(W,(()=>{var t=h(()=>e.status===`ACTIVE`);return()=>t()?o(`themes.deactivate`):o(`themes.activate`)})()),i(t=>{var n=`theme-card ${e.status===`ACTIVE`?`active`:``}`,r=`status-badge ${V(e.status)}`,i=`btn ${F()===e.id?`btn-loading`:``}`,o=F()!==null;return n!==t.e&&l(a,t.e=n),r!==t.t&&l(L,t.t=r),i!==t.a&&l(W,t.a=i),o!==t.o&&d(W,`disabled`,t.o=o),t},{e:void 0,t:void 0,a:void 0,o:void 0}),c(),a})()}}),g,_),u(e,(()=>{var e=h(()=>s().length===0);return()=>e()&&(()=>{var e=f(D);return u(e,()=>o(`themes.empty`)),e})()})(),y,b),e})()})(),q,J),i(()=>d(_,`disabled`,k())),c(),e})()}s([`click`]);export{O as ThemeManager};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{S as e,a as t,h as n,l as r,p as i,r as a}from"./solid.Ck4Vtfe4.js";import{_ as o,a as s,f as c,l,m as u,o as d,s as f,u as ee}from"./web.DD6VKaIp.js";import{n as p}from"./i18n.LMZI7jyc.js";import{n as m}from"./api.B03e8F6d.js";var h=o(`<div class="notice notice--error">`),te=o(`<div class=user-create><!$><!/><form class=card><h3></h3><div class=form-grid><label><!$><!/><input class=input required></label><label><!$><!/><input class=input type=email required></label><label><!$><!/><span class=muted></span><input class=input type=password required minlength=8></label><label><!$><!/><select class=input><option value></option><!$><!/></select></label></div><p class=muted><!$><!/> <!$><!/> — <!$><!/> <!$><!/>.</p><div class=media-details__actions><button class="btn btn-primary"type=submit></button><a class="btn btn-secondary"href=/users>`),g=o(`<option><!$><!/> (<!$><!/>)`);function _(){let{t:o}=p(),[s,_]=n(``),[v,y]=n(``),[b,ne]=n(``),[x,S]=n(``),[C,w]=n([]),[T,E]=n(``),[D,O]=n(!1);e(async()=>{try{let e=await m.listRoles();w(e),S(e.find(e=>e.slug===`EDITOR`)?.id??e[0]?.id??``)}catch{}});let re=async e=>{if(e.preventDefault(),E(``),b().length<8){E(o(`users.detail.passwordError`));return}O(!0);try{await m.createUser({name:s(),email:v(),password:b(),roleId:x()||void 0}),window.location.href=`/users`}catch(e){E(e instanceof Error?e.message:String(e)),O(!1)}};return(()=>{var e=d(te),n=e.firstChild,[p,m]=f(n.nextSibling),w=p.nextSibling,E=w.firstChild,O=E.nextSibling,k=O.firstChild,ie=k.firstChild,[A,j]=f(ie.nextSibling),M=A.nextSibling,N=k.nextSibling,P=N.firstChild,[F,ae]=f(P.nextSibling),I=F.nextSibling,L=N.nextSibling,oe=L.firstChild,[R,z]=f(oe.nextSibling),B=R.nextSibling,V=B.nextSibling,H=L.nextSibling,U=H.firstChild,[W,G]=f(U.nextSibling),K=W.nextSibling,q=K.firstChild,se=q.nextSibling,[ce,le]=f(se.nextSibling),J=O.nextSibling,ue=J.firstChild,[Y,de]=f(ue.nextSibling),fe=Y.nextSibling.nextSibling,[X,pe]=f(fe.nextSibling),me=X.nextSibling.nextSibling,[Z,he]=f(me.nextSibling),ge=Z.nextSibling.nextSibling,[Q,_e]=f(ge.nextSibling);Q.nextSibling;var $=J.nextSibling.firstChild,ve=$.nextSibling;return l(e,r(t,{get when(){return T()},get children(){var e=d(h);return l(e,T),e}}),p,m),w.addEventListener(`submit`,re),l(E,()=>o(`users.new`)),l(k,()=>o(`users.detail.fields.name`),A,j),M.$$input=e=>_(e.currentTarget.value),l(N,()=>o(`users.detail.fields.email`),F,ae),I.$$input=e=>y(e.currentTarget.value),l(L,()=>o(`users.detail.fields.password`),R,z),l(B,()=>o(`users.detail.passwordPrompt`,{email:``})),V.$$input=e=>ne(e.currentTarget.value),l(H,()=>o(`users.detail.fields.role`),W,G),K.addEventListener(`change`,e=>S(e.currentTarget.value)),l(q,()=>o(`users.detail.rolePlaceholder`)),l(K,r(a,{get each(){return C()},children:e=>(()=>{var t=d(g),n=t.firstChild,[r,a]=f(n.nextSibling),o=r.nextSibling.nextSibling,[s,c]=f(o.nextSibling);return s.nextSibling,l(t,()=>e.name,r,a),l(t,()=>e.slug,s,c),i(()=>u(t,`value`,e.id)),t})()}),ce,le),l(J,()=>o(`common.save`),Y,de),l(J,()=>o(`users.new`).toLowerCase(),X,pe),l(J,()=>o(`users.detail.fields.role`),Z,he),l(J,()=>o(`users.toolbar.newBtn`).toLowerCase(),Q,_e),l($,(()=>{var e=ee(()=>!!D());return()=>e()?o(`common.loading`):o(`common.create`)})()),l(ve,()=>o(`common.back`)),i(()=>u($,`disabled`,D())),i(()=>u(M,`value`,s())),i(()=>u(I,`value`,v())),i(()=>u(V,`value`,b())),i(()=>u(K,`value`,x())),c(),e})()}s([`input`]);export{_ as UserCreateForm};
|