@panneau/core 4.0.11 → 4.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/contexts.d.ts +450 -0
- package/{es → dist}/contexts.js +23 -23
- package/dist/hooks.d.ts +362 -0
- package/{es → dist}/hooks.js +4 -4
- package/dist/index.d.ts +502 -0
- package/{es → dist}/index.js +7 -258
- package/dist/utils.d.ts +207 -0
- package/{es → dist}/utils.js +7 -7
- package/package.json +23 -23
- package/es/types/core.d.ts +0 -133
- package/es/types/form.d.ts +0 -58
- package/es/types/index.d.ts +0 -20
- package/es/types/panneau.d.ts +0 -50
- package/es/types/resource.d.ts +0 -112
- package/lib/contexts.js +0 -1432
- package/lib/hooks.js +0 -1168
- package/lib/index.js +0 -1019
- package/lib/utils.js +0 -789
|
@@ -0,0 +1,450 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as react from 'react';
|
|
3
|
+
import { ReactNode, ComponentType } from 'react';
|
|
4
|
+
export { RoutesContext, RoutesProvider, useRoutes, useUrlGenerator } from '@folklore/routes';
|
|
5
|
+
export { TrackingContext } from '@folklore/tracking';
|
|
6
|
+
|
|
7
|
+
declare class ComponentsManager {
|
|
8
|
+
components: Record<string, unknown>;
|
|
9
|
+
constructor(components?: Record<string, unknown>);
|
|
10
|
+
addComponent(name: string, component: unknown, namespace?: string | null): this;
|
|
11
|
+
addComponents(components: Record<string, unknown>, namespace?: string | null): this;
|
|
12
|
+
merge(manager: ComponentsManager, namespace?: string | null): this;
|
|
13
|
+
addNamespace(namespace: string | null): this;
|
|
14
|
+
getComponent(name: string, namespace?: string | null): unknown;
|
|
15
|
+
getComponents(namespace?: string | null): Record<string, unknown> | null;
|
|
16
|
+
hasComponent(name: string, namespace?: string | null): boolean;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface Definition$1 {
|
|
20
|
+
id: string;
|
|
21
|
+
component?: unknown;
|
|
22
|
+
[key: string]: unknown;
|
|
23
|
+
}
|
|
24
|
+
declare class DefinitionsManager {
|
|
25
|
+
definitions: Definition$1[];
|
|
26
|
+
constructor(definitions?: Definition$1[]);
|
|
27
|
+
addDefinition(definition: Definition$1 | Definition$1[]): this;
|
|
28
|
+
addDefinitions(definitions: Definition$1[]): this;
|
|
29
|
+
merge(manager: DefinitionsManager): this;
|
|
30
|
+
getDefinition(id: string | null): Definition$1 | null;
|
|
31
|
+
getDefinitions(): Definition$1[];
|
|
32
|
+
hasDefinition(id: string): boolean;
|
|
33
|
+
getComponent(id: string): unknown;
|
|
34
|
+
getComponents(): Record<string, unknown>;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
declare class FieldsManager extends DefinitionsManager {
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
declare const MODALS_NAMESPACE = "modals";
|
|
41
|
+
declare const FIELDS_NAMESPACE = "fields";
|
|
42
|
+
declare const FORMS_NAMESPACE = "forms";
|
|
43
|
+
declare const FILTERS_NAMESPACE = "filters";
|
|
44
|
+
declare const LISTS_NAMESPACE = "lists";
|
|
45
|
+
declare const DISPLAYS_NAMESPACE = "displays";
|
|
46
|
+
declare const ACTIONS_NAMESPACE = "actions";
|
|
47
|
+
declare const BUTTONS_NAMESPACE = "buttons";
|
|
48
|
+
declare const PAGES_NAMESPACE = "pages";
|
|
49
|
+
declare const PREVIEWS_NAMESPACE = "previews";
|
|
50
|
+
declare const APP_NAMESPACE = "app";
|
|
51
|
+
declare const ComponentsContext: react.Context<ComponentsManager>;
|
|
52
|
+
/**
|
|
53
|
+
* Hooks
|
|
54
|
+
*/
|
|
55
|
+
declare const useComponentsManager: (namespace?: string | null) => ComponentsManager;
|
|
56
|
+
declare const useComponents: (namespace?: string | null, defaultComponents?: Record<string, unknown>) => Record<string, unknown>;
|
|
57
|
+
declare const useComponent: (name: unknown, defaultComponent?: unknown, namespace?: string | null) => unknown;
|
|
58
|
+
/**
|
|
59
|
+
* Fields hooks
|
|
60
|
+
*/
|
|
61
|
+
declare const useFieldsComponentsManager: () => ComponentsManager;
|
|
62
|
+
declare const useFieldsComponents: (defaultComponents?: Record<string, unknown>) => Record<string, unknown>;
|
|
63
|
+
declare const useFieldComponent: (name: unknown, defaultComponent?: unknown) => unknown;
|
|
64
|
+
/**
|
|
65
|
+
* Forms hooks
|
|
66
|
+
*/
|
|
67
|
+
declare const useFormsComponentsManager: () => ComponentsManager;
|
|
68
|
+
declare const useFormsComponents: (defaultComponents?: Record<string, unknown>) => Record<string, unknown>;
|
|
69
|
+
declare const useFormComponent: (name: unknown, defaultComponent?: unknown) => unknown;
|
|
70
|
+
/**
|
|
71
|
+
* Modals hooks
|
|
72
|
+
*/
|
|
73
|
+
declare const useModalsComponentsManager: () => ComponentsManager;
|
|
74
|
+
declare const useModalsComponents: (defaultComponents?: Record<string, unknown>) => Record<string, unknown>;
|
|
75
|
+
declare const useModalComponent: (name: unknown, defaultComponent?: unknown) => unknown;
|
|
76
|
+
/**
|
|
77
|
+
* Filters hooks
|
|
78
|
+
*/
|
|
79
|
+
declare const useFiltersComponentsManager: () => ComponentsManager;
|
|
80
|
+
declare const useFiltersComponents: (defaultComponents?: Record<string, unknown>) => Record<string, unknown>;
|
|
81
|
+
declare const useFilterComponent: (name: unknown, defaultComponent?: unknown) => unknown;
|
|
82
|
+
/**
|
|
83
|
+
* Lists hooks
|
|
84
|
+
*/
|
|
85
|
+
declare const useListsComponentsManager: () => ComponentsManager;
|
|
86
|
+
declare const useListsComponents: (defaultComponents?: Record<string, unknown>) => Record<string, unknown>;
|
|
87
|
+
declare const useListComponent: (name: unknown, defaultComponent?: unknown) => unknown;
|
|
88
|
+
/**
|
|
89
|
+
* Displays hooks
|
|
90
|
+
*/
|
|
91
|
+
declare const useDisplaysComponentsManager: () => ComponentsManager;
|
|
92
|
+
declare const useDisplaysComponents: (defaultComponents?: Record<string, unknown>) => Record<string, unknown>;
|
|
93
|
+
declare const useDisplayComponent: (name: unknown, defaultComponent?: unknown) => unknown;
|
|
94
|
+
/**
|
|
95
|
+
* Actions hooks
|
|
96
|
+
*/
|
|
97
|
+
declare const useActionsComponentsManager: () => ComponentsManager;
|
|
98
|
+
declare const useActionsComponents: (defaultComponents?: Record<string, unknown>) => Record<string, unknown>;
|
|
99
|
+
declare const useActionComponent: (name: unknown, defaultComponent?: unknown) => unknown;
|
|
100
|
+
/**
|
|
101
|
+
* Buttons hooks
|
|
102
|
+
*/
|
|
103
|
+
declare const useButtonsComponentsManager: () => ComponentsManager;
|
|
104
|
+
declare const useButtonsComponents: (defaultComponents?: Record<string, unknown>) => Record<string, unknown>;
|
|
105
|
+
declare const useButtonComponent: (name: unknown, defaultComponent?: unknown) => unknown;
|
|
106
|
+
/**
|
|
107
|
+
* Pages hooks
|
|
108
|
+
*/
|
|
109
|
+
declare const usePagesComponentsManager: () => ComponentsManager;
|
|
110
|
+
declare const usePagesComponents: (defaultComponents?: Record<string, unknown>) => Record<string, unknown>;
|
|
111
|
+
declare const usePageComponent: (name: unknown, defaultComponent?: unknown) => unknown;
|
|
112
|
+
/**
|
|
113
|
+
* Previews hooks
|
|
114
|
+
*/
|
|
115
|
+
declare const usePreviewsComponentsManager: () => ComponentsManager;
|
|
116
|
+
declare const usePreviewsComponents: (defaultComponents?: Record<string, unknown>) => Record<string, unknown>;
|
|
117
|
+
declare const usePreviewComponent: (name: unknown, defaultComponent?: unknown) => unknown;
|
|
118
|
+
/**
|
|
119
|
+
* App hooks
|
|
120
|
+
*/
|
|
121
|
+
declare const useAppComponentsManager: () => ComponentsManager;
|
|
122
|
+
declare const useAppComponents: (defaultComponents?: Record<string, unknown>) => Record<string, unknown>;
|
|
123
|
+
declare const useAppComponent: (name: unknown, defaultComponent?: unknown) => unknown;
|
|
124
|
+
/**
|
|
125
|
+
* Provider
|
|
126
|
+
*/
|
|
127
|
+
interface ComponentsProviderProps {
|
|
128
|
+
children: ReactNode;
|
|
129
|
+
namespace?: string | null;
|
|
130
|
+
manager?: ComponentsManager | null;
|
|
131
|
+
components?: Record<string, unknown>;
|
|
132
|
+
}
|
|
133
|
+
declare function ComponentsProvider({ components, manager, namespace, children, }: ComponentsProviderProps): react_jsx_runtime.JSX.Element;
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Core UI Types
|
|
137
|
+
*/
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Font definition
|
|
141
|
+
*/
|
|
142
|
+
interface Font {
|
|
143
|
+
name: string;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Tracking variables
|
|
147
|
+
*/
|
|
148
|
+
type TrackingVariables = Record<string, unknown>;
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Form Types
|
|
152
|
+
* TypeScript interfaces for form-related components
|
|
153
|
+
*/
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Field definition
|
|
157
|
+
*/
|
|
158
|
+
interface Field {
|
|
159
|
+
name?: string;
|
|
160
|
+
type?: string;
|
|
161
|
+
component?: string;
|
|
162
|
+
label?: ReactNode;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Resource Types
|
|
167
|
+
* TypeScript interfaces for resources, items, users, media, and other entities
|
|
168
|
+
*/
|
|
169
|
+
|
|
170
|
+
interface ResourceIntlValues {
|
|
171
|
+
a_singular?: string;
|
|
172
|
+
a_plural?: string;
|
|
173
|
+
[key: string]: unknown;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Internationalization configuration
|
|
177
|
+
*/
|
|
178
|
+
interface ResourceIntl {
|
|
179
|
+
messages?: Record<string, string>;
|
|
180
|
+
values?: ResourceIntlValues;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Resource definition
|
|
184
|
+
*/
|
|
185
|
+
interface Resource {
|
|
186
|
+
id: string;
|
|
187
|
+
name: string;
|
|
188
|
+
intl?: ResourceIntl;
|
|
189
|
+
fields?: Field[];
|
|
190
|
+
forms?: Record<string, unknown>;
|
|
191
|
+
shows_in_navbar?: boolean;
|
|
192
|
+
settings?: Record<string, unknown>;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Panneau Definition Types
|
|
197
|
+
* TypeScript interfaces for main Panneau configuration and definitions
|
|
198
|
+
*/
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Panneau route configuration
|
|
202
|
+
*/
|
|
203
|
+
interface Routes {
|
|
204
|
+
'resources.index': string;
|
|
205
|
+
'resources.create': string;
|
|
206
|
+
'resources.store': string;
|
|
207
|
+
'resources.show': string;
|
|
208
|
+
'resources.edit': string;
|
|
209
|
+
'resources.update': string;
|
|
210
|
+
'resources.delete': string;
|
|
211
|
+
'resources.destroy': string;
|
|
212
|
+
'resources.duplicate': string;
|
|
213
|
+
'resources.clone': string;
|
|
214
|
+
'resources.restore': string;
|
|
215
|
+
[key: string]: string;
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Page definition
|
|
219
|
+
*/
|
|
220
|
+
interface Page {
|
|
221
|
+
component: string;
|
|
222
|
+
[key: string]: unknown;
|
|
223
|
+
}
|
|
224
|
+
interface PanneauTheme {
|
|
225
|
+
colorScheme?: string | null;
|
|
226
|
+
[key: string]: unknown;
|
|
227
|
+
}
|
|
228
|
+
interface PanneauComponents {
|
|
229
|
+
[key: string]: string | {
|
|
230
|
+
component: string;
|
|
231
|
+
[key: string]: unknown;
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
interface PanneauIntlValues {
|
|
235
|
+
[key: string]: string;
|
|
236
|
+
}
|
|
237
|
+
interface PanneauIntl {
|
|
238
|
+
locale?: string;
|
|
239
|
+
locales?: string[];
|
|
240
|
+
messages?: Record<string, string>;
|
|
241
|
+
values?: PanneauIntlValues;
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Panneau definition (main configuration)
|
|
245
|
+
*/
|
|
246
|
+
interface PanneauDefinition {
|
|
247
|
+
name?: string;
|
|
248
|
+
resources?: Resource[];
|
|
249
|
+
routes?: Routes;
|
|
250
|
+
pages?: Record<string, Page>;
|
|
251
|
+
intl?: PanneauIntl;
|
|
252
|
+
theme?: PanneauTheme;
|
|
253
|
+
components?: PanneauComponents;
|
|
254
|
+
settings?: Record<string, unknown>;
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Generic definition
|
|
258
|
+
*/
|
|
259
|
+
interface Definition {
|
|
260
|
+
name?: string;
|
|
261
|
+
[key: string]: unknown;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
declare const useDefinitionContext: () => Definition | null;
|
|
265
|
+
declare const useDefinition: () => Definition | null;
|
|
266
|
+
interface DefinitionProviderProps {
|
|
267
|
+
definition: Definition;
|
|
268
|
+
children: ReactNode;
|
|
269
|
+
}
|
|
270
|
+
declare function DefinitionProvider({ definition, children }: DefinitionProviderProps): react_jsx_runtime.JSX.Element;
|
|
271
|
+
|
|
272
|
+
declare const FieldsContext: react.Context<FieldsManager>;
|
|
273
|
+
declare const useFieldsManager: () => FieldsManager | null;
|
|
274
|
+
declare const useField: (id: string) => Field | null;
|
|
275
|
+
declare const useFields: () => Field[];
|
|
276
|
+
interface FieldsProviderProps {
|
|
277
|
+
fields?: Field[] | null;
|
|
278
|
+
manager?: FieldsManager | null;
|
|
279
|
+
children: ReactNode;
|
|
280
|
+
}
|
|
281
|
+
declare function FieldsProvider({ fields, manager, children }: FieldsProviderProps): react_jsx_runtime.JSX.Element;
|
|
282
|
+
|
|
283
|
+
interface FontsContextValue {
|
|
284
|
+
systemFonts: Font[] | null;
|
|
285
|
+
googleFonts: Font[] | null;
|
|
286
|
+
customFonts: Font[] | null;
|
|
287
|
+
setGoogleFonts?: ((fonts: Font[]) => void) | null;
|
|
288
|
+
}
|
|
289
|
+
declare const FontsContext: react.Context<FontsContextValue>;
|
|
290
|
+
declare const useGoogleFonts: ({ disabled, setFonts, }?: {
|
|
291
|
+
disabled?: boolean;
|
|
292
|
+
setFonts?: ((fonts: Font[]) => void) | null;
|
|
293
|
+
}) => Font[] | null;
|
|
294
|
+
declare const useFonts: ({ withoutGoogleFonts, }?: {
|
|
295
|
+
withoutGoogleFonts?: boolean;
|
|
296
|
+
}) => FontsContextValue;
|
|
297
|
+
interface FontsProviderProps {
|
|
298
|
+
children: ReactNode;
|
|
299
|
+
systemFonts?: (Font | string)[] | null;
|
|
300
|
+
customFonts?: (Font | string)[] | null;
|
|
301
|
+
}
|
|
302
|
+
declare function FontsProvider({ systemFonts, customFonts, children, }: FontsProviderProps): react_jsx_runtime.JSX.Element;
|
|
303
|
+
|
|
304
|
+
interface FormContextValue {
|
|
305
|
+
value: Record<string, unknown>;
|
|
306
|
+
setValue: (value: Record<string, unknown>) => void;
|
|
307
|
+
}
|
|
308
|
+
declare const useFormContext: () => FormContextValue | null;
|
|
309
|
+
declare const useFormValue: () => Record<string, unknown>;
|
|
310
|
+
declare const useFormSetValue: () => ((value: Record<string, unknown>) => void);
|
|
311
|
+
interface FormProviderProps {
|
|
312
|
+
value: Record<string, unknown>;
|
|
313
|
+
setValue: (value: Record<string, unknown>) => void;
|
|
314
|
+
children: ReactNode;
|
|
315
|
+
}
|
|
316
|
+
declare function FormProvider({ value, setValue, children }: FormProviderProps): react_jsx_runtime.JSX.Element;
|
|
317
|
+
|
|
318
|
+
declare const GoogleApiClientContext: react.Context<any>;
|
|
319
|
+
declare const useGoogleApiClient: () => any | null;
|
|
320
|
+
declare const withGoogleApiClient: (WrappedComponent: ComponentType<any>) => {
|
|
321
|
+
(props: any): react_jsx_runtime.JSX.Element;
|
|
322
|
+
displayName: string;
|
|
323
|
+
};
|
|
324
|
+
interface GoogleApiClientProviderProps {
|
|
325
|
+
children: ReactNode;
|
|
326
|
+
}
|
|
327
|
+
declare function GoogleApiClientProvider({ children }: GoogleApiClientProviderProps): react_jsx_runtime.JSX.Element;
|
|
328
|
+
|
|
329
|
+
interface GoogleKeysContextValue {
|
|
330
|
+
apiKey: string | null;
|
|
331
|
+
}
|
|
332
|
+
declare const GoogleKeysContext: react.Context<GoogleKeysContextValue>;
|
|
333
|
+
declare const useGoogleKeys: () => GoogleKeysContextValue;
|
|
334
|
+
interface GoogleKeysProviderProps {
|
|
335
|
+
children: ReactNode;
|
|
336
|
+
apiKey?: string | null;
|
|
337
|
+
}
|
|
338
|
+
declare function GoogleKeysProvider({ children, apiKey }: GoogleKeysProviderProps): react_jsx_runtime.JSX.Element;
|
|
339
|
+
|
|
340
|
+
declare const GoogleMapsClientContext: react.Context<any>;
|
|
341
|
+
declare const useGoogleMapsClient: () => any | null;
|
|
342
|
+
declare const withGoogleMapsClient: (WrappedComponent: ComponentType<any>) => {
|
|
343
|
+
(props: any): react_jsx_runtime.JSX.Element;
|
|
344
|
+
displayName: string;
|
|
345
|
+
};
|
|
346
|
+
interface GoogleMapsClientProviderProps {
|
|
347
|
+
children: ReactNode;
|
|
348
|
+
locale?: string;
|
|
349
|
+
libraries?: string[] | null;
|
|
350
|
+
}
|
|
351
|
+
declare function GoogleMapsClientProvider({ children, locale, libraries, }: GoogleMapsClientProviderProps): react_jsx_runtime.JSX.Element;
|
|
352
|
+
|
|
353
|
+
interface LocalesContextValue {
|
|
354
|
+
locales: string[];
|
|
355
|
+
}
|
|
356
|
+
declare const LocalesContext: react.Context<LocalesContextValue>;
|
|
357
|
+
declare const useLocalesContext: () => LocalesContextValue;
|
|
358
|
+
declare const useLocales: () => string[];
|
|
359
|
+
declare const useOtherLocales: () => string[];
|
|
360
|
+
interface LocalesProviderProps {
|
|
361
|
+
locales?: string[];
|
|
362
|
+
children: ReactNode;
|
|
363
|
+
}
|
|
364
|
+
declare function LocalesProvider({ locales, children }: LocalesProviderProps): react_jsx_runtime.JSX.Element;
|
|
365
|
+
|
|
366
|
+
interface ModalData {
|
|
367
|
+
id: string;
|
|
368
|
+
onClose?: (() => void) | null;
|
|
369
|
+
[key: string]: unknown;
|
|
370
|
+
}
|
|
371
|
+
interface ModalContextValue {
|
|
372
|
+
modals: ModalData[];
|
|
373
|
+
container: unknown | null;
|
|
374
|
+
setContainer: (container: unknown) => void;
|
|
375
|
+
register: (id: string, data?: Record<string, unknown> | null) => void;
|
|
376
|
+
unregister: (id?: string | null, data?: Record<string, unknown> | null) => void;
|
|
377
|
+
closeLastModal: () => void;
|
|
378
|
+
getModalById: (modalId: string) => ModalData | null;
|
|
379
|
+
}
|
|
380
|
+
declare const ModalContext: react.Context<ModalContextValue>;
|
|
381
|
+
declare const useModal: () => ModalContextValue;
|
|
382
|
+
interface ModalProviderProps {
|
|
383
|
+
children: ReactNode;
|
|
384
|
+
container?: unknown | null;
|
|
385
|
+
}
|
|
386
|
+
declare function ModalProvider({ children, container: initialContainer }: ModalProviderProps): react_jsx_runtime.JSX.Element;
|
|
387
|
+
|
|
388
|
+
interface PanelData {
|
|
389
|
+
id: string;
|
|
390
|
+
[key: string]: unknown;
|
|
391
|
+
}
|
|
392
|
+
interface PanelsContextValue {
|
|
393
|
+
panels: PanelData[];
|
|
394
|
+
container: unknown | null;
|
|
395
|
+
setContainer: (container: unknown) => void;
|
|
396
|
+
register: (id: string, data?: Record<string, unknown> | null) => void;
|
|
397
|
+
unregister: (id: string) => void;
|
|
398
|
+
}
|
|
399
|
+
declare const PanelsContext: react.Context<PanelsContextValue>;
|
|
400
|
+
declare const usePanels: () => PanelsContextValue;
|
|
401
|
+
declare const withPanels: (WrappedComponent: ComponentType<any>) => {
|
|
402
|
+
(props: any): react_jsx_runtime.JSX.Element;
|
|
403
|
+
displayName: string;
|
|
404
|
+
};
|
|
405
|
+
interface PanelsProviderProps {
|
|
406
|
+
children: ReactNode;
|
|
407
|
+
container?: unknown | null;
|
|
408
|
+
}
|
|
409
|
+
declare function PanelsProvider({ children, container: initialContainer }: PanelsProviderProps): react_jsx_runtime.JSX.Element;
|
|
410
|
+
|
|
411
|
+
declare const usePanneau: () => PanneauDefinition | null;
|
|
412
|
+
declare const usePanneauResources: () => Resource[];
|
|
413
|
+
declare const usePanneauResource: (id: string) => Resource | null;
|
|
414
|
+
declare const usePanneauColorScheme: () => {
|
|
415
|
+
theme: string;
|
|
416
|
+
background: string | null;
|
|
417
|
+
text: string | null;
|
|
418
|
+
sidebarPosition?: string | null;
|
|
419
|
+
};
|
|
420
|
+
declare const usePanneauComponents: () => Record<string, unknown>;
|
|
421
|
+
declare const usePanneauComponent: (namespace: string | null, name: string) => string | null;
|
|
422
|
+
declare const usePanneauAuth: () => Record<string, unknown>;
|
|
423
|
+
declare const usePanneauSettings: () => Record<string, unknown>;
|
|
424
|
+
interface PanneauProviderProps {
|
|
425
|
+
definition: PanneauDefinition;
|
|
426
|
+
children: ReactNode;
|
|
427
|
+
}
|
|
428
|
+
declare function PanneauProvider({ definition, children }: PanneauProviderProps): react_jsx_runtime.JSX.Element;
|
|
429
|
+
|
|
430
|
+
declare const useResource: () => Resource | null;
|
|
431
|
+
interface ResourceProviderProps {
|
|
432
|
+
resource: Resource;
|
|
433
|
+
children: ReactNode;
|
|
434
|
+
}
|
|
435
|
+
declare function ResourceProvider({ resource, children }: ResourceProviderProps): react_jsx_runtime.JSX.Element;
|
|
436
|
+
|
|
437
|
+
declare const useRoutePush: () => ((route: string | {
|
|
438
|
+
pathname?: string | null;
|
|
439
|
+
search?: string | null;
|
|
440
|
+
}, data?: unknown, ...args: unknown[]) => void);
|
|
441
|
+
declare const useRouteBack: () => (() => void);
|
|
442
|
+
|
|
443
|
+
declare const useTracking: () => any;
|
|
444
|
+
interface TrackingProviderProps {
|
|
445
|
+
children: ReactNode;
|
|
446
|
+
variables?: TrackingVariables | null;
|
|
447
|
+
}
|
|
448
|
+
declare function TrackingProvider({ variables, children }: TrackingProviderProps): react_jsx_runtime.JSX.Element;
|
|
449
|
+
|
|
450
|
+
export { ACTIONS_NAMESPACE, APP_NAMESPACE, BUTTONS_NAMESPACE, ComponentsContext, ComponentsProvider, DISPLAYS_NAMESPACE, DefinitionProvider, FIELDS_NAMESPACE, FILTERS_NAMESPACE, FORMS_NAMESPACE, FieldsContext, FieldsProvider, FontsContext, FontsProvider, FormProvider, GoogleApiClientContext, GoogleApiClientProvider, GoogleKeysContext, GoogleKeysProvider, GoogleMapsClientContext, GoogleMapsClientProvider, LISTS_NAMESPACE, LocalesContext, LocalesProvider, MODALS_NAMESPACE, ModalContext, ModalProvider, PAGES_NAMESPACE, PREVIEWS_NAMESPACE, PanelsContext, PanelsProvider, PanneauProvider, ResourceProvider, TrackingProvider, useActionComponent, useActionsComponents, useActionsComponentsManager, useAppComponent, useAppComponents, useAppComponentsManager, useButtonComponent, useButtonsComponents, useButtonsComponentsManager, useComponent, useComponents, useComponentsManager, useDefinition, useDefinitionContext, useDisplayComponent, useDisplaysComponents, useDisplaysComponentsManager, useField, useFieldComponent, useFields, useFieldsComponents, useFieldsComponentsManager, useFieldsManager, useFilterComponent, useFiltersComponents, useFiltersComponentsManager, useFonts, useFormComponent, useFormContext, useFormSetValue, useFormValue, useFormsComponents, useFormsComponentsManager, useGoogleApiClient, useGoogleFonts, useGoogleKeys, useGoogleMapsClient, useListComponent, useListsComponents, useListsComponentsManager, useLocales, useLocalesContext, useModal, useModalComponent, useModalsComponents, useModalsComponentsManager, useOtherLocales, usePageComponent, usePagesComponents, usePagesComponentsManager, usePanels, usePanneau, usePanneauAuth, usePanneauColorScheme, usePanneauComponent, usePanneauComponents, usePanneauResource, usePanneauResources, usePanneauSettings, usePreviewComponent, usePreviewsComponents, usePreviewsComponentsManager, useResource, useRouteBack, useRoutePush, useTracking, withGoogleApiClient, withGoogleMapsClient, withPanels };
|
package/{es → dist}/contexts.js
RENAMED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
2
|
-
import isString from 'lodash
|
|
3
|
-
import { createContext, useContext, useMemo, useState, useEffect, useRef, useCallback } from 'react';
|
|
2
|
+
import isString from 'lodash/isString';
|
|
3
|
+
import { createContext, useContext, useMemo, useState, use, useEffect, useRef, useCallback } from 'react';
|
|
4
4
|
import { ComponentsManager, FieldsManager, Tracking } from '@panneau/core';
|
|
5
5
|
import { jsx } from 'react/jsx-runtime';
|
|
6
6
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
7
7
|
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
8
|
-
import uniqBy from 'lodash
|
|
8
|
+
import uniqBy from 'lodash/uniqBy';
|
|
9
9
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
10
10
|
import { getJSON } from '@folklore/fetch';
|
|
11
|
-
import isObject from 'lodash
|
|
11
|
+
import isObject from 'lodash/isObject';
|
|
12
12
|
import { loadGoogleApi, loadGoogleMaps } from '@folklore/services';
|
|
13
13
|
import { useIntl } from 'react-intl';
|
|
14
14
|
import { getDisplayName } from '@panneau/core/utils';
|
|
@@ -381,15 +381,15 @@ var useFonts = function useFonts() {
|
|
|
381
381
|
var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
382
382
|
_ref3$withoutGoogleFo = _ref3.withoutGoogleFonts,
|
|
383
383
|
withoutGoogleFonts = _ref3$withoutGoogleFo === void 0 ? false : _ref3$withoutGoogleFo;
|
|
384
|
-
var
|
|
385
|
-
|
|
386
|
-
setGoogleFonts =
|
|
387
|
-
|
|
388
|
-
systemFonts =
|
|
389
|
-
|
|
390
|
-
googleFonts =
|
|
391
|
-
|
|
392
|
-
customFonts =
|
|
384
|
+
var _use = use(FontsContext),
|
|
385
|
+
_use$setGoogleFonts = _use.setGoogleFonts,
|
|
386
|
+
setGoogleFonts = _use$setGoogleFonts === void 0 ? null : _use$setGoogleFonts,
|
|
387
|
+
_use$systemFonts = _use.systemFonts,
|
|
388
|
+
systemFonts = _use$systemFonts === void 0 ? null : _use$systemFonts,
|
|
389
|
+
_use$googleFonts = _use.googleFonts,
|
|
390
|
+
googleFonts = _use$googleFonts === void 0 ? null : _use$googleFonts,
|
|
391
|
+
_use$customFonts = _use.customFonts,
|
|
392
|
+
customFonts = _use$customFonts === void 0 ? null : _use$customFonts;
|
|
393
393
|
useGoogleFonts({
|
|
394
394
|
disabled: withoutGoogleFonts || googleFonts !== null && googleFonts.length > 0,
|
|
395
395
|
setFonts: setGoogleFonts
|
|
@@ -442,17 +442,17 @@ function FontsProvider(_ref4) {
|
|
|
442
442
|
}
|
|
443
443
|
|
|
444
444
|
var FormContext = /*#__PURE__*/createContext(null);
|
|
445
|
-
var
|
|
446
|
-
return
|
|
445
|
+
var useFormContext = function useFormContext() {
|
|
446
|
+
return use(FormContext);
|
|
447
447
|
};
|
|
448
448
|
var useFormValue = function useFormValue() {
|
|
449
|
-
var
|
|
450
|
-
value =
|
|
449
|
+
var _useFormContext = useFormContext(),
|
|
450
|
+
value = _useFormContext.value;
|
|
451
451
|
return value;
|
|
452
452
|
};
|
|
453
453
|
var useFormSetValue = function useFormSetValue() {
|
|
454
|
-
var
|
|
455
|
-
setValue =
|
|
454
|
+
var _useFormContext2 = useFormContext(),
|
|
455
|
+
setValue = _useFormContext2.setValue;
|
|
456
456
|
return setValue;
|
|
457
457
|
};
|
|
458
458
|
function FormProvider(_ref) {
|
|
@@ -846,11 +846,11 @@ var usePanneauComponent = function usePanneauComponent(namespace, name) {
|
|
|
846
846
|
_ref5$components = _ref5.components,
|
|
847
847
|
components = _ref5$components === void 0 ? {} : _ref5$components;
|
|
848
848
|
var path = namespace !== null ? "".concat(namespace, ".").concat(name) : name || null;
|
|
849
|
-
var component = components[path] || null;
|
|
849
|
+
var component = path !== null ? components[path] || null : null;
|
|
850
850
|
if (isString(component)) {
|
|
851
851
|
return component;
|
|
852
852
|
}
|
|
853
|
-
if (isObject(component) && isString(component === null || component === void 0 ? void 0 : component.
|
|
853
|
+
if (isObject(component) && isString(component === null || component === void 0 ? void 0 : component.component)) {
|
|
854
854
|
component.component;
|
|
855
855
|
_objectWithoutProperties(component, _excluded);
|
|
856
856
|
return component.component;
|
|
@@ -880,7 +880,7 @@ function PanneauProvider(_ref8) {
|
|
|
880
880
|
|
|
881
881
|
var ResourceContext = /*#__PURE__*/createContext(null);
|
|
882
882
|
var useResource = function useResource() {
|
|
883
|
-
return
|
|
883
|
+
return use(ResourceContext);
|
|
884
884
|
};
|
|
885
885
|
function ResourceProvider(_ref) {
|
|
886
886
|
var resource = _ref.resource,
|
|
@@ -947,4 +947,4 @@ function TrackingProvider(_ref) {
|
|
|
947
947
|
});
|
|
948
948
|
}
|
|
949
949
|
|
|
950
|
-
export { ACTIONS_NAMESPACE, APP_NAMESPACE, BUTTONS_NAMESPACE, ComponentsContext, ComponentsProvider, DISPLAYS_NAMESPACE, DefinitionProvider, FIELDS_NAMESPACE, FILTERS_NAMESPACE, FORMS_NAMESPACE, FieldsContext, FieldsProvider, FontsContext, FontsProvider, FormProvider, GoogleApiClientContext, GoogleApiClientProvider, GoogleKeysContext, GoogleKeysProvider, GoogleMapsClientContext, GoogleMapsClientProvider, LISTS_NAMESPACE, LocalesContext, LocalesProvider, MODALS_NAMESPACE, ModalContext, ModalProvider, PAGES_NAMESPACE, PREVIEWS_NAMESPACE, PanelsContext, PanelsProvider, PanneauProvider, ResourceProvider, TrackingProvider, useActionComponent, useActionsComponents, useActionsComponentsManager, useAppComponent, useAppComponents, useAppComponentsManager, useButtonComponent, useButtonsComponents, useButtonsComponentsManager, useComponent, useComponents, useComponentsManager, useDefinition, useDefinitionContext, useDisplayComponent, useDisplaysComponents, useDisplaysComponentsManager, useField, useFieldComponent, useFields, useFieldsComponents, useFieldsComponentsManager, useFieldsManager, useFilterComponent, useFiltersComponents, useFiltersComponentsManager, useFonts,
|
|
950
|
+
export { ACTIONS_NAMESPACE, APP_NAMESPACE, BUTTONS_NAMESPACE, ComponentsContext, ComponentsProvider, DISPLAYS_NAMESPACE, DefinitionProvider, FIELDS_NAMESPACE, FILTERS_NAMESPACE, FORMS_NAMESPACE, FieldsContext, FieldsProvider, FontsContext, FontsProvider, FormProvider, GoogleApiClientContext, GoogleApiClientProvider, GoogleKeysContext, GoogleKeysProvider, GoogleMapsClientContext, GoogleMapsClientProvider, LISTS_NAMESPACE, LocalesContext, LocalesProvider, MODALS_NAMESPACE, ModalContext, ModalProvider, PAGES_NAMESPACE, PREVIEWS_NAMESPACE, PanelsContext, PanelsProvider, PanneauProvider, ResourceProvider, TrackingProvider, useActionComponent, useActionsComponents, useActionsComponentsManager, useAppComponent, useAppComponents, useAppComponentsManager, useButtonComponent, useButtonsComponents, useButtonsComponentsManager, useComponent, useComponents, useComponentsManager, useDefinition, useDefinitionContext, useDisplayComponent, useDisplaysComponents, useDisplaysComponentsManager, useField, useFieldComponent, useFields, useFieldsComponents, useFieldsComponentsManager, useFieldsManager, useFilterComponent, useFiltersComponents, useFiltersComponentsManager, useFonts, useFormComponent, useFormContext, useFormSetValue, useFormValue, useFormsComponents, useFormsComponentsManager, useGoogleApiClient, useGoogleFonts, useGoogleKeys, useGoogleMapsClient, useListComponent, useListsComponents, useListsComponentsManager, useLocales, useLocalesContext, useModal, useModalComponent, useModalsComponents, useModalsComponentsManager, useOtherLocales, usePageComponent, usePagesComponents, usePagesComponentsManager, usePanels, usePanneau, usePanneauAuth, usePanneauColorScheme, usePanneauComponent, usePanneauComponents, usePanneauResource, usePanneauResources, usePanneauSettings, usePreviewComponent, usePreviewsComponents, usePreviewsComponentsManager, useResource, useRouteBack, useRoutePush, useTracking, withGoogleApiClient, withGoogleMapsClient, withPanels };
|