@oktis-works/admin 0.12.0 → 0.14.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.D9s4FOLp.js → ActivityWidget.DmhtX3Xm.js} +2 -2
- package/dist/client/_astro/{AdminBar.D8078Gqs.js → AdminBar.DKoQ5M3w.js} +2 -2
- package/dist/client/_astro/ApiKeysManager.BaPrAyqm.js +1 -0
- package/dist/client/_astro/{AtGlanceWidget.DBA3mEnF.js → AtGlanceWidget.zlWIhmzI.js} +3 -3
- package/dist/client/_astro/{BaseLayout.DAkzjMTq.css → BaseLayout.Cp-O10m_.css} +1 -1
- package/dist/client/_astro/CommentsManager.DROGQRli.js +21 -0
- package/dist/client/_astro/ContentEditor.ChA5r0aE.js +3 -0
- package/dist/client/_astro/ContentEditor.CtCFQb14.js +1 -0
- package/dist/client/_astro/ContentTypeWorkspace.Dj9dP14a.js +1 -0
- package/dist/client/_astro/DashboardHome.Dn6_pJuX.js +1 -0
- package/dist/client/_astro/{DashboardLayout.astro_astro_type_script_index_0_lang.Cc0PvXrs.js → DashboardLayout.astro_astro_type_script_index_0_lang.NiobGnWg.js} +1 -1
- package/dist/client/_astro/FbIcon.Bn4e_qFb.js +1 -0
- package/dist/client/_astro/FieldGroupEditor.CiFoYYb2.js +69 -0
- package/dist/client/_astro/FieldGroupList.CdN99hvU.js +1 -0
- package/dist/client/_astro/FieldRenderer.DYMREsip.js +1 -0
- package/dist/client/_astro/FloatingPanel.BetdW5N2.js +1 -0
- package/dist/client/_astro/{Footer.Chcu8yzV.js → Footer.VGpnxqkW.js} +2 -2
- package/dist/client/_astro/GeneralSettings.mQ7FyhM-.js +1 -0
- package/dist/client/_astro/LogsManager.BUJ7baOa.js +1 -0
- package/dist/client/_astro/MediaLibrary.DMvI8KXX.js +1 -0
- package/dist/client/_astro/MenuManager._4YgarRt.js +1 -0
- package/dist/client/_astro/Modal.DbBPpkbR.js +1 -0
- package/dist/client/_astro/{PluginManager.BHvKQlj2.js → PluginManager.BozI4gXB.js} +2 -2
- package/dist/client/_astro/PostTypesManager.CifIQbeV.js +1 -0
- package/dist/client/_astro/QuickDraftWidget.CsG3_wS2.js +17 -0
- package/dist/client/_astro/ResourceHubs.DedTFbiz.js +1 -0
- package/dist/client/_astro/TaxonomiesManager.JqBPU1pf.js +1 -0
- package/dist/client/_astro/TaxonomyTermsManager.BLGRLt8p.js +1 -0
- package/dist/client/_astro/ThemeCustomizer.DrSQPj4W.js +49 -0
- package/dist/client/_astro/{ThemeManager.DuHgcKyn.js → ThemeManager.Csu39Xjr.js} +2 -2
- package/dist/client/_astro/UserCreateForm.C54wZYbf.js +1 -0
- package/dist/client/_astro/UsersManager.BYTWz2I8.js +1 -0
- package/dist/client/_astro/WebhooksManager.DeJ_f1Gk.js +1 -0
- package/dist/client/_astro/{api.CYg1SW2X.js → api.flUgn70U.js} +1 -1
- package/dist/client/_astro/client.ljtU74WL.js +1 -0
- package/dist/client/_astro/extensions.DtuT3Phu.js +1 -0
- package/dist/client/_astro/i18n.CBexpqud.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.COYjmQTY.js} +1 -1
- package/dist/client/_astro/preload-helper.oCYlU9a4.js +1 -0
- package/dist/client/_astro/pt-BR.DlIhl4_A.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.CYzqtRKs.js +1 -0
- package/dist/client/_astro/web.DD6VKaIp.js +1 -0
- package/dist/server/chunks/{404_C9d1fN7T.mjs → 404_BxFvEXYq.mjs} +1 -1
- package/dist/server/chunks/{BaseLayout_D-10OcWZ.mjs → BaseLayout_BTzlA_Yr.mjs} +5 -5
- package/dist/server/chunks/ContentEditor_DStZ4RZE.mjs +655 -0
- package/dist/server/chunks/{DashboardLayout_HxBoC5fJ.mjs → DashboardLayout_PXoRmnBH.mjs} +362 -99
- package/dist/server/chunks/{FbIcon_D0f6QiFJ.mjs → FbIcon_7YixzwO3.mjs} +1 -1
- package/dist/server/chunks/{ContentEditor_DZWLWgAD.mjs → FieldRenderer_BlZgS0Im.mjs} +159 -588
- package/dist/server/chunks/{FloatingPanel_DI2CdUZK.mjs → FloatingPanel_BtB-nNBT.mjs} +1 -1
- package/dist/server/chunks/{MediaLibrary_CD_cadEt.mjs → MediaLibrary_D7vu5VMd.mjs} +3 -3
- package/dist/server/chunks/{Modal_vHjkS4i2.mjs → Modal_I_mBEOz2.mjs} +2 -2
- package/dist/server/chunks/{PageHeader_CBOioOjo.mjs → PageHeader_CRpzf5xU.mjs} +1 -1
- package/dist/server/chunks/{_id__DrGJOSWh.mjs → _id__DFFoFesR.mjs} +209 -66
- package/dist/server/chunks/{_slug__C6TfwYcI.mjs → _slug__DBH2w1la.mjs} +2 -2
- package/dist/server/chunks/{access_D46Rg5g2.mjs → access_D1rk89Sh.mjs} +8 -8
- package/dist/server/chunks/{api-keys_BUCeuDw4.mjs → api-keys_BqhmvOer.mjs} +6 -6
- package/dist/server/chunks/comments_D_ta2fip.mjs +208 -0
- package/dist/server/chunks/{custom-fields_B7PeZo06.mjs → custom-fields_Cl8P-rrK.mjs} +5 -5
- package/dist/server/chunks/customize_DgtzmFmz.mjs +233 -0
- package/dist/server/chunks/{edit_H_Z0tUXd.mjs → edit_DTk4qFj5.mjs} +3 -3
- package/dist/server/chunks/{general_BROn356D.mjs → general_B-fEXuQn.mjs} +7 -7
- package/dist/server/chunks/{i18n_CItvcX64.mjs → i18n_BmAxDr2Q.mjs} +76 -10
- package/dist/server/chunks/{index_BYjGHhFv.mjs → index_BKjRvOw4.mjs} +113 -64
- package/dist/server/chunks/{index_BSanLOwq.mjs → index_BXnSMGRk.mjs} +4 -4
- package/dist/server/chunks/{index_9wINU7Wu.mjs → index_BcVtYp1L.mjs} +5 -5
- package/dist/server/chunks/{index_WgopTFB2.mjs → index_DI8jAAVQ.mjs} +2 -2
- package/dist/server/chunks/{index_GXbAk6jt.mjs → index_DXsKda1J.mjs} +4 -4
- package/dist/server/chunks/{login_BzHv0uQ0.mjs → login_BGPEB2l4.mjs} +1 -1
- package/dist/server/chunks/{logs_C32euU-n.mjs → logs_XjDk7dqi.mjs} +5 -5
- package/dist/server/chunks/{menus_EJ0NIw-1.mjs → menus_Kqym4CNK.mjs} +4 -4
- package/dist/server/chunks/{new_CWKqh8oV.mjs → new_BiikYmvu.mjs} +5 -5
- package/dist/server/chunks/{new_BwrgYLev.mjs → new_Dnp7PIHP.mjs} +3 -3
- package/dist/server/chunks/{plugins_C8RXEzie.mjs → plugins_C6qX0SAE.mjs} +5 -5
- package/dist/server/chunks/{post-types_bDF0xDxo.mjs → post-types_Dr4t-TYB.mjs} +7 -7
- package/dist/server/chunks/{pt-BR_DpWzkRv5.mjs → pt-BR_DH_fNjEo.mjs} +49 -5
- package/dist/server/chunks/{taxonomies_AHnU1mD0.mjs → taxonomies_B0YzIdmD.mjs} +5 -5
- package/dist/server/chunks/{taxonomy_DwH2xYGw.mjs → taxonomy_CCWZ58qQ.mjs} +63 -18
- package/dist/server/chunks/{themes_DE_yoCn2.mjs → themes_C7G3LcIz.mjs} +5 -5
- package/dist/server/chunks/{upload_BQA9bixd.mjs → upload_BT3ud_vb.mjs} +4 -4
- package/dist/server/chunks/{webhooks_iWH_jV-x.mjs → webhooks_CWW0L8EK.mjs} +5 -5
- package/dist/server/entry.mjs +104 -50
- package/dist/server/virtual_astro_middleware.mjs +3 -3
- package/package.json +5 -5
- package/dist/client/_astro/ApiKeysManager.BjyxI6JT.js +0 -1
- package/dist/client/_astro/ContentEditor.BZ8aLcGz.js +0 -3
- package/dist/client/_astro/ContentEditor.CfQqsa6r.js +0 -1
- package/dist/client/_astro/ContentTypeWorkspace.BhHFc6WZ.js +0 -1
- package/dist/client/_astro/DashboardHome.BXIUgb4u.js +0 -1
- package/dist/client/_astro/FbIcon.CUNS6rpP.js +0 -1
- package/dist/client/_astro/FieldGroupEditor.CVoPJ2v-.js +0 -69
- package/dist/client/_astro/FieldGroupList.BG2ET5gZ.js +0 -1
- package/dist/client/_astro/FloatingPanel.BeCEt_JP.js +0 -1
- package/dist/client/_astro/GeneralSettings.CefkBcVj.js +0 -1
- package/dist/client/_astro/LogsManager.ya0kmAUm.js +0 -1
- package/dist/client/_astro/MediaLibrary.Bod2Afk4.js +0 -1
- package/dist/client/_astro/MenuManager.d6_0hgNg.js +0 -1
- package/dist/client/_astro/Modal.DR905gyF.js +0 -1
- package/dist/client/_astro/PostTypesManager.DMUxfOp9.js +0 -1
- package/dist/client/_astro/QuickDraftWidget.DyX_bJ1p.js +0 -17
- package/dist/client/_astro/ResourceHubs.BwxYHeE5.js +0 -1
- package/dist/client/_astro/TaxonomiesManager.DlVS4Ujm.js +0 -1
- package/dist/client/_astro/TaxonomyTermsManager.B_ZDFU-K.js +0 -1
- package/dist/client/_astro/UserCreateForm.1KIa3Aa2.js +0 -1
- package/dist/client/_astro/UsersManager.v24y8OSk.js +0 -1
- package/dist/client/_astro/WebhooksManager.DPkFhoVr.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.AbBpo2WD.js +0 -1
- package/dist/client/_astro/pt-BR.B0jeLTb0.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
|
@@ -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.CBexpqud.js";import{n as C}from"./api.flUgn70U.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.CBexpqud.js";import{n as g}from"./api.flUgn70U.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.CBexpqud.js";import{n as h}from"./api.flUgn70U.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.CBexpqud.js";import{n as _}from"./api.flUgn70U.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.CBexpqud.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};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
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,i 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.CBexpqud.js";import{n as g}from"./api.flUgn70U.js";var _=a(`<div class=plugin-manager><p class=page-hint></p><!$><!/><!$><!/><!$><!/><style>
|
|
2
2
|
.page-hint {
|
|
3
3
|
margin: 0 0 1.25rem;
|
|
4
4
|
color: var(--color-muted);
|
|
@@ -133,4 +133,4 @@ import{d as e,p as t,r as n,s as r,y as i}from"./solid.D49dPDCT.js";import{a,c a
|
|
|
133
133
|
text-align: center;
|
|
134
134
|
color: var(--color-muted);
|
|
135
135
|
}
|
|
136
|
-
`),v=
|
|
136
|
+
`),v=a(`<div class="alert alert-error">`),y=a(`<div class=skeleton>Loading...`),b=a(`<div class=plugins-table-container><table class=table><thead><tr><th></th><th></th><th></th><th></th><th></th></tr></thead><tbody></tbody></table><!$><!/>`),x=a(`<div class=tenant-selector-bar><label><!$><!/>: </label><select><option value></option><!$><!/></select><button class="btn btn-sm">`),S=a(`<option><!$><!/> (<!$><!/>)`),C=a(`<tr class=plugin-row><td class=plugin-name><strong></strong><!$><!/><!$><!/></td><td></td><td><span></span></td><td></td><td><button>`),w=a(`<span class=plugin-description>`),T=a(`<span class=badge-enabled>`),E=a(`<span class=enabled-badge>`),D=a(`<span class=disabled-badge>`),O=a(`<div class=empty-state>`);function k(){let{t:a}=h(),[o,k]=t([]),[A,j]=t(!0),[M,N]=t(null),[P,F]=t(null),[I,L]=t(null),[R,z]=t([]),[B,V]=t(!1);e(async()=>{await H()});async function H(){try{j(!0);let e=await g.getPlugins();k(e)}catch{N(a(`plugins.loadError`))}finally{j(!1)}}async function U(){try{let e=await g.listTenants({limit:100});z(e.data.map(e=>({id:e.id??``,name:e.name})))}catch{}}let W=e=>e.enabled===!0;async function G(e){if(!I()){V(!0),await U();return}let t=W(e);F(e.id);try{let n=t?await g.deactivatePlugin(e.id,I()):await g.activatePlugin(e.id,I());k(o().map(t=>t.id===e.id?n:t))}catch{N(a(t?`plugins.deactivateError`:`plugins.activateError`))}finally{F(null)}}let K=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}},q=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=d(_),t=e.firstChild,h=t.nextSibling,[g,k]=p(h.nextSibling),j=g.nextSibling,[N,F]=p(j.nextSibling),z=N.nextSibling,[H,U]=p(z.nextSibling);return H.nextSibling,l(t,()=>a(`plugins.directoryHint`)),l(e,(()=>{var e=m(()=>!!M());return()=>e()&&(()=>{var e=d(v);return l(e,M),e})()})(),g,k),l(e,(()=>{var e=m(()=>!!A());return()=>e()&&d(y)})(),N,F),l(e,(()=>{var e=m(()=>!(A()||M()));return()=>e()&&[m(()=>m(()=>!!B())()&&(()=>{var e=d(x),t=e.firstChild,o=t.firstChild,[c,f]=p(o.nextSibling);c.nextSibling;var m=t.nextSibling,h=m.firstChild,g=h.nextSibling,[_,v]=p(g.nextSibling),y=m.nextSibling;return l(t,()=>a(`plugins.selectTenant`),c,f),m.addEventListener(`change`,e=>L(e.currentTarget.value||null)),l(h,()=>a(`plugins.selectTenantPlaceholder`)),l(m,n(i,{get each(){return R()},children:e=>(()=>{var t=d(S),n=t.firstChild,[i,a]=p(n.nextSibling),o=i.nextSibling.nextSibling,[s,c]=p(o.nextSibling);return s.nextSibling,l(t,()=>e.name,i,a),l(t,()=>e.id,s,c),r(()=>u(t,`value`,e.id)),t})()}),_,v),y.$$click=()=>V(!1),l(y,()=>a(`plugins.hideSelector`)),r(()=>u(m,`value`,I()??``)),s(),e})()),(()=>{var e=d(b),t=e.firstChild,h=t.firstChild,g=h.firstChild.firstChild,_=g.nextSibling,v=_.nextSibling,y=v.nextSibling,x=y.nextSibling,S=h.nextSibling,k=t.nextSibling,[A,j]=p(k.nextSibling);return l(g,()=>a(`plugins.columns.name`)),l(_,()=>a(`plugins.columns.version`)),l(v,()=>a(`plugins.columns.status`)),l(y,()=>a(`plugins.columns.enabled`)),l(x,()=>a(`plugins.columns.actions`)),l(S,n(i,{get each(){return o()},children:e=>(()=>{var t=d(C),n=t.firstChild,i=n.firstChild,o=i.nextSibling,[h,g]=p(o.nextSibling),_=h.nextSibling,[v,y]=p(_.nextSibling),b=n.nextSibling,x=b.nextSibling,S=x.firstChild,O=x.nextSibling,k=O.nextSibling.firstChild;return l(i,()=>e.name),l(n,(()=>{var t=m(()=>!!e.manifest?.description);return()=>t()&&(()=>{var t=d(w);return l(t,()=>e.manifest.description),t})()})(),h,g),l(n,(()=>{var t=m(()=>!!e.enabled);return()=>t()&&(()=>{var e=d(T);return l(e,()=>a(`plugins.enabledForTenant`)),e})()})(),v,y),l(b,()=>e.version),l(S,()=>K(e.status)),l(O,(()=>{var t=m(()=>!!e.enabled);return()=>t()?(()=>{var e=d(E);return l(e,()=>a(`plugins.enabledYes`)),e})():(()=>{var e=d(D);return l(e,()=>a(`plugins.enabledNo`)),e})()})()),k.$$click=()=>G(e),l(k,(()=>{var t=m(()=>!!W(e));return()=>t()?a(`plugins.deactivate`):a(`plugins.activate`)})()),r(t=>{var n=`status-badge ${q(e.status)}`,r=`btn btn-sm ${P()===e.id?`btn-loading`:``}`,i=P()!==null||!I(),o=W(e)?a(`plugins.deactivate`):a(`plugins.activate`);return n!==t.e&&c(S,t.e=n),r!==t.t&&c(k,t.t=r),i!==t.a&&u(k,`disabled`,t.a=i),o!==t.o&&f(k,`aria-label`,t.o=o),t},{e:void 0,t:void 0,a:void 0,o:void 0}),s(),t})()})),l(e,(()=>{var e=m(()=>o().length===0);return()=>e()&&(()=>{var e=d(O);return l(e,()=>a(`plugins.empty`)),e})()})(),A,j),e})()]})(),H,U),e})()}o([`click`]);export{k 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.CBexpqud.js";import{n as x}from"./api.flUgn70U.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.CBexpqud.js";import{n as h}from"./api.flUgn70U.js";import{DashboardWidget as g}from"./AtGlanceWidget.zlWIhmzI.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.CBexpqud.js";import{n as v}from"./api.flUgn70U.js";import{t as y}from"./Modal.DbBPpkbR.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.CBexpqud.js";import{n as g}from"./api.flUgn70U.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.CBexpqud.js";import{n as h}from"./api.flUgn70U.js";import{n as g,t as _}from"./FieldRenderer.DYMREsip.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.CBexpqud.js";import{n as _}from"./api.flUgn70U.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};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
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.CBexpqud.js";import{n as _}from"./api.flUgn70U.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
2
|
.theme-toolbar {
|
|
3
3
|
display: flex;
|
|
4
4
|
align-items: flex-start;
|
|
@@ -173,4 +173,4 @@ import{d as e,i as t,p as n,r,s as i,y as a}from"./solid.D49dPDCT.js";import{a a
|
|
|
173
173
|
text-align: center;
|
|
174
174
|
color: var(--color-muted);
|
|
175
175
|
}
|
|
176
|
-
`),y=
|
|
176
|
+
`),y=o(`<div class="alert alert-error">`),b=o(`<div class=skeleton>Loading...`),x=o(`<div class=themes-grid><!$><!/><!$><!/>`),S=o(`<img class=theme-preview__img alt loading=lazy>`,!0,!1,!1),ee=o(`<span class=config-saved>`),C=o(`<div class=config-panel><!$><!/><div class=config-actions><button class=btn></button><!$><!/>`),te=o(`<button class="btn btn-secondary">`),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></button><!$><!/><button class="btn btn-danger">`),T=o(`<div class="theme-badge active-badge">`),E=o(`<p class=theme-desc>`),ne=o(`<div class=config-field><label class=config-label></label><!$><!/>`),re=o(`<textarea class=input rows=3>`),ie=o(`<select class=input>`),ae=o(`<option>`),oe=o(`<input type=checkbox>`),se=o(`<input type=color class="input config-color">`),ce=o(`<input class=input>`),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),[L,R]=n({}),[le,z]=n(!1),[B,V]=n(!1);e(async()=>{await H()});async function H(){M(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 U(e){let t=e.status===`ACTIVE`;M(null),P(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{P(null)}}async function ue(e){if(window.confirm(o(`themes.confirmUninstall`,{name:e.name}))){M(null),P(e.id);try{await _.uninstallTheme(e.id),O(s().filter(t=>t.id!==e.id))}catch{M(o(`themes.uninstallError`))}finally{P(null)}}}function W(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}`}function G(e){return(e.manifest?.settings??[]).filter(e=>!!e&&typeof e.name==`string`)}function K(e){return e.default===void 0?e.type===`checkbox`?!1:e.type===`number`?0:``:e.default}function de(e){return typeof e==`string`?e:e.value}function fe(e){return typeof e==`string`?e:e.label??e.value}function pe(e){if(F()===e.id){I(null);return}let t={};for(let n of G(e)){let r=e.config?.[n.name];t[n.name]=r===void 0?K(n):r}R(t),V(!1),I(e.id)}function q(e,t){R({...L(),[e]:t})}async function me(e){M(null),V(!1),z(!0);try{let t=await _.updateThemeConfig(e.id,L());O(s().map(n=>n.id===e.id?t:n)),V(!0)}catch{M(o(`themes.configError`))}finally{z(!1)}}let he=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}},ge=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,R]=m(P.nextSibling),z=I.nextSibling,[V,K]=m(z.nextSibling);return V.nextSibling,u(g,()=>o(`themes.directoryHint`)),_.$$click=H,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(()=>!!k());return()=>e()&&f(b)})(),I,R),u(e,(()=>{var e=h(()=>!k());return()=>e()&&(()=>{var e=f(x),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=G(e),s=W(e);return(()=>{var g=f(w),_=g.firstChild,v=_.firstChild,[y,b]=m(v.nextSibling),x=y.nextSibling,[D,O]=m(x.nextSibling),k=_.nextSibling,A=k.firstChild,j=A.nextSibling,M=j.firstChild,[P,I]=m(M.nextSibling),R=P.nextSibling.nextSibling,[z,V]=m(R.nextSibling),H=j.nextSibling,W=H.firstChild,G=H.nextSibling,[K,J]=m(G.nextSibling),_e=k.nextSibling,[Y,ve]=m(_e.nextSibling),X=Y.nextSibling,Z=X.firstChild,ye=Z.nextSibling,[Q,be]=m(ye.nextSibling),$=Q.nextSibling;return u(_,r(t,{when:s,get children(){var e=f(S);return e.addEventListener(`error`,e=>{e.currentTarget.style.display=`none`}),p(e,`src`,s),e}}),y,b),u(_,(()=>{var t=h(()=>e.status===`ACTIVE`);return()=>t()&&(()=>{var e=f(T);return u(e,()=>o(`themes.active`)),e})()})(),D,O),u(A,()=>e.name),u(j,()=>o(`themes.version`),P,I),u(j,()=>e.version,z,V),u(W,()=>he(e.status)),u(k,(()=>{var t=h(()=>!!e.manifest?.description);return()=>t()&&(()=>{var t=f(E);return u(t,()=>e.manifest.description),t})()})(),K,J),u(g,r(t,{get when(){return h(()=>F()===e.id)()&&n.length>0},get children(){var s=f(C),l=s.firstChild,[g,_]=m(l.nextSibling),v=g.nextSibling,y=v.firstChild,b=y.nextSibling,[x,S]=m(b.nextSibling);return u(s,r(a,{each:n,children:t=>(()=>{var n=f(ne),o=n.firstChild,s=o.nextSibling,[l,g]=m(s.nextSibling);return u(o,()=>t.label||t.name),u(n,(()=>{var n=h(()=>t.type===`textarea`);return()=>n()?(()=>{var n=f(re);return n.$$input=e=>q(t.name,e.currentTarget.value),i(()=>p(n,`id`,`cfg-${e.id}-${t.name}`)),i(()=>d(n,`value`,String(L()[t.name]??``))),c(),n})():h(()=>t.type===`select`)()?(()=>{var n=f(ie);return n.addEventListener(`change`,e=>q(t.name,e.currentTarget.value)),u(n,r(a,{get each(){return t.options??[]},children:e=>(()=>{var t=f(ae);return u(t,()=>fe(e)),i(()=>d(t,`value`,de(e))),t})()})),i(()=>p(n,`id`,`cfg-${e.id}-${t.name}`)),i(()=>d(n,`value`,String(L()[t.name]??``))),n})():h(()=>t.type===`checkbox`)()?(()=>{var n=f(oe);return n.addEventListener(`change`,e=>q(t.name,e.currentTarget.checked)),i(()=>p(n,`id`,`cfg-${e.id}-${t.name}`)),i(()=>d(n,`checked`,!!L()[t.name])),n})():h(()=>t.type===`color`)()?(()=>{var n=f(se);return n.$$input=e=>q(t.name,e.currentTarget.value),i(()=>p(n,`id`,`cfg-${e.id}-${t.name}`)),i(()=>d(n,`value`,String(L()[t.name]??`#000000`))),c(),n})():(()=>{var n=f(ce);return n.$$input=e=>q(t.name,t.type===`number`?Number(e.currentTarget.value):e.currentTarget.value),i(r=>{var i=`cfg-${e.id}-${t.name}`,a=t.type===`number`?`number`:`text`;return i!==r.e&&p(n,`id`,r.e=i),a!==r.t&&p(n,`type`,r.t=a),r},{e:void 0,t:void 0}),i(()=>d(n,`value`,String(L()[t.name]??``))),c(),n})()})(),l,g),i(()=>p(o,`for`,`cfg-${e.id}-${t.name}`)),n})()}),g,_),y.$$click=()=>me(e),u(y,()=>o(`themes.configSave`)),u(v,r(t,{get when(){return B()},get children(){var e=f(ee);return u(e,()=>o(`themes.configSaved`)),e}}),x,S),i(()=>d(y,`disabled`,le())),c(),s}}),Y,ve),Z.$$click=()=>U(e),u(Z,(()=>{var t=h(()=>e.status===`ACTIVE`);return()=>t()?o(`themes.deactivate`):o(`themes.activate`)})()),u(X,r(t,{get when(){return n.length>0},get children(){var t=f(te);return t.$$click=()=>pe(e),u(t,(()=>{var t=h(()=>F()===e.id);return()=>t()?o(`themes.configClose`):o(`themes.configTitle`)})()),i(()=>d(t,`disabled`,N()!==null)),c(),t}}),Q,be),$.$$click=()=>ue(e),u($,()=>o(`themes.uninstall`)),i(t=>{var n=`theme-card ${e.status===`ACTIVE`?`active`:``}`,r=`status-badge ${ge(e.status)}`,i=`btn ${N()===e.id?`btn-loading`:``}`,a=N()!==null,o=N()!==null;return n!==t.e&&l(g,t.e=n),r!==t.t&&l(W,t.t=r),i!==t.a&&l(Z,t.a=i),a!==t.o&&d(Z,`disabled`,t.o=a),o!==t.i&&d($,`disabled`,t.i=o),t},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),c(),g})()}}),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})()})(),V,K),i(()=>d(_,`disabled`,k())),c(),e})()}s([`click`,`input`]);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.CBexpqud.js";import{n as m}from"./api.flUgn70U.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};
|
|
@@ -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}from"./web.DD6VKaIp.js";import{n as p}from"./i18n.CBexpqud.js";import{n as m}from"./api.flUgn70U.js";import{i as h,n as g,o as _,s as v,t as y}from"./src.CYKGYEyR.js";var b=o(`<div class="notice notice--error">`),x=o(`<div class=notice>`),S=o(`<table class=users-table><thead><tr><th></th><th></th><th></th><th></th><th></th><th></th></tr></thead><tbody>`),C=o(`<div class=users-manager><!$><!/><!$><!/><div class=toolbar><!$><!/><!$><!/><a class="btn btn-primary"href=/users/new></a><!$><!/></div><!$><!/><!$><!/><!$><!/>`),w=o(`<p class=muted>`),T=o(`<tr><td></td><td class=muted></td><td></td><td><span class=status-dot></span><!$><!/></td><td class=muted></td><td class=users-table__actions><!$><!/><!$><!/>`),E=o(`<span class=muted>`),D=o(`<div class="card user-details"><h3></h3><div class=form-grid><label><!$><!/><input class=input></label><label><!$><!/><input class=input type=email></label><label><!$><!/><select class=input><option value=ACTIVE></option><option value=INACTIVE></option></select></label><label><!$><!/><select class=input><option value></option><!$><!/></select></label></div><p class=muted></p><div class=media-details__actions><!$><!/><!$><!/><!$><!/>`),O=o(`<option><!$><!/> (<!$><!/>)`);function k(e){if(!e)return`—`;let t=new Date(e);return Number.isNaN(t.getTime())?`—`:t.toLocaleString(`pt-BR`)}function A(){let{t:o}=p(),[s,A]=n([]),[j,M]=n([]),[N,P]=n(0),[F,I]=n(1),[L,R]=n(``),[z,B]=n(``),[V,H]=n(``),[U,W]=n(``),[G,K]=n(null),[q,J]=n(!1),Y=async()=>{try{let e=await m.listUsers({page:F(),limit:20,search:L()||void 0,status:z()||void 0});A(e.data??[]),P(e.total??0)}catch(e){H(e instanceof Error?e.message:String(e))}};e(async()=>{await Y();try{M(await m.listRoles())}catch{}});let X=async()=>{I(1),await Y()},ee=async(e,t)=>{if(t){J(!0),H(``);try{let n=await m.assignRole(e.id,t);K({...e,roles:n.roles}),W(o(`users.detail.toasts.roleUpdated`,{name:e.name})),await Y()}catch(e){H(e instanceof Error?e.message:String(e))}finally{J(!1)}}},te=async e=>{let t=prompt(o(`users.detail.passwordPrompt`,{email:e.email}));if(t){if(t.length<8){H(o(`users.detail.passwordError`));return}J(!0),H(``);try{await m.setUserPassword(e.id,t),W(o(`users.detail.toasts.passwordChanged`,{name:e.name}))}catch(e){H(e instanceof Error?e.message:String(e))}finally{J(!1)}}},ne=async e=>{J(!0),H(``);try{await m.updateUser(e.id,{name:e.name,email:e.email,status:e.status}),W(o(`users.detail.toasts.saved`,{name:e.name})),K(null),await Y()}catch(e){H(e instanceof Error?e.message:String(e))}finally{J(!1)}},re=async e=>{if(confirm(o(`users.detail.confirmDelete`,{email:e.email}))){J(!0),H(``);try{await m.deleteUser(e.id),G()?.id===e.id&&K(null),W(o(`users.detail.toasts.deleted`,{name:e.name})),await Y()}catch(e){H(e instanceof Error?e.message:String(e))}finally{J(!1)}}},ie=e=>j().find(t=>t.slug===e.roles[0]);return(()=>{var e=d(C),n=e.firstChild,[p,m]=f(n.nextSibling),A=p.nextSibling,[M,P]=f(A.nextSibling),H=M.nextSibling,W=H.firstChild,[J,Z]=f(W.nextSibling),ae=J.nextSibling,[Q,oe]=f(ae.nextSibling),$=Q.nextSibling,se=$.nextSibling,[ce,le]=f(se.nextSibling),ue=H.nextSibling,[de,fe]=f(ue.nextSibling),pe=de.nextSibling,[me,he]=f(pe.nextSibling),ge=me.nextSibling,[_e,ve]=f(ge.nextSibling);return l(e,r(t,{get when(){return V()},get children(){var e=d(b);return l(e,V),e}}),p,m),l(e,r(t,{get when(){return U()},get children(){var e=d(x);return l(e,U),e}}),M,P),l(H,r(h,{name:`user-search`,get placeholder(){return o(`users.toolbar.search`)},get value(){return L()},onInput:e=>{R(e),X()}}),J,Z),l(H,r(v,{name:`user-status`,get placeholder(){return o(`users.toolbar.allStatus`)},get value(){return z()},get options(){return[{value:`ACTIVE`,label:o(`users.toolbar.active`)},{value:`INACTIVE`,label:o(`users.toolbar.inactive`)}]},onChange:e=>{B(e),X()}}),Q,oe),l($,()=>o(`users.toolbar.newBtn`)),l(H,r(g,{variant:`secondary`,onClick:()=>void X(),get children(){return o(`users.toolbar.searchBtn`)}}),ce,le),l(e,r(t,{get when(){return s().length>0},get fallback(){return(()=>{var e=d(w);return l(e,()=>o(`users.empty`)),e})()},get children(){var e=d(S),n=e.firstChild,c=n.firstChild.firstChild,u=c.nextSibling,p=u.nextSibling,m=p.nextSibling,h=m.nextSibling,_=n.nextSibling;return l(c,()=>o(`users.table.name`)),l(u,()=>o(`users.table.email`)),l(p,()=>o(`users.table.role`)),l(m,()=>o(`users.table.status`)),l(h,()=>o(`users.table.lastAccess`)),l(_,r(a,{get each(){return s()},children:e=>(()=>{var n=d(T),a=n.firstChild,s=a.nextSibling,c=s.nextSibling,u=c.nextSibling,p=u.firstChild,m=p.nextSibling,[h,_]=f(m.nextSibling),v=u.nextSibling,b=v.nextSibling,x=b.firstChild,[S,C]=f(x.nextSibling),w=S.nextSibling,[D,O]=f(w.nextSibling);return l(a,()=>e.name),l(s,()=>e.email),l(c,r(t,{get when(){return e.roles.length>0},get fallback(){return(()=>{var e=d(E);return l(e,()=>o(`users.noRole`)),e})()},get children(){return r(y,{get children(){return e.roles.join(`, `)}})}})),l(u,()=>o(`common.status.`+e.status.toLowerCase()),h,_),l(v,()=>k(e.last_login_at)),l(b,r(g,{variant:`secondary`,size:`sm`,onClick:()=>K(e),get children(){return o(`users.table.actions.manage`)}}),S,C),l(b,r(g,{variant:`danger`,size:`sm`,onClick:()=>void re(e),get children(){return o(`users.table.actions.delete`)}}),D,O),i(t=>{var r=G()?.id===e.id,i=e.status===`ACTIVE`;return r!==t.e&&n.classList.toggle(`users-table__row--selected`,t.e=r),i!==t.t&&p.classList.toggle(`status-dot--active`,t.t=i),t},{e:void 0,t:void 0}),n})()})),e}}),de,fe),l(e,r(_,{get page(){return F()},limit:20,get total(){return N()},onPageChange:e=>{I(e),Y()}}),me,he),l(e,r(t,{get when(){return G()},children:e=>(()=>{var t=d(D),n=t.firstChild,s=n.nextSibling,p=s.firstChild,m=p.firstChild,[h,_]=f(m.nextSibling),v=h.nextSibling,y=p.nextSibling,b=y.firstChild,[x,S]=f(b.nextSibling),C=x.nextSibling,w=y.nextSibling,T=w.firstChild,[E,A]=f(T.nextSibling),M=E.nextSibling,N=M.firstChild,P=N.nextSibling,F=w.nextSibling,I=F.firstChild,[L,R]=f(I.nextSibling),z=L.nextSibling,B=z.firstChild,V=B.nextSibling,[H,U]=f(V.nextSibling),W=s.nextSibling,G=W.nextSibling,J=G.firstChild,[Y,X]=f(J.nextSibling),re=Y.nextSibling,[Z,ae]=f(re.nextSibling),Q=Z.nextSibling,[oe,$]=f(Q.nextSibling);return l(n,()=>o(`users.detail.title`)),l(p,()=>o(`users.detail.fields.name`),h,_),v.$$input=t=>K({...e(),name:t.currentTarget.value}),l(y,()=>o(`users.detail.fields.email`),x,S),C.$$input=t=>K({...e(),email:t.currentTarget.value}),l(w,()=>o(`users.detail.fields.status`),E,A),M.addEventListener(`change`,t=>K({...e(),status:t.currentTarget.value})),l(N,()=>o(`users.detail.statusOptions.active`)),l(P,()=>o(`users.detail.statusOptions.inactive`)),l(F,()=>o(`users.detail.fields.role`),L,R),z.addEventListener(`change`,t=>void ee(e(),t.currentTarget.value)),l(B,()=>o(`users.detail.rolePlaceholder`)),l(z,r(a,{get each(){return j()},children:e=>(()=>{var t=d(O),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})()}),H,U),l(W,()=>o(`users.detail.meta`,{created:k(e().created_at),lastAccess:k(e().last_login_at)})),l(G,r(g,{variant:`primary`,get disabled(){return q()},get loading(){return q()},onClick:()=>void ne(e()),get children(){return o(`users.detail.actions.save`)}}),Y,X),l(G,r(g,{variant:`secondary`,get disabled(){return q()},onClick:()=>void te(e()),get children(){return o(`users.detail.actions.resetPassword`)}}),Z,ae),l(G,r(g,{variant:`secondary`,onClick:()=>K(null),get children(){return o(`users.detail.actions.close`)}}),oe,$),i(()=>u(z,`disabled`,q())),i(()=>u(v,`value`,e().name)),i(()=>u(C,`value`,e().email)),i(()=>u(M,`value`,e().status)),i(()=>u(z,`value`,ie(e())?.id??``)),c(),t})()}),_e,ve),e})()}s([`input`]);export{A as UsersManager};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{S as e,a as t,h as n,l as r,p as i,r as a,x 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.CBexpqud.js";import{n as v}from"./api.flUgn70U.js";var y=s(`<div class=webhook-event-select__dropdown role=listbox><input class=input><div class=webhook-event-select__options>`),b=s(`<div class=webhook-event-select><button type=button class="input webhook-event-select__trigger"aria-haspopup=listbox><span></span><span aria-hidden=true>⌄</span></button><!$><!/><div class=webhook-event-select__chips>`),x=s(`<span class=muted>`),S=s(`<label class=webhook-event-option><input type=checkbox><span><!$><!/><small>`),C=s(`<button type=button class=webhook-event-chip><!$><!/> ×`),w=s(`<div class="notice notice--error">`),T=s(`<div class=table-scroll><table class=table><thead><tr><th></th><th></th><th></th><th></th><th></th></tr></thead><tbody>`),E=s(`<div class="resource-hub webhooks-manager"><!$><!/><div class=card-header-row><div><h3></h3></div><button class="btn btn-primary"type=button></button></div><!$><!/><section class=card></section><style>.webhook-event-select{position:relative}.webhook-event-select__trigger{width:100%;display:flex;justify-content:space-between;align-items:center;text-align:left;cursor:pointer}.webhook-event-select__dropdown{position:absolute;z-index:20;top:calc(100% + .25rem);left:0;right:0;background:var(--color-surface,#fff);border:1px solid var(--color-border,#dcdcde);box-shadow:0 8px 22px rgba(0,0,0,.14);padding:.6rem}.webhook-event-select__options{max-height:240px;overflow:auto;margin-top:.5rem;display:grid;gap:.2rem}.webhook-event-option{display:flex!important;align-items:flex-start;gap:.5rem!important;padding:.45rem;border-radius:4px;cursor:pointer}.webhook-event-option:hover{background:var(--color-surface-muted,#f5f5f5)}.webhook-event-option span{display:grid;gap:.12rem}.webhook-event-option small{color:var(--color-muted);font-size:.75rem}.webhook-event-select__chips{display:flex;flex-wrap:wrap;gap:.35rem;margin-top:.4rem}.webhook-event-chip{border:1px solid var(--color-border,#dcdcde);background:var(--color-surface-muted,#f5f5f5);border-radius:999px;padding:.2rem .55rem;cursor:pointer;font-size:.78rem}`),D=s(`<label><!$><!/><input class=input type=password>`),O=s(`<div class=form-grid><label><!$><!/><input class=input></label><label><!$><!/><input class=input type=password>`),k=s(`<div class=form-grid><label><!$><!/><input class=input type=password></label><label><!$><!/><input class=input>`),A=s(`<section class=card><h3></h3><form class=resource-form><label><!$><!/><input class=input required type=url></label><label><!$><!/><!$><!/></label><label><!$><!/><select class=input><option value=none></option><option value=bearer></option><option value=basic></option><option value=api_key></option><option value=hmac_sha256></option></select></label><!$><!/><!$><!/><!$><!/><!$><!/><label class=checkbox-label><input type=checkbox> <!$><!/></label><div><button class="btn btn-primary"type=submit></button> <button class=btn type=button>`),j=s(`<p>`),M=s(`<tr><td></td><td></td><td></td><td></td><td><button class=btn type=button></button> <button class="btn btn-danger"type=button>`),N=()=>({url:``,events:[],active:!0,auth_type:`hmac_sha256`,auth_config:{signatureHeader:`X-Webhook-Signature`}});function P(s){let[c,_]=n(!1),[v,w]=n(``),T;e(()=>{let e=e=>{T&&!T.contains(e.target)&&_(!1)};document.addEventListener(`mousedown`,e),o(()=>document.removeEventListener(`mousedown`,e))});let E=()=>s.options.filter(e=>`${e.label} ${e.value}`.toLowerCase().includes(v().toLowerCase())),D=e=>s.onChange(s.value.includes(e)?s.value.filter(t=>t!==e):[...s.value,e]);return(()=>{var e=f(b),n=e.firstChild,o=n.firstChild,O=n.nextSibling,[k,A]=m(O.nextSibling),j=k.nextSibling,M=T;return typeof M==`function`?g(M,e):T=e,n.$$click=()=>_(!c()),u(o,(()=>{var e=h(()=>s.value.length>0);return()=>e()?`${s.value.length} selecionado(s)`:s.placeholder})()),u(e,r(t,{get when(){return c()},get children(){var e=f(y),n=e.firstChild,o=n.nextSibling;return n.$$input=e=>w(e.currentTarget.value),u(o,r(t,{get when(){return E().length>0},get fallback(){return(()=>{var e=f(x);return u(e,()=>s.empty),e})()},get children(){return r(a,{get each(){return E()},children:e=>(()=>{var t=f(S),n=t.firstChild,r=n.nextSibling,a=r.firstChild,[o,c]=m(a.nextSibling),l=o.nextSibling;return n.addEventListener(`change`,()=>D(e.value)),u(r,()=>e.label,o,c),u(l,()=>e.value),i(()=>d(n,`checked`,s.value.includes(e.value))),t})()})}})),i(()=>p(n,`placeholder`,s.searchPlaceholder)),i(()=>d(n,`value`,v())),l(),e}}),k,A),u(j,r(a,{get each(){return s.value},children:e=>(()=>{var t=f(C),n=t.firstChild,[r,i]=m(n.nextSibling);return r.nextSibling,t.$$click=()=>D(e),u(t,()=>s.options.find(t=>t.value===e)?.label??e,r,i),l(),t})()})),i(()=>p(n,`aria-expanded`,c())),l(),e})()}function F(){let{t:o}=_(),[s,c]=n([]),[g,y]=n([]),[b,x]=n(null),[S,C]=n(``),[F,I]=n(!0),L=async()=>{I(!0);try{let[e,t]=await Promise.all([v.getWebhooks(),v.getWebhookEvents()]);c(e),y(t)}catch(e){C(e instanceof Error?e.message:String(e))}finally{I(!1)}};e(L);let R=e=>{if(!e){x(N());return}x({...e,events:[...e.events??[]],auth_type:e.auth_type??`hmac_sha256`,auth_config:{...e.auth_config??{}}})},z=(e,t)=>{let n=b();if(n){if(!n.events||n.events.length===0){C(o(`webhooks.eventsRequired`));return}x({...n,auth_config:{...n.auth_config,[e]:t}})}},B=async e=>{e.preventDefault();let t=b();if(!t)return;let n=Object.fromEntries(Object.entries(t.auth_config).filter(([,e])=>e));try{t.id?await v.updateWebhook(t.id,{...t,auth_config:n}):await v.createWebhook({...t,auth_config:n}),x(null),await L()}catch(e){C(e instanceof Error?e.message:String(e))}};return(()=>{var e=f(E),n=e.firstChild,[c,_]=m(n.nextSibling),y=c.nextSibling,C=y.firstChild,N=C.firstChild,I=C.nextSibling,V=y.nextSibling,[H,U]=m(V.nextSibling),W=H.nextSibling;return u(e,r(t,{get when(){return S()},get children(){var e=f(w);return u(e,S),e}}),c,_),u(N,()=>o(`webhooks.listTitle`)),I.$$click=()=>R(),u(I,()=>o(`webhooks.new`)),u(e,r(t,{get when(){return b()},children:e=>(()=>{var n=f(A),a=n.firstChild,s=a.nextSibling,c=s.firstChild,_=c.firstChild,[v,y]=m(_.nextSibling),b=v.nextSibling,S=c.nextSibling,C=S.firstChild,[w,T]=m(C.nextSibling),E=w.nextSibling,[j,M]=m(E.nextSibling),N=S.nextSibling,F=N.firstChild,[I,L]=m(F.nextSibling),R=I.nextSibling,V=R.firstChild,H=V.nextSibling,U=H.nextSibling,W=U.nextSibling,G=W.nextSibling,ee=N.nextSibling,[K,te]=m(ee.nextSibling),ne=K.nextSibling,[q,re]=m(ne.nextSibling),ie=q.nextSibling,[J,ae]=m(ie.nextSibling),oe=J.nextSibling,[Y,se]=m(oe.nextSibling),X=Y.nextSibling,Z=X.firstChild,ce=Z.nextSibling.nextSibling,[le,ue]=m(ce.nextSibling),Q=X.nextSibling.firstChild,$=Q.nextSibling.nextSibling;return u(a,(()=>{var t=h(()=>!!e().id);return()=>t()?o(`webhooks.edit`):o(`webhooks.create`)})()),s.addEventListener(`submit`,B),u(c,()=>o(`webhooks.url`),v,y),b.$$input=t=>x({...e(),url:t.currentTarget.value}),u(S,()=>o(`webhooks.events`),w,T),u(S,r(P,{get options(){return g()},get value(){return e().events??[]},onChange:t=>x({...e(),events:t}),get placeholder(){return o(`webhooks.selectEvents`)},get searchPlaceholder(){return o(`webhooks.searchEvents`)},get empty(){return o(`webhooks.noEvents`)}}),j,M),u(N,()=>o(`webhooks.authentication`),I,L),R.addEventListener(`change`,t=>x({...e(),auth_type:t.currentTarget.value,auth_config:{}})),u(V,()=>o(`webhooks.auth.none`)),u(H,()=>o(`webhooks.auth.bearer`)),u(U,()=>o(`webhooks.auth.basic`)),u(W,()=>o(`webhooks.auth.apiKey`)),u(G,()=>o(`webhooks.auth.hmac_sha256`)),u(s,r(t,{get when(){return e().auth_type===`bearer`},get children(){var t=f(D),n=t.firstChild,[r,a]=m(n.nextSibling),s=r.nextSibling;return u(t,()=>o(`webhooks.token`),r,a),s.$$input=e=>z(`token`,e.currentTarget.value),i(()=>p(s,`placeholder`,e().id?o(`webhooks.keepExisting`):``)),i(()=>d(s,`value`,e().auth_config.token??``)),l(),t}}),K,te),u(s,r(t,{get when(){return e().auth_type===`basic`},get children(){var t=f(O),n=t.firstChild,r=n.firstChild,[a,s]=m(r.nextSibling),c=a.nextSibling,h=n.nextSibling,g=h.firstChild,[_,v]=m(g.nextSibling),y=_.nextSibling;return u(n,()=>o(`webhooks.username`),a,s),c.$$input=e=>z(`username`,e.currentTarget.value),u(h,()=>o(`webhooks.password`),_,v),y.$$input=e=>z(`password`,e.currentTarget.value),i(()=>p(y,`placeholder`,e().id?o(`webhooks.keepExisting`):``)),i(()=>d(c,`value`,e().auth_config.username??``)),i(()=>d(y,`value`,e().auth_config.password??``)),l(),t}}),q,re),u(s,r(t,{get when(){return e().auth_type===`api_key`},get children(){var t=f(O),n=t.firstChild,r=n.firstChild,[a,s]=m(r.nextSibling),c=a.nextSibling,h=n.nextSibling,g=h.firstChild,[_,v]=m(g.nextSibling),y=_.nextSibling;return u(n,()=>o(`webhooks.headerName`),a,s),c.$$input=e=>z(`headerName`,e.currentTarget.value),u(h,()=>o(`webhooks.apiKeyValue`),_,v),y.$$input=e=>z(`value`,e.currentTarget.value),i(()=>p(y,`placeholder`,e().id?o(`webhooks.keepExisting`):``)),i(()=>d(c,`value`,e().auth_config.headerName??``)),i(()=>d(y,`value`,e().auth_config.value??``)),l(),t}}),J,ae),u(s,r(t,{get when(){return e().auth_type===`hmac_sha256`},get children(){var t=f(k),n=t.firstChild,r=n.firstChild,[a,s]=m(r.nextSibling),c=a.nextSibling,h=n.nextSibling,g=h.firstChild,[_,v]=m(g.nextSibling),y=_.nextSibling;return u(n,()=>o(`webhooks.secret`),a,s),c.$$input=e=>z(`secret`,e.currentTarget.value),u(h,()=>o(`webhooks.signatureHeader`),_,v),y.$$input=e=>z(`signatureHeader`,e.currentTarget.value),i(t=>{var n=!e().id,r=e().id?o(`webhooks.keepExisting`):``;return n!==t.e&&d(c,`required`,t.e=n),r!==t.t&&p(c,`placeholder`,t.t=r),t},{e:void 0,t:void 0}),i(()=>d(c,`value`,e().auth_config.secret??``)),i(()=>d(y,`value`,e().auth_config.signatureHeader??`X-Webhook-Signature`)),l(),t}}),Y,se),Z.addEventListener(`change`,t=>x({...e(),active:t.currentTarget.checked})),u(X,()=>o(`webhooks.active`),le,ue),u(Q,()=>o(`common.save`)),$.$$click=()=>x(null),u($,()=>o(`common.cancel`)),i(()=>d(b,`value`,e().url??``)),i(()=>d(R,`value`,e().auth_type)),i(()=>d(Z,`checked`,e().active??!0)),l(),n})()}),H,U),u(W,r(t,{get when(){return!F()},get fallback(){return(()=>{var e=f(j);return u(e,()=>o(`webhooks.loading`)),e})()},get children(){return r(t,{get when(){return s().length>0},get fallback(){return(()=>{var e=f(j);return u(e,()=>o(`webhooks.empty`)),e})()},get children(){var e=f(T),t=e.firstChild.firstChild,n=t.firstChild.firstChild,i=n.nextSibling,c=i.nextSibling,d=c.nextSibling,p=d.nextSibling,m=t.nextSibling;return u(n,()=>o(`webhooks.url`)),u(i,()=>o(`webhooks.events`)),u(c,()=>o(`webhooks.authentication`)),u(d,()=>o(`webhooks.active`)),u(p,()=>o(`common.actions`)),u(m,r(a,{get each(){return s()},children:e=>(()=>{var t=f(M),n=t.firstChild,r=n.nextSibling,i=r.nextSibling,a=i.nextSibling,s=a.nextSibling.firstChild,c=s.nextSibling.nextSibling;return u(n,()=>e.url),u(r,()=>(e.events??[]).join(`, `)),u(i,()=>o(`webhooks.auth.${e.auth_type??`hmac_sha256`}`)),u(a,(()=>{var t=h(()=>!!e.active);return()=>t()?o(`common.yes`):o(`common.no`)})()),s.$$click=()=>R(e),u(s,()=>o(`common.edit`)),c.$$click=()=>e.id&&void v.deleteWebhook(e.id).then(L),u(c,()=>o(`common.delete`)),l(),t})()})),e}})}})),l(),e})()}c([`click`,`input`]);export{F as WebhooksManager};
|