@kyro-cms/admin 0.9.0 → 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.
- package/dist/index.cjs +11715 -11292
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +67 -65
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +564 -0
- package/dist/index.d.ts +11 -10
- package/dist/index.js +11326 -10912
- package/dist/index.js.map +1 -1
- package/package.json +16 -12
- package/src/components/ActionBar.tsx +25 -161
- package/src/components/Admin.tsx +2 -4
- package/src/components/ApiKeysManager.tsx +5 -5
- package/src/components/AuditLogsPage.tsx +2 -13
- package/src/components/AutoForm.tsx +572 -461
- package/src/components/BrandingHub.tsx +7 -4
- package/src/components/CreateView.tsx +2 -0
- package/src/components/DetailView.tsx +52 -65
- package/src/components/DeveloperCenter.tsx +8 -6
- package/src/components/FieldRenderer.tsx +94 -19
- package/src/components/ListView.tsx +57 -216
- package/src/components/MediaGallery.tsx +334 -367
- package/src/components/PluginsManager.tsx +197 -70
- package/src/components/RestPlayground.tsx +59 -52
- package/src/components/SessionsManager.tsx +1 -1
- package/src/components/SettingsPage.tsx +22 -0
- package/src/components/Sidebar.astro +13 -41
- package/src/components/UserManagement.tsx +153 -15
- package/src/components/UserMenu.tsx +30 -4
- package/src/components/VersionHistoryPanel.tsx +112 -119
- package/src/components/WebhookManager.tsx +6 -4
- package/src/components/blocks/ArrayBlock.tsx +6 -23
- package/src/components/blocks/BlockEditModal.tsx +82 -309
- package/src/components/blocks/CardBlock.tsx +35 -0
- package/src/components/blocks/ChildBlocksTree.tsx +57 -31
- package/src/components/blocks/GenericBlock.tsx +44 -0
- package/src/components/blocks/HeadingSubheadingBlock.tsx +32 -0
- package/src/components/blocks/HeroBlock.tsx +5 -14
- package/src/components/blocks/RichTextBlock.tsx +5 -5
- package/src/components/blocks/index.ts +5 -3
- package/src/components/fields/AccordionField.tsx +2 -2
- package/src/components/fields/ArrayField.tsx +1 -1
- package/src/components/fields/ArrayLayout.tsx +120 -29
- package/src/components/fields/BlocksField.tsx +433 -55
- package/src/components/fields/CardField.tsx +73 -0
- package/src/components/fields/CheckboxField.tsx +7 -3
- package/src/components/fields/DateField.tsx +4 -1
- package/src/components/fields/GroupLayout.tsx +2 -2
- package/src/components/fields/HeadingSubheadingField.tsx +43 -0
- package/src/components/fields/ListField.tsx +2 -2
- package/src/components/fields/NumberField.tsx +4 -1
- package/src/components/fields/RelationshipBlockField.tsx +2 -3
- package/src/components/fields/RelationshipField.tsx +155 -90
- package/src/components/fields/RichTextField.tsx +781 -0
- package/src/components/fields/SecretField.tsx +102 -0
- package/src/components/fields/SelectField.tsx +19 -6
- package/src/components/fields/TabsLayout.tsx +19 -9
- package/src/components/fields/TextField.tsx +4 -1
- package/src/components/fields/UploadField.tsx +122 -56
- package/src/components/fields/extensions/blockComponents.tsx +103 -174
- package/src/components/fields/extensions/blocksStore.ts +8 -1
- package/src/components/fields/index.ts +4 -2
- package/src/components/fix_imports.cjs +23 -0
- package/src/components/fix_imports2.cjs +19 -0
- package/src/components/replace_svgs.cjs +63 -0
- package/src/components/ui/Dropdown.tsx +7 -2
- package/src/components/ui/Modal.tsx +24 -27
- package/src/components/ui/PageHeader.tsx +5 -5
- package/src/components/ui/PromptModal.tsx +2 -10
- package/src/components/ui/SlidePanel.tsx +10 -13
- package/src/components/ui/SplitButton.tsx +107 -0
- package/src/components/ui/Toaster.tsx +0 -1
- package/src/components/ui/icons.tsx +110 -109
- package/src/components/users/UserDetail.tsx +79 -16
- package/src/components/users/UsersList.tsx +8 -85
- package/src/hooks/useAutoFormState.ts +187 -196
- package/src/hooks/useQueue.ts +60 -0
- package/src/integration.ts +148 -46
- package/src/kyro-cms.d.ts +7 -2
- package/src/layouts/AdminLayout.astro +22 -2
- package/src/layouts/AuthLayout.astro +67 -7
- package/src/lib/autoform-store.ts +90 -53
- package/src/lib/change-source.ts +9 -0
- package/src/lib/config.ts +104 -8
- package/src/lib/globals.ts +48 -11
- package/src/lib/normalize-upload-fields.ts +41 -0
- package/src/lib/paths.ts +2 -2
- package/src/lib/resolve-field-value.ts +110 -0
- package/src/lib/shim/use-sync-external-store-with-selector.js +30 -0
- package/src/lib/shim/use-sync-external-store.js +1 -0
- package/src/lib/stores/index.ts +1 -0
- package/src/lib/useResourceManager.ts +4 -4
- package/src/lib/vite-shim-plugin.ts +100 -0
- package/src/pages/[collection]/[id].astro +1 -1
- package/src/pages/auth/register.astro +5 -2
- package/src/pages/preview/[collection]/[id].astro +4 -4
- package/src/pages/settings/[slug].astro +2 -2
- package/src/styles/main.css +60 -54
- package/README.md +0 -46
- package/dist/EditorClient-Q23UXR37.cjs +0 -468
- package/dist/EditorClient-Q23UXR37.cjs.map +0 -1
- package/dist/EditorClient-T5PASFNR.js +0 -466
- package/dist/EditorClient-T5PASFNR.js.map +0 -1
- package/dist/chunk-3BGDYKTD.cjs +0 -348
- package/dist/chunk-3BGDYKTD.cjs.map +0 -1
- package/dist/chunk-EEFXLQVT.js +0 -3
- package/dist/chunk-EEFXLQVT.js.map +0 -1
- package/src/components/blocks/ButtonBlock.tsx +0 -64
- package/src/components/blocks/ColumnsBlock.tsx +0 -55
- package/src/components/blocks/DividerBlock.tsx +0 -43
- package/src/components/blocks/LinkBlock.tsx +0 -65
- package/src/components/blocks/VStackBlock.tsx +0 -29
- package/src/components/fields/EditorClient.tsx +0 -535
- package/src/components/fields/PortableTextField.tsx +0 -155
- package/src/components/fields/PortableTextRenderer.tsx +0 -68
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,564 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { CollectionConfig, GlobalConfig, KyroConfig } from '@kyro-cms/core/client';
|
|
3
|
+
import * as React$1 from 'react';
|
|
4
|
+
import React__default, { ReactNode, ComponentType, SVGAttributes, ButtonHTMLAttributes } from 'react';
|
|
5
|
+
import { CollectionConfig as CollectionConfig$1, Block, Field, FieldType } from '@kyro-cms/core';
|
|
6
|
+
import { AstroIntegration } from 'astro';
|
|
7
|
+
|
|
8
|
+
interface ThemeColors {
|
|
9
|
+
primary?: string;
|
|
10
|
+
secondary?: string;
|
|
11
|
+
accent?: string;
|
|
12
|
+
background?: string;
|
|
13
|
+
surface?: string;
|
|
14
|
+
text?: string;
|
|
15
|
+
textMuted?: string;
|
|
16
|
+
border?: string;
|
|
17
|
+
success?: string;
|
|
18
|
+
error?: string;
|
|
19
|
+
warning?: string;
|
|
20
|
+
info?: string;
|
|
21
|
+
}
|
|
22
|
+
interface ThemeTypography {
|
|
23
|
+
fontFamily?: string;
|
|
24
|
+
fontFamilyMono?: string;
|
|
25
|
+
fontSize?: {
|
|
26
|
+
xs?: string;
|
|
27
|
+
sm?: string;
|
|
28
|
+
md?: string;
|
|
29
|
+
lg?: string;
|
|
30
|
+
xl?: string;
|
|
31
|
+
"2xl"?: string;
|
|
32
|
+
"3xl"?: string;
|
|
33
|
+
"4xl"?: string;
|
|
34
|
+
};
|
|
35
|
+
fontWeight?: {
|
|
36
|
+
normal?: number;
|
|
37
|
+
medium?: number;
|
|
38
|
+
semibold?: number;
|
|
39
|
+
bold?: number;
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
interface ThemeSpacing {
|
|
43
|
+
xs?: string;
|
|
44
|
+
sm?: string;
|
|
45
|
+
md?: string;
|
|
46
|
+
lg?: string;
|
|
47
|
+
xl?: string;
|
|
48
|
+
"2xl"?: string;
|
|
49
|
+
}
|
|
50
|
+
interface ThemeRadius {
|
|
51
|
+
sm?: string;
|
|
52
|
+
md?: string;
|
|
53
|
+
lg?: string;
|
|
54
|
+
full?: string;
|
|
55
|
+
}
|
|
56
|
+
interface ThemeShadows {
|
|
57
|
+
sm?: string;
|
|
58
|
+
md?: string;
|
|
59
|
+
lg?: string;
|
|
60
|
+
xl?: string;
|
|
61
|
+
}
|
|
62
|
+
interface BlockThemeOverrides {
|
|
63
|
+
card?: {
|
|
64
|
+
background?: string;
|
|
65
|
+
borderRadius?: string;
|
|
66
|
+
padding?: string;
|
|
67
|
+
shadow?: string;
|
|
68
|
+
};
|
|
69
|
+
hero?: {
|
|
70
|
+
background?: string;
|
|
71
|
+
textAlign?: "left" | "center" | "right";
|
|
72
|
+
};
|
|
73
|
+
gallery?: {
|
|
74
|
+
gridColumns?: number;
|
|
75
|
+
gap?: string;
|
|
76
|
+
};
|
|
77
|
+
code?: {
|
|
78
|
+
fontFamily?: string;
|
|
79
|
+
fontSize?: string;
|
|
80
|
+
background?: string;
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
interface FieldThemeOverrides {
|
|
84
|
+
input?: {
|
|
85
|
+
background?: string;
|
|
86
|
+
border?: string;
|
|
87
|
+
borderRadius?: string;
|
|
88
|
+
padding?: string;
|
|
89
|
+
focusRing?: string;
|
|
90
|
+
};
|
|
91
|
+
select?: {
|
|
92
|
+
background?: string;
|
|
93
|
+
border?: string;
|
|
94
|
+
};
|
|
95
|
+
textarea?: {
|
|
96
|
+
background?: string;
|
|
97
|
+
minHeight?: string;
|
|
98
|
+
};
|
|
99
|
+
richText?: {
|
|
100
|
+
toolbarBackground?: string;
|
|
101
|
+
buttonActive?: string;
|
|
102
|
+
};
|
|
103
|
+
upload?: {
|
|
104
|
+
dropzoneBackground?: string;
|
|
105
|
+
dropzoneActive?: string;
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
interface KyroTheme {
|
|
109
|
+
id?: string;
|
|
110
|
+
label?: string;
|
|
111
|
+
colors?: ThemeColors;
|
|
112
|
+
typography?: ThemeTypography;
|
|
113
|
+
spacing?: ThemeSpacing;
|
|
114
|
+
borderRadius?: ThemeRadius;
|
|
115
|
+
shadows?: ThemeShadows;
|
|
116
|
+
blocks?: BlockThemeOverrides;
|
|
117
|
+
fields?: FieldThemeOverrides;
|
|
118
|
+
}
|
|
119
|
+
declare const LIGHT_THEME: KyroTheme;
|
|
120
|
+
declare const DARK_THEME: KyroTheme;
|
|
121
|
+
declare function mergeThemes(base: KyroTheme, overrides: Partial<KyroTheme>): KyroTheme;
|
|
122
|
+
|
|
123
|
+
type ThemeMode = "light" | "dark" | "system";
|
|
124
|
+
interface ThemeContextValue {
|
|
125
|
+
mode: ThemeMode;
|
|
126
|
+
theme: KyroTheme;
|
|
127
|
+
lightTheme: KyroTheme;
|
|
128
|
+
darkTheme: KyroTheme;
|
|
129
|
+
setMode: (mode: ThemeMode) => void;
|
|
130
|
+
updateTheme: (overrides: Partial<KyroTheme>) => void;
|
|
131
|
+
getCssVar: (key: string) => string;
|
|
132
|
+
}
|
|
133
|
+
declare function useTheme(): ThemeContextValue;
|
|
134
|
+
interface ThemeProviderProps {
|
|
135
|
+
children: ReactNode;
|
|
136
|
+
defaultMode?: ThemeMode;
|
|
137
|
+
light?: Partial<KyroTheme>;
|
|
138
|
+
dark?: Partial<KyroTheme>;
|
|
139
|
+
}
|
|
140
|
+
declare function ThemeProvider({ children, defaultMode, light: lightOverrides, dark: darkOverrides, }: ThemeProviderProps): react_jsx_runtime.JSX.Element;
|
|
141
|
+
declare const LightThemeProvider: (props: Omit<ThemeProviderProps, "defaultMode">) => react_jsx_runtime.JSX.Element;
|
|
142
|
+
declare const DarkThemeProvider: (props: Omit<ThemeProviderProps, "defaultMode">) => react_jsx_runtime.JSX.Element;
|
|
143
|
+
|
|
144
|
+
interface KyroAdminConfig {
|
|
145
|
+
collections?: CollectionConfig[] | Record<string, CollectionConfig>;
|
|
146
|
+
globals?: GlobalConfig[] | Record<string, GlobalConfig>;
|
|
147
|
+
adapter?: unknown;
|
|
148
|
+
name?: string;
|
|
149
|
+
}
|
|
150
|
+
interface AdminProps {
|
|
151
|
+
config: KyroAdminConfig;
|
|
152
|
+
theme?: ThemeMode;
|
|
153
|
+
onThemeChange?: (mode: ThemeMode) => void;
|
|
154
|
+
}
|
|
155
|
+
declare function Admin({ config, theme, onThemeChange }: AdminProps): react_jsx_runtime.JSX.Element;
|
|
156
|
+
|
|
157
|
+
interface LoginPageProps {
|
|
158
|
+
onAuth: (token: string, user: Record<string, unknown>) => void;
|
|
159
|
+
theme?: ThemeMode;
|
|
160
|
+
}
|
|
161
|
+
declare function LoginPage({ onAuth, theme }: LoginPageProps): react_jsx_runtime.JSX.Element;
|
|
162
|
+
|
|
163
|
+
interface ListViewProps {
|
|
164
|
+
collection: CollectionConfig$1;
|
|
165
|
+
collectionSlug?: string;
|
|
166
|
+
initialDocs?: any[];
|
|
167
|
+
initialTotal?: number;
|
|
168
|
+
onCreate?: () => void;
|
|
169
|
+
onEdit?: (id: string) => void;
|
|
170
|
+
config?: any;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Unified ListView component used across both SPA (Admin.tsx) and MPA (Astro pages) modes.
|
|
174
|
+
*/
|
|
175
|
+
declare function ListView({ collection, collectionSlug: providedSlug, initialDocs, initialTotal, onCreate: providedOnCreate, onEdit: providedOnEdit, config, }: ListViewProps): react_jsx_runtime.JSX.Element;
|
|
176
|
+
|
|
177
|
+
interface DetailViewProps {
|
|
178
|
+
config: KyroConfig;
|
|
179
|
+
collection?: CollectionConfig;
|
|
180
|
+
global?: GlobalConfig;
|
|
181
|
+
documentId?: string;
|
|
182
|
+
onBack: () => void;
|
|
183
|
+
onSave: () => void;
|
|
184
|
+
onDelete?: () => void;
|
|
185
|
+
onError: (message: string) => void;
|
|
186
|
+
mode?: "collection" | "global";
|
|
187
|
+
}
|
|
188
|
+
declare function DetailView({ config, collection, global, documentId, onBack, onSave, onDelete, onError, mode, }: DetailViewProps): react_jsx_runtime.JSX.Element;
|
|
189
|
+
|
|
190
|
+
interface CreateViewProps {
|
|
191
|
+
config: KyroConfig;
|
|
192
|
+
collection: CollectionConfig;
|
|
193
|
+
onCancel: () => void;
|
|
194
|
+
onSuccess: () => void;
|
|
195
|
+
onError: (message: string) => void;
|
|
196
|
+
}
|
|
197
|
+
declare function CreateView({ config, collection, onCancel, onSuccess, onError, }: CreateViewProps): react_jsx_runtime.JSX.Element;
|
|
198
|
+
|
|
199
|
+
interface AutoFormProps {
|
|
200
|
+
config: CollectionConfig | GlobalConfig;
|
|
201
|
+
data?: Record<string, unknown>;
|
|
202
|
+
errors?: Record<string, string>;
|
|
203
|
+
onChange?: (data: Record<string, unknown>) => void;
|
|
204
|
+
disabled?: boolean;
|
|
205
|
+
collectionSlug?: string;
|
|
206
|
+
globalSlug?: string;
|
|
207
|
+
documentName?: string;
|
|
208
|
+
layout?: "split" | "single";
|
|
209
|
+
onActionSuccess?: (message: string) => void;
|
|
210
|
+
onActionError?: (message: string) => void;
|
|
211
|
+
justSaved?: boolean;
|
|
212
|
+
documentStatus?: string;
|
|
213
|
+
}
|
|
214
|
+
declare function AutoForm({ config: propConfig, data: initialData, errors, onChange, disabled: propDisabled, collectionSlug, globalSlug, documentName, layout, onActionSuccess, onActionError, justSaved, }: AutoFormProps): react_jsx_runtime.JSX.Element;
|
|
215
|
+
|
|
216
|
+
type DocumentStatus = "draft" | "published" | "scheduled" | "archived";
|
|
217
|
+
type SaveStatus = "idle" | "saving" | "saved" | "error";
|
|
218
|
+
interface ActionBarProps {
|
|
219
|
+
status: DocumentStatus;
|
|
220
|
+
saveStatus: SaveStatus;
|
|
221
|
+
hasChanges: boolean;
|
|
222
|
+
onSave: () => void;
|
|
223
|
+
onPublish?: () => void;
|
|
224
|
+
onUnpublish?: () => void;
|
|
225
|
+
onDuplicate?: () => void;
|
|
226
|
+
onViewHistory?: () => void;
|
|
227
|
+
onPreview?: () => void;
|
|
228
|
+
onDelete?: () => void;
|
|
229
|
+
publishedAt?: string | null;
|
|
230
|
+
updatedAt?: string | null;
|
|
231
|
+
}
|
|
232
|
+
declare function ActionBar({ status, saveStatus, hasChanges, onSave, onPublish, onUnpublish, onDuplicate, onViewHistory, onPreview, onDelete, publishedAt, updatedAt, }: ActionBarProps): react_jsx_runtime.JSX.Element;
|
|
233
|
+
|
|
234
|
+
interface BulkAction {
|
|
235
|
+
label: string;
|
|
236
|
+
onClick: () => void;
|
|
237
|
+
icon?: React__default.ReactNode;
|
|
238
|
+
danger?: boolean;
|
|
239
|
+
}
|
|
240
|
+
interface BulkActionsBarProps {
|
|
241
|
+
selectedCount: number;
|
|
242
|
+
onClearSelection: () => void;
|
|
243
|
+
actions: BulkAction[];
|
|
244
|
+
onSelectAll?: () => void;
|
|
245
|
+
}
|
|
246
|
+
declare function BulkActionsBar({ selectedCount, onClearSelection, actions, onSelectAll, }: BulkActionsBarProps): react_jsx_runtime.JSX.Element | null;
|
|
247
|
+
|
|
248
|
+
type BadgeVariant = "default" | "success" | "warning" | "danger" | "info" | "outline" | "draft" | "published" | "scheduled" | "archived" | "active" | "inactive" | "pending" | "completed" | "cancelled";
|
|
249
|
+
interface BadgeProps {
|
|
250
|
+
variant?: BadgeVariant;
|
|
251
|
+
status?: BadgeVariant;
|
|
252
|
+
className?: string;
|
|
253
|
+
children?: ReactNode;
|
|
254
|
+
dot?: boolean;
|
|
255
|
+
}
|
|
256
|
+
declare function Badge({ variant, status, className, children, dot, }: BadgeProps): react_jsx_runtime.JSX.Element;
|
|
257
|
+
declare function CountBadge({ count, max }: {
|
|
258
|
+
count: number;
|
|
259
|
+
max?: number;
|
|
260
|
+
}): react_jsx_runtime.JSX.Element | null;
|
|
261
|
+
|
|
262
|
+
interface Breadcrumb {
|
|
263
|
+
label: string;
|
|
264
|
+
href?: string;
|
|
265
|
+
onClick?: () => void;
|
|
266
|
+
}
|
|
267
|
+
interface Action {
|
|
268
|
+
label: string;
|
|
269
|
+
onClick: () => void;
|
|
270
|
+
icon?: ComponentType<SVGAttributes<SVGSVGElement>>;
|
|
271
|
+
variant?: "primary" | "outline" | "ghost";
|
|
272
|
+
className?: string;
|
|
273
|
+
}
|
|
274
|
+
interface PageHeaderProps {
|
|
275
|
+
title?: string;
|
|
276
|
+
description?: string;
|
|
277
|
+
icon?: ComponentType<SVGAttributes<SVGSVGElement>>;
|
|
278
|
+
breadcrumbs?: Breadcrumb[];
|
|
279
|
+
metadata?: ReactNode[];
|
|
280
|
+
back?: {
|
|
281
|
+
label?: string;
|
|
282
|
+
href?: string;
|
|
283
|
+
onClick?: () => void;
|
|
284
|
+
};
|
|
285
|
+
action?: Action;
|
|
286
|
+
actions?: ReactNode | Action[];
|
|
287
|
+
children?: ReactNode;
|
|
288
|
+
}
|
|
289
|
+
declare function PageHeader({ title, description, icon: Icon, breadcrumbs, metadata, back, action, actions, children, }: PageHeaderProps): react_jsx_runtime.JSX.Element;
|
|
290
|
+
|
|
291
|
+
interface Version {
|
|
292
|
+
id: string;
|
|
293
|
+
version: number;
|
|
294
|
+
createdAt: string;
|
|
295
|
+
updatedAt: string;
|
|
296
|
+
createdBy?: {
|
|
297
|
+
id: string;
|
|
298
|
+
name: string;
|
|
299
|
+
email?: string;
|
|
300
|
+
};
|
|
301
|
+
status: "draft" | "published";
|
|
302
|
+
changelog?: string;
|
|
303
|
+
}
|
|
304
|
+
interface VersionHistoryPanelProps {
|
|
305
|
+
open: boolean;
|
|
306
|
+
onClose: () => void;
|
|
307
|
+
versions: Version[];
|
|
308
|
+
currentVersionId?: string;
|
|
309
|
+
onPreview: (version: Version) => void;
|
|
310
|
+
onRestore: (version: Version) => void;
|
|
311
|
+
onCompare?: (v1: Version, v2: Version) => void;
|
|
312
|
+
loading?: boolean;
|
|
313
|
+
}
|
|
314
|
+
declare function VersionHistoryPanel({ open, onClose, versions, currentVersionId, onPreview, onRestore, onCompare, loading, }: VersionHistoryPanelProps): react_jsx_runtime.JSX.Element;
|
|
315
|
+
|
|
316
|
+
interface HeaderProps {
|
|
317
|
+
title: string;
|
|
318
|
+
onMenuClick: () => void;
|
|
319
|
+
actions?: ReactNode;
|
|
320
|
+
}
|
|
321
|
+
declare function Header({ title, onMenuClick, actions }: HeaderProps): react_jsx_runtime.JSX.Element;
|
|
322
|
+
|
|
323
|
+
interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
324
|
+
variant?: 'primary' | 'secondary' | 'danger' | 'ghost';
|
|
325
|
+
size?: 'sm' | 'md' | 'lg';
|
|
326
|
+
loading?: boolean;
|
|
327
|
+
children: ReactNode;
|
|
328
|
+
}
|
|
329
|
+
declare function Button({ variant, size, loading, children, className, disabled, ...props }: ButtonProps): react_jsx_runtime.JSX.Element;
|
|
330
|
+
|
|
331
|
+
interface SpinnerProps {
|
|
332
|
+
size?: "sm" | "md" | "lg";
|
|
333
|
+
className?: string;
|
|
334
|
+
}
|
|
335
|
+
declare function Spinner({ size, className }: SpinnerProps): react_jsx_runtime.JSX.Element;
|
|
336
|
+
|
|
337
|
+
interface Toast$1 {
|
|
338
|
+
id: string;
|
|
339
|
+
type: "success" | "error" | "warning" | "info";
|
|
340
|
+
message: string;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
type ToastType = "success" | "error" | "warning" | "info";
|
|
344
|
+
interface ToastProps {
|
|
345
|
+
type: ToastType;
|
|
346
|
+
message: string;
|
|
347
|
+
onClose: () => void;
|
|
348
|
+
}
|
|
349
|
+
declare function Toast({ type, message, onClose }: ToastProps): react_jsx_runtime.JSX.Element;
|
|
350
|
+
interface ToastProviderProps {
|
|
351
|
+
children: ReactNode;
|
|
352
|
+
}
|
|
353
|
+
declare function ToastProvider({ children }: ToastProviderProps): react_jsx_runtime.JSX.Element;
|
|
354
|
+
declare function useToast(): {
|
|
355
|
+
toasts: Toast$1[];
|
|
356
|
+
addToast: (type: Toast$1["type"], message: string) => void;
|
|
357
|
+
removeToast: (id: string) => void;
|
|
358
|
+
};
|
|
359
|
+
|
|
360
|
+
interface DropdownProps {
|
|
361
|
+
trigger: ReactNode;
|
|
362
|
+
children: ReactNode;
|
|
363
|
+
align?: "left" | "right";
|
|
364
|
+
direction?: "up" | "down";
|
|
365
|
+
}
|
|
366
|
+
declare function Dropdown({ trigger, children, align, direction, }: DropdownProps): react_jsx_runtime.JSX.Element;
|
|
367
|
+
interface DropdownItemProps {
|
|
368
|
+
children: ReactNode;
|
|
369
|
+
onClick?: () => void;
|
|
370
|
+
icon?: ReactNode;
|
|
371
|
+
danger?: boolean;
|
|
372
|
+
disabled?: boolean;
|
|
373
|
+
className?: string;
|
|
374
|
+
}
|
|
375
|
+
declare function DropdownItem({ children, onClick, icon, danger, disabled, className, }: DropdownItemProps): react_jsx_runtime.JSX.Element;
|
|
376
|
+
declare function DropdownSeparator(): react_jsx_runtime.JSX.Element;
|
|
377
|
+
|
|
378
|
+
interface ModalProps {
|
|
379
|
+
open: boolean;
|
|
380
|
+
onClose: () => void;
|
|
381
|
+
title: string;
|
|
382
|
+
children: ReactNode;
|
|
383
|
+
footer?: ReactNode;
|
|
384
|
+
size?: "sm" | "md" | "lg" | "full";
|
|
385
|
+
variant?: "default" | "danger" | "lightbox";
|
|
386
|
+
}
|
|
387
|
+
declare function Modal({ open, onClose, title, children, footer, size, variant, }: ModalProps): React__default.ReactPortal | null;
|
|
388
|
+
interface ConfirmModalProps {
|
|
389
|
+
open: boolean;
|
|
390
|
+
onClose: () => void;
|
|
391
|
+
onConfirm: () => void;
|
|
392
|
+
title: string;
|
|
393
|
+
message: string;
|
|
394
|
+
confirmLabel?: string;
|
|
395
|
+
cancelLabel?: string;
|
|
396
|
+
variant?: "default" | "danger";
|
|
397
|
+
loading?: boolean;
|
|
398
|
+
}
|
|
399
|
+
declare function ConfirmModal({ open, onClose, onConfirm, title, message, confirmLabel, cancelLabel, variant, loading, }: ConfirmModalProps): react_jsx_runtime.JSX.Element;
|
|
400
|
+
|
|
401
|
+
interface SlidePanelProps {
|
|
402
|
+
open: boolean;
|
|
403
|
+
onClose: () => void;
|
|
404
|
+
title: string;
|
|
405
|
+
subtitle?: string;
|
|
406
|
+
size?: "sm" | "md" | "lg" | "xl";
|
|
407
|
+
children: ReactNode;
|
|
408
|
+
width?: "sm" | "md" | "lg" | "xl";
|
|
409
|
+
showOverlay?: boolean;
|
|
410
|
+
accentClass?: string;
|
|
411
|
+
}
|
|
412
|
+
declare function SlidePanel({ open, onClose, title, children, width, showOverlay, accentClass, }: SlidePanelProps): React__default.ReactPortal | null;
|
|
413
|
+
|
|
414
|
+
interface AuthUser {
|
|
415
|
+
id: string;
|
|
416
|
+
email: string;
|
|
417
|
+
role: string;
|
|
418
|
+
tenantId?: string;
|
|
419
|
+
}
|
|
420
|
+
interface TenantInfo {
|
|
421
|
+
id: string;
|
|
422
|
+
slug: string;
|
|
423
|
+
name: string;
|
|
424
|
+
}
|
|
425
|
+
interface AdminContext {
|
|
426
|
+
user: AuthUser | null;
|
|
427
|
+
tenant: TenantInfo | null;
|
|
428
|
+
config: Record<string, unknown>;
|
|
429
|
+
api: {
|
|
430
|
+
baseUrl: string;
|
|
431
|
+
token: string | null;
|
|
432
|
+
};
|
|
433
|
+
}
|
|
434
|
+
interface HookResult {
|
|
435
|
+
success: boolean;
|
|
436
|
+
error?: string;
|
|
437
|
+
}
|
|
438
|
+
type LifecycleHook = (ctx: AdminContext) => void | HookResult | Promise<void | HookResult>;
|
|
439
|
+
|
|
440
|
+
declare function onAdminReady(hook: LifecycleHook): () => void;
|
|
441
|
+
declare function beforeDeploy(hook: LifecycleHook): () => void;
|
|
442
|
+
declare function afterDeploy(hook: (ctx: AdminContext, result: HookResult) => void): () => void;
|
|
443
|
+
declare function emitAdminReady(ctx: AdminContext): Promise<HookResult[]>;
|
|
444
|
+
declare function emitBeforeDeploy(ctx: AdminContext): Promise<HookResult[]>;
|
|
445
|
+
declare function emitAfterDeploy(ctx: AdminContext, result: HookResult): Promise<void>;
|
|
446
|
+
|
|
447
|
+
interface QueryOptions {
|
|
448
|
+
page?: number;
|
|
449
|
+
limit?: number;
|
|
450
|
+
filter?: Record<string, unknown>;
|
|
451
|
+
sort?: string;
|
|
452
|
+
order?: "asc" | "desc";
|
|
453
|
+
}
|
|
454
|
+
interface QueryResult<T> {
|
|
455
|
+
data: T | null;
|
|
456
|
+
loading: boolean;
|
|
457
|
+
error: string | null;
|
|
458
|
+
refetch: () => Promise<void>;
|
|
459
|
+
}
|
|
460
|
+
interface MutationResult {
|
|
461
|
+
mutate: (data?: Record<string, unknown>) => Promise<Record<string, unknown> | null>;
|
|
462
|
+
loading: boolean;
|
|
463
|
+
error: string | null;
|
|
464
|
+
}
|
|
465
|
+
declare function useKyroQuery<T = Record<string, unknown>>(slug: string, options?: QueryOptions): QueryResult<T>;
|
|
466
|
+
declare function useKyroMutation(slug: string, method?: "POST" | "PATCH" | "DELETE"): MutationResult;
|
|
467
|
+
|
|
468
|
+
interface KyroPlugin {
|
|
469
|
+
name: string;
|
|
470
|
+
version: string;
|
|
471
|
+
description?: string;
|
|
472
|
+
apply?: (config: Record<string, unknown>) => void;
|
|
473
|
+
hooks?: {
|
|
474
|
+
onAdminReady?: (ctx: AdminContext) => void | HookResult | Promise<void | HookResult>;
|
|
475
|
+
beforeDeploy?: (ctx: AdminContext) => void | HookResult | Promise<void | HookResult>;
|
|
476
|
+
afterDeploy?: (ctx: AdminContext, result: HookResult) => void | Promise<void>;
|
|
477
|
+
beforeRender?: (ctx: AdminContext) => void;
|
|
478
|
+
afterRender?: (ctx: AdminContext) => void;
|
|
479
|
+
};
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
declare function registerPlugin(plugin: KyroPlugin): void;
|
|
483
|
+
declare function unregisterPlugin(name: string): void;
|
|
484
|
+
declare function getPlugin(name: string): KyroPlugin | undefined;
|
|
485
|
+
declare function getPlugins(): KyroPlugin[];
|
|
486
|
+
declare function getPluginsWithHook<K extends keyof NonNullable<KyroPlugin["hooks"]>>(hookName: K): KyroPlugin[];
|
|
487
|
+
|
|
488
|
+
interface BlockRenderProps {
|
|
489
|
+
data: Record<string, unknown>;
|
|
490
|
+
context: {
|
|
491
|
+
theme: KyroTheme;
|
|
492
|
+
locale: string;
|
|
493
|
+
isPreview: boolean;
|
|
494
|
+
};
|
|
495
|
+
}
|
|
496
|
+
interface KyroBlock extends Omit<Block, "fields" | "slug"> {
|
|
497
|
+
id: string;
|
|
498
|
+
label: string;
|
|
499
|
+
category?: string;
|
|
500
|
+
icon?: ReactNode;
|
|
501
|
+
schema: Field[];
|
|
502
|
+
render: (props: BlockRenderProps) => ReactNode;
|
|
503
|
+
preview?: (props: BlockRenderProps) => ReactNode;
|
|
504
|
+
settings?: Record<string, unknown>;
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
declare function registerBlock(block: KyroBlock): void;
|
|
508
|
+
declare function unregisterBlock(id: string): void;
|
|
509
|
+
declare function getBlock(id: string): KyroBlock | undefined;
|
|
510
|
+
declare function getBlocks(): KyroBlock[];
|
|
511
|
+
declare function getBlocksByCategory(category: string): KyroBlock[];
|
|
512
|
+
declare function useBlockRenderer(id: string): ((props: BlockRenderProps) => React$1.ReactNode) | null;
|
|
513
|
+
|
|
514
|
+
interface FieldEditorProps {
|
|
515
|
+
name: string;
|
|
516
|
+
label: string;
|
|
517
|
+
value: unknown;
|
|
518
|
+
onChange: (value: unknown) => void;
|
|
519
|
+
onBlur?: () => void;
|
|
520
|
+
error?: string;
|
|
521
|
+
required?: boolean;
|
|
522
|
+
disabled?: boolean;
|
|
523
|
+
schema?: Record<string, unknown>;
|
|
524
|
+
}
|
|
525
|
+
interface KyroField {
|
|
526
|
+
id: string;
|
|
527
|
+
type: FieldType;
|
|
528
|
+
label?: string;
|
|
529
|
+
editor: React.ComponentType<FieldEditorProps>;
|
|
530
|
+
schema?: Record<string, unknown>;
|
|
531
|
+
defaultValue?: unknown;
|
|
532
|
+
validate?: (value: unknown) => string | null;
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
declare function registerField(field: KyroField): void;
|
|
536
|
+
declare function unregisterField(id: string): void;
|
|
537
|
+
declare function getField(id: string): KyroField | undefined;
|
|
538
|
+
declare function getFields(): KyroField[];
|
|
539
|
+
declare function getFieldByType(type: FieldType): KyroField | undefined;
|
|
540
|
+
declare function useFieldRenderer(fieldId: string, props: Omit<FieldEditorProps, "onChange"> & {
|
|
541
|
+
onChange?: (value: unknown) => void;
|
|
542
|
+
}): ReactNode | null;
|
|
543
|
+
|
|
544
|
+
interface KyroAdminOptions {
|
|
545
|
+
basePath?: string;
|
|
546
|
+
apiPath?: string;
|
|
547
|
+
configPath?: string;
|
|
548
|
+
}
|
|
549
|
+
declare function kyroAdmin(options?: KyroAdminOptions): AstroIntegration;
|
|
550
|
+
|
|
551
|
+
declare const adminPath: string;
|
|
552
|
+
declare const apiPath: string;
|
|
553
|
+
declare function resolveApi(url: string): string;
|
|
554
|
+
declare function resolveAdmin(url: string): string;
|
|
555
|
+
declare function resolveMedia(url: unknown): string;
|
|
556
|
+
declare const paths: {
|
|
557
|
+
readonly admin: string;
|
|
558
|
+
readonly api: string;
|
|
559
|
+
readonly resolveApi: typeof resolveApi;
|
|
560
|
+
readonly resolveAdmin: typeof resolveAdmin;
|
|
561
|
+
readonly resolveMedia: typeof resolveMedia;
|
|
562
|
+
};
|
|
563
|
+
|
|
564
|
+
export { ActionBar, type ActionBarProps, Admin, type AdminContext, type AuthUser, AutoForm, Badge, type BadgeVariant, type BlockRenderProps, type BlockThemeOverrides, BulkActionsBar, Button, ConfirmModal, CountBadge, CreateView, DARK_THEME, DarkThemeProvider, DetailView, type DocumentStatus, Dropdown, DropdownItem, DropdownSeparator, DarkThemeProvider as ExtDarkThemeProvider, LightThemeProvider as ExtLightThemeProvider, type ThemeMode as ExtThemeMode, ThemeProvider as ExtThemeProvider, type FieldEditorProps, type FieldThemeOverrides, Header, type HookResult, type KyroAdminOptions, type KyroBlock, type KyroField, type KyroPlugin, type KyroTheme, LIGHT_THEME, type LifecycleHook, LightThemeProvider, ListView, LoginPage, Modal, type MutationResult, PageHeader, type QueryOptions, type QueryResult, type SaveStatus, SlidePanel, Spinner, type TenantInfo, type ThemeColors, type ThemeMode, ThemeProvider, type ThemeRadius, type ThemeShadows, type ThemeSpacing, type ThemeTypography, Toast, ToastProvider, VersionHistoryPanel, adminPath, afterDeploy, apiPath, beforeDeploy, emitAdminReady, emitAfterDeploy, emitBeforeDeploy, getBlock, getBlocks, getBlocksByCategory, getField, getFieldByType, getFields, getPlugin, getPlugins, getPluginsWithHook, kyroAdmin, mergeThemes, onAdminReady, paths, registerBlock, registerField, registerPlugin, resolveAdmin, resolveApi, unregisterBlock, unregisterField, unregisterPlugin, useBlockRenderer, useTheme as useExtTheme, useFieldRenderer, useKyroMutation, useKyroQuery, useTheme, useToast };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { CollectionConfig, GlobalConfig, KyroConfig } from '@kyro-cms/core/client';
|
|
3
3
|
import * as React$1 from 'react';
|
|
4
|
-
import React__default, { ReactNode, ButtonHTMLAttributes } from 'react';
|
|
4
|
+
import React__default, { ReactNode, ComponentType, SVGAttributes, ButtonHTMLAttributes } from 'react';
|
|
5
5
|
import { CollectionConfig as CollectionConfig$1, Block, Field, FieldType } from '@kyro-cms/core';
|
|
6
|
-
import { IconType } from 'react-icons';
|
|
7
6
|
import { AstroIntegration } from 'astro';
|
|
8
7
|
|
|
9
8
|
interface ThemeColors {
|
|
@@ -268,14 +267,14 @@ interface Breadcrumb {
|
|
|
268
267
|
interface Action {
|
|
269
268
|
label: string;
|
|
270
269
|
onClick: () => void;
|
|
271
|
-
icon?:
|
|
270
|
+
icon?: ComponentType<SVGAttributes<SVGSVGElement>>;
|
|
272
271
|
variant?: "primary" | "outline" | "ghost";
|
|
273
272
|
className?: string;
|
|
274
273
|
}
|
|
275
274
|
interface PageHeaderProps {
|
|
276
275
|
title?: string;
|
|
277
276
|
description?: string;
|
|
278
|
-
icon?:
|
|
277
|
+
icon?: ComponentType<SVGAttributes<SVGSVGElement>>;
|
|
279
278
|
breadcrumbs?: Breadcrumb[];
|
|
280
279
|
metadata?: ReactNode[];
|
|
281
280
|
back?: {
|
|
@@ -362,8 +361,9 @@ interface DropdownProps {
|
|
|
362
361
|
trigger: ReactNode;
|
|
363
362
|
children: ReactNode;
|
|
364
363
|
align?: "left" | "right";
|
|
364
|
+
direction?: "up" | "down";
|
|
365
365
|
}
|
|
366
|
-
declare function Dropdown({ trigger, children, align, }: DropdownProps): react_jsx_runtime.JSX.Element;
|
|
366
|
+
declare function Dropdown({ trigger, children, align, direction, }: DropdownProps): react_jsx_runtime.JSX.Element;
|
|
367
367
|
interface DropdownItemProps {
|
|
368
368
|
children: ReactNode;
|
|
369
369
|
onClick?: () => void;
|
|
@@ -381,8 +381,8 @@ interface ModalProps {
|
|
|
381
381
|
title: string;
|
|
382
382
|
children: ReactNode;
|
|
383
383
|
footer?: ReactNode;
|
|
384
|
-
size?: "sm" | "md" | "lg";
|
|
385
|
-
variant?: "default" | "danger";
|
|
384
|
+
size?: "sm" | "md" | "lg" | "full";
|
|
385
|
+
variant?: "default" | "danger" | "lightbox";
|
|
386
386
|
}
|
|
387
387
|
declare function Modal({ open, onClose, title, children, footer, size, variant, }: ModalProps): React__default.ReactPortal | null;
|
|
388
388
|
interface ConfirmModalProps {
|
|
@@ -407,8 +407,9 @@ interface SlidePanelProps {
|
|
|
407
407
|
children: ReactNode;
|
|
408
408
|
width?: "sm" | "md" | "lg" | "xl";
|
|
409
409
|
showOverlay?: boolean;
|
|
410
|
+
accentClass?: string;
|
|
410
411
|
}
|
|
411
|
-
declare function SlidePanel({ open, onClose, title, children, width, showOverlay, }: SlidePanelProps): React__default.ReactPortal | null;
|
|
412
|
+
declare function SlidePanel({ open, onClose, title, children, width, showOverlay, accentClass, }: SlidePanelProps): React__default.ReactPortal | null;
|
|
412
413
|
|
|
413
414
|
interface AuthUser {
|
|
414
415
|
id: string;
|
|
@@ -551,7 +552,7 @@ declare const adminPath: string;
|
|
|
551
552
|
declare const apiPath: string;
|
|
552
553
|
declare function resolveApi(url: string): string;
|
|
553
554
|
declare function resolveAdmin(url: string): string;
|
|
554
|
-
declare function resolveMedia(url:
|
|
555
|
+
declare function resolveMedia(url: unknown): string;
|
|
555
556
|
declare const paths: {
|
|
556
557
|
readonly admin: string;
|
|
557
558
|
readonly api: string;
|
|
@@ -560,4 +561,4 @@ declare const paths: {
|
|
|
560
561
|
readonly resolveMedia: typeof resolveMedia;
|
|
561
562
|
};
|
|
562
563
|
|
|
563
|
-
export { ActionBar, ActionBarProps, Admin, AdminContext, AuthUser, AutoForm, Badge, BadgeVariant, BlockRenderProps, BlockThemeOverrides, BulkActionsBar, Button, ConfirmModal, CountBadge, CreateView, DARK_THEME, DarkThemeProvider, DetailView, DocumentStatus, Dropdown, DropdownItem, DropdownSeparator, DarkThemeProvider as ExtDarkThemeProvider, LightThemeProvider as ExtLightThemeProvider, ThemeMode as ExtThemeMode, ThemeProvider as ExtThemeProvider, FieldEditorProps, FieldThemeOverrides, Header, HookResult, KyroAdminOptions, KyroBlock, KyroField, KyroPlugin, KyroTheme, LIGHT_THEME, LifecycleHook, LightThemeProvider, ListView, LoginPage, Modal, MutationResult, PageHeader, QueryOptions, QueryResult, SaveStatus, SlidePanel, Spinner, TenantInfo, ThemeColors, ThemeMode, ThemeProvider, ThemeRadius, ThemeShadows, ThemeSpacing, ThemeTypography, Toast, ToastProvider, VersionHistoryPanel, adminPath, afterDeploy, apiPath, beforeDeploy, emitAdminReady, emitAfterDeploy, emitBeforeDeploy, getBlock, getBlocks, getBlocksByCategory, getField, getFieldByType, getFields, getPlugin, getPlugins, getPluginsWithHook, kyroAdmin, mergeThemes, onAdminReady, paths, registerBlock, registerField, registerPlugin, resolveAdmin, resolveApi, unregisterBlock, unregisterField, unregisterPlugin, useBlockRenderer, useTheme as useExtTheme, useFieldRenderer, useKyroMutation, useKyroQuery, useTheme, useToast };
|
|
564
|
+
export { ActionBar, type ActionBarProps, Admin, type AdminContext, type AuthUser, AutoForm, Badge, type BadgeVariant, type BlockRenderProps, type BlockThemeOverrides, BulkActionsBar, Button, ConfirmModal, CountBadge, CreateView, DARK_THEME, DarkThemeProvider, DetailView, type DocumentStatus, Dropdown, DropdownItem, DropdownSeparator, DarkThemeProvider as ExtDarkThemeProvider, LightThemeProvider as ExtLightThemeProvider, type ThemeMode as ExtThemeMode, ThemeProvider as ExtThemeProvider, type FieldEditorProps, type FieldThemeOverrides, Header, type HookResult, type KyroAdminOptions, type KyroBlock, type KyroField, type KyroPlugin, type KyroTheme, LIGHT_THEME, type LifecycleHook, LightThemeProvider, ListView, LoginPage, Modal, type MutationResult, PageHeader, type QueryOptions, type QueryResult, type SaveStatus, SlidePanel, Spinner, type TenantInfo, type ThemeColors, type ThemeMode, ThemeProvider, type ThemeRadius, type ThemeShadows, type ThemeSpacing, type ThemeTypography, Toast, ToastProvider, VersionHistoryPanel, adminPath, afterDeploy, apiPath, beforeDeploy, emitAdminReady, emitAfterDeploy, emitBeforeDeploy, getBlock, getBlocks, getBlocksByCategory, getField, getFieldByType, getFields, getPlugin, getPlugins, getPluginsWithHook, kyroAdmin, mergeThemes, onAdminReady, paths, registerBlock, registerField, registerPlugin, resolveAdmin, resolveApi, unregisterBlock, unregisterField, unregisterPlugin, useBlockRenderer, useTheme as useExtTheme, useFieldRenderer, useKyroMutation, useKyroQuery, useTheme, useToast };
|