@panneau/core 4.1.1 → 5.0.0-alpha.1

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.
Files changed (75) hide show
  1. package/README.md +83 -0
  2. package/dist/definition/abilities.d.ts +21 -0
  3. package/dist/definition/abilities.d.ts.map +1 -0
  4. package/dist/definition/abilities.js +47 -0
  5. package/dist/definition/abilities.js.map +1 -0
  6. package/dist/definition/form.d.ts +31 -0
  7. package/dist/definition/form.d.ts.map +1 -0
  8. package/dist/definition/form.js +54 -0
  9. package/dist/definition/form.js.map +1 -0
  10. package/dist/definition/list.d.ts +44 -0
  11. package/dist/definition/list.d.ts.map +1 -0
  12. package/dist/definition/list.js +70 -0
  13. package/dist/definition/list.js.map +1 -0
  14. package/dist/definition/resource.d.ts +21 -0
  15. package/dist/definition/resource.d.ts.map +1 -0
  16. package/dist/definition/resource.js +24 -0
  17. package/dist/definition/resource.js.map +1 -0
  18. package/dist/form/form.d.ts +148 -0
  19. package/dist/form/form.d.ts.map +1 -0
  20. package/dist/form/form.js +239 -0
  21. package/dist/form/form.js.map +1 -0
  22. package/dist/form/messages.d.ts +7 -0
  23. package/dist/form/messages.d.ts.map +1 -0
  24. package/dist/form/messages.js +25 -0
  25. package/dist/form/messages.js.map +1 -0
  26. package/dist/form/problem.d.ts +16 -0
  27. package/dist/form/problem.d.ts.map +1 -0
  28. package/dist/form/problem.js +34 -0
  29. package/dist/form/problem.js.map +1 -0
  30. package/dist/form/selectors.d.ts +16 -0
  31. package/dist/form/selectors.d.ts.map +1 -0
  32. package/dist/form/selectors.js +27 -0
  33. package/dist/form/selectors.js.map +1 -0
  34. package/dist/form/store.d.ts +19 -0
  35. package/dist/form/store.d.ts.map +1 -0
  36. package/dist/form/store.js +29 -0
  37. package/dist/form/store.js.map +1 -0
  38. package/dist/index.d.ts +17 -692
  39. package/dist/index.d.ts.map +1 -0
  40. package/dist/index.js +17 -536
  41. package/dist/list/list.d.ts +68 -0
  42. package/dist/list/list.d.ts.map +1 -0
  43. package/dist/list/list.js +191 -0
  44. package/dist/list/list.js.map +1 -0
  45. package/dist/list/router.d.ts +26 -0
  46. package/dist/list/router.d.ts.map +1 -0
  47. package/dist/list/router.js +54 -0
  48. package/dist/list/router.js.map +1 -0
  49. package/dist/plugins.d.ts +73 -0
  50. package/dist/plugins.d.ts.map +1 -0
  51. package/dist/plugins.js +54 -0
  52. package/dist/plugins.js.map +1 -0
  53. package/dist/react/provider.d.ts +38 -0
  54. package/dist/react/provider.d.ts.map +1 -0
  55. package/dist/react/provider.js +63 -0
  56. package/dist/react/provider.js.map +1 -0
  57. package/dist/react/useForm.d.ts +26 -0
  58. package/dist/react/useForm.d.ts.map +1 -0
  59. package/dist/react/useForm.js +115 -0
  60. package/dist/react/useForm.js.map +1 -0
  61. package/dist/react/useList.d.ts +11 -0
  62. package/dist/react/useList.d.ts.map +1 -0
  63. package/dist/react/useList.js +47 -0
  64. package/dist/react/useList.js.map +1 -0
  65. package/dist/values.d.ts +12 -0
  66. package/dist/values.d.ts.map +1 -0
  67. package/dist/values.js +44 -0
  68. package/dist/values.js.map +1 -0
  69. package/package.json +19 -81
  70. package/dist/contexts.d.ts +0 -667
  71. package/dist/contexts.js +0 -1772
  72. package/dist/hooks.d.ts +0 -512
  73. package/dist/hooks.js +0 -2146
  74. package/dist/utils.d.ts +0 -457
  75. package/dist/utils.js +0 -557
