@kyro-cms/admin 0.3.2 → 0.3.4
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/EditorClient-XEUOVAAC.js +466 -0
- package/dist/EditorClient-XEUOVAAC.js.map +1 -0
- package/dist/EditorClient-YLCGVDXY.cjs +468 -0
- package/dist/EditorClient-YLCGVDXY.cjs.map +1 -0
- package/dist/chunk-7KPIUCGT.js +384 -0
- package/dist/chunk-7KPIUCGT.js.map +1 -0
- package/dist/chunk-GOACG6R7.cjs +473 -0
- package/dist/chunk-GOACG6R7.cjs.map +1 -0
- package/dist/index.cjs +14861 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.css +1661 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.ts +563 -0
- package/dist/index.js +14784 -0
- package/dist/index.js.map +1 -0
- package/package.json +19 -19
- package/src/components/ActionBar.tsx +7 -43
- package/src/components/Admin.tsx +138 -277
- package/src/components/ApiKeysManager.tsx +428 -419
- package/src/components/AuditLogsPage.tsx +35 -39
- package/src/components/AuthBridge.tsx +51 -0
- package/src/components/AutoForm.tsx +495 -1230
- package/src/components/BrandingHub.tsx +18 -19
- package/src/components/BulkActionsBar.tsx +1 -1
- package/src/components/CreateView.tsx +22 -36
- package/src/components/Dashboard.tsx +60 -84
- package/src/components/DetailView.tsx +113 -91
- package/src/components/DeveloperCenter.tsx +200 -198
- package/src/components/FieldRenderer.tsx +206 -0
- package/src/components/GraphQLPlayground.tsx +340 -480
- package/src/components/ListView.tsx +828 -254
- package/src/components/LoginPage.tsx +3 -4
- package/src/components/MarketplaceManager.tsx +254 -0
- package/src/components/MediaGallery.tsx +856 -1192
- package/src/components/PluginsManager.tsx +277 -0
- package/src/components/RestPlayground.tsx +398 -560
- package/src/components/SessionsManager.tsx +211 -0
- package/src/components/Sidebar.astro +179 -151
- package/src/components/ThemeProvider.tsx +7 -161
- package/src/components/UserManagement.tsx +162 -146
- package/src/components/UserMenu.tsx +110 -0
- package/src/components/WebhookManager.tsx +305 -367
- package/src/components/blocks/AccordionBlock.tsx +4 -4
- package/src/components/blocks/ArrayBlock.tsx +3 -3
- package/src/components/blocks/BlockEditModal.tsx +8 -8
- package/src/components/blocks/BlockWrapper.tsx +61 -0
- package/src/components/blocks/ButtonBlock.tsx +4 -4
- package/src/components/blocks/ChildBlocksTree.tsx +23 -25
- package/src/components/blocks/CodeBlock.tsx +15 -15
- package/src/components/blocks/ColumnsBlock.tsx +6 -44
- package/src/components/blocks/DividerBlock.tsx +3 -3
- package/src/components/blocks/FileBlock.tsx +4 -4
- package/src/components/blocks/HeadingBlock.tsx +6 -38
- package/src/components/blocks/HeroBlock.tsx +4 -4
- package/src/components/blocks/ImageBlock.tsx +4 -4
- package/src/components/blocks/LinkBlock.tsx +4 -4
- package/src/components/blocks/ListBlock.tsx +3 -3
- package/src/components/blocks/ParagraphBlock.tsx +12 -42
- package/src/components/blocks/RelationshipBlock.tsx +4 -4
- package/src/components/blocks/RichTextBlock.tsx +4 -4
- package/src/components/blocks/VStackBlock.tsx +5 -37
- package/src/components/blocks/VideoBlock.tsx +4 -4
- package/src/components/blocks/types.ts +11 -0
- package/src/components/fields/AccordionField.tsx +1 -1
- package/src/components/fields/ArrayField.tsx +2 -2
- package/src/components/fields/ArrayLayout.tsx +93 -0
- package/src/components/fields/BlocksField.tsx +122 -111
- package/src/components/fields/ButtonField.tsx +1 -1
- package/src/components/fields/CheckboxField.tsx +14 -15
- package/src/components/fields/ChildrenField.tsx +2 -2
- package/src/components/fields/CodeField.tsx +3 -3
- package/src/components/fields/ColumnsField.tsx +2 -2
- package/src/components/fields/DateField.tsx +13 -26
- package/src/components/fields/EditorClient.tsx +26 -28
- package/src/components/fields/FieldLayout.tsx +52 -0
- package/src/components/fields/GroupLayout.tsx +35 -0
- package/src/components/fields/JSONField.tsx +7 -7
- package/src/components/fields/LinkField.tsx +1 -1
- package/src/components/fields/MarkdownField.tsx +1 -1
- package/src/components/fields/NumberField.tsx +13 -26
- package/src/components/fields/PortableTextField.tsx +4 -4
- package/src/components/fields/PortableTextRenderer.tsx +1 -1
- package/src/components/fields/RelationshipBlockField.tsx +31 -23
- package/src/components/fields/RelationshipField.tsx +14 -14
- package/src/components/fields/SelectField.tsx +17 -26
- package/src/components/fields/TabsLayout.tsx +69 -0
- package/src/components/fields/TextField.tsx +85 -38
- package/src/components/fields/UploadField.tsx +71 -41
- package/src/components/fields/VideoField.tsx +1 -1
- package/src/components/fields/extensions/blockComponents.tsx +2 -2
- package/src/components/fields/extensions/blocksStore.ts +207 -193
- package/src/components/fields/types.ts +22 -0
- package/src/components/layout/Layout.tsx +1 -1
- package/src/components/ui/ActionMenu.tsx +63 -0
- package/src/components/ui/Badge.tsx +59 -5
- package/src/components/ui/BlockDrawer.tsx +4 -5
- package/src/components/ui/CommandPalette.tsx +58 -36
- package/src/components/ui/CommandPaletteWrapper.tsx +18 -17
- package/src/components/ui/Dropdown.tsx +18 -16
- package/src/components/ui/EmptyState.tsx +25 -0
- package/src/components/ui/GlobalModal.tsx +49 -0
- package/src/components/ui/IconButton.tsx +44 -0
- package/src/components/ui/Modal.tsx +19 -20
- package/src/components/ui/PageHeader.tsx +158 -0
- package/src/components/ui/Pagination.tsx +61 -0
- package/src/components/ui/PromptModal.tsx +1 -1
- package/src/components/ui/SearchInput.tsx +57 -0
- package/src/components/ui/SeoPreview.tsx +31 -0
- package/src/components/ui/SessionModal.tsx +0 -0
- package/src/components/ui/SlidePanel.tsx +2 -0
- package/src/components/ui/Toast.tsx +65 -122
- package/src/components/ui/Toaster.tsx +18 -0
- package/src/components/ui/icons.tsx +112 -0
- package/src/components/users/UserDetail.tsx +290 -0
- package/src/components/users/UserForm.tsx +242 -0
- package/src/components/users/UsersList.tsx +338 -0
- package/src/env.d.ts +13 -13
- package/src/fields/index.ts +2 -1
- package/src/global.d.ts +7 -0
- package/src/hooks/data.ts +2 -9
- package/src/hooks/useAsyncData.ts +36 -0
- package/src/hooks/useAutoFormState.ts +527 -0
- package/src/hooks/useSelection.ts +49 -0
- package/src/hooks/useSession.ts +0 -0
- package/src/index.ts +11 -1
- package/src/integration.ts +86 -11
- package/src/kyro-cms.d.ts +209 -0
- package/src/layouts/AdminLayout.astro +128 -11
- package/src/layouts/AuthLayout.astro +21 -5
- package/src/lib/api.ts +175 -55
- package/src/lib/autoform-store.ts +435 -0
- package/src/lib/config.ts +82 -34
- package/src/lib/createRegistry.ts +29 -0
- package/src/lib/default-kyro-config.ts +4 -0
- package/src/lib/globals.ts +50 -0
- package/src/lib/media-utils.ts +18 -0
- package/src/lib/object-utils.ts +77 -0
- package/src/lib/paths.ts +61 -0
- package/src/lib/stores/index.ts +370 -0
- package/src/lib/types.ts +43 -0
- package/src/lib/useResourceManager.ts +105 -0
- package/src/pages/403.astro +67 -0
- package/src/pages/[collection]/[id].astro +14 -180
- package/src/pages/[collection]/index.astro +11 -6
- package/src/pages/api-explorer.astro +173 -0
- package/src/pages/audit/index.astro +2 -0
- package/src/pages/auth/login.astro +122 -0
- package/src/pages/auth/register.astro +167 -0
- package/src/pages/graphql-explorer.astro +59 -0
- package/src/pages/{admin/graphql.astro → graphql.astro} +51 -17
- package/src/pages/index.astro +577 -0
- package/src/pages/index_ALT.astro +3 -0
- package/src/pages/keys.astro +11 -0
- package/src/pages/marketplace.astro +11 -0
- package/src/pages/media.astro +3 -0
- package/src/pages/plugins.astro +8 -0
- package/src/pages/preview/[collection]/[id].astro +188 -123
- package/src/pages/rest-playground.astro +62 -0
- package/src/pages/roles/index.astro +183 -76
- package/src/pages/sessions.astro +8 -0
- package/src/pages/settings/[slug].astro +92 -114
- package/src/pages/settings/index.astro +5 -3
- package/src/pages/users/[id].astro +25 -154
- package/src/pages/users/index.astro +19 -130
- package/src/pages/users/new.astro +9 -86
- package/src/pages/webhooks.astro +11 -0
- package/src/routes.ts +80 -0
- package/src/styles/main.css +119 -79
- package/src/theme/tokens.ts +1 -0
- package/src/vite-env.d.ts +14 -0
- package/src/collections/auth/index.ts +0 -155
- package/src/collections/portfolio/index.ts +0 -343
- package/src/components/ApiExplorer.tsx +0 -325
- package/src/components/EnhancedListView.tsx +0 -889
- package/src/components/GraphQLExplorer.tsx +0 -675
- package/src/components/Icons.tsx +0 -23
- package/src/components/StatusBadge.tsx +0 -76
- package/src/lib/MediaService.ts +0 -541
- package/src/lib/auth/sqlite-adapter.ts +0 -319
- package/src/lib/dataStore.ts +0 -226
- package/src/lib/db/adapter.ts +0 -54
- package/src/lib/db/drizzle-mysql-adapter.ts +0 -194
- package/src/lib/db/drizzle-mysql-auth-adapter.ts +0 -327
- package/src/lib/db/drizzle-postgres-adapter.ts +0 -202
- package/src/lib/db/drizzle-postgres-auth-adapter.ts +0 -304
- package/src/lib/db/drizzle-sqlite-adapter.ts +0 -227
- package/src/lib/db/drizzle-sqlite-auth-adapter.ts +0 -548
- package/src/lib/db/index.ts +0 -449
- package/src/lib/db/mongodb-adapter.ts +0 -207
- package/src/lib/db/mongodb-auth-adapter.ts +0 -305
- package/src/lib/db/schema/mysql-auth.ts +0 -113
- package/src/lib/db/schema/mysql-content.ts +0 -20
- package/src/lib/db/schema/postgres-auth.ts +0 -116
- package/src/lib/db/schema/postgres-content.ts +0 -35
- package/src/lib/db/schema/postgres-media.ts +0 -52
- package/src/lib/db/schema/postgres-settings.ts +0 -11
- package/src/lib/db/schema/sqlite-auth.ts +0 -112
- package/src/lib/db/schema/sqlite-content.ts +0 -20
- package/src/lib/db/version-adapter.ts +0 -248
- package/src/lib/graphql/index.ts +0 -1
- package/src/lib/graphql/schema.ts +0 -443
- package/src/lib/rate-limit.ts +0 -267
- package/src/lib/storage.ts +0 -374
- package/src/lib/store.ts +0 -85
- package/src/middleware.ts +0 -177
- package/src/pages/admin/api-explorer.astro +0 -98
- package/src/pages/admin/graphql-explorer.astro +0 -40
- package/src/pages/admin/index.astro +0 -286
- package/src/pages/admin/keys.astro +0 -8
- package/src/pages/admin/rest-playground.astro +0 -44
- package/src/pages/admin/webhooks.astro +0 -8
- package/src/pages/api/[collection]/[id]/publish.ts +0 -52
- package/src/pages/api/[collection]/[id]/unpublish.ts +0 -42
- package/src/pages/api/[collection]/[id]/versions.ts +0 -66
- package/src/pages/api/[collection]/[id].ts +0 -213
- package/src/pages/api/[collection]/index.ts +0 -209
- package/src/pages/api/auth/[id].ts +0 -121
- package/src/pages/api/auth/audit-logs.ts +0 -57
- package/src/pages/api/auth/login.ts +0 -211
- package/src/pages/api/auth/logout.ts +0 -66
- package/src/pages/api/auth/me.ts +0 -36
- package/src/pages/api/auth/refresh.ts +0 -119
- package/src/pages/api/auth/register.ts +0 -188
- package/src/pages/api/auth/users.ts +0 -97
- package/src/pages/api/collections.ts +0 -59
- package/src/pages/api/globals/[slug].ts +0 -42
- package/src/pages/api/graphql.ts +0 -90
- package/src/pages/api/health.ts +0 -426
- package/src/pages/api/keys/[id].ts +0 -26
- package/src/pages/api/keys/index.ts +0 -75
- package/src/pages/api/media/[id].ts +0 -309
- package/src/pages/api/media/folders.ts +0 -609
- package/src/pages/api/media/index.ts +0 -146
- package/src/pages/api/media/resize.ts +0 -267
- package/src/pages/api/search.ts +0 -82
- package/src/pages/api/slug-availability.ts +0 -70
- package/src/pages/api/storage-config.ts +0 -20
- package/src/pages/api/storage-status.ts +0 -206
- package/src/pages/api/upload.ts +0 -334
- package/src/pages/api/webhooks/index.ts +0 -71
- package/src/pages/login.astro +0 -82
- package/src/pages/register.astro +0 -102
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { Field } from "@kyro-cms/core/client";
|
|
3
|
+
import { UploadField } from "./fields/UploadField";
|
|
4
|
+
import { CodeField } from "./fields";
|
|
5
|
+
import NumberField from "./fields/NumberField";
|
|
6
|
+
import CheckboxField from "./fields/CheckboxField";
|
|
7
|
+
import SelectField from "./fields/SelectField";
|
|
8
|
+
import DateField from "./fields/DateField";
|
|
9
|
+
import { MarkdownField } from "./fields/MarkdownField";
|
|
10
|
+
import TextField from "./fields/TextField";
|
|
11
|
+
import { BlocksField } from "./fields/BlocksField";
|
|
12
|
+
import PortableTextField from "./fields/PortableTextField";
|
|
13
|
+
import { ListField } from "./fields/ListField";
|
|
14
|
+
import RelationshipField from "./fields/RelationshipField";
|
|
15
|
+
import FieldLayout from "./fields/FieldLayout";
|
|
16
|
+
|
|
17
|
+
interface FieldRendererProps {
|
|
18
|
+
field: Field;
|
|
19
|
+
value: any;
|
|
20
|
+
onChange: (value: any) => void;
|
|
21
|
+
error?: string;
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const FieldRenderer: React.FC<FieldRendererProps> = ({
|
|
26
|
+
field,
|
|
27
|
+
value,
|
|
28
|
+
onChange,
|
|
29
|
+
error,
|
|
30
|
+
disabled,
|
|
31
|
+
}) => {
|
|
32
|
+
if (field.admin?.hidden) return null;
|
|
33
|
+
|
|
34
|
+
switch (field.type) {
|
|
35
|
+
case "text":
|
|
36
|
+
case "email":
|
|
37
|
+
case "url":
|
|
38
|
+
return (
|
|
39
|
+
<TextField
|
|
40
|
+
field={field as any}
|
|
41
|
+
value={value}
|
|
42
|
+
onChange={onChange}
|
|
43
|
+
error={error}
|
|
44
|
+
disabled={disabled}
|
|
45
|
+
/>
|
|
46
|
+
);
|
|
47
|
+
case "textarea":
|
|
48
|
+
return (
|
|
49
|
+
<TextField
|
|
50
|
+
field={{ ...field, variant: "textarea" } as any}
|
|
51
|
+
value={value}
|
|
52
|
+
onChange={onChange}
|
|
53
|
+
error={error}
|
|
54
|
+
disabled={disabled}
|
|
55
|
+
/>
|
|
56
|
+
);
|
|
57
|
+
case "password":
|
|
58
|
+
return (
|
|
59
|
+
<TextField
|
|
60
|
+
field={{ ...field, variant: "password" } as any}
|
|
61
|
+
value={value}
|
|
62
|
+
onChange={onChange}
|
|
63
|
+
error={error}
|
|
64
|
+
disabled={disabled}
|
|
65
|
+
/>
|
|
66
|
+
);
|
|
67
|
+
case "number":
|
|
68
|
+
return (
|
|
69
|
+
<NumberField
|
|
70
|
+
field={field as any}
|
|
71
|
+
value={value}
|
|
72
|
+
onChange={onChange}
|
|
73
|
+
disabled={disabled}
|
|
74
|
+
error={error}
|
|
75
|
+
/>
|
|
76
|
+
);
|
|
77
|
+
case "checkbox":
|
|
78
|
+
return (
|
|
79
|
+
<CheckboxField
|
|
80
|
+
field={field as any}
|
|
81
|
+
value={value}
|
|
82
|
+
onChange={onChange}
|
|
83
|
+
disabled={disabled}
|
|
84
|
+
error={error}
|
|
85
|
+
/>
|
|
86
|
+
);
|
|
87
|
+
case "select":
|
|
88
|
+
return (
|
|
89
|
+
<SelectField
|
|
90
|
+
field={field as any}
|
|
91
|
+
value={value}
|
|
92
|
+
onChange={onChange}
|
|
93
|
+
disabled={disabled}
|
|
94
|
+
error={error}
|
|
95
|
+
/>
|
|
96
|
+
);
|
|
97
|
+
case "date":
|
|
98
|
+
return (
|
|
99
|
+
<DateField
|
|
100
|
+
field={field as any}
|
|
101
|
+
value={value}
|
|
102
|
+
onChange={onChange}
|
|
103
|
+
disabled={disabled}
|
|
104
|
+
error={error}
|
|
105
|
+
/>
|
|
106
|
+
);
|
|
107
|
+
case "richtext":
|
|
108
|
+
return (field as any).hasBlocks === false ? (
|
|
109
|
+
<PortableTextField
|
|
110
|
+
field={field as any}
|
|
111
|
+
value={value}
|
|
112
|
+
onChange={onChange}
|
|
113
|
+
disabled={disabled}
|
|
114
|
+
error={error}
|
|
115
|
+
/>
|
|
116
|
+
) : (
|
|
117
|
+
<BlocksField
|
|
118
|
+
field={field as any}
|
|
119
|
+
value={value}
|
|
120
|
+
onChange={onChange}
|
|
121
|
+
disabled={disabled}
|
|
122
|
+
error={error}
|
|
123
|
+
/>
|
|
124
|
+
);
|
|
125
|
+
case "markdown":
|
|
126
|
+
return (
|
|
127
|
+
<MarkdownField
|
|
128
|
+
field={field as any}
|
|
129
|
+
value={value}
|
|
130
|
+
onChange={onChange}
|
|
131
|
+
disabled={disabled}
|
|
132
|
+
error={error}
|
|
133
|
+
/>
|
|
134
|
+
);
|
|
135
|
+
case "code":
|
|
136
|
+
return (
|
|
137
|
+
<CodeField
|
|
138
|
+
field={field as any}
|
|
139
|
+
value={value}
|
|
140
|
+
onChange={onChange}
|
|
141
|
+
disabled={disabled}
|
|
142
|
+
error={error}
|
|
143
|
+
/>
|
|
144
|
+
);
|
|
145
|
+
case "image":
|
|
146
|
+
case "upload":
|
|
147
|
+
return (
|
|
148
|
+
<FieldLayout field={field} error={error}>
|
|
149
|
+
<UploadField
|
|
150
|
+
field={field as any}
|
|
151
|
+
value={value}
|
|
152
|
+
onChange={onChange}
|
|
153
|
+
disabled={disabled}
|
|
154
|
+
/>
|
|
155
|
+
</FieldLayout>
|
|
156
|
+
);
|
|
157
|
+
case "relationship":
|
|
158
|
+
return (
|
|
159
|
+
<RelationshipField
|
|
160
|
+
field={field as any}
|
|
161
|
+
value={value}
|
|
162
|
+
onChange={onChange}
|
|
163
|
+
disabled={disabled}
|
|
164
|
+
error={error}
|
|
165
|
+
/>
|
|
166
|
+
);
|
|
167
|
+
case "list":
|
|
168
|
+
return (
|
|
169
|
+
<FieldLayout field={field} error={error}>
|
|
170
|
+
<ListField
|
|
171
|
+
items={Array.isArray(value) ? value : []}
|
|
172
|
+
onChange={onChange}
|
|
173
|
+
compact
|
|
174
|
+
/>
|
|
175
|
+
</FieldLayout>
|
|
176
|
+
);
|
|
177
|
+
case "color":
|
|
178
|
+
return (
|
|
179
|
+
<FieldLayout field={field} error={error}>
|
|
180
|
+
<div className="flex items-center gap-3">
|
|
181
|
+
<input
|
|
182
|
+
type="color"
|
|
183
|
+
value={value || "#000000"}
|
|
184
|
+
onChange={(e) => onChange(e.target.value)}
|
|
185
|
+
disabled={disabled}
|
|
186
|
+
className="h-10 w-14 p-1 cursor-pointer bg-[var(--kyro-input-bg)] border border-[var(--kyro-input-border)] rounded-lg"
|
|
187
|
+
/>
|
|
188
|
+
<input
|
|
189
|
+
type="text"
|
|
190
|
+
className="kyro-form-input font-mono "
|
|
191
|
+
value={value || ""}
|
|
192
|
+
onChange={(e) => onChange(e.target.value)}
|
|
193
|
+
disabled={disabled}
|
|
194
|
+
placeholder="#000000"
|
|
195
|
+
/>
|
|
196
|
+
</div>
|
|
197
|
+
</FieldLayout>
|
|
198
|
+
);
|
|
199
|
+
default:
|
|
200
|
+
return (
|
|
201
|
+
<div className="p-4 bg-amber-50 border border-amber-200 rounded-lg text-amber-800 text-xs italic">
|
|
202
|
+
Field type "{field.type}" is not yet supported in this renderer.
|
|
203
|
+
</div>
|
|
204
|
+
);
|
|
205
|
+
}
|
|
206
|
+
};
|