@dyrected/admin 2.6.0 → 2.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/dist/admin.css +221 -32
  2. package/dist/components/forms/field-renderer.d.ts +3 -9
  3. package/dist/components/forms/fields/date-picker.d.ts +4 -1
  4. package/dist/components/forms/fields/format-aware-inputs.test.d.ts +1 -0
  5. package/dist/components/forms/fields/text-field.d.ts +1 -1
  6. package/dist/components/forms/fields/url-field.d.ts +1 -1
  7. package/dist/components/forms/form-engine.d.ts +13 -2
  8. package/dist/components/media/__tests__/media-library-dialog.test.d.ts +1 -0
  9. package/dist/components/media/storage-notice.d.ts +7 -0
  10. package/dist/components/workflow/WorkflowPanel.d.ts +8 -1
  11. package/dist/components/workflow/draft-live-compare-sheet.d.ts +6 -0
  12. package/dist/components/workflow/workflow-transition-controls.d.ts +60 -0
  13. package/dist/controllers/__tests__/field.test.d.ts +1 -0
  14. package/dist/controllers/__tests__/form.test.d.ts +1 -0
  15. package/dist/controllers/__tests__/media.test.d.ts +1 -0
  16. package/dist/controllers/__tests__/theme.test.d.ts +1 -0
  17. package/dist/controllers/field.d.ts +13 -0
  18. package/dist/controllers/form.d.ts +102 -0
  19. package/dist/controllers/media.d.ts +119 -0
  20. package/dist/controllers/theme.d.ts +28 -0
  21. package/dist/favicon.ico +0 -0
  22. package/dist/favicon.svg +85 -1
  23. package/dist/hooks/__tests__/use-add-media-from-url.test.d.ts +1 -0
  24. package/dist/hooks/__tests__/use-field.test.d.ts +1 -0
  25. package/dist/hooks/admin-theme-context.d.ts +2 -8
  26. package/dist/hooks/admin-theme-provider.d.ts +3 -1
  27. package/dist/hooks/admin-theme.d.ts +1 -0
  28. package/dist/hooks/use-add-media-from-url.d.ts +8 -17
  29. package/dist/hooks/use-admin-theme.d.ts +2 -1
  30. package/dist/hooks/use-dyrected-form.d.ts +2 -0
  31. package/dist/hooks/use-field.d.ts +2 -0
  32. package/dist/hooks/use-media-library.d.ts +26 -0
  33. package/dist/hooks/use-media-upload.d.ts +20 -0
  34. package/dist/hooks/use-media-url.d.ts +20 -0
  35. package/dist/index.d.ts +30 -3
  36. package/dist/index.mjs +2878 -1827
  37. package/dist/lib/__tests__/external-media.test.d.ts +1 -0
  38. package/dist/lib/__tests__/media-utils.test.d.ts +1 -0
  39. package/dist/lib/compress-image.d.ts +9 -0
  40. package/dist/lib/draft-live-compare.d.ts +38 -0
  41. package/dist/lib/draft-live-compare.test.d.ts +1 -0
  42. package/dist/lib/external-media.d.ts +9 -4
  43. package/dist/lib/media-utils.d.ts +26 -0
  44. package/dist/lib/workflow-autosave.d.ts +18 -0
  45. package/dist/lib/workflow-autosave.test.d.ts +1 -0
  46. package/dist/lib/workflow-ui.d.ts +22 -0
  47. package/dist/lib/workflow-ui.test.d.ts +1 -0
  48. package/dist/providers/dyrected-form-context.d.ts +14 -0
  49. package/dist/public/contracts.d.ts +230 -0
  50. package/dist/public/index.d.ts +26 -0
  51. package/dist/public/index.js +2 -0
  52. package/dist/public.d.ts +2 -0
  53. package/dist/types/admin-components.d.ts +17 -2
  54. package/dist/use-add-media-from-url-DHGAAVLY.js +1604 -0
  55. package/package.json +10 -4
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Compress a raster image file client-side using the Canvas API before upload.
3
+ * - Skips SVGs, GIFs, and non-images (returned unchanged).
4
+ * - Skips if the environment lacks DOM Canvas / URL API (SSR or Node.js test environment).
5
+ * - Skips if the result would be larger than the original.
6
+ * - maxDimension: longest edge cap in pixels (default 2048).
7
+ * - quality: JPEG/WebP quality 0–1 (default 0.85).
8
+ */
9
+ export declare function compressImage(file: File, maxDimension?: number, quality?: number): Promise<File>;
@@ -0,0 +1,38 @@
1
+ import { Field as FieldSchema } from '@dyrected/sdk';
2
+ export type CompareGroup = "Text changes" | "Media changes" | "Layout / sections changed" | "Settings changed";
3
+ export type CompareStatus = "Changed" | "Added" | "Removed";
4
+ export interface CompareCard {
5
+ id: string;
6
+ group: CompareGroup;
7
+ label: string;
8
+ status: CompareStatus;
9
+ path: string;
10
+ kind: "text" | "richText" | "media" | "array" | "setting";
11
+ liveValue: unknown;
12
+ draftValue: unknown;
13
+ liveText: string;
14
+ draftText: string;
15
+ liveMedia?: CompareMediaPreview | null;
16
+ draftMedia?: CompareMediaPreview | null;
17
+ }
18
+ export interface CompareMediaPreview {
19
+ url: string | null;
20
+ filename: string | null;
21
+ alt: string | null;
22
+ }
23
+ export interface DraftLiveComparison {
24
+ hasPublishedVersion: boolean;
25
+ hasChanges: boolean;
26
+ fieldChangeCount: number;
27
+ sectionsAdded: number;
28
+ sectionsRemoved: number;
29
+ groups: Array<{
30
+ title: CompareGroup;
31
+ cards: CompareCard[];
32
+ }>;
33
+ }
34
+ export declare function buildDraftLiveComparison(args: {
35
+ fields: FieldSchema[];
36
+ draft: Record<string, unknown> | null | undefined;
37
+ live: Record<string, unknown> | null | undefined;
38
+ }): DraftLiveComparison;
@@ -0,0 +1 @@
1
+ export {};
@@ -2,10 +2,9 @@
2
2
  * Detects the kind of external media a URL points to and builds the document