package/dist/contexts.js DELETED
@@ -1,1772 +0,0 @@
1
- import { c } from 'react/compiler-runtime';
2
- import isString from 'lodash-es/isString';
3
- import { createContext, useContext, use, useState, useEffect, useRef } from 'react';
4
- import { ComponentsManager, FieldsManager, FormsManager, Tracking } from '@panneau/core';
5
- import { jsx } from 'react/jsx-runtime';
6
- import uniqBy from 'lodash-es/uniqBy';
7
- import { getJSON } from '@folklore/fetch';
8
- import isObject from 'lodash-es/isObject';
9
- import { loadGoogleApi, loadGoogleMaps } from '@folklore/services';
10
- import { useIntl } from 'react-intl';
11
- import { getDisplayName } from '@panneau/core/utils';
12
- import { useUrlGenerator } from '@folklore/routes';
13
- export { RoutesContext, RoutesProvider, useRoutes, useUrlGenerator } from '@folklore/routes';
14
- import { TrackingContext, TrackingContainer } from '@folklore/tracking';
15
- export { TrackingContext } from '@folklore/tracking';
16
- import { useLocation } from 'wouter';
17
-
18
- const MODALS_NAMESPACE = 'modals';
19
- const FIELDS_NAMESPACE = 'fields';
20
- const FORMS_NAMESPACE = 'forms';
21
- const FILTERS_NAMESPACE = 'filters';
22
- const LISTS_NAMESPACE = 'lists';
23
- const DISPLAYS_NAMESPACE = 'displays';
24
- const ACTIONS_NAMESPACE = 'actions';
25
- const BUTTONS_NAMESPACE = 'buttons';
26
- const PAGES_NAMESPACE = 'pages';
27
- const PREVIEWS_NAMESPACE = 'previews';
28
- const APP_NAMESPACE = 'app';
29
- const ComponentsContext = /*#__PURE__*/createContext(null);
30
-
31
- /**
32
- * Hooks
33
- */
34
- function useComponentsManager(t0) {
35
- const $ = c(3);
36
- const namespace = t0 === undefined ? null : t0;
37
- const manager = useContext(ComponentsContext);
38
- let t1;
39
- if ($[0] !== manager || $[1] !== namespace) {
40
- t1 = namespace !== null ? new ComponentsManager(manager?.getComponents(namespace) ?? {}) : manager;
41
- $[0] = manager;
42
- $[1] = namespace;
43
- $[2] = t1;
44
- } else {
45
- t1 = $[2];
46
- }
47
- const finalManager = t1;
48
- return finalManager;
49
- }
50
- function useComponents(t0, t1) {
51
- const $ = c(6);
52
- const namespace = t0 === undefined ? null : t0;
53
- let t2;
54
- if ($[0] !== t1) {
55
- t2 = t1 === undefined ? {} : t1;
56
- $[0] = t1;
57
- $[1] = t2;
58
- } else {
59
- t2 = $[1];
60
- }
61
- const defaultComponents = t2;
62
- const manager = useComponentsManager();
63
- let t3;
64
- if ($[2] !== defaultComponents || $[3] !== manager || $[4] !== namespace) {
65
- t3 = manager?.getComponents(namespace) || defaultComponents;
66
- $[2] = defaultComponents;
67
- $[3] = manager;
68
- $[4] = namespace;
69
- $[5] = t3;
70
- } else {
71
- t3 = $[5];
72
- }
73
- return t3;
74
- }
75
- function useComponent(name, t0, t1) {
76
- const $ = c(4);
77
- const defaultComponent = t0 === undefined ? null : t0;
78
- const namespace = t1 === undefined ? null : t1;
79
- const manager = useComponentsManager(namespace);
80
- let t2;
81
- bb0: {
82
- if (!isString(name)) {
83
- t2 = name || defaultComponent;
84
- break bb0;
85
- }
86
- let t3;
87
- if ($[0] !== defaultComponent || $[1] !== manager || $[2] !== name) {
88
- t3 = manager?.getComponent(name) || defaultComponent;
89
- $[0] = defaultComponent;
90
- $[1] = manager;
91
- $[2] = name;
92
- $[3] = t3;
93
- } else {
94
- t3 = $[3];
95
- }
96
- t2 = t3;
97
- }
98
- return t2;
99
- }
100
-
101
- /**
102
- * Fields hooks
103
- */
104
- function useFieldsComponentsManager() {
105
- return useComponentsManager(FIELDS_NAMESPACE);
106
- }
107
- function useFieldsComponents(t0) {
108
- const $ = c(2);
109
- let t1;
110
- if ($[0] !== t0) {
111
- t1 = t0 === undefined ? {} : t0;
112
- $[0] = t0;
113
- $[1] = t1;
114
- } else {
115
- t1 = $[1];
116
- }
117
- const defaultComponents = t1;
118
- return useComponents(FIELDS_NAMESPACE, defaultComponents);
119
- }
120
- function useFieldComponent(name, t0) {
121
- const defaultComponent = t0 === undefined ? null : t0;
122
- return useComponent(name, defaultComponent, FIELDS_NAMESPACE);
123
- }
124
-
125
- /**
126
- * Forms hooks
127
- */
128
- function useFormsComponentsManager() {
129
- return useComponentsManager(FORMS_NAMESPACE);
130
- }
131
- function useFormsComponents(t0) {
132
- const $ = c(2);
133
- let t1;
134
- if ($[0] !== t0) {
135
- t1 = t0 === undefined ? {} : t0;
136
- $[0] = t0;
137
- $[1] = t1;
138
- } else {
139
- t1 = $[1];
140
- }
141
- const defaultComponents = t1;
142
- return useComponents(FORMS_NAMESPACE, defaultComponents);
143
- }
144
- function useFormComponent(name, t0) {
145
- const defaultComponent = t0 === undefined ? null : t0;
146
- return useComponent(name, defaultComponent, FORMS_NAMESPACE);
147
- }
148
-
149
- /**
150
- * Modals hooks
151
- */
152
- function useModalsComponentsManager() {
153
- return useComponentsManager(MODALS_NAMESPACE);
154
- }
155
- function useModalsComponents(t0) {
156
- const $ = c(2);
157
- let t1;
158
- if ($[0] !== t0) {
159
- t1 = t0 === undefined ? {} : t0;
160
- $[0] = t0;
161
- $[1] = t1;
162
- } else {
163
- t1 = $[1];
164
- }
165
- const defaultComponents = t1;
166
- return useComponents(MODALS_NAMESPACE, defaultComponents);
167
- }
168
- function useModalComponent(name, t0) {
169
- const defaultComponent = t0 === undefined ? null : t0;
170
- return useComponent(name, defaultComponent, MODALS_NAMESPACE);
171
- }
172
-
173
- /**
174
- * Filters hooks
175
- */
176
- function useFiltersComponentsManager() {
177
- return useComponentsManager(FILTERS_NAMESPACE);
178
- }
179
- function useFiltersComponents(t0) {
180
- const $ = c(2);
181
- let t1;
182
- if ($[0] !== t0) {
183
- t1 = t0 === undefined ? {} : t0;
184
- $[0] = t0;
185
- $[1] = t1;
186
- } else {
187
- t1 = $[1];
188
- }
189
- const defaultComponents = t1;
190
- return useComponents(FILTERS_NAMESPACE, defaultComponents);
191
- }
192
- function useFilterComponent(name, t0) {
193
- const defaultComponent = t0 === undefined ? null : t0;
194
- return useComponent(name, defaultComponent, FILTERS_NAMESPACE);
195
- }
196
-
197
- /**
198
- * Lists hooks
199
- */
200
- function useListsComponentsManager() {
201
- return useComponentsManager(LISTS_NAMESPACE);
202
- }
203
- function useListsComponents(t0) {
204
- const $ = c(2);
205
- let t1;
206
- if ($[0] !== t0) {
207
- t1 = t0 === undefined ? {} : t0;
208
- $[0] = t0;
209
- $[1] = t1;
210
- } else {
211
- t1 = $[1];
212
- }
213
- const defaultComponents = t1;
214
- return useComponents(LISTS_NAMESPACE, defaultComponents);
215
- }
216
- function useListComponent(name, t0) {
217
- const defaultComponent = t0 === undefined ? null : t0;
218
- return useComponent(name, defaultComponent, LISTS_NAMESPACE);
219
- }
220
-
221
- /**
222
- * Displays hooks
223
- */
224
- function useDisplaysComponentsManager() {
225
- return useComponentsManager(DISPLAYS_NAMESPACE);
226
- }
227
- function useDisplaysComponents(t0) {
228
- const $ = c(2);
229
- let t1;
230
- if ($[0] !== t0) {
231
- t1 = t0 === undefined ? {} : t0;
232
- $[0] = t0;
233
- $[1] = t1;
234
- } else {
235
- t1 = $[1];
236
- }
237
- const defaultComponents = t1;
238
- return useComponents(DISPLAYS_NAMESPACE, defaultComponents);
239
- }
240
- function useDisplayComponent(name, t0) {
241
- const defaultComponent = t0 === undefined ? null : t0;
242
- return useComponent(name, defaultComponent, DISPLAYS_NAMESPACE);
243
- }
244
-
245
- /**
246
- * Actions hooks
247
- */
248
- function useActionsComponentsManager() {
249
- return useComponentsManager(ACTIONS_NAMESPACE);
250
- }
251
- function useActionsComponents(t0) {
252
- const $ = c(2);
253
- let t1;
254
- if ($[0] !== t0) {
255
- t1 = t0 === undefined ? {} : t0;
256
- $[0] = t0;
257
- $[1] = t1;
258
- } else {
259
- t1 = $[1];
260
- }
261
- const defaultComponents = t1;
262
- return useComponents(ACTIONS_NAMESPACE, defaultComponents);
263
- }
264
- function useActionComponent(name, t0) {
265
- const defaultComponent = t0 === undefined ? null : t0;
266
- return useComponent(name, defaultComponent, ACTIONS_NAMESPACE);
267
- }
268
-
269
- /**
270
- * Buttons hooks
271
- */
272
- function useButtonsComponentsManager() {
273
- return useComponentsManager(BUTTONS_NAMESPACE);
274
- }
275
- function useButtonsComponents(t0) {
276
- const $ = c(2);
277
- let t1;
278
- if ($[0] !== t0) {
279
- t1 = t0 === undefined ? {} : t0;
280
- $[0] = t0;
281
- $[1] = t1;
282
- } else {
283
- t1 = $[1];
284
- }
285
- const defaultComponents = t1;
286
- return useComponents(BUTTONS_NAMESPACE, defaultComponents);
287
- }
288
- function useButtonComponent(name, t0) {
289
- const defaultComponent = t0 === undefined ? null : t0;
290
- return useComponent(name, defaultComponent, BUTTONS_NAMESPACE);
291
- }
292
-
293
- /**
294
- * Pages hooks
295
- */
296
- function usePagesComponentsManager() {
297
- return useComponentsManager(PAGES_NAMESPACE);
298
- }
299
- function usePagesComponents(t0) {
300
- const $ = c(2);
301
- let t1;
302
- if ($[0] !== t0) {
303
- t1 = t0 === undefined ? {} : t0;
304
- $[0] = t0;
305
- $[1] = t1;
306
- } else {
307
- t1 = $[1];
308
- }
309
- const defaultComponents = t1;
310
- return useComponents(PAGES_NAMESPACE, defaultComponents);
311
- }
312
- function usePageComponent(name, t0) {
313
- const defaultComponent = t0 === undefined ? null : t0;
314
- return useComponent(name, defaultComponent, PAGES_NAMESPACE);
315
- }
316
-
317
- /**
318
- * Previews hooks
319
- */
320
- function usePreviewsComponentsManager() {
321
- return useComponentsManager(PREVIEWS_NAMESPACE);
322
- }
323
- function usePreviewsComponents(t0) {
324
- const $ = c(2);
325
- let t1;
326
- if ($[0] !== t0) {
327
- t1 = t0 === undefined ? {} : t0;
328
- $[0] = t0;
329
- $[1] = t1;
330
- } else {
331
- t1 = $[1];
332
- }
333
- const defaultComponents = t1;
334
- return useComponents(PREVIEWS_NAMESPACE, defaultComponents);
335
- }
336
- function usePreviewComponent(name, t0) {
337
- const defaultComponent = t0 === undefined ? null : t0;
338
- return useComponent(name, defaultComponent, PREVIEWS_NAMESPACE);
339
- }
340
-
341
- /**
342
- * App hooks
343
- */
344
- function useAppComponentsManager() {
345
- return useComponentsManager(APP_NAMESPACE);
346
- }
347
- function useAppComponents(t0) {
348
- const $ = c(2);
349
- let t1;
350
- if ($[0] !== t0) {
351
- t1 = t0 === undefined ? {} : t0;
352
- $[0] = t0;
353
- $[1] = t1;
354
- } else {
355
- t1 = $[1];
356
- }
357
- const defaultComponents = t1;
358
- return useComponents(APP_NAMESPACE, defaultComponents);
359
- }
360
- function useAppComponent(name, t0) {
361
- const defaultComponent = t0 === undefined ? null : t0;
362
- return useComponent(name, defaultComponent, APP_NAMESPACE);
363
- }
364
-
365
- /**
366
- * Provider
367
- */
368
-
369
- const DEFAULT_COMPONENTS$1 = {};
370
- function ComponentsProvider(t0) {
371
- const $ = c(8);
372
- const {
373
- components: t1,
374
- manager: t2,
375
- namespace: t3,
376
- children
377
- } = t0;
378
- const components = t1 === undefined ? DEFAULT_COMPONENTS$1 : t1;
379
- const manager = t2 === undefined ? null : t2;
380
- const namespace = t3 === undefined ? null : t3;
381
- const previousManager = useComponentsManager() || null;
382
- let t4;
383
- if ($[0] !== components || $[1] !== manager || $[2] !== namespace || $[3] !== previousManager) {
384
- t4 = new ComponentsManager({
385
- ...(previousManager !== null ? previousManager.getComponents() : null),
386
- ...(manager !== null ? manager.getComponents() : null),
387
- ...new ComponentsManager(components).addNamespace(namespace).getComponents()
388
- });
389
- $[0] = components;
390
- $[1] = manager;
391
- $[2] = namespace;
392
- $[3] = previousManager;
393
- $[4] = t4;
394
- } else {
395
- t4 = $[4];
396
- }
397
- const finalManager = t4;
398
- let t5;
399
- if ($[5] !== children || $[6] !== finalManager) {
400
- t5 = /*#__PURE__*/jsx(ComponentsContext, {
401
- value: finalManager,
402
- children: children
403
- });
404
- $[5] = children;
405
- $[6] = finalManager;
406
- $[7] = t5;
407
- } else {
408
- t5 = $[7];
409
- }
410
- return t5;
411
- }
412
-
413
- const DefinitionContext = /*#__PURE__*/createContext(null);
414
- function useDefinitionContext() {
415
- return useContext(DefinitionContext);
416
- }
417
- function useDefinition() {
418
- const definition = useDefinitionContext();
419
- return definition || null;
420
- }
421
- function DefinitionProvider(t0) {
422
- const $ = c(3);
423
- const {
424
- definition,
425
- children
426
- } = t0;
427
- let t1;
428
- if ($[0] !== children || $[1] !== definition) {
429
- t1 = /*#__PURE__*/jsx(DefinitionContext, {
430
- value: definition,
431
- children: children
432
- });
433
- $[0] = children;
434
- $[1] = definition;
435
- $[2] = t1;
436
- } else {
437
- t1 = $[2];
438
- }
439
- return t1;
440
- }
441
-
442
- const FieldsContext = /*#__PURE__*/createContext(null);
443
- function useFieldsManager() {
444
- return use(FieldsContext);
445
- }
446
- function useFieldDefinition(id) {
447
- const $ = c(3);
448
- const manager = useFieldsManager();
449
- let t0;
450
- if ($[0] !== id || $[1] !== manager) {
451
- t0 = manager.getDefinition(id);
452
- $[0] = id;
453
- $[1] = manager;
454
- $[2] = t0;
455
- } else {
456
- t0 = $[2];
457
- }
458
- return t0;
459
- }
460
- function useFieldDefinitions() {
461
- const $ = c(2);
462
- const manager = useFieldsManager();
463
- let t0;
464
- if ($[0] !== manager) {
465
- t0 = manager.getDefinitions();
466
- $[0] = manager;
467
- $[1] = t0;
468
- } else {
469
- t0 = $[1];
470
- }
471
- return t0;
472
- }
473
- function FieldsProvider(t0) {
474
- const $ = c(12);
475
- const {
476
- fields: t1,
477
- manager: t2,
478
- children
479
- } = t0;
480
- const fields = t1 === undefined ? null : t1;
481
- const manager = t2 === undefined ? null : t2;
482
- const previousManager = useFieldsManager() || null;
483
- let t3;
484
- if ($[0] !== fields || $[1] !== manager || $[2] !== previousManager) {
485
- const newFields = uniqBy([...(fields || []), ...(manager !== null ? manager.getDefinitions() : []), ...(previousManager !== null ? previousManager.getDefinitions() : [])], _temp$3).reverse();
486
- t3 = new FieldsManager(newFields);
487
- $[0] = fields;
488
- $[1] = manager;
489
- $[2] = previousManager;
490
- $[3] = t3;
491
- } else {
492
- t3 = $[3];
493
- }
494
- const finalManager = t3;
495
- let t4;
496
- if ($[4] !== finalManager) {
497
- const newComponents = finalManager.getComponents();
498
- t4 = Object.keys(newComponents).reduce((map, id_0) => {
499
- const component = newComponents[id_0];
500
- return isString(component) ? map : {
501
- ...map,
502
- [id_0]: component
503
- };
504
- }, {});
505
- $[4] = finalManager;
506
- $[5] = t4;
507
- } else {
508
- t4 = $[5];
509
- }
510
- const components = t4;
511
- let t5;
512
- if ($[6] !== children || $[7] !== components) {
513
- t5 = /*#__PURE__*/jsx(ComponentsProvider, {
514
- namespace: FIELDS_NAMESPACE,
515
- components: components,
516
- children: children
517
- });
518
- $[6] = children;
519
- $[7] = components;
520
- $[8] = t5;
521
- } else {
522
- t5 = $[8];
523
- }
524
- let t6;
525
- if ($[9] !== finalManager || $[10] !== t5) {
526
- t6 = /*#__PURE__*/jsx(FieldsContext, {
527
- value: finalManager,
528
- children: t5
529
- });
530
- $[9] = finalManager;
531
- $[10] = t5;
532
- $[11] = t6;
533
- } else {
534
- t6 = $[11];
535
- }
536
- return t6;
537
- }
538
- function _temp$3(t0) {
539
- const {
540
- id
541
- } = t0;
542
- return id;
543
- }
544
-
545
- const GoogleKeysContext = /*#__PURE__*/createContext({
546
- apiKey: null
547
- });
548
- function useGoogleKeys() {
549
- return useContext(GoogleKeysContext);
550
- }
551
- function GoogleKeysProvider(t0) {
552
- const $ = c(5);
553
- const {
554
- children,
555
- apiKey: t1
556
- } = t0;
557
- const apiKey = t1 === undefined ? null : t1;
558
- const {
559
- apiKey: previousApiKey
560
- } = useGoogleKeys();
561
- const t2 = apiKey || previousApiKey;
562
- let t3;
563
- if ($[0] !== t2) {
564
- t3 = {
565
- apiKey: t2
566
- };
567
- $[0] = t2;
568
- $[1] = t3;
569
- } else {
570
- t3 = $[1];
571
- }
572
- const value = t3;
573
- let t4;
574
- if ($[2] !== children || $[3] !== value) {
575
- t4 = /*#__PURE__*/jsx(GoogleKeysContext, {
576
- value: value,
577
- children: children
578
- });
579
- $[2] = children;
580
- $[3] = value;
581
- $[4] = t4;
582
- } else {
583
- t4 = $[4];
584
- }
585
- return t4;
586
- }
587
-
588
- const FontsContext = /*#__PURE__*/createContext({
589
- systemFonts: null,
590
- googleFonts: null,
591
- customFonts: null
592
- });
593
- function useGoogleFonts(t0) {
594
- const $ = c(7);
595
- let t1;
596
- if ($[0] !== t0) {
597
- t1 = t0 === undefined ? {} : t0;
598
- $[0] = t0;
599
- $[1] = t1;
600
- } else {
601
- t1 = $[1];
602
- }
603
- const {
604
- disabled: t2,
605
- setFonts: t3
606
- } = t1;
607
- const disabled = t2 === undefined ? false : t2;
608
- const setFonts = t3 === undefined ? null : t3;
609
- const {
610
- apiKey
611
- } = useGoogleKeys();
612
- const [googleFonts, setGoogleFonts] = useState(null);
613
- let t4;
614
- let t5;
615
- if ($[2] !== apiKey || $[3] !== disabled || $[4] !== setFonts) {
616
- t4 = () => {
617
- let canceled = false;
618
- if (apiKey !== null && !disabled) {
619
- getJSON(`https://www.googleapis.com/webfonts/v1/webfonts?key=${apiKey}&sort=popularity`).then(t6 => {
620
- const {
621
- items: t7
622
- } = t6;
623
- const items = t7 === undefined ? [] : t7;
624
- if (!canceled) {
625
- const newFonts = items.map(_temp$2);
626
- if (setFonts !== null) {
627
- setFonts(newFonts);
628
- } else {
629
- setGoogleFonts(newFonts);
630
- }
631
- }
632
- });
633
- }
634
- return () => {
635
- canceled = true;
636
- };
637
- };
638
- t5 = [apiKey, disabled, setFonts, setGoogleFonts];
639
- $[2] = apiKey;
640
- $[3] = disabled;
641
- $[4] = setFonts;
642
- $[5] = t4;
643
- $[6] = t5;
644
- } else {
645
- t4 = $[5];
646
- t5 = $[6];
647
- }
648
- useEffect(t4, t5);
649
- return googleFonts;
650
- }
651
- function _temp$2(it) {
652
- return {
653
- type: "google",
654
- name: it.family,
655
- variants: it.variants
656
- };
657
- }
658
- function useFonts(t0) {
659
- const $ = c(9);
660
- let t1;
661
- if ($[0] !== t0) {
662
- t1 = t0 === undefined ? {} : t0;
663
- $[0] = t0;
664
- $[1] = t1;
665
- } else {
666
- t1 = $[1];
667
- }
668
- const {
669
- withoutGoogleFonts: t2
670
- } = t1;
671
- const withoutGoogleFonts = t2 === undefined ? false : t2;
672
- const {
673
- setGoogleFonts: t3,
674
- systemFonts: t4,
675
- googleFonts: t5,
676
- customFonts: t6
677
- } = use(FontsContext);
678
- const setGoogleFonts = t3 === undefined ? null : t3;
679
- const systemFonts = t4 === undefined ? null : t4;
680
- const googleFonts = t5 === undefined ? null : t5;
681
- const customFonts = t6 === undefined ? null : t6;
682
- const t7 = withoutGoogleFonts || googleFonts !== null && googleFonts.length > 0;
683
- let t8;
684
- if ($[2] !== setGoogleFonts || $[3] !== t7) {
685
- t8 = {
686
- disabled: t7,
687
- setFonts: setGoogleFonts
688
- };
689
- $[2] = setGoogleFonts;
690
- $[3] = t7;
691
- $[4] = t8;
692
- } else {
693
- t8 = $[4];
694
- }
695
- useGoogleFonts(t8);
696
- let t9;
697
- if ($[5] !== customFonts || $[6] !== googleFonts || $[7] !== systemFonts) {
698
- t9 = {
699
- systemFonts,
700
- googleFonts,
701
- customFonts
702
- };
703
- $[5] = customFonts;
704
- $[6] = googleFonts;
705
- $[7] = systemFonts;
706
- $[8] = t9;
707
- } else {
708
- t9 = $[8];
709
- }
710
- const fonts = t9;
711
- return fonts;
712
- }
713
- const DEFAULT_SYSTEM_FONTS = ['Arial', 'Courier', 'Georgia', 'Times New Roman', 'Verdana'];
714
- function FontsProvider(t0) {
715
- const $ = c(16);
716
- const {
717
- systemFonts: t1,
718
- customFonts: t2,
719
- children
720
- } = t0;
721
- const systemFonts = t1 === undefined ? DEFAULT_SYSTEM_FONTS : t1;
722
- const customFonts = t2 === undefined ? null : t2;
723
- const {
724
- systemFonts: t3,
725
- googleFonts: t4,
726
- customFonts: t5
727
- } = useFonts();
728
- const previousSystemFonts = t3 === undefined ? null : t3;
729
- const previousGoogleFonts = t4 === undefined ? null : t4;
730
- const previousCustomFonts = t5 === undefined ? null : t5;
731
- const [googleFonts, setGoogleFonts] = useState(null);
732
- let t6;
733
- if ($[0] !== previousSystemFonts || $[1] !== systemFonts) {
734
- t6 = uniqBy([...(previousSystemFonts || []), ...(systemFonts || [])], _temp2);
735
- $[0] = previousSystemFonts;
736
- $[1] = systemFonts;
737
- $[2] = t6;
738
- } else {
739
- t6 = $[2];
740
- }
741
- let t7;
742
- if ($[3] !== googleFonts || $[4] !== previousGoogleFonts) {
743
- t7 = uniqBy([...(previousGoogleFonts || []), ...(googleFonts || [])], _temp3);
744
- $[3] = googleFonts;
745
- $[4] = previousGoogleFonts;
746
- $[5] = t7;
747
- } else {
748
- t7 = $[5];
749
- }
750
- let t8;
751
- if ($[6] !== customFonts || $[7] !== previousCustomFonts) {
752
- t8 = uniqBy([...(previousCustomFonts || []), ...(customFonts || [])], _temp4);
753
- $[6] = customFonts;
754
- $[7] = previousCustomFonts;
755
- $[8] = t8;
756
- } else {
757
- t8 = $[8];
758
- }
759
- let t9;
760
- if ($[9] !== t6 || $[10] !== t7 || $[11] !== t8) {
761
- t9 = {
762
- systemFonts: t6,
763
- googleFonts: t7,
764
- customFonts: t8,
765
- setGoogleFonts
766
- };
767
- $[9] = t6;
768
- $[10] = t7;
769
- $[11] = t8;
770
- $[12] = t9;
771
- } else {
772
- t9 = $[12];
773
- }
774
- const fonts = t9;
775
- let t10;
776
- if ($[13] !== children || $[14] !== fonts) {
777
- t10 = /*#__PURE__*/jsx(FontsContext, {
778
- value: fonts,
779
- children: children
780
- });
781
- $[13] = children;
782
- $[14] = fonts;
783
- $[15] = t10;
784
- } else {
785
- t10 = $[15];
786
- }
787
- return t10;
788
- }
789
- function _temp4(font_1) {
790
- return isObject(font_1) ? font_1.name : font_1;
791
- }
792
- function _temp3(font_0) {
793
- return isObject(font_0) ? font_0.name : font_0;
794
- }
795
- function _temp2(font) {
796
- return isObject(font) ? font.name : font;
797
- }
798
-
799
- const FormContext = /*#__PURE__*/createContext(null);
800
- function useFormContext() {
801
- return use(FormContext);
802
- }
803
- function useFormValue() {
804
- const {
805
- value
806
- } = useFormContext();
807
- return value;
808
- }
809
- function useFormSetValue() {
810
- const {
811
- setValue
812
- } = useFormContext();
813
- return setValue;
814
- }
815
- function FormProvider(t0) {
816
- const $ = c(6);
817
- const {
818
- value,
819
- setValue,
820
- children
821
- } = t0;
822
- let t1;
823
- if ($[0] !== setValue || $[1] !== value) {
824
- t1 = {
825
- value,
826
- setValue
827
- };
828
- $[0] = setValue;
829
- $[1] = value;
830
- $[2] = t1;
831
- } else {
832
- t1 = $[2];
833
- }
834
- const values = t1;
835
- let t2;
836
- if ($[3] !== children || $[4] !== values) {
837
- t2 = /*#__PURE__*/jsx(FormContext, {
838
- value: values,
839
- children: children
840
- });
841
- $[3] = children;
842
- $[4] = values;
843
- $[5] = t2;
844
- } else {
845
- t2 = $[5];
846
- }
847
- return t2;
848
- }
849
-
850
- const FormsContext = /*#__PURE__*/createContext(null);
851
- function useFormsManager() {
852
- return use(FormsContext);
853
- }
854
- function useFormDefinition(id) {
855
- const $ = c(3);
856
- const manager = useFormsManager();
857
- let t0;
858
- if ($[0] !== id || $[1] !== manager) {
859
- t0 = manager.getDefinition(id);
860
- $[0] = id;
861
- $[1] = manager;
862
- $[2] = t0;
863
- } else {
864
- t0 = $[2];
865
- }
866
- return t0;
867
- }
868
- function useFormDefinitions() {
869
- const $ = c(2);
870
- const manager = useFormsManager();
871
- let t0;
872
- if ($[0] !== manager) {
873
- t0 = manager.getDefinitions();
874
- $[0] = manager;
875
- $[1] = t0;
876
- } else {
877
- t0 = $[1];
878
- }
879
- return t0;
880
- }
881
- function FormsProvider(t0) {
882
- const $ = c(12);
883
- const {
884
- forms: t1,
885
- manager: t2,
886
- children
887
- } = t0;
888
- const forms = t1 === undefined ? null : t1;
889
- const manager = t2 === undefined ? null : t2;
890
- const previousManager = useFormsManager() || null;
891
- let t3;
892
- if ($[0] !== forms || $[1] !== manager || $[2] !== previousManager) {
893
- const newForms = uniqBy([...(forms || []), ...(manager !== null ? manager.getDefinitions() : []), ...(previousManager !== null ? previousManager.getDefinitions() : [])], _temp$1).reverse();
894
- t3 = new FormsManager(newForms);
895
- $[0] = forms;
896
- $[1] = manager;
897
- $[2] = previousManager;
898
- $[3] = t3;
899
- } else {
900
- t3 = $[3];
901
- }
902
- const finalManager = t3;
903
- let t4;
904
- if ($[4] !== finalManager) {
905
- const newComponents = finalManager.getComponents();
906
- t4 = Object.keys(newComponents).reduce((map, id_0) => {
907
- const component = newComponents[id_0];
908
- return isString(component) ? map : {
909
- ...map,
910
- [id_0]: component
911
- };
912
- }, {});
913
- $[4] = finalManager;
914
- $[5] = t4;
915
- } else {
916
- t4 = $[5];
917
- }
918
- const components = t4;
919
- let t5;
920
- if ($[6] !== children || $[7] !== components) {
921
- t5 = /*#__PURE__*/jsx(ComponentsProvider, {
922
- namespace: FORMS_NAMESPACE,
923
- components: components,
924
- children: children
925
- });
926
- $[6] = children;
927
- $[7] = components;
928
- $[8] = t5;
929
- } else {
930
- t5 = $[8];
931
- }
932
- let t6;
933
- if ($[9] !== finalManager || $[10] !== t5) {
934
- t6 = /*#__PURE__*/jsx(FormsContext, {
935
- value: finalManager,
936
- children: t5
937
- });
938
- $[9] = finalManager;
939
- $[10] = t5;
940
- $[11] = t6;
941
- } else {
942
- t6 = $[11];
943
- }
944
- return t6;
945
- }
946
- function _temp$1(t0) {
947
- const {
948
- id
949
- } = t0;
950
- return id;
951
- }
952
-
953
- const GoogleApiClientContext = /*#__PURE__*/createContext(null);
954
- function useGoogleApiClient() {
955
- return useContext(GoogleApiClientContext);
956
- }
957
- function withGoogleApiClient(WrappedComponent) {
958
- function getDisplayName({
959
- displayName = null,
960
- name = null
961
- }) {
962
- return displayName || name || 'Component';
963
- }
964
- function WithGoogleApiClientComponent(props) {
965
- const $ = c(2);
966
- let t0;
967
- if ($[0] !== props) {
968
- t0 = /*#__PURE__*/jsx(GoogleApiClientContext.Consumer, {
969
- children: client => /*#__PURE__*/jsx(WrappedComponent, {
970
- googleApiClient: client,
971
- ...props
972
- })
973
- });
974
- $[0] = props;
975
- $[1] = t0;
976
- } else {
977
- t0 = $[1];
978
- }
979
- return t0;
980
- }
981
- WithGoogleApiClientComponent.displayName = `WithGoogleApiClient(${getDisplayName(WrappedComponent)})`;
982
- return WithGoogleApiClientComponent;
983
- }
984
-
985
- // Minimal shape of the Google API (gapi) object used here, @folklore/services types it as unknown
986
-
987
- function GoogleApiClientProvider(t0) {
988
- const $ = c(6);
989
- const {
990
- children
991
- } = t0;
992
- const {
993
- apiKey
994
- } = useGoogleKeys();
995
- const [client, setClient] = useState(null);
996
- let t1;
997
- let t2;
998
- if ($[0] !== apiKey) {
999
- t1 = () => {
1000
- loadGoogleApi().then(gapi => gapi.client.init({
1001
- apiKey
1002
- }).then(() => gapi)).then(gapi_0 => setClient(gapi_0));
1003
- };
1004
- t2 = [apiKey, setClient];
1005
- $[0] = apiKey;
1006
- $[1] = t1;
1007
- $[2] = t2;
1008
- } else {
1009
- t1 = $[1];
1010
- t2 = $[2];
1011
- }
1012
- useEffect(t1, t2);
1013
- let t3;
1014
- if ($[3] !== children || $[4] !== client) {
1015
- t3 = /*#__PURE__*/jsx(GoogleApiClientContext, {
1016
- value: client,
1017
- children: children
1018
- });
1019
- $[3] = children;
1020
- $[4] = client;
1021
- $[5] = t3;
1022
- } else {
1023
- t3 = $[5];
1024
- }
1025
- return t3;
1026
- }
1027
-
1028
- const GoogleMapsClientContext = /*#__PURE__*/createContext(null);
1029
- function useGoogleMapsClient() {
1030
- return useContext(GoogleMapsClientContext);
1031
- }
1032
- function withGoogleMapsClient(WrappedComponent) {
1033
- function getDisplayName({
1034
- displayName = null,
1035
- name = null
1036
- }) {
1037
- return displayName || name || 'Component';
1038
- }
1039
- function WithGoogleMapsClientComponent(props) {
1040
- const $ = c(2);
1041
- let t0;
1042
- if ($[0] !== props) {
1043
- t0 = /*#__PURE__*/jsx(GoogleMapsClientContext.Consumer, {
1044
- children: client => /*#__PURE__*/jsx(WrappedComponent, {
1045
- googleMapsClient: client,
1046
- ...props
1047
- })
1048
- });
1049
- $[0] = props;
1050
- $[1] = t0;
1051
- } else {
1052
- t0 = $[1];
1053
- }
1054
- return t0;
1055
- }
1056
- WithGoogleMapsClientComponent.displayName = `WithGoogleMapsClient(${getDisplayName(WrappedComponent)})`;
1057
- return WithGoogleMapsClientComponent;
1058
- }
1059
- function GoogleMapsClientProvider(t0) {
1060
- const $ = c(9);
1061
- const {
1062
- children,
1063
- locale: t1,
1064
- libraries: t2
1065
- } = t0;
1066
- const locale = t1 === undefined ? "fr" : t1;
1067
- const libraries = t2 === undefined ? null : t2;
1068
- const {
1069
- apiKey
1070
- } = useGoogleKeys();
1071
- const exisitingClient = useGoogleMapsClient();
1072
- const [client, setClient] = useState(exisitingClient);
1073
- let t3;
1074
- let t4;
1075
- if ($[0] !== apiKey || $[1] !== exisitingClient || $[2] !== libraries || $[3] !== locale) {
1076
- t3 = () => {
1077
- if (exisitingClient === null) {
1078
- loadGoogleMaps({
1079
- apiKey,
1080
- locale,
1081
- libraries
1082
- }).then(newClient => {
1083
- setClient(newClient);
1084
- });
1085
- }
1086
- };
1087
- t4 = [apiKey, locale, libraries, setClient, exisitingClient];
1088
- $[0] = apiKey;
1089
- $[1] = exisitingClient;
1090
- $[2] = libraries;
1091
- $[3] = locale;
1092
- $[4] = t3;
1093
- $[5] = t4;
1094
- } else {
1095
- t3 = $[4];
1096
- t4 = $[5];
1097
- }
1098
- useEffect(t3, t4);
1099
- let t5;
1100
- if ($[6] !== children || $[7] !== client) {
1101
- t5 = /*#__PURE__*/jsx(GoogleMapsClientContext, {
1102
- value: client,
1103
- children: children
1104
- });
1105
- $[6] = children;
1106
- $[7] = client;
1107
- $[8] = t5;
1108
- } else {
1109
- t5 = $[8];
1110
- }
1111
- return t5;
1112
- }
1113
-
1114
- const defaultLocales = ['en', 'fr'];
1115
- const LocalesContext = /*#__PURE__*/createContext({
1116
- locales: defaultLocales
1117
- });
1118
- function useLocalesContext() {
1119
- const context = useContext(LocalesContext);
1120
- return context;
1121
- }
1122
- function useLocales() {
1123
- const {
1124
- locales
1125
- } = useLocalesContext();
1126
- return locales;
1127
- }
1128
- function useOtherLocales() {
1129
- const $ = c(5);
1130
- const {
1131
- locales
1132
- } = useLocalesContext();
1133
- const {
1134
- locale
1135
- } = useIntl();
1136
- let t0;
1137
- if ($[0] !== locale || $[1] !== locales) {
1138
- let t1;
1139
- if ($[3] !== locale) {
1140
- t1 = it => it !== locale;
1141
- $[3] = locale;
1142
- $[4] = t1;
1143
- } else {
1144
- t1 = $[4];
1145
- }
1146
- t0 = locales.filter(t1);
1147
- $[0] = locale;
1148
- $[1] = locales;
1149
- $[2] = t0;
1150
- } else {
1151
- t0 = $[2];
1152
- }
1153
- const otherLocales = t0;
1154
- return otherLocales;
1155
- }
1156
- const DEFAULT_LOCALES = [];
1157
- function LocalesProvider(t0) {
1158
- const $ = c(5);
1159
- const {
1160
- locales: t1,
1161
- children
1162
- } = t0;
1163
- const locales = t1 === undefined ? DEFAULT_LOCALES : t1;
1164
- let t2;
1165
- if ($[0] !== locales) {
1166
- t2 = {
1167
- locales
1168
- };
1169
- $[0] = locales;
1170
- $[1] = t2;
1171
- } else {
1172
- t2 = $[1];
1173
- }
1174
- const value = t2;
1175
- let t3;
1176
- if ($[2] !== children || $[3] !== value) {
1177
- t3 = /*#__PURE__*/jsx(LocalesContext, {
1178
- value: value,
1179
- children: children
1180
- });
1181
- $[2] = children;
1182
- $[3] = value;
1183
- $[4] = t3;
1184
- } else {
1185
- t3 = $[4];
1186
- }
1187
- return t3;
1188
- }
1189
-
1190
- const ModalContext = /*#__PURE__*/createContext(null);
1191
- function useModal() {
1192
- return useContext(ModalContext) || {};
1193
- }
1194
- const DEFAULT_MODALS = [];
1195
- function ModalProvider(t0) {
1196
- const $ = c(17);
1197
- const {
1198
- children,
1199
- container: t1
1200
- } = t0;
1201
- const initialContainer = t1 === undefined ? null : t1;
1202
- const [container, setContainer] = useState(initialContainer);
1203
- const [modals, setModals] = useState(DEFAULT_MODALS);
1204
- const modalsRef = useRef(modals);
1205
- let t2;
1206
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
1207
- t2 = (id, t3) => {
1208
- const data = t3 === undefined ? null : t3;
1209
- const {
1210
- current: t4
1211
- } = modalsRef;
1212
- const currentModals = t4 === undefined ? [] : t4;
1213
- const newModals = [...currentModals, {
1214
- id,
1215
- ...data
1216
- }];
1217
- setModals(newModals);
1218
- modalsRef.current = newModals;
1219
- };
1220
- $[0] = t2;
1221
- } else {
1222
- t2 = $[0];
1223
- }
1224
- const register = t2;
1225
- let t3;
1226
- if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
1227
- t3 = t4 => {
1228
- const id_0 = t4 === undefined ? null : t4;
1229
- const {
1230
- current: t5
1231
- } = modalsRef;
1232
- const currentModals_0 = t5 === undefined ? [] : t5;
1233
- const foundIndex = currentModals_0.findIndex(t6 => {
1234
- const {
1235
- id: modalId
1236
- } = t6;
1237
- return modalId === id_0;
1238
- });
1239
- if (foundIndex !== -1) {
1240
- const newModals_0 = currentModals_0.filter(t7 => {
1241
- const {
1242
- id: modalId_0
1243
- } = t7;
1244
- return modalId_0 !== id_0;
1245
- });
1246
- setModals(newModals_0);
1247
- modalsRef.current = newModals_0;
1248
- }
1249
- };
1250
- $[1] = t3;
1251
- } else {
1252
- t3 = $[1];
1253
- }
1254
- const unregister = t3;
1255
- let t4;
1256
- if ($[2] !== modals) {
1257
- t4 = id_1 => {
1258
- const {
1259
- requestClose: t6
1260
- } = modals.find(t5 => {
1261
- const {
1262
- id: modalId_1
1263
- } = t5;
1264
- return modalId_1 === id_1;
1265
- }) || {};
1266
- const requestClose = t6 === undefined ? null : t6;
1267
- if (requestClose !== null) {
1268
- requestClose();
1269
- }
1270
- };
1271
- $[2] = modals;
1272
- $[3] = t4;
1273
- } else {
1274
- t4 = $[3];
1275
- }
1276
- const closeModal = t4;
1277
- let t5;
1278
- if ($[4] !== modals) {
1279
- t5 = () => {
1280
- const {
1281
- requestClose: t6
1282
- } = modals !== null && modals.length > 0 ? modals[modals.length - 1] || {} : {};
1283
- const requestClose_0 = t6 === undefined ? null : t6;
1284
- if (requestClose_0 !== null) {
1285
- requestClose_0();
1286
- }
1287
- };
1288
- $[4] = modals;
1289
- $[5] = t5;
1290
- } else {
1291
- t5 = $[5];
1292
- }
1293
- const closeLastModal = t5;
1294
- let t6;
1295
- if ($[6] !== modals) {
1296
- t6 = modalId_2 => (modals || []).find(modal => modal?.id === modalId_2) || null;
1297
- $[6] = modals;
1298
- $[7] = t6;
1299
- } else {
1300
- t6 = $[7];
1301
- }
1302
- const getModalById = t6;
1303
- let t7;
1304
- if ($[8] !== closeLastModal || $[9] !== closeModal || $[10] !== container || $[11] !== getModalById || $[12] !== modals) {
1305
- t7 = {
1306
- modals,
1307
- container,
1308
- setContainer,
1309
- register,
1310
- unregister,
1311
- closeModal,
1312
- closeLastModal,
1313
- getModalById
1314
- };
1315
- $[8] = closeLastModal;
1316
- $[9] = closeModal;
1317
- $[10] = container;
1318
- $[11] = getModalById;
1319
- $[12] = modals;
1320
- $[13] = t7;
1321
- } else {
1322
- t7 = $[13];
1323
- }
1324
- const value = t7;
1325
- let t8;
1326
- if ($[14] !== children || $[15] !== value) {
1327
- t8 = /*#__PURE__*/jsx(ModalContext, {
1328
- value: value,
1329
- children: children
1330
- });
1331
- $[14] = children;
1332
- $[15] = value;
1333
- $[16] = t8;
1334
- } else {
1335
- t8 = $[16];
1336
- }
1337
- return t8;
1338
- }
1339
-
1340
- const PanelsContext = /*#__PURE__*/createContext({
1341
- panels: [],
1342
- container: null,
1343
- setContainer: () => {},
1344
- register: () => {},
1345
- unregister: () => {}
1346
- });
1347
- function usePanels() {
1348
- return useContext(PanelsContext);
1349
- }
1350
- function withPanels(WrappedComponent) {
1351
- function WithPanelsComponent(props) {
1352
- const $ = c(2);
1353
- let t0;
1354
- if ($[0] !== props) {
1355
- t0 = /*#__PURE__*/jsx(PanelsContext.Consumer, {
1356
- children: t1 => {
1357
- const {
1358
- panels,
1359
- setContainer,
1360
- container,
1361
- register,
1362
- unregister
1363
- } = t1;
1364
- return /*#__PURE__*/jsx(WrappedComponent, {
1365
- panelsContainer: container,
1366
- setPanelsContainer: setContainer,
1367
- panels: panels,
1368
- registerPanel: register,
1369
- unregisterPanel: unregister,
1370
- ...props
1371
- });
1372
- }
1373
- });
1374
- $[0] = props;
1375
- $[1] = t0;
1376
- } else {
1377
- t0 = $[1];
1378
- }
1379
- return t0;
1380
- }
1381
- WithPanelsComponent.displayName = `WithPanels(${getDisplayName(WrappedComponent)})`;
1382
- return WithPanelsComponent;
1383
- }
1384
- function PanelsProvider(t0) {
1385
- const $ = c(9);
1386
- const {
1387
- children,
1388
- container: t1
1389
- } = t0;
1390
- const initialContainer = t1 === undefined ? null : t1;
1391
- const [container, setContainer] = useState(initialContainer);
1392
- let t2;
1393
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
1394
- t2 = [];
1395
- $[0] = t2;
1396
- } else {
1397
- t2 = $[0];
1398
- }
1399
- const [panels, setPanels] = useState(t2);
1400
- const panelsRef = useRef(panels);
1401
- let t3;
1402
- if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
1403
- t3 = (id, t4) => {
1404
- const data = t4 === undefined ? null : t4;
1405
- const {
1406
- current: currentPanels
1407
- } = panelsRef;
1408
- const newPanels = [...currentPanels, {
1409
- id,
1410
- ...data
1411
- }];
1412
- setPanels(newPanels);
1413
- panelsRef.current = newPanels;
1414
- };
1415
- $[1] = t3;
1416
- } else {
1417
- t3 = $[1];
1418
- }
1419
- const register = t3;
1420
- let t4;
1421
- if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
1422
- t4 = id_0 => {
1423
- const {
1424
- current: currentPanels_0
1425
- } = panelsRef;
1426
- const foundIndex = currentPanels_0.findIndex(t5 => {
1427
- const {
1428
- id: modalId
1429
- } = t5;
1430
- return modalId === id_0;
1431
- });
1432
- if (foundIndex !== -1) {
1433
- const newPanels_0 = currentPanels_0.filter(t6 => {
1434
- const {
1435
- id: modalId_0
1436
- } = t6;
1437
- return modalId_0 !== id_0;
1438
- });
1439
- setPanels(newPanels_0);
1440
- panelsRef.current = newPanels_0;
1441
- }
1442
- };
1443
- $[2] = t4;
1444
- } else {
1445
- t4 = $[2];
1446
- }
1447
- const unregister = t4;
1448
- let t5;
1449
- if ($[3] !== container || $[4] !== panels) {
1450
- t5 = {
1451
- panels,
1452
- setContainer,
1453
- container,
1454
- register,
1455
- unregister
1456
- };
1457
- $[3] = container;
1458
- $[4] = panels;
1459
- $[5] = t5;
1460
- } else {
1461
- t5 = $[5];
1462
- }
1463
- const value = t5;
1464
- let t6;
1465
- if ($[6] !== children || $[7] !== value) {
1466
- t6 = /*#__PURE__*/jsx(PanelsContext, {
1467
- value: value,
1468
- children: children
1469
- });
1470
- $[6] = children;
1471
- $[7] = value;
1472
- $[8] = t6;
1473
- } else {
1474
- t6 = $[8];
1475
- }
1476
- return t6;
1477
- }
1478
-
1479
- const PanneauContext = /*#__PURE__*/createContext(null);
1480
- function usePanneau() {
1481
- return useContext(PanneauContext);
1482
- }
1483
- const DEFAULT_RESOURCES = [];
1484
- function usePanneauResources() {
1485
- const {
1486
- resources: t0
1487
- } = usePanneau() || {};
1488
- const resources = t0 === undefined ? DEFAULT_RESOURCES : t0;
1489
- return resources;
1490
- }
1491
- function usePanneauResource(id) {
1492
- const $ = c(3);
1493
- const resources = usePanneauResources();
1494
- if (isObject(id)) {
1495
- return id;
1496
- }
1497
- let t0;
1498
- if ($[0] !== id || $[1] !== resources) {
1499
- t0 = id !== null ? resources.find(it => it.id === id) || null : null;
1500
- $[0] = id;
1501
- $[1] = resources;
1502
- $[2] = t0;
1503
- } else {
1504
- t0 = $[2];
1505
- }
1506
- return t0;
1507
- }
1508
- function usePanneauColorScheme() {
1509
- const $ = c(6);
1510
- const {
1511
- theme: t0
1512
- } = usePanneau() || {};
1513
- const theme = t0 === undefined ? null : t0;
1514
- let t1;
1515
- if ($[0] !== theme) {
1516
- t1 = theme || {};
1517
- $[0] = theme;
1518
- $[1] = t1;
1519
- } else {
1520
- t1 = $[1];
1521
- }
1522
- const {
1523
- colorScheme: t2
1524
- } = t1;
1525
- const colorScheme = t2 === undefined ? "light" : t2;
1526
- if (colorScheme === null || colorScheme === "light" || colorScheme === "dark") {
1527
- let t3;
1528
- if ($[2] !== colorScheme) {
1529
- t3 = colorScheme === "dark" ? {
1530
- theme: "dark",
1531
- background: "dark",
1532
- text: "light"
1533
- } : {
1534
- theme: "light",
1535
- background: "light",
1536
- text: "dark"
1537
- };
1538
- $[2] = colorScheme;
1539
- $[3] = t3;
1540
- } else {
1541
- t3 = $[3];
1542
- }
1543
- return t3;
1544
- }
1545
- let t3;
1546
- if ($[4] !== colorScheme) {
1547
- t3 = {
1548
- theme: colorScheme,
1549
- background: null,
1550
- text: null
1551
- };
1552
- $[4] = colorScheme;
1553
- $[5] = t3;
1554
- } else {
1555
- t3 = $[5];
1556
- }
1557
- return t3;
1558
- }
1559
- const DEFAULT_COMPONENTS = {};
1560
-
1561
- /** @deprecated The `components` key of the definition is not supported */
1562
- function usePanneauComponents() {
1563
- const {
1564
- components: t0
1565
- } = usePanneau() || {};
1566
- const components = t0 === undefined ? DEFAULT_COMPONENTS : t0;
1567
- return components;
1568
- }
1569
-
1570
- /** @deprecated The `components` key of the definition is not supported */
1571
- function usePanneauComponent(namespace, name) {
1572
- const $ = c(2);
1573
- const {
1574
- components: t0
1575
- } = usePanneau() || {};
1576
- let t1;
1577
- if ($[0] !== t0) {
1578
- t1 = t0 === undefined ? {} : t0;
1579
- $[0] = t0;
1580
- $[1] = t1;
1581
- } else {
1582
- t1 = $[1];
1583
- }
1584
- const components = t1;
1585
- const path = namespace !== null ? `${namespace}.${name}` : name || null;
1586
- const component = path !== null ? components[path] || null : null;
1587
- if (isString(component)) {
1588
- return component;
1589
- }
1590
- if (isObject(component) && isString(component?.component)) {
1591
- return component.component;
1592
- }
1593
- return null;
1594
- }
1595
- function usePanneauAuth() {
1596
- const $ = c(2);
1597
- const {
1598
- auth: t0
1599
- } = usePanneau() || {};
1600
- let t1;
1601
- if ($[0] !== t0) {
1602
- t1 = t0 === undefined ? {} : t0;
1603
- $[0] = t0;
1604
- $[1] = t1;
1605
- } else {
1606
- t1 = $[1];
1607
- }
1608
- const auth = t1;
1609
- return auth;
1610
- }
1611
- function usePanneauSettings() {
1612
- const $ = c(2);
1613
- const {
1614
- settings: t0
1615
- } = usePanneau() || {};
1616
- let t1;
1617
- if ($[0] !== t0) {
1618
- t1 = t0 === undefined ? {} : t0;
1619
- $[0] = t0;
1620
- $[1] = t1;
1621
- } else {
1622
- t1 = $[1];
1623
- }
1624
- const settings = t1;
1625
- return settings;
1626
- }
1627
- function PanneauProvider(t0) {
1628
- const $ = c(6);
1629
- const {
1630
- definition,
1631
- children
1632
- } = t0;
1633
- let t1;
1634
- let t2;
1635
- if ($[0] !== definition) {
1636
- t1 = () => {
1637
- };
1638
- t2 = [definition];
1639
- $[0] = definition;
1640
- $[1] = t1;
1641
- $[2] = t2;
1642
- } else {
1643
- t1 = $[1];
1644
- t2 = $[2];
1645
- }
1646
- useEffect(t1, t2);
1647
- let t3;
1648
- if ($[3] !== children || $[4] !== definition) {
1649
- t3 = /*#__PURE__*/jsx(PanneauContext, {
1650
- value: definition,
1651
- children: children
1652
- });
1653
- $[3] = children;
1654
- $[4] = definition;
1655
- $[5] = t3;
1656
- } else {
1657
- t3 = $[5];
1658
- }
1659
- return t3;
1660
- }
1661
-
1662
- const ResourceContext = /*#__PURE__*/createContext(null);
1663
- function useResource() {
1664
- return use(ResourceContext);
1665
- }
1666
- function ResourceProvider(t0) {
1667
- const $ = c(3);
1668
- const {
1669
- resource,
1670
- children
1671
- } = t0;
1672
- let t1;
1673
- if ($[0] !== children || $[1] !== resource) {
1674
- t1 = /*#__PURE__*/jsx(ResourceContext, {
1675
- value: resource,
1676
- children: children
1677
- });
1678
- $[0] = children;
1679
- $[1] = resource;
1680
- $[2] = t1;
1681
- } else {
1682
- t1 = $[2];
1683
- }
1684
- return t1;
1685
- }
1686
-
1687
- function useRoutePush() {
1688
- const $ = c(3);
1689
- const url = useUrlGenerator();
1690
- const [, navigate] = useLocation();
1691
- let t0;
1692
- if ($[0] !== navigate || $[1] !== url) {
1693
- t0 = (route, data, ...t1) => {
1694
- const args = t1;
1695
- if (isString(route)) {
1696
- navigate(url(route, data), ...args);
1697
- } else {
1698
- const {
1699
- pathname: t2,
1700
- search: t3
1701
- } = route || {};
1702
- const pathname = t2 === undefined ? null : t2;
1703
- const search = t3 === undefined ? null : t3;
1704
- navigate(`${url(pathname, data)}${search !== null ? `?${search}` : ""}`, ...args);
1705
- }
1706
- };
1707
- $[0] = navigate;
1708
- $[1] = url;
1709
- $[2] = t0;
1710
- } else {
1711
- t0 = $[2];
1712
- }
1713
- const push = t0;
1714
- return push;
1715
- }
1716
- function useRouteBack() {
1717
- const back = _temp;
1718
- return back;
1719
- }
1720
- function _temp() {
1721
- if (typeof window !== "undefined") {
1722
- window.history.back();
1723
- }
1724
- }
1725
-
1726
- function useTracking() {
1727
- return useContext(TrackingContext);
1728
- }
1729
- function TrackingProvider(t0) {
1730
- const $ = c(5);
1731
- const {
1732
- variables: t1,
1733
- children
1734
- } = t0;
1735
- const variables = t1 === undefined ? null : t1;
1736
- const contextTracking = useTracking() || null;
1737
- let t2;
1738
- bb0: {
1739
- if (contextTracking !== null) {
1740
- contextTracking.setVariables(variables);
1741
- t2 = contextTracking;
1742
- break bb0;
1743
- }
1744
- let t3;
1745
- if ($[0] !== variables) {
1746
- t3 = new Tracking({
1747
- variables
1748
- });
1749
- $[0] = variables;
1750
- $[1] = t3;
1751
- } else {
1752
- t3 = $[1];
1753
- }
1754
- t2 = t3;
1755
- }
1756
- const tracking = t2;
1757
- let t3;
1758
- if ($[2] !== children || $[3] !== tracking) {
1759
- t3 = /*#__PURE__*/jsx(TrackingContainer, {
1760
- tracking: tracking,
1761
- children: children
1762
- });
1763
- $[2] = children;
1764
- $[3] = tracking;
1765
- $[4] = t3;
1766
- } else {
1767
- t3 = $[4];
1768
- }
1769
- return t3;
1770
- }
1771
-
1772
- export { ACTIONS_NAMESPACE, APP_NAMESPACE, BUTTONS_NAMESPACE, ComponentsContext, ComponentsProvider, DISPLAYS_NAMESPACE, DefinitionProvider, FIELDS_NAMESPACE, FILTERS_NAMESPACE, FORMS_NAMESPACE, FieldsContext, FieldsProvider, FontsContext, FontsProvider, FormProvider, FormsContext, FormsProvider, 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, useFieldComponent, useFieldDefinition, useFieldDefinitions, useFieldsComponents, useFieldsComponentsManager, useFieldsManager, useFilterComponent, useFiltersComponents, useFiltersComponentsManager, useFonts, useFormComponent, useFormContext, useFormDefinition, useFormDefinitions, useFormSetValue, useFormValue, useFormsComponents, useFormsComponentsManager, useFormsManager, 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 };