@manifest-editor/shell 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts ADDED
@@ -0,0 +1,1301 @@
1
+ // Generated by dts-bundle-generator v6.13.0
2
+
3
+ import { Collection, DescriptiveProperties, InternationalString, LinkingProperties, Manifest, MetadataItem, NavPlaceExtension, Reference, Service, SpecificResource, SpecificationTimeMode, StructuralProperties, TechnicalProperties, TextGranularityExtension, ViewingDirection } from '@iiif/presentation-3';
4
+ import { AnnotationNormalized } from '@iiif/presentation-3-normalized';
5
+ import { Vault } from '@iiif/vault';
6
+ import { Emitter } from 'mitt';
7
+ import * as React from 'react';
8
+ import { Dispatch, HTMLAttributes, ReactNode, SetStateAction } from 'react';
9
+ import { TransitionStatus } from 'react-transition-group';
10
+
11
+ export type LoadedApp = Partial<LayoutProps> & {
12
+ default: {
13
+ id: string;
14
+ title: string;
15
+ type?: "manifest" | "launcher";
16
+ project?: boolean;
17
+ projectType?: "Manifest" | "Collection";
18
+ dev?: boolean;
19
+ desktop?: boolean;
20
+ web?: boolean;
21
+ drafts?: boolean;
22
+ };
23
+ };
24
+ export type MappedApp = {
25
+ metadata: LoadedApp["default"];
26
+ layout: LayoutProps;
27
+ };
28
+ export type AppDefinition = {
29
+ allApps: Record<string, MappedApp>;
30
+ allAppIds: string[];
31
+ allPaths: string[];
32
+ };
33
+ export interface Storage {
34
+ type: string;
35
+ error?: {
36
+ message: string;
37
+ };
38
+ data: any;
39
+ }
40
+ export interface ManifestStorage {
41
+ type: "manifest-storage";
42
+ data: Manifest;
43
+ }
44
+ export interface CollectionStorage {
45
+ type: "collection-storage";
46
+ data: Collection;
47
+ }
48
+ export interface RemoteWebsocketStorage {
49
+ type: "remote-websocket-storage";
50
+ data: {
51
+ id: string;
52
+ type: string;
53
+ };
54
+ }
55
+ export interface ResourceKeyedStorage {
56
+ type: "resource-keyed-storage";
57
+ data: {
58
+ id: string;
59
+ type: string;
60
+ key: string;
61
+ };
62
+ }
63
+ export interface Publication {
64
+ id: string;
65
+ type: string;
66
+ config: any;
67
+ }
68
+ export interface Preview {
69
+ id: string;
70
+ type: string;
71
+ data: any;
72
+ }
73
+ export interface ProjectState {
74
+ current: EditorProject | null;
75
+ allProjects: EditorProject[];
76
+ loadingStatus: null | ProjectsLoadingStatus;
77
+ }
78
+ export type ProjectContext = ProjectState & {
79
+ actions: ProjectActions;
80
+ canDelete: boolean;
81
+ };
82
+ export interface ProjectsLoadingStatus {
83
+ loading: boolean;
84
+ loaded: boolean;
85
+ lastLoaded: number;
86
+ }
87
+ export interface ProjectActions {
88
+ createProject(project: EditorProject): void;
89
+ deleteProject(id: string): void;
90
+ switchProject(id: string): void;
91
+ deselectProject(id: string): void;
92
+ forkProject(details: {
93
+ id: string;
94
+ name: string;
95
+ filename?: string;
96
+ }): void;
97
+ load(state: ProjectState): void;
98
+ setLoadingStatus(status: ProjectsLoadingStatus): void;
99
+ saveProject(project: EditorProject): Promise<void> | void;
100
+ updateDetails(details: {
101
+ name: string;
102
+ filename?: string;
103
+ }): void;
104
+ createPublication(publication: Publication): void;
105
+ updatePublication(publication: Publication): void;
106
+ removePublication(id: string): void;
107
+ setPreview(publication: Preview): void;
108
+ removePreview(id: string): void;
109
+ updateSettings(settings: EditorProject["settings"]): void;
110
+ updateThumbnail(url: string): void;
111
+ updateStorage(storage: Storage): void;
112
+ }
113
+ export type ProjectActionsType = {
114
+ [T in keyof ProjectActions]: {
115
+ type: T;
116
+ payload: Parameters<ProjectActions[T]>[0];
117
+ };
118
+ }[keyof ProjectActions];
119
+ export interface EditorProject {
120
+ id: string;
121
+ name: string;
122
+ filename?: string;
123
+ thumbnail?: string;
124
+ resource: {
125
+ id: string;
126
+ type: "Manifest";
127
+ } | {
128
+ id: string;
129
+ type: "Collection";
130
+ };
131
+ storage: Storage;
132
+ settings: Record<string, never>;
133
+ publications: Publication[];
134
+ previews: Preview[];
135
+ metadata: {
136
+ created: number;
137
+ modified: number;
138
+ };
139
+ }
140
+ export interface ProjectBackend {
141
+ saveInterval: number;
142
+ getAllProjects(fresh?: boolean): Promise<EditorProject[]>;
143
+ getLastProject(): Promise<string | null>;
144
+ setLastProject(id: string): Promise<void>;
145
+ canDelete(): boolean;
146
+ createProject(project: EditorProject): Promise<void>;
147
+ updateProject(project: EditorProject): Promise<void>;
148
+ deleteProject(id: string): Promise<void>;
149
+ }
150
+ export interface ProjectStorage<S extends Storage, DataType = any, Ref extends Storage = any> {
151
+ type: string;
152
+ saveInterval: number;
153
+ create(project: EditorProject, data: DataType): Promise<Ref | void>;
154
+ saveStorage(ref: Ref): Promise<void>;
155
+ deleteStorage(ref: Ref): Promise<void>;
156
+ canCreate(): boolean;
157
+ canDelete(): boolean;
158
+ getBackendStorage(project: EditorProject): Ref;
159
+ createVaultInstance(project: EditorProject): [
160
+ Vault,
161
+ Promise<void>
162
+ ];
163
+ closeVaultInstance(project: EditorProject, vault: Vault): void;
164
+ shouldUpdateWithVault(): boolean;
165
+ }
166
+ export type AppContext = {
167
+ apps: Record<string, MappedApp>;
168
+ currentApp: {
169
+ id: string;
170
+ args?: any;
171
+ };
172
+ initialApp: {
173
+ id: string;
174
+ args?: any;
175
+ };
176
+ changeApp: (app: {
177
+ id: string;
178
+ args?: any;
179
+ }) => void;
180
+ editProject: (project: EditorProject) => void;
181
+ };
182
+ export type AppState = {
183
+ state: null | any;
184
+ setState: SetStateAction<any>;
185
+ };
186
+ export declare function useApps(): AppContext;
187
+ export declare function useAppState<S = any>(): {
188
+ state: any;
189
+ setState: any;
190
+ };
191
+ export declare function AppStateProvider(props: {
192
+ appId: string;
193
+ initialValue?: any;
194
+ args?: any;
195
+ children: ReactNode;
196
+ }): JSX.Element;
197
+ export declare function AppProvider({ apps, initialApp, saveCurrentApp, children, }: {
198
+ apps: Record<string, MappedApp>;
199
+ initialApp?: AppContext["currentApp"];
200
+ saveCurrentApp?: boolean;
201
+ children: ReactNode;
202
+ }): JSX.Element;
203
+ export interface AppHeaderProps {
204
+ onClickLogo?: () => void;
205
+ }
206
+ export declare const AppHeader: import("react").NamedExoticComponent<AppHeaderProps>;
207
+ export declare function useIsDesktop(): boolean;
208
+ export declare function DesktopContext({ children }: {
209
+ children: ReactNode;
210
+ }): JSX.Element;
211
+ export type PreviewContext = PreviewState & {
212
+ handlers: Array<PreviewHandler>;
213
+ actions: PreviewActions;
214
+ configs: Array<PreviewConfiguration>;
215
+ };
216
+ export interface PreviewState {
217
+ selected: string | null;
218
+ active: string[];
219
+ }
220
+ export interface PreviewActions {
221
+ activatePreview(id: string): void;
222
+ updatePreviews(): void;
223
+ selectPreview(id: string): void;
224
+ deletePreview(id: string): void;
225
+ focusPreview(id: string): void;
226
+ }
227
+ export type PreviewActionsType = {
228
+ [T in keyof PreviewActions]: {
229
+ type: T;
230
+ payload: Parameters<PreviewActions[T]>[0];
231
+ };
232
+ }[keyof PreviewActions];
233
+ export interface PreviewConfiguration<Config = any> {
234
+ id: string;
235
+ type: string;
236
+ label: string;
237
+ config: Config;
238
+ }
239
+ export interface PreviewHandler {
240
+ id: string;
241
+ label: string;
242
+ type: string;
243
+ focusable: boolean;
244
+ getRequires(): string[];
245
+ getProvides(): string[];
246
+ isPreviewValid(project: EditorProject): boolean;
247
+ createPreview(project: EditorProject, vault: Vault, ctx: any): Promise<Preview>;
248
+ focus(project: EditorProject): Promise<void>;
249
+ updatePreview(project: EditorProject, vault: Vault, ctx: any): Promise<Preview | null>;
250
+ deletePreview(id: string): Promise<void>;
251
+ }
252
+ export interface Config {
253
+ previews: PreviewConfiguration[];
254
+ defaultLanguages: string[];
255
+ behaviorPresets: string[];
256
+ newTemplates: Collection | null;
257
+ }
258
+ export declare function useConfig(): Config;
259
+ export declare function ConfigProvider({ children, config }: {
260
+ children: ReactNode;
261
+ config?: Partial<Config>;
262
+ }): JSX.Element;
263
+ export interface EditableResource {
264
+ parent?: Reference;
265
+ property?: string;
266
+ index?: number;
267
+ resource: SpecificResource;
268
+ onlyReference?: boolean;
269
+ }
270
+ export interface CreatableResource {
271
+ type: string;
272
+ parent?: Reference;
273
+ property?: string;
274
+ index?: number;
275
+ onlyReference?: boolean;
276
+ target?: Reference;
277
+ initialData?: any;
278
+ isPainting?: boolean;
279
+ }
280
+ export interface EditingStackState {
281
+ current: EditableResource | null;
282
+ stack: Array<EditableResource>;
283
+ create: {
284
+ resource: CreatableResource;
285
+ options: any;
286
+ } | null;
287
+ }
288
+ export interface EditingStackActions {
289
+ edit(resource: EditableResource | null, reset?: boolean): void;
290
+ updateCurrent(resource: Partial<EditableResource>): void;
291
+ close(): void;
292
+ back(): void;
293
+ create(resource: CreatableResource, options?: any): () => void;
294
+ }
295
+ export type EditingStackActionCreators = {
296
+ type: "edit";
297
+ payload: {
298
+ resource: EditableResource | null;
299
+ reset?: boolean;
300
+ };
301
+ } | {
302
+ type: "updateCurrent";
303
+ payload: {
304
+ resource: EditableResource;
305
+ };
306
+ } | {
307
+ type: "syncRemoval";
308
+ payload: {
309
+ resource: EditableResource;
310
+ };
311
+ } | {
312
+ type: "back";
313
+ } | {
314
+ type: "create";
315
+ payload: {
316
+ resource: CreatableResource | null;
317
+ options?: any;
318
+ };
319
+ } | {
320
+ type: "close";
321
+ };
322
+ export interface EditorConfig {
323
+ vault: Vault;
324
+ reference: Reference;
325
+ context: {
326
+ resource: SpecificResource;
327
+ parent?: Reference;
328
+ parentProperty?: string;
329
+ index?: number;
330
+ };
331
+ tracker: TrackerState;
332
+ validators: Validator[];
333
+ }
334
+ export interface TrackerState {
335
+ key: string;
336
+ observed: string[];
337
+ start(onChange: () => void): () => void;
338
+ subscribe(cb: (entity: any) => void): () => void;
339
+ track(key: string): void;
340
+ reset(): void;
341
+ }
342
+ export interface Validator {
343
+ types: string[];
344
+ properties: string[];
345
+ message: string;
346
+ error?: boolean;
347
+ warning?: boolean;
348
+ valid: (resource: any, vault: Vault, context: any) => boolean;
349
+ }
350
+ export interface EntityValidationResponse {
351
+ isError: boolean;
352
+ isWarning: boolean;
353
+ problems: Array<{
354
+ isError: boolean;
355
+ isWarning: boolean;
356
+ message: string;
357
+ properties: string[];
358
+ }>;
359
+ }
360
+ declare class BaseEditor<T> {
361
+ protected config: EditorConfig;
362
+ constructor(config: EditorConfig);
363
+ protected entity(): T;
364
+ protected ref(): Reference;
365
+ protected getId(): string;
366
+ protected getType(): string;
367
+ focusId(): string;
368
+ protected _observe(selector: (resource: T, context: any, vault: Vault) => any, cb: (selected: any, resource: T, context: any) => void, skipInitial?: boolean): () => void;
369
+ }
370
+ declare class BasePropertyEditor<Entity, T> extends BaseEditor<Entity> {
371
+ protected property: string;
372
+ constructor(config: EditorConfig, property: string);
373
+ observe(cb: (selected: T, resource: Entity, context: any) => void, skipInitial?: boolean): void;
374
+ focusId(): string;
375
+ containerId(): string;
376
+ getContainerProps(): {
377
+ "data-property": string;
378
+ "data-resource-id": string;
379
+ "data-resource-type": string;
380
+ };
381
+ isRequired(): boolean;
382
+ isRecommended(): boolean;
383
+ isNotAllowed(): boolean;
384
+ isOptional(orRecommended?: boolean): boolean;
385
+ validate(): {
386
+ isError: boolean;
387
+ isWarning: boolean;
388
+ warnings: string[];
389
+ errors: string[];
390
+ };
391
+ getWithoutTracking(): T;
392
+ get(): T;
393
+ set(value: T): void;
394
+ }
395
+ declare class MetadataEditor<T> extends BasePropertyEditor<T, MetadataItem[]> {
396
+ protected cachedList: MetadataItem[] | undefined;
397
+ protected cachedSortableList: Array<{
398
+ id: string;
399
+ } & MetadataItem>;
400
+ protected idCache: Map<any, any>;
401
+ constructor(config: EditorConfig);
402
+ protected _getId(resource: any): any;
403
+ getSortable(): ({
404
+ id: string;
405
+ } & MetadataItem)[];
406
+ add(label: InternationalString, value: InternationalString, beforeIndex?: number): void;
407
+ update(atIndex: number, label: InternationalString, value: InternationalString): void;
408
+ deleteAtIndex(atIndex: number): void;
409
+ moveToStart(index: number): void;
410
+ moveToEnd(index: number): void;
411
+ reorder(startIndex: number, endIndex: number): void;
412
+ }
413
+ declare class RequiredStatementEditor<T> extends BasePropertyEditor<T, DescriptiveProperties["requiredStatement"]> {
414
+ constructor(config: EditorConfig);
415
+ updateLabel(text: string | InternationalString): void;
416
+ update(text: InternationalString): void;
417
+ }
418
+ declare class RightsStatementEditor<T> extends BasePropertyEditor<T, string> {
419
+ constructor(config: EditorConfig);
420
+ getClean(): string;
421
+ getDefinition(): {
422
+ label: string;
423
+ shortLabel: string;
424
+ description: string;
425
+ icon: string;
426
+ value: string;
427
+ url: string;
428
+ legal: string;
429
+ } | null;
430
+ getIcon(): string | undefined;
431
+ getOptions(): {
432
+ label: string;
433
+ shortLabel: string;
434
+ description: string;
435
+ icon: string;
436
+ value: string;
437
+ url: string;
438
+ legal: string;
439
+ }[];
440
+ }
441
+ declare class NavDateEditor<T> extends BasePropertyEditor<T, string | null> {
442
+ constructor(config: EditorConfig);
443
+ setDate(date: Date | null): void;
444
+ getDate(): Date | null;
445
+ modifyAsDate(fn: (date: Date) => void): void;
446
+ }
447
+ declare class InternationalStringEditor<Entity> extends BasePropertyEditor<Entity, InternationalString> {
448
+ constructor(config: EditorConfig, property: string);
449
+ }
450
+ declare class BaseReferenceListEditor<Entity, T> extends BasePropertyEditor<Entity, T[]> {
451
+ protected cachedList: T[] | undefined;
452
+ protected cachedSortableList: Array<Reference | ({
453
+ id: string;
454
+ } & SpecificResource)> | undefined;
455
+ protected idCache: Map<any, any>;
456
+ constructor(config: EditorConfig, property: string);
457
+ focusId(): string;
458
+ protected _getId(resource: any): any;
459
+ getSortable(): (Reference | ({
460
+ id: string;
461
+ } & import("@iiif/presentation-3").OtherProperties & {
462
+ role?: string | undefined;
463
+ } & {
464
+ id?: string | undefined;
465
+ type: "SpecificResource";
466
+ state?: import("@iiif/presentation-3").State | import("@iiif/presentation-3").State[] | undefined;
467
+ purpose?: import("@iiif/presentation-3").AnyMotivation | import("@iiif/presentation-3").AnyMotivation[] | undefined;
468
+ source?: any;
469
+ selector?: import("@iiif/presentation-3").Selector | import("@iiif/presentation-3").Selector[] | undefined;
470
+ styleClass?: string | undefined;
471
+ renderedVia?: import("@iiif/presentation-3").Agent | import("@iiif/presentation-3").Agent[] | undefined;
472
+ scope?: any;
473
+ }))[] | undefined;
474
+ get(): T[];
475
+ set(): void;
476
+ moveToStart(index: number): void;
477
+ moveToEnd(index: number): void;
478
+ deleteAtIndex(index: number): void;
479
+ addAfter(index: number, reference: Reference | SpecificResource): void;
480
+ addBefore(index: number, reference: Reference | SpecificResource): void;
481
+ add(reference: Reference | SpecificResource): void;
482
+ reorder(startIndex: number, endIndex: number): void;
483
+ moveUpBy(index: number, steps: number): void;
484
+ moveDownBy(index: number, steps: number): void;
485
+ private duplicate;
486
+ updateReference(index: number, item: Reference | SpecificResource): void;
487
+ private batchInsertAtIndex;
488
+ }
489
+ declare class DescriptiveEditor<T extends Partial<DescriptiveProperties>> extends BaseEditor<T> {
490
+ label: InternationalStringEditor<T>;
491
+ summary: InternationalStringEditor<T>;
492
+ metadata: MetadataEditor<T>;
493
+ requiredStatement: RequiredStatementEditor<T>;
494
+ rights: RightsStatementEditor<T>;
495
+ navDate: NavDateEditor<T>;
496
+ language: BasePropertyEditor<T, string[]>;
497
+ thumbnail: BaseReferenceListEditor<T, Reference<"ContentResource">>;
498
+ provider: BasePropertyEditor<T, Reference<"Agent">[]>;
499
+ placeholderCanvas: BasePropertyEditor<T, Reference<"Canvas">>;
500
+ accompanyingCanvas: BasePropertyEditor<T, Reference<"Canvas">>;
501
+ value: BasePropertyEditor<T, any>;
502
+ constructor(config: EditorConfig);
503
+ }
504
+ declare class SelfReferenceEditor<T> {
505
+ index: number;
506
+ private editor;
507
+ config: EditorConfig;
508
+ constructor(config: EditorConfig);
509
+ getSelector(): import("@iiif/presentation-3").Selector | import("@iiif/presentation-3").Selector[] | null;
510
+ updateReference(reference: Reference | SpecificResource): void;
511
+ moveToStart(): void;
512
+ moveToEnd(): void;
513
+ moveUpBy(steps: number): void;
514
+ moveDownBy(steps: number): void;
515
+ removeFromParent(): void;
516
+ addAfter(reference: Reference | SpecificResource): void;
517
+ addBefore(reference: Reference | SpecificResource): void;
518
+ }
519
+ declare class ReadonlyProperty<T, Prop> extends BasePropertyEditor<T, Prop> {
520
+ set(): void;
521
+ }
522
+ export interface BehaviorChoice {
523
+ id: string;
524
+ label: InternationalString;
525
+ type: "choice";
526
+ addNone?: boolean;
527
+ items: Array<{
528
+ value: string;
529
+ label: InternationalString;
530
+ }>;
531
+ }
532
+ declare class BehaviorEditor<T> extends BasePropertyEditor<T, string[]> {
533
+ constructor(config: EditorConfig);
534
+ getSupported(): BehaviorChoice[];
535
+ }
536
+ declare class TechnicalEditor<T extends Partial<TechnicalProperties>> extends BaseEditor<T> {
537
+ id: ReadonlyProperty<T, string>;
538
+ type: string;
539
+ mediaType: BasePropertyEditor<T, string>;
540
+ format: BasePropertyEditor<T, string>;
541
+ profile: BasePropertyEditor<T, string>;
542
+ height: BasePropertyEditor<T, number>;
543
+ width: BasePropertyEditor<T, number>;
544
+ duration: BasePropertyEditor<T, number>;
545
+ viewingDirection: BasePropertyEditor<T, ViewingDirection>;
546
+ behavior: BehaviorEditor<T>;
547
+ timeMode: BasePropertyEditor<T, SpecificationTimeMode | string | null>;
548
+ motivation: BasePropertyEditor<T, string | null>;
549
+ constructor(config: EditorConfig);
550
+ }
551
+ declare class LinkingEditor<T extends Partial<LinkingProperties>> extends BaseEditor<T> {
552
+ seeAlso: BaseReferenceListEditor<T, Reference<"ContentResource">>;
553
+ service: BaseReferenceListEditor<T, Service>;
554
+ services: BaseReferenceListEditor<T, Service>;
555
+ rendering: BaseReferenceListEditor<T, Reference<"ContentResource">>;
556
+ partOf: BaseReferenceListEditor<T, Reference<"ContentResource"> | Reference<"Canvas"> | Reference<"AnnotationCollection">>;
557
+ start: BasePropertyEditor<T, Reference<"Canvas"> | null>;
558
+ supplementary: BaseReferenceListEditor<T, Reference<"ContentResource">>;
559
+ homepage: BaseReferenceListEditor<T, Reference<"ContentResource">>;
560
+ logo: BaseReferenceListEditor<T, Reference<"ContentResource">>;
561
+ constructor(config: EditorConfig);
562
+ }
563
+ declare class StructuralEditor<T extends Partial<StructuralProperties<any>>> extends BaseEditor<T> {
564
+ items: BaseReferenceListEditor<T, Reference>;
565
+ annotations: BaseReferenceListEditor<T, Reference<"AnnotationPage">>;
566
+ structures: BaseReferenceListEditor<T, Reference<"Range">>;
567
+ constructor(config: EditorConfig);
568
+ }
569
+ declare class AnnotationTargetEditor extends BasePropertyEditor<AnnotationNormalized, SpecificResource> {
570
+ constructor(config: EditorConfig);
571
+ getSourceId(): any;
572
+ removeSelector(): void;
573
+ getParsedSelector(): import("@iiif/vault-helpers").SupportedSelectors | null;
574
+ setPosition(position: {
575
+ x: number;
576
+ y: number;
577
+ width: number;
578
+ height: number;
579
+ }): void;
580
+ }
581
+ declare class AnnotationBodyEditor extends BaseReferenceListEditor<AnnotationNormalized, Reference<"ContentResource"> | SpecificResource> {
582
+ constructor(config: EditorConfig);
583
+ isSpatial(): boolean;
584
+ hasBody(): boolean;
585
+ getFirst(): SpecificResource | Reference<"ContentResource">;
586
+ getFirstOrNone(): SpecificResource | Reference<"ContentResource"> | undefined;
587
+ }
588
+ declare class AnnotationEditor extends BaseEditor<AnnotationNormalized> {
589
+ target: AnnotationTargetEditor;
590
+ body: AnnotationBodyEditor;
591
+ constructor(config: EditorConfig);
592
+ }
593
+ declare class NavPlaceEditor<T> extends BasePropertyEditor<T, NavPlaceExtension["navPlace"]> {
594
+ constructor(config: EditorConfig);
595
+ }
596
+ declare class ExtensionsEditor<T extends Partial<NavPlaceExtension & TextGranularityExtension>> extends BaseEditor<T> {
597
+ navPlace: NavPlaceEditor<T>;
598
+ textGranularity: BasePropertyEditor<T, TextGranularityExtension["textGranularity"]>;
599
+ constructor(config: EditorConfig);
600
+ }
601
+ declare class EditorInstance<T extends Partial<DescriptiveProperties> & Partial<TechnicalProperties> & Partial<LinkingProperties> & Partial<StructuralProperties<unknown>> & Partial<NavPlaceExtension & TextGranularityExtension>> extends BaseEditor<T> {
602
+ technical: TechnicalEditor<T>;
603
+ descriptive: DescriptiveEditor<T>;
604
+ metadata: MetadataEditor<T>;
605
+ linking: LinkingEditor<T>;
606
+ structural: StructuralEditor<T>;
607
+ annotation: AnnotationEditor;
608
+ extensions: ExtensionsEditor<T>;
609
+ required: (keyof T)[];
610
+ recommended: (keyof T)[];
611
+ notAllowed: string[];
612
+ optional: (keyof T)[];
613
+ allowed: (keyof T)[];
614
+ isMultiple: boolean;
615
+ context?: SelfReferenceEditor<T>;
616
+ observe: TrackerState;
617
+ constructor(_config: {
618
+ vault: Vault;
619
+ reference: Reference;
620
+ } & Partial<EditorConfig>);
621
+ getPartOf(): string | null;
622
+ ref(): Reference;
623
+ validate(): EntityValidationResponse;
624
+ }
625
+ export declare function useEditingStack(): EditingStackActions;
626
+ export declare function useEditingResource(): EditableResource | null;
627
+ export declare function useEditingResourceStack(): EditableResource[];
628
+ export declare function useCreatingResource(): {
629
+ resource: import("@/shell/EditingStack/EditingStack.types").CreatableResource;
630
+ options: any;
631
+ } | null;
632
+ export declare function useManifestEditor(): EditorInstance<Partial<import("@iiif/presentation-3").DescriptiveProperties> & Partial<import("@iiif/presentation-3").TechnicalProperties> & Partial<import("@iiif/presentation-3").LinkingProperties> & Partial<import("@iiif/presentation-3").StructuralProperties<unknown>> & Partial<import("@iiif/presentation-3").NavPlaceExtension & import("@iiif/presentation-3").TextGranularityExtension>>;
633
+ export declare function useCollectionEditor(): EditorInstance<Partial<import("@iiif/presentation-3").DescriptiveProperties> & Partial<import("@iiif/presentation-3").TechnicalProperties> & Partial<import("@iiif/presentation-3").LinkingProperties> & Partial<import("@iiif/presentation-3").StructuralProperties<unknown>> & Partial<import("@iiif/presentation-3").NavPlaceExtension & import("@iiif/presentation-3").TextGranularityExtension>>;
634
+ export declare function useGenericEditor(ref: Reference<any> | SpecificResource | undefined, ctx?: {
635
+ parent?: Reference;
636
+ parentProperty?: string;
637
+ index?: number;
638
+ }): EditorInstance<Partial<import("@iiif/presentation-3").DescriptiveProperties> & Partial<import("@iiif/presentation-3").TechnicalProperties> & Partial<import("@iiif/presentation-3").LinkingProperties> & Partial<import("@iiif/presentation-3").StructuralProperties<unknown>> & Partial<import("@iiif/presentation-3").NavPlaceExtension & import("@iiif/presentation-3").TextGranularityExtension>>;
639
+ export declare function useAnnotationPageEditor(): EditorInstance<Partial<import("@iiif/presentation-3").DescriptiveProperties> & Partial<import("@iiif/presentation-3").TechnicalProperties> & Partial<import("@iiif/presentation-3").LinkingProperties> & Partial<import("@iiif/presentation-3").StructuralProperties<unknown>> & Partial<import("@iiif/presentation-3").NavPlaceExtension & import("@iiif/presentation-3").TextGranularityExtension>>;
640
+ export declare function useEditor(): EditorInstance<Partial<import("@iiif/presentation-3").DescriptiveProperties> & Partial<import("@iiif/presentation-3").TechnicalProperties> & Partial<import("@iiif/presentation-3").LinkingProperties> & Partial<import("@iiif/presentation-3").StructuralProperties<unknown>> & Partial<import("@iiif/presentation-3").NavPlaceExtension & import("@iiif/presentation-3").TextGranularityExtension>>;
641
+ export declare function EditingStack(props: {
642
+ children?: any;
643
+ }): JSX.Element;
644
+ declare class ReferencedResource {
645
+ vault: Vault;
646
+ original: Reference | SpecificResource;
647
+ reference: Reference;
648
+ resource: SpecificResource;
649
+ constructor(reference: Reference | SpecificResource, vault: Vault);
650
+ ref(): Reference;
651
+ specificResource(): SpecificResource;
652
+ optionalSpecificResource(): Reference | {
653
+ source: {
654
+ id: any;
655
+ type: any;
656
+ };
657
+ created?: string | undefined;
658
+ generated?: string | undefined;
659
+ modified?: string | undefined;
660
+ creator?: import("@iiif/presentation-3").Creator | undefined;
661
+ generator?: import("@iiif/presentation-3").Creator | undefined;
662
+ audience?: import("@iiif/presentation-3").Audience | import("@iiif/presentation-3").Audience[] | undefined;
663
+ accessibility?: string | string[] | undefined;
664
+ motivation?: import("@iiif/presentation-3").AnyMotivation | import("@iiif/presentation-3").AnyMotivation[] | undefined;
665
+ rights?: string | string[] | undefined;
666
+ canonical?: string | undefined;
667
+ via?: string | string[] | undefined;
668
+ role?: string | undefined;
669
+ id?: string | undefined;
670
+ type: "SpecificResource";
671
+ state?: import("@iiif/presentation-3").State | import("@iiif/presentation-3").State[] | undefined;
672
+ purpose?: import("@iiif/presentation-3").AnyMotivation | import("@iiif/presentation-3").AnyMotivation[] | undefined;
673
+ selector?: import("@iiif/presentation-3").Selector | import("@iiif/presentation-3").Selector[] | undefined;
674
+ styleClass?: string | undefined;
675
+ renderedVia?: import("@iiif/presentation-3").Agent | import("@iiif/presentation-3").Agent[] | undefined;
676
+ scope?: any;
677
+ };
678
+ get(): any;
679
+ }
680
+ declare class CreatorResource {
681
+ resource: any;
682
+ warnings: string[];
683
+ errors: string[];
684
+ partOf: any;
685
+ references: ReferencedResource[];
686
+ embedded: CreatorResource[];
687
+ vault: Vault;
688
+ specificResource?: SpecificResource;
689
+ constructor(data: any, vault: Vault);
690
+ get(): any;
691
+ ref(): SpecificResource | {
692
+ id: any;
693
+ type: any;
694
+ };
695
+ getAllReferencedResources(): ReferencedResource[];
696
+ getAllEmbeddedResources(): CreatorResource[];
697
+ getVaultResource(): any;
698
+ setPartOf(id: string): void;
699
+ }
700
+ declare class CreatorInstance implements CreatorFunctionContext {
701
+ vault: Vault;
702
+ previewVault: Vault;
703
+ configs: CreatorDefinition[];
704
+ options: CreatorOptions;
705
+ constructor(vault: Vault, options: CreatorOptions, createConfigs: CreatorDefinition[], previewVault: Vault);
706
+ getPreviewVault(): Vault;
707
+ getTarget(): SpecificResource | Reference | undefined;
708
+ getParent(): Reference | undefined;
709
+ getParentResource(): SpecificResource | undefined;
710
+ generateId(type: string, parent?: Reference | ReferencedResource): string;
711
+ ref(idOrRef: string | Reference): ReferencedResource;
712
+ embed(data: any): CreatorResource;
713
+ create(definition: string, payload: any, options?: Partial<CreatorOptions>): Promise<CreatorResource>;
714
+ }
715
+ export interface CreatorContext<T = any> {
716
+ vault: Vault;
717
+ options: CreatorOptions;
718
+ validate: (payload: T) => Promise<boolean> | boolean;
719
+ runCreate: (payload: T) => void;
720
+ }
721
+ export interface CreatorFunctionContext {
722
+ options: CreatorOptions;
723
+ ref(idOrRef: string | Reference): ReferencedResource;
724
+ embed(data: any): CreatorResource;
725
+ create(definition: string, payload: any, options?: Partial<CreatorOptions>): Promise<CreatorResource>;
726
+ generateId(type: string, parent?: Reference | ReferencedResource): string;
727
+ getParent(): Reference | undefined;
728
+ getTarget(): SpecificResource | Reference | undefined;
729
+ getParentResource(): SpecificResource | undefined;
730
+ getPreviewVault(): Vault;
731
+ }
732
+ export interface CreatorParent {
733
+ resource: Reference;
734
+ property: string;
735
+ atIndex?: number;
736
+ }
737
+ export interface CreatorOptions {
738
+ targetType: string;
739
+ target?: Reference;
740
+ parent?: CreatorParent;
741
+ initialData?: any;
742
+ }
743
+ export interface CreatorDefinition {
744
+ id: string;
745
+ label: string;
746
+ summary?: string;
747
+ icon?: any;
748
+ dependencies?: string[];
749
+ create: (payload: any, ctx: CreatorInstance) => any | Promise<any>;
750
+ validate?: (payload: any, vault: Vault) => void | Promise<void>;
751
+ render?: (ctx: CreatorContext) => ReactNode;
752
+ renderCanvas?: (ctx: CreatorContext) => ReactNode | null;
753
+ renderModal?: (ctx: CreatorContext) => ReactNode;
754
+ resourceType: string;
755
+ additionalTypes?: string[];
756
+ resourceFields: string[];
757
+ embeddedResources?: string[];
758
+ staticFields?: Record<string, any>;
759
+ allowModal?: boolean;
760
+ supports: {
761
+ initialData?: boolean;
762
+ parentTypes?: string[];
763
+ parentFields?: string[];
764
+ parentFieldMap?: Record<string, string[]>;
765
+ custom?: (parent: CreatorParent, vault: Vault) => boolean;
766
+ disallowPainting?: boolean;
767
+ };
768
+ sideEffects?: Array<CreatorSideEffect>;
769
+ }
770
+ export interface CreatorSideEffect {
771
+ run?: (result: any, ctx: {
772
+ options: CreatorOptions;
773
+ vault: Vault;
774
+ }) => void | Promise<void>;
775
+ temporal?: boolean;
776
+ spatial?: boolean;
777
+ replaceSiblings?: boolean;
778
+ canvasInteraction?: boolean;
779
+ }
780
+ export interface LayoutProviderProps {
781
+ loading?: true;
782
+ leftPanels: Array<LayoutPanel>;
783
+ rightPanels: Array<LayoutPanel>;
784
+ centerPanels: Array<LayoutPanel>;
785
+ }
786
+ export interface LayoutContext extends LayoutProviderProps {
787
+ state: LayoutState;
788
+ actions: LayoutActions;
789
+ }
790
+ export interface LayoutState {
791
+ leftPanel: PanelState;
792
+ centerPanel: PanelState;
793
+ rightPanel: PanelState;
794
+ pinnedRightPanel: PinnablePanelState;
795
+ }
796
+ export interface LayoutActions {
797
+ setAvailable(panels: LayoutProviderProps): void;
798
+ stack(id: string, state?: any): void;
799
+ stack(args: {
800
+ id: string;
801
+ state?: any;
802
+ }): void;
803
+ open(id: string, state?: any): void;
804
+ open(args: {
805
+ id: string;
806
+ state?: any;
807
+ stacked?: boolean;
808
+ unique?: boolean;
809
+ }): void;
810
+ change(id: string, state?: any): void;
811
+ change(args: {
812
+ id: string;
813
+ state?: any;
814
+ stacked?: boolean;
815
+ unique?: boolean;
816
+ }): void;
817
+ close(id: string, state?: any): void;
818
+ close(args: {
819
+ id: string;
820
+ state?: any;
821
+ }): void;
822
+ toggle(id: string, state?: any): void;
823
+ toggle(args: {
824
+ id: string;
825
+ state?: any;
826
+ }): void;
827
+ edit(resource: Reference | SpecificResource, context?: Omit<EditableResource, "resource">, options?: {
828
+ reset?: boolean;
829
+ property?: string;
830
+ stacked?: boolean | undefined;
831
+ }): void;
832
+ create(resource: CreatableResource): void;
833
+ leftPanel: PanelActions;
834
+ centerPanel: PanelActions;
835
+ rightPanel: PanelActions;
836
+ pinnedRightPanel: PinnablePanelActions;
837
+ }
838
+ export interface PanelState {
839
+ current: string | null;
840
+ state: any;
841
+ open: boolean;
842
+ minimised: boolean;
843
+ customWidth?: number;
844
+ stack: Array<{
845
+ id: string;
846
+ state: any;
847
+ }>;
848
+ }
849
+ export interface PanelActions {
850
+ change(args: {
851
+ id: string;
852
+ state?: any;
853
+ stacked?: boolean;
854
+ unique?: boolean;
855
+ }): void;
856
+ open(args?: {
857
+ id: string;
858
+ state?: any;
859
+ stacked?: boolean;
860
+ unique?: boolean;
861
+ }): void;
862
+ close(): void;
863
+ toggle(): void;
864
+ minimise(): void;
865
+ maximise(args?: {
866
+ id: string;
867
+ state?: any;
868
+ }): void;
869
+ setCustomWidth(size: number): void;
870
+ resetSize(): void;
871
+ popStack(): void;
872
+ }
873
+ export type PanelActionType = {
874
+ [T in keyof PinnablePanelActions]: {
875
+ type: T;
876
+ panel: keyof LayoutState;
877
+ payload: Parameters<PinnablePanelActions[T]>[0];
878
+ };
879
+ }[keyof PinnablePanelActions];
880
+ export interface PinnablePanelState extends PanelState {
881
+ pinnable: true;
882
+ pinned: boolean;
883
+ }
884
+ export interface PinnablePanelActions extends PanelActions {
885
+ pin(args: {
886
+ id: string;
887
+ state?: any;
888
+ }): void;
889
+ unpin(): void;
890
+ }
891
+ export type LayoutPanelContext = {
892
+ global: {
893
+ currentCanvasId: string | null;
894
+ };
895
+ current: {
896
+ actions: PanelActions;
897
+ state: any;
898
+ };
899
+ actions: LayoutActions;
900
+ state: LayoutState;
901
+ };
902
+ export type LayoutFunction = (state: any, ctx: {
903
+ current: PanelActions;
904
+ vault?: Vault;
905
+ transition?: TransitionStatus;
906
+ } & LayoutContext, app: AppState) => ReactNode;
907
+ export interface LayoutPanel {
908
+ id: string;
909
+ label: string;
910
+ icon?: null | string | ReactNode;
911
+ render: LayoutFunction;
912
+ onMount?: (state: any, ctx: {
913
+ current: PanelActions;
914
+ vault?: Vault;
915
+ } & LayoutContext, app: AppState) => (() => void) | void;
916
+ defaultState?: any;
917
+ requiresState?: boolean;
918
+ backAction?: (state: any, ctx: {
919
+ current: PanelActions;
920
+ } & LayoutContext, app: AppState) => void;
921
+ renderBackAction?: (options: {
922
+ backAction: (e?: React.MouseEvent) => void;
923
+ fallback: any;
924
+ }) => ReactNode | null;
925
+ renderCloseAction?: (options: {
926
+ closeAction: () => void;
927
+ fallback: any;
928
+ }) => ReactNode | null;
929
+ options?: {
930
+ minWidth?: number;
931
+ maxWidth?: number;
932
+ hideHeader?: boolean;
933
+ pinnable?: boolean;
934
+ openPinned?: boolean;
935
+ tabs?: boolean;
936
+ };
937
+ }
938
+ export type MenuPositions = "left" | "right" | "bottom" | "top";
939
+ export interface PinnedLayoutPanel<T = any> extends LayoutPanel {
940
+ pinned: true;
941
+ state: T;
942
+ }
943
+ export interface EditorDefinition {
944
+ id: string;
945
+ label: string;
946
+ tabs?: {
947
+ showTitle?: boolean;
948
+ hide?: boolean;
949
+ };
950
+ supports: {
951
+ properties: string[];
952
+ readOnlyProperties?: string[];
953
+ resourceTypes: string[];
954
+ sortKey?: string;
955
+ sortFallback?: boolean;
956
+ read?: boolean;
957
+ edit?: boolean;
958
+ customLocking?: boolean;
959
+ target?: boolean;
960
+ multi?: boolean;
961
+ custom?: (resource: EditableResource, vault: Vault) => boolean;
962
+ };
963
+ component: () => ReactNode;
964
+ }
965
+ export interface ResourceDefinition {
966
+ id: string;
967
+ label: string;
968
+ resourceType: string;
969
+ auto: boolean;
970
+ editors: EditorDefinition[];
971
+ }
972
+ export interface LayoutProps {
973
+ className?: string;
974
+ hideHeader?: boolean;
975
+ isProject?: boolean;
976
+ provider?: React.FC;
977
+ leftPanels: Array<LayoutPanel>;
978
+ rightPanels: Array<LayoutPanel>;
979
+ centerPanels: Array<LayoutPanel>;
980
+ footer?: ReactNode;
981
+ menu?: ReactNode;
982
+ header?: ReactNode;
983
+ onClickLogo?: (e: React.MouseEvent) => void;
984
+ leftPanelMenu?: ReactNode;
985
+ centerPanelMenu?: ReactNode;
986
+ rightPanelMenu?: ReactNode;
987
+ leftPanelMenuPosition?: MenuPositions;
988
+ centerPanelMenuPosition?: MenuPositions;
989
+ rightPanelMenuPosition?: MenuPositions;
990
+ editors?: EditorDefinition[];
991
+ resources?: (string | ResourceDefinition)[];
992
+ creators?: CreatorDefinition[];
993
+ miniEditor?: {
994
+ resource?: EditableResource;
995
+ };
996
+ }
997
+ export declare const Layout: import("react").NamedExoticComponent<LayoutProps>;
998
+ export declare const HandleContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
999
+ export declare const HandleControls: import("react").ForwardRefExoticComponent<{
1000
+ dir: "left" | "right";
1001
+ open: boolean;
1002
+ actions: PanelActions;
1003
+ transition?: TransitionStatus | undefined;
1004
+ reset?: (() => void) | undefined;
1005
+ } & import("react").RefAttributes<HTMLDivElement>>;
1006
+ export interface ModularPanelProps {
1007
+ panel?: LayoutPanel;
1008
+ isLeft?: boolean;
1009
+ state: PinnablePanelState | PanelState;
1010
+ actions: PanelActions;
1011
+ pinActions?: PinnablePanelActions;
1012
+ transition?: TransitionStatus;
1013
+ close?: () => void;
1014
+ available?: LayoutPanel[];
1015
+ style?: any;
1016
+ }
1017
+ export declare function useSetCustomTitle(): (title: string) => void;
1018
+ export declare const ModularPanelHeader: import("styled-components").StyledComponent<"div", any, {
1019
+ $tabs?: boolean | undefined;
1020
+ $error?: boolean | undefined;
1021
+ }, never>;
1022
+ export declare const ModulePanelButton: import("styled-components").StyledComponent<"button", any, {}, never>;
1023
+ export declare function ModularPanel({ panel, state, actions, isLeft, pinActions, transition, close, available, style, }: ModularPanelProps): JSX.Element | null;
1024
+ export declare function PanelError(props: {
1025
+ error: Error;
1026
+ resetErrorBoundary: () => void;
1027
+ }): JSX.Element;
1028
+ export declare const layoutReducer: (state: LayoutState, args_0: PanelActionType) => LayoutState;
1029
+ export declare function getDefaultPanelState(): PanelState;
1030
+ export declare function getDefaultLayoutState(): LayoutState;
1031
+ export declare function usePanelActions(panel: keyof LayoutState, dispatch: Dispatch<PanelActionType>): PanelActions | PinnablePanelActions;
1032
+ export declare const LayoutPropsReactContext: import("react").Context<LayoutProviderProps & {
1033
+ loading?: true | undefined;
1034
+ }>;
1035
+ export declare const LayoutActionsReactContext: import("react").Context<LayoutActions>;
1036
+ export declare const LayoutStateReactContext: import("react").Context<LayoutState>;
1037
+ export declare function useLayoutState(): LayoutState;
1038
+ export declare function useLayoutActions(): LayoutActions;
1039
+ export declare function useAvailableLayouts(): LayoutProviderProps & {
1040
+ loading?: true | undefined;
1041
+ };
1042
+ export declare function useLayoutProvider(): LayoutProviderProps & {
1043
+ loading?: true;
1044
+ actions: LayoutActions;
1045
+ state: LayoutState;
1046
+ };
1047
+ export declare function isPinnableState(t: unknown): t is PinnablePanelState;
1048
+ export declare function panelSizing({ initial, fallback, options, }: {
1049
+ initial?: number;
1050
+ fallback: number;
1051
+ options?: {
1052
+ minWidth?: number;
1053
+ maxWidth?: number;
1054
+ };
1055
+ }): number;
1056
+ export declare function renderHelper(htmlOrReact: string | ReactNode): ReactNode;
1057
+ export declare const ProjectReactContext: import("react").Context<ProjectContext | null>;
1058
+ export declare const ProjectLoadingReactContext: import("react").Context<{
1059
+ isLoading: boolean;
1060
+ isError: boolean;
1061
+ error?: string | undefined;
1062
+ }>;
1063
+ export declare function useProjectLoading(): {
1064
+ isLoading: boolean;
1065
+ isError: boolean;
1066
+ error?: string | undefined;
1067
+ };
1068
+ export declare function useProjectContext(): ProjectContext;
1069
+ export declare function useCurrentProject(): EditorProject;
1070
+ export declare function useProjectActionsWithBackend(dispatch: Dispatch<ProjectActionsType>, backend: ProjectBackend, storage: ProjectStorage<any>): {
1071
+ createProject: (payload: EditorProject) => Promise<void>;
1072
+ deleteProject: (payload: string) => void;
1073
+ switchProject: (payload: string) => void;
1074
+ deselectProject: (payload: string) => void;
1075
+ forkProject: (payload: {
1076
+ id: string;
1077
+ name: string;
1078
+ filename?: string;
1079
+ }) => void;
1080
+ saveProject: (project: EditorProject) => void;
1081
+ setLoadingStatus: (payload: ProjectsLoadingStatus) => void;
1082
+ load: (payload: ProjectState) => void;
1083
+ updateDetails: (payload: {
1084
+ name: string;
1085
+ filename?: string;
1086
+ }) => void;
1087
+ createPublication: (payload: Publication) => void;
1088
+ updatePublication: (payload: Publication) => void;
1089
+ removePublication: (payload: string) => void;
1090
+ updateSettings: (payload: EditorProject["settings"]) => void;
1091
+ updateThumbnail: (payload: string) => void;
1092
+ updateStorage: (payload: Storage) => void;
1093
+ setPreview: (publication: Preview) => void;
1094
+ removePreview: (id: string) => void;
1095
+ };
1096
+ export declare function useProjectBackend({ actions, current }: ProjectContext, backend: ProjectBackend): void;
1097
+ export declare function useProjectLoader<T extends Storage = any>({ actions, current }: ProjectContext, storage: ProjectStorage<T>): {
1098
+ vault: import("@iiif/vault/*").Vault | null;
1099
+ ready: boolean;
1100
+ error: string;
1101
+ };
1102
+ export declare function useProjectCreators(): {
1103
+ createProjectFromManifestJson: (json: string) => Promise<void>;
1104
+ createProjectFromManifestId: (id: string) => Promise<void>;
1105
+ createProjectFromCollectionId: (id: string) => Promise<void>;
1106
+ createBlankManifest: () => void;
1107
+ };
1108
+ export declare function projectFromCollection(collection: Collection, details?: Partial<EditorProject>): EditorProject;
1109
+ export declare function projectFromManifest(manifest: Manifest, details?: Partial<EditorProject>): EditorProject;
1110
+ export declare function ensureUniqueFilename(project: EditorProject, existing: EditorProject[]): void;
1111
+ export declare class LocalStorageBackend implements ProjectBackend {
1112
+ namespace: string;
1113
+ saveInterval: number;
1114
+ storage: LocalForage;
1115
+ constructor(settings?: {
1116
+ namespace?: string;
1117
+ });
1118
+ deleteProject(id: string): Promise<void>;
1119
+ createProject(project: EditorProject): Promise<void>;
1120
+ canDelete(): boolean;
1121
+ getAllProjects(): Promise<EditorProject[]>;
1122
+ getLastProject(): Promise<string | null>;
1123
+ setLastProject(id: string): Promise<void>;
1124
+ updateProject(project: EditorProject): Promise<void>;
1125
+ private saveProjectIndex;
1126
+ private getProjectIndex;
1127
+ }
1128
+ export declare abstract class AbstractVaultLoader<T extends Storage> implements ProjectStorage<ManifestStorage | CollectionStorage, Manifest | Collection, T> {
1129
+ abstract type: string;
1130
+ vaults: Record<string, Vault | null>;
1131
+ saveInterval: number;
1132
+ protected constructor(config?: Partial<{
1133
+ saveInterval: number;
1134
+ }>);
1135
+ shouldUpdateWithVault(): boolean;
1136
+ canCreate(): boolean;
1137
+ canDelete(): boolean;
1138
+ abstract create(project: EditorProject, data: Manifest | Collection): Promise<T>;
1139
+ createVaultInstance(project: EditorProject): [
1140
+ Vault,
1141
+ Promise<void>
1142
+ ];
1143
+ closeVaultInstance(project: EditorProject, vault: Vault): void;
1144
+ saveStorage(storage: T): Promise<void>;
1145
+ abstract getStorage(storage: T): Promise<CollectionStorage | ManifestStorage | null>;
1146
+ abstract saveStorageData(manifest: CollectionStorage | ManifestStorage, storage: T): void | Promise<void>;
1147
+ abstract deleteStorage(storage: T): Promise<void>;
1148
+ abstract getBackendStorage(project: EditorProject): T;
1149
+ }
1150
+ export declare class WebsocketLoader extends AbstractVaultLoader<RemoteWebsocketStorage> {
1151
+ type: string;
1152
+ baseUrl: string;
1153
+ token: string;
1154
+ constructor(settings: {
1155
+ baseUrl: string;
1156
+ token: string;
1157
+ });
1158
+ getStorage(storage: RemoteWebsocketStorage): Promise<CollectionStorage | ManifestStorage | null>;
1159
+ shouldUpdateWithVault(): boolean;
1160
+ create(project: EditorProject, data: Manifest | Collection): Promise<RemoteWebsocketStorage>;
1161
+ canCreate(): boolean;
1162
+ canDelete(): boolean;
1163
+ createVaultInstance(project: EditorProject): [
1164
+ Vault,
1165
+ Promise<void>
1166
+ ];
1167
+ closeVaultInstance(project: EditorProject, vault: Vault): void;
1168
+ saveStorageData(manifestStorage: ManifestStorage | CollectionStorage, storage: RemoteWebsocketStorage): Promise<void>;
1169
+ deleteStorage(storage: RemoteWebsocketStorage): Promise<void>;
1170
+ getBackendStorage(project: EditorProject): RemoteWebsocketStorage;
1171
+ }
1172
+ export declare class LocalStorageLoader extends AbstractVaultLoader<ResourceKeyedStorage> {
1173
+ type: string;
1174
+ namespace: string;
1175
+ storage: LocalForage;
1176
+ vaults: Record<string, Vault | null>;
1177
+ constructor(settings?: {
1178
+ namespace?: string;
1179
+ });
1180
+ shouldUpdateWithVault(): boolean;
1181
+ create(project: EditorProject, data: Manifest | Collection): Promise<ResourceKeyedStorage>;
1182
+ getStorage(storage: ResourceKeyedStorage): Promise<CollectionStorage | ManifestStorage | null>;
1183
+ saveStorageData(manifestStorage: ManifestStorage | CollectionStorage, storage: ResourceKeyedStorage): Promise<void>;
1184
+ deleteStorage(storage: ResourceKeyedStorage): Promise<void>;
1185
+ getBackendStorage(project: EditorProject): ResourceKeyedStorage;
1186
+ }
1187
+ export declare const PreviewProvider: import("react").NamedExoticComponent<{
1188
+ children: ReactNode;
1189
+ configs: PreviewConfiguration[];
1190
+ }>;
1191
+ export declare function usePreviewContext(): PreviewContext;
1192
+ export declare function usePreviewVault(): Vault;
1193
+ export declare const HOMEPAGE_COLLECTION = "manifest-editor://homepage-collection.json";
1194
+ export declare function usePreviewHistory(): {
1195
+ addHistory: (id: string, type: string) => void;
1196
+ clearHistory: () => void;
1197
+ };
1198
+ export declare function PreviewVaultContext(props: {
1199
+ children: any;
1200
+ }): JSX.Element;
1201
+ export declare function PreviewVaultBoundary({ children }: {
1202
+ children: any;
1203
+ }): JSX.Element;
1204
+ export declare function createPreviewVault(homepageCollectionId?: string): {
1205
+ readonly vault: Vault;
1206
+ readonly unsubscribe: () => void;
1207
+ readonly addHistory: (id: string, type: string) => void;
1208
+ readonly clearHistory: () => void;
1209
+ };
1210
+ export interface ResourceEditingContext {
1211
+ resource: Reference<any> | null;
1212
+ }
1213
+ export declare function useEditingContext(): ResourceEditingContext;
1214
+ /**
1215
+ * useResource
1216
+ *
1217
+ * Only use this if you KNOW that there is a resource (e.g. in a panel)
1218
+ */
1219
+ export declare function useResource<T = Record<string, never>>(): T & Reference<any>;
1220
+ /**
1221
+ * useOptionalResource
1222
+ *
1223
+ * Use in components where you don't know if something is editing. (e.g. canvas listing)
1224
+ */
1225
+ export declare function useOptionalResource(): Reference<any> | null;
1226
+ export declare function ResourceEditingProvider({ resource, children, }: {
1227
+ resource: {
1228
+ id: string;
1229
+ type: string;
1230
+ } | null | undefined;
1231
+ children: ReactNode;
1232
+ }): JSX.Element;
1233
+ export interface ProjectProviderProps {
1234
+ children: ReactNode;
1235
+ defaultApp?: string;
1236
+ storage?: AbstractVaultLoader<any>;
1237
+ backend?: ProjectBackend;
1238
+ initialState?: () => ProjectState;
1239
+ }
1240
+ export declare const ShellProvider: ({ config, children, theme, saveCurrentApp, apps, initialApp, project, }: {
1241
+ config?: Partial<Config> | undefined;
1242
+ children: ReactNode;
1243
+ theme?: any;
1244
+ saveCurrentApp?: boolean | undefined;
1245
+ apps: AppDefinition;
1246
+ initialApp?: {
1247
+ id: string;
1248
+ args?: any;
1249
+ } | undefined;
1250
+ project?: Partial<ProjectProviderProps> | undefined;
1251
+ }) => JSX.Element;
1252
+ export interface Task<Req = any, Res = any> {
1253
+ name: string;
1254
+ status: "idle" | "running" | "complete" | "error";
1255
+ emitter: Emitter<any>;
1256
+ promise: Promise<any>;
1257
+ abort: AbortController;
1258
+ resolve: (value?: any) => void;
1259
+ reject: (reason?: any) => void;
1260
+ error?: string;
1261
+ request?: Req;
1262
+ response?: Res;
1263
+ }
1264
+ export declare function useTask(name: string): Task<any, any>;
1265
+ export declare function useTaskEvent<Req = any, Res = any>(task: Task<Req, Res>, name: string, _cb: (task: Task<Req, Res>) => any): void;
1266
+ export declare function useTaskDispatch<Req = any, Res = any>(name: string, onComplete?: (task: Task<Req, Res>) => void | Promise<void>): readonly [
1267
+ (request?: any) => void,
1268
+ Task<any, any>
1269
+ ];
1270
+ export declare function useTaskRunner<Req = any, Res = any>(name: string, onRun: (task: Task<Req, Res>) => void | Promise<void>): readonly [
1271
+ (response?: any) => void,
1272
+ Task<any, any>,
1273
+ (reason?: any, error?: any) => void
1274
+ ];
1275
+ export declare function TaskBridge({ children }: {
1276
+ children?: ReactNode;
1277
+ }): JSX.Element;
1278
+ export interface UniversalCopyPasteProps<T> {
1279
+ as?: keyof JSX.IntrinsicElements | React.ComponentType<T>;
1280
+ children?: ReactNode;
1281
+ reference?: Reference;
1282
+ onReference?: (reference: Reference) => void;
1283
+ onPasteReference?: (reference: Reference) => void;
1284
+ onDropReference?: (reference: Reference, e: DragEvent) => void;
1285
+ onLink?: (link: string) => void;
1286
+ onPasteLink?: (link: string) => void;
1287
+ onDropLink?: (link: string) => void;
1288
+ onAnalysis?: (analysisResults: any) => void;
1289
+ onPasteAnalysis?: (analysisResults: any) => void;
1290
+ onDropAnalysis?: (analysisResults: any) => void;
1291
+ onLoading?: () => void;
1292
+ onComplete?: () => void;
1293
+ }
1294
+ export declare function UniversalCopyTarget<T>({ as, reference: _ref, onReference, onLink, onAnalysis, onDropReference: _onDropReference, onDropLink: _onDropLink, onDropAnalysis: _onDropAnalysis, onPasteReference: _onPasteReference, onPasteLink: _onPasteLink, onPasteAnalysis: _onPasteAnalysis, ...props }: Partial<HTMLAttributes<HTMLElement>> & UniversalCopyPasteProps<T> & T): JSX.Element;
1295
+ export declare namespace JSX {
1296
+ interface IntrinsicElements {
1297
+ "canvas-panel": any;
1298
+ }
1299
+ }
1300
+
1301
+ export {};