Skip to content

Commit

Permalink
Merge pull request #673 from contember/headless-upload
Browse files Browse the repository at this point in the history
headless uploader
  • Loading branch information
matej21 committed Mar 13, 2024
2 parents 188f020 + c178652 commit 0ddc167
Show file tree
Hide file tree
Showing 143 changed files with 4,921 additions and 413 deletions.
6 changes: 3 additions & 3 deletions build/api/admin.api.md
Expand Up @@ -6,7 +6,6 @@

/// <reference types="react" />

import { AccessorErrorsHolder } from '@contember/react-binding-ui';
import type { AccessorTreeState } from '@contember/react-binding';
import { AddEntityButtonProps } from '@contember/react-binding-ui';
import { Ancestor } from 'slate';
Expand Down Expand Up @@ -52,6 +51,7 @@ import { EntityListSubTreeAdditionalProps } from '@contember/react-binding';
import { EntitySubTreeAdditionalCreationProps } from '@contember/react-binding';
import { EntitySubTreeAdditionalProps } from '@contember/react-binding';
import { Environment } from '@contember/react-binding';
import { ErrorAccessorHolder } from '@contember/react-binding';
import { ErrorCodeDictionary } from '@contember/react-binding-ui';
import { FC } from 'react';
import { FieldAccessor } from '@contember/react-binding';
Expand Down Expand Up @@ -1228,7 +1228,7 @@ export interface FileDataExtractor<ExtractedData = unknown, UploadResult = unkno
// (undocumented)
extractFileData?: (options: FileDataExtractorExtractFileDataOptions<AcceptArtifacts>) => Promise<ExtractedData> | null;
// (undocumented)
getErrorsHolders?: (options: FileDataExtractorGetErrorsOptions) => AccessorErrorsHolder[];
getErrorsHolders?: (options: FileDataExtractorGetErrorsOptions) => ErrorAccessorHolder[];
// (undocumented)
populateFields: (options: FileDataExtractorPopulateFieldsOptions<ExtractedData, UploadResult, AcceptArtifacts>) => void;
// (undocumented)
Expand Down Expand Up @@ -2861,7 +2861,7 @@ export interface ResolvedDiscriminatedDatum<Datum> {
export type ResolvedFileEntity = {
parentEntity: EntityAccessor;
destroy?: () => void;
getErrorHolders: () => AccessorErrorsHolder[];
getErrorHolders: () => ErrorAccessorHolder[];
} & ({
fileEntity: EntityAccessor;
fileKind: FullFileKind<any, any>;
Expand Down
10 changes: 10 additions & 0 deletions build/api/binding.api.md
Expand Up @@ -357,6 +357,8 @@ export class EntityListAccessor implements Errorable {
// (undocumented)
getChildEntityById(id: EntityId): EntityAccessor;
// (undocumented)
getParent(): EntityAccessor | undefined;
// (undocumented)
hasEntityId(id: EntityId): boolean;
// (undocumented)
hasEntityOnServer(entityOrItsId: EntityAccessor | EntityId): boolean;
Expand Down Expand Up @@ -714,6 +716,12 @@ export namespace ErrorAccessor {
normalizeError: (error: Error | string) => Error;
}

// @public (undocumented)
export interface ErrorAccessorHolder {
// (undocumented)
readonly errors: ErrorAccessor | undefined;
}

// @public (undocumented)
export type ErrorPersistResult = InvalidInputPersistResult | InvalidResponseResult;

Expand Down Expand Up @@ -845,6 +853,8 @@ export class FieldAccessor<Value extends FieldValue = FieldValue> implements Err
// (undocumented)
readonly getAccessor: FieldAccessor.GetFieldAccessor<Value>;
// (undocumented)
getParent(): EntityAccessor;
// (undocumented)
readonly hasUnpersistedChanges: boolean;
// (undocumented)
hasValue(candidate: this['value']): boolean;
Expand Down
18 changes: 18 additions & 0 deletions build/api/interface.api.md
Expand Up @@ -16,6 +16,7 @@ import { ReactNode } from 'react';
import { RouteMap } from '@contember/react-routing';
import { RoutingLinkTarget } from '@contember/react-routing';
import { SuccessfulPersistResult } from '@contember/react-binding';
import { SugaredRelativeSingleEntity } from '@contember/react-binding';
import { SugaredRelativeSingleField } from '@contember/react-binding';

// @public (undocumented)
Expand Down Expand Up @@ -63,6 +64,23 @@ export interface DeleteEntityTriggerProps {
onPersistSuccess?: (result: SuccessfulPersistResult) => void;
}

// @public (undocumented)
export const DisconnectEntityTrigger: ({ immediatePersist, onPersistError, onPersistSuccess, field, ...props }: DisconnectEntityTriggerProps) => JSX_2.Element;

// @public (undocumented)
export interface DisconnectEntityTriggerProps {
// (undocumented)
children: ReactNode;
// (undocumented)
field?: SugaredRelativeSingleEntity['field'];
// (undocumented)
immediatePersist?: true;
// (undocumented)
onPersistError?: (result: ErrorPersistResult) => void;
// (undocumented)
onPersistSuccess?: (result: SuccessfulPersistResult) => void;
}

// @public (undocumented)
export const EntityBeforePersist: ({ listener }: {
listener: EntityAccessor.EntityEventListenerMap['beforePersist'];
Expand Down
6 changes: 0 additions & 6 deletions build/api/react-binding-ui.api.md
Expand Up @@ -42,12 +42,6 @@ export type AccessorErrorMessages = [AccessorErrorMessage, ...AccessorErrorMessa
// @public (undocumented)
export function AccessorErrors({ accessor, ...errorListProps }: AccessorErrorsProps): ReactElement | null;

// @public (undocumented)
export interface AccessorErrorsHolder {
// (undocumented)
readonly errors: ErrorAccessor | undefined;
}

// @public (undocumented)
export interface AccessorErrorsProps extends Omit<ErrorListProps, 'errors'> {
// (undocumented)
Expand Down
42 changes: 27 additions & 15 deletions build/api/react-client.api.md
Expand Up @@ -159,34 +159,46 @@ export interface SessionTokenContextValue {
export const SetSessionTokenContext: Context<(token: string | undefined) => void>;

// @public (undocumented)
export type SingleFileUploadState<Result = unknown, Metadata = undefined> = {
readyState: 'initializing';
abortController: AbortController;
export type SingleFileUploadErrorState<Metadata = undefined> = {
readyState: 'error';
errors: FileUploadError[] | undefined;
rawError: any;
file: File;
metadata: Metadata | undefined;
previewUrl: string;
} | {
readyState: 'uploading';
uploader: FileUploader | undefined;
};

// @public (undocumented)
export type SingleFileUploadInitializingState = {
readyState: 'initializing';
abortController: AbortController;
file: File;
metadata: Metadata;
previewUrl: string;
progress: number | undefined;
uploader: FileUploader;
} | {
};

// @public (undocumented)
export type SingleFileUploadState<Result = unknown, Metadata = undefined> = SingleFileUploadInitializingState | SingleFileUploadUploadingState<Metadata> | SingleFileUploadSuccessState<Metadata, Result> | SingleFileUploadErrorState<Metadata>;

// @public (undocumented)
export type SingleFileUploadSuccessState<Metadata = undefined, Result = unknown> = {
readyState: 'success';
file: File;
metadata: Metadata;
previewUrl: string;
result: Result;
uploader: FileUploader;
} | {
readyState: 'error';
errors: FileUploadError[] | undefined;
rawError: any;
};

// @public (undocumented)
export type SingleFileUploadUploadingState<Metadata = undefined> = {
readyState: 'uploading';
abortController: AbortController;
file: File;
metadata: Metadata | undefined;
metadata: Metadata;
previewUrl: string;
uploader: FileUploader | undefined;
progress: number | undefined;
uploader: FileUploader;
};

// @public (undocumented)
Expand Down
26 changes: 21 additions & 5 deletions build/api/react-repeater.api.md
Expand Up @@ -4,6 +4,7 @@
```ts

import { Context } from 'react';
import { EntityAccessor } from '@contember/binding';
import { EntityAccessor as EntityAccessor_2 } from '@contember/react-binding';
import { EntityListAccessor } from '@contember/binding';
Expand All @@ -29,6 +30,9 @@ export const RepeaterAddItemTrigger: ({ children, index }: {
index: RepeaterAddItemIndex;
}) => JSX_2.Element;

// @internal (undocumented)
export const RepeaterCurrentEntityContext: Context<EntityAccessor_2>;

// @public (undocumented)
export const RepeaterEachItem: ({ children }: {
children: ReactNode;
Expand All @@ -39,13 +43,19 @@ export const RepeaterEmpty: ({ children }: {
children: ReactNode;
}) => JSX_2.Element | null;

// @internal (undocumented)
export const RepeaterEntityListAccessorContext: Context<EntityListAccessor>;

// @public (undocumented)
export type RepeaterMethods = {
moveItem?: RepeaterMoveItemMethod;
addItem?: RepeaterAddItemMethod;
removeItem?: RepeaterRemoveItemMethod;
addItem: RepeaterAddItemMethod;
removeItem: RepeaterRemoveItemMethod;
};

// @internal (undocumented)
export const RepeaterMethodsContext: Context<RepeaterMethods>;

// @public (undocumented)
export type RepeaterMoveItemIndex = number | 'first' | 'last' | 'previous' | 'next';

Expand All @@ -68,13 +78,13 @@ export type RepeaterProps = RepeaterQualifiedProps | RepeaterRelativeProps;

// @public (undocumented)
export type RepeaterQualifiedProps = SugaredQualifiedEntityList & {
children: React_2.ReactNode;
children?: React_2.ReactNode;
sortableBy?: SugaredFieldProps['field'];
};

// @public (undocumented)
export type RepeaterRelativeProps = SugaredRelativeEntityList & {
children: React_2.ReactNode;
children?: React_2.ReactNode;
sortableBy?: SugaredFieldProps['field'];
};

Expand All @@ -86,8 +96,14 @@ export const RepeaterRemoveItemTrigger: ({ children }: {
children: ReactNode;
}) => JSX_2.Element;

// @internal (undocumented)
export const RepeaterSortedEntitiesContext: Context<EntityAccessor_2[]>;

// @public (undocumented)
export const useRepeaterCurrentEntity: () => EntityAccessor_2;

// @public (undocumented)
export const useRepeaterEntityListAccessor: () => EntityListAccessor | undefined;
export const useRepeaterEntityListAccessor: () => EntityListAccessor;

// @public (undocumented)
export const useRepeaterMethods: () => RepeaterMethods;
Expand Down
30 changes: 30 additions & 0 deletions build/api/react-uploader-dropzone.api.md
@@ -0,0 +1,30 @@
## API Report File for "@contember/react-uploader-dropzone"

> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
```ts

import { DropzoneState } from 'react-dropzone';
import { JSX as JSX_2 } from 'react/jsx-runtime';
import { ReactNode } from 'react';

// @public (undocumented)
export const UploaderDropzoneArea: ({ children }: {
children: ReactNode;
}) => JSX_2.Element;

// @public (undocumented)
export const UploaderDropzoneInput: () => JSX_2.Element;

// @public (undocumented)
export const UploaderDropzoneRoot: ({ children, noInput }: {
children: ReactNode;
noInput?: boolean | undefined;
}) => JSX_2.Element;

// @public (undocumented)
export const useUploaderDropzoneState: () => DropzoneState;

// (No @packageDocumentation comment for this package)

```

0 comments on commit 0ddc167

Please sign in to comment.