@manifest-editor/shell 1.0.0 → 1.0.4

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.
@@ -0,0 +1,817 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as react from 'react';
3
+ import { ReactNode, SetStateAction, Dispatch, HTMLAttributes } from 'react';
4
+ import { Vault } from '@iiif/helpers/vault';
5
+ import { TransitionStatus } from 'react-transition-group';
6
+ import * as _iiif_presentation_3 from '@iiif/presentation-3';
7
+ import { Reference, SpecificResource, Collection } from '@iiif/presentation-3';
8
+ import { CreatorDefinition as CreatorDefinition$1, Creator } from '@manifest-editor/creator-api';
9
+ import { Vault as Vault$1 } from '@iiif/helpers';
10
+ import { EditorInstance } from '@manifest-editor/editor-api';
11
+ import * as styled_components from 'styled-components';
12
+ import * as styled_components_dist_types from 'styled-components/dist/types';
13
+ import { Emitter } from 'mitt';
14
+ import { ManifestNormalized } from '@iiif/presentation-3-normalized';
15
+ import * as zustand from 'zustand';
16
+
17
+ interface EditableResource {
18
+ parent?: Reference;
19
+ property?: string;
20
+ index?: number;
21
+ resource: SpecificResource;
22
+ onlyReference?: boolean;
23
+ }
24
+ interface CreatableResource {
25
+ type: string;
26
+ parent?: Reference;
27
+ property?: string;
28
+ index?: number;
29
+ onlyReference?: boolean;
30
+ target?: Reference;
31
+ initialData?: any;
32
+ isPainting?: boolean;
33
+ }
34
+ interface EditingStackState {
35
+ current: EditableResource | null;
36
+ stack: Array<EditableResource>;
37
+ create: {
38
+ resource: CreatableResource;
39
+ options: any;
40
+ } | null;
41
+ }
42
+ interface EditingStackActions {
43
+ edit(resource: EditableResource | null, reset?: boolean): void;
44
+ updateCurrent(resource: Partial<EditableResource>): void;
45
+ close(): void;
46
+ back(): void;
47
+ create(resource: CreatableResource, options?: any): () => void;
48
+ }
49
+ type EditingStackActionCreators = {
50
+ type: "edit";
51
+ payload: {
52
+ resource: EditableResource | null;
53
+ reset?: boolean;
54
+ };
55
+ } | {
56
+ type: "updateCurrent";
57
+ payload: {
58
+ resource: EditableResource;
59
+ };
60
+ } | {
61
+ type: "syncRemoval";
62
+ payload: {
63
+ resource: EditableResource;
64
+ };
65
+ } | {
66
+ type: "back";
67
+ } | {
68
+ type: "create";
69
+ payload: {
70
+ resource: CreatableResource | null;
71
+ options?: any;
72
+ };
73
+ } | {
74
+ type: "close";
75
+ };
76
+
77
+ interface Preview {
78
+ id: string;
79
+ type: string;
80
+ data: any;
81
+ }
82
+ type PreviewContext = PreviewState & {
83
+ handlers: Array<PreviewHandler>;
84
+ actions: PreviewActions;
85
+ configs: Array<PreviewConfiguration>;
86
+ };
87
+ interface PreviewState {
88
+ selected: string | null;
89
+ active: string[];
90
+ }
91
+ interface PreviewActions {
92
+ activatePreview(id: string): void;
93
+ updatePreviews(): void;
94
+ selectPreview(id: string): void;
95
+ deletePreview(id: string): void;
96
+ focusPreview(id: string): void;
97
+ getPreviewLink(): Promise<string | null>;
98
+ }
99
+ type PreviewActionsType = {
100
+ [T in keyof PreviewActions]: {
101
+ type: T;
102
+ payload: Parameters<PreviewActions[T]>[0];
103
+ };
104
+ }[keyof PreviewActions];
105
+ interface PreviewConfiguration<Config = any> {
106
+ id: string;
107
+ type: string;
108
+ label: string;
109
+ config: Config;
110
+ }
111
+ interface PreviewHandler {
112
+ id: string;
113
+ label: string;
114
+ type: string;
115
+ focusable: boolean;
116
+ getRequires(): string[];
117
+ getProvides(): string[];
118
+ isPreviewValid(instanceId: string, instance: Preview): boolean | Promise<boolean>;
119
+ createPreview(instanceId: string, resource: {
120
+ id: string;
121
+ type: string;
122
+ }, vault: Vault, ctx: any): Promise<Preview>;
123
+ focus(instanceId: string): Promise<void>;
124
+ updatePreview(instanceId: string, resource: {
125
+ id: string;
126
+ type: string;
127
+ }, vault: Vault, ctx: any): Promise<Preview | null>;
128
+ deletePreview(id: string): Promise<void>;
129
+ }
130
+
131
+ interface Config {
132
+ previews: PreviewConfiguration[];
133
+ behaviorPresets: string[];
134
+ newTemplates: Collection | null;
135
+ defaultPreview: string | null;
136
+ editorConfig: {
137
+ All?: EditorConfig;
138
+ Manifest?: EditorConfig;
139
+ Canvas?: EditorConfig;
140
+ Annotation?: EditorConfig;
141
+ AnnotationPage?: EditorConfig;
142
+ AnnotationCollection?: EditorConfig;
143
+ Range?: EditorConfig;
144
+ Collection?: EditorConfig;
145
+ ContentResource?: EditorConfig;
146
+ };
147
+ editorFeatureFlags: {
148
+ enableMultiImageCanvases?: boolean;
149
+ enableMultiMediaCanvases?: boolean;
150
+ };
151
+ i18n: {
152
+ defaultLanguage: string;
153
+ availableLanguages: string[];
154
+ advancedLanguageMode: boolean;
155
+ };
156
+ export: {
157
+ baseIdentifier: string | null;
158
+ version: 3 | 2;
159
+ };
160
+ uploadBackends: Array<UploadBackendConfig>;
161
+ }
162
+ interface EditorConfig {
163
+ singleTab?: string;
164
+ fields?: string[];
165
+ hideTabs?: string[];
166
+ onlyTabs?: string[];
167
+ }
168
+ interface UploadBackendConfig {
169
+ id: string;
170
+ label: string;
171
+ resourceTypes: string[];
172
+ canUpload?: () => Promise<boolean>;
173
+ upload: (resource: File) => Promise<{
174
+ id: string;
175
+ type: string;
176
+ }> | null;
177
+ }
178
+ declare function useConfig(): Config;
179
+ declare function useSaveConfig(): (config: Partial<Config>) => void;
180
+ declare function ConfigProvider({ children, config, saveConfig, }: {
181
+ children: ReactNode;
182
+ config?: Partial<Config>;
183
+ saveConfig?: (config: Partial<Config>) => void;
184
+ }): react_jsx_runtime.JSX.Element;
185
+
186
+ type CreatorDefinition = any;
187
+ interface LayoutProviderProps {
188
+ loading?: true;
189
+ leftPanels: Array<LayoutPanel>;
190
+ rightPanels: Array<LayoutPanel>;
191
+ centerPanels: Array<LayoutPanel>;
192
+ modals?: Array<LayoutPanel>;
193
+ }
194
+ interface LayoutContext extends LayoutProviderProps {
195
+ state: LayoutState;
196
+ actions: LayoutActions;
197
+ }
198
+ interface LayoutState {
199
+ leftPanel: PanelState;
200
+ centerPanel: PanelState;
201
+ rightPanel: PanelState;
202
+ pinnedRightPanel: PinnablePanelState;
203
+ modal: PanelState;
204
+ }
205
+ interface LayoutActions {
206
+ stack(id: string, state?: any): void;
207
+ stack(args: {
208
+ id: string;
209
+ state?: any;
210
+ }): void;
211
+ open(id: string, state?: any): void;
212
+ open(args: {
213
+ id: string;
214
+ state?: any;
215
+ stacked?: boolean;
216
+ unique?: boolean;
217
+ }): void;
218
+ change(id: string, state?: any): void;
219
+ change(args: {
220
+ id: string;
221
+ state?: any;
222
+ stacked?: boolean;
223
+ unique?: boolean;
224
+ }): void;
225
+ close(id: string, state?: any): void;
226
+ close(args: {
227
+ id: string;
228
+ state?: any;
229
+ }): void;
230
+ toggle(id: string, state?: any): void;
231
+ toggle(args: {
232
+ id: string;
233
+ state?: any;
234
+ }): void;
235
+ edit(resource: Reference | SpecificResource, context?: Omit<EditableResource, "resource">, options?: {
236
+ reset?: boolean;
237
+ property?: string;
238
+ stacked?: boolean | undefined;
239
+ selectedTab?: string;
240
+ }): void;
241
+ create(resource: CreatableResource): void;
242
+ leftPanel: PanelActions;
243
+ centerPanel: PanelActions;
244
+ rightPanel: PanelActions;
245
+ pinnedRightPanel: PinnablePanelActions;
246
+ modal: PanelActions;
247
+ }
248
+ interface PanelState {
249
+ current: string | null;
250
+ state: any;
251
+ open: boolean;
252
+ minimised: boolean;
253
+ customWidth?: number;
254
+ stack: Array<{
255
+ id: string;
256
+ state: any;
257
+ }>;
258
+ }
259
+ interface PanelActions {
260
+ change(args: {
261
+ id: string;
262
+ state?: any;
263
+ stacked?: boolean;
264
+ unique?: boolean;
265
+ }): void;
266
+ open(args?: {
267
+ id: string;
268
+ state?: any;
269
+ stacked?: boolean;
270
+ unique?: boolean;
271
+ }): void;
272
+ close(): void;
273
+ toggle(): void;
274
+ minimise(): void;
275
+ maximise(args?: {
276
+ id: string;
277
+ state?: any;
278
+ }): void;
279
+ setCustomWidth(size: number): void;
280
+ resetSize(): void;
281
+ popStack(): void;
282
+ }
283
+ type PanelActionType = {
284
+ [T in keyof PinnablePanelActions]: {
285
+ type: T;
286
+ panel: keyof LayoutState;
287
+ payload: Parameters<PinnablePanelActions[T]>[0];
288
+ };
289
+ }[keyof PinnablePanelActions];
290
+ interface PinnablePanelState extends PanelState {
291
+ pinnable: true;
292
+ pinned: boolean;
293
+ }
294
+ interface PinnablePanelActions extends PanelActions {
295
+ pin(args: {
296
+ id: string;
297
+ state?: any;
298
+ }): void;
299
+ unpin(): void;
300
+ }
301
+ type LayoutPanelContext = {
302
+ global: {
303
+ currentCanvasId: string | null;
304
+ };
305
+ current: {
306
+ actions: PanelActions;
307
+ state: any;
308
+ };
309
+ actions: LayoutActions;
310
+ state: LayoutState;
311
+ };
312
+ type LayoutFunction = (state: any, ctx: {
313
+ current: PanelActions;
314
+ vault?: Vault;
315
+ transition?: TransitionStatus;
316
+ } & LayoutContext, app: AppState) => ReactNode;
317
+ interface LayoutPanel {
318
+ id: string;
319
+ label: string;
320
+ divide?: boolean;
321
+ icon?: null | string | ReactNode;
322
+ render: LayoutFunction;
323
+ onMount?: (state: any, ctx: {
324
+ current: PanelActions;
325
+ vault?: Vault;
326
+ } & LayoutContext, app: AppState) => (() => void) | void;
327
+ defaultState?: any;
328
+ requiresState?: boolean;
329
+ backAction?: (state: any, ctx: {
330
+ current: PanelActions;
331
+ } & LayoutContext, app: AppState) => void;
332
+ renderBackAction?: (options: {
333
+ backAction: (e?: React.MouseEvent) => void;
334
+ fallback: any;
335
+ }) => ReactNode | null;
336
+ renderCloseAction?: (options: {
337
+ closeAction: () => void;
338
+ fallback: any;
339
+ }) => ReactNode | null;
340
+ options?: {
341
+ minWidth?: number;
342
+ maxWidth?: number;
343
+ hideHeader?: boolean;
344
+ pinnable?: boolean;
345
+ openPinned?: boolean;
346
+ tabs?: boolean;
347
+ };
348
+ }
349
+ type MenuPositions = "left" | "right" | "bottom" | "top";
350
+ interface PinnedLayoutPanel<T = any> extends LayoutPanel {
351
+ pinned: true;
352
+ state: T;
353
+ }
354
+ interface EditorDefinition {
355
+ id: string;
356
+ label: string;
357
+ tabs?: {
358
+ showTitle?: boolean;
359
+ hide?: boolean;
360
+ };
361
+ supports: {
362
+ properties: string[];
363
+ readOnlyProperties?: string[];
364
+ resourceTypes: string[];
365
+ sortKey?: string;
366
+ sortFallback?: boolean;
367
+ read?: boolean;
368
+ edit?: boolean;
369
+ customLocking?: boolean;
370
+ target?: boolean;
371
+ multi?: boolean;
372
+ custom?: (resource: EditableResource, vault: Vault) => boolean;
373
+ };
374
+ component: (config: EditorConfig) => ReactNode;
375
+ }
376
+ interface ResourceDefinition {
377
+ id: string;
378
+ label: string;
379
+ resourceType: string;
380
+ auto: boolean;
381
+ editors: EditorDefinition[];
382
+ }
383
+ interface LayoutProps$1 {
384
+ isLoading?: boolean;
385
+ className?: string;
386
+ hideHeader?: boolean;
387
+ isProject?: boolean;
388
+ provider?: React.FC;
389
+ leftPanels: Array<LayoutPanel>;
390
+ rightPanels: Array<LayoutPanel>;
391
+ centerPanels: Array<LayoutPanel>;
392
+ modals?: Array<LayoutPanel>;
393
+ footer?: ReactNode;
394
+ menu?: ReactNode;
395
+ header?: ReactNode;
396
+ onClickLogo?: (e: React.MouseEvent) => void;
397
+ leftPanelMenu?: ReactNode;
398
+ centerPanelMenu?: ReactNode;
399
+ rightPanelMenu?: ReactNode;
400
+ leftPanelMenuPosition?: MenuPositions;
401
+ centerPanelMenuPosition?: MenuPositions;
402
+ rightPanelMenuPosition?: MenuPositions;
403
+ editors?: EditorDefinition[];
404
+ resources?: (string | ResourceDefinition)[];
405
+ creators?: CreatorDefinition[];
406
+ }
407
+
408
+ type AppContext = {
409
+ instanceId: string;
410
+ appId: string;
411
+ args?: any;
412
+ };
413
+ type LoadedApp = Partial<LayoutProps$1> & {
414
+ default: {
415
+ id: string;
416
+ title: string;
417
+ type?: "manifest" | "launcher";
418
+ project?: boolean;
419
+ projectType?: "Manifest" | "Collection";
420
+ dev?: boolean;
421
+ desktop?: boolean;
422
+ web?: boolean;
423
+ drafts?: boolean;
424
+ };
425
+ };
426
+ type MappedApp$1 = {
427
+ metadata: LoadedApp["default"];
428
+ layout: LayoutProps$1;
429
+ };
430
+ type AppState = {
431
+ state: null | any;
432
+ setState: SetStateAction<any>;
433
+ };
434
+ declare const PrimeAppReactContext: react.Context<MappedApp$1 | null>;
435
+ declare function useAppInstance(): AppContext;
436
+ declare function useApp(): MappedApp$1;
437
+ declare function useAppState<S = any>(): {
438
+ state: any;
439
+ setState: any;
440
+ };
441
+ declare function AppProvider({ instanceId, appId, args, definition, children, initialState, }: {
442
+ initialState?: any;
443
+ instanceId: string;
444
+ appId: string;
445
+ args?: any;
446
+ definition: MappedApp$1;
447
+ children: ReactNode;
448
+ }): react_jsx_runtime.JSX.Element;
449
+
450
+ type MappedApp = any;
451
+ type MultiAppContext = {
452
+ apps: Record<string, MappedApp>;
453
+ currentApp: {
454
+ id: string;
455
+ args?: any;
456
+ };
457
+ initialApp: {
458
+ id: string;
459
+ args?: any;
460
+ };
461
+ changeApp: (app: {
462
+ id: string;
463
+ args?: any;
464
+ }) => void;
465
+ changeProjectType: (type: "Manifest" | "Collection") => void;
466
+ };
467
+ declare function useApps(): MultiAppContext;
468
+ declare function MultiAppProvider({ apps, initialApp, saveCurrentApp, instanceId, children, config, }: {
469
+ apps: Record<string, MappedApp>;
470
+ initialApp?: MultiAppContext["currentApp"];
471
+ saveCurrentApp?: boolean;
472
+ instanceId: string;
473
+ children: ReactNode;
474
+ config?: {
475
+ defaultApp?: string;
476
+ manifestApp?: string;
477
+ collectionApp?: string;
478
+ };
479
+ }): react_jsx_runtime.JSX.Element | null;
480
+
481
+ interface AppHeaderProps {
482
+ onClickLogo?: () => void;
483
+ }
484
+ declare const AppHeader: react.NamedExoticComponent<AppHeaderProps>;
485
+
486
+ type MenuItem = {
487
+ label: string;
488
+ onClick?: () => void;
489
+ active?: boolean;
490
+ };
491
+ interface AppMenuContext {
492
+ file: {
493
+ new: MenuItem;
494
+ edit: MenuItem;
495
+ open: MenuItem;
496
+ newOptions: MenuItem[];
497
+ openOptions: MenuItem[];
498
+ };
499
+ }
500
+ declare function useAppMenu(): AppMenuContext | null;
501
+ declare function useAppMenuItem<Key extends keyof AppMenuContext, Name extends keyof AppMenuContext[Key], Return extends AppMenuContext[Key][Name]>(menu: Key, name: Name): Return | null;
502
+ declare function AppMenuProvider({ children, menu }: {
503
+ children: React.ReactNode;
504
+ menu: AppMenuContext;
505
+ }): react_jsx_runtime.JSX.Element;
506
+
507
+ interface Resource {
508
+ id: string;
509
+ type: string;
510
+ }
511
+ declare function useAppResourceInstance(): string;
512
+ declare function useAppResource(): Resource;
513
+ declare function AppResourceInstanceProvider({ id, children }: {
514
+ id?: string;
515
+ children: React.ReactNode;
516
+ }): string | number | boolean | Iterable<react.ReactNode> | react_jsx_runtime.JSX.Element | null | undefined;
517
+ declare function AppResourceProvider({ resource, children }: {
518
+ resource?: Resource;
519
+ children: React.ReactNode;
520
+ }): react_jsx_runtime.JSX.Element;
521
+
522
+ declare const baseCreator: LayoutPanel;
523
+
524
+ declare function matchBasedOnResource(resource: CreatableResource, list: CreatorDefinition$1[], options: {
525
+ vault: Vault;
526
+ }): CreatorDefinition$1[];
527
+ declare function useCreator(parent: any, property: string, type: string, target?: Reference, options?: {
528
+ isPainting?: boolean;
529
+ onlyReference?: boolean;
530
+ }): readonly [any, {
531
+ readonly create: (index?: number, initialData?: any) => void;
532
+ readonly edit: (resource: any, index?: number) => void;
533
+ readonly buttonProps: {
534
+ "data-action-id": string;
535
+ };
536
+ }];
537
+ declare function useInlineCreator(): Creator;
538
+
539
+ declare const baseEditor: LayoutPanel;
540
+
541
+ declare function BaseEditorBackButton({ fallback, backAction }: any): any;
542
+ declare function BaseEditorCloseButton({ closeAction, fallback }: any): any;
543
+ declare function editBasedOnResource(resource: EditableResource, list: ResourceDefinition[], options: {
544
+ edit?: boolean;
545
+ vault: Vault$1;
546
+ }, config: EditorConfig): ResourceDefinition | null;
547
+ declare function BaseEditor({ currentTab }: {
548
+ currentTab?: string;
549
+ }): react_jsx_runtime.JSX.Element | null;
550
+
551
+ declare function ConfigEditor(): react_jsx_runtime.JSX.Element;
552
+
553
+ declare function useEditingStack(): EditingStackActions;
554
+ declare function useEditingResource(): EditableResource | null;
555
+ declare function useEditingResourceStack(): EditableResource[];
556
+ declare function useCreatingResource(): {
557
+ resource: CreatableResource;
558
+ options: any;
559
+ } | null;
560
+ declare function useManifestEditor(): EditorInstance<Partial<_iiif_presentation_3.DescriptiveProperties> & Partial<_iiif_presentation_3.TechnicalProperties> & Partial<_iiif_presentation_3.LinkingProperties> & Partial<_iiif_presentation_3.StructuralProperties<unknown>> & Partial<_iiif_presentation_3.NavPlaceExtension & _iiif_presentation_3.TextGranularityExtension>>;
561
+ declare function useCollectionEditor(): EditorInstance<Partial<_iiif_presentation_3.DescriptiveProperties> & Partial<_iiif_presentation_3.TechnicalProperties> & Partial<_iiif_presentation_3.LinkingProperties> & Partial<_iiif_presentation_3.StructuralProperties<unknown>> & Partial<_iiif_presentation_3.NavPlaceExtension & _iiif_presentation_3.TextGranularityExtension>>;
562
+ declare function useGenericEditor(ref: Reference<any> | SpecificResource | undefined, ctx?: {
563
+ parent?: Reference;
564
+ parentProperty?: string;
565
+ index?: number;
566
+ }): EditorInstance<Partial<_iiif_presentation_3.DescriptiveProperties> & Partial<_iiif_presentation_3.TechnicalProperties> & Partial<_iiif_presentation_3.LinkingProperties> & Partial<_iiif_presentation_3.StructuralProperties<unknown>> & Partial<_iiif_presentation_3.NavPlaceExtension & _iiif_presentation_3.TextGranularityExtension>>;
567
+ declare function useAnnotationPageEditor(): EditorInstance<Partial<_iiif_presentation_3.DescriptiveProperties> & Partial<_iiif_presentation_3.TechnicalProperties> & Partial<_iiif_presentation_3.LinkingProperties> & Partial<_iiif_presentation_3.StructuralProperties<unknown>> & Partial<_iiif_presentation_3.NavPlaceExtension & _iiif_presentation_3.TextGranularityExtension>>;
568
+ declare function useEditor(): EditorInstance<Partial<_iiif_presentation_3.DescriptiveProperties> & Partial<_iiif_presentation_3.TechnicalProperties> & Partial<_iiif_presentation_3.LinkingProperties> & Partial<_iiif_presentation_3.StructuralProperties<unknown>> & Partial<_iiif_presentation_3.NavPlaceExtension & _iiif_presentation_3.TextGranularityExtension>>;
569
+ declare function EditingStack(props: {
570
+ children?: any;
571
+ editing?: {
572
+ id: string;
573
+ type: string;
574
+ };
575
+ }): react_jsx_runtime.JSX.Element;
576
+
577
+ interface ExportPanelProps {
578
+ initialVersion?: 2 | 3;
579
+ versions?: Array<2 | 3>;
580
+ }
581
+ declare function ExportPanel(props: ExportPanelProps): react_jsx_runtime.JSX.Element;
582
+
583
+ interface LayoutProps {
584
+ header?: React.ReactNode;
585
+ footer?: React.ReactNode;
586
+ menu?: React.ReactNode;
587
+ leftPanelMenu?: React.ReactNode;
588
+ rightPanelMenu?: React.ReactNode;
589
+ centerPanelMenu?: React.ReactNode;
590
+ leftPanelMenuPosition?: "top" | "bottom";
591
+ rightPanelMenuPosition?: "top" | "bottom";
592
+ hideHeader?: boolean;
593
+ isLoading?: boolean;
594
+ className?: string;
595
+ centerPanelMenuPosition?: "top" | "bottom";
596
+ }
597
+ declare const Layout: react.NamedExoticComponent<LayoutProps>;
598
+
599
+ declare const LayoutActionsReactContext: react.Context<LayoutActions>;
600
+ declare const LayoutStateReactContext: react.Context<LayoutState>;
601
+ declare function useLayoutState(): LayoutState;
602
+ declare function useLayoutActions(): LayoutActions;
603
+ declare function useAvailableLayouts(): LayoutProps$1;
604
+ declare function useLayoutProvider(): LayoutProviderProps & {
605
+ loading?: true;
606
+ actions: LayoutActions;
607
+ state: LayoutState;
608
+ };
609
+
610
+ declare function isPinnableState(t: unknown): t is PinnablePanelState;
611
+ declare function panelSizing({ initial, fallback, options, }: {
612
+ initial?: number;
613
+ fallback: number;
614
+ options?: {
615
+ minWidth?: number;
616
+ maxWidth?: number;
617
+ };
618
+ }): number;
619
+ declare function renderHelper(htmlOrReact: string | ReactNode): ReactNode;
620
+
621
+ declare function usePanelActions(panel: keyof LayoutState, dispatch: Dispatch<PanelActionType>): PanelActions | PinnablePanelActions;
622
+
623
+ declare const layoutReducer: (state: LayoutState, args_0: PanelActionType) => LayoutState;
624
+ declare function getDefaultPanelState(): PanelState;
625
+ declare function getDefaultLayoutState(): LayoutState;
626
+
627
+ declare const HandleContainer: styled_components.IStyledComponent<"web", styled_components_dist_types.FastOmit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>;
628
+ declare const HandleControls: react.ForwardRefExoticComponent<{
629
+ dir: "left" | "right";
630
+ open: boolean;
631
+ actions: PanelActions;
632
+ transition?: TransitionStatus | undefined;
633
+ reset?: (() => void) | undefined;
634
+ } & react.RefAttributes<HTMLDivElement>>;
635
+
636
+ interface ModularPanelProps {
637
+ panel?: LayoutPanel;
638
+ isLeft?: boolean;
639
+ state: PinnablePanelState | PanelState;
640
+ actions: PanelActions;
641
+ pinActions?: PinnablePanelActions;
642
+ transition?: TransitionStatus;
643
+ noHeader?: boolean;
644
+ close?: () => void;
645
+ available?: LayoutPanel[];
646
+ style?: any;
647
+ }
648
+ declare function useSetCustomTitle(): (title: string) => void;
649
+ declare const ModularPanelHeader: styled_components.IStyledComponent<"web", styled_components_dist_types.Substitute<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
650
+ $tabs?: boolean | undefined;
651
+ $error?: boolean | undefined;
652
+ }>>;
653
+ declare const ModulePanelButton: styled_components.IStyledComponent<"web", styled_components_dist_types.FastOmit<react.DetailedHTMLProps<react.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, never>>;
654
+ declare function ModularPanel({ panel, state, actions, isLeft, pinActions, transition, close, available, style, noHeader, }: ModularPanelProps): react_jsx_runtime.JSX.Element | null;
655
+
656
+ declare function PanelError(props: {
657
+ error: Error;
658
+ resetErrorBoundary: () => void;
659
+ }): react_jsx_runtime.JSX.Element;
660
+
661
+ declare function PreviewButton({ downloadEnabled, fileName }: {
662
+ downloadEnabled?: boolean;
663
+ fileName?: string;
664
+ }): react_jsx_runtime.JSX.Element;
665
+
666
+ declare const PreviewProvider: react.NamedExoticComponent<{
667
+ previews: Preview[];
668
+ children: ReactNode;
669
+ configs: PreviewConfiguration[];
670
+ }>;
671
+ declare function usePreviews(): Preview[];
672
+ declare function usePreviewContext(): PreviewContext;
673
+
674
+ declare function usePreviewVault(): Vault;
675
+ declare const HOMEPAGE_COLLECTION = "manifest-editor://homepage-collection.json";
676
+ declare function usePreviewHistory(): {
677
+ addHistory: (id: string, type: string) => void;
678
+ clearHistory: () => void;
679
+ };
680
+ declare function PreviewVaultContext(props: {
681
+ children: any;
682
+ }): react_jsx_runtime.JSX.Element;
683
+ declare function PreviewVaultBoundary({ children }: {
684
+ children: any;
685
+ }): react_jsx_runtime.JSX.Element;
686
+
687
+ declare function createPreviewVault(homepageCollectionId?: string): {
688
+ readonly vault: Vault;
689
+ readonly unsubscribe: () => void;
690
+ readonly addHistory: (id: string, type: string) => void;
691
+ readonly clearHistory: () => void;
692
+ };
693
+
694
+ interface ResourceEditingContext {
695
+ resource: Reference<any> | null;
696
+ }
697
+ declare function useEditingContext(): ResourceEditingContext;
698
+ /**
699
+ * useResource
700
+ *
701
+ * Only use this if you KNOW that there is a resource (e.g. in a panel)
702
+ */
703
+ declare function useResource<T = Record<string, never>>(): T & Reference<any>;
704
+ /**
705
+ * useOptionalResource
706
+ *
707
+ * Use in components where you don't know if something is editing. (e.g. canvas listing)
708
+ */
709
+ declare function useOptionalResource(): {
710
+ type: any;
711
+ id: string;
712
+ } | null;
713
+ declare function ResourceEditingProvider({ resource, children, }: {
714
+ resource: {
715
+ id: string;
716
+ type: string;
717
+ } | null | undefined;
718
+ children: ReactNode;
719
+ }): react_jsx_runtime.JSX.Element;
720
+
721
+ declare function ShellProvider({ config, saveConfig, children, theme, previews, resource, editing, }: {
722
+ resource: Resource;
723
+ config?: Partial<Config>;
724
+ saveConfig?: (config: Partial<Config>) => void;
725
+ children: ReactNode;
726
+ theme?: any;
727
+ previews?: Preview[];
728
+ editing?: {
729
+ id: string;
730
+ type: string;
731
+ };
732
+ }): react_jsx_runtime.JSX.Element;
733
+
734
+ interface Task<Req = any, Res = any> {
735
+ name: string;
736
+ status: "idle" | "running" | "complete" | "error";
737
+ emitter: Emitter<any>;
738
+ promise: Promise<any>;
739
+ abort: AbortController;
740
+ resolve: (value?: any) => void;
741
+ reject: (reason?: any) => void;
742
+ error?: string;
743
+ request?: Req;
744
+ response?: Res;
745
+ }
746
+ declare function useTask(name: string): Task<any, any>;
747
+ declare function useTaskEvent<Req = any, Res = any>(task: Task<Req, Res>, name: string, _cb: (task: Task<Req, Res>) => any): void;
748
+ declare function useTaskDispatch<Req = any, Res = any>(name: string, onComplete?: (task: Task<Req, Res>) => void | Promise<void>): readonly [(request?: any) => void, Task<any, any>];
749
+ declare function useTaskRunner<Req = any, Res = any>(name: string, onRun: (task: Task<Req, Res>) => void | Promise<void>): readonly [(response?: any) => void, Task<any, any>, (reason?: any, error?: any) => void];
750
+ declare function TaskBridge({ children }: {
751
+ children?: ReactNode;
752
+ }): react_jsx_runtime.JSX.Element;
753
+
754
+ interface UniversalCopyPasteProps<T> {
755
+ as?: keyof JSX.IntrinsicElements | react.ComponentType<T>;
756
+ children?: ReactNode;
757
+ reference?: Reference;
758
+ onReference?: (reference: Reference) => void;
759
+ onPasteReference?: (reference: Reference) => void;
760
+ onDropReference?: (reference: Reference, e: DragEvent) => void;
761
+ onLink?: (link: string) => void;
762
+ onPasteLink?: (link: string) => void;
763
+ onDropLink?: (link: string) => void;
764
+ onAnalysis?: (analysisResults: any) => void;
765
+ onPasteAnalysis?: (analysisResults: any) => void;
766
+ onDropAnalysis?: (analysisResults: any) => void;
767
+ onLoading?: () => void;
768
+ onComplete?: () => void;
769
+ }
770
+
771
+ 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): react_jsx_runtime.JSX.Element;
772
+
773
+ declare function detectMedia(): Promise<void>;
774
+ declare function analyse(url: string, ...expectedTypes: string[]): Promise<any>;
775
+ declare function analyseJson(data: any, url: string): Promise<any>;
776
+ declare function getFormat(url: string, capturedContentType?: string): Promise<string>;
777
+ declare function getImageDimensions(url: string): Promise<{
778
+ width: number;
779
+ height: number;
780
+ } | null>;
781
+
782
+ declare function getManifestNomalized(id: string): Promise<ManifestNormalized | undefined>;
783
+ declare function createActionIdentity(type: string, property: string, parent: any): string;
784
+ declare function createDownload(data: any, fileName: string, fileType?: string): void;
785
+ declare function copyToClipboard(json: string | any): Promise<void>;
786
+ declare function randomId(): string;
787
+ declare function mapApp(input: any, map?: (app: MappedApp$1) => MappedApp$1): MappedApp$1;
788
+
789
+ type Projection = {
790
+ x: number;
791
+ y: number;
792
+ width: number;
793
+ height: number;
794
+ };
795
+ interface HighlightedImageResources {
796
+ regions: Record<string, Projection | null>;
797
+ resources: string[];
798
+ setRegion: (id: string, region?: Projection | null) => void;
799
+ setHighlight: (id: string | string[]) => void;
800
+ highlight: (id: string) => void;
801
+ clearHighlight: (id: string) => void;
802
+ }
803
+ declare const useHighlightedImageResource: zustand.UseBoundStore<zustand.StoreApi<HighlightedImageResources>>;
804
+ declare function useTemporaryHighlight(newValue?: Projection | null): void;
805
+ declare function useHoverHighlightImageResource(id?: string): {
806
+ onMouseEnter(): void;
807
+ onMouseLeave(): void;
808
+ };
809
+
810
+ declare function useSaveVault(vault: Vault$1, saveChanges: () => void, saveInterval: number, enabled?: boolean): void;
811
+
812
+ declare function useDecayState(time: number): readonly [boolean, {
813
+ readonly set: () => void;
814
+ readonly clear: (existing?: boolean) => void;
815
+ }];
816
+
817
+ export { type AppContext, AppHeader, AppMenuProvider, AppProvider, AppResourceInstanceProvider, AppResourceProvider, type AppState, BaseEditor, BaseEditorBackButton, BaseEditorCloseButton, type Config, ConfigEditor, ConfigProvider, type CreatableResource, type EditableResource, EditingStack, type EditingStackActionCreators, type EditingStackActions, type EditingStackState, type EditorConfig, type EditorDefinition, ExportPanel, type ExportPanelProps, HOMEPAGE_COLLECTION, HandleContainer, HandleControls, Layout, type LayoutActions, LayoutActionsReactContext, type LayoutContext, type LayoutFunction, type LayoutPanel, type LayoutPanelContext, type LayoutProps$1 as LayoutProps, type LayoutProviderProps, type LayoutState, LayoutStateReactContext, type LoadedApp, type MappedApp$1 as MappedApp, type MenuPositions, ModularPanel, ModularPanelHeader, ModulePanelButton, type MultiAppContext, MultiAppProvider, type PanelActionType, type PanelActions, PanelError, type PanelState, type PinnablePanelActions, type PinnablePanelState, type PinnedLayoutPanel, type Preview, type PreviewActions, type PreviewActionsType, PreviewButton, type PreviewConfiguration, type PreviewContext, type PreviewHandler, PreviewProvider, type PreviewState, PreviewVaultBoundary, PreviewVaultContext, PrimeAppReactContext, type Resource, type ResourceDefinition, ResourceEditingProvider, ShellProvider, TaskBridge, type UniversalCopyPasteProps, UniversalCopyTarget, type UploadBackendConfig, analyse, analyseJson, baseCreator, baseEditor, copyToClipboard, createActionIdentity, createDownload, createPreviewVault, detectMedia, editBasedOnResource, getDefaultLayoutState, getDefaultPanelState, getFormat, getImageDimensions, getManifestNomalized, isPinnableState, layoutReducer, mapApp, matchBasedOnResource, panelSizing, randomId, renderHelper, useAnnotationPageEditor, useApp, useAppInstance, useAppMenu, useAppMenuItem, useAppResource, useAppResourceInstance, useAppState, useApps, useAvailableLayouts, useCollectionEditor, useConfig, useCreatingResource, useCreator, useDecayState, useEditingContext, useEditingResource, useEditingResourceStack, useEditingStack, useEditor, useGenericEditor, useHighlightedImageResource, useHoverHighlightImageResource, useInlineCreator, useLayoutActions, useLayoutProvider, useLayoutState, useManifestEditor, useOptionalResource, usePanelActions, usePreviewContext, usePreviewHistory, usePreviewVault, usePreviews, useResource, useSaveConfig, useSaveVault, useSetCustomTitle, useTask, useTaskDispatch, useTaskEvent, useTaskRunner, useTemporaryHighlight };