3
3
  * payload used to store it as a media record (no file bytes — just a reference).
4
4
  *
5
- * Supports YouTube and Vimeo video links, direct image URLs, and generic files.
6
- * The resulting `mimeType` (`video/youtube`, `video/vimeo`, `image/external`, or a
7
- * generic type) is what the media grid/preview components key off to render the
8
- * asset correctly.
5
+ * Supports YouTube and Vimeo video links, direct image URLs, direct video URLs, and generic files.
6
+ * The resulting `mimeType` (`video/youtube`, `video/vimeo`, `image/external`, `video/external`, or a
7
+ * generic type) is what the media grid/preview components key off to render the asset correctly.
9
8
  */
10
9
  export interface ExternalMediaPayload {
11
10
  filename: string;
@@ -14,6 +13,12 @@ export interface ExternalMediaPayload {
14
13
  filesize: number;
15
14
  id: string;
16
15
  }
16
+ /** Extract the trailing filename from a URL, stripping any query string. */
17
+ export declare function filenameFromUrl(url: string, fallback: string): string;
18
+ /** Check if a URL points to an embeddable video streaming site (YouTube or Vimeo). */
19
+ export declare function isEmbeddableVideoUrl(url: string): boolean;
20
+ /** Check if a URL points directly to a raster/vector image file. */
21
+ export declare function isDirectImageUrl(url: string): boolean;
17
22
  /**
18
23
  * Build a media document payload from an external URL.
19
24
  * Returns `null` when the input is empty/whitespace.
@@ -0,0 +1,26 @@
1
+ export interface MediaSourceInfo {
2
+ source: "external" | "internal";
3
+ type: "youtube" | "vimeo" | "external-cdn" | "storage";
4
+ label: string;
5
+ }
6
+ /**
7
+ * Safely resolves the collection slug to use for media uploads.
8
+ * If the target collection is upload-enabled, returns collectionSlug.
9
+ * Otherwise, safely falls back to "media".
10
+ */
11
+ export declare function resolveActiveMediaCollection(schemas: any, collectionSlug: string): string;
12
+ /**
13
+ * Determines whether a media item is an External asset (embed/remote link) or an
14
+ * Internal asset (uploaded file in storage) based strictly on its persisted metadata.
15
+ */
16
+ export declare function getMediaSourceInfo(item: unknown): MediaSourceInfo;
17
+ /** Returns true if the given item is an external asset. */
18
+ export declare function isExternalMedia(item: unknown): boolean;
19
+ /**
20
+ * Checks whether an error indicates that Dyrected media storage is not configured.
21
+ */
22
+ export declare function isStorageNotConfiguredError(error: unknown): boolean;
23
+ /**
24
+ * Formats a media error into a friendly, non-technical message.
25
+ */
26
+ export declare function formatMediaErrorMessage(error: unknown): string;
@@ -0,0 +1,18 @@
1
+ export declare const DEFAULT_WORKFLOW_AUTOSAVE_DELAY_MS = 1500;
2
+ type WorkflowAutosaveAdminConfig = {
3
+ autosave?: boolean;
4
+ autosaveDelayMs?: number;
5
+ } & Record<string, unknown>;
6
+ type WorkflowAutosaveCollectionLike = {
7
+ workflow?: unknown;
8
+ drafts?: boolean;
9
+ admin?: WorkflowAutosaveAdminConfig;
10
+ };
11
+ export type WorkflowAutosaveState = "idle" | "dirty" | "saving" | "saved" | "error" | "conflict";
12
+ export declare function isWorkflowEnabledCollection(collection?: WorkflowAutosaveCollectionLike | null): boolean;
13
+ export declare function resolveWorkflowAutosaveSettings(collection?: WorkflowAutosaveCollectionLike | null): {
14
+ enabled: boolean;
15
+ delayMs: number;
16
+ };
17
+ export declare function classifyWorkflowAutosaveError(error: unknown): Extract<WorkflowAutosaveState, "error" | "conflict">;
18
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,22 @@
1
+ import { CollectionConfig, WorkflowConfig, WorkflowMetadata, WorkflowState, WorkflowTransition } from '@dyrected/core';
2
+ export type WorkflowDocumentLike = Record<string, unknown> & {
3
+ id?: string;
4
+ _workflow?: WorkflowMetadata | null;
5
+ };
6
+ export declare function resolveWorkflowState(workflowConfig: WorkflowConfig | null | undefined, workflowMeta: Pick<WorkflowMetadata, "state"> | null | undefined): WorkflowState | null;
7
+ export declare function resolveWorkflowStateFromDocument(workflowConfig: WorkflowConfig | null | undefined, item: WorkflowDocumentLike): WorkflowState | null;
8
+ export type PublishingStatusSummary = {
9
+ label: "Draft" | "Published" | "Changed";
10
+ color: "warning" | "success" | "info";
11
+ workflowStateLabel: string | null;
12
+ };
13
+ export declare function resolvePublishingStatus(schema: CollectionConfig | undefined, item: Record<string, unknown>): PublishingStatusSummary | null;
14
+ export declare function getAvailableWorkflowTransitions(workflowConfig: WorkflowConfig | null | undefined, workflowMeta: WorkflowMetadata | null | undefined): WorkflowTransition[];
15
+ export declare function getPrimaryWorkflowTransition(transitions: WorkflowTransition[]): WorkflowTransition | null;
16
+ export declare function shouldUseSaveDraftAsPrimaryAction(workflowConfig: WorkflowConfig | null | undefined, workflowMeta: WorkflowMetadata | null | undefined): boolean;
17
+ export type GroupedWorkflowTransitions = {
18
+ normal: WorkflowTransition[];
19
+ unpublish: WorkflowTransition[];
20
+ };
21
+ export declare function groupWorkflowTransitions(transitions: WorkflowTransition[]): GroupedWorkflowTransitions;
22
+ export declare function getCommonWorkflowTransitions(workflowConfig: WorkflowConfig | null | undefined, docs: WorkflowDocumentLike[]): WorkflowTransition[];
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,14 @@
1
+ import { DyrectedFormController } from '../controllers/form';
2
+ import * as React from "react";
3
+ export interface DyrectedFormProviderProps {
4
+ controller: DyrectedFormController;
5
+ children: React.ReactNode;
6
+ }
7
+ export declare function DyrectedFormProvider({ controller, children }: DyrectedFormProviderProps): React.JSX.Element;
8
+ export interface DyrectedFieldPathProviderProps {
9
+ path: string;
10
+ children: React.ReactNode;
11
+ }
12
+ export declare function DyrectedFieldPathProvider({ path, children, }: DyrectedFieldPathProviderProps): React.JSX.Element;
13
+ export declare function useDyrectedFormControllerContext(): DyrectedFormController;
14
+ export declare function useDyrectedFieldPathContext(): string | null;
@@ -0,0 +1,230 @@
1
+ import { AdminThemeController } from '../controllers/theme';
2
+ import { AdminThemePreference, ResolvedAdminTheme } from '../hooks/admin-theme';
3
+ import { DyrectedFieldController } from '../controllers/field';
4
+ import { DyrectedFieldPathPart, DyrectedFieldState, DyrectedFormController, DyrectedFormState, DyrectedFormValues, DyrectedSetValueOptions } from '../controllers/form';
5
+ import { MediaLibraryController, MediaRecord, MediaUploadController, MediaUploadQueueItem, MediaURLClassification, MediaURLController } from '../controllers/media';
6
+ import { AdminSchemas } from '../types/admin-components';
7
+ export interface AdminSchemasResult {
8
+ /** Loaded admin schemas for the active Dyrected client. */
9
+ schemas: AdminSchemas | null;
10
+ /** `true` while schemas are being fetched or refreshed. */
11
+ isLoading: boolean;
12
+ /** The last schema-loading error, if one occurred. */
13
+ error: Error | null;
14
+ /** Re-fetch the schema registry from the backend. */
15
+ refresh(): Promise<AdminSchemas>;
16
+ }
17
+ export interface MediaUploadHookOptions {
18
+ /** Target upload collection. Falls back to `"media"` when the collection is not upload-enabled. */
19
+ collectionSlug?: string;
20
+ /** Compress image files in the browser before upload. */
21
+ compressImages?: boolean;
22
+ /** Maximum image width or height after compression. */
23
+ maxDimension?: number;
24
+ /** Output image quality used during client-side compression. */
25
+ quality?: number;
26
+ /** Called each time a file completes successfully. */
27
+ onCompletedItem?: (item: MediaRecord) => void | Promise<void>;
28
+ /** Called once the full batch completes successfully. */
29
+ onAllCompleted?: (items: MediaRecord[]) => void | Promise<void>;
30
+ /** Called when an individual file upload fails. */
31
+ onError?: (error: Error, file: File) => void;
32
+ }
33
+ export interface MediaUploadHookResult {
34
+ /** The current upload queue. */
35
+ queue: MediaUploadQueueItem[];
36
+ /** `true` while any queued file is uploading. */
37
+ isUploading: boolean;
38
+ /** The collection currently being uploaded to. */
39
+ activeCollection: string;
40
+ /** Add one or more files to the upload queue and process them. */
41
+ uploadFiles(files: File[]): Promise<MediaRecord[]>;
42
+ /** Retry a previously failed queue item. */
43
+ retryUpload(id: string): Promise<MediaRecord | null>;
44
+ /** Remove one queue item without clearing the full queue. */
45
+ removeQueueItem(id: string): void;
46
+ /** Remove completed items from the queue. */
47
+ clearCompleted(): void;
48
+ /** Clear the queue contents exposed by this public API. */
49
+ clearQueue(): void;
50
+ /** Underlying framework-agnostic controller for advanced integrations. */
51
+ controller: MediaUploadController;
52
+ }
53
+ export interface MediaLibraryHookOptions {
54
+ /** Collection whose media should be browsed. Falls back to `"media"` when needed. */
55
+ collection: string;
56
+ /** Number of assets to fetch per page. */
57
+ pageSize?: number;
58
+ /** Initial filename search query. */
59
+ initialSearchQuery?: string;
60
+ /** Asset ids that should start selected. */
61
+ initialSelectedIds?: string[];
62
+ }
63
+ export interface MediaLibraryHookResult {
64
+ /** The resolved collection used by the media library. */
65
+ activeCollection: string;
66
+ /** Media items loaded for the current page and query. */
67
+ items: MediaRecord[];
68
+ /** Currently selected media ids. */
69
+ selectedIds: string[];
70
+ /** Selected media items derived from `items` and `selectedIds`. */
71
+ selectedItems: MediaRecord[];
72
+ /** Current search query. */
73
+ searchQuery: string;
74
+ /** Current page number. */
75
+ page: number;
76
+ /** `true` when another page can be loaded. */
77
+ hasNextPage: boolean;
78
+ /** `true` while a library request is in flight. */
79
+ isLoading: boolean;
80
+ /** The last library error, if any. */
81
+ error: Error | null;
82
+ /** Load the first page using the current query. */
83
+ load(): Promise<MediaRecord[]>;
84
+ /** Run a filename search and load the first page of results. */
85
+ search(query: string): Promise<MediaRecord[]>;
86
+ /** Load the next page and append it to the current results. */
87
+ loadNextPage(): Promise<MediaRecord[]>;
88
+ /** Replace the current selection with these ids. */
89
+ setSelectedIds(ids: string[]): void;
90
+ /** Add one id to the current selection. */
91
+ select(id: string): void;
92
+ /** Remove one id from the current selection. */
93
+ deselect(id: string): void;
94
+ /** Toggle one id in the current selection. */
95
+ toggle(id: string): void;
96
+ /** Clear all selected ids. */
97
+ clearSelection(): void;
98
+ /** Underlying framework-agnostic controller for advanced integrations. */
99
+ controller: MediaLibraryController;
100
+ }
101
+ export interface MediaURLHookOptions {
102
+ /** Collection where imported media records should be created. */
103
+ collection: string;
104
+ /** Compress direct image URLs after fetch and before upload. */
105
+ compressImages?: boolean;
106
+ /** Maximum image width or height after compression. */
107
+ maxDimension?: number;
108
+ /** Output image quality used during client-side compression. */
109
+ quality?: number;
110
+ /** Called when a URL import creates a media record successfully. */
111
+ onAdded?: (media: MediaRecord) => void | Promise<void>;
112
+ /** Called when URL classification or import fails. */
113
+ onError?: (error: Error) => void;
114
+ }
115
+ export interface MediaURLHookResult {
116
+ /** The current buffered URL. */
117
+ url: string;
118
+ /** Replace the buffered URL value. */
119
+ setUrl(nextUrl: string): void;
120
+ /** Submit the buffered URL. */
121
+ submit(): Promise<void>;
122
+ /** Import a URL directly without using the buffered value. */
123
+ importURL(nextUrl: string): Promise<MediaRecord>;
124
+ /** Classify a URL before importing it. */
125
+ classifyURL(nextUrl: string): MediaURLClassification;
126
+ /** `true` while a URL import is in flight. */
127
+ isSubmitting: boolean;
128
+ /** `true` when `submit()` can run with the current state. */
129
+ canSubmit: boolean;
130
+ /** The resolved collection used for the import. */
131
+ activeCollection: string;
132
+ /** Underlying framework-agnostic controller for advanced integrations. */
133
+ controller: MediaURLController;
134
+ }
135
+ export interface DyrectedFormHookResult {
136
+ /** Collection currently being edited. */
137
+ collection: string;
138
+ /** Field schema list for the form. */
139
+ fields: DyrectedFormState["fields"];
140
+ /** Current form values. */
141
+ values: DyrectedFormValues;
142
+ /** Current validation errors keyed by field path. */
143
+ errors: DyrectedFormState["errors"];
144
+ /** Dirty flags keyed by field path. */
145
+ dirtyFields: DyrectedFormState["dirtyFields"];
146
+ /** Touched flags keyed by field path. */
147
+ touchedFields: DyrectedFormState["touchedFields"];
148
+ /** `true` when any field has been marked dirty. */
149
+ isDirty: boolean;
150
+ /** `true` while submit is in progress. */
151
+ isSubmitting: boolean;
152
+ /** `true` when the form is currently valid. */
153
+ isValid: boolean;
154
+ /** Number of submit attempts made through this controller. */
155
+ submitCount: number;
156
+ /** `true` when the form is read-only. */
157
+ readOnly: boolean;
158
+ /** Current document id, when editing an existing document. */
159
+ documentId?: string;
160
+ /** Read one value by dotted field path. */
161
+ getValue(path: string): unknown;
162
+ /** Read the full form value object. */
163
+ getValues(): DyrectedFormValues;
164
+ /** Write one value by dotted field path. */
165
+ setValue(path: string, value: unknown, options?: DyrectedSetValueOptions): void;
166
+ /** Read one field schema by dotted field path. */
167
+ getFieldSchema(path: string): DyrectedFieldState["schema"];
168
+ /** Read one field state by dotted field path. */
169
+ getFieldState(path: string): DyrectedFieldState;
170
+ /** Reset the form to supplied values or initial state. */
171
+ reset(values?: DyrectedFormValues): void;
172
+ /** Validate the full form or one or more field paths. */
173
+ validate(paths?: string | string[]): Promise<boolean>;
174
+ /** Submit the form through its configured adapter. */
175
+ submit(): Promise<unknown>;
176
+ /** Underlying framework-agnostic controller for advanced integrations. */
177
+ controller: DyrectedFormController;
178
+ }
179
+ export interface DyrectedFieldHookResult {
180
+ /** Full resolved field path. */
181
+ path: string;
182
+ /** Field schema for this path. */
183
+ schema: DyrectedFieldState["schema"];
184
+ /** Current field value. */
185
+ value: unknown;
186
+ /** Validation error for this field, if any. */
187
+ error?: string;
188
+ /** `true` when this field is dirty. */
189
+ isDirty: boolean;
190
+ /** `true` when this field has been touched. */
191
+ isTouched: boolean;
192
+ /** `true` when this field is invalid. */
193
+ invalid: boolean;
194
+ /** Path split into segments. */
195
+ pathSegments: string[];
196
+ /** Parent path for this field. */
197
+ parentPath: string;
198
+ /** Join child path segments onto this field path. */
199
+ getChildPath(...parts: DyrectedFieldPathPart[]): string;
200
+ /** Build a child path under a specific array index. */
201
+ getItemPath(index: number, ...parts: DyrectedFieldPathPart[]): string;
202
+ /** Read a nested child value relative to this field path. */
203
+ getChildValue(...parts: DyrectedFieldPathPart[]): unknown;
204
+ /** Read a nested child schema relative to this field path. */
205
+ getChildSchema(...parts: DyrectedFieldPathPart[]): DyrectedFieldState["schema"];
206
+ /** Read a nested child state relative to this field path. */
207
+ getChildState(...parts: DyrectedFieldPathPart[]): DyrectedFieldState;
208
+ /** Write a nested child value relative to this field path. */
209
+ setChildValue(parts: DyrectedFieldPathPart | DyrectedFieldPathPart[], value: unknown, options?: DyrectedSetValueOptions): void;
210
+ /** Write this field's value. */
211
+ setValue(value: unknown, options?: DyrectedSetValueOptions): void;
212
+ /** Validate this field path. */
213
+ validate(): Promise<boolean>;
214
+ /** Underlying framework-agnostic controller for advanced integrations. */
215
+ controller: DyrectedFieldController;
216
+ }
217
+ export interface AdminThemeHookResult {
218
+ /** Stored theme preference. */
219
+ theme: AdminThemePreference;
220
+ /** Current detected system theme. */
221
+ systemTheme: ResolvedAdminTheme;
222
+ /** Resolved theme after applying the preference. */
223
+ resolvedTheme: ResolvedAdminTheme;
224
+ /** CSS class name that should be applied to the themed root. */
225
+ themeClassName: string;
226
+ /** Update the stored theme preference. */
227
+ setTheme(theme: AdminThemePreference): void;
228
+ /** Underlying controller, or `null` when using fallback state without a provider. */
229
+ controller: AdminThemeController | null;
230
+ }
@@ -0,0 +1,26 @@
1
+ export type { AdminComponents, AdminFieldComponentContext, AdminFieldComponentProps, AdminSchemas, CollectionListSlotProps, DashboardSlotProps, } from '../types/admin-components';
2
+ export type { AdminSchemasResult, AdminThemeHookResult, DyrectedFieldHookResult, DyrectedFormHookResult, MediaLibraryHookOptions, MediaLibraryHookResult, MediaUploadHookOptions, MediaUploadHookResult, MediaURLHookOptions, MediaURLHookResult, } from './contracts';
3
+ export { createDyrectedFieldController, } from '../controllers/field';
4
+ export { createDyrectedFormController, getFieldPathSegments, getParentFieldPath, getValueAtPath, joinFieldPath, normalizeFieldPath, setValueAtPath, } from '../controllers/form';
5
+ export { createAdminThemeController, } from '../controllers/theme';
6
+ export { createMediaLibraryController, createMediaUploadController, createMediaURLController, } from '../controllers/media';
7
+ export type { DyrectedFieldController, } from '../controllers/field';
8
+ export type { DyrectedFieldState, DyrectedFormController, DyrectedFormControllerAdapters, DyrectedFormControllerOptions, DyrectedFieldPathPart, DyrectedFormState, DyrectedFormValues, DyrectedSetValueOptions, } from '../controllers/form';
9
+ export type { AdminThemeController, AdminThemeControllerOptions, AdminThemeControllerState, } from '../controllers/theme';
10
+ export type { MediaControllerSchemas, MediaLibraryController, MediaLibraryControllerOptions, MediaLibraryControllerState, MediaRecord, MediaUploadController, MediaUploadControllerOptions, MediaUploadControllerState, MediaUploadQueueItem, MediaURLClassification, MediaURLController, MediaURLControllerOptions, MediaURLControllerState, } from '../controllers/media';
11
+ export { compressImage } from '../lib/compress-image';
12
+ export { buildExternalMediaPayload, filenameFromUrl, isDirectImageUrl, isEmbeddableVideoUrl, } from '../lib/external-media';
13
+ export { formatMediaErrorMessage, getMediaSourceInfo, isExternalMedia, resolveActiveMediaCollection, } from '../lib/media-utils';
14
+ export { buildDefaultValues, buildSchemaShape, formatPath, getFlatErrors, resolveContainerPath, } from '../components/forms/utils';
15
+ export { DyrectedFieldPathProvider, DyrectedFormProvider, } from '../providers/dyrected-form-context';
16
+ export type { DyrectedFieldPathProviderProps, DyrectedFormProviderProps, } from '../providers/dyrected-form-context';
17
+ export { AdminThemeProvider, AdminThemedRoot, } from '../hooks/admin-theme-provider';
18
+ export { adminThemeClassName, getSystemAdminTheme, resolveAdminTheme, } from '../hooks/admin-theme';
19
+ export type { AdminThemePreference, ResolvedAdminTheme, } from '../hooks/admin-theme';
20
+ export { useAdminTheme } from '../hooks/use-admin-theme';
21
+ export { useDyrectedForm } from '../hooks/use-dyrected-form';
22
+ export { useField } from '../hooks/use-field';
23
+ export { useMediaLibrary } from '../hooks/use-media-library';
24
+ export { useMediaUpload } from '../hooks/use-media-upload';
25
+ export { useMediaURL } from '../hooks/use-media-url';
26
+ export { useAddMediaFromUrl } from '../hooks/use-add-media-from-url';
@@ -0,0 +1,2 @@
1
+ import { A as buildExternalMediaPayload, C as useMediaUpload, D as createMediaURLController, E as createMediaLibraryController, F as isEmbeddableVideoUrl, G as resolveAdminTheme, H as useAdminTheme, L as formatMediaErrorMessage, O as createMediaUploadController, P as isDirectImageUrl, R as getMediaSourceInfo, S as resolveContainerPath, T as useMediaLibrary, U as adminThemeClassName, V as resolveActiveMediaCollection, W as getSystemAdminTheme, _ as buildDefaultValues, a as useField, b as getFlatErrors, c as DyrectedFieldPathProvider, d as getFieldPathSegments, f as getParentFieldPath, g as setValueAtPath, h as normalizeFieldPath, i as createAdminThemeController, j as filenameFromUrl, k as compressImage, l as DyrectedFormProvider, m as joinFieldPath, n as AdminThemeProvider, o as createDyrectedFieldController, p as getValueAtPath, r as AdminThemedRoot, s as useDyrectedForm, t as useAddMediaFromUrl, u as createDyrectedFormController, v as buildSchemaShape, w as useMediaURL, y as formatPath, z as isExternalMedia } from "../use-add-media-from-url-DHGAAVLY.js";
2
+ export { AdminThemeProvider, AdminThemedRoot, DyrectedFieldPathProvider, DyrectedFormProvider, adminThemeClassName, buildDefaultValues, buildExternalMediaPayload, buildSchemaShape, compressImage, createAdminThemeController, createDyrectedFieldController, createDyrectedFormController, createMediaLibraryController, createMediaURLController, createMediaUploadController, filenameFromUrl, formatMediaErrorMessage, formatPath, getFieldPathSegments, getFlatErrors, getMediaSourceInfo, getParentFieldPath, getSystemAdminTheme, getValueAtPath, isDirectImageUrl, isEmbeddableVideoUrl, isExternalMedia, joinFieldPath, normalizeFieldPath, resolveActiveMediaCollection, resolveAdminTheme, resolveContainerPath, setValueAtPath, useAddMediaFromUrl, useAdminTheme, useDyrectedForm, useField, useMediaLibrary, useMediaURL, useMediaUpload };
@@ -0,0 +1,2 @@
1
+ export * from './public/index.js'
2
+ export {}
@@ -1,5 +1,5 @@
1
1
  import { ComponentType } from 'react';
2
- import { AdminConfig, Block, CollectionConfig, GlobalConfig, PublicAdminAuthConfig } from '@dyrected/core';
2
+ import { AdminConfig, Block, CollectionConfig, Field as FieldSchema, GlobalConfig, PublicAdminAuthConfig } from '@dyrected/core';
3
3
  import { DyrectedClient, PaginatedResult } from '@dyrected/sdk';
4
4
  /** All collection and global schemas returned by the backend, plus optional admin config. */
5
5
  export interface AdminSchemas {
@@ -8,6 +8,7 @@ export interface AdminSchemas {
8
8
  globals: GlobalConfig[];
9
9
  admin?: AdminConfig;
10
10
  adminAuth?: PublicAdminAuthConfig;
11
+ hasStorage?: boolean;
11
12
  }
12
13
  /** Props injected into custom dashboard slot components. */
13
14
  export interface DashboardSlotProps {
@@ -54,6 +55,20 @@ export interface CollectionListSlotProps {
54
55
  create: string;
55
56
  };
56
57
  }
58
+ export interface AdminFieldComponentContext {
59
+ user: Record<string, unknown> | null;
60
+ schemas?: AdminSchemas;
61
+ siblingData: Record<string, unknown>;
62
+ }
63
+ export interface AdminFieldComponentProps {
64
+ value: unknown;
65
+ onChange: (...event: any[]) => void;
66
+ field: FieldSchema;
67
+ path: string;
68
+ disabled?: boolean;
69
+ collection: string;
70
+ context?: AdminFieldComponentContext;
71
+ }
57
72
  /**
58
73
  * Custom component overrides passed to `<DyrectedAdmin />`. Each key is a
59
74
  * registry: you reference a component by a string key in your schema config,
@@ -80,7 +95,7 @@ export interface AdminComponents {
80
95
  * registered under that key replaces the built-in input for that field.
81
96
  * Keys are arbitrary — this is a per-field override, not a per-type one.
82
97
  */
83
- fields?: Record<string, ComponentType<any>>;
98
+ fields?: Record<string, ComponentType<AdminFieldComponentProps>>;
84
99
  /**
85
100
  * Dashboard slot components keyed by the slot-key names declared in the
86
101
  * top-level `admin.components` (`beforeDashboard` / `afterDashboard`).