@blinkk/root-cms 3.1.5 → 3.1.6
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/app.js +1 -1
- package/dist/{chunk-ETHWZSNM.js → chunk-PLSNGCYU.js} +196 -22
- package/dist/{chunk-MUXSUGFF.js → chunk-U4TMO2LI.js} +2 -2
- package/dist/{chunk-6CTCV2PN.js → chunk-Z2CTQVYR.js} +1 -1
- package/dist/cli.js +1 -1
- package/dist/client.js +1 -1
- package/dist/core/client.d.ts +30 -2
- package/dist/core/cron-schedule.d.ts +63 -0
- package/dist/core/plugin.d.ts +6 -1
- package/dist/core.js +1 -1
- package/dist/functions.js +2 -2
- package/dist/plugin.js +7 -5
- package/dist/richtext.js +1 -1
- package/dist/shared/embed-protocol.d.ts +19 -0
- package/dist/ui/{AIPage-25WICIOT.js → AIPage-EO5WH25R.js} +1 -1
- package/dist/ui/{AssetsPage-WKTM2J2G.js → AssetsPage-ESLB4R3I.js} +1 -1
- package/dist/ui/{CollectionPage-5ZOVG7IG.js → CollectionPage-MXN7XKUX.js} +1 -1
- package/dist/ui/{ComparePage-DDIFYYTK.js → ComparePage-TY7VJVE3.js} +1 -1
- package/dist/ui/{DataPage-RFNGSDDN.js → DataPage-YEIS7HBN.js} +1 -1
- package/dist/ui/{DataSourcePage-U46CDIH2.js → DataSourcePage-VD6YBDRW.js} +1 -1
- package/dist/ui/{DocTranslationsPage-BFCM2PE3.js → DocTranslationsPage-6XLREBPQ.js} +1 -1
- package/dist/ui/DocumentPage-2HNNEGRI.js +1 -0
- package/dist/ui/{EditDataSourcePage-NKKIF6AD.js → EditDataSourcePage-E4PSKSG3.js} +1 -1
- package/dist/ui/{EditReleasePage-TKNOUT7A.js → EditReleasePage-DOMXJXCU.js} +1 -1
- package/dist/ui/{EmbeddedAIPage-4AX7VO3T.js → EmbeddedAIPage-U5LONYH2.js} +1 -1
- package/dist/ui/EmbeddedDocumentPage-HYV5GPK6.js +1 -0
- package/dist/ui/{LogsPage-SCECIAZH.js → LogsPage-6KV3CQLH.js} +1 -1
- package/dist/ui/{NewDataSourcePage-FAOPK2RZ.js → NewDataSourcePage-NJJDHGPX.js} +1 -1
- package/dist/ui/{NewReleasePage-HD6T6UV2.js → NewReleasePage-FXHPFUVG.js} +1 -1
- package/dist/ui/{NotFoundPage-JRYFUENW.js → NotFoundPage-CA7XVXUO.js} +1 -1
- package/dist/ui/{ProjectPage-2WIMWCSX.js → ProjectPage-XUBJSCWB.js} +1 -1
- package/dist/ui/{ReleasePage-GUMEMLF6.js → ReleasePage-NLGRYJX7.js} +1 -1
- package/dist/ui/{ReleasesPage-AW6PICTQ.js → ReleasesPage-OY7OKC3C.js} +1 -1
- package/dist/ui/{SettingsPage-KFLNZ356.js → SettingsPage-5EQUY52A.js} +1 -1
- package/dist/ui/SidebarToolsPage-FWG6TIDI.js +1 -0
- package/dist/ui/TaskPage-APNRUOYG.js +1 -0
- package/dist/ui/{TasksPage-G3GBTV3L.js → TasksPage-FTEELXVZ.js} +1 -1
- package/dist/ui/{TranslationsArbPage-K272JEAA.js → TranslationsArbPage-PG5USRYB.js} +1 -1
- package/dist/ui/{TranslationsEditPage-XWXPNKRQ.js → TranslationsEditPage-GV3ZJXTY.js} +1 -1
- package/dist/ui/{TranslationsPage-7KUHVTLK.js → TranslationsPage-3AKSMCNF.js} +1 -1
- package/dist/ui/{chunk-VPZHG7JL.js → chunk-235TRWJF.js} +1 -1
- package/dist/ui/{chunk-IGZDFHVM.js → chunk-3LEYSXZP.js} +1 -1
- package/dist/ui/chunk-56NMZYX6.js +19 -0
- package/dist/ui/{chunk-T5BJNOWE.js → chunk-6WJQBFN5.js} +1 -1
- package/dist/ui/{chunk-OWBT6YUM.js → chunk-A7IZAHBZ.js} +1 -1
- package/dist/ui/{chunk-WC7KMPEQ.js → chunk-C5FRMXDS.js} +1 -1
- package/dist/ui/{chunk-UPN3EMUS.js → chunk-EYJ6GKZR.js} +1 -1
- package/dist/ui/{chunk-TNW2GNUR.js → chunk-G5647K25.js} +1 -1
- package/dist/ui/chunk-LAXQZPE3.js +31 -0
- package/dist/ui/chunk-MYPLMHFW.js +1 -0
- package/dist/ui/{chunk-XUBZH4ON.js → chunk-O7ESOZQO.js} +1 -1
- package/dist/ui/{chunk-5KSGCGYY.js → chunk-QGAPMQEJ.js} +1 -1
- package/dist/ui/{chunk-7UHZS56B.js → chunk-ST6QNIWT.js} +53 -53
- package/dist/ui/{chunk-DWV5J2W7.js → chunk-U7LSFUHT.js} +1 -1
- package/dist/ui/chunk-UOKVF54Y.js +3 -0
- package/dist/ui/{chunk-FVWSVOOY.js → chunk-VJRMR2JM.js} +1 -1
- package/dist/ui/chunk-Z2CRNO3I.js +1 -0
- package/dist/ui/{chunk-N5RJIILP.js → chunk-ZAJPNVYS.js} +1 -1
- package/dist/ui/ui.css +1 -1
- package/dist/ui/ui.js +1 -1
- package/package.json +3 -3
- package/dist/ui/DocumentPage-OTBXM55S.js +0 -1
- package/dist/ui/EmbeddedDocumentPage-2CNQJTW5.js +0 -1
- package/dist/ui/SidebarToolsPage-3R7BQ2F7.js +0 -1
- package/dist/ui/TaskPage-GZGPKIL5.js +0 -1
- package/dist/ui/chunk-2FQMT5AB.js +0 -3
- package/dist/ui/chunk-GCSN3YEC.js +0 -31
- package/dist/ui/chunk-NXWYS4HG.js +0 -19
- package/dist/ui/chunk-RN4XVVWD.js +0 -1
- /package/dist/ui/{chunk-VPZHG7JL.js.LEGAL.txt → chunk-235TRWJF.js.LEGAL.txt} +0 -0
- /package/dist/ui/{chunk-7UHZS56B.js.LEGAL.txt → chunk-ST6QNIWT.js.LEGAL.txt} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{d as qe,j as Je,k as Ye,l as G,n as Ge,o as Qe,p as Ze,q as et,s as tt}from"./chunk-7UHZS56B.js";import"./chunk-UCYWQEAS.js";import"./chunk-DWV5J2W7.js";import"./chunk-T5BJNOWE.js";import"./chunk-34W6H4YG.js";import"./chunk-SYDHFYRC.js";import"./chunk-535JU7FU.js";import"./chunk-FBSBL476.js";import{a as nt}from"./chunk-NXWYS4HG.js";import"./chunk-GCSN3YEC.js";import"./chunk-QWB6MAPJ.js";import{c as Ue}from"./chunk-VPZHG7JL.js";import"./chunk-AAR7DBEN.js";import{b as it}from"./chunk-RB23LLKL.js";import"./chunk-JBLSUM6W.js";import"./chunk-2RRM4HEQ.js";import"./chunk-HXSB6YB2.js";import"./chunk-N5RJIILP.js";import{b as je,c as ce,g as Xe}from"./chunk-UPN3EMUS.js";import"./chunk-HV3JJ5UT.js";import"./chunk-TNW2GNUR.js";import"./chunk-FVWSVOOY.js";import{a as T}from"./chunk-QFDU6FXP.js";import"./chunk-JDW4UORS.js";import{a as fe}from"./chunk-UJX25CXD.js";import"./chunk-RN4XVVWD.js";import"./chunk-QRAFYIAW.js";import"./chunk-ATTW36EM.js";import"./chunk-YDO2EDVY.js";import"./chunk-5MV6XVGA.js";import"./chunk-PLYSJ7W5.js";import"./chunk-H37RXS4R.js";import{b as He}from"./chunk-W5DOO6ID.js";import{a as $e}from"./chunk-YBHFGQ3Z.js";import"./chunk-2PTLQRTU.js";import"./chunk-PIJ3E47R.js";import"./chunk-NCZD5IWS.js";import{a as at}from"./chunk-QLIIVG5Q.js";import{c as ot}from"./chunk-OWBT6YUM.js";import{a as Ke}from"./chunk-AAHM6RYJ.js";import"./chunk-ISUGBMXC.js";import"./chunk-DZYYWCHX.js";import"./chunk-XOWWPE7X.js";import{e as E}from"./chunk-WASID5UU.js";import{$a as Ne,$b as Ae,$c as We,Fa as R,Ga as e,Gc as Ve,Ia as Se,Oa as ye,P as ke,Qa as ie,Sa as Ie,W as N,Wa as Ee,_b as Be,a as I,ad as re,ba as De,c as b,da as Y,e as w,g as z,h as D,j as ae,nb as Te,tb as Re,ub as Le,vb as Me,vc as Oe,wb as ze,za as Ce,zc as Fe}from"./chunk-WRA24P66.js";import{d as W,j as be,k as ft}from"./chunk-KUCVLANF.js";import"./chunk-7SK47HHZ.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";ae();ae();async function rt(t,o){let a=await(await fetch("/cms/api/check.test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({check:t,docId:o})})).json();if(!a.success)throw new Error(a.error||"Check failed.");return a.data}function ct(t){let o=window.__ROOT_CTX.checks||[],n=t.docId.split("/")[0],a=o.filter(l=>!l.collections||l.collections.includes(n)),[i,c]=I({}),d=D(async l=>{c(h=>({...h,[l]:{loading:!0}}));try{let h=await rt(l,t.docId);c(_=>({..._,[l]:{loading:!1,result:h}}))}catch(h){c(_=>({..._,[l]:{loading:!1,error:h.message||"Unknown error."}}))}},[t.docId]),u=D(async()=>{let l={};for(let h of a)l[h.id]={loading:!0};c(l);for(let h of a)try{let _=await rt(h.id,t.docId);c(f=>({...f,[h.id]:{loading:!1,result:_}}))}catch(_){c(f=>({...f,[h.id]:{loading:!1,error:_.message||"Unknown error."}}))}},[t.docId,a]);return e("div",{className:"ChecksPanel",children:[e("div",{className:"ChecksPanel__header",children:[e("div",{className:"ChecksPanel__header__title",children:"Checks"}),e(Y,{variant:"default",size:"xs",compact:!0,leftIcon:e(Oe,{size:12}),onClick:u,children:"Run All"})]}),e("div",{className:"ChecksPanel__body",children:e("div",{className:"ChecksPanel__checks",children:a.map(l=>{let h=i[l.id];return e(vt,{check:l,state:h,onRun:()=>d(l.id)},l.id)})})})]})}function vt(t){let{check:o,state:n,onRun:a}=t;return e("div",{className:"ChecksPanel__check",children:[e("div",{className:"ChecksPanel__check__header",children:[e("div",{className:"ChecksPanel__check__label",children:[o.label,n?.result&&e(xt,{status:n.result.status})]}),e(Y,{className:"ChecksPanel__check__runButton",variant:"default",size:"xs",compact:!0,loading:n?.loading,onClick:a,children:"Run"})]}),o.description&&e("div",{className:"ChecksPanel__check__description",children:o.description}),n?.result&&e("div",{className:E("ChecksPanel__check__result",`ChecksPanel__check__result--${n.result.status}`),children:e(Ue,{code:n.result.message})}),n?.error&&e("div",{className:"ChecksPanel__check__error",children:n.error})]})}var Pt={success:"green",warning:"yellow",error:"red"},wt={success:Ne,warning:Se,error:re};function xt(t){let o=Pt[t.status],n=wt[t.status],a=t.status.charAt(0).toUpperCase()+t.status.slice(1);return e(De,{className:"ChecksPanel__statusBadge",color:o,size:"sm",variant:"filled",leftSection:e(n,{size:10}),children:a})}function st(t){let{devices:o,multiSelect:n,expandVertically:a,iframeUrl:i,localeOptions:c,selectedLocale:d,onToggleDevice:u,onToggleMultiSelect:l,onToggleExpandVertically:h,onReloadClick:_,onOpenNewTab:f,onLocaleChange:C}=t,g=o.length>0;return e("div",{className:"DocumentPagePreviewBar",children:[e("div",{className:"DocumentPagePreviewBar__devices",children:[e(R,{label:"Mobile",children:e(N,{className:E("DocumentPagePreviewBar__device",o.includes("mobile")&&"active"),"aria-pressed":o.includes("mobile"),onClick:()=>u("mobile"),children:e(ze,{size:16})})}),e(R,{label:"Tablet",children:e(N,{className:E("DocumentPagePreviewBar__device",o.includes("tablet")&&"active"),"aria-pressed":o.includes("tablet"),onClick:()=>u("tablet"),children:e(Me,{size:16})})}),e(R,{label:"Desktop",children:e(N,{className:E("DocumentPagePreviewBar__device",o.includes("desktop")&&"active"),"aria-pressed":o.includes("desktop"),onClick:()=>u("desktop"),children:e(Re,{size:16})})}),e("div",{className:"DocumentPagePreviewBar__divider"}),e(R,{label:"Compare viewports",children:e(N,{className:E("DocumentPagePreviewBar__device",n&&"active"),role:"checkbox","aria-checked":n,onClick:l,children:e(Te,{size:16})})}),e(R,{label:"Expand",children:e(N,{className:E("DocumentPagePreviewBar__device",a&&"active"),"aria-pressed":a,disabled:!g,onClick:h,children:e(Ie,{size:16})})})]}),e("div",{className:"DocumentPagePreviewBar__navbar",children:e("div",{className:"DocumentPagePreviewBar__navbar__url",children:i})}),e("div",{className:"DocumentPagePreviewBar__locales",children:e(Ce,{data:c,placeholder:"Locale",radius:"xl",size:"xs",required:!0,icon:e(We,{size:16,strokeWidth:1.5}),value:d,onChange:v=>{C(v)}})}),e("div",{className:"DocumentPagePreviewBar__buttons",children:[e(R,{label:"Reload",children:e(N,{className:"DocumentPagePreviewBar__button DocumentPagePreviewBar__button--reload",onClick:_,children:e(Fe,{size:16})})}),e(R,{label:"Open new tab",children:e(N,{className:"DocumentPagePreviewBar__button DocumentPagePreviewBar__button--openNewTab",onClick:f,children:e(ie,{size:16})})})]})]})}ae();function lt(t){let o=t.docId.split("/")[0],n=Xe(o),a=G(),i=w(null),[c,d]=I(""),[u,l]=I([]),[h,_]=I(!1),f=w("");f.current=c;let C=w(n.schema?.fields||[]);C.current=n.schema?.fields||[];let g=w(n.schema?.types||{});g.current=n.schema?.types||{};let v=z(()=>Je(p=>{let k=p.trim();if(!k){l([]),_(!1);return}let y=a.controller?.getData()?.fields||{},L=et(k,y,C.current,g.current);l(L),_(!0)},150),[a.controller]);b(()=>{v(c)},[c,v]),Ge(()=>{f.current.trim()&&v(f.current)}),b(()=>{t.autoFocus&&requestAnimationFrame(()=>{i.current?.focus(),i.current?.select()})},[t.autoFocus]),b(()=>{let p=()=>{i.current?.focus(),i.current?.select()};return window.addEventListener("root:focus-search",p),()=>window.removeEventListener("root:focus-search",p)},[]);let P=p=>{Dt(p)};return e("div",{className:"SearchPanel",children:[e("div",{className:"SearchPanel__header",children:[e("div",{className:"SearchPanel__header__title",children:"Search"}),t.onClose&&e(N,{size:"xs",onClick:t.onClose,title:"Close search",children:e(re,{size:14})})]}),e("div",{className:"SearchPanel__searchInput",children:[e("span",{className:"SearchPanel__searchInput__icon",children:e(Ve,{size:14})}),e("input",{ref:i,type:"text",className:"SearchPanel__searchInput__input",value:c,onInput:p=>d(p.currentTarget.value),onKeyDown:p=>{p.key==="Escape"&&t.onClose&&(p.preventDefault(),t.onClose())},placeholder:"Search field values\u2026",autoComplete:"off",spellcheck:!1})]}),e("div",{className:"SearchPanel__body",children:[!h&&!c.trim()&&e("div",{className:"SearchPanel__empty",children:"Type a query above to search field values in this document."}),h&&u.length===0&&e("div",{className:"SearchPanel__empty",children:["No matches for ",e("strong",{children:c}),"."]}),u.length>0&&e(W,{children:[e("div",{className:"SearchPanel__resultsCount",children:[u.length," ",u.length===1?"match":"matches"]}),e("ul",{className:"SearchPanel__results",children:u.map((p,k)=>e(bt,{result:p,onClick:()=>P(p)},`${p.deepKey}:${k}`))})]})]})]})}function bt(t){let{result:o}=t;return e("li",{className:"SearchPanel__result",children:e("button",{type:"button",className:"SearchPanel__result__button",onClick:t.onClick,children:[e("div",{className:"SearchPanel__result__label",children:o.label}),e("div",{className:"SearchPanel__result__snippet",children:kt(o.snippet,o.matches)}),e("div",{className:"SearchPanel__result__meta",children:[e("span",{className:"SearchPanel__result__type",children:o.fieldType}),o.richTextBlock&&e("span",{className:"SearchPanel__result__badge",children:"in block"}),o.richTextInline&&e("span",{className:"SearchPanel__result__badge",children:"inline"})]})]})})}function kt(t,o){if(!o||o.length===0)return t;let n=[],a=0;for(let i of o)i.start>a&&n.push({text:t.slice(a,i.start),match:!1}),n.push({text:t.slice(i.start,i.end),match:!0}),a=i.end;return a<t.length&&n.push({text:t.slice(a),match:!1}),n.map((i,c)=>i.match?e("mark",{children:i.text},c):e("span",{children:i.text},c))}function Dt(t){if(window.postMessage({scrollToDeeplink:{deepKey:t.deepKey}},"*"),t.richTextBlock){let o=t.richTextBlock;setTimeout(()=>{window.dispatchEvent(new CustomEvent(Qe,{detail:o}))},350)}else if(t.richTextInline){let o=t.richTextInline;setTimeout(()=>{window.dispatchEvent(new CustomEvent(Ze,{detail:o}))},350)}}ft();ae();var Ct=be(null);function Q(t){let{className:o,localStorageId:n,children:a}=t,[i,c]=T(`root::SplitPanel:${n}`,350),[d,u]=I(!1),[l,h]=I(0),_=z(()=>new Set,[]),f=w(null),C=w(null),g={onResize:P=>(_.add(P),()=>{_.delete(P)})};if(b(()=>{let P=()=>u(!1);window.addEventListener("mouseup",P);let p=f.current;return p&&h(p.getBoundingClientRect().left),()=>window.removeEventListener("mouseup",P)},[]),b(()=>{let P=p=>{let k=p.clientX-l;c(k),_.forEach(y=>y())};return d&&window.addEventListener("mousemove",P),()=>window.removeEventListener("mousemove",P)},[d]),a?.length!==2)throw new Error("SplitPanel should have two <SplitPanel.Item> children.");let v={"--panel-size":`${i}px`};return e(Ct.Provider,{value:g,children:e("div",{className:E(o,"SplitPanel",d&&"dragging"),ref:f,style:v,children:[a[0],e("div",{className:"SplitPanel__divider",ref:C,onMouseDown:()=>u(!0)}),a[1]]})})}Q.Item=t=>e("div",{className:E("SplitPanel__item",t.className,t.fluid?"fluid":"static"),children:t.children});function ve(t,o,n=""){let a=ce({collectionId:t,slug:o}),i=new URLSearchParams(window.location.search);i.set("preview","true"),i.delete("locale"),i.delete("modal");let c=`${i.toString()}${window.location.hash}`;return n?`${ce({collectionId:t,slug:o,locale:n})}?${c}`:`${a}?${c}`}function St(t,o){let n=new URL(o,window.location.origin);try{let a=t.contentWindow?.location.href;if(a&&!a.startsWith("about:blank")){let i=new URL(a);i.origin===n.origin&&i.pathname===n.pathname&&(i.searchParams.forEach((c,d)=>{n.searchParams.set(d,c)}),n.hash=i.hash)}}catch{}return n.searchParams.set("preview","true"),n.toString()}function dt(t){let o=t.collection,n=t.slug,a=`${o}/${n}`,{roles:i}=$e(),c=window.firebase.user.email||"",d=He(i,c);return e(Ye,{docId:a,readOnly:!d,children:e(yt,{...t,canEdit:d})})}function yt(t){let o=t.canEdit,n=t.collection,a=t.slug,i=`${n}/${a}`;at(i);let c=window.__ROOT_CTX.collections[n],d=G(),u=!!c?.url,[l,h]=T(`root::DocumentPage::previewVisible::${n}`,u),_=z(()=>(window.__ROOT_CTX.checks||[]).some(x=>!x.collections||x.collections.includes(n)),[n]),[f,C]=T("root::DocumentPage::checksVisible",!1),g=w(f);g.current=f;let[v,P]=T("root::DocumentPage::searchVisible",!1),p=w(v);p.current=v;let k=Ke(),[y,L]=T("root::DocumentPage::aiVisible",!1),X=w(y);X.current=y,b(()=>{window.dispatchEvent(new CustomEvent("root:checks-visible",{detail:f}))},[f]),b(()=>{window.dispatchEvent(new CustomEvent("root:search-visible",{detail:v}))},[v]),b(()=>{window.dispatchEvent(new CustomEvent("root:ai-visible",{detail:y}))},[y]);let[A,le]=T("root::DocumentPage::searchPanelWidth",360),[O,q]=I(A),[F,K]=I(!1),Z=w(null);if(b(()=>{let S=()=>{let x=!g.current;C(()=>x),x&&(P(()=>!1),L(()=>!1))};return window.addEventListener("root:toggle-checks",S),()=>window.removeEventListener("root:toggle-checks",S)},[]),b(()=>{let S=()=>{let x=!p.current;P(()=>x),x&&(C(()=>!1),L(()=>!1),requestAnimationFrame(()=>{window.dispatchEvent(new CustomEvent("root:focus-search"))}))};return window.addEventListener("root:toggle-search",S),()=>window.removeEventListener("root:toggle-search",S)},[]),b(()=>{let S=()=>{let x=!X.current;L(()=>x),x&&(C(()=>!1),P(()=>!1))};return window.addEventListener("root:toggle-ai",S),()=>window.removeEventListener("root:toggle-ai",S)},[]),b(()=>{if(!F)return;let S=H=>{let oe=Z.current;if(!oe)return;let pe=oe.getBoundingClientRect(),J=Math.max(240,Math.min(pe.right-H.clientX,800));q(J)},x=()=>{K(!1),q(H=>(le(()=>H),H))};return window.addEventListener("mousemove",S),window.addEventListener("mouseup",x),()=>{window.removeEventListener("mousemove",S),window.removeEventListener("mouseup",x)}},[F]),!c)return e("div",{children:"Could not find collection."});let ee=D(()=>{if(!u)return;let S=ve(n,a),x=window.open(S,"_blank","noopener,noreferrer");x&&x.focus()},[u,n,a]),U=D(()=>{o&&d.controller&&d.controller.flush()},[o,d.controller]),$=qe(),de=D(()=>{let S=d.controller?.getData()?.fields||{};$.open({data:S,onSave:x=>{d.controller&&x&&typeof x=="object"&&(d.controller.updateKey("fields",x),d.controller.flush()),$.close()}})},[d.controller]),ue=D(()=>{window.dispatchEvent(new CustomEvent("root:toggle-search"))},[]),te=D(()=>{k&&window.dispatchEvent(new CustomEvent("root:toggle-ai"))},[k]),me=D(()=>{L(()=>!1)},[L]);return ke([["mod+S",U],["mod+shift+F",ue],["mod+I",te]]),e(ot,{children:e("div",{className:E("DocumentPage__layout",F&&"DocumentPage__layout--dragging"),ref:Z,children:[e(Q,{className:"DocumentPage",localStorageId:"DocumentPage",children:[e(Q.Item,{className:E("DocumentPage__side",(!u||!l)&&"DocumentPage__side--expanded"),children:[e("div",{className:"DocumentPage__side__header",children:[e("div",{className:"DocumentPage__side__header__nav",children:[e("a",{href:`/cms/content/${n}`,children:e(N,{className:"DocumentPage__side__header__back",children:e(ye,{size:16})})}),e("div",{className:"DocumentPage__side__header__docId",children:i})]}),e("div",{className:"DocumentPage__side__header__buttons",children:[e(fe,{label:"You don't have access to edit this document",condition:!o,children:e(Y,{className:"DocumentPage__side__header__saveButton",variant:"filled",color:"dark",size:"xs",compact:!0,leftIcon:e(Le,{size:16}),onClick:()=>U(),disabled:!o,children:"Save"})}),e(fe,{label:"You don't have access to edit this document",condition:!o,children:e(R,{label:"Edit JSON",disabled:!o,children:e(N,{className:"DocumentPage__side__header__editJson",onClick:()=>de(),disabled:!o,children:e(Ee,{size:14})})})}),u&&e(W,{children:[e(R,{label:l?"Hide preview":"Show preview",children:e(N,{className:"DocumentPage__side__header__previewToggle",onClick:()=>h(!l),children:l?e(Be,{size:16}):e(Ae,{size:16})})}),!l&&e(R,{label:"Open preview in new tab",children:e(N,{className:"DocumentPage__side__header__openNewTab",onClick:ee,children:e(ie,{size:16})})})]})]})]}),e("div",{className:E("DocumentPage__side__editor",(!u||!l)&&!f&&!v&&!y&&"DocumentPage__side__editor--centered"),children:e(tt,{docId:i})})]}),e(Q.Item,{className:E("DocumentPage__main",(!u||!l)&&"DocumentPage__main--hidden"),fluid:!0,children:u&&l&&e(dt.Preview,{docId:i},i)})]}),_&&f&&e(Et,{docId:i}),v&&e(W,{children:[e("div",{className:"DocumentPage__searchDivider",onMouseDown:()=>K(!0)}),e("div",{className:"DocumentPage__search",style:{flexBasis:`${O}px`},children:e(lt,{docId:i,autoFocus:!0,onClose:()=>P(()=>!1)})})]}),k&&y&&e(It,{docId:i,onClose:me})]})})}function It(t){let[o,n]=T("root::DocumentPage::aiPanelWidth",420),[a,i]=I(o),c=w(null),d=w(a),u=w(),l=z(()=>e(nt,{variant:"panel",docContext:{docId:t.docId},onClose:t.onClose}),[t.docId,t.onClose]),h=D(()=>{let _=c.current?.parentElement;if(!_)return;d.current=a,_.classList.add("DocumentPage__layout--dragging");let f=v=>{let P=c.current?.parentElement;if(!P)return;let p=P.getBoundingClientRect(),k=Math.max(280,Math.min(p.right-v.clientX,800));d.current=k,i(k)},C=()=>{_.classList.remove("DocumentPage__layout--dragging"),window.removeEventListener("mousemove",f),window.removeEventListener("mouseup",g),u.current=void 0},g=()=>{C(),n(()=>d.current)};u.current=C,window.addEventListener("mousemove",f),window.addEventListener("mouseup",g)},[a,n]);return b(()=>()=>u.current?.(),[]),e(W,{children:[e("div",{className:"DocumentPage__aiDivider",ref:c,onMouseDown:h}),e("div",{className:"DocumentPage__ai",style:{flexBasis:`${a}px`},children:l})]})}function Et(t){let[o,n]=T("root::DocumentPage::checksPanelWidth",360),[a,i]=I(o),c=w(null),d=w(a),u=w(),l=z(()=>e(ct,{docId:t.docId}),[t.docId]),h=D(()=>{let _=c.current?.parentElement;if(!_)return;d.current=a,_.classList.add("DocumentPage__layout--dragging");let f=v=>{let P=c.current?.parentElement;if(!P)return;let p=P.getBoundingClientRect(),k=Math.max(200,Math.min(p.right-v.clientX,800));d.current=k,i(k)},C=()=>{_.classList.remove("DocumentPage__layout--dragging"),window.removeEventListener("mousemove",f),window.removeEventListener("mouseup",g),u.current=void 0},g=()=>{C(),n(()=>d.current)};u.current=C,window.addEventListener("mousemove",f),window.addEventListener("mouseup",g)},[a,n]);return b(()=>()=>u.current?.(),[]),e(W,{children:[e("div",{className:"DocumentPage__checksDivider",ref:c,onMouseDown:h}),e("div",{className:"DocumentPage__checks",style:{flexBasis:`${a}px`},children:l})]})}var se={mobile:[430,932],tablet:[768,1024],desktop:[1440,800]},Pe=["mobile","tablet","desktop"],Nt="root::DocumentPage::preview::devices",Tt="root::DocumentPage::preview::device";function Rt(){try{let t=window.localStorage.getItem(Tt);if(t){let o=JSON.parse(t);if(Pe.includes(o))return[o]}}catch(t){console.error(t)}return[]}function Lt(t){let o=new Intl.DisplayNames(["en"],{type:"language"}),a=t.split("_")[0];return`${o.of(a)||t} (${t})`}dt.Preview=t=>{let o=G();if(o.loading)return null;let[n,a]=t.docId.split("/"),c=window.__ROOT_CTX.collections[n];if(!c)throw new Error(`collection not found: ${n}`);if(!c.url)return null;let d=c.domain||window.__ROOT_CTX.rootConfig.domain||"https://example.com",u=je({collectionId:n,slug:a}),l=ce({collectionId:n,slug:a}),h=`${d}${u}`,[_,f]=I(h),C=z(Rt,[]),[g,v]=T(Nt,C),[P,p]=T("root::DocumentPage::preview::multiSelect",!1),[k,y]=T("root::DocumentPage::preview::expandVertically",!1),[L,X]=I({scale:1,frameHeight:0}),[A,le]=it("locale",""),O=w(new Map),q=w(new Map),F=w(null),K=w([]),Z=D(r=>{let s=q.current.get(r);return s||(s=m=>{m?O.current.set(r,m):O.current.delete(r)},q.current.set(r,s)),s},[]),ee=o.controller.getLocales()||[],U=ve(n,a,A),$=w(U);$.current=U;let de=z(()=>[{value:"",label:"Select locale"},...ee.map(r=>({value:r,label:Lt(r)}))],[ee]);function ue(r){if(document.hidden)return;let s=St(r,$.current);r.src="about:blank",window.requestAnimationFrame(()=>{r.src!==s?r.src=s:r.contentWindow.location.reload()})}function te(){O.current.forEach(r=>ue(r))}b(()=>{let r=o.controller?.onFlush(()=>{te()});return()=>{r?.()}},[]),b(()=>{O.current.forEach(r=>{r.src=U})},[A]);let me=g.length>0?g.length:1;b(()=>{let r=Array.from(O.current.values());function s(m){let V=m.currentTarget.contentWindow;if(V&&l===u&&!V.location.href.startsWith("about:blank")){let j=V.location;f(`${d}${j.pathname}`)}}return r.forEach(m=>{m.getAttribute("src")||(m.src=$.current),m.addEventListener("load",s)}),()=>{r.forEach(m=>m.removeEventListener("load",s))}},[me]);let S=D(r=>{if(P){v(s=>{if(s.includes(r)){let m=s.filter(M=>M!==r);return m.length===0&&y(!1),m}return Pe.filter(m=>m===r||s.includes(m))});return}v(s=>s.length===1&&s[0]===r?(y(!1),[]):[r])},[P,v,y]),x=D(()=>{p(r=>{let s=!r;return v(s?m=>{if(K.current=m,m.length>=2)return m;let M=m[0]||"desktop",V=M==="desktop"?"mobile":"desktop";return Pe.filter(j=>j===M||j===V)}:()=>K.current),s})},[p,v]),H=D(()=>{g.length!==0&&y(r=>!r)},[g,y]),oe=D(()=>{o.controller&&o.controller.flush().then(()=>te())},[o.controller]),pe=D(()=>{let r=ve(n,a,A),s=window.open(r,"_blank","noopener,noreferrer");s&&s.focus()},[n,a,A]),J=D(()=>{if(g.length===0){X(B=>B.scale===1&&B.frameHeight===0?B:{scale:1,frameHeight:0});return}let r=F.current;if(!r)return;let s=r.getBoundingClientRect(),m=20,M=16,V=28,j=g.length,we=Math.max(s.width-2*m-M*(j-1),0),he=Math.max(s.height-2*m-V,0),_e=0,ne=0;for(let B of g){let[_t,gt]=se[B];_e+=_t,ne=Math.max(ne,gt)}let mt=we>0&&_e>0?we/_e:1,pt=he>0&&ne>0?he/ne:1,ht=Math.min(mt,pt,1),ge=Number(ht.toFixed(4))||1,xe=Math.max(he/ge,0);X(B=>B.scale===ge&&B.frameHeight===xe?B:{scale:ge,frameHeight:xe})},[g]);b(()=>{J();let r=F.current;if(!r)return;let s=0,m=()=>{window.cancelAnimationFrame(s),s=window.requestAnimationFrame(J)},M=new window.ResizeObserver(m);return M.observe(r),window.addEventListener("resize",m),()=>{window.cancelAnimationFrame(s),M.disconnect(),window.removeEventListener("resize",m)}},[J]);let ut=g.length>0?g.map((r,s)=>({slot:s,device:r})):[{slot:0,device:null}];return e("div",{className:"DocumentPage__main__preview",children:[e(st,{devices:g,multiSelect:P,expandVertically:k,iframeUrl:_,localeOptions:de,selectedLocale:A,onToggleDevice:S,onToggleMultiSelect:x,onToggleExpandVertically:H,onReloadClick:oe,onOpenNewTab:pe,onLocaleChange:le}),e("div",{className:"DocumentPage__main__previewFrame","data-device":g.length>0?"device":"full",ref:F,children:e("div",{className:"DocumentPage__main__previewFrame__group",children:ut.map(r=>{let s=r.device,m=s?{"--iframe-width":`${se[s][0]}px`,"--iframe-height":`${k?L.frameHeight:se[s][1]}px`,"--iframe-scale":String(L.scale)}:void 0;return e("div",{className:"DocumentPage__main__previewFrame__item",style:m,children:[e("div",{className:"DocumentPage__main__previewFrame__iframeWrap",children:e("iframe",{ref:Z(r.slot),title:"iframe preview"})}),s&&e("div",{className:"DocumentPage__main__previewFrame__deviceLabel",children:`${s}: ${se[s].join("x")}`})]},r.slot)})})})]})};export{dt as DocumentPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{k as E,l as P,m as h,s as S}from"./chunk-7UHZS56B.js";import"./chunk-UCYWQEAS.js";import"./chunk-DWV5J2W7.js";import"./chunk-T5BJNOWE.js";import"./chunk-34W6H4YG.js";import"./chunk-SYDHFYRC.js";import"./chunk-535JU7FU.js";import{b as s}from"./chunk-FBSBL476.js";import"./chunk-GCSN3YEC.js";import"./chunk-QWB6MAPJ.js";import"./chunk-VPZHG7JL.js";import"./chunk-AAR7DBEN.js";import"./chunk-JBLSUM6W.js";import"./chunk-2RRM4HEQ.js";import"./chunk-HXSB6YB2.js";import"./chunk-N5RJIILP.js";import"./chunk-UPN3EMUS.js";import"./chunk-HV3JJ5UT.js";import"./chunk-TNW2GNUR.js";import"./chunk-FVWSVOOY.js";import"./chunk-QFDU6FXP.js";import"./chunk-JDW4UORS.js";import"./chunk-UJX25CXD.js";import"./chunk-RN4XVVWD.js";import"./chunk-QRAFYIAW.js";import"./chunk-ATTW36EM.js";import"./chunk-YDO2EDVY.js";import"./chunk-5MV6XVGA.js";import"./chunk-PLYSJ7W5.js";import"./chunk-H37RXS4R.js";import{b as p}from"./chunk-W5DOO6ID.js";import{a as D}from"./chunk-YBHFGQ3Z.js";import"./chunk-2PTLQRTU.js";import"./chunk-PIJ3E47R.js";import"./chunk-NCZD5IWS.js";import{a as x}from"./chunk-QLIIVG5Q.js";import"./chunk-AAHM6RYJ.js";import"./chunk-ISUGBMXC.js";import"./chunk-DZYYWCHX.js";import"./chunk-XOWWPE7X.js";import{e as _}from"./chunk-WASID5UU.js";import{Ga as t,a as v,c as m,da as f,e as u,j as B,ub as b}from"./chunk-WRA24P66.js";import"./chunk-KUCVLANF.js";import"./chunk-7SK47HHZ.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";B();function H(e){let o=`${e.collection}/${e.slug}`,{roles:d}=D(),a=window.firebase.user.email||"",n=p(d,a);return t(E,{docId:o,readOnly:!n,autoSave:!1,flushOnStop:!1,children:t(w,{...e,canEdit:n})})}function I(e){return e&&typeof e.toMillis=="function"?e.toMillis():0}function w(e){let o=`${e.collection}/${e.slug}`;x(o);let d=P(),a=d.controller,n=d.loading,[r,y]=v("NO_CHANGES");h(y);let g=u(!1);m(()=>{n||g.current||(g.current=!0,s({type:"ready",docId:o}))},[n,o]);let c=u(0);return m(()=>{let N=[a.onFlush(()=>{s({type:"saved",docId:o,saveState:"SAVED"})}),a.onChange(l=>{let i=I(l?.sys?.publishedAt);if(c.current===0){c.current=i;return}i>c.current&&(c.current=i,s({type:"published",docId:o,publishedAt:i}))})];return()=>N.forEach(l=>l())},[a,o]),t("div",{className:"EmbeddedDocumentPage",children:[e.canEdit&&!n&&t("div",{className:"EmbeddedDocumentPage__saveBar",children:[t(f,{component:"a",className:"EmbeddedDocumentPage__saveBar__docId",href:`/cms/content/${e.collection}/${e.slug}`,target:"_blank",rel:"noreferrer noopener",title:"Open in new tab",compact:!0,size:"xs",variant:"default",children:o}),t("div",{className:"EmbeddedDocumentPage__saveBar__controls",children:[t("div",{className:"EmbeddedDocumentPage__saveBar__saveState",children:[r==="UPDATE_PENDING"&&"unsaved changes",r==="SAVED"&&"saved!",r==="ERROR"&&"error saving"]}),t(f,{color:"dark",compact:!0,size:"xs",leftIcon:t(b,{size:16}),loading:r==="SAVING",disabled:r!=="UPDATE_PENDING"&&r!=="ERROR",onClick:()=>a.flush(),children:"Save"})]})]}),t("div",{className:_("EmbeddedDocumentPage__editor","DocumentPage__side"),children:t(S,{docId:o,hideStatusBar:!0})})]})}export{H as EmbeddedDocumentPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as t}from"./chunk-QLIIVG5Q.js";import{c as a}from"./chunk-OWBT6YUM.js";import"./chunk-AAHM6RYJ.js";import"./chunk-WASID5UU.js";import{Ga as e,c as d,j as l}from"./chunk-WRA24P66.js";import"./chunk-KUCVLANF.js";import"./chunk-PVAE643M.js";l();function u(o){let r=(window.__ROOT_CTX.sidebar?.tools||{})[o.id];t(r?.label||o.id);let i=r?.cmsUrl,s=r?.externalUrl;return d(()=>{i?.startsWith("/cms/")&&window.location.replace(i)},[i]),d(()=>{s&&window.open(s,"_blank","noopener,noreferrer")?.focus()},[s]),r?s?e(a,{children:e("div",{className:"SidebarToolsPage SidebarToolsPage--message",children:e("a",{href:s,target:"_blank",rel:"noreferrer noopener",children:["Open ",r.label||o.id," in a new tab"]})})}):i?.startsWith("/cms/")?e(a,{children:e("div",{className:"SidebarToolsPage",children:"redirecting..."})}):i?e(a,{children:e("div",{className:"SidebarToolsPage SidebarToolsPage--error",children:["invalid cmsUrl (must start with /cms/): ",o.id]})}):r.iframeUrl?e(a,{children:e("div",{className:"SidebarToolsPage",children:e("iframe",{src:r.iframeUrl})})}):e(a,{children:e("div",{className:"SidebarToolsPage SidebarToolsPage--error",children:["missing iframeUrl: ",o.id]})}):e(a,{children:e("div",{className:"SidebarToolsPage SidebarToolsPage--error",children:["not found: ",o.id]})})}export{u as SidebarToolsPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as C,f as oe,g as re,h as le,i as ce,j as me,k as de,l as _e,m as ge,n as pe,o as ue,p as ke,q as fe,r as Te,s as he}from"./chunk-XACLTYBB.js";import{r as ie}from"./chunk-7UHZS56B.js";import"./chunk-UCYWQEAS.js";import"./chunk-DWV5J2W7.js";import"./chunk-T5BJNOWE.js";import"./chunk-34W6H4YG.js";import"./chunk-SYDHFYRC.js";import"./chunk-535JU7FU.js";import"./chunk-FBSBL476.js";import"./chunk-GCSN3YEC.js";import"./chunk-QWB6MAPJ.js";import{b as R,c as ae}from"./chunk-VPZHG7JL.js";import"./chunk-AAR7DBEN.js";import"./chunk-JBLSUM6W.js";import"./chunk-2RRM4HEQ.js";import{a as W}from"./chunk-HXSB6YB2.js";import{a as I}from"./chunk-OWYV43BT.js";import"./chunk-N5RJIILP.js";import"./chunk-UPN3EMUS.js";import"./chunk-HV3JJ5UT.js";import"./chunk-TNW2GNUR.js";import"./chunk-FVWSVOOY.js";import"./chunk-QFDU6FXP.js";import"./chunk-JDW4UORS.js";import"./chunk-UJX25CXD.js";import"./chunk-RN4XVVWD.js";import"./chunk-QRAFYIAW.js";import"./chunk-ATTW36EM.js";import"./chunk-YDO2EDVY.js";import"./chunk-5MV6XVGA.js";import"./chunk-PLYSJ7W5.js";import"./chunk-H37RXS4R.js";import"./chunk-W5DOO6ID.js";import"./chunk-YBHFGQ3Z.js";import{a as k}from"./chunk-2PTLQRTU.js";import{a as f}from"./chunk-PIJ3E47R.js";import"./chunk-NCZD5IWS.js";import{a as se}from"./chunk-QLIIVG5Q.js";import{c as ne}from"./chunk-OWBT6YUM.js";import"./chunk-AAHM6RYJ.js";import"./chunk-ISUGBMXC.js";import"./chunk-DZYYWCHX.js";import{a as Y}from"./chunk-XOWWPE7X.js";import{e as x}from"./chunk-WASID5UU.js";import{$a as b,Ab as J,Fa as P,Ga as e,Gb as Q,V,Vc as M,W as h,Ya as Z,_c as te,a as d,ad as A,c as y,ca as U,da as T,e as O,g as D,j as Ie,lc as ee,na as G,pc as F,qb as B,qc as w,ua as S,za as L}from"./chunk-WRA24P66.js";import"./chunk-KUCVLANF.js";import{h as X}from"./chunk-7SK47HHZ.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";Ie();function H(a){return e(ie,{className:x("TaskCommentEditor",a.className),placeholder:a.placeholder,value:a.value,onChange:a.onChange,autoFocus:a.autoFocus,autosize:!0,variant:"comment"})}var we=[{value:"new",label:"New"},{value:"in-progress",label:"In progress"},{value:"in-review",label:"In review"},{value:"closed",label:"Closed"}],Ce=[{value:"high",label:"High"},{value:"medium",label:"Medium"},{value:"normal",label:"Normal"}];function yt(a){let t=a.id,[i,o]=d(null),[_,g]=d([]),[r,l]=d([]),[n,m]=d(!0),[c,s]=d("");return se(i?`Task: ${i.title}`:`Task: ${t}`),y(()=>{m(!0),s("");let u=[oe(t,p=>{o(p),m(!1)},p=>{s(k(p)),m(!1)}),re(t,p=>g(p),p=>s(k(p))),le(t,p=>l(p),p=>s(k(p)))];return()=>u.forEach(p=>p())},[t]),e(ne,{children:e("div",{className:"TaskPage",children:[e("div",{className:"TaskPage__header",children:[e(U,{className:"TaskPage__header__breadcrumbs",children:[e("a",{href:"/cms/tasks",children:"Tasks"}),e("div",{children:t})]}),e("div",{className:"TaskPage__header__titleWrap",children:[e(Ne,{task:i,taskId:t}),i&&e("span",{className:x("TaskPage__statusBadge",`TaskPage__statusBadge--${je(i.status)}`),children:$e(i.status)})]})]}),n&&e("div",{className:"TaskPage__loading",children:e(V,{color:"gray",size:"xl"})}),!n&&c&&e("div",{className:"TaskPage__error",children:c}),!n&&!c&&!i&&e(I,{className:"TaskPage__notFound",children:"Task not found."}),!n&&!c&&i&&e("div",{className:"TaskPage__body",children:[e("main",{className:"TaskPage__main",children:[e(ze,{task:i}),e(Ae,{task:i}),e(De,{task:i,comments:_,events:r}),e(ye,{taskId:i.id})]}),e("aside",{className:"TaskPage__side",children:e(Ee,{task:i})})]})]})})}function Ne(a){let{task:t}=a,[i,o]=d(!1),[_,g]=d(t?.title||""),[r,l]=d(!1);y(()=>{i||g(t?.title||"")},[t?.title,i]);async function n(){if(!t)return;let m=_.trim();if(!m){f({title:"Could not update title",message:"Task title is required.",color:"red"});return}if(m===t.title){g(t.title),o(!1);return}l(!0);try{await me(t.id,m),o(!1)}catch(c){f({title:"Could not update title",message:k(c),color:"red",autoClose:!1})}finally{l(!1)}}return t?i?e("form",{className:"TaskPage__header__titleForm",onSubmit:m=>{m.preventDefault(),n()},children:[e(S,{autoFocus:!0,className:"TaskPage__header__titleInput",disabled:r,value:_,onChange:m=>g(m.currentTarget.value),onKeyDown:m=>{m.key==="Escape"&&(g(t.title),o(!1))}}),e(T,{compact:!0,size:"xs",color:"dark",type:"submit",loading:r,leftIcon:e(b,{size:14,strokeWidth:"1.8"}),children:"Save"}),e(T,{compact:!0,size:"xs",variant:"default",type:"button",leftIcon:e(A,{size:14,strokeWidth:"1.8"}),onClick:()=>{g(t.title),o(!1)},children:"Cancel"})]}):e("div",{className:"TaskPage__header__titleContent",children:[e(W,{size:"h1",children:t.title}),e(P,{label:"Edit title",children:e(h,{size:"sm",onClick:()=>o(!0),children:e(w,{size:16,strokeWidth:"1.8"})})})]}):e(W,{size:"h1",children:`Task #${a.taskId}`})}function ze(a){let{task:t}=a,[i,o]=d(!1),[_,g]=d(t.description||""),[r,l]=d(!1);y(()=>{i||g(t.description||"")},[t.description,i]);async function n(){l(!0);try{await pe(t.id,_.trim()),o(!1)}catch(m){f({title:"Could not update description",message:k(m),color:"red",autoClose:!1})}finally{l(!1)}}return e(I,{className:"TaskPage__description",children:[e("div",{className:"TaskPage__description__top",children:[e("div",{className:"TaskPage__description__label",children:"Description"}),!i&&e(h,{size:"sm",onClick:()=>o(!0),children:e(w,{size:16,strokeWidth:"1.8"})})]}),i?e("div",{className:"TaskPage__description__edit",children:[e(G,{autosize:!0,autoFocus:!0,minRows:4,value:_,placeholder:"Add task details, scope, and acceptance criteria.",onChange:m=>g(m.currentTarget.value)}),e("div",{className:"TaskPage__description__editActions",children:[e(T,{compact:!0,size:"xs",variant:"default",leftIcon:e(A,{size:14,strokeWidth:"1.8"}),onClick:()=>{o(!1),g(t.description||"")},children:"Cancel"}),e(T,{compact:!0,size:"xs",color:"dark",loading:r,leftIcon:e(b,{size:14,strokeWidth:"1.8"}),onClick:n,children:"Save"})]})]}):e("div",{className:x("TaskPage__description__content",!t.description&&"TaskPage__description__content--empty"),children:t.description||"No description provided."})]})}function Ae(a){let{task:t}=a,i=O(null),[o,_]=d(!1),[g,r]=d(""),l=t.attachments||[];async function n(c){let s=Array.from(c);if(s.length!==0){_(!0);try{for(let u of s){let p=await X(u);await ue(t.id,{...p,filename:p.filename||u.name,contentType:u.type||void 0,size:u.size})}f({message:s.length===1?"File attached.":`${s.length} files attached.`,color:"green"})}catch(u){f({title:"Could not attach file",message:k(u),color:"red",autoClose:!1})}finally{_(!1),i.current&&(i.current.value="")}}}async function m(c){let s=xe(c);if(window.confirm(`Remove ${s} from this task?`)){r(c.id);try{await ke(t.id,c.id)}catch(u){f({title:"Could not remove attachment",message:k(u),color:"red",autoClose:!1})}finally{r("")}}}return e("section",{className:"TaskPage__attachments",children:[e("div",{className:"TaskPage__attachments__top",children:[e("div",{className:"TaskPage__attachments__label",children:"Attachments"}),e(T,{compact:!0,size:"xs",variant:"subtle",type:"button",loading:o,leftIcon:e(F,{size:14,strokeWidth:"1.8"}),onClick:()=>i.current?.click(),children:"Attach files"}),e("input",{ref:i,className:"TaskPage__attachments__input",type:"file",multiple:!0,onChange:c=>{n(c.currentTarget.files||[])}})]}),l.length>0?e("div",{className:"TaskPage__attachments__list",children:l.map(c=>e("div",{className:"TaskPage__attachments__item",children:[e("div",{className:"TaskPage__attachments__itemIcon",children:e(F,{size:16,strokeWidth:"1.8"})}),e("div",{className:"TaskPage__attachments__itemContent",children:[e("a",{href:c.src,target:"_blank",rel:"noreferrer",className:"TaskPage__attachments__itemTitle",children:xe(c)}),e("div",{className:"TaskPage__attachments__itemMeta",children:Re(c)})]}),e("div",{className:"TaskPage__attachments__itemActions",children:[e(P,{label:"Open file",children:e(h,{component:"a",href:c.src,target:"_blank",rel:"noreferrer",size:"sm",children:e(J,{size:16,strokeWidth:"1.8"})})}),e(P,{label:"Remove attachment",children:e(h,{size:"sm",disabled:g===c.id,onClick:()=>m(c),children:e(M,{size:16,strokeWidth:"1.8"})})})]})]},c.id))}):e("div",{className:"TaskPage__attachments__empty",children:"No files attached."})]})}function Ee(a){let{task:t}=a,[i,o]=d(t.assignee||""),[_,g]=d(j(t.targetLaunchDate)),[r,l]=d("");y(()=>{o(t.assignee||""),g(j(t.targetLaunchDate))},[t.assignee,t.targetLaunchDate]);async function n(s,u){l(s);try{await u()}catch(p){f({title:"Could not update task",message:k(p),color:"red",autoClose:!1})}finally{l("")}}function m(){let s=i.trim();(t.assignee||"")!==s&&n("assignee",()=>ce(t.id,s||null))}function c(s){g(s),j(t.targetLaunchDate)!==s&&n("targetLaunchDate",()=>ge(t.id,Ke(s)))}return e(I,{className:"TaskPage__metadata",children:[e("div",{className:"TaskPage__metadata__field",children:[e("label",{children:"Status"}),e(L,{size:"xs",data:we,value:C(t.status),onChange:s=>{s&&s!==C(t.status)&&n("status",()=>de(t.id,s))}})]}),e("div",{className:"TaskPage__metadata__field",children:[e("label",{children:"Assignee"}),e("div",{className:"TaskPage__metadata__assignee",children:e(S,{size:"xs",type:"email",placeholder:"teammate@example.com",value:i,disabled:r==="assignee",onChange:s=>o(s.currentTarget.value),onBlur:()=>m(),onKeyDown:s=>{s.key==="Enter"&&s.currentTarget.blur()}})})]}),e("div",{className:"TaskPage__metadata__field",children:[e("label",{children:"Priority"}),e(L,{size:"xs",data:Ce,value:t.priority||"normal",onChange:s=>{s&&s!==(t.priority||"normal")&&n("priority",()=>_e(t.id,s))}})]}),e("div",{className:"TaskPage__metadata__field",children:[e("label",{children:"Target launch date"}),e("div",{className:"TaskPage__metadata__date",children:e("input",{type:"date",value:_,disabled:r==="targetLaunchDate",onInput:s=>c(s.currentTarget.value)})})]})]})}function De(a){let{task:t,comments:i,events:o}=a,_=D(()=>{let r=new Map;return i.filter(l=>l.parentId).forEach(l=>{let n=l.parentId||"";r.set(n,[...r.get(n)||[],l])}),r.forEach(l=>l.sort((n,m)=>E(n.createdAt)-E(m.createdAt))),r},[i]),g=D(()=>{let r=i.filter(n=>!n.parentId);return[{id:"opened",kind:"opened",createdAt:t.createdAt},...o.map(n=>({id:n.id,kind:"event",event:n,createdAt:n.createdAt})),...r.map(n=>({id:n.id,kind:"comment",comment:n,createdAt:n.createdAt}))].sort((n,m)=>E(n.createdAt)-E(m.createdAt))},[t,i,o]);return e("div",{className:"TaskPage__timeline",children:g.map(r=>r.kind==="opened"?e(Se,{task:t},r.id):r.kind==="event"?e(Le,{event:r.event},r.id):e(ve,{comment:r.comment,replies:_.get(r.comment.id)||[],threadParentId:r.comment.id},r.id))})}function Se(a){let{task:t}=a;return e("div",{className:"TaskPage__timelineItem TaskPage__timelineItem--event",children:[e("div",{className:"TaskPage__timelineItem__marker",children:e(b,{size:15,strokeWidth:"2"})}),e("div",{className:"TaskPage__timelineItem__content",children:[e("b",{children:z(t.createdBy||"unknown")})," opened this task"," ",N(t.createdAt),"."]})]})}function Le(a){let{event:t}=a;return e("div",{className:"TaskPage__timelineItem TaskPage__timelineItem--event",children:[e("div",{className:"TaskPage__timelineItem__marker",children:t.field==="title"?e(w,{size:15,strokeWidth:"2"}):t.field==="assignee"?e(te,{size:15,strokeWidth:"2"}):t.field==="priority"?e(Q,{size:15,strokeWidth:"2"}):t.field==="targetLaunchDate"?e(Z,{size:15,strokeWidth:"2"}):e(b,{size:15,strokeWidth:"2"})}),e("div",{className:"TaskPage__timelineItem__content",children:[e("b",{children:z(t.createdBy||"unknown")})," changed"," ",qe(t.field)," from"," ",e("span",{className:"TaskPage__timelineValue",children:Pe(t.field,t.oldValue)})," ","to"," ",e("span",{className:"TaskPage__timelineValue",children:Pe(t.field,t.newValue)})," ",N(t.createdAt),"."]})]})}function ve(a){let{comment:t}=a,i=window.firebase.user.email||"",[o,_]=d(!1),[g,r]=d(!1),[l,n]=d(t.body||q(t.content)),[m,c]=d(!1),s=t.createdBy===i&&!t.isDeleted,u=a.threadParentId||t.parentId||t.id;y(()=>{n(t.body||q(t.content))},[t.body,t.content]);async function p(){if(l){c(!0);try{await Te(t.taskId,t.id,l),r(!1)}catch(v){f({title:"Could not edit comment",message:k(v),color:"red",autoClose:!1})}finally{c(!1)}}}async function be(){if(window.confirm("Delete this comment?"))try{await he(t.taskId,t.id)}catch(v){f({title:"Could not delete comment",message:k(v),color:"red",autoClose:!1})}}return e("div",{className:x("TaskPage__timelineItem","TaskPage__timelineItem--comment",a.isReply&&"TaskPage__timelineItem--reply"),children:[e("div",{className:"TaskPage__timelineItem__marker",children:a.isReply?e(B,{size:15,strokeWidth:"2"}):e(ee,{size:15,strokeWidth:"2"})}),e("div",{className:"TaskPage__timelineItem__content",children:[e(I,{className:"TaskPage__comment",children:[e("div",{className:"TaskPage__comment__header",children:[e("div",{children:[e("b",{children:z(t.createdBy||"unknown")})," ",e("span",{children:N(t.createdAt)}),t.updatedAt&&!t.isDeleted&&e("span",{children:[" edited ",N(t.updatedAt)]})]}),e("div",{className:"TaskPage__comment__actions",children:[!t.isDeleted&&e(P,{label:"Reply",children:e(h,{size:"sm",onClick:()=>_(!o),children:e(B,{size:16,strokeWidth:"1.8"})})}),s&&e(P,{label:"Edit",children:e(h,{size:"sm",onClick:()=>r(!0),children:e(w,{size:16,strokeWidth:"1.8"})})}),s&&e(P,{label:"Delete",children:e(h,{size:"sm",onClick:be,children:e(M,{size:16,strokeWidth:"1.8"})})})]})]}),g?e("div",{className:"TaskPage__comment__edit",children:[e(H,{value:l,placeholder:"Edit this comment...",onChange:n}),e("div",{className:"TaskPage__comment__editActions",children:[e(T,{compact:!0,size:"xs",variant:"default",leftIcon:e(A,{size:14,strokeWidth:"1.8"}),onClick:()=>{r(!1),n(t.body||q(t.content))},children:"Cancel"}),e(T,{compact:!0,size:"xs",color:"dark",loading:m,disabled:!l,leftIcon:e(b,{size:14,strokeWidth:"1.8"}),onClick:p,children:"Save"})]})]}):e("div",{className:x("TaskPage__comment__body",t.isDeleted&&"TaskPage__comment__body--deleted"),children:t.isDeleted?"Comment deleted.":t.body?e(Be,{className:"TaskPage__comment__richText",data:t.body}):e(ae,{className:"TaskPage__comment__markdown",code:t.content})})]}),o&&e(ye,{taskId:t.taskId,parentId:u,autoFocus:!0,onSubmitted:()=>_(!1),onCancel:()=>_(!1)}),a.replies&&a.replies.length>0&&e("div",{className:"TaskPage__replies",children:a.replies.map(v=>e(ve,{comment:v,isReply:!0,threadParentId:t.id},v.id))})]})]})}function ye(a){let[t,i]=d(null),[o,_]=d(0),[g,r]=d(!1),l=!!a.parentId;async function n(m){if(m.preventDefault(),!!t){r(!0);try{await fe(a.taskId,t,a.parentId),i(null),_(c=>c+1),a.onSubmitted?.()}catch(c){f({title:l?"Could not add reply":"Could not add comment",message:k(c),color:"red",autoClose:!1})}finally{r(!1)}}}return e(I,{className:x("TaskPage__composer",l&&"TaskPage__composer--reply"),children:e("form",{onSubmit:n,children:[e(H,{autoFocus:a.autoFocus,placeholder:l?"Write a reply...":"Leave a comment...",value:t,onChange:i},o),e("div",{className:"TaskPage__composer__actions",children:[a.onCancel&&e(T,{compact:!0,size:"xs",variant:"default",type:"button",onClick:a.onCancel,children:"Cancel"}),e(T,{compact:!0,size:"xs",color:"dark",type:"submit",loading:g,disabled:!t,children:l?"Reply":"Comment"})]})]})})}function Be(a){return e("div",{className:a.className,children:(a.data.blocks||[]).map((t,i)=>e(Fe,{block:t},i))})}function Fe(a){let{block:t}=a;switch(t.type){case"paragraph":return e($,{tag:"p",html:t.data?.text});case"heading":return e($,{tag:"h4",html:t.data?.text});case"quote":return e($,{tag:"blockquote",html:t.data?.text});case"orderedList":return e("ol",{children:(t.data?.items||[]).map((i,o)=>e(K,{item:i},o))});case"unorderedList":return e("ul",{children:(t.data?.items||[]).map((i,o)=>e(K,{item:i},o))});case"image":{let i=t.data?.file;return i?.url?e("img",{src:i.url,width:Number(i.width)||void 0,height:Number(i.height)||void 0,alt:i.alt||""}):null}default:return null}}function $(a){if(!a.html)return null;let t=a.tag;return e(t,{dangerouslySetInnerHTML:{__html:R(a.html)}})}function K(a){return e("li",{children:[a.item.content&&e("span",{dangerouslySetInnerHTML:{__html:R(a.item.content)}}),a.item.items&&a.item.items.length>0&&e("ul",{children:a.item.items.map((t,i)=>e(K,{item:t},i))})]})}function q(a){return a.trim()?{blocks:a.split(/\n{2,}/).map(t=>({type:"paragraph",data:{text:Me(t).replace(/\n/g,"<br>")}})),time:Date.now(),version:"plain-text"}:null}function Me(a){return a.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function E(a){return a?.toMillis?.()||0}function xe(a){let t=a.src.split("?")[0].split("/").filter(Boolean).at(-1)||"",i=a.filename||t||"Attachment";try{return decodeURIComponent(i)}catch{return i}}function Re(a){let t=[We(a.size),a.contentType||"",a.attachedBy?`attached by ${z(a.attachedBy)}`:"",a.attachedAt?N(a.attachedAt):""].filter(Boolean);return t.length>0?t.join(" - "):"Attached file"}function We(a){if(typeof a!="number")return"";if(a<1024)return`${a} B`;let t=["KB","MB","GB"],i=a/1024,o=0;for(;i>=1024&&o<t.length-1;)i=i/1024,o+=1;return`${i.toFixed(i>=10?0:1)} ${t[o]}`}function z(a){return a.split("@")[0]||a}function He(a){return a?.toMillis?new Date(a.toMillis()).toLocaleDateString("en",{month:"short",day:"numeric",year:"numeric"}):"No date"}function N(a){return a?.toMillis?new Date(a.toMillis()).toLocaleString("en",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}):"just now"}function $e(a){return C(a).replace(/[-_]/g," ")}function qe(a){return a.replace(/([A-Z])/g," $1").toLowerCase()}function Pe(a,t){return t?t instanceof Y?He(t):a==="assignee"?z(t):a==="title"?t:t.replace(/[-_]/g," "):"none"}function je(a){return C(a).replace(/[^a-z0-9]+/gi,"-").toLowerCase()}function j(a){if(!a?.toMillis)return"";let t=new Date(a.toMillis()),i=t.getFullYear(),o=String(t.getMonth()+1).padStart(2,"0"),_=String(t.getDate()).padStart(2,"0");return`${i}-${o}-${_}`}function Ke(a){if(!a)return null;let[t,i,o]=a.split("-").map(Number);return!t||!i||!o?null:new Date(t,i-1,o)}export{yt as TaskPage};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{a as Z}from"./chunk-535JU7FU.js";import{a as j}from"./chunk-JDW4UORS.js";import{a as Q,c as X,e as Y}from"./chunk-RN4XVVWD.js";import{c as K}from"./chunk-ATTW36EM.js";import{b as J}from"./chunk-2PTLQRTU.js";import{a as x}from"./chunk-PIJ3E47R.js";import{d as W}from"./chunk-WASID5UU.js";import{Ga as e,a as s,c as q,da as A,e as B,ea as P,j as re,na as b,pa as $,ua as F,va as V,za as S}from"./chunk-WRA24P66.js";import{d as M}from"./chunk-KUCVLANF.js";re();var se="Enter the URL to make the HTTP request.",ne="Enter the URL of the Google Sheet, e.g. https://docs.google.com/spreadsheets/d/SPREADSHEET_ID/edit#gid=SHEET_ID";function Ne(a){let{route:n}=W(),c=B(null),i=Z(),[h,d]=s(!1),[r,U]=s(i.enabled?"gsheet":"http"),[g,z]=s("map"),[v,ee]=s("GET"),[y,T]=s(!1),[w,N]=s(1),[E,H]=s("hours"),[R,C]=s(!1),[L,p]=s(""),[te,O]=s(!!a.dataSourceId),[_,G]=s(null),I="";r==="http"?I=se:r==="gsheet"&&(I=ne);async function ae(t){await J(async()=>{let o=await X(t);G(o),U(o?.type||"http"),z(o?.dataFormat||"map"),o?.cron?(T(o.cron.enabled||!1),N(o.cron.interval||1),H(o.cron.unit||"hours"),C(o.cron.autoPublish||!1)):(T(!1),N(1),H("hours"),C(!1))}),O(!1)}q(()=>{a.dataSourceId&&(O(!0),ae(a.dataSourceId))},[a.dataSourceId]);async function oe(){p("");let t=c.current;function o(l){let f=t.elements[l];return f?f.value.trim():""}let m=a.dataSourceId||o("id");if(!m){p("missing id");return}if(!j(m)){p("id is invalid (alphanumeric characters and dashes only)");return}let D=o("url");if(!D){p("missing url");return}let u={id:m,description:o("description"),type:r,url:D,previewUrl:o("previewUrl")};if(r==="http"){if(!ie(D)){p("invalid url");return}u.httpOptions={method:v};let l=o("httpHeaders");if(l&&(u.httpOptions.headers=ue(l)),v==="POST"){let f=o("httpBody");f&&(u.httpOptions.body=f)}}else if(r==="gsheet"){if(!K(D)?.spreadsheetId){p("failed to parse spreadsheet url");return}u.dataFormat=g||"map"}y?u.cron={enabled:!0,interval:w,unit:E,autoPublish:R}:u.cron={enabled:!1,interval:w,unit:E};try{G(u),d(!0),a.dataSourceId?(await Y(a.dataSourceId,u),x({title:"Saved data source",message:`Successfully updated ${m}`,autoClose:5e3}),d(!1)):(await Q(m,u),x({title:"Added data source",message:`Successfully added ${m}`,autoClose:5e3}),d(!1),n(`/cms/data/${m}`))}catch(l){console.error(l),x({title:"Failed to save data source",message:String(l),color:"red",autoClose:!1}),d(!1)}}let k=[{value:"http",label:"HTTP"}];return(i.enabled||r==="gsheet")&&k.push({value:"gsheet",label:"Google Sheet"}),e("form",{className:"DataSourceForm",ref:c,onSubmit:t=>{t.preventDefault(),oe()},children:[e($,{visible:te}),e("div",{className:"DataSourceForm__input",children:e(S,{name:"type",label:"Type",data:k,value:r,onChange:t=>U(t),size:"xs",radius:0,dropdownComponent:"div"})}),e(F,{className:"DataSourceForm__input",name:"id",label:"ID",description:"Unique identifier for the data source. Use alphanumeric characters and dashes only, e.g. grogus-favorite-meals",size:"xs",radius:0,value:a.dataSourceId,disabled:!!a.dataSourceId}),e(b,{className:"DataSourceForm__input",name:"description",label:"Description",description:"Optional.",size:"xs",radius:0,value:_?.description}),e(F,{className:"DataSourceForm__input",name:"url",label:"URL",description:I,size:"xs",radius:0,value:_?.url}),r==="http"&&e(M,{children:[e("div",{className:"DataSourceForm__input",children:e(S,{name:"httpMethod",label:"HTTP Request Method",data:[{value:"GET",label:"GET"},{value:"POST",label:"POST"}],value:v,onChange:t=>ee(t),size:"xs",radius:0,dropdownComponent:"div"})}),e(b,{className:"DataSourceForm__input",name:"httpHeaders",label:"HTTP Request Headers",description:"Format as `HeaderName: Value`, each value on its own line.",size:"xs",radius:0,value:ce(_?.httpOptions?.headers||{})}),v==="POST"&&e(b,{className:"DataSourceForm__input",name:"httpRequestBody",label:"HTTP Request Body",size:"xs",radius:0,value:_?.httpOptions?.body})]}),r==="gsheet"&&e("div",{className:"DataSourceForm__input",children:[e(S,{name:"dataFormat",label:"Data Format",data:[{value:"map",label:"map"}],value:g,onChange:t=>z(t),size:"xs",radius:0,dropdownComponent:"div"}),g==="array"&&e("div",{className:"DataSourceForm__input__example",children:["Data is stored as an array of arrays, e.g.",e("code",{children:"[[header1, header2], [foo, bar]]"})]}),g==="map"&&e("div",{className:"DataSourceForm__input__example",children:["Data is stored as an array of maps, e.g.",e("code",{children:["[","{","header1: foo, header2: bar","}","]"]})]})]}),e("div",{className:"DataSourceForm__section",children:[e("div",{className:"DataSourceForm__section__label",children:"Sync Schedule"}),e(P,{className:"DataSourceForm__input",label:"Enable scheduled sync",checked:y,onChange:t=>T(t.currentTarget.checked),size:"xs"}),y&&e("div",{className:"DataSourceForm__cron",children:[e("div",{className:"DataSourceForm__cron__row",children:[e("span",{children:"Run every"}),e(V,{className:"DataSourceForm__cron__interval",value:w,onChange:t=>N(Number(t)||1),min:1,size:"xs",radius:0}),e(S,{className:"DataSourceForm__cron__unit",data:[{value:"minutes",label:"minutes"},{value:"hours",label:"hours"},{value:"days",label:"days"}],value:E,onChange:t=>H(t),size:"xs",radius:0,dropdownComponent:"div"})]}),e(P,{className:"DataSourceForm__input",label:"Auto-publish after sync",checked:R,onChange:t=>C(t.currentTarget.checked),size:"xs"})]})]}),e(F,{className:"DataSourceForm__input",name:"previewUrl",label:"Preview URL",description:"URL where users can preview the data source.",size:"xs",radius:0,value:_?.previewUrl}),e(A,{className:"DataSourceForm__submit",color:"blue",size:"xs",type:"submit",loading:h,children:a.buttonLabel||"Save"}),L&&e("div",{className:"DataSourceForm__error",children:["Error: ",L]})]})}function ie(a){let n,c=a.startsWith("/")?"http://localhost":void 0;try{n=new URL(a,c)}catch(i){return console.error(i),!1}return n.protocol==="http:"||n.protocol==="https:"}function ue(a){let n={};return a.split(`
|
|
2
|
-
`).forEach(i=>{let h=i.indexOf(":");if(h===-1)return;let d=i.slice(0,h).trim(),r=i.slice(h+1).trim();d&&r&&(n[d]=r)}),n}function ce(a){let n=[];for(let c in a){let i=a[c];n.push(`${c}: ${i}`)}return n.join(`
|
|
3
|
-
`)}export{Ne as a};
|