@kyro-cms/admin 0.1.6 → 0.1.7
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/README.md +149 -51
- package/package.json +53 -6
- package/src/collections/auth/index.ts +2 -2
- package/src/collections/portfolio/index.ts +343 -0
- package/src/components/ActionBar.tsx +153 -16
- package/src/components/Admin.tsx +136 -27
- package/src/components/ApiExplorer.tsx +325 -0
- package/src/components/ApiKeysManager.tsx +563 -0
- package/src/components/AuditLogsPage.tsx +664 -0
- package/src/components/AutoForm.tsx +1417 -661
- package/src/components/BrandingHub.tsx +267 -0
- package/src/components/BulkActionsBar.tsx +3 -3
- package/src/components/CreateView.tsx +3 -3
- package/src/components/Dashboard.tsx +393 -0
- package/src/components/DetailView.tsx +199 -57
- package/src/components/DeveloperCenter.tsx +403 -0
- package/src/components/EnhancedListView.tsx +786 -0
- package/src/components/GraphQLExplorer.tsx +675 -0
- package/src/components/GraphQLPlayground.tsx +627 -0
- package/src/components/ListView.tsx +191 -53
- package/src/components/MediaGallery.tsx +1569 -0
- package/src/components/Modal.tsx +149 -0
- package/src/components/RestPlayground.tsx +951 -0
- package/src/components/Sidebar.astro +237 -0
- package/src/components/UserManagement.tsx +204 -0
- package/src/components/VersionHistoryPanel.tsx +3 -3
- package/src/components/WebhookManager.tsx +608 -0
- package/src/components/blocks/AccordionBlock.tsx +97 -0
- package/src/components/blocks/ArrayBlock.tsx +75 -0
- package/src/components/blocks/BlockEditModal.MARKER +12 -0
- package/src/components/blocks/BlockEditModal.tsx +774 -0
- package/src/components/blocks/ButtonBlock.tsx +165 -0
- package/src/components/blocks/ChildBlocksTree.tsx +551 -0
- package/src/components/blocks/CodeBlock.tsx +66 -0
- package/src/components/blocks/ColumnsBlock.tsx +151 -0
- package/src/components/blocks/DividerBlock.tsx +43 -0
- package/src/components/blocks/FileBlock.tsx +64 -0
- package/src/components/blocks/HeadingBlock.tsx +81 -0
- package/src/components/blocks/HeroBlock.tsx +157 -0
- package/src/components/blocks/ImageBlock.tsx +83 -0
- package/src/components/blocks/LinkBlock.tsx +71 -0
- package/src/components/blocks/ListBlock.tsx +39 -0
- package/src/components/blocks/ParagraphBlock.tsx +61 -0
- package/src/components/blocks/RelationshipBlock.tsx +279 -0
- package/src/components/blocks/VStackBlock.tsx +75 -0
- package/src/components/blocks/VideoBlock.tsx +45 -0
- package/src/components/blocks/index.ts +10 -0
- package/src/components/fields/BlocksField.tsx +323 -0
- package/src/components/fields/CheckboxField.tsx +15 -9
- package/src/components/fields/CodeField.tsx +234 -0
- package/src/components/fields/DateField.tsx +38 -11
- package/src/components/fields/EditorClient.tsx +271 -0
- package/src/components/fields/FileField.tsx +390 -0
- package/src/components/fields/HybridContentField.tsx +109 -0
- package/src/components/fields/ImageField.tsx +429 -0
- package/src/components/fields/JSONField.tsx +361 -0
- package/src/components/fields/MarkdownField.tsx +282 -0
- package/src/components/fields/NumberField.tsx +42 -12
- package/src/components/fields/PortableTextField.tsx +143 -0
- package/src/components/fields/PortableTextRenderer.tsx +68 -0
- package/src/components/fields/RelationshipField.tsx +231 -59
- package/src/components/fields/SelectField.tsx +25 -15
- package/src/components/fields/TextField.tsx +45 -14
- package/src/components/fields/extensions/blockComponents.tsx +237 -0
- package/src/components/fields/extensions/blocksStore.ts +273 -0
- package/src/components/fields/index.ts +13 -0
- package/src/components/index.ts +1 -2
- package/src/components/layout/Header.tsx +2 -2
- package/src/components/layout/Layout.tsx +2 -2
- package/src/components/ui/Badge.tsx +9 -4
- package/src/components/ui/BlockDrawer.tsx +79 -0
- package/src/components/ui/Button.tsx +1 -1
- package/src/components/ui/CommandPalette.tsx +362 -0
- package/src/components/ui/CommandPaletteWrapper.tsx +97 -0
- package/src/components/ui/Dropdown.tsx +1 -1
- package/src/components/ui/Modal.tsx +37 -12
- package/src/components/ui/PromptModal.tsx +94 -0
- package/src/components/ui/SlidePanel.tsx +43 -16
- package/src/components/ui/Toast.tsx +80 -14
- package/src/env.d.ts +16 -0
- package/src/env.ts +20 -0
- package/src/index.ts +0 -1
- package/src/layouts/AdminLayout.astro +164 -170
- package/src/layouts/AuthLayout.astro +23 -6
- package/src/lib/MediaService.ts +541 -0
- package/src/lib/auth/sqlite-adapter.ts +319 -0
- package/src/lib/config.ts +22 -6
- package/src/lib/dataStore.ts +132 -74
- package/src/lib/db/adapter.ts +54 -0
- package/src/lib/db/drizzle-mysql-adapter.ts +194 -0
- package/src/lib/db/drizzle-mysql-auth-adapter.ts +327 -0
- package/src/lib/db/drizzle-postgres-adapter.ts +202 -0
- package/src/lib/db/drizzle-postgres-auth-adapter.ts +304 -0
- package/src/lib/db/drizzle-sqlite-adapter.ts +227 -0
- package/src/lib/db/drizzle-sqlite-auth-adapter.ts +548 -0
- package/src/lib/db/index.ts +449 -0
- package/src/lib/db/mongodb-adapter.ts +207 -0
- package/src/lib/db/mongodb-auth-adapter.ts +305 -0
- package/src/lib/db/schema/mysql-auth.ts +113 -0
- package/src/lib/db/schema/mysql-content.ts +20 -0
- package/src/lib/db/schema/postgres-auth.ts +116 -0
- package/src/lib/db/schema/postgres-content.ts +35 -0
- package/src/lib/db/schema/postgres-media.ts +52 -0
- package/src/lib/db/schema/postgres-settings.ts +11 -0
- package/src/lib/db/schema/sqlite-auth.ts +112 -0
- package/src/lib/db/schema/sqlite-content.ts +20 -0
- package/src/lib/graphql/index.ts +1 -0
- package/src/lib/graphql/schema.ts +443 -0
- package/src/lib/rate-limit.ts +267 -0
- package/src/lib/storage.ts +374 -0
- package/src/lib/store.ts +85 -0
- package/src/middleware.ts +70 -11
- package/src/pages/[collection]/[id].astro +178 -122
- package/src/pages/[collection]/index.astro +24 -156
- package/src/pages/admin/api-explorer.astro +98 -0
- package/src/pages/admin/graphql-explorer.astro +40 -0
- package/src/pages/admin/graphql.astro +97 -0
- package/src/pages/admin/index.astro +200 -139
- package/src/pages/admin/keys.astro +8 -0
- package/src/pages/admin/rest-playground.astro +44 -0
- package/src/pages/admin/webhooks.astro +8 -0
- package/src/pages/api/[collection]/[id]/publish.ts +44 -0
- package/src/pages/api/[collection]/[id]/unpublish.ts +42 -0
- package/src/pages/api/[collection]/[id]/versions.ts +36 -0
- package/src/pages/api/[collection]/[id].ts +102 -159
- package/src/pages/api/[collection]/index.ts +151 -230
- package/src/pages/api/auth/[id].ts +48 -69
- package/src/pages/api/auth/audit-logs.ts +20 -43
- package/src/pages/api/auth/login.ts +159 -45
- package/src/pages/api/auth/logout.ts +42 -24
- package/src/pages/api/auth/refresh.ts +119 -0
- package/src/pages/api/auth/register.ts +110 -40
- package/src/pages/api/auth/users.ts +22 -97
- package/src/pages/api/collections.ts +59 -0
- package/src/pages/api/globals/[slug]/test.ts +172 -0
- package/src/pages/api/globals/[slug].ts +42 -0
- package/src/pages/api/graphql.ts +90 -0
- package/src/pages/api/health.ts +417 -40
- package/src/pages/api/keys/[id].ts +26 -0
- package/src/pages/api/keys/index.ts +75 -0
- package/src/pages/api/media/[id].ts +309 -0
- package/src/pages/api/media/folders.ts +609 -0
- package/src/pages/api/media/index.ts +146 -0
- package/src/pages/api/media/resize.ts +267 -0
- package/src/pages/api/search.ts +82 -0
- package/src/pages/api/slug-availability.ts +70 -0
- package/src/pages/api/storage-config.ts +20 -0
- package/src/pages/api/storage-status.ts +206 -0
- package/src/pages/api/upload.ts +334 -0
- package/src/pages/api/webhooks/index.ts +71 -0
- package/src/pages/audit/index.astro +2 -104
- package/src/pages/login.astro +11 -11
- package/src/pages/media.astro +10 -0
- package/src/pages/preview/[collection]/[id].astro +178 -0
- package/src/pages/register.astro +13 -13
- package/src/pages/roles/index.astro +21 -21
- package/src/pages/settings/[slug].astro +162 -0
- package/src/pages/settings/index.astro +9 -0
- package/src/pages/users/[id].astro +29 -21
- package/src/pages/users/index.astro +22 -17
- package/src/pages/users/new.astro +18 -17
- package/src/styles/main.css +553 -128
- package/src/components/layout/Sidebar.tsx +0 -497
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import {
|
|
3
|
+
useBlockById,
|
|
4
|
+
useBlockActions,
|
|
5
|
+
} from "../fields/extensions/blocksStore";
|
|
6
|
+
import { ChevronRight, X, ChevronDown, ChevronUp } from "lucide-react";
|
|
7
|
+
|
|
8
|
+
interface AccordionBlockProps {
|
|
9
|
+
block: any;
|
|
10
|
+
index: number;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const AccordionBlock: React.FC<AccordionBlockProps> = ({
|
|
14
|
+
block,
|
|
15
|
+
index,
|
|
16
|
+
}) => {
|
|
17
|
+
const blockData = useBlockById(block.id);
|
|
18
|
+
const { updateBlock, removeBlock, moveBlock } = useBlockActions();
|
|
19
|
+
const data = blockData?.data ?? block.data ?? {};
|
|
20
|
+
const items = Array.isArray(data.items) ? data.items : [];
|
|
21
|
+
const [openIndex, setOpenIndex] = React.useState<number | null>(0);
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<div className="block-accordion border border-[var(--kyro-border)] rounded-lg p-4 mb-4 relative group bg-[var(--kyro-surface)]">
|
|
25
|
+
<div className="flex items-center justify-between mb-4">
|
|
26
|
+
<div className="flex items-center gap-2">
|
|
27
|
+
<span className="text-sm font-medium text-[var(--kyro-text-primary)]">
|
|
28
|
+
Accordion
|
|
29
|
+
</span>
|
|
30
|
+
<span className="text-xs text-[var(--kyro-text-muted)]">
|
|
31
|
+
({items.length} items)
|
|
32
|
+
</span>
|
|
33
|
+
</div>
|
|
34
|
+
<div className="flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity">
|
|
35
|
+
<button
|
|
36
|
+
type="button"
|
|
37
|
+
onClick={() => moveBlock(block.id, "up")}
|
|
38
|
+
className="p-1.5 hover:bg-[var(--kyro-surface-accent)] rounded"
|
|
39
|
+
title="Move up"
|
|
40
|
+
>
|
|
41
|
+
<ChevronRight className="w-3.5 h-3.5 rotate-[-90deg] text-[var(--kyro-text-muted)]" />
|
|
42
|
+
</button>
|
|
43
|
+
<button
|
|
44
|
+
type="button"
|
|
45
|
+
onClick={() => moveBlock(block.id, "down")}
|
|
46
|
+
className="p-1.5 hover:bg-[var(--kyro-surface-accent)] rounded"
|
|
47
|
+
title="Move down"
|
|
48
|
+
>
|
|
49
|
+
<ChevronRight className="w-3.5 h-3.5 rotate-90 text-[var(--kyro-text-muted)]" />
|
|
50
|
+
</button>
|
|
51
|
+
<button
|
|
52
|
+
type="button"
|
|
53
|
+
onClick={() => removeBlock(block.id)}
|
|
54
|
+
className="p-1.5 hover:bg-red-50 rounded"
|
|
55
|
+
title="Remove"
|
|
56
|
+
>
|
|
57
|
+
<X className="w-3.5 h-3.5 text-red-500" />
|
|
58
|
+
</button>
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
|
|
62
|
+
<div className="space-y-2">
|
|
63
|
+
{items.map((item: any, i: number) => {
|
|
64
|
+
const isOpen = openIndex === i;
|
|
65
|
+
return (
|
|
66
|
+
<div
|
|
67
|
+
key={i}
|
|
68
|
+
className="border border-[var(--kyro-border)] rounded-lg overflow-hidden"
|
|
69
|
+
>
|
|
70
|
+
<button
|
|
71
|
+
type="button"
|
|
72
|
+
onClick={() => setOpenIndex(isOpen ? null : i)}
|
|
73
|
+
className="w-full flex items-center justify-between p-3 bg-[var(--kyro-surface-accent)] hover:bg-[var(--kyro-sidebar-active)]/10 transition-colors"
|
|
74
|
+
>
|
|
75
|
+
<span className="text-sm font-medium text-[var(--kyro-text-primary)]">
|
|
76
|
+
{item.title || `Item ${i + 1}`}
|
|
77
|
+
</span>
|
|
78
|
+
{isOpen ? (
|
|
79
|
+
<ChevronUp className="w-4 h-4 text-[var(--kyro-text-muted)]" />
|
|
80
|
+
) : (
|
|
81
|
+
<ChevronDown className="w-4 h-4 text-[var(--kyro-text-muted)]" />
|
|
82
|
+
)}
|
|
83
|
+
</button>
|
|
84
|
+
{isOpen && (
|
|
85
|
+
<div className="p-3 bg-[var(--kyro-surface)]">
|
|
86
|
+
<p className="text-sm text-[var(--kyro-text-primary)] whitespace-pre-wrap">
|
|
87
|
+
{item.content || "No content"}
|
|
88
|
+
</p>
|
|
89
|
+
</div>
|
|
90
|
+
)}
|
|
91
|
+
</div>
|
|
92
|
+
);
|
|
93
|
+
})}
|
|
94
|
+
</div>
|
|
95
|
+
</div>
|
|
96
|
+
);
|
|
97
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import {
|
|
3
|
+
useBlockById,
|
|
4
|
+
useBlockActions,
|
|
5
|
+
} from "../fields/extensions/blocksStore";
|
|
6
|
+
import { ChevronRight, X } from "lucide-react";
|
|
7
|
+
import { ChildBlocksTree } from "./ChildBlocksTree";
|
|
8
|
+
|
|
9
|
+
interface ArrayBlockProps {
|
|
10
|
+
block: any;
|
|
11
|
+
index: number;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const ArrayBlock: React.FC<ArrayBlockProps> = ({ block, index }) => {
|
|
15
|
+
const blockData = useBlockById(block.id);
|
|
16
|
+
const { updateBlock, removeBlock, moveBlock } = useBlockActions();
|
|
17
|
+
const data = blockData?.data ?? block.data ?? {};
|
|
18
|
+
const children = blockData?.children ?? block.children ?? [];
|
|
19
|
+
|
|
20
|
+
const handleUpdateChildren = (newChildren: any[]) => {
|
|
21
|
+
updateBlock(block.id, { children: newChildren });
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<div className="block-array border border-[var(--kyro-border)] rounded-lg p-4 mb-4 relative group bg-[var(--kyro-surface)]">
|
|
26
|
+
<div className="flex items-center justify-between mb-4">
|
|
27
|
+
<div className="flex items-center gap-2">
|
|
28
|
+
<span className="text-sm font-medium text-[var(--kyro-text-primary)]">
|
|
29
|
+
Repeater
|
|
30
|
+
</span>
|
|
31
|
+
<span className="text-xs text-[var(--kyro-text-muted)]">
|
|
32
|
+
({children.length} children)
|
|
33
|
+
</span>
|
|
34
|
+
</div>
|
|
35
|
+
<div className="flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity">
|
|
36
|
+
<button
|
|
37
|
+
type="button"
|
|
38
|
+
onClick={() => moveBlock(block.id, "up")}
|
|
39
|
+
className="p-1.5 hover:bg-[var(--kyro-surface-accent)] rounded"
|
|
40
|
+
title="Move up"
|
|
41
|
+
>
|
|
42
|
+
<ChevronRight className="w-3.5 h-3.5 rotate-[-90deg] text-[var(--kyro-text-muted)]" />
|
|
43
|
+
</button>
|
|
44
|
+
<button
|
|
45
|
+
type="button"
|
|
46
|
+
onClick={() => moveBlock(block.id, "down")}
|
|
47
|
+
className="p-1.5 hover:bg-[var(--kyro-surface-accent)] rounded"
|
|
48
|
+
title="Move down"
|
|
49
|
+
>
|
|
50
|
+
<ChevronRight className="w-3.5 h-3.5 rotate-90 text-[var(--kyro-text-muted)]" />
|
|
51
|
+
</button>
|
|
52
|
+
<button
|
|
53
|
+
type="button"
|
|
54
|
+
onClick={() => removeBlock(block.id)}
|
|
55
|
+
className="p-1.5 hover:bg-red-50 rounded"
|
|
56
|
+
title="Remove"
|
|
57
|
+
>
|
|
58
|
+
<X className="w-3.5 h-3.5 text-red-500" />
|
|
59
|
+
</button>
|
|
60
|
+
</div>
|
|
61
|
+
</div>
|
|
62
|
+
|
|
63
|
+
<div className="pt-4 border-t border-[var(--kyro-border)]">
|
|
64
|
+
<label className="text-xs font-medium text-[var(--kyro-text-muted)] mb-2 block">
|
|
65
|
+
Children
|
|
66
|
+
</label>
|
|
67
|
+
<ChildBlocksTree
|
|
68
|
+
blockId={block.id}
|
|
69
|
+
children={children}
|
|
70
|
+
onUpdateChildren={handleUpdateChildren}
|
|
71
|
+
/>
|
|
72
|
+
</div>
|
|
73
|
+
</div>
|
|
74
|
+
);
|
|
75
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# BlockEditModal Children Marker
|
|
2
|
+
# Created: 2026-04-29
|
|
3
|
+
#
|
|
4
|
+
# This marks the point where BlockEditModal was updated to include:
|
|
5
|
+
# - Children (via ChildBlocksTree) for array, vstack, accordion, columns, hero
|
|
6
|
+
# - Matching styling to original block components
|
|
7
|
+
#
|
|
8
|
+
# To revert:
|
|
9
|
+
# 1. Check git history for previous BlockEditModal.tsx
|
|
10
|
+
# 2. Or use: git show HEAD~1:admin/src/components/blocks/BlockEditModal.tsx > BlockEditModal.tsx
|
|
11
|
+
#
|
|
12
|
+
# Marker Line in code: // @MARKER: BlockEditModal with children - 2026-04-29
|