node_modules ignore

This commit is contained in:
2025-05-08 23:43:47 +02:00
parent e19d52f172
commit 4574544c9f
65041 changed files with 10593536 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
import * as React from 'react';
import { FlexProps } from '@strapi/design-system';
import type { Struct } from '@strapi/types';
interface ComponentIconProps extends FlexProps {
showBackground?: boolean;
icon?: Struct.ContentTypeSchemaInfo['icon'];
}
declare const ComponentIcon: ({ showBackground, icon, ...props }: ComponentIconProps) => import("react/jsx-runtime").JSX.Element;
declare const COMPONENT_ICONS: Record<string, React.ComponentType<any>>;
export { ComponentIcon, COMPONENT_ICONS };
export type { ComponentIconProps };

View File

@@ -0,0 +1,9 @@
import type { Schema } from '@strapi/types';
interface EditFieldFormProps {
attribute?: Schema.Attribute.AnyAttribute;
name: string;
onClose: () => void;
}
declare const EditFieldForm: ({ attribute, name, onClose }: EditFieldFormProps) => import("react/jsx-runtime").JSX.Element | null;
export { EditFieldForm };
export type { EditFieldFormProps };

View File

@@ -0,0 +1,21 @@
import * as React from 'react';
import { type UseDragAndDropOptions } from '../../hooks/useDragAndDrop';
import { EditFieldFormProps } from './EditFieldForm';
import type { EditLayout } from '../../hooks/useDocumentLayout';
interface FieldsProps extends Pick<EditLayout, 'metadatas'>, Pick<FieldProps, 'components'> {
attributes: {
[key: string]: FieldProps['attribute'];
};
fieldSizes: Record<string, number>;
components: EditLayout['components'];
}
declare const Fields: ({ attributes, fieldSizes, components, metadatas }: FieldsProps) => import("react/jsx-runtime").JSX.Element;
interface FieldProps extends Pick<EditFieldFormProps, 'name' | 'attribute'> {
components: EditLayout['components'];
index: [row: number, index: number];
onMoveField: UseDragAndDropOptions<number[]>['onMoveItem'];
onRemoveField: React.MouseEventHandler<HTMLButtonElement>;
}
declare const TEMP_FIELD_NAME = "_TEMP_";
export { Fields, TEMP_FIELD_NAME };
export type { FieldsProps };

View File

@@ -0,0 +1,32 @@
import { FormProps } from '@strapi/admin/strapi-admin';
import { FieldsProps } from './Fields';
import type { EditFieldLayout, EditLayout } from '../../hooks/useDocumentLayout';
interface ConfigurationFormProps extends Pick<FieldsProps, 'attributes' | 'fieldSizes'> {
layout: EditLayout;
onSubmit: FormProps<ConfigurationFormData>['onSubmit'];
}
/**
* Every key in EditFieldLayout is turned to optional never and then we overwrite the ones we are using.
*/
type EditFieldSpacerLayout = {
[key in keyof Omit<EditFieldLayout, 'name' | 'size'>]?: never;
} & {
description?: never;
editable?: never;
name: '_TEMP_';
size: number;
__temp_key__: string;
};
interface ConfigurationFormData extends Pick<EditLayout, 'settings'> {
layout: Array<{
__temp_key__: string;
children: Array<(Pick<EditFieldLayout, 'label' | 'size' | 'name' | 'placeholder' | 'mainField'> & {
description: EditFieldLayout['hint'];
editable: EditFieldLayout['disabled'];
__temp_key__: string;
}) | EditFieldSpacerLayout>;
}>;
}
declare const ConfigurationForm: ({ attributes, fieldSizes, layout: editLayout, onSubmit, }: ConfigurationFormProps) => import("react/jsx-runtime").JSX.Element;
export { ConfigurationForm };
export type { ConfigurationFormProps, ConfigurationFormData, EditFieldSpacerLayout };

View File

@@ -0,0 +1,13 @@
import * as React from 'react';
import { DragLayerMonitor } from 'react-dnd';
export interface DragLayerProps {
renderItem: (item: {
/**
* TODO: it'd be great if we could make this a union where the type infers the item.
*/
item: any;
type: ReturnType<DragLayerMonitor['getItemType']>;
}) => React.ReactNode;
}
declare const DragLayer: ({ renderItem }: DragLayerProps) => import("react/jsx-runtime").JSX.Element | null;
export { DragLayer };

View File

@@ -0,0 +1,7 @@
interface CardDragPreviewProps {
label: string;
isSibling?: boolean;
}
declare const CardDragPreview: ({ label, isSibling }: CardDragPreviewProps) => import("react/jsx-runtime").JSX.Element;
export { CardDragPreview };
export type { CardDragPreviewProps };

View File

@@ -0,0 +1,6 @@
interface ComponentDragPreviewProps {
displayedValue: string;
}
declare const ComponentDragPreview: ({ displayedValue }: ComponentDragPreviewProps) => import("react/jsx-runtime").JSX.Element;
export { ComponentDragPreview };
export type { ComponentDragPreviewProps };

View File

@@ -0,0 +1,11 @@
import type { Data } from '@strapi/types';
interface RelationDragPreviewProps {
status?: string;
displayedValue: string;
id: Data.ID;
index: number;
width: number;
}
declare const RelationDragPreview: ({ status, displayedValue, width }: RelationDragPreviewProps) => import("react/jsx-runtime").JSX.Element;
export { RelationDragPreview };
export type { RelationDragPreviewProps };

View File

@@ -0,0 +1,9 @@
import * as React from 'react';
import type { Schema } from '@strapi/types';
declare const iconByTypes: Record<Schema.Attribute.Kind, React.ReactElement>;
interface FieldTypeIconProps {
type?: keyof typeof iconByTypes;
customFieldUid?: string;
}
declare const FieldTypeIcon: ({ type, customFieldUid }: FieldTypeIconProps) => React.ReactElement<any, string | React.JSXElementConstructor<any>> | null;
export { FieldTypeIcon };

View File

@@ -0,0 +1,51 @@
/// <reference types="react" />
import { InjectionZoneComponent } from '@strapi/admin/strapi-admin';
declare const INJECTION_ZONES: {
editView: {
informations: never[];
'right-links': never[];
};
listView: {
actions: never[];
deleteModalAdditionalInfos: never[];
publishModalAdditionalInfos: never[];
unpublishModalAdditionalInfos: never[];
};
preview: {
actions: never[];
};
};
interface InjectionZones {
editView: {
informations: InjectionZoneComponent[];
'right-links': InjectionZoneComponent[];
};
listView: {
actions: InjectionZoneComponent[];
deleteModalAdditionalInfos: InjectionZoneComponent[];
publishModalAdditionalInfos: InjectionZoneComponent[];
unpublishModalAdditionalInfos: InjectionZoneComponent[];
};
preview: {
actions: InjectionZoneComponent[];
};
}
type InjectionZoneArea = 'editView.informations' | 'editView.right-links' | 'listView.actions' | 'listView.unpublishModalAdditionalInfos' | 'listView.deleteModalAdditionalInfos' | 'listView.publishModalAdditionalInfos' | 'listView.deleteModalAdditionalInfos' | 'preview.actions';
type InjectionZoneModule = InjectionZoneArea extends `${infer Word}.${string}` ? Word : never;
type InjectionZoneContainer = InjectionZoneArea extends `${string}.${infer Word}.${string}` ? Word : never;
type InjectionZoneBlock = InjectionZoneArea extends `${string}.${string}.${infer Word}` ? Word : never;
/**
* You can't know what this component props will be because it's generic and used everywhere
* e.g. content-manager edit view, we just send the slug but we might not in the listView,
* therefore, people should type it themselves on the components they render.
*/
declare const InjectionZone: ({ area, ...props }: {
area: InjectionZoneArea;
[key: string]: unknown;
}) => import("react/jsx-runtime").JSX.Element;
export declare const useInjectionZone: (area: InjectionZoneArea) => {
name: string;
Component: import("react").ComponentType<{}>;
}[];
export { InjectionZone, INJECTION_ZONES };
export type { InjectionZoneArea, InjectionZoneComponent, InjectionZones, InjectionZoneModule, InjectionZoneContainer, InjectionZoneBlock, };

View File

@@ -0,0 +1,2 @@
declare const LeftMenu: () => import("react/jsx-runtime").JSX.Element;
export { LeftMenu };

View File

@@ -0,0 +1,28 @@
import * as React from 'react';
import { Duration } from 'date-fns';
interface CustomInterval {
unit: keyof Duration;
text: string;
threshold: number;
}
interface RelativeTimeProps extends React.ComponentPropsWithoutRef<'time'> {
timestamp: Date;
customIntervals?: CustomInterval[];
}
/**
* Displays the relative time between a given timestamp and the current time.
* You can display a custom message for given time intervals by passing an array of custom intervals.
*
* @example
* ```jsx
* <caption>Display "last hour" if the timestamp is less than an hour ago</caption>
* <RelativeTime
* timestamp={new Date('2021-01-01')}
* customIntervals={[
* { unit: 'hours', threshold: 1, text: 'last hour' },
* ]}
* ```
*/
declare const RelativeTime: React.ForwardRefExoticComponent<RelativeTimeProps & React.RefAttributes<HTMLTimeElement>>;
export { RelativeTime };
export type { CustomInterval, RelativeTimeProps };

View File

@@ -0,0 +1,3 @@
declare const LastEditedWidget: () => import("react/jsx-runtime").JSX.Element;
declare const LastPublishedWidget: () => import("react/jsx-runtime").JSX.Element;
export { LastEditedWidget, LastPublishedWidget };

View File

@@ -0,0 +1,14 @@
declare const CREATED_BY_ATTRIBUTE_NAME = "createdBy";
declare const UPDATED_BY_ATTRIBUTE_NAME = "updatedBy";
declare const CREATOR_FIELDS: string[];
declare const PUBLISHED_BY_ATTRIBUTE_NAME = "publishedBy";
declare const CREATED_AT_ATTRIBUTE_NAME = "createdAt";
declare const UPDATED_AT_ATTRIBUTE_NAME = "updatedAt";
declare const PUBLISHED_AT_ATTRIBUTE_NAME = "publishedAt";
declare const DOCUMENT_META_FIELDS: string[];
/**
* List of attribute types that cannot be used as the main field.
* Not sure the name could be any clearer.
*/
declare const ATTRIBUTE_TYPES_THAT_CANNOT_BE_MAIN_FIELD: string[];
export { ATTRIBUTE_TYPES_THAT_CANNOT_BE_MAIN_FIELD, CREATED_AT_ATTRIBUTE_NAME, UPDATED_AT_ATTRIBUTE_NAME, PUBLISHED_AT_ATTRIBUTE_NAME, CREATED_BY_ATTRIBUTE_NAME, UPDATED_BY_ATTRIBUTE_NAME, PUBLISHED_BY_ATTRIBUTE_NAME, CREATOR_FIELDS, DOCUMENT_META_FIELDS, };

View File

@@ -0,0 +1,3 @@
declare const SINGLE_TYPES = "single-types";
declare const COLLECTION_TYPES = "collection-types";
export { SINGLE_TYPES, COLLECTION_TYPES };

View File

