@kyro-cms/admin 0.9.1 → 0.9.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 (37) hide show
  1. package/dist/index.cjs +1196 -1727
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.d.cts +4 -3
  4. package/dist/index.d.ts +4 -3
  5. package/dist/index.js +891 -1422
  6. package/dist/index.js.map +1 -1
  7. package/package.json +2 -2
  8. package/src/components/ActionBar.tsx +25 -174
  9. package/src/components/Admin.tsx +1 -3
  10. package/src/components/AuditLogsPage.tsx +2 -13
  11. package/src/components/AutoForm.tsx +160 -265
  12. package/src/components/DetailView.tsx +38 -66
  13. package/src/components/FieldRenderer.tsx +1 -1
  14. package/src/components/ListView.tsx +26 -198
  15. package/src/components/MediaGallery.tsx +117 -175
  16. package/src/components/RestPlayground.tsx +54 -47
  17. package/src/components/fields/BlocksField.tsx +8 -10
  18. package/src/components/fields/RelationshipBlockField.tsx +2 -3
  19. package/src/components/fields/RelationshipField.tsx +2 -3
  20. package/src/components/fix_imports.cjs +23 -0
  21. package/src/components/fix_imports2.cjs +19 -0
  22. package/src/components/replace_svgs.cjs +63 -0
  23. package/src/components/ui/Dropdown.tsx +7 -2
  24. package/src/components/ui/Modal.tsx +24 -27
  25. package/src/components/ui/PromptModal.tsx +2 -10
  26. package/src/components/ui/SlidePanel.tsx +2 -10
  27. package/src/components/ui/SplitButton.tsx +107 -0
  28. package/src/components/ui/Toaster.tsx +0 -1
  29. package/src/components/ui/icons.tsx +1 -0
  30. package/src/components/users/UsersList.tsx +8 -85
  31. package/src/hooks/useAutoFormState.ts +89 -161
  32. package/src/hooks/useQueue.ts +60 -0
  33. package/src/layouts/AdminLayout.astro +22 -2
  34. package/src/layouts/AuthLayout.astro +66 -18
  35. package/src/lib/autoform-store.ts +6 -2
  36. package/src/lib/globals.ts +5 -3
  37. package/src/pages/auth/register.astro +5 -2
@@ -12,6 +12,8 @@ export interface GlobalOptions {
12
12
  * falling back to the direct adapter approach.
13
13
  */
14
14
  export async function getGlobal(slug: string, options?: GlobalOptions) {
15
+ const draft = options?.draft ?? !!options?.request;
16
+
15
17
  // Strategy 1: Direct adapter access via shared kyro instance (SSR context)
16
18
  // This avoids HTTP round-trips and auth cookie forwarding issues
17
19
  const kyroInstance = (globalThis as any).__KYRO_INSTANCE__;
@@ -21,7 +23,7 @@ export async function getGlobal(slug: string, options?: GlobalOptions) {
21
23
  const doc = await db.findOne({
22
24
  collection: `_globals_${slug}`,
23
25
  where: {},
24
- draft: options?.draft ?? false,
26
+ draft,
25
27
  });
26
28
  if (!doc) return null;
27
29
 
@@ -48,7 +50,7 @@ export async function getGlobal(slug: string, options?: GlobalOptions) {
48
50
  try {
49
51
  const apiPath = (globalThis as any).__KYRO_API_PATH__ || "/api";
50
52
  const cookie = options.request.headers.get("cookie") || "";
51
- const res = await fetch(`${apiPath}/globals/${slug}`, {
53
+ const res = await fetch(`${apiPath}/globals/${slug}${draft ? '?draft=true' : ''}`, {
52
54
  headers: { Cookie: cookie },
53
55
  });
54
56
  if (res.ok) {
@@ -93,7 +95,7 @@ export async function getGlobal(slug: string, options?: GlobalOptions) {
93
95
  const doc = await db.findOne({
94
96
  collection: `_globals_${slug}`,
95
97
  where: {},
96
- draft: options?.draft ?? false,
98
+ draft,
97
99
  });
98
100
  if (!doc) return null;
99
101
 
@@ -1,7 +1,10 @@
1
- ---
2
1
  import AuthLayout from "../../layouts/AuthLayout.astro";
3
2
 
4
3
  import { adminPath, apiPath } from "../../lib/paths";
4
+ import { getSiteSettings } from "../../lib/globals";
5
+
6
+ const siteSettings = await getSiteSettings({ request: Astro.request });
7
+ const siteName = siteSettings?.siteName || "Kyro CMS";
5
8
  ---
6
9
 
7
10
  <AuthLayout title="Create Account">
@@ -13,7 +16,7 @@ import { adminPath, apiPath } from "../../lib/paths";
13
16
  Create your account
14
17
  </h1>
15
18
  <p class="text-sm text-[var(--kyro-text-secondary)] mt-2">
16
- Get started with Kyro CMS
19
+ Get started with {siteName}
17
20
  </p>
18
21
  </div>
19
22