@firecms/collection_editor 3.0.1 → 3.1.0-canary.9e89e98
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/ConfigControllerProvider.d.ts +6 -0
- package/dist/api/generateCollectionApi.d.ts +71 -0
- package/dist/api/index.d.ts +1 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.es.js +9418 -5587
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +9413 -5582
- package/dist/index.umd.js.map +1 -1
- package/dist/types/collection_editor_controller.d.ts +14 -0
- package/dist/types/collection_inference.d.ts +8 -2
- package/dist/types/config_controller.d.ts +23 -2
- package/dist/ui/AddKanbanColumnAction.d.ts +11 -0
- package/dist/ui/KanbanSetupAction.d.ts +10 -0
- package/dist/ui/collection_editor/AICollectionGeneratorPopover.d.ts +33 -0
- package/dist/ui/collection_editor/AIModifiedPathsContext.d.ts +20 -0
- package/dist/ui/collection_editor/CollectionDetailsForm.d.ts +2 -3
- package/dist/ui/collection_editor/CollectionEditorDialog.d.ts +20 -0
- package/dist/ui/collection_editor/CollectionEditorWelcomeView.d.ts +3 -1
- package/dist/ui/collection_editor/CollectionJsonImportDialog.d.ts +7 -0
- package/dist/ui/collection_editor/CollectionYupValidation.d.ts +9 -13
- package/dist/ui/collection_editor/DisplaySettingsForm.d.ts +3 -0
- package/dist/ui/collection_editor/EntityActionsEditTab.d.ts +2 -1
- package/dist/ui/collection_editor/ExtendSettingsForm.d.ts +14 -0
- package/dist/ui/collection_editor/GeneralSettingsForm.d.ts +7 -0
- package/dist/ui/collection_editor/KanbanConfigSection.d.ts +4 -0
- package/dist/ui/collection_editor/PropertyEditView.d.ts +6 -1
- package/dist/ui/collection_editor/PropertyTree.d.ts +2 -1
- package/dist/ui/collection_editor/SubcollectionsEditTab.d.ts +2 -1
- package/dist/ui/collection_editor/ViewModeSwitch.d.ts +6 -0
- package/dist/ui/collection_editor/properties/EnumPropertyField.d.ts +2 -1
- package/dist/ui/collection_editor/properties/conditions/ConditionsEditor.d.ts +10 -0
- package/dist/ui/collection_editor/properties/conditions/ConditionsPanel.d.ts +2 -0
- package/dist/ui/collection_editor/properties/conditions/EnumConditionsEditor.d.ts +6 -0
- package/dist/ui/collection_editor/properties/conditions/index.d.ts +6 -0
- package/dist/ui/collection_editor/properties/conditions/property_paths.d.ts +19 -0
- package/dist/useCollectionEditorPlugin.d.ts +7 -1
- package/dist/utils/validateCollectionJson.d.ts +22 -0
- package/package.json +11 -11
- package/src/ConfigControllerProvider.tsx +81 -47
- package/src/api/generateCollectionApi.ts +119 -0
- package/src/api/index.ts +1 -0
- package/src/index.ts +28 -1
- package/src/types/collection_editor_controller.tsx +16 -3
- package/src/types/collection_inference.ts +15 -2
- package/src/types/config_controller.tsx +27 -2
- package/src/ui/AddKanbanColumnAction.tsx +203 -0
- package/src/ui/EditorCollectionActionStart.tsx +1 -2
- package/src/ui/HomePageEditorCollectionAction.tsx +41 -13
- package/src/ui/KanbanSetupAction.tsx +38 -0
- package/src/ui/MissingReferenceWidget.tsx +1 -1
- package/src/ui/NewCollectionButton.tsx +1 -1
- package/src/ui/PropertyAddColumnComponent.tsx +1 -1
- package/src/ui/collection_editor/AICollectionGeneratorPopover.tsx +225 -0
- package/src/ui/collection_editor/AIModifiedPathsContext.tsx +88 -0
- package/src/ui/collection_editor/CollectionDetailsForm.tsx +209 -257
- package/src/ui/collection_editor/CollectionEditorDialog.tsx +226 -167
- package/src/ui/collection_editor/CollectionEditorWelcomeView.tsx +130 -67
- package/src/ui/collection_editor/CollectionJsonImportDialog.tsx +171 -0
- package/src/ui/collection_editor/CollectionPropertiesEditorForm.tsx +190 -91
- package/src/ui/collection_editor/DisplaySettingsForm.tsx +333 -0
- package/src/ui/collection_editor/EntityActionsEditTab.tsx +106 -96
- package/src/ui/collection_editor/EntityActionsSelectDialog.tsx +6 -7
- package/src/ui/collection_editor/EntityCustomViewsSelectDialog.tsx +1 -3
- package/src/ui/collection_editor/EnumForm.tsx +147 -100
- package/src/ui/collection_editor/ExtendSettingsForm.tsx +93 -0
- package/src/ui/collection_editor/GeneralSettingsForm.tsx +335 -0
- package/src/ui/collection_editor/GetCodeDialog.tsx +57 -36
- package/src/ui/collection_editor/KanbanConfigSection.tsx +207 -0
- package/src/ui/collection_editor/LayoutModeSwitch.tsx +22 -41
- package/src/ui/collection_editor/PropertyEditView.tsx +205 -141
- package/src/ui/collection_editor/PropertyFieldPreview.tsx +1 -1
- package/src/ui/collection_editor/PropertyTree.tsx +130 -58
- package/src/ui/collection_editor/SubcollectionsEditTab.tsx +171 -162
- package/src/ui/collection_editor/UnsavedChangesDialog.tsx +0 -2
- package/src/ui/collection_editor/ViewModeSwitch.tsx +41 -0
- package/src/ui/collection_editor/properties/BlockPropertyField.tsx +0 -2
- package/src/ui/collection_editor/properties/BooleanPropertyField.tsx +1 -0
- package/src/ui/collection_editor/properties/DateTimePropertyField.tsx +117 -35
- package/src/ui/collection_editor/properties/EnumPropertyField.tsx +28 -21
- package/src/ui/collection_editor/properties/MapPropertyField.tsx +0 -2
- package/src/ui/collection_editor/properties/MarkdownPropertyField.tsx +115 -39
- package/src/ui/collection_editor/properties/StoragePropertyField.tsx +1 -1
- package/src/ui/collection_editor/properties/conditions/ConditionsEditor.tsx +861 -0
- package/src/ui/collection_editor/properties/conditions/ConditionsPanel.tsx +28 -0
- package/src/ui/collection_editor/properties/conditions/EnumConditionsEditor.tsx +599 -0
- package/src/ui/collection_editor/properties/conditions/index.ts +6 -0
- package/src/ui/collection_editor/properties/conditions/property_paths.ts +92 -0
- package/src/ui/collection_editor/properties/validation/ValidationPanel.tsx +1 -1
- package/src/useCollectionEditorPlugin.tsx +32 -17
- package/src/utils/validateCollectionJson.ts +380 -0
|
@@ -4,6 +4,7 @@ import { User } from "@firecms/core";
|
|
|
4
4
|
import { CollectionEditorController } from "./types/collection_editor_controller";
|
|
5
5
|
import { CollectionEditorPermissionsBuilder } from "./types/config_permissions";
|
|
6
6
|
import { CollectionInference } from "./types/collection_inference";
|
|
7
|
+
import { CollectionGenerationCallback } from "./api/generateCollectionApi";
|
|
7
8
|
export declare const ConfigControllerContext: React.Context<CollectionsConfigController>;
|
|
8
9
|
export declare const CollectionEditorContext: React.Context<CollectionEditorController>;
|
|
9
10
|
export interface ConfigControllerProviderProps {
|
|
@@ -33,5 +34,10 @@ export interface ConfigControllerProviderProps {
|
|
|
33
34
|
getUser?: (uid: string) => User | null;
|
|
34
35
|
getData?: (path: string, parentPaths: string[]) => Promise<object[]>;
|
|
35
36
|
onAnalyticsEvent?: (event: string, params?: object) => void;
|
|
37
|
+
/**
|
|
38
|
+
* Callback function for generating/modifying collections.
|
|
39
|
+
* The plugin is API-agnostic - the consumer provides the implementation.
|
|
40
|
+
*/
|
|
41
|
+
generateCollection?: CollectionGenerationCallback;
|
|
36
42
|
}
|
|
37
43
|
export declare const ConfigControllerProvider: React.NamedExoticComponent<React.PropsWithChildren<ConfigControllerProviderProps>>;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { EntityCollection } from "@firecms/core";
|
|
2
|
+
export interface GenerateCollectionRequest {
|
|
3
|
+
/** User's natural language description of what they want */
|
|
4
|
+
prompt: string;
|
|
5
|
+
/** Other collections in the project (for context/relationships). Limit to 30. */
|
|
6
|
+
existingCollections: Partial<EntityCollection>[];
|
|
7
|
+
/** Optional for generate, required for modifications. If provided, modifies this collection */
|
|
8
|
+
existingCollection?: Partial<EntityCollection>;
|
|
9
|
+
}
|
|
10
|
+
/** Operation types for modifying a collection */
|
|
11
|
+
export type CollectionOperationType = "add" | "modify" | "delete";
|
|
12
|
+
/** A single operation describing what changed */
|
|
13
|
+
export interface CollectionOperation {
|
|
14
|
+
op: CollectionOperationType;
|
|
15
|
+
path: string;
|
|
16
|
+
value?: any;
|
|
17
|
+
}
|
|
18
|
+
/** Result from collection generation, including optional delta operations */
|
|
19
|
+
export interface GenerateCollectionResult {
|
|
20
|
+
collection: EntityCollection;
|
|
21
|
+
operations?: CollectionOperation[];
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Callback type for generating or modifying a collection.
|
|
25
|
+
* The plugin is API-agnostic - consumers implement the actual API call.
|
|
26
|
+
*/
|
|
27
|
+
export type CollectionGenerationCallback = (request: GenerateCollectionRequest) => Promise<GenerateCollectionResult>;
|
|
28
|
+
export declare class CollectionGenerationApiError extends Error {
|
|
29
|
+
code?: string;
|
|
30
|
+
constructor(message: string, code?: string);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Default endpoint for AI collection generation
|
|
34
|
+
*/
|
|
35
|
+
export declare const DEFAULT_COLLECTION_GENERATION_ENDPOINT = "https://api.firecms.co/collections/generate";
|
|
36
|
+
/**
|
|
37
|
+
* Props for building a collection generation callback
|
|
38
|
+
*/
|
|
39
|
+
export interface BuildCollectionGenerationCallbackProps {
|
|
40
|
+
/**
|
|
41
|
+
* Function to get the auth token (e.g., from Firebase Auth)
|
|
42
|
+
* This is typically `authController.getAuthToken` from `@firecms/firebase`
|
|
43
|
+
*/
|
|
44
|
+
getAuthToken: () => Promise<string>;
|
|
45
|
+
/**
|
|
46
|
+
* Optional custom API endpoint for collection generation.
|
|
47
|
+
* Defaults to the FireCMS SaaS API endpoint.
|
|
48
|
+
*/
|
|
49
|
+
apiEndpoint?: string;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Build a callback for AI collection generation.
|
|
53
|
+
* This helper allows self-hosted FireCMS users to enable the AI collection
|
|
54
|
+
* generation feature.
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```typescript
|
|
58
|
+
* import { useCollectionEditorPlugin, buildCollectionGenerationCallback } from "@firecms/collection_editor";
|
|
59
|
+
* import { useFirebaseAuthController } from "@firecms/firebase";
|
|
60
|
+
*
|
|
61
|
+
* const authController = useFirebaseAuthController({ firebaseApp });
|
|
62
|
+
*
|
|
63
|
+
* const collectionEditorPlugin = useCollectionEditorPlugin({
|
|
64
|
+
* // ... other props
|
|
65
|
+
* generateCollection: buildCollectionGenerationCallback({
|
|
66
|
+
* getAuthToken: authController.getAuthToken
|
|
67
|
+
* })
|
|
68
|
+
* });
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
export declare function buildCollectionGenerationCallback({ getAuthToken, apiEndpoint }: BuildCollectionGenerationCallbackProps): CollectionGenerationCallback;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./generateCollectionApi";
|
package/dist/index.d.ts
CHANGED
|
@@ -3,10 +3,14 @@ export { useCollectionEditorController } from "./useCollectionEditorController";
|
|
|
3
3
|
export { useCollectionsConfigController } from "./useCollectionsConfigController";
|
|
4
4
|
export { editableProperty, removeNonEditableProperties } from "./utils/entities";
|
|
5
5
|
export * from "./utils/collections";
|
|
6
|
-
export
|
|
6
|
+
export { validateCollectionJson, type CollectionValidationError, type CollectionValidationResult } from "./utils/validateCollectionJson";
|
|
7
|
+
export type { CollectionsConfigController, DeleteCollectionParams, SaveCollectionParams, UpdateCollectionParams, CollectionsSetupInfo, UpdatePropertiesOrderParams, UpdateKanbanColumnsOrderParams } from "./types/config_controller";
|
|
7
8
|
export type { CollectionEditorController } from "./types/collection_editor_controller";
|
|
8
9
|
export type { CollectionEditorPermissions, CollectionEditorPermissionsBuilder } from "./types/config_permissions";
|
|
9
10
|
export type { PersistedCollection } from "./types/persisted_collection";
|
|
10
11
|
export type { CollectionInference } from "./types/collection_inference";
|
|
12
|
+
export { buildCollectionGenerationCallback, CollectionGenerationApiError, DEFAULT_COLLECTION_GENERATION_ENDPOINT } from "./api/generateCollectionApi";
|
|
13
|
+
export type { CollectionGenerationCallback, GenerateCollectionRequest, GenerateCollectionResult, CollectionOperation, CollectionOperationType, BuildCollectionGenerationCallbackProps } from "./api/generateCollectionApi";
|
|
11
14
|
export { MissingReferenceWidget } from "./ui/MissingReferenceWidget";
|
|
12
15
|
export * from "./ui/collection_editor/util";
|
|
16
|
+
export { PropertyForm, PropertyFormDialog, type PropertyFormProps, type OnPropertyChangedParams } from "./ui/collection_editor/PropertyEditView";
|