@@ -0,0 +1,8 @@
export declare const ItemTypes: {
readonly COMPONENT: "component";
readonly EDIT_FIELD: "editField";
readonly FIELD: "field";
readonly DYNAMIC_ZONE: "dynamicZone";
readonly RELATION: "relation";
readonly BLOCKS: "blocks";
};

View File

@@ -0,0 +1,26 @@
export declare const HOOKS: {
/**
* Hook that allows to mutate the displayed headers of the list view table
* @constant
* @type {string}
*/
INJECT_COLUMN_IN_TABLE: string;
/**
* Hook that allows to mutate the CM's collection types links pre-set filters
* @constant
* @type {string}
*/
MUTATE_COLLECTION_TYPES_LINKS: string;
/**
* Hook that allows to mutate the CM's edit view layout
* @constant
* @type {string}
*/
MUTATE_EDIT_VIEW_LAYOUT: string;
/**
* Hook that allows to mutate the CM's single types links pre-set filters
* @constant
* @type {string}
*/
MUTATE_SINGLE_TYPES_LINKS: string;
};

View File

@@ -0,0 +1,3 @@
declare const PLUGIN_ID = "content-manager";
declare const PERMISSIONS: string[];
export { PLUGIN_ID, PERMISSIONS };

View File

@@ -0,0 +1,137 @@
import { type DocumentActionPosition, type DocumentActionDescription } from './pages/EditView/components/DocumentActions';
import { type HeaderActionDescription } from './pages/EditView/components/Header';
import { type PanelDescription } from './pages/EditView/components/Panels';
import { type BulkActionDescription } from './pages/ListView/components/BulkActions/Actions';
import type { Document } from './hooks/useDocument';
import type { DocumentMetadata } from '../../shared/contracts/collection-types';
import type { DescriptionComponent } from '@strapi/admin/strapi-admin';
type DescriptionReducer<Config extends object> = (prev: Config[]) => Config[];
interface EditViewContext {
/**
* This will ONLY be null, if the content-type
* does not have draft & published enabled.
*/
activeTab: 'draft' | 'published' | null;
/**
* Will be either 'single-types' | 'collection-types'
*/
collectionType: string;
/**
* this will be undefined if someone is creating an entry.
*/
document?: Document;
/**
* this will be undefined if someone is creating an entry.
*/
documentId?: string;
/**
* this will be undefined if someone is creating an entry.
*/
meta?: DocumentMetadata;
/**
* The current content-type's model.
*/
model: string;
}
interface ListViewContext {
/**
* Will be either 'single-types' | 'collection-types'
*/
collectionType: string;
/**
* The current selected documents in the table
*/
documents: Document[];
/**
* The current content-type's model.
*/
model: string;
}
interface PanelComponentProps extends EditViewContext {
}
interface PanelComponent extends DescriptionComponent<PanelComponentProps, PanelDescription> {
/**
* The defaults are added by Strapi only, if you're providing your own component,
* you do not need to provide this.
*/
type?: 'actions' | 'releases';
}
interface DocumentActionProps extends EditViewContext {
}
interface DocumentActionComponent extends DescriptionComponent<DocumentActionProps, DocumentActionDescription> {
type?: 'clone' | 'configure-the-view' | 'delete' | 'discard' | 'edit' | 'edit-the-model' | 'history' | 'publish' | 'unpublish' | 'update';
position?: DocumentActionDescription['position'];
}
interface HeaderActionProps extends EditViewContext {
}
interface HeaderActionComponent extends DescriptionComponent<HeaderActionProps, HeaderActionDescription> {
}
interface BulkActionComponentProps extends ListViewContext {
}
interface BulkActionComponent extends DescriptionComponent<BulkActionComponentProps, BulkActionDescription> {
type?: 'delete' | 'publish' | 'unpublish';
}
declare class ContentManagerPlugin {
/**
* The following properties are the stored ones provided by any plugins registering with
* the content-manager. The function calls however, need to be called at runtime in the
* application, so instead we collate them and run them later with the complete list incl.
* ones already registered & the context of the view.
*/
bulkActions: BulkActionComponent[];
documentActions: DocumentActionComponent[];
editViewSidePanels: PanelComponent[];
headerActions: HeaderActionComponent[];
constructor();
addEditViewSidePanel(panels: DescriptionReducer<PanelComponent>): void;
addEditViewSidePanel(panels: PanelComponent[]): void;
addDocumentAction(actions: DescriptionReducer<DocumentActionComponent>): void;
addDocumentAction(actions: DocumentActionComponent[]): void;
addDocumentHeaderAction(actions: DescriptionReducer<HeaderActionComponent>): void;
addDocumentHeaderAction(actions: HeaderActionComponent[]): void;
addBulkAction(actions: DescriptionReducer<BulkActionComponent>): void;
addBulkAction(actions: BulkActionComponent[]): void;
get config(): {
id: string;
name: string;
injectionZones: {
editView: {
informations: never[];
'right-links': never[];
};
listView: {
actions: never[];
deleteModalAdditionalInfos: never[];
publishModalAdditionalInfos: never[];
unpublishModalAdditionalInfos: never[];
};
preview: {
actions: never[];
};
};
apis: {
addBulkAction: {
(actions: DescriptionReducer<BulkActionComponent>): void;
(actions: BulkActionComponent[]): void;
};
addDocumentAction: {
(actions: DescriptionReducer<DocumentActionComponent>): void;
(actions: DocumentActionComponent[]): void;
};
addDocumentHeaderAction: {
(actions: DescriptionReducer<HeaderActionComponent>): void;
(actions: HeaderActionComponent[]): void;
};
addEditViewSidePanel: {
(panels: DescriptionReducer<PanelComponent>): void;
(panels: PanelComponent[]): void;
};
getBulkActions: () => BulkActionComponent[];
getDocumentActions: (position?: DocumentActionPosition) => DocumentActionComponent[];
getEditViewSidePanels: () => PanelComponent[];
getHeaderActions: () => HeaderActionComponent[];
};
};
}
export { ContentManagerPlugin };
export type { EditViewContext, ListViewContext, BulkActionComponent, BulkActionComponentProps, BulkActionDescription, DescriptionComponent, DescriptionReducer, PanelComponentProps, PanelComponent, PanelDescription, DocumentActionComponent, DocumentActionDescription, DocumentActionProps, HeaderActionComponent, HeaderActionDescription, HeaderActionProps, };

View File

@@ -0,0 +1,13 @@
/**
* This file keeps track of the exports from the CM plugin admin side.
* When we move the CM plugin back to its package, we won't need this
* but should still export the same things.
*/
export { buildValidParams } from './utils/api';
export { DocumentStatus } from './pages/EditView/components/DocumentStatus';
export { useDocument as unstable_useDocument, useContentManagerContext as unstable_useContentManagerContext, } from './hooks/useDocument';
export { useDocumentActions as unstable_useDocumentActions } from './hooks/useDocumentActions';
export { useDocumentLayout as unstable_useDocumentLayout } from './hooks/useDocumentLayout';
export type { EditFieldLayout, EditLayout, ListFieldLayout, ListLayout, } from './hooks/useDocumentLayout';
export * from './features/DocumentRBAC';
export type { EditViewContext, ListViewContext, BulkActionComponent, BulkActionComponentProps, BulkActionDescription, DescriptionComponent, DescriptionReducer, PanelComponentProps, PanelComponent, PanelDescription, DocumentActionComponent, DocumentActionDescription, DocumentActionProps, HeaderActionComponent, HeaderActionDescription, HeaderActionProps, } from './content-manager';

View File

@@ -0,0 +1,37 @@
import * as React from 'react';
import { type Permission } from '@strapi/admin/strapi-admin';
import type { Schema } from '@strapi/types';
/**
* The boolean values indicate the global actions a user can perform on the document.
* The `string[]` values tell us specifically which fields the actions can be performed on,
* for example, if the `canReadFields` array is empty, than no fields can be read by the user.
* This can happen even if the user can read the document.
*/
interface DocumentRBACContextValue {
canCreate?: boolean;
canCreateFields: string[];
canDelete?: boolean;
canPublish?: boolean;
canRead?: boolean;
canReadFields: string[];
canUpdate?: boolean;
canUpdateFields: string[];
canUserAction: (fieldName: string, fieldsUserCanAction: string[], fieldType: Schema.Attribute.Kind) => boolean;
isLoading: boolean;
}
declare const useDocumentRBAC: <Selected, ShouldThrow extends boolean = true>(consumerName: string, selector: (value: DocumentRBACContextValue) => Selected, shouldThrowOnMissingContext?: ShouldThrow | undefined) => ShouldThrow extends true ? Selected : Selected | undefined;
interface DocumentRBACProps {
children: React.ReactNode;
permissions: Permission[] | null;
model?: string;
}
/**
* @internal This component is not meant to be used outside of the Content Manager plugin.
* It depends on knowing the slug/model of the content-type using the params of the URL or the model if it is passed as arg.
* If you do use the hook outside of the context, we default to `false` for all actions.
*
* It then creates an list of `can{Action}` that are passed to the context for consumption
* within the app to enforce RBAC.
*/
declare const DocumentRBAC: ({ children, permissions, model }: DocumentRBACProps) => import("react/jsx-runtime").JSX.Element;
export { DocumentRBAC, useDocumentRBAC, DocumentRBACContextValue, DocumentRBACProps };

View File

@@ -0,0 +1,3 @@
import type { DocumentActionComponent } from '../../content-manager';
declare const HistoryAction: DocumentActionComponent;
export { HistoryAction };

View File

@@ -0,0 +1,17 @@
import { HistoryContextValue } from '../pages/History';
import type { Metadatas } from '../../../../shared/contracts/content-types';
import type { GetInitData } from '../../../../shared/contracts/init';
import type { EditFieldLayout } from '../../hooks/useDocumentLayout';
interface GetRemainingFieldsLayoutOptions extends Pick<HistoryContextValue, 'layout'>, Pick<GetInitData.Response['data'], 'fieldSizes'> {
schemaAttributes: HistoryContextValue['schema']['attributes'];
metadatas: Metadatas;
}
/**
* Build a layout for the fields that are were deleted from the edit view layout
* via the configure the view page. This layout will be merged with the main one.
* Those fields would be restored if the user restores the history version, which is why it's
* important to show them, even if they're not in the normal layout.
*/
declare function getRemaingFieldsLayout({ layout, metadatas, schemaAttributes, fieldSizes, }: GetRemainingFieldsLayoutOptions): EditFieldLayout[][][];
declare const VersionContent: () => import("react/jsx-runtime").JSX.Element;
export { VersionContent, getRemaingFieldsLayout };

View File

@@ -0,0 +1,5 @@
interface VersionHeaderProps {
headerId: string;
}
export declare const VersionHeader: ({ headerId }: VersionHeaderProps) => import("react/jsx-runtime").JSX.Element;
export {};

View File

@@ -0,0 +1,19 @@
import type { EditFieldLayout } from '../../hooks/useDocumentLayout';
import type { DistributiveOmit } from 'react-redux';
type VersionInputRendererProps = DistributiveOmit<EditFieldLayout, 'size'> & {
/**
* In the context of content history, deleted fields need to ignore RBAC
* @default false
*/
shouldIgnoreRBAC?: boolean;
};
/**
* @internal
*
* @description An abstraction around the regular form input renderer designed specifically
* to be used on the History page in the content-manager. It understands how to render specific
* inputs within the context of a history version (i.e. relations, media, ignored RBAC, etc...)
*/
declare const VersionInputRenderer: ({ visible, hint: providedHint, shouldIgnoreRBAC, labelAction, ...props }: VersionInputRendererProps) => import("react/jsx-runtime").JSX.Element | null;
export type { VersionInputRendererProps };
export { VersionInputRenderer };

View File

@@ -0,0 +1,2 @@
declare const VersionsList: () => import("react/jsx-runtime").JSX.Element;
export { VersionsList };

View File

@@ -0,0 +1,3 @@
import type { Plugin } from '@strapi/types';
declare const historyAdmin: Partial<Plugin.Config.AdminInput>;
export { historyAdmin };

View File

@@ -0,0 +1,27 @@
import * as React from 'react';
import { type EditLayout } from '../../hooks/useDocumentLayout';
import type { ContentType, FindContentTypeConfiguration } from '../../../../shared/contracts/content-types';
import type { HistoryVersionDataResponse, GetHistoryVersions } from '../../../../shared/contracts/history-versions';
import type { UID } from '@strapi/types';
interface HistoryContextValue {
contentType: UID.ContentType;
id?: string;
layout: EditLayout['layout'];
configuration: FindContentTypeConfiguration.Response['data'];
selectedVersion: HistoryVersionDataResponse;
versions: Extract<GetHistoryVersions.Response, {
data: Array<HistoryVersionDataResponse>;
}>;
page: number;
mainField: string;
schema: ContentType;
}
declare const HistoryProvider: {
(props: HistoryContextValue & {
children: React.ReactNode;
}): import("react/jsx-runtime").JSX.Element;
displayName: string;
}, useHistoryContext: <Selected, ShouldThrow extends boolean = true>(consumerName: string, selector: (value: HistoryContextValue) => Selected, shouldThrowOnMissingContext?: ShouldThrow | undefined) => ShouldThrow extends true ? Selected : Selected | undefined;
declare const ProtectedHistoryPage: () => import("react/jsx-runtime").JSX.Element;
export { ProtectedHistoryPage, HistoryProvider, useHistoryContext };
export type { HistoryContextValue };

View File

@@ -0,0 +1,6 @@
import { type PathRouteProps } from 'react-router-dom';
/**
* These routes will be merged with the rest of the Content Manager routes
*/
declare const routes: PathRouteProps[];
export { routes };

View File

@@ -0,0 +1,12 @@
import { GetHistoryVersions, RestoreHistoryVersion } from '../../../../shared/contracts/history-versions';
import type { Data } from '@strapi/types';
interface RestoreVersion extends RestoreHistoryVersion.Request {
documentId: Data.ID;
collectionType?: string;
}
declare const useGetHistoryVersionsQuery: import("@reduxjs/toolkit/dist/query/react/buildHooks").UseQuery<import("@reduxjs/toolkit/query").QueryDefinition<{
contentType: import("@strapi/types/dist/uid").ContentType;
documentId?: Data.ID | undefined;
locale?: string | undefined;
} & Partial<Pick<import("../../../../shared/contracts/history-versions").Pagination, "page" | "pageSize">>, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@strapi/admin/strapi-admin").QueryArguments, unknown, import("@strapi/admin/strapi-admin").BaseQueryError, {}, {}>, "ComponentConfiguration" | "ContentTypesConfiguration" | "ContentTypeSettings" | "Document" | "InitialData" | "HistoryVersion" | "Relations" | "UidAvailability" | "RecentDocumentList", GetHistoryVersions.Response, "adminApi">>, useRestoreVersionMutation: import("@reduxjs/toolkit/dist/query/react/buildHooks").UseMutation<import("@reduxjs/toolkit/query").MutationDefinition<RestoreVersion, import("@reduxjs/toolkit/query").BaseQueryFn<string | import("@strapi/admin/strapi-admin").QueryArguments, unknown, import("@strapi/admin/strapi-admin").BaseQueryError, {}, {}>, "ComponentConfiguration" | "ContentTypesConfiguration" | "ContentTypeSettings" | "Document" | "InitialData" | "HistoryVersion" | "Relations" | "UidAvailability" | "RecentDocumentList", RestoreHistoryVersion.Response, "adminApi">>;
export { useGetHistoryVersionsQuery, useRestoreVersionMutation };

View File

@@ -0,0 +1,15 @@
import { type Permission } from '@strapi/admin/strapi-admin';
import { AppState } from '../modules/app';
interface ContentManagerLink {
permissions: Permission[];
search: string | null;
kind: string;
title: string;
to: string;
uid: string;
name: string;
isDisplayed: boolean;
}
declare const useContentManagerInitData: () => AppState;
export { useContentManagerInitData };
export type { ContentManagerLink };

View File

@@ -0,0 +1,25 @@
import type { Component } from '../../../shared/contracts/components';
import type { ContentType } from '../../../shared/contracts/content-types';
type ComponentsDictionary = Record<string, Component>;
/**
* @internal
* @description Given a model UID, return the schema and the schemas
* of the associated components within said model's schema. A wrapper
* implementation around the `useGetInitialDataQuery` with a unique
* `selectFromResult` function to memoize the calculation.
*
* If no model is provided, the hook will return all the schemas.
*/
declare const useContentTypeSchema: (model?: string) => {
components: ComponentsDictionary;
schema: ContentType | undefined;
schemas: ContentType[];
isLoading: boolean;
};
/**
* @internal
* @description Extracts the components used in a content type's attributes recursively.
*/
declare const extractContentTypeComponents: (attributes?: ContentType['attributes'], allComponents?: ComponentsDictionary) => ComponentsDictionary;
export { useContentTypeSchema, extractContentTypeComponents };
export type { ComponentsDictionary };

View File

@@ -0,0 +1 @@
export declare function useDebounce<TValue>(value: TValue, delay: number): TValue;

View File

@@ -0,0 +1,137 @@
/**
* This hook doesn't use a context provider because we fetch directly from the server,
* this sounds expensive but actually, it's really not. Because we have redux-toolkit-query
* being a cache layer so if nothing invalidates the cache, we don't fetch again.
*/
import { FormErrors } from '@strapi/admin/strapi-admin';
import { type AnyData } from '../pages/EditView/utils/data';
import { useGetDocumentQuery } from '../services/documents';
import { ComponentsDictionary } from './useContentTypeSchema';
import type { FindOne } from '../../../shared/contracts/collection-types';
import type { ContentType } from '../../../shared/contracts/content-types';
import type { Modules } from '@strapi/types';
interface UseDocumentArgs {
collectionType: string;
model: string;
documentId?: string;
params?: object;
}
type UseDocumentOpts = Parameters<typeof useGetDocumentQuery>[1];
type Document = FindOne.Response['data'];
type Schema = ContentType;
type UseDocument = (args: UseDocumentArgs, opts?: UseDocumentOpts) => {
/**
* These are the schemas of the components used in the content type, organised
* by their uid.
*/
components: ComponentsDictionary;
document?: Document;
meta?: FindOne.Response['meta'];
isLoading: boolean;
/**
* This is the schema of the content type, it is not the same as the layout.
*/
schema?: Schema;
schemas?: Schema[];
hasError?: boolean;
refetch: () => void;
validate: (document: Document) => null | FormErrors;
/**
* Get the document's title
*/
getTitle: (mainField: string) => string;
/**
* Get the initial form values for the document
*/
getInitialFormValues: (isCreatingDocument?: boolean) => AnyData | undefined;
};
/**
* @alpha
* @public
* @description Returns a document based on the model, collection type & id passed as arguments.
* Also extracts its schema from the redux cache to be used for creating a validation schema.
* @example
* ```tsx
* const { id, model, collectionType } = useParams<{ id: string; model: string; collectionType: string }>();
*
* if(!model || !collectionType) return null;
*
* const { document, isLoading, validate } = useDocument({ documentId: id, model, collectionType, params: { locale: 'en-GB' } })
* const { update } = useDocumentActions()
*
* const onSubmit = async (document: Document) => {
* const errors = validate(document);
*
* if(errors) {
* // handle errors
* }
*
* await update({ collectionType, model, id }, document)
* }
* ```
*
* @see {@link https://contributor.strapi.io/docs/core/content-manager/hooks/use-document} for more information
*/
declare const useDocument: UseDocument;
/**
* @internal this hook uses the router to extract the model, collection type & id from the url.
* therefore, it shouldn't be used outside of the content-manager because it won't work as intended.
*/
declare const useDoc: () => {
/**
* These are the schemas of the components used in the content type, organised
* by their uid.
*/
components: ComponentsDictionary;
document?: Modules.Documents.AnyDocument | undefined;
meta?: import("../../../shared/contracts/collection-types").DocumentMetadata | undefined;
isLoading: boolean;
/**
* This is the schema of the content type, it is not the same as the layout.
*/
schema?: ContentType | undefined;
schemas?: ContentType[] | undefined;
hasError?: boolean | undefined;
refetch: () => void;
validate: (document: Document) => null | FormErrors;
/**
* Get the document's title
*/
getTitle: (mainField: string) => string;
/**
* Get the initial form values for the document
*/
getInitialFormValues: (isCreatingDocument?: boolean) => AnyData | undefined;
collectionType: string;
model: string;
id: string | undefined;
};
/**
* @public
* @experimental
* Content manager context hooks for plugin development.
* Make sure to use this hook inside the content manager.
*/
declare const useContentManagerContext: () => {
error: import("@reduxjs/toolkit").SerializedError | import("../utils/api").BaseQueryError | undefined;
isLoading: boolean;
model: string;
collectionType: string;
id: string | undefined;
slug: string;
isCreatingEntry: boolean;
isSingleType: boolean;
hasDraftAndPublish: boolean;
components: ComponentsDictionary;
contentType: ContentType | undefined;
contentTypes: ContentType[] | undefined;
form: unknown;
layout: {
error?: import("@reduxjs/toolkit").SerializedError | import("../utils/api").BaseQueryError | undefined;
isLoading: boolean;
edit: import("./useDocumentLayout").EditLayout;
list: import("./useDocumentLayout").ListLayout;
};
};
export { useDocument, useDoc, useContentManagerContext };
export type { UseDocument, UseDocumentArgs, Document, Schema, ComponentsDictionary };

View File

@@ -0,0 +1,124 @@
import { SerializedError } from '@reduxjs/toolkit';
import { type TrackingEvent } from '@strapi/admin/strapi-admin';
import { BaseQueryError } from '../utils/api';
import type { Document } from './useDocument';
import type { AutoClone, Clone, Create, Delete, BulkDelete, Discard, FindOne, Publish, BulkPublish, Update, Unpublish, BulkUnpublish } from '../../../shared/contracts/collection-types';
type OperationResponse<TResponse extends {
data: any;
meta?: any;
error?: any;
}> = Pick<TResponse, 'data'> | Pick<TResponse, 'data' | 'meta'> | {
error: BaseQueryError | SerializedError;
};
type BulkOperationResponse<TResponse extends {
data: any;
error?: any;
}> = Pick<TResponse, 'data'> | {
error: BaseQueryError | SerializedError;
};
type UseDocumentActions = (fromPreview?: boolean, fromRelationModal?: boolean) => {
/**
* @description Attempts to clone a document based on the provided sourceId.
* This will return a list of the fields as an error if it's unable to clone.
* You most likely want to use the `clone` action instead.
*/
isLoading: boolean;
autoClone: (args: {
model: string;
sourceId: string;
}) => Promise<OperationResponse<AutoClone.Response>>;
clone: (args: {
model: string;
documentId: string;
params?: object;
}, document: Omit<Document, 'id'>, trackerProperty?: Extract<TrackingEvent, {
name: 'willCreateEntry' | 'didCreateEntry' | 'didNotCreateEntry';
}>['properties']) => Promise<OperationResponse<Clone.Response>>;
create: (args: {
model: string;
params?: object;
}, document: Omit<Document, 'id'>, trackerProperty?: Extract<TrackingEvent, {
name: 'willCreateEntry' | 'didCreateEntry' | 'didNotCreateEntry';
}>['properties']) => Promise<OperationResponse<Create.Response>>;
delete: (args: {
collectionType: string;
model: string;
documentId?: string;
params?: object;
}, trackerProperty?: Extract<TrackingEvent, {
name: 'willDeleteEntry' | 'didDeleteEntry' | 'didNotDeleteEntry';
}>['properties']) => Promise<OperationResponse<Delete.Response>>;
deleteMany: (args: {
model: string;
documentIds: string[];
params?: object;
}) => Promise<BulkOperationResponse<BulkDelete.Response>>;
discard: (args: {
collectionType: string;
model: string;
documentId?: string;
params?: object;
}) => Promise<OperationResponse<Discard.Response>>;
getDocument: (args: {
collectionType: string;
model: string;
documentId?: string;
params?: object;
}) => Promise<FindOne.Response | undefined>;
publish: (args: {
collectionType: string;
model: string;
documentId?: string;
params?: object;
}, document: Partial<Document>) => Promise<OperationResponse<Publish.Response>>;
publishMany: (args: {
model: string;
documentIds: string[];
params?: object;
}) => Promise<BulkOperationResponse<BulkPublish.Response>>;
update: (args: {
collectionType: string;
model: string;
documentId?: string;
params?: object;
}, document: Partial<Document>, trackerProperty?: Extract<TrackingEvent, {
name: 'willEditEntry' | 'didEditEntry' | 'didNotEditEntry';
}>['properties']) => Promise<OperationResponse<Update.Response>>;
unpublish: (args: {
collectionType: string;
model: string;
documentId?: string;
params?: object;
}, discardDraft?: boolean) => Promise<OperationResponse<Unpublish.Response>>;
unpublishMany: (args: {
model: string;
documentIds: string[];
params?: object;
}) => Promise<BulkOperationResponse<BulkUnpublish.Response>>;
};
/**
* @alpha
* @public
* @description Contains all the operations that can be performed on a single document.
* Designed to be able to be used anywhere within a Strapi app. The hooks will handle
* notifications should the operation fail, however the response is always returned incase
* the user needs to handle side-effects.
* @example
* ```tsx
* import { Form } from '@strapi/admin/admin';
*
* const { id, model, collectionType } = useParams<{ id: string; model: string; collectionType: string }>();
* const { update } = useDocumentActions();
*
* const handleSubmit = async (data) => {
* await update({ collectionType, model, documentId: id }, data);
* }
*
* return <Form method="PUT" onSubmit={handleSubmit} />
* ```
*
* @see {@link https://contributor.strapi.io/docs/core/content-manager/hooks/use-document-operations} for more information
*/
declare const useDocumentActions: UseDocumentActions;
export { useDocumentActions };
export type { UseDocumentActions, OperationResponse };

View File

@@ -0,0 +1,30 @@
import { type UseDocument } from '../hooks/useDocument';
interface DocumentMeta {
/**
* The equivalent of the ":id" url param value
* i.e. gus5a67jcboa3o2zjnz39mb1
*/
documentId?: string;
/**
* The equivalent of the url ":slug" param value
* i.e. api::articles.article
*/
model: string;
/**
* The equivalent of the url ":collectionType" param value
* i.e. collection-types or single-types
*/
collectionType: string;
/**
* Query params object
* i.e. { locale: 'fr' }
*/
params?: Record<string, string | string[] | null>;
}
interface DocumentContextValue {
currentDocumentMeta: DocumentMeta;
currentDocument: ReturnType<UseDocument>;
}
declare function useDocumentContext(consumerName: string): DocumentContextValue;
export { useDocumentContext };
export type { DocumentMeta };

View File

@@ -0,0 +1,137 @@
import { SerializedError } from '@reduxjs/toolkit';
import { BaseQueryError } from '../utils/api';
import { type ComponentsDictionary, type Document, type Schema } from './useDocument';
import type { ComponentConfiguration } from '../../../shared/contracts/components';
import type { Metadatas, FindContentTypeConfiguration, Settings } from '../../../shared/contracts/content-types';
import type { Filters, InputProps, Table } from '@strapi/admin/strapi-admin';
import type { Schema as SchemaUtils } from '@strapi/types';
type LayoutOptions = Schema['options'] & Schema['pluginOptions'] & object;
interface LayoutSettings extends Settings {
displayName?: string;
icon?: never;
}
interface ListFieldLayout extends Table.Header<Document, ListFieldLayout>, Pick<Filters.Filter, 'mainField'> {
attribute: SchemaUtils.Attribute.AnyAttribute | {
type: 'custom';
};
}
interface ListLayout {
layout: ListFieldLayout[];
components?: never;
metadatas: {
[K in keyof Metadatas]: Metadatas[K]['list'];
};
options: LayoutOptions;
settings: LayoutSettings;
}
interface EditFieldSharedProps extends Omit<InputProps, 'hint' | 'label' | 'type'>, Pick<Filters.Filter, 'mainField'> {
hint?: string;
label: string;
size: number;
unique?: boolean;
visible?: boolean;
}
/**
* Map over all the types in Attribute Types and use that to create a union of new types where the attribute type
* is under the property attribute and the type is under the property type.
*/
type EditFieldLayout = {
[K in SchemaUtils.Attribute.Kind]: EditFieldSharedProps & {
attribute: Extract<SchemaUtils.Attribute.AnyAttribute, {
type: K;
}>;
type: K;
};
}[SchemaUtils.Attribute.Kind];
interface EditLayout {
layout: Array<Array<EditFieldLayout[]>>;
components: {
[uid: string]: {
layout: Array<EditFieldLayout[]>;
settings: ComponentConfiguration['settings'] & {
displayName?: string;
icon?: string;
};
};
};
metadatas: {
[K in keyof Metadatas]: Metadatas[K]['edit'];
};
options: LayoutOptions;
settings: LayoutSettings;
}
type UseDocumentLayout = (model: string) => {
error?: BaseQueryError | SerializedError;
isLoading: boolean;
/**
* This is the layout for the edit view,
*/
edit: EditLayout;
list: ListLayout;
};
declare const DEFAULT_SETTINGS: {
bulkable: boolean;
filterable: boolean;
searchable: boolean;
pagination: boolean;
defaultSortBy: string;
defaultSortOrder: string;
mainField: string;
pageSize: number;
};
/**
* @alpha
* @description This hook is used to get the layouts for either the edit view or list view of a specific content-type
* including the layouts for the components used in the content-type. It also runs the mutation hook waterfall so the data
* is consistent wherever it is used. It's a light wrapper around the `useDocument` hook, but provides the `skip` option a document
* is not fetched, however, it does fetch the schemas & components if they do not already exist in the cache.
*
* If the fetch fails, it will display a notification to the user.
*
* @example
* ```tsx
* const { model } = useParams<{ model: string }>();
* const { edit: { schema: layout } } = useDocumentLayout(model);
*
* return layout.map(panel => panel.map(row => row.map(field => <Field.Root {...field} />)))
* ```
*
*/
declare const useDocumentLayout: UseDocumentLayout;
/**
* @internal this hook uses the internal useDoc hook, as such it shouldn't be used outside of the
* content-manager because it won't work as intended.
*/
declare const useDocLayout: () => {
error?: SerializedError | BaseQueryError | undefined;
isLoading: boolean;
/**
* This is the layout for the edit view,
*/
edit: EditLayout;
list: ListLayout;
};
type LayoutData = FindContentTypeConfiguration.Response['data'];
/**
* @internal
* @description takes the edit layout from either a content-type or a component
* and formats it into a generic object that can be used to correctly render
* the form fields.
*/
declare const convertEditLayoutToFieldLayouts: (rows: LayoutData['contentType']['layouts']['edit'], attributes: import("@strapi/types/dist/struct").SchemaAttributes | undefined, metadatas: Metadatas, components?: {
configurations: Record<string, ComponentConfiguration>;
schemas: ComponentsDictionary;
}, schemas?: Schema[]) => EditFieldLayout[][];
/**
* @internal
* @description takes the columns from the list view configuration and formats them into a generic object
* combinining metadata and attribute data.
*
* @note We do use this to reformat the list of strings when updating the displayed headers for the list view.
*/
declare const convertListLayoutToFieldLayouts: (columns: LayoutData['contentType']['layouts']['list'], attributes: import("@strapi/types/dist/struct").SchemaAttributes | undefined, metadatas: ListLayout['metadatas'], components?: {
configurations: Record<string, ComponentConfiguration>;
schemas: ComponentsDictionary;
}, schemas?: Schema[]) => ListFieldLayout[];
export { useDocLayout, useDocumentLayout, convertListLayoutToFieldLayouts, convertEditLayoutToFieldLayouts, DEFAULT_SETTINGS, };
export type { EditLayout, EditFieldLayout, ListLayout, ListFieldLayout, UseDocumentLayout };

View File

@@ -0,0 +1,51 @@
import * as React from 'react';
import { type HandlerManager, type ConnectDragSource, type ConnectDropTarget, type ConnectDragPreview } from 'react-dnd';
import { type UseKeyboardDragAndDropCallbacks } from './useKeyboardDragAndDrop';
import type { Data } from '@strapi/types';
declare const DIRECTIONS: {
readonly UPWARD: "upward";
readonly DOWNWARD: "downward";
};
declare const DROP_SENSITIVITY: {
readonly REGULAR: "regular";
readonly IMMEDIATE: "immediate";
};
interface UseDragAndDropOptions<TIndex extends number | Array<number> = number, TItem extends {
index: TIndex;
} = {
index: TIndex;
}> extends UseKeyboardDragAndDropCallbacks<TIndex> {
type?: string;
index: TIndex;
item?: TItem;
onStart?: () => void;
onEnd?: () => void;
dropSensitivity?: (typeof DROP_SENSITIVITY)[keyof typeof DROP_SENSITIVITY];
}
type Identifier = ReturnType<HandlerManager['getHandlerId']>;
type UseDragAndDropReturn<E extends Element = HTMLElement> = [
props: {
handlerId: Identifier;
isDragging: boolean;
handleKeyDown: <E extends Element>(event: React.KeyboardEvent<E>) => void;
isOverDropTarget: boolean;
direction: (typeof DIRECTIONS)[keyof typeof DIRECTIONS] | null;
},
objectRef: React.RefObject<E>,
dropRef: ConnectDropTarget,
dragRef: ConnectDragSource,
dragPreviewRef: ConnectDragPreview
];
/**
* A utility hook abstracting the general drag and drop hooks from react-dnd.
* Centralising the same behaviours and by default offering keyboard support.
*/
declare const useDragAndDrop: <TIndex extends number | number[], TItem extends {
[key: string]: unknown;
index: TIndex;
id?: Data.ID | undefined;
} = {
[key: string]: unknown;
index: TIndex;
}, E extends Element = HTMLElement>(active: boolean, { type, index, item, onStart, onEnd, onGrabItem, onDropItem, onCancel, onMoveItem, dropSensitivity, }: UseDragAndDropOptions<TIndex, TItem>) => UseDragAndDropReturn<E>;
export { useDragAndDrop, UseDragAndDropReturn, UseDragAndDropOptions, DIRECTIONS, DROP_SENSITIVITY, };

View File

@@ -0,0 +1,14 @@
import * as React from 'react';
export type UseKeyboardDragAndDropCallbacks<TIndex extends number | Array<number> = number> = {
onCancel?: (index: TIndex) => void;
onDropItem?: (currentIndex: TIndex, newIndex?: TIndex) => void;
onGrabItem?: (index: TIndex) => void;
onMoveItem?: (newIndex: TIndex, currentIndex: TIndex) => void;
};
/**
* Utility hook designed to implement keyboard accessibile drag and drop by
* returning an onKeyDown handler to be passed to the drag icon button.
*
* @internal - You should use `useDragAndDrop` instead.
*/
export declare const useKeyboardDragAndDrop: <TIndex extends number | number[] = number>(active: boolean, index: TIndex, { onCancel, onDropItem, onGrabItem, onMoveItem }: UseKeyboardDragAndDropCallbacks<TIndex>) => <E extends Element>(e: React.KeyboardEvent<E>) => void;

View File

@@ -0,0 +1,13 @@
import { ComponentType } from 'react';
type LazyComponentStore = Record<string, ComponentType | undefined>;
interface UseLazyComponentsReturn {
isLazyLoading: boolean;
lazyComponentStore: LazyComponentStore;
cleanup: () => void;
}
/**
* @description A hook to lazy load custom field components
*/
declare const useLazyComponents: (componentUids?: string[]) => UseLazyComponentsReturn;
export { useLazyComponents };
export type { UseLazyComponentsReturn, LazyComponentStore };

View File

@@ -0,0 +1,2 @@
import * as React from 'react';
export declare const useOnce: (effect: React.EffectCallback) => void;

View File

@@ -0,0 +1 @@
export declare const usePrev: <T>(value: T) => T | undefined;

View File

@@ -0,0 +1,18 @@
import 'prismjs';
declare const _default: {
register(app: any): void;
bootstrap(app: any): void;
registerTrads({ locales }: {
locales: string[];
}): Promise<({
data: {
[x: string]: string;
};
locale: string;
} | {
data: {};
locale: string;
})[]>;
};
export default _default;
export * from './exports';

View File

@@ -0,0 +1,2 @@
declare const Layout: () => import("react/jsx-runtime").JSX.Element;
export { Layout };

View File

@@ -0,0 +1,20 @@
import { GetInitData } from '../../../shared/contracts/init';
import type { ContentManagerLink } from '../hooks/useContentManagerInitData';
interface AppState {
collectionTypeLinks: ContentManagerLink[];
components: GetInitData.Response['data']['components'];
fieldSizes: GetInitData.Response['data']['fieldSizes'];
models: GetInitData.Response['data']['contentTypes'];
singleTypeLinks: ContentManagerLink[];
isLoading: boolean;
}
declare const reducer: import("redux").Reducer<AppState>;
declare const setInitialData: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
authorizedCollectionTypeLinks: AppState['collectionTypeLinks'];
authorizedSingleTypeLinks: AppState['singleTypeLinks'];
components: AppState['components'];
contentTypeSchemas: AppState['models'];
fieldSizes: AppState['fieldSizes'];
}, "app/setInitialData">;
export { reducer, setInitialData };
export type { AppState };

View File

@@ -0,0 +1,10 @@
import { Dispatch } from '@reduxjs/toolkit';
import { TypedUseSelectorHook } from 'react-redux';
import { State } from './reducers';
import type { Store } from '@strapi/admin/strapi-admin';
type RootState = ReturnType<Store['getState']> & {
['content-manager']: State;
};
declare const useTypedDispatch: () => Dispatch;
declare const useTypedSelector: TypedUseSelectorHook<RootState>;
export { useTypedSelector, useTypedDispatch };

View File

@@ -0,0 +1,6 @@
declare const reducer: import("redux").Reducer<import("redux").CombinedState<{
app: import("./app").AppState;
}>, import("redux").AnyAction>;
type State = ReturnType<typeof reducer>;
export { reducer };
export type { State };

View File

@@ -0,0 +1,3 @@
declare const ComponentConfigurationPage: () => import("react/jsx-runtime").JSX.Element;
declare const ProtectedComponentConfigurationPage: () => import("react/jsx-runtime").JSX.Element;
export { ComponentConfigurationPage, ProtectedComponentConfigurationPage };

View File

@@ -0,0 +1,3 @@
declare const EditConfigurationPage: () => import("react/jsx-runtime").JSX.Element;
declare const ProtectedEditConfigurationPage: () => import("react/jsx-runtime").JSX.Element;
export { ProtectedEditConfigurationPage, EditConfigurationPage };

View File

@@ -0,0 +1,11 @@
import { type UseDocument } from '../../hooks/useDocument';
declare const EditViewPage: () => import("react/jsx-runtime").JSX.Element;
/**
* @internal
* @description Returns the status of the document where its latest state takes priority,
* this typically will be "published" unless a user has edited their draft in which we should
* display "modified".
*/
declare const getDocumentStatus: (document: ReturnType<UseDocument>['document'], meta: ReturnType<UseDocument>['meta']) => 'draft' | 'published' | 'modified';
declare const ProtectedEditViewPage: () => import("react/jsx-runtime").JSX.Element;
export { EditViewPage, ProtectedEditViewPage, getDocumentStatus };

View File

@@ -0,0 +1,77 @@
import * as React from 'react';
import { NotificationConfig } from '@strapi/admin/strapi-admin';
import { ButtonProps } from '@strapi/design-system';
import type { DocumentActionComponent } from '../../../content-manager';
type DocumentActionPosition = 'panel' | 'header' | 'table-row' | 'preview' | 'relation-modal';
interface DocumentActionDescription {
label: string;
onClick?: (event: React.SyntheticEvent) => Promise<boolean | void> | boolean | void;
icon?: React.ReactNode;
/**
* @default false
*/
disabled?: boolean;
/**
* @default 'panel'
* @description Where the action should be rendered.
*/
position?: DocumentActionPosition | DocumentActionPosition[];
dialog?: DialogOptions | NotificationOptions | ModalOptions;
/**
* @default 'secondary'
*/
variant?: ButtonProps['variant'];
loading?: ButtonProps['loading'];
}
interface DialogOptions {
type: 'dialog';
title: string;
content?: React.ReactNode;
variant?: ButtonProps['variant'];
onConfirm?: () => void | Promise<void>;
onCancel?: () => void | Promise<void>;
}
interface NotificationOptions {
type: 'notification';
title: string;
link?: {
label: string;
url: string;
target?: string;
};
content?: string;
onClose?: () => void;
status?: NotificationConfig['type'];
timeout?: number;
}
interface ModalOptions {
type: 'modal';
title: string;
content: React.ComponentType<{
onClose: () => void;
}> | React.ReactNode;
footer?: React.ComponentType<{
onClose: () => void;
}> | React.ReactNode;
onClose?: () => void;
}
interface Action extends DocumentActionDescription {
id: string;
}
interface DocumentActionsProps {
actions: Action[];
}
declare const DocumentActions: ({ actions }: DocumentActionsProps) => import("react/jsx-runtime").JSX.Element | null;
interface DocumentActionButtonProps extends Action {
}
declare const DocumentActionButton: (action: DocumentActionButtonProps) => import("react/jsx-runtime").JSX.Element;
interface DocumentActionsMenuProps {
actions: Action[];
children?: React.ReactNode;
label?: string;
variant?: 'ghost' | 'tertiary';
}
declare const DocumentActionsMenu: ({ actions, children, label, variant, }: DocumentActionsMenuProps) => import("react/jsx-runtime").JSX.Element;
declare const DEFAULT_ACTIONS: DocumentActionComponent[];
export { DocumentActions, DocumentActionsMenu, DocumentActionButton, DEFAULT_ACTIONS };
export type { DocumentActionDescription, DocumentActionPosition, DialogOptions, NotificationOptions, ModalOptions, };

View File

@@ -0,0 +1,16 @@
import { StatusProps } from '@strapi/design-system';
interface DocumentStatusProps extends Omit<StatusProps, 'children' | 'variant'> {
/**
* The status of the document (draft, published, etc.)
* @default 'draft'
*/
status?: string;
}
/**
* @public
* @description Displays the status of a document (draft, published, etc.)
* and automatically calculates the appropriate variant for the status.
*/
declare const DocumentStatus: ({ status, size, ...restProps }: DocumentStatusProps) => import("react/jsx-runtime").JSX.Element;
export { DocumentStatus };
export type { DocumentStatusProps };

View File

@@ -0,0 +1,11 @@
import * as React from 'react';
import { Menu } from '@strapi/design-system';
export interface ObservedComponent {
toolbar: React.ReactNode;
menu: React.ReactNode;
key: string;
}
export declare const EditorToolbarObserver: ({ observedComponents, menuTriggerVariant, }: {
observedComponents: ObservedComponent[];
menuTriggerVariant?: Menu.TriggerProps['variant'];
}) => import("react/jsx-runtime").JSX.Element[];

View File

@@ -0,0 +1,58 @@
import { BaseRange, NodeEntry } from 'slate';
import { type BlocksStore } from '../BlocksEditor';
import 'prismjs/themes/prism-solarizedlight.css';
import 'prismjs/components/prism-asmatmel';
import 'prismjs/components/prism-bash';
import 'prismjs/components/prism-basic';
import 'prismjs/components/prism-c';
import 'prismjs/components/prism-clojure';
import 'prismjs/components/prism-cobol';
import 'prismjs/components/prism-cpp';
import 'prismjs/components/prism-csharp';
import 'prismjs/components/prism-dart';
import 'prismjs/components/prism-docker';
import 'prismjs/components/prism-elixir';
import 'prismjs/components/prism-erlang';
import 'prismjs/components/prism-fortran';
import 'prismjs/components/prism-fsharp';
import 'prismjs/components/prism-go';
import 'prismjs/components/prism-graphql';
import 'prismjs/components/prism-groovy';
import 'prismjs/components/prism-haskell';
import 'prismjs/components/prism-haxe';
import 'prismjs/components/prism-ini';
import 'prismjs/components/prism-java';
import 'prismjs/components/prism-javascript';
import 'prismjs/components/prism-jsx';
import 'prismjs/components/prism-json';
import 'prismjs/components/prism-julia';
import 'prismjs/components/prism-kotlin';
import 'prismjs/components/prism-latex';
import 'prismjs/components/prism-lua';
import 'prismjs/components/prism-markdown';
import 'prismjs/components/prism-matlab';
import 'prismjs/components/prism-makefile';
import 'prismjs/components/prism-objectivec';
import 'prismjs/components/prism-perl';
import 'prismjs/components/prism-php';
import 'prismjs/components/prism-powershell';
import 'prismjs/components/prism-python';
import 'prismjs/components/prism-r';
import 'prismjs/components/prism-ruby';
import 'prismjs/components/prism-rust';
import 'prismjs/components/prism-sas';
import 'prismjs/components/prism-scala';
import 'prismjs/components/prism-scheme';
import 'prismjs/components/prism-sql';
import 'prismjs/components/prism-stata';
import 'prismjs/components/prism-swift';
import 'prismjs/components/prism-typescript';
import 'prismjs/components/prism-tsx';
import 'prismjs/components/prism-vbnet';
import 'prismjs/components/prism-yaml';
type BaseRangeCustom = BaseRange & {
className: string;
};
export declare const decorateCode: ([node, path]: NodeEntry) => BaseRangeCustom[];
declare const codeBlocks: Pick<BlocksStore, 'code'>;
export { codeBlocks };

View File

@@ -0,0 +1,3 @@
import { type BlocksStore } from '../BlocksEditor';
declare const headingBlocks: Pick<BlocksStore, 'heading-one' | 'heading-two' | 'heading-three' | 'heading-four' | 'heading-five' | 'heading-six'>;
export { headingBlocks };

View File

@@ -0,0 +1,3 @@
import { type BlocksStore } from '../BlocksEditor';
declare const imageBlocks: Pick<BlocksStore, 'image'>;
export { imageBlocks };

View File

@@ -0,0 +1,3 @@
import { type BlocksStore } from '../BlocksEditor';
declare const linkBlocks: Pick<BlocksStore, 'link'>;
export { linkBlocks };

View File

@@ -0,0 +1,3 @@
import { type BlocksStore } from '../BlocksEditor';
declare const listBlocks: Pick<BlocksStore, 'list-ordered' | 'list-unordered' | 'list-item'>;
export { listBlocks };

View File

@@ -0,0 +1,3 @@
import { type BlocksStore } from '../BlocksEditor';
declare const paragraphBlocks: Pick<BlocksStore, 'paragraph'>;
export { paragraphBlocks };

View File

@@ -0,0 +1,3 @@
import { type BlocksStore } from '../BlocksEditor';
declare const quoteBlocks: Pick<BlocksStore, 'quote'>;
export { quoteBlocks };

View File

@@ -0,0 +1,6 @@
interface BlocksContentProps {
placeholder?: string;
ariaLabelId: string;
}
declare const BlocksContent: ({ placeholder, ariaLabelId }: BlocksContentProps) => import("react/jsx-runtime").JSX.Element;
export { BlocksContent, BlocksContentProps };

View File

@@ -0,0 +1,61 @@
import * as React from 'react';
import { type FieldValue } from '@strapi/admin/strapi-admin';
import { MessageDescriptor } from 'react-intl';
import { Editor } from 'slate';
import { type RenderElementProps } from 'slate-react';
import { type CSSProperties } from 'styled-components';
import { type BlocksContentProps } from './BlocksContent';
import { type ModifiersStore } from './Modifiers';
import type { Schema } from '@strapi/types';
interface BaseBlock {
renderElement: (props: RenderElementProps) => React.JSX.Element;
matchNode: (node: Schema.Attribute.BlocksNode) => boolean;
handleConvert?: (editor: Editor) => void | (() => React.JSX.Element);
handleEnterKey?: (editor: Editor) => void;
handleBackspaceKey?: (editor: Editor, event: React.KeyboardEvent<HTMLElement>) => void;
handleTab?: (editor: Editor) => void;
snippets?: string[];
dragHandleTopMargin?: CSSProperties['marginTop'];
}
interface NonSelectorBlock extends BaseBlock {
isInBlocksSelector: false;
}
interface SelectorBlock extends BaseBlock {
isInBlocksSelector: true;
icon: React.ComponentType;
label: MessageDescriptor;
}
type NonSelectorBlockKey = 'list-item' | 'link';
declare const selectorBlockKeys: readonly ["paragraph", "heading-one", "heading-two", "heading-three", "heading-four", "heading-five", "heading-six", "list-ordered", "list-unordered", "image", "quote", "code"];
type SelectorBlockKey = (typeof selectorBlockKeys)[number];
declare const isSelectorBlockKey: (key: unknown) => key is "code" | "image" | "paragraph" | "quote" | "heading-one" | "heading-two" | "heading-three" | "heading-four" | "heading-five" | "heading-six" | "list-ordered" | "list-unordered";
type BlocksStore = {
[K in SelectorBlockKey]: SelectorBlock;
} & {
[K in NonSelectorBlockKey]: NonSelectorBlock;
};
interface BlocksEditorContextValue {
blocks: BlocksStore;
modifiers: ModifiersStore;
disabled: boolean;
name: string;
setLiveText: (text: string) => void;
isExpandedMode: boolean;
}
declare const BlocksEditorProvider: {
(props: BlocksEditorContextValue & {
children: React.ReactNode;
}): import("react/jsx-runtime").JSX.Element;
displayName: string;
};
declare function useBlocksEditorContext(consumerName: string): BlocksEditorContextValue & {
editor: Editor;
};
interface BlocksEditorProps extends Pick<FieldValue<Schema.Attribute.BlocksValue>, 'onChange' | 'value' | 'error'>, BlocksContentProps {
disabled?: boolean;
name: string;
}
declare const BlocksEditor: React.ForwardRefExoticComponent<BlocksEditorProps & React.RefAttributes<{
focus: () => void;
}>>;
export { type BlocksStore, type SelectorBlockKey, BlocksEditor, BlocksEditorProvider, useBlocksEditorContext, isSelectorBlockKey, };

View File

@@ -0,0 +1,11 @@
import * as React from 'react';
import { type InputProps } from '@strapi/admin/strapi-admin';
import type { Schema } from '@strapi/types';
interface BlocksInputProps extends Omit<InputProps, 'type'> {
labelAction?: React.ReactNode;
type: Schema.Attribute.Blocks['type'];
}
declare const MemoizedBlocksInput: React.MemoExoticComponent<React.ForwardRefExoticComponent<BlocksInputProps & React.RefAttributes<{
focus: () => void;
}>>>;
export { MemoizedBlocksInput as BlocksInput };

View File

@@ -0,0 +1,10 @@
import * as React from 'react';
/**
* Handles the modal component that may be returned by a block when converting it
*/
declare function useConversionModal(): {
modalElement: React.JSX.Element | null;
handleConversionResult: (renderModal: void | (() => React.JSX.Element) | undefined) => void;
};
declare const BlocksToolbar: () => import("react/jsx-runtime").JSX.Element;
export { BlocksToolbar, useConversionModal };

View File

@@ -0,0 +1,10 @@
import * as React from 'react';
interface EditorLayoutProps {
children: React.ReactNode;
error?: string;
onToggleExpand: () => void;
disabled: boolean;
ariaDescriptionId: string;
}
declare const EditorLayout: ({ children, error, disabled, onToggleExpand, ariaDescriptionId, }: EditorLayoutProps) => import("react/jsx-runtime").JSX.Element;
export { EditorLayout };

View File

@@ -0,0 +1,16 @@
import * as React from 'react';
import { type MessageDescriptor } from 'react-intl';
import { Editor, Text } from 'slate';
type ModifierKey = Exclude<keyof Text, 'type' | 'text'>;
type ModifiersStore = {
[K in ModifierKey]: {
icon: React.ComponentType;
isValidEventKey: (event: React.KeyboardEvent<HTMLElement>) => boolean;
label: MessageDescriptor;
checkIsActive: (editor: Editor) => boolean;
handleToggle: (editor: Editor) => void;
renderLeaf: (children: React.JSX.Element | string) => React.JSX.Element;
};
};
declare const modifiers: ModifiersStore;
export { type ModifiersStore, modifiers };

View File

@@ -0,0 +1,11 @@
import { type Editor } from 'slate';
/**
* Images are void elements. They handle the rendering of their children instead of Slate.
* See the Slate documentation for more information:
* - https://docs.slatejs.org/api/nodes/element#void-vs-not-void
* - https://docs.slatejs.org/api/nodes/element#rendering-void-elements
*/
declare const withImages: (editor: Editor) => Omit<import("slate").BaseEditor & import("slate-react").ReactEditor & import("slate-history").HistoryEditor & import("./withLinks").LinkEditor, "children"> & {
children: import("@strapi/types/dist/schema/attribute").BlocksValue;
};
export { withImages };

View File

@@ -0,0 +1,9 @@
import { type BaseEditor, Path, Editor } from 'slate';
interface LinkEditor extends BaseEditor {
lastInsertedLinkPath: Path | null;
shouldSaveLinkPath: boolean;
}
declare const withLinks: (editor: Editor) => Omit<BaseEditor & import("slate-react").ReactEditor & import("slate-history").HistoryEditor & LinkEditor, "children"> & {
children: import("@strapi/types/dist/schema/attribute").BlocksValue;
};
export { withLinks, type LinkEditor };

View File

@@ -0,0 +1,8 @@
import { Editor } from 'slate';
/**
* This plugin is used to normalize the Slate document to match the Strapi schema.
*/
declare const withStrapiSchema: (editor: Editor) => Omit<import("slate").BaseEditor & import("slate-react").ReactEditor & import("slate-history").HistoryEditor & import("./withLinks").LinkEditor, "children"> & {
children: import("@strapi/types/dist/schema/attribute").BlocksValue;
};
export { withStrapiSchema };

View File

@@ -0,0 +1,5 @@
export declare const codeLanguages: {
value: string;
label: string;
decorate?: string;
}[];

View File

@@ -0,0 +1,13 @@
import { type Element, type Path, Editor } from 'slate';
/**
* Extracts some logic that is common to most blocks' handleConvert functions.
* @returns The path of the converted block
*/
declare const baseHandleConvert: <T extends import("@strapi/types/dist/schema/attribute").BlocksNode>(editor: Editor, attributesToSet: Partial<T> & {
type: T['type'];
}) => void | Path;
/**
* Set all attributes except type and children to null so that Slate deletes them
*/
declare const getAttributesToClear: (element: Element) => Record<string, null>;
export { baseHandleConvert, getAttributesToClear };

View File

@@ -0,0 +1,6 @@
import { Editor } from 'slate';
/**
* Inserts a line break the first time the user presses enter, and exits the node the second time.
*/
declare const pressEnterTwiceToExit: (editor: Editor) => void;
export { pressEnterTwiceToExit };

View File

@@ -0,0 +1,10 @@
import { Editor } from 'slate';
declare const removeLink: (editor: Editor) => void;
declare const insertLink: (editor: Editor, { url }: {
url: string;
}) => void;
declare const editLink: (editor: Editor, link: {
url: string;
text: string;
}) => void;
export { insertLink, editLink, removeLink };

View File

@@ -0,0 +1,10 @@
import type { Schema } from '@strapi/types';
import type { Element, Node } from 'slate';
type Block<T extends Element['type']> = Extract<Node, {
type: T;
}>;
declare const getEntries: <T extends object>(object: T) => [keyof T, T[keyof T]][];
declare const getKeys: <T extends object>(object: T) => (keyof T)[];
declare const isLinkNode: (element: Element) => element is Schema.Attribute.LinkInlineNode;
declare const isListNode: (element: Element) => element is Schema.Attribute.ListBlockNode;
export { type Block, getEntries, getKeys, isLinkNode, isListNode };

View File

@@ -0,0 +1,9 @@
import * as React from 'react';
interface InitializerProps {
disabled?: boolean;
name: string;
onClick?: React.MouseEventHandler<HTMLButtonElement> & React.MouseEventHandler<HTMLDivElement>;
}
declare const Initializer: ({ disabled, name, onClick }: InitializerProps) => import("react/jsx-runtime").JSX.Element;
export { Initializer };
export type { InitializerProps };

View File

@@ -0,0 +1,18 @@
import * as React from 'react';
import { InputProps } from '@strapi/admin/strapi-admin';
import { EditFieldLayout } from '../../../../../hooks/useDocumentLayout';
import { type InputRendererProps } from '../../InputRenderer';
interface ComponentInputProps extends Omit<Extract<EditFieldLayout, {
type: 'component';
}>, 'size' | 'hint'>, Pick<InputProps, 'hint'> {
labelAction?: React.ReactNode;
children: (props: InputRendererProps) => React.ReactNode;
/**
* We need layout to come from the props, and not via a hook, because Content History needs
* a way to modify the normal component layout to add hidden fields.
*/
layout: EditFieldLayout[][];
}
declare const MemoizedComponentInput: React.MemoExoticComponent<({ label, required, name, attribute, disabled, labelAction, ...props }: ComponentInputProps) => import("react/jsx-runtime").JSX.Element>;
export { MemoizedComponentInput as ComponentInput };
export type { ComponentInputProps };

View File

@@ -0,0 +1,5 @@
import type { ComponentInputProps } from './Input';
type NonRepeatableComponentProps = Omit<ComponentInputProps, 'required' | 'label'>;
declare const NonRepeatableComponent: ({ attribute, name, children, layout, }: NonRepeatableComponentProps) => import("react/jsx-runtime").JSX.Element;
export { NonRepeatableComponent };
export type { NonRepeatableComponentProps };

View File

@@ -0,0 +1,5 @@
import type { ComponentInputProps } from './Input';
type RepeatableComponentProps = Omit<ComponentInputProps, 'required' | 'label'>;
declare const RepeatableComponent: ({ attribute, disabled, name, mainField, children, layout, }: RepeatableComponentProps) => import("react/jsx-runtime").JSX.Element;
export { RepeatableComponent };
export type { RepeatableComponentProps };

View File

@@ -0,0 +1,42 @@
/// <reference types="react" />
interface ComponentContextValue {
/**
* The id of the component. It will be undefined if the component
* has not been created in the database yet. This could be on a new
* or existing entry.
*/
id?: number;
/**
* The level of the component. This is used to determine the nesting
* of the component. The default is set to -1 so that the base level is 0
* for the top level component, and increases by 1 for each level of nesting.
*/
level: number;
/**
* The uid of the component. This is used to determine the type of the
* component. Within an attribute, it is normally the `component` value.
* It will be undefined if the hook is not called within the confines
* of a provider.
*/
uid?: string;
/**
* The type of component parent. It will be undefined if the hook
* is not called within the confines of a provider.
*/
type?: 'dynamiczone' | 'repeatable' | 'component';
}
/**
* We use this component to wrap any individual component field in the Edit View,
* this could be a component field in a dynamic zone, a component within a repeatable space,
* or even nested components.
*
* We primarily need this to provide the component id to the components so that they can
* correctly fetch their relations.
*/
declare const ComponentProvider: {
(props: ComponentContextValue & {
children: import("react").ReactNode;
}): import("react/jsx-runtime").JSX.Element;
displayName: string;
}, useComponent: <Selected, ShouldThrow extends boolean = true>(consumerName: string, selector: (value: ComponentContextValue) => Selected, shouldThrowOnMissingContext?: ShouldThrow | undefined) => ShouldThrow extends true ? Selected : Selected | undefined;
export { ComponentProvider, useComponent };

View File

@@ -0,0 +1,11 @@
import * as React from 'react';
interface AddComponentButtonProps {
children: React.ReactNode;
hasError?: boolean;
isDisabled?: boolean;
isOpen?: boolean;
onClick: React.MouseEventHandler<HTMLButtonElement> & React.MouseEventHandler<HTMLDivElement>;
}
declare const AddComponentButton: ({ hasError, isDisabled, isOpen, children, onClick, }: AddComponentButtonProps) => import("react/jsx-runtime").JSX.Element;
export { AddComponentButton };
export type { AddComponentButtonProps };

View File

@@ -0,0 +1,9 @@
import * as React from 'react';
import { ComponentIconProps } from '../../../../../components/ComponentIcon';
interface ComponentCardProps extends Pick<ComponentIconProps, 'icon'> {
children: React.ReactNode;
onClick?: React.MouseEventHandler<HTMLButtonElement> & React.MouseEventHandler<HTMLDivElement>;
}
declare const ComponentCard: ({ children, onClick, icon }: ComponentCardProps) => import("react/jsx-runtime").JSX.Element;
export { ComponentCard };
export type { ComponentCardProps };

View File

@@ -0,0 +1,15 @@
import * as React from 'react';
import { Accordion } from '@strapi/design-system';
interface ComponentCategoryProps {
category: string;
components?: Array<{
uid: string;
displayName: string;
icon?: string;
}>;
onAddComponent: (componentUid: string) => React.MouseEventHandler<HTMLButtonElement> & React.MouseEventHandler<HTMLDivElement>;
variant?: Accordion.Variant;
}
declare const ComponentCategory: ({ category, components, variant, onAddComponent, }: ComponentCategoryProps) => import("react/jsx-runtime").JSX.Element;
export { ComponentCategory };
export type { ComponentCategoryProps };

View File

@@ -0,0 +1,9 @@
import { ComponentCategoryProps } from './ComponentCategory';
interface ComponentPickerProps {
dynamicComponentsByCategory?: Record<string, NonNullable<ComponentCategoryProps['components']>>;
isOpen?: boolean;
onClickAddComponent: (componentUid: string) => void;
}
declare const ComponentPicker: ({ dynamicComponentsByCategory, isOpen, onClickAddComponent, }: ComponentPickerProps) => import("react/jsx-runtime").JSX.Element | null;
export { ComponentPicker };
export type { ComponentPickerProps };

View File

@@ -0,0 +1,17 @@
import * as React from 'react';
import { type UseDragAndDropOptions } from '../../../../../hooks/useDragAndDrop';
import { type InputRendererProps } from '../../InputRenderer';
import type { ComponentPickerProps } from './ComponentPicker';
interface DynamicComponentProps extends Pick<UseDragAndDropOptions, 'onGrabItem' | 'onDropItem' | 'onCancel'>, Pick<ComponentPickerProps, 'dynamicComponentsByCategory'> {
componentUid: string;
disabled?: boolean;
index: number;
name: string;
onAddComponent: (componentUid: string, index: number) => void;
onRemoveComponentClick: () => void;
onMoveComponent: (dragIndex: number, hoverIndex: number) => void;
children?: (props: InputRendererProps) => React.ReactNode;
}
declare const DynamicComponent: ({ componentUid, disabled, index, name, onRemoveComponentClick, onMoveComponent, onGrabItem, onDropItem, onCancel, dynamicComponentsByCategory, onAddComponent, children, }: DynamicComponentProps) => import("react/jsx-runtime").JSX.Element;
export { DynamicComponent };
export type { DynamicComponentProps };

View File

@@ -0,0 +1,12 @@
import * as React from 'react';
interface DynamicZoneLabelProps {
label?: React.ReactNode;
labelAction?: React.ReactNode;
name: string;
numberOfComponents?: number;
required?: boolean;
hint?: React.ReactNode;
}
declare const DynamicZoneLabel: ({ hint, label, labelAction, name, numberOfComponents, required, }: DynamicZoneLabelProps) => import("react/jsx-runtime").JSX.Element;
export { DynamicZoneLabel };
export type { DynamicZoneLabelProps };

View File

@@ -0,0 +1,17 @@
import * as React from 'react';
import { InputProps } from '@strapi/admin/strapi-admin';
import { type EditFieldLayout } from '../../../../../hooks/useDocumentLayout';
import { DynamicZoneLabelProps } from './DynamicZoneLabel';
import type { InputRendererProps } from '../../InputRenderer';
interface DynamicZoneContextValue {
isInDynamicZone: boolean;
}
declare const useDynamicZone: <Selected, ShouldThrow extends boolean = true>(consumerName: string, selector: (value: DynamicZoneContextValue) => Selected, shouldThrowOnMissingContext?: ShouldThrow | undefined) => ShouldThrow extends true ? Selected : Selected | undefined;
interface DynamicZoneProps extends Omit<Extract<EditFieldLayout, {
type: 'dynamiczone';
}>, 'size' | 'hint'>, Pick<InputProps, 'hint'>, Pick<DynamicZoneLabelProps, 'labelAction'> {
children?: (props: InputRendererProps) => React.ReactNode;
}
declare const DynamicZone: ({ attribute, disabled: disabledProp, hint, label, labelAction, name, required, children, }: DynamicZoneProps) => import("react/jsx-runtime").JSX.Element;
export { DynamicZone, useDynamicZone };
export type { DynamicZoneProps };

View File

@@ -0,0 +1,7 @@
import type { InputProps } from '@strapi/admin/strapi-admin';
import type { Schema } from '@strapi/types';
interface NotAllowedInputProps extends Omit<InputProps, 'type'> {
type: Schema.Attribute.Kind;
}
declare const NotAllowedInput: ({ hint, label, required, name }: NotAllowedInputProps) => import("react/jsx-runtime").JSX.Element;
export { NotAllowedInput };

View File

@@ -0,0 +1,74 @@
import * as React from 'react';
import { type UseDocument } from '../../../../../hooks/useDocument';
import { type DocumentMeta } from '../../../../../hooks/useDocumentContext';
export declare function getCollectionType(url: string): string | undefined;
interface State {
documentHistory: DocumentMeta[];
confirmDialogIntent: null | 'close' | 'back' | 'navigate' | DocumentMeta;
isModalOpen: boolean;
hasUnsavedChanges: boolean;
fieldToConnect?: string;
fieldToConnectUID?: string;
}
type Action = {
type: 'GO_TO_RELATION';
payload: {
document: DocumentMeta;
shouldBypassConfirmation: boolean;
fieldToConnect?: string;
fieldToConnectUID?: string;
};
} | {
type: 'GO_BACK';
payload: {
shouldBypassConfirmation: boolean;
};
} | {
type: 'GO_FULL_PAGE';
} | {
type: 'GO_TO_CREATED_RELATION';
payload: {
document: DocumentMeta;
shouldBypassConfirmation: boolean;
fieldToConnect?: string;
fieldToConnectUID?: string;
};
} | {
type: 'CANCEL_CONFIRM_DIALOG';
} | {
type: 'CLOSE_MODAL';
payload: {
shouldBypassConfirmation: boolean;
};
} | {
type: 'SET_HAS_UNSAVED_CHANGES';
payload: {
hasUnsavedChanges: boolean;
};
};
declare function reducer(state: State, action: Action): State;
interface RelationModalContextValue {
state: State;
dispatch: React.Dispatch<Action>;
rootDocumentMeta: DocumentMeta;
currentDocumentMeta: DocumentMeta;
currentDocument: ReturnType<UseDocument>;
onPreview?: () => void;
isCreating: boolean;
}
declare const useRelationModal: <Selected, ShouldThrow extends boolean = true>(consumerName: string, selector: (value: RelationModalContextValue) => Selected, shouldThrowOnMissingContext?: ShouldThrow | undefined) => ShouldThrow extends true ? Selected : Selected | undefined;
type RelationModalRendererProps = {
relation: DocumentMeta;
children: React.ReactNode;
} | {
relation?: never;
children: (props: {
dispatch: (action: Action) => void;
}) => React.ReactNode;
};
/**
* Component responsible for rendering its children wrapped in a modal, form and context if needed
*/
declare const RelationModalRenderer: (props: RelationModalRendererProps) => import("react/jsx-runtime").JSX.Element;
export { reducer, RelationModalRenderer, useRelationModal };
export type { State, Action };

View File

@@ -0,0 +1,45 @@
import * as React from 'react';
import { type InputProps } from '@strapi/admin/strapi-admin';
import { FlexComponent } from '@strapi/design-system';
import { type EditFieldLayout } from '../../../../../hooks/useDocumentLayout';
import { RelationResult } from '../../../../../services/relations';
type RelationPosition = (Pick<RelationResult, 'status' | 'locale'> & {
before: string;
end?: never;
}) | {
end: boolean;
before?: never;
status?: never;
locale?: never;
};
interface Relation extends Pick<RelationResult, 'documentId' | 'id' | 'locale' | 'status'> {
href: string;
label: string;
position?: RelationPosition;
__temp_key__: string;
apiData?: {
documentId: RelationResult['documentId'];
id: RelationResult['id'];
locale?: RelationResult['locale'];
position: RelationPosition;
isTemporary?: boolean;
};
}
interface RelationsFieldProps extends Omit<Extract<EditFieldLayout, {
type: 'relation';
}>, 'size' | 'hint'>, Pick<InputProps, 'hint'> {
}
export interface RelationsFormValue {
connect?: Relation[];
disconnect?: Pick<Relation, 'id'>[];
}
declare const FlexWrapper: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<Omit<Omit<import("@strapi/design-system").FlexProps<"div">, "ref"> & React.RefAttributes<unknown>, "ref"> & {
ref?: ((instance: unknown) => void) | React.RefObject<unknown> | null | undefined;
}, never>> & Omit<FlexComponent, keyof React.Component<any, {}, any>>;
declare const DisconnectButton: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, never>>;
declare const LinkEllipsis: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<Omit<Omit<import("@strapi/design-system").LinkProps<React.ElementType<any, keyof React.JSX.IntrinsicElements>>, "ref"> & React.RefAttributes<unknown>, "ref"> & {
ref?: ((instance: unknown) => void) | React.RefObject<unknown> | null | undefined;
}, never>> & Omit<(<C extends React.ElementType<any, keyof React.JSX.IntrinsicElements> = "a">(props: React.PropsWithoutRef<import("@strapi/design-system").LinkProps<C>> & React.RefAttributes<unknown>) => React.ReactNode), keyof React.Component<any, {}, any>>;
declare const MemoizedRelationsField: React.MemoExoticComponent<React.ForwardRefExoticComponent<RelationsFieldProps & React.RefAttributes<HTMLDivElement>>>;
export { MemoizedRelationsField as RelationsInput, FlexWrapper, DisconnectButton, LinkEllipsis };
export type { RelationsFieldProps };

View File

@@ -0,0 +1,9 @@
import * as React from 'react';
import { type InputProps } from '@strapi/admin/strapi-admin';
import type { Schema } from '@strapi/types';
interface UIDInputProps extends Omit<InputProps, 'type'> {
type: Schema.Attribute.TypeOf<Schema.Attribute.UID>;
}
declare const MemoizedUIDInput: React.MemoExoticComponent<React.ForwardRefExoticComponent<UIDInputProps & React.RefAttributes<any>>>;
export { MemoizedUIDInput as UIDInput };
export type { UIDInputProps };

View File

@@ -0,0 +1,17 @@
import * as React from 'react';
import { EditorFromTextArea } from 'codemirror5';
import type { FieldValue, InputProps } from '@strapi/admin/strapi-admin';
import 'codemirror5/addon/display/placeholder';
interface EditorApi {
focus: () => void;
scrollIntoView: (args?: Parameters<HTMLElement['scrollIntoView']>[0]) => void;
}
interface EditorProps extends Omit<FieldValue, 'initialValue'>, Omit<InputProps, 'type' | 'label'> {
editorRef: React.MutableRefObject<EditorFromTextArea>;
isPreviewMode?: boolean;
isExpandMode?: boolean;
textareaRef: React.RefObject<HTMLTextAreaElement>;
}
declare const Editor: React.ForwardRefExoticComponent<EditorProps & React.RefAttributes<EditorApi>>;
export { Editor };
export type { EditorProps, EditorApi };

View File

@@ -0,0 +1,14 @@
import * as React from 'react';
interface EditorLayoutProps {
children: React.ReactNode;
isExpandMode: boolean;
error?: string;
previewContent?: string;
onCollapse: () => void;
}
declare const EditorLayout: ({ children, isExpandMode, error, previewContent, onCollapse, }: EditorLayoutProps) => import("react/jsx-runtime").JSX.Element;
declare const ExpandButton: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<Omit<Omit<import("@strapi/design-system").ButtonProps<React.ElementType<any, keyof React.JSX.IntrinsicElements>>, "ref"> & React.RefAttributes<unknown>, "ref"> & {
ref?: ((instance: unknown) => void) | React.RefObject<unknown> | null | undefined;
}, never>> & Omit<(<C extends React.ElementType<any, keyof React.JSX.IntrinsicElements> = "button">(props: React.PropsWithoutRef<import("@strapi/design-system").ButtonProps<C>> & React.RefAttributes<unknown>) => React.ReactNode), keyof React.Component<any, {}, any>>;
export { EditorLayout, ExpandButton };
export type { EditorLayoutProps };

View File

@@ -0,0 +1,11 @@
import * as React from 'react';
import { type InputProps } from '@strapi/admin/strapi-admin';
import { EditorApi } from './Editor';
import type { Schema } from '@strapi/types';
interface WysiwygProps extends Omit<InputProps, 'type'> {
labelAction?: React.ReactNode;
type: Schema.Attribute.RichText['type'];
}
declare const MemoizedWysiwyg: React.MemoExoticComponent<React.ForwardRefExoticComponent<WysiwygProps & React.RefAttributes<EditorApi>>>;
export { MemoizedWysiwyg as Wysiwyg };
export type { WysiwygProps };

View File

@@ -0,0 +1,5 @@
interface PreviewWysiwygProps {
data?: string;
}
declare const PreviewWysiwyg: ({ data }: PreviewWysiwygProps) => import("react/jsx-runtime").JSX.Element;
export { PreviewWysiwyg };

View File

@@ -0,0 +1,7 @@
import { ButtonProps } from '@strapi/design-system';
interface WysiwygFooterProps {
onToggleExpand: ButtonProps['onClick'];
}
declare const WysiwygFooter: ({ onToggleExpand }: WysiwygFooterProps) => import("react/jsx-runtime").JSX.Element;
export { WysiwygFooter };
export type { WysiwygFooterProps };

View File

@@ -0,0 +1,16 @@
import * as React from 'react';
import { EditorFromTextArea } from 'codemirror5';
interface WysiwygNavProps {
disabled?: boolean;
editorRef: React.MutableRefObject<EditorFromTextArea>;
isExpandMode?: boolean;
isPreviewMode?: boolean;
onToggleMediaLib: () => void;
onTogglePreviewMode?: () => void;
}
/**
* TODO: refactor this mess.
*/
declare const WysiwygNav: ({ disabled, editorRef, isPreviewMode, onToggleMediaLib, onTogglePreviewMode, }: WysiwygNavProps) => import("react/jsx-runtime").JSX.Element;
export { WysiwygNav };
export type { WysiwygNavProps };

View File

@@ -0,0 +1,18 @@
/// <reference types="react" />
import { IconButtonComponent } from '@strapi/design-system';
export declare const MainButtons: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<any, never>> | (import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<any, never>> & Omit<any, keyof import("react").Component<any, {}, any>>);
export declare const MoreButton: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<import("@strapi/design-system").TransientBoxProps & {
children?: import("react").ReactNode;
} & import("@strapi/design-system/dist/types").AsProp<"button"> & Omit<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref">, "children" | keyof import("@strapi/design-system/dist/types").AsProp<C> | keyof import("@strapi/design-system").TransientBoxProps> & {
ref?: ((instance: HTMLButtonElement | null) => void) | import("react").RefObject<HTMLButtonElement> | null | undefined;
} & import("@strapi/design-system").TransientFlexProps & Pick<import("@strapi/design-system").ButtonProps, "size" | "variant"> & {
children: import("react").ReactNode;
disabled?: boolean | undefined;
label: string;
onClick?: import("react").MouseEventHandler<HTMLButtonElement> | undefined;
withTooltip?: boolean | undefined;
}, never>> & Omit<IconButtonComponent, keyof import("react").Component<any, {}, any>>;
export declare const IconButtonGroupMargin: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<any, never>> | (import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<any, never>> & Omit<any, keyof import("react").Component<any, {}, any>>);
export declare const ExpandButton: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<Omit<Omit<import("@strapi/design-system").ButtonProps<import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements>>, "ref"> & import("react").RefAttributes<unknown>, "ref"> & {
ref?: ((instance: unknown) => void) | import("react").RefObject<unknown> | null | undefined;
}, never>> & Omit<(<C extends import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> = "button">(props: import("react").PropsWithoutRef<import("@strapi/design-system").ButtonProps<C>> & import("react").RefAttributes<unknown>) => import("react").ReactNode), keyof import("react").Component<any, {}, any>>;

View File

@@ -0,0 +1,5 @@
import CodeMirror from 'codemirror5';
declare function newlineAndIndentContinueMarkdownList(cm: CodeMirror.Editor): {
toString(): "CodeMirror.PASS";
} | undefined;
export { newlineAndIndentContinueMarkdownList };

View File

@@ -0,0 +1,4 @@
import Markdown from 'markdown-it';
import 'highlight.js/styles/solarized-dark.css';
declare const md: Markdown;
export { md };

View File

@@ -0,0 +1,16 @@
import { MutableRefObject } from 'react';
import CodeMirror from 'codemirror5';
export declare const replaceText: (markdownName: string, textToChange: string) => string;
export declare const insertText: (markdownName: string) => {
editedText: string;
selection: {
start: number;
end: number;
};
};
export declare const insertListOrTitle: (markdown: string) => string;
export declare const markdownHandler: (editor: MutableRefObject<CodeMirror.EditorFromTextArea>, markdownType: string) => void;
export declare const listHandler: (editor: MutableRefObject<CodeMirror.EditorFromTextArea>, listType: string) => void;
export declare const titleHandler: (editor: MutableRefObject<CodeMirror.EditorFromTextArea>, titleType: string) => void;
export declare const insertFile: (editor: MutableRefObject<CodeMirror.EditorFromTextArea>, files: any[]) => void;
export declare const quoteAndCodeHandler: (editor: MutableRefObject<CodeMirror.EditorFromTextArea>, markdownType: string) => void;

Some files were not shown because too many files have changed in this diff Show More