@phtngyn/cms 0.1.0-beta.0 → 0.1.0-beta.2

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.
Files changed (181) hide show
  1. package/README.md +260 -6
  2. package/package.json +31 -16
  3. package/src/Authoring.d.ts +13 -1
  4. package/src/Configuration-Br7tE9Qt.d.ts +68 -0
  5. package/src/{AuthoringSchema-BQ5kbhVB.js → Configuration-CA_jvQKG.js} +599 -492
  6. package/src/Configuration-CA_jvQKG.js.map +1 -0
  7. package/src/Configuration.d.ts +2 -44
  8. package/src/Configuration.js +0 -1
  9. package/src/Configuration.js.map +1 -1
  10. package/src/{DocumentEngine-Da0kWotL.js → DocumentEngine-CgiBQU4g.js} +110 -84
  11. package/src/DocumentEngine-CgiBQU4g.js.map +1 -0
  12. package/src/DocumentModel-BB9igGC7.d.ts +34 -0
  13. package/src/DocumentModel.d.ts +2 -30
  14. package/src/DocumentModel.js +13 -3
  15. package/src/DocumentModel.js.map +1 -1
  16. package/src/Forms-BsJMev5_.d.ts +74 -0
  17. package/src/Forms-CfcI3tPU.js +79 -0
  18. package/src/Forms-CfcI3tPU.js.map +1 -0
  19. package/src/Forms-DxbkU3_5.js +367 -0
  20. package/src/Forms-DxbkU3_5.js.map +1 -0
  21. package/src/Forms.d.ts +35 -0
  22. package/src/Forms.js +13 -0
  23. package/src/Forms.js.map +1 -0
  24. package/src/HttpPaths-c9nLZ9H2.js +21 -0
  25. package/src/HttpPaths-c9nLZ9H2.js.map +1 -0
  26. package/src/I18n-DZK4CkJF.d.ts +21 -0
  27. package/src/I18n.d.ts +2 -0
  28. package/src/I18n.js +1 -0
  29. package/src/Module.js +78 -81
  30. package/src/Module.js.map +1 -1
  31. package/src/S3MediaObjects-JKMAWyVB.js +2664 -0
  32. package/src/S3MediaObjects-JKMAWyVB.js.map +1 -0
  33. package/src/Seed.d.ts +6 -0
  34. package/src/Seed.js +34 -0
  35. package/src/Seed.js.map +1 -0
  36. package/src/Seo-402YumpT.d.ts +198 -0
  37. package/src/{connection-ZGtL54qY.js → connection-B-iz0Y9Y.js} +5 -7
  38. package/src/connection-B-iz0Y9Y.js.map +1 -0
  39. package/src/{installation-BNKaVjni.js → installation-DgF2M1gL.js} +1162 -2147
  40. package/src/installation-DgF2M1gL.js.map +1 -0
  41. package/src/internal/authoring-catalog.js +153 -0
  42. package/src/internal/authoring-catalog.js.map +1 -0
  43. package/src/internal/authoring-compiler.js +2 -2
  44. package/src/internal/authoring-compiler.js.map +1 -1
  45. package/src/internal/authoring-metadata.js +68 -49
  46. package/src/internal/authoring-metadata.js.map +1 -1
  47. package/src/internal/cms-config.js +0 -1
  48. package/src/internal/cms-config.js.map +1 -1
  49. package/src/internal/configuration.js +25 -13
  50. package/src/internal/configuration.js.map +1 -1
  51. package/src/internal/document-model.js +66 -20
  52. package/src/internal/document-model.js.map +1 -1
  53. package/src/internal/form-capabilities.js +12 -0
  54. package/src/internal/form-capabilities.js.map +1 -0
  55. package/src/internal/i18n.js +47 -0
  56. package/src/internal/i18n.js.map +1 -0
  57. package/src/internal/studio-app.js +66 -0
  58. package/src/internal/studio-app.js.map +1 -0
  59. package/src/location-CFKTeK1K.js +35 -0
  60. package/src/location-CFKTeK1K.js.map +1 -0
  61. package/src/{metadata-Czvi3E4K.js → metadata-BEZPWh-3.js} +3 -72
  62. package/src/metadata-BEZPWh-3.js.map +1 -0
  63. package/src/{models-DS5ClMsH.js → models-BWm1pTAf.js} +9 -31
  64. package/src/models-BWm1pTAf.js.map +1 -0
  65. package/src/models-DwYioyNV.js +726 -0
  66. package/src/models-DwYioyNV.js.map +1 -0
  67. package/src/runtime/blocks.js +30 -0
  68. package/src/runtime/blocks.js.map +1 -0
  69. package/src/runtime/collaboration.js +9 -4
  70. package/src/runtime/collaboration.js.map +1 -1
  71. package/src/runtime/delivery/DocumentRenderer.js +10 -4
  72. package/src/runtime/delivery/DocumentRenderer.js.map +1 -1
  73. package/src/runtime/delivery/blocks.js +8 -0
  74. package/src/runtime/delivery/blocks.js.map +1 -0
  75. package/src/runtime/delivery/context.js +12 -0
  76. package/src/runtime/delivery/context.js.map +1 -0
  77. package/src/runtime/delivery/document-page.js +14 -12
  78. package/src/runtime/delivery/document-page.js.map +1 -1
  79. package/src/runtime/delivery/document.js +21 -3
  80. package/src/runtime/delivery/document.js.map +1 -1
  81. package/src/runtime/delivery/error.js +11 -0
  82. package/src/runtime/delivery/error.js.map +1 -0
  83. package/src/runtime/delivery/plugin.js +41 -0
  84. package/src/runtime/delivery/plugin.js.map +1 -0
  85. package/src/runtime/delivery/types.d.ts +5 -0
  86. package/src/runtime/delivery/useCmsDocumentSeo.d.ts +56 -0
  87. package/src/runtime/delivery/useCmsDocumentSeo.js +99 -0
  88. package/src/runtime/delivery/useCmsDocumentSeo.js.map +1 -0
  89. package/src/runtime/delivery/useDocument.js +5 -2
  90. package/src/runtime/delivery/useDocument.js.map +1 -1
  91. package/src/runtime/delivery/useDocumentQuery.js +5 -2
  92. package/src/runtime/delivery/useDocumentQuery.js.map +1 -1
  93. package/src/runtime/forms/document.js +38 -0
  94. package/src/runtime/forms/document.js.map +1 -0
  95. package/src/runtime/forms/useCmsForm.js +149 -0
  96. package/src/runtime/forms/useCmsForm.js.map +1 -0
  97. package/src/runtime/i18n/translator.js +22 -0
  98. package/src/runtime/i18n/translator.js.map +1 -0
  99. package/src/runtime/i18n/useCmsI18n.d.ts +9 -0
  100. package/src/runtime/i18n/useCmsI18n.js +29 -0
  101. package/src/runtime/i18n/useCmsI18n.js.map +1 -0
  102. package/src/runtime/installation.js +1 -1
  103. package/src/runtime/plugin.js +3 -3
  104. package/src/runtime/plugin.js.map +1 -1
  105. package/src/runtime/preview/comark-document.js +0 -1
  106. package/src/runtime/preview/comark-document.js.map +1 -1
  107. package/src/runtime/preview/connection.js +1 -1
  108. package/src/runtime/preview/controller.js +37 -11
  109. package/src/runtime/preview/controller.js.map +1 -1
  110. package/src/runtime/preview/overlay.js +65 -0
  111. package/src/runtime/preview/overlay.js.map +1 -0
  112. package/src/runtime/preview/plugin.client.js +59 -61
  113. package/src/runtime/preview/plugin.client.js.map +1 -1
  114. package/src/runtime/preview/preview.css +72 -4
  115. package/src/runtime/preview/protocol.js.map +1 -1
  116. package/src/runtime/preview/store.js +1 -1
  117. package/src/runtime/preview/targets.js +0 -1
  118. package/src/runtime/preview/targets.js.map +1 -1
  119. package/src/runtime/sitemap-entries.js +17 -0
  120. package/src/runtime/sitemap-entries.js.map +1 -0
  121. package/src/runtime/sitemap.js +24 -0
  122. package/src/runtime/sitemap.js.map +1 -0
  123. package/src/runtime/studio-app.js +5 -1
  124. package/src/runtime/studio-app.js.map +1 -1
  125. package/src/runtime/studio-entry.js +36 -0
  126. package/src/runtime/studio-entry.js.map +1 -0
  127. package/src/runtime/studio-navigation.js +11 -0
  128. package/src/runtime/studio-navigation.js.map +1 -0
  129. package/src/scalars-B2lgGUnj.js +26 -0
  130. package/src/scalars-B2lgGUnj.js.map +1 -0
  131. package/src/{store-Nl4uxEXx.js → store-DjJs3I7k.js} +12 -7
  132. package/src/store-DjJs3I7k.js.map +1 -0
  133. package/studio/CreateDocumentDialog-CTeIFlPb.js +256 -0
  134. package/studio/collaboration-DcK2F6v9.js +4566 -0
  135. package/studio/documentPlanning-Bfv-d7OU.js +29820 -0
  136. package/studio/dom-to-image-more.min-D6jGGdrW.js +877 -0
  137. package/studio/editor-Bzlh3zXt.js +30827 -0
  138. package/studio/host.css +3 -0
  139. package/studio/host.js +46614 -0
  140. package/studio/rolldown-runtime-B0aSnxlc.js +20 -0
  141. package/dist/studio/assets/ActivityEntryRow-D--fRvWI.js +0 -1
  142. package/dist/studio/assets/ActivityView-D-XBBUHb.js +0 -1
  143. package/dist/studio/assets/CreateDocumentDialog-CH8UH1QM.js +0 -1
  144. package/dist/studio/assets/DocumentsView-CxRpmAxt.js +0 -34
  145. package/dist/studio/assets/DropdownMenu-BSb1l7fr.js +0 -1
  146. package/dist/studio/assets/Input-DVao38h7.js +0 -3
  147. package/dist/studio/assets/MediaView-BHrPIjxB.js +0 -1
  148. package/dist/studio/assets/Modal-VNrXGa5C.js +0 -1
  149. package/dist/studio/assets/OverviewView-DfP6-mLZ.js +0 -1
  150. package/dist/studio/assets/Select-BJZIs9sY.js +0 -1
  151. package/dist/studio/assets/SettingsView-CerHe-ua.js +0 -1
  152. package/dist/studio/assets/Skeleton-CWJNi3nS.js +0 -1
  153. package/dist/studio/assets/StudioPageHeader-DP9HDAF2.js +0 -1
  154. package/dist/studio/assets/UsersView-cP3REkH2.js +0 -1
  155. package/dist/studio/assets/collaboration-BLnCzfvV.js +0 -4
  156. package/dist/studio/assets/context-dY4fNbn3.js +0 -1
  157. package/dist/studio/assets/editor-CE07wW83.js +0 -137
  158. package/dist/studio/assets/gateway-BAyQgCse.js +0 -10
  159. package/dist/studio/assets/index-CjoaPLhZ.js +0 -28
  160. package/dist/studio/assets/index-s2rPqCmP.css +0 -2
  161. package/dist/studio/assets/render-BkxbK2St.js +0 -83
  162. package/dist/studio/assets/rolldown-runtime-DK3Fl9T5.js +0 -1
  163. package/dist/studio/assets/useMediaLibrary-D7qR7aBf.js +0 -1
  164. package/dist/studio/index.html +0 -76
  165. package/src/AuthoringSchema-BQ5kbhVB.js.map +0 -1
  166. package/src/Configuration-BGYFD2N1.js +0 -150
  167. package/src/Configuration-BGYFD2N1.js.map +0 -1
  168. package/src/DocumentEngine-Da0kWotL.js.map +0 -1
  169. package/src/HttpPaths-86qLGB90.js +0 -15
  170. package/src/HttpPaths-86qLGB90.js.map +0 -1
  171. package/src/StudioHttp-BTLLooh0.js +0 -916
  172. package/src/StudioHttp-BTLLooh0.js.map +0 -1
  173. package/src/connection-ZGtL54qY.js.map +0 -1
  174. package/src/installation-BNKaVjni.js.map +0 -1
  175. package/src/internal/component-metadata.js +0 -37
  176. package/src/internal/component-metadata.js.map +0 -1
  177. package/src/metadata-Czvi3E4K.js.map +0 -1
  178. package/src/models-Citx8jBi.js +0 -306
  179. package/src/models-Citx8jBi.js.map +0 -1
  180. package/src/models-DS5ClMsH.js.map +0 -1
  181. package/src/store-Nl4uxEXx.js.map +0 -1
@@ -0,0 +1,20 @@
1
+ //#region \0rolldown/runtime.js
2
+ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescriptor, r = Object.getOwnPropertyNames, i = Object.getPrototypeOf, a = Object.prototype.hasOwnProperty, o = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), s = (e, n) => {
3
+ let r = {};
4
+ for (var i in e) t(r, i, {
5
+ get: e[i],
6
+ enumerable: !0
7
+ });
8
+ return n || t(r, Symbol.toStringTag, { value: "Module" }), r;
9
+ }, c = (e, i, o, s) => {
10
+ if (i && typeof i == "object" || typeof i == "function") for (var c = r(i), l = 0, u = c.length, d; l < u; l++) d = c[l], !a.call(e, d) && d !== o && t(e, d, {
11
+ get: ((e) => i[e]).bind(null, d),
12
+ enumerable: !(s = n(i, d)) || s.enumerable
13
+ });
14
+ return e;
15
+ }, l = (n, r, o) => (o = n == null ? {} : e(i(n)), c(r || !n || !n.__esModule || !a.call(n, "default") ? t(o, "default", {
16
+ value: n,
17
+ enumerable: !0
18
+ }) : o, n));
19
+ //#endregion
20
+ export { s as n, l as r, o as t };
@@ -1 +0,0 @@
1
- import{$ as e,Ct as t,Dt as n,Q as r,Rt as i,et as a,in as o,it as s,ln as c,on as l,ot as u,tt as d}from"./editor-CE07wW83.js";import{y as f}from"./context-dY4fNbn3.js";import{$ as p,Q as m,bn as h,tt as g}from"./gateway-BAyQgCse.js";var _={"authentication.password.changed":{filterLabel:`Password changed`,icon:`i-lucide-key-round`,label:`changed the password for`},"authentication.password.reset":{filterLabel:`Password reset`,icon:`i-lucide-key-round`,label:`reset the password for`},"authentication.signed-in":{filterLabel:`Signed in`,icon:`i-lucide-log-in`,label:`signed in as`},"authentication.signed-out":{filterLabel:`Signed out`,icon:`i-lucide-log-out`,label:`signed out as`},"document.created":{filterLabel:`Created`,icon:`i-lucide-file-plus`,label:`created`},"document.moved":{filterLabel:`Moved`,icon:`i-lucide-file-symlink`,label:`moved`},"document.published":{filterLabel:`Published`,icon:`i-lucide-send`,label:`published`},"document.trashed":{filterLabel:`Moved to trash`,icon:`i-lucide-trash-2`,label:`moved to trash`},"document.revision.restored":{filterLabel:`Restored revision`,icon:`i-lucide-history`,label:`restored a revision of`},"document.untrashed":{filterLabel:`Restored from trash`,icon:`i-lucide-archive-restore`,label:`restored from trash`},"document.updated":{filterLabel:`Updated`,icon:`i-lucide-pencil-line`,label:`updated`},"media.cleaned":{filterLabel:`Media cleaned`,icon:`i-lucide-sparkles`,label:`cleaned up`},"media.removed":{filterLabel:`Media removed`,icon:`i-lucide-image-minus`,label:`removed`},"media.replaced":{filterLabel:`Media replaced`,icon:`i-lucide-images`,label:`replaced`},"media.uploaded":{filterLabel:`Media uploaded`,icon:`i-lucide-image-plus`,label:`uploaded`},"user.created":{filterLabel:`User added`,icon:`i-lucide-user-plus`,label:`added`},"user.removed":{filterLabel:`User removed`,icon:`i-lucide-user-minus`,label:`removed`},"user.role.changed":{filterLabel:`User role changed`,icon:`i-lucide-shield-check`,label:`changed the role for`},"user.sessions.revoked":{filterLabel:`User sessions revoked`,icon:`i-lucide-log-out`,label:`revoked sessions for`}},v=[{label:`All actions`,value:`all`},...Object.entries(_).map(([e,t])=>({label:t.filterLabel,value:e}))];function y(e){return _[e.action].icon}function b(e){return _[e.action].label}function x(e){for(let t of[`sourcePath`,`objectKey`,`email`]){let n=e.details[t];if(h(n))return n}switch(e.target.kind){case`document`:return e.target.documentId;case`media`:return e.target.mediaId;case`user`:return e.target.userId;case`media-library`:return`Media library`}}function S(e,t){let n=e.target.kind===`document`?e.target.documentId:void 0;return n&&t.has(n)?n:void 0}function C(e,t=g(p())){let n=g(e),r=Math.round((n-t)/1e3),i=new Intl.RelativeTimeFormat(void 0,{numeric:`auto`});if(Math.abs(r)<60)return i.format(r,`second`);let a=Math.round(r/60);if(Math.abs(a)<60)return i.format(a,`minute`);let o=Math.round(a/60);if(Math.abs(o)<24)return i.format(o,`hour`);let s=Math.round(o/24);return Math.abs(s)<30?i.format(s,`day`):new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`}).format(n)}var w={class:`text-muted`},T={key:0,class:`font-medium`},E={key:0,class:`block truncate font-mono text-[11px] text-muted`},D={key:1,class:`mt-0.5 block text-dimmed`},O={key:2,class:`mt-1 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-muted`},k=[`title`],A={class:`font-mono text-[10px]`},j=u({__name:`ActivityEntryRow`,props:{clickable:{type:Boolean,default:!1},compact:{type:Boolean,default:!1},entry:{}},emits:[`select`],setup(u,{emit:p}){let h=p;return(p,g)=>{let _=f;return t(),e(n(u.clickable?`button`:`div`),{type:u.clickable?`button`:void 0,class:l([`flex w-full text-left transition-colors`,[u.compact?`gap-3 px-4 py-3`:`gap-4 px-4 py-4 sm:px-5`,u.clickable?`hover:bg-muted/40`:`cursor-default`]]),onClick:g[0]||=e=>u.clickable&&h(`select`)},{default:i(()=>[r(`span`,{class:l([`grid shrink-0 place-items-center rounded-full bg-muted/50`,u.compact?`mt-0.5 size-7`:`size-9 border border-default`])},[s(_,{name:o(y)(u.entry),class:l(u.compact?`size-3.5 text-muted`:`size-4 text-muted`)},null,8,[`name`,`class`])],2),r(`span`,{class:l([`min-w-0 flex-1`,u.compact?`text-xs`:``])},[r(`span`,{class:l(u.compact?``:`block text-sm text-highlighted`)},[r(`span`,{class:l(u.compact?`font-medium text-highlighted`:`font-semibold`)},c(u.entry.actor.name),3),r(`span`,w,c(o(b)(u.entry)),1),u.compact?a(``,!0):(t(),d(`span`,T,c(o(x)(u.entry)),1))],2),u.compact?(t(),d(`span`,E,c(o(x)(u.entry)),1)):a(``,!0),u.compact?(t(),d(`span`,D,c(o(C)(u.entry.occurredAt)),1)):(t(),d(`span`,O,[r(`span`,{title:o(m).toDate(u.entry.occurredAt).toLocaleString()},c(o(C)(u.entry.occurredAt)),9,k),g[1]||=r(`span`,{"aria-hidden":`true`},`·`,-1),r(`span`,null,c(u.entry.actor.email),1),g[2]||=r(`span`,{"aria-hidden":`true`},`·`,-1),r(`span`,A,c(u.entry.requestId),1)]))],2),u.clickable&&!u.compact?(t(),e(_,{key:0,name:`i-lucide-chevron-right`,class:`mt-2 size-4 shrink-0 text-dimmed`})):a(``,!0)]),_:1},8,[`type`,`class`])}}});export{S as a,x as i,v as n,b as r,j as t};
@@ -1 +0,0 @@
1
- import{$ as e,Ct as t,J as n,Jt as r,Kt as i,Pt as a,Q as o,Qt as s,Rt as c,Tt as l,Wt as u,Yt as d,Z as f,bt as p,et as m,in as h,it as g,nt as _,ot as v,tt as y}from"./editor-CE07wW83.js";import{N as b,i as x,n as S,r as C,y as w}from"./context-dY4fNbn3.js";import{t as T}from"./Input-DVao38h7.js";import{t as E}from"./Select-BJZIs9sY.js";import{n as D}from"./gateway-BAyQgCse.js";import{p as O,s as k}from"./index-CjoaPLhZ.js";import{t as A}from"./Skeleton-CWJNi3nS.js";import{a as j,i as M,n as N,r as P,t as F}from"./ActivityEntryRow-D--fRvWI.js";import{t as I}from"./StudioPageHeader-DP9HDAF2.js";function L(e){let t=s([]),n=s(),o=s(!1),c=s(),l=d(`all`),u=d(``),p=0,m=f(()=>{let e=u.value.trim().toLocaleLowerCase();return e?t.value.filter(t=>[t.actor.name,t.actor.email,M(t),P(t)].some(t=>t.toLocaleLowerCase().includes(e))):t.value}),h=async()=>{let r=++p;o.value=!0,c.value=void 0;try{let i=await e.activity.list({action:l.value===`all`?void 0:l.value,limit:50});if(r!==p)return;t.value=i.entries,n.value=i.nextCursor}catch(e){r===p&&(c.value=e)}finally{r===p&&(o.value=!1)}},g=async()=>{let r=n.value;if(!r||o.value)return;let i=p;o.value=!0,c.value=void 0;try{let a=await e.activity.list({action:l.value===`all`?void 0:l.value,cursor:r,limit:50});if(i!==p)return;let o=new Map(t.value.map(e=>[e.id,e]));for(let e of a.entries)o.set(e.id,e);t.value=[...o.values()],n.value=a.nextCursor}catch(e){i===p&&(c.value=e)}finally{i===p&&(o.value=!1)}},_=a(l,h);return i(()=>{p+=1,_()}),{action:l,entries:r(t),error:r(c),isLoading:r(o),load:h,loadMore:g,nextCursor:r(n),search:u,visibleEntries:m}}var R={class:`mx-auto w-full max-w-5xl space-y-7 p-5 sm:p-7 lg:p-9`},z={class:`flex flex-col gap-2 sm:flex-row`},B={key:1,class:`space-y-4 p-5`},V={key:2,class:`divide-y divide-default`},H={key:3,class:`px-6 py-16 text-center`},U={class:`mx-auto grid size-11 place-items-center rounded-full bg-muted`},W={class:`flex justify-center`},G=v({__name:`ActivityView`,setup(r){let{gateway:i}=S(),{catalog:a}=k(),s=b(),d=L(i),{action:v,entries:M,loadMore:P,nextCursor:G,search:K,visibleEntries:q}=d,J=d.isLoading,Y=f(()=>{let e=d.error.value;return e?D(e):``}),X=d.load,Z=f(()=>new Set(a.entries.value.map(e=>e.document.id)));p(X);function Q(e){return j(e,Z.value)}function $(e){let t=Q(e);t&&s.push({name:`documents`,query:{document:t}})}return(r,i)=>{let a=T,s=E,d=x,f=C,p=A,b=w,S=O;return t(),y(`div`,R,[g(I,{title:`Activity`,description:`An immutable record of Document, Media, and User administration, with authentication activity as it becomes available.`}),g(S,{ui:{body:`p-0 sm:p-0`}},_({header:c(()=>[o(`div`,z,[g(a,{modelValue:h(K),"onUpdate:modelValue":i[0]||=e=>u(K)?K.value=e:null,icon:`i-lucide-search`,placeholder:`Filter loaded activity`,class:`min-w-0 flex-1`},null,8,[`modelValue`]),g(s,{modelValue:h(v),"onUpdate:modelValue":i[1]||=e=>u(v)?v.value=e:null,items:h(N),"value-key":`value`,class:`w-full sm:w-44`},null,8,[`modelValue`,`items`]),g(d,{color:`neutral`,variant:`outline`,icon:`i-lucide-refresh-cw`,"aria-label":`Refresh`,loading:h(J),onClick:h(X)},null,8,[`loading`,`onClick`])])]),default:c(()=>[Y.value?(t(),e(f,{key:0,title:`Activity could not be loaded`,description:Y.value,color:`error`,variant:`subtle`,class:`m-4`},null,8,[`description`])):m(``,!0),h(J)&&!h(M).length?(t(),y(`div`,B,[(t(),y(n,null,l(7,e=>g(p,{key:e,class:`h-12`})),64))])):h(q).length?(t(),y(`div`,V,[(t(!0),y(n,null,l(h(q),n=>(t(),e(F,{key:n.id,entry:n,clickable:Q(n)!==void 0,onSelect:e=>$(n)},null,8,[`entry`,`clickable`,`onSelect`]))),128))])):(t(),y(`div`,H,[o(`span`,U,[g(b,{name:`i-lucide-activity`,class:`size-5 text-muted`})]),i[2]||=o(`p`,{class:`mt-3 text-sm font-medium text-highlighted`},`No matching activity`,-1),i[3]||=o(`p`,{class:`mt-1 text-xs text-muted`},` Document, Media, User administration, and authentication activity will appear here. `,-1)]))]),_:2},[h(G)?{name:`footer`,fn:c(()=>[o(`div`,W,[g(d,{color:`neutral`,variant:`outline`,label:`Load more`,loading:h(J),onClick:h(P)},null,8,[`loading`,`onClick`])])]),key:`0`}:void 0]),1024)])}}});export{G as default};
@@ -1 +0,0 @@
1
- import{$ as e,Ct as t,J as n,K as r,Pt as i,Q as a,Qt as o,Rt as s,Tt as c,Yt as l,Z as u,et as d,in as f,it as p,jt as m,ln as h,on as g,ot as _,pt as v,tt as y}from"./editor-CE07wW83.js";import{i as ee,n as b,r as te}from"./context-dY4fNbn3.js";import{t as ne}from"./Input-DVao38h7.js";import{t as re}from"./Select-BJZIs9sY.js";import{r as ie,t as ae}from"./Modal-VNrXGa5C.js";import{A as x,B as S,bn as C,dn as w,fn as T,h as E,ln as D,m as O,mn as k,n as oe,p as A,pn as j,pt as M,q as N,un as P,x as F,y as I}from"./gateway-BAyQgCse.js";import{t as L}from"./render-BkxbK2St.js";var R=/:([a-z][\w.]*)(\*)?/giu;function z(e){let t=[...e.matchAll(R)].map(e=>({catchAll:e[2]===`*`,name:e[1]??``}));return e.replace(R,``).includes(`:`)||t.some(e=>!e.name)?D({field:`addressPattern`,message:`Document address pattern "${e}" contains an invalid token.`}):t.filter(e=>e.catchAll).length>1?D({field:`addressPattern`,message:`Document address pattern "${e}" contains more than one catch-all token.`}):new Set(t.map(e=>e.name)).size===t.length?k({pattern:e,tokens:t}):D({field:`addressPattern`,message:`Document address pattern "${e}" contains duplicate tokens.`})}function B(e,t,n){let r=t===`/`?``:t.slice(1),i=e.pattern;for(let t of e.tokens){let a=G(n,t.name),o=t.catchAll?r:void 0,s=a===void 0?o:C(a)&&a.trim()?a:void 0;if(s===void 0)return D({field:t.name,message:a===void 0?`Document address field "${t.name}" is required by pattern "${e.pattern}".`:`Document address field "${t.name}" must be a non-empty string.`});let c=t.catchAll?U(s):W(s);if(w(c))return D(c.failure);i=i.replace(`:${t.name}${t.catchAll?`*`:``}`,c.success)}return H(i)}function V(e,t,n){return!n||!t||t===n.defaultLocale&&!n.prefixDefaultLocale?e:I.make(`/${t}${e===`/`?``:e}`)}function H(e){let t=`/${e.replace(/\\/gu,`/`).replace(/^\/+|\/+$/gu,``)}`.replace(/\/{2,}/gu,`/`);return S(I)(t).pipe(j(()=>({field:`path`,message:`Document path "${e}" cannot be normalized into a public path.`})))}function U(e){if(!e.trim())return k(``);let t=e.replace(/\\/gu,`/`).split(`/`).filter(Boolean),n=[];for(let e of t){let t=W(e);if(w(t))return t;n.push(t.success)}return k(n.join(`/`))}function W(e){let t=e.trim().normalize(`NFKC`).toLocaleLowerCase().replace(/[^\p{Letter}\p{Number}_-]+/gu,`-`).replace(/^-+|-+$/gu,``);return t?k(t):D({message:`Document path segment "${e}" is empty after normalization.`})}function G(e,t){return t.split(`.`).reduce((e,t)=>{if(N(x)(e))return e[t]},e)}function K(e,t){return P(function*(){let n=e.types.find(e=>e.collection===t.collection);if(!n)return yield*Q(`Document collection "${t.collection}" does not exist.`,`collection`);if(!n.canCreate)return yield*Q(`Document collection "${t.collection}" does not allow creation.`,`collection`);let r=t.title.trim();if(!r)return yield*Q(`A document title is required.`,`title`);let i=yield*le(e,t.locale),a=yield*z(n.addressPattern).pipe(j(Z)),o=yield*ue(n,t.location),s=Object.fromEntries(a.tokens.flatMap(e=>e.name===`slug`&&o?[[e.name,o.split(`/`).at(-1)??o]]:[])),c=yield*B(a,yield*H(o).pipe(j(Z)),s).pipe(j(Z)),l=q(n,o,i),u=V(c,i,e.locales);return Object.assign({collection:n,data:s,key:c,path:u,sourcePath:l,title:r},i===void 0?void 0:{locale:i})})}M(`DocumentPlanning.createInitialSource`)(function*(e){let t=O.make({frontmatter:J(e),meta:{},nodes:[[`h1`,{},e.title]]});return{body:t,markdown:yield*L(t)}});function se(e,t){let n=t.sourcePath;return t.document.locale&&n.startsWith(`${t.document.locale}/`)&&(n=n.slice(t.document.locale.length+1)),e.directory!==`.`&&n.startsWith(`${e.directory}/`)&&(n=n.slice(e.directory.length+1)),n=n.replace(/\.(?:md|mdc)$/iu,``),n.toLocaleLowerCase()===`index`?void 0:n}function q(e,t,n){let r=t?`${t}.md`:`index.md`;return F.make([n,e.directory===`.`?void 0:e.directory,r].filter(e=>e!==void 0).join(`/`))}function J(e){let t={...e.data,title:e.title};for(let n of e.collection.authoringFields)n.defaultValue!==void 0&&ce(t,n.path)===void 0&&(t=Y(t,n.path.split(`.`),n.defaultValue));return t}function ce(e,t){return t.split(`.`).reduce((e,t)=>X(e)?e[t]:void 0,e)}function Y(e,t,n){let[r,...i]=t;if(!r)return e;if(i.length===0)return Object.assign({},e,{[r]:n});let a=e[r];return Object.assign({},e,{[r]:Y(X(a)?a:{},i,n)})}var X=N(x);function le(e,t){let n=e.locales;if(!n)return t===void 0?k(void 0):Q(`Document locale "${t}" is not configured.`,`locale`);let r=t??n.defaultLocale;return n.locales.includes(r)?k(r):Q(`Document locale "${r}" does not exist.`,`locale`)}function ue(e,t){return t.kind===`home`?e.addressPattern===`/:path*`?k(``):Q(`Only a root catch-all collection can use the home location.`,`location`):t.parent!==void 0&&!e.hierarchy?Q(`Document collection "${e.collection}" does not allow hierarchy.`,`location.parent`):U([t.parent,t.slug].filter(e=>e!==void 0).join(`/`)).pipe(j(e=>Z({...e,field:`location`})))}function Z(e){return new A({issues:[de(e.message,e.field)]})}function Q(e,t){return D(new A({issues:[de(e,t)]}))}function de(e,t){return t===void 0?{code:`document.invalid`,message:e,severity:`error`}:{code:`document.invalid`,field:t,message:e,severity:`error`}}function fe(e,t){let n=S(E)(t);if(w(n))return D(`The document details are invalid.`);let r=K(e,n.success);return T(r)?k({path:r.success.path,sourcePath:r.success.sourcePath}):D(r.failure.issues[0]?.message||`The document location is invalid.`)}function pe(e){return e.trim().normalize(`NFKC`).toLocaleLowerCase().replace(/[^\p{Letter}\p{Number}_-]+/gu,`-`).replace(/^-+|-+$/gu,``)}var me={key:2},he={class:`grid grid-flow-col auto-cols-fr overflow-x-auto rounded-md border border-default`},ge=[`title`,`onClick`],_e={class:`block truncate`},ve={key:0,class:`mt-2 flex min-w-0 items-center justify-between gap-3 text-xs text-muted`},ye={class:`truncate`},be={class:`shrink-0 font-mono text-[11px] text-dimmed`},xe={key:5,class:`flex min-w-0 items-center gap-3 rounded-md border border-default px-3 py-2`},Se={key:6,class:`-mt-2 text-xs text-error`},Ce={key:7,class:`-mt-2 text-xs text-error`},we={class:`flex w-full justify-end gap-2`},$=`__top_level__`,Te=_({__name:`CreateDocumentDialog`,props:v({catalog:{}},{open:{type:Boolean},openModifiers:{}}),emits:v([`close`],[`update:open`]),setup(_,{emit:v}){let x=v,S=m(_,`open`),C=b(),E=C.bootstrap.documents,D=E.types.filter(e=>e.canCreate),O=(E.locales?.locales??[]).map(e=>({label:J(e),value:e})),k=o(``),A=o(!1),j=l(``),M=l(``),N=l(!1),P=l(``),F=l($),I=l(E.locales?.defaultLocale??``),L=u(()=>{let e=D.map(e=>({collection:e.collection,description:e.description,key:`entry:${e.collection}`,kind:`entry`,label:e.label,type:e,urlHint:e.addressPattern.replace(/:[a-z][\w.]*\*?/giu,`…`)}));return[...D.filter(e=>e.addressPattern===`/:path*`).slice(0,1).flatMap(e=>{let t=fe(E,{collection:e.collection,locale:I.value||void 0,location:{kind:`home`},title:`Home`});return w(t)||_.catalog.entries.value.some(e=>e.document.path===t.success.path)?[]:[{collection:e.collection,description:`The first document visitors see when they open the website.`,key:`home:${e.collection}`,kind:`home`,label:`Home`,type:e,urlHint:t.success.path}]}),...e]}),R=u(()=>L.value.find(e=>e.key===P.value)),z=u(()=>R.value?.kind===`home`?{kind:`home`}:F.value===$?{kind:`entry`,slug:M.value}:{kind:`entry`,parent:F.value,slug:M.value}),B=u(()=>{let e=R.value;if(!e||e.kind===`entry`&&!M.value.trim())return;let t={collection:e.collection,location:z.value,title:j.value||`Untitled`};return fe(E,I.value?{...t,locale:I.value}:t)}),V=u(()=>{let e=B.value;return e&&T(e)?e.success:void 0}),H=u(()=>{let e=B.value;return e&&w(e)?e.failure:``}),U=u(()=>V.value&&_.catalog.entries.value.some(e=>e.document.path===V.value?.path)),W=u(()=>{let e=R.value;if(!e||e.kind===`home`||!e.type.hierarchy)return[];let t=_.catalog.entries.value.flatMap(t=>{if(t.document.collection!==e.collection||t.document.locale!==(I.value||void 0))return[];let n=se(e.type,t);return n?[{label:`${t.document.title} · /${n}`,value:n}]:[]});return[{label:`Top level`,value:$},...t]}),G=u(()=>!!j.value.trim()&&!!R.value&&!!V.value&&!U.value);i(j,e=>{N.value||(M.value=pe(e))}),i(P,()=>F.value=$),i(I,()=>{F.value=$,R.value||(P.value=q())}),i(S,e=>{e&&(k.value=``,j.value=``,M.value=``,N.value=!1,F.value=$,I.value=E.locales?.defaultLocale??``,P.value=q())},{immediate:!0});async function K(){let e=R.value;if(G.value&&e&&!A.value){A.value=!0,k.value=``;try{let t={collection:e.collection,location:z.value,title:j.value},n=await C.gateway.documents.create(I.value?{...t,locale:I.value}:t);await _.catalog.refresh(!0);let r=_.catalog.byId(n.documentId);if(!r)throw Error(`The page was created but could not be opened.`);x(`close`,r.document.id)}catch(e){k.value=oe(e)}finally{A.value=!1}}}function q(){return L.value[0]?.key??``}function J(e){try{return new Intl.DisplayNames(void 0,{type:`language`}).of(e)??e.toLocaleUpperCase()}catch{return e.toLocaleUpperCase()}}return(i,o)=>{let l=te,u=ne,m=ie,_=re,v=ee,b=ae;return t(),e(b,{open:S.value,"onUpdate:open":o[6]||=e=>S.value=e,title:`New document`,description:`Add a document to your website.`,ui:{content:`max-w-lg`}},{body:s(()=>[a(`form`,{id:`create-document-form`,class:`space-y-4`,onSubmit:r(K,[`prevent`])},[k.value?(t(),e(l,{key:0,description:k.value,color:`error`,variant:`subtle`},null,8,[`description`])):d(``,!0),L.value.length?L.value.length>1?(t(),y(`fieldset`,me,[o[7]||=a(`legend`,{class:`mb-2 text-sm font-medium text-highlighted`},`Collection`,-1),a(`div`,he,[(t(!0),y(n,null,c(L.value,e=>(t(),y(`button`,{key:e.key,type:`button`,title:e.description,class:g([`min-w-28 border-l border-default px-3 py-2 text-center text-sm transition-colors first:border-l-0`,e.key===P.value?`bg-muted font-medium text-highlighted`:`bg-default text-muted hover:bg-muted/50 hover:text-highlighted`]),onClick:t=>P.value=e.key},[a(`span`,_e,h(e.label),1)],10,ge))),128))]),R.value?(t(),y(`div`,ve,[a(`span`,ye,h(R.value.description),1),a(`code`,be,h(R.value.urlHint),1)])):d(``,!0)])):d(``,!0):(t(),e(l,{key:1,title:`Document creation is not configured`,description:`A developer needs to make at least one collection creatable in Studio.`,color:`warning`,variant:`subtle`})),R.value?(t(),y(`div`,{key:3,class:g([`grid gap-4`,f(O).length?`sm:grid-cols-[minmax(0,2fr)_minmax(9rem,1fr)]`:``])},[p(m,{label:`Title`,required:``},{default:s(()=>[p(u,{modelValue:j.value,"onUpdate:modelValue":o[0]||=e=>j.value=e,autofocus:``,placeholder:`About us`,class:`w-full`},null,8,[`modelValue`])]),_:1}),f(O).length?(t(),e(m,{key:0,label:`Language`},{default:s(()=>[p(_,{modelValue:I.value,"onUpdate:modelValue":o[1]||=e=>I.value=e,items:f(O),"value-key":`value`,class:`w-full`},null,8,[`modelValue`,`items`])]),_:1})):d(``,!0)],2)):d(``,!0),R.value?.kind===`entry`?(t(),y(`div`,{key:4,class:g([`grid gap-4`,R.value.type.hierarchy?`sm:grid-cols-2`:``])},[R.value.type.hierarchy?(t(),e(m,{key:0,label:`Parent document`},{default:s(()=>[p(_,{modelValue:F.value,"onUpdate:modelValue":o[2]||=e=>F.value=e,items:W.value,"value-key":`value`,class:`w-full`},null,8,[`modelValue`,`items`])]),_:1})):d(``,!0),p(m,{label:`URL ending`,required:``},{default:s(()=>[p(u,{modelValue:M.value,"onUpdate:modelValue":[o[3]||=e=>M.value=e,o[4]||=e=>N.value=!0],placeholder:`about-us`,class:`w-full`},null,8,[`modelValue`])]),_:1})],2)):d(``,!0),R.value?(t(),y(`div`,xe,[o[8]||=a(`span`,{class:`shrink-0 text-xs text-muted`},`URL`,-1),a(`p`,{class:g([`min-w-0 flex-1 truncate text-right font-mono text-xs`,U.value?`text-error`:`text-highlighted`])},h(V.value?.path||R.value.urlHint),3)])):d(``,!0),U.value?(t(),y(`p`,Se,`This URL is already in use.`)):H.value?(t(),y(`p`,Ce,h(H.value),1)):d(``,!0)],32)]),footer:s(()=>[a(`div`,we,[p(v,{color:`neutral`,variant:`ghost`,label:`Cancel`,onClick:o[5]||=e=>S.value=!1}),p(v,{type:`submit`,form:`create-document-form`,color:`neutral`,label:`Create document`,loading:A.value,disabled:!G.value},null,8,[`loading`,`disabled`])])]),_:1},8,[`open`])}}});export{Te as default};