@kyro-cms/admin 0.9.0 → 0.9.1

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 (100) hide show
  1. package/dist/index.cjs +11960 -11006
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.css +67 -65
  4. package/dist/index.css.map +1 -1
  5. package/dist/index.d.cts +563 -0
  6. package/dist/index.d.ts +7 -7
  7. package/dist/index.js +12183 -11238
  8. package/dist/index.js.map +1 -1
  9. package/package.json +15 -11
  10. package/src/components/ActionBar.tsx +27 -14
  11. package/src/components/Admin.tsx +1 -1
  12. package/src/components/ApiKeysManager.tsx +5 -5
  13. package/src/components/AutoForm.tsx +585 -369
  14. package/src/components/BrandingHub.tsx +7 -4
  15. package/src/components/CreateView.tsx +2 -0
  16. package/src/components/DetailView.tsx +71 -56
  17. package/src/components/DeveloperCenter.tsx +8 -6
  18. package/src/components/FieldRenderer.tsx +94 -19
  19. package/src/components/ListView.tsx +33 -20
  20. package/src/components/MediaGallery.tsx +219 -194
  21. package/src/components/PluginsManager.tsx +197 -70
  22. package/src/components/RestPlayground.tsx +7 -7
  23. package/src/components/SessionsManager.tsx +1 -1
  24. package/src/components/SettingsPage.tsx +22 -0
  25. package/src/components/Sidebar.astro +13 -41
  26. package/src/components/UserManagement.tsx +153 -15
  27. package/src/components/UserMenu.tsx +30 -4
  28. package/src/components/VersionHistoryPanel.tsx +112 -119
  29. package/src/components/WebhookManager.tsx +6 -4
  30. package/src/components/blocks/ArrayBlock.tsx +6 -23
  31. package/src/components/blocks/BlockEditModal.tsx +82 -309
  32. package/src/components/blocks/CardBlock.tsx +35 -0
  33. package/src/components/blocks/ChildBlocksTree.tsx +57 -31
  34. package/src/components/blocks/GenericBlock.tsx +44 -0
  35. package/src/components/blocks/HeadingSubheadingBlock.tsx +32 -0
  36. package/src/components/blocks/HeroBlock.tsx +5 -14
  37. package/src/components/blocks/RichTextBlock.tsx +5 -5
  38. package/src/components/blocks/index.ts +5 -3
  39. package/src/components/fields/AccordionField.tsx +2 -2
  40. package/src/components/fields/ArrayField.tsx +1 -1
  41. package/src/components/fields/ArrayLayout.tsx +120 -29
  42. package/src/components/fields/BlocksField.tsx +430 -50
  43. package/src/components/fields/CardField.tsx +73 -0
  44. package/src/components/fields/CheckboxField.tsx +7 -3
  45. package/src/components/fields/DateField.tsx +4 -1
  46. package/src/components/fields/GroupLayout.tsx +2 -2
  47. package/src/components/fields/HeadingSubheadingField.tsx +43 -0
  48. package/src/components/fields/ListField.tsx +2 -2
  49. package/src/components/fields/NumberField.tsx +4 -1
  50. package/src/components/fields/RelationshipField.tsx +153 -87
  51. package/src/components/fields/RichTextField.tsx +781 -0
  52. package/src/components/fields/SecretField.tsx +102 -0
  53. package/src/components/fields/SelectField.tsx +19 -6
  54. package/src/components/fields/TabsLayout.tsx +19 -9
  55. package/src/components/fields/TextField.tsx +4 -1
  56. package/src/components/fields/UploadField.tsx +122 -56
  57. package/src/components/fields/extensions/blockComponents.tsx +103 -174
  58. package/src/components/fields/extensions/blocksStore.ts +8 -1
  59. package/src/components/fields/index.ts +4 -2
  60. package/src/components/ui/PageHeader.tsx +5 -5
  61. package/src/components/ui/SlidePanel.tsx +8 -3
  62. package/src/components/ui/icons.tsx +109 -109
  63. package/src/components/users/UserDetail.tsx +79 -16
  64. package/src/hooks/useAutoFormState.ts +125 -62
  65. package/src/integration.ts +148 -46
  66. package/src/kyro-cms.d.ts +7 -2
  67. package/src/layouts/AuthLayout.astro +14 -2
  68. package/src/lib/autoform-store.ts +85 -52
  69. package/src/lib/change-source.ts +9 -0
  70. package/src/lib/config.ts +104 -8
  71. package/src/lib/globals.ts +44 -9
  72. package/src/lib/normalize-upload-fields.ts +41 -0
  73. package/src/lib/paths.ts +2 -2
  74. package/src/lib/resolve-field-value.ts +110 -0
  75. package/src/lib/shim/use-sync-external-store-with-selector.js +30 -0
  76. package/src/lib/shim/use-sync-external-store.js +1 -0
  77. package/src/lib/stores/index.ts +1 -0
  78. package/src/lib/useResourceManager.ts +4 -4
  79. package/src/lib/vite-shim-plugin.ts +100 -0
  80. package/src/pages/[collection]/[id].astro +1 -1
  81. package/src/pages/preview/[collection]/[id].astro +4 -4
  82. package/src/pages/settings/[slug].astro +2 -2
  83. package/src/styles/main.css +60 -54
  84. package/README.md +0 -46
  85. package/dist/EditorClient-Q23UXR37.cjs +0 -468
  86. package/dist/EditorClient-Q23UXR37.cjs.map +0 -1
  87. package/dist/EditorClient-T5PASFNR.js +0 -466
  88. package/dist/EditorClient-T5PASFNR.js.map +0 -1
  89. package/dist/chunk-3BGDYKTD.cjs +0 -348
  90. package/dist/chunk-3BGDYKTD.cjs.map +0 -1
  91. package/dist/chunk-EEFXLQVT.js +0 -3
  92. package/dist/chunk-EEFXLQVT.js.map +0 -1
  93. package/src/components/blocks/ButtonBlock.tsx +0 -64
  94. package/src/components/blocks/ColumnsBlock.tsx +0 -55
  95. package/src/components/blocks/DividerBlock.tsx +0 -43
  96. package/src/components/blocks/LinkBlock.tsx +0 -65
  97. package/src/components/blocks/VStackBlock.tsx +0 -29
  98. package/src/components/fields/EditorClient.tsx +0 -535
  99. package/src/components/fields/PortableTextField.tsx +0 -155
  100. package/src/components/fields/PortableTextRenderer.tsx +0 -68
@@ -0,0 +1,563 @@
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
+ }
365
+ declare function Dropdown({ trigger, children, align, }: DropdownProps): react_jsx_runtime.JSX.Element;
366
+ interface DropdownItemProps {
367
+ children: ReactNode;
368
+ onClick?: () => void;
369
+ icon?: ReactNode;
370
+ danger?: boolean;
371
+ disabled?: boolean;
372
+ className?: string;
373
+ }
374
+ declare function DropdownItem({ children, onClick, icon, danger, disabled, className, }: DropdownItemProps): react_jsx_runtime.JSX.Element;
375
+ declare function DropdownSeparator(): react_jsx_runtime.JSX.Element;
376
+
377
+ interface ModalProps {
378
+ open: boolean;
379
+ onClose: () => void;
380
+ title: string;
381
+ children: ReactNode;
382
+ footer?: ReactNode;
383
+ size?: "sm" | "md" | "lg";
384
+ variant?: "default" | "danger";
385
+ }
386
+ declare function Modal({ open, onClose, title, children, footer, size, variant, }: ModalProps): React__default.ReactPortal | null;
387
+ interface ConfirmModalProps {
388
+ open: boolean;
389
+ onClose: () => void;
390
+ onConfirm: () => void;
391
+ title: string;
392
+ message: string;
393
+ confirmLabel?: string;
394
+ cancelLabel?: string;
395
+ variant?: "default" | "danger";
396
+ loading?: boolean;
397
+ }
398
+ declare function ConfirmModal({ open, onClose, onConfirm, title, message, confirmLabel, cancelLabel, variant, loading, }: ConfirmModalProps): react_jsx_runtime.JSX.Element;
399
+
400
+ interface SlidePanelProps {
401
+ open: boolean;
402
+ onClose: () => void;
403
+ title: string;
404
+ subtitle?: string;
405
+ size?: "sm" | "md" | "lg" | "xl";
406
+ children: ReactNode;
407
+ width?: "sm" | "md" | "lg" | "xl";
408
+ showOverlay?: boolean;
409
+ accentClass?: string;
410
+ }
411
+ declare function SlidePanel({ open, onClose, title, children, width, showOverlay, accentClass, }: SlidePanelProps): React__default.ReactPortal | null;
412
+
413
+ interface AuthUser {
414
+ id: string;
415
+ email: string;
416
+ role: string;
417
+ tenantId?: string;
418
+ }
419
+ interface TenantInfo {
420
+ id: string;
421
+ slug: string;
422
+ name: string;
423
+ }
424
+ interface AdminContext {
425
+ user: AuthUser | null;
426
+ tenant: TenantInfo | null;
427
+ config: Record<string, unknown>;
428
+ api: {
429
+ baseUrl: string;
430
+ token: string | null;
431
+ };
432
+ }
433
+ interface HookResult {
434
+ success: boolean;
435
+ error?: string;
436
+ }
437
+ type LifecycleHook = (ctx: AdminContext) => void | HookResult | Promise<void | HookResult>;
438
+
439
+ declare function onAdminReady(hook: LifecycleHook): () => void;
440
+ declare function beforeDeploy(hook: LifecycleHook): () => void;
441
+ declare function afterDeploy(hook: (ctx: AdminContext, result: HookResult) => void): () => void;
442
+ declare function emitAdminReady(ctx: AdminContext): Promise<HookResult[]>;
443
+ declare function emitBeforeDeploy(ctx: AdminContext): Promise<HookResult[]>;
444
+ declare function emitAfterDeploy(ctx: AdminContext, result: HookResult): Promise<void>;
445
+
446
+ interface QueryOptions {
447
+ page?: number;
448
+ limit?: number;
449
+ filter?: Record<string, unknown>;
450
+ sort?: string;
451
+ order?: "asc" | "desc";
452
+ }
453
+ interface QueryResult<T> {
454
+ data: T | null;
455
+ loading: boolean;
456
+ error: string | null;
457
+ refetch: () => Promise<void>;
458
+ }
459
+ interface MutationResult {
460
+ mutate: (data?: Record<string, unknown>) => Promise<Record<string, unknown> | null>;
461
+ loading: boolean;
462
+ error: string | null;
463
+ }
464
+ declare function useKyroQuery<T = Record<string, unknown>>(slug: string, options?: QueryOptions): QueryResult<T>;
465
+ declare function useKyroMutation(slug: string, method?: "POST" | "PATCH" | "DELETE"): MutationResult;
466
+
467
+ interface KyroPlugin {
468
+ name: string;
469
+ version: string;
470
+ description?: string;
471
+ apply?: (config: Record<string, unknown>) => void;
472
+ hooks?: {
473
+ onAdminReady?: (ctx: AdminContext) => void | HookResult | Promise<void | HookResult>;
474
+ beforeDeploy?: (ctx: AdminContext) => void | HookResult | Promise<void | HookResult>;
475
+ afterDeploy?: (ctx: AdminContext, result: HookResult) => void | Promise<void>;
476
+ beforeRender?: (ctx: AdminContext) => void;
477
+ afterRender?: (ctx: AdminContext) => void;
478
+ };
479
+ }
480
+
481
+ declare function registerPlugin(plugin: KyroPlugin): void;
482
+ declare function unregisterPlugin(name: string): void;
483
+ declare function getPlugin(name: string): KyroPlugin | undefined;
484
+ declare function getPlugins(): KyroPlugin[];
485
+ declare function getPluginsWithHook<K extends keyof NonNullable<KyroPlugin["hooks"]>>(hookName: K): KyroPlugin[];
486
+
487
+ interface BlockRenderProps {
488
+ data: Record<string, unknown>;
489
+ context: {
490
+ theme: KyroTheme;
491
+ locale: string;
492
+ isPreview: boolean;
493
+ };
494
+ }
495
+ interface KyroBlock extends Omit<Block, "fields" | "slug"> {
496
+ id: string;
497
+ label: string;
498
+ category?: string;
499
+ icon?: ReactNode;
500
+ schema: Field[];
501
+ render: (props: BlockRenderProps) => ReactNode;
502
+ preview?: (props: BlockRenderProps) => ReactNode;
503
+ settings?: Record<string, unknown>;
504
+ }
505
+
506
+ declare function registerBlock(block: KyroBlock): void;
507
+ declare function unregisterBlock(id: string): void;
508
+ declare function getBlock(id: string): KyroBlock | undefined;
509
+ declare function getBlocks(): KyroBlock[];
510
+ declare function getBlocksByCategory(category: string): KyroBlock[];
511
+ declare function useBlockRenderer(id: string): ((props: BlockRenderProps) => React$1.ReactNode) | null;
512
+
513
+ interface FieldEditorProps {
514
+ name: string;
515
+ label: string;
516
+ value: unknown;
517
+ onChange: (value: unknown) => void;
518
+ onBlur?: () => void;
519
+ error?: string;
520
+ required?: boolean;
521
+ disabled?: boolean;
522
+ schema?: Record<string, unknown>;
523
+ }
524
+ interface KyroField {
525
+ id: string;
526
+ type: FieldType;
527
+ label?: string;
528
+ editor: React.ComponentType<FieldEditorProps>;
529
+ schema?: Record<string, unknown>;
530
+ defaultValue?: unknown;
531
+ validate?: (value: unknown) => string | null;
532
+ }
533
+
534
+ declare function registerField(field: KyroField): void;
535
+ declare function unregisterField(id: string): void;
536
+ declare function getField(id: string): KyroField | undefined;
537
+ declare function getFields(): KyroField[];
538
+ declare function getFieldByType(type: FieldType): KyroField | undefined;
539
+ declare function useFieldRenderer(fieldId: string, props: Omit<FieldEditorProps, "onChange"> & {
540
+ onChange?: (value: unknown) => void;
541
+ }): ReactNode | null;
542
+
543
+ interface KyroAdminOptions {
544
+ basePath?: string;
545
+ apiPath?: string;
546
+ configPath?: string;
547
+ }
548
+ declare function kyroAdmin(options?: KyroAdminOptions): AstroIntegration;
549
+
550
+ declare const adminPath: string;
551
+ declare const apiPath: string;
552
+ declare function resolveApi(url: string): string;
553
+ declare function resolveAdmin(url: string): string;
554
+ declare function resolveMedia(url: unknown): string;
555
+ declare const paths: {
556
+ readonly admin: string;
557
+ readonly api: string;
558
+ readonly resolveApi: typeof resolveApi;
559
+ readonly resolveAdmin: typeof resolveAdmin;
560
+ readonly resolveMedia: typeof resolveMedia;
561
+ };
562
+
563
+ 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?: IconType;
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?: IconType;
277
+ icon?: ComponentType<SVGAttributes<SVGSVGElement>>;
279
278
  breadcrumbs?: Breadcrumb[];
280
279
  metadata?: ReactNode[];
281
280
  back?: {
@@ -407,8 +406,9 @@ interface SlidePanelProps {
407
406
  children: ReactNode;
408
407
  width?: "sm" | "md" | "lg" | "xl";
409
408
  showOverlay?: boolean;
409
+ accentClass?: string;
410
410
  }
411
- declare function SlidePanel({ open, onClose, title, children, width, showOverlay, }: SlidePanelProps): React__default.ReactPortal | null;
411
+ declare function SlidePanel({ open, onClose, title, children, width, showOverlay, accentClass, }: SlidePanelProps): React__default.ReactPortal | null;
412
412
 
413
413
  interface AuthUser {
414
414
  id: string;
@@ -551,7 +551,7 @@ declare const adminPath: string;
551
551
  declare const apiPath: string;
552
552
  declare function resolveApi(url: string): string;
553
553
  declare function resolveAdmin(url: string): string;
554
- declare function resolveMedia(url: string): string;
554
+ declare function resolveMedia(url: unknown): string;
555
555
  declare const paths: {
556
556
  readonly admin: string;
557
557
  readonly api: string;
@@ -560,4 +560,4 @@ declare const paths: {
560
560
  readonly resolveMedia: typeof resolveMedia;
561
561
  };
562
562
 
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 };
563
+ 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 };