@gaddario98/react-core 2.0.0 → 2.0.2

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 (45) hide show
  1. package/dist/form/index.js +4566 -1
  2. package/dist/form/index.js.map +1 -1
  3. package/dist/form/index.mjs +4566 -1
  4. package/dist/form/index.mjs.map +1 -1
  5. package/dist/index.d.ts +2152 -7
  6. package/dist/index.js +20713 -1
  7. package/dist/index.js.map +1 -1
  8. package/dist/index.mjs +20713 -1
  9. package/dist/index.mjs.map +1 -1
  10. package/dist/localization/index.js +318 -1
  11. package/dist/localization/index.js.map +1 -1
  12. package/dist/localization/index.mjs +318 -1
  13. package/dist/localization/index.mjs.map +1 -1
  14. package/dist/notifications/index.js +84 -0
  15. package/dist/notifications/index.js.map +1 -0
  16. package/dist/notifications/index.mjs +84 -0
  17. package/dist/notifications/index.mjs.map +1 -0
  18. package/dist/pages/index.js +4652 -1
  19. package/dist/pages/index.js.map +1 -1
  20. package/dist/pages/index.mjs +4652 -1
  21. package/dist/pages/index.mjs.map +1 -1
  22. package/dist/providers/index.d.ts +12 -1
  23. package/dist/providers/index.js +17 -1
  24. package/dist/providers/index.js.map +1 -1
  25. package/dist/providers/index.mjs +17 -1
  26. package/dist/providers/index.mjs.map +1 -1
  27. package/dist/queries/index.js +8903 -1
  28. package/dist/queries/index.js.map +1 -1
  29. package/dist/queries/index.mjs +8903 -1
  30. package/dist/queries/index.mjs.map +1 -1
  31. package/dist/state/index.js +1927 -1
  32. package/dist/state/index.js.map +1 -1
  33. package/dist/state/index.mjs +1927 -1
  34. package/dist/state/index.mjs.map +1 -1
  35. package/dist/utiles/index.d.ts +15 -1
  36. package/dist/utiles/index.js +2973 -1
  37. package/dist/utiles/index.js.map +1 -1
  38. package/dist/utiles/index.mjs +2973 -1
  39. package/dist/utiles/index.mjs.map +1 -1
  40. package/package.json +12 -6
  41. package/dist/form/index.d.ts +0 -1
  42. package/dist/localization/index.d.ts +0 -1
  43. package/dist/pages/index.d.ts +0 -1
  44. package/dist/queries/index.d.ts +0 -1
  45. package/dist/state/index.d.ts +0 -1
package/dist/index.d.ts CHANGED
@@ -1,8 +1,2153 @@
1
+ import { AuthState } from '@gaddario98/react-auth';
1
2
  export * from '@gaddario98/react-auth';
2
- export * from '@gaddario98/react-pages';
3
- export * from '@gaddario98/react-form';
4
- export * from '@gaddario98/react-localization';
5
- export * from '@gaddario98/react-providers';
6
- export * from '@gaddario98/react-queries';
7
- export * from '@gaddario98/react-state';
8
- export * from '@gaddario98/utiles';
3
+ import * as react_jsx_runtime from 'react/jsx-runtime';
4
+ import * as _gaddario98_react_form from '@gaddario98/react-form';
5
+ import { FieldValues as FieldValues$1, FormManagerConfig as FormManagerConfig$1, Submit as Submit$1, SetValueFunction as SetValueFunction$1, FormManager as FormManager$1, SubmitKeysArg as SubmitKeysArg$1, FormElements as FormElements$1 } from '@gaddario98/react-form';
6
+ import { QueriesArray as QueriesArray$1, MultipleQueryResponse as MultipleQueryResponse$1, AllMutation as AllMutation$1, QueryDefinition as QueryDefinition$1, MutationConfig as MutationConfig$1, QueryProps as QueryProps$1, QueryAtIndex as QueryAtIndex$1, ExtractQuery as ExtractQuery$1 } from '@gaddario98/react-queries';
7
+ import * as _tanstack_react_form from '@tanstack/react-form';
8
+ import { DeepKeys, DeepValue, FormOptions, FieldApi, FieldState, ReactFormExtendedApi } from '@tanstack/react-form';
9
+ import * as React$1 from 'react';
10
+ import React__default, { ComponentProps, PropsWithChildren, JSX as JSX$1, ReactNode } from 'react';
11
+ import * as _gaddario98_react_state from '@gaddario98/react-state';
12
+ import * as jotai_family from 'jotai-family';
13
+ import * as jotai from 'jotai';
14
+ import { PrimitiveAtom } from 'jotai';
15
+ export { PrimitiveAtom } from 'jotai';
16
+ import * as jotai_utils from 'jotai/utils';
17
+ import * as _tanstack_react_query from '@tanstack/react-query';
18
+ import { UseQueryOptions, useQuery, UseMutationOptions, MutateOptions, useMutation, UseMutationResult, QueryClient } from '@tanstack/react-query';
19
+ import { NotificationConfig } from '@gaddario98/react-notifications';
20
+ import { AxiosRequestConfig } from 'axios';
21
+ import { PersistQueryClientOptions } from '@tanstack/react-query-persist-client';
22
+ import { ClassValue } from 'clsx';
23
+
24
+ /**
25
+ * Metadata Configuration Types
26
+ * Custom metadata system replacing react-helmet-async
27
+ * Platform-agnostic: works on web, React Native, and SSR
28
+ */
29
+
30
+ /**
31
+ * Context passed to dynamic metadata evaluator functions
32
+ * Provides access to form values, queries, and page state
33
+ */
34
+ type MetadataEvaluatorContext<F extends FieldValues$1 = FieldValues$1, Q extends QueriesArray$1 = QueriesArray$1> = FunctionProps<F, Q>;
35
+ interface MetaTag {
36
+ /** For <meta name="..." content="..." /> */
37
+ name?: string;
38
+ /** For <meta property="og:..." content="..." /> */
39
+ property?: string;
40
+ /** For <meta http-equiv="..." content="..." /> */
41
+ httpEquiv?: string;
42
+ /** Meta tag content */
43
+ content: string;
44
+ /** Unique identifier for updating existing tags */
45
+ id?: string;
46
+ }
47
+ /**
48
+ * Open Graph Image Configuration
49
+ */
50
+ interface OpenGraphImage {
51
+ /** Absolute URL to the image */
52
+ url: string;
53
+ /** Alt text for the image */
54
+ alt?: string;
55
+ /** Image width in pixels */
56
+ width?: number;
57
+ /** Image height in pixels */
58
+ height?: number;
59
+ /** MIME type (e.g., "image/jpeg", "image/png") */
60
+ type?: string;
61
+ }
62
+ /**
63
+ * Open Graph Article Configuration (when type='article')
64
+ */
65
+ interface OpenGraphArticle {
66
+ /** ISO 8601 date string */
67
+ publishedTime?: string;
68
+ /** ISO 8601 date string */
69
+ modifiedTime?: string;
70
+ /** ISO 8601 date string */
71
+ expirationTime?: string;
72
+ /** Author name or URL */
73
+ author?: string | Array<string>;
74
+ /** Article section/category */
75
+ section?: string;
76
+ /** Article tags */
77
+ tags?: Array<string>;
78
+ }
79
+ /**
80
+ * Open Graph Configuration (Facebook, LinkedIn, etc.)
81
+ */
82
+ interface OpenGraphConfig<F extends FieldValues$1 = FieldValues$1, Q extends QueriesArray$1 = QueriesArray$1> {
83
+ type?: 'website' | 'article' | 'product' | 'profile';
84
+ title?: string | ((context: MetadataEvaluatorContext<F, Q>) => string);
85
+ description?: string | ((context: MetadataEvaluatorContext<F, Q>) => string);
86
+ /** Single image URL or full image config */
87
+ image?: string | OpenGraphImage | ((context: MetadataEvaluatorContext<F, Q>) => string | OpenGraphImage);
88
+ /** Multiple images for the page */
89
+ images?: Array<OpenGraphImage> | ((context: MetadataEvaluatorContext<F, Q>) => Array<OpenGraphImage>);
90
+ /** Canonical URL */
91
+ url?: string | ((context: MetadataEvaluatorContext<F, Q>) => string);
92
+ siteName?: string;
93
+ /** Locale (e.g., "en_US", "it_IT") */
94
+ locale?: string;
95
+ /** Article-specific metadata (when type='article') */
96
+ article?: OpenGraphArticle;
97
+ }
98
+ /**
99
+ * Twitter Card Configuration
100
+ */
101
+ interface TwitterCardConfig<F extends FieldValues$1 = FieldValues$1, Q extends QueriesArray$1 = QueriesArray$1> {
102
+ /** Card type */
103
+ card?: 'summary' | 'summary_large_image' | 'app' | 'player';
104
+ /** @username of the website */
105
+ site?: string;
106
+ /** @username of the content creator */
107
+ creator?: string;
108
+ /** Title (falls back to og:title then page title) */
109
+ title?: string | ((context: MetadataEvaluatorContext<F, Q>) => string);
110
+ /** Description (falls back to og:description then page description) */
111
+ description?: string | ((context: MetadataEvaluatorContext<F, Q>) => string);
112
+ /** Image URL (falls back to og:image) */
113
+ image?: string | ((context: MetadataEvaluatorContext<F, Q>) => string);
114
+ /** Alt text for the image */
115
+ imageAlt?: string | ((context: MetadataEvaluatorContext<F, Q>) => string);
116
+ }
117
+ /**
118
+ * Alternate languages/URLs configuration for i18n SEO
119
+ */
120
+ interface AlternatesConfig {
121
+ /** Canonical URL for this page */
122
+ canonical?: string;
123
+ /** Map of locale → URL for hreflang tags (e.g., { "en": "/en/page", "it": "/it/page" }) */
124
+ languages?: Record<string, string>;
125
+ /** Media-specific alternates (e.g., mobile version) */
126
+ media?: Record<string, string>;
127
+ /** RSS/Atom feed alternates */
128
+ types?: Record<string, Array<{
129
+ url: string;
130
+ title?: string;
131
+ }>>;
132
+ }
133
+ /**
134
+ * Icon configuration
135
+ */
136
+ interface IconConfig {
137
+ /** URL to the icon */
138
+ url: string;
139
+ /** Icon type (e.g., "image/png", "image/svg+xml") */
140
+ type?: string;
141
+ /** Icon sizes (e.g., "32x32", "192x192") */
142
+ sizes?: string;
143
+ /** Color for SVG mask icons */
144
+ color?: string;
145
+ }
146
+ /**
147
+ * Icons & PWA configuration
148
+ */
149
+ interface IconsConfig {
150
+ /** Standard favicon(s) - link[rel="icon"] */
151
+ icon?: string | IconConfig | Array<IconConfig>;
152
+ /** Apple touch icon(s) - link[rel="apple-touch-icon"] */
153
+ apple?: string | IconConfig | Array<IconConfig>;
154
+ /** Shortcut icon (legacy) */
155
+ shortcut?: string;
156
+ }
157
+ /**
158
+ * Structured Data Configuration (schema.org JSON-LD)
159
+ */
160
+ interface StructuredDataConfig<F extends FieldValues$1 = FieldValues$1, Q extends QueriesArray$1 = QueriesArray$1> {
161
+ type: 'Article' | 'Product' | 'WebPage' | 'FAQPage' | 'Organization' | 'Person' | 'WebSite' | 'BreadcrumbList';
162
+ schema: Record<string, unknown> | ((context: MetadataEvaluatorContext<F, Q>) => Record<string, unknown>);
163
+ }
164
+ /**
165
+ * AI Crawler Hints (for AI search engines and LLMs)
166
+ */
167
+ interface AIHintsConfig<F extends FieldValues$1 = FieldValues$1, Q extends QueriesArray$1 = QueriesArray$1> {
168
+ /** Content classification (e.g., "documentation", "tutorial", "reference") */
169
+ contentClassification?: string | ((context: MetadataEvaluatorContext<F, Q>) => string);
170
+ /** Hints for AI models (e.g., ["code-heavy", "technical"]) */
171
+ modelHints?: Array<string> | ((context: MetadataEvaluatorContext<F, Q>) => Array<string>);
172
+ /** Additional context for AI understanding */
173
+ contextualInfo?: string | ((context: MetadataEvaluatorContext<F, Q>) => string);
174
+ /** Exclude this page from AI crawler indexing */
175
+ excludeFromIndexing?: boolean;
176
+ }
177
+ /**
178
+ * Robots Configuration (indexing directives)
179
+ */
180
+ interface RobotsConfig {
181
+ /** Prevent indexing */
182
+ noindex?: boolean;
183
+ /** Don't follow links */
184
+ nofollow?: boolean;
185
+ /** Don't cache page */
186
+ noarchive?: boolean;
187
+ /** Don't show snippets in search results */
188
+ nosnippet?: boolean;
189
+ /** Image preview size in search results */
190
+ maxImagePreview?: 'none' | 'standard' | 'large';
191
+ /** Max snippet length in search results */
192
+ maxSnippet?: number;
193
+ }
194
+ /**
195
+ * Resolved Metadata - all dynamic functions have been evaluated.
196
+ * This is the output of resolveMetadata() and is what gets applied to the DOM
197
+ * or passed to framework helpers (toNextMetadata, etc.).
198
+ */
199
+ interface ResolvedMetadata {
200
+ title?: string;
201
+ description?: string;
202
+ canonical?: string;
203
+ lang?: string;
204
+ keywords?: Array<string>;
205
+ author?: string;
206
+ viewport?: string;
207
+ themeColor?: string;
208
+ openGraph?: {
209
+ type?: 'website' | 'article' | 'product' | 'profile';
210
+ title?: string;
211
+ description?: string;
212
+ image?: string | OpenGraphImage;
213
+ images?: Array<OpenGraphImage>;
214
+ url?: string;
215
+ siteName?: string;
216
+ locale?: string;
217
+ article?: OpenGraphArticle;
218
+ };
219
+ twitter?: {
220
+ card?: 'summary' | 'summary_large_image' | 'app' | 'player';
221
+ site?: string;
222
+ creator?: string;
223
+ title?: string;
224
+ description?: string;
225
+ image?: string;
226
+ imageAlt?: string;
227
+ };
228
+ alternates?: AlternatesConfig;
229
+ icons?: IconsConfig;
230
+ /** Web app manifest URL */
231
+ manifest?: string;
232
+ structuredData?: {
233
+ type: string;
234
+ schema: Record<string, unknown>;
235
+ };
236
+ aiHints?: {
237
+ contentClassification?: string;
238
+ modelHints?: Array<string>;
239
+ contextualInfo?: string;
240
+ excludeFromIndexing?: boolean;
241
+ };
242
+ robots?: RobotsConfig;
243
+ disableIndexing?: boolean;
244
+ customMeta?: Array<MetaTag>;
245
+ }
246
+ /**
247
+ * Complete Metadata Configuration (Generic over F and Q for dynamic metadata)
248
+ * This is the "input" type — values can be strings or evaluator functions.
249
+ * Use resolveMetadata() to convert this to ResolvedMetadata.
250
+ */
251
+ interface MetadataConfig<F extends FieldValues$1 = FieldValues$1, Q extends QueriesArray$1 = QueriesArray$1> {
252
+ /** Page title - sets document.title on web */
253
+ title?: string | ((context: MetadataEvaluatorContext<F, Q>) => string);
254
+ /** Page description meta tag */
255
+ description?: string | ((context: MetadataEvaluatorContext<F, Q>) => string);
256
+ /** Canonical URL for the page */
257
+ canonical?: string | ((context: MetadataEvaluatorContext<F, Q>) => string);
258
+ /** HTML lang attribute (e.g., "en", "it") */
259
+ lang?: string;
260
+ /**
261
+ * @deprecated Use `lang` instead. Will be removed in a future version.
262
+ */
263
+ documentLang?: string;
264
+ /** Keywords for SEO */
265
+ keywords?: Array<string> | ((context: MetadataEvaluatorContext<F, Q>) => Array<string>);
266
+ openGraph?: OpenGraphConfig<F, Q>;
267
+ twitter?: TwitterCardConfig<F, Q>;
268
+ alternates?: AlternatesConfig;
269
+ icons?: IconsConfig;
270
+ /** Web app manifest URL */
271
+ manifest?: string;
272
+ structuredData?: StructuredDataConfig<F, Q>;
273
+ aiHints?: AIHintsConfig<F, Q>;
274
+ robots?: RobotsConfig;
275
+ customMeta?: Array<MetaTag> | ((context: MetadataEvaluatorContext<F, Q>) => Array<MetaTag>);
276
+ disableIndexing?: boolean;
277
+ /** Author meta tag */
278
+ author?: string;
279
+ /** Viewport meta tag (defaults to "width=device-width, initial-scale=1") */
280
+ viewport?: string;
281
+ /** Theme color for browser UI */
282
+ themeColor?: string;
283
+ }
284
+ /**
285
+ * Request-scoped metadata store.
286
+ * In SSR each request gets its own store to avoid cross-request leaks.
287
+ * On the client, a single global store is used.
288
+ */
289
+ interface MetadataStore {
290
+ /** Get current resolved metadata */
291
+ getMetadata: () => ResolvedMetadata;
292
+ /** Set (merge) resolved metadata into the store */
293
+ setMetadata: (meta: ResolvedMetadata) => void;
294
+ /** Reset store to empty */
295
+ reset: () => void;
296
+ }
297
+ interface MetadataProvider {
298
+ /** Apply metadata configuration to the page */
299
+ setMetadata: (config: MetadataConfig) => void;
300
+ /** Get current metadata configuration */
301
+ getMetadata: () => MetadataConfig;
302
+ /** Reset all metadata to defaults */
303
+ resetMetadata: () => void;
304
+ }
305
+ /**
306
+ * Configuration for lazy loading and code splitting behavior
307
+ * Enables deferred component loading to reduce initial bundle size
308
+ */
309
+ interface LazyLoadingConfig<F extends FieldValues$1 = FieldValues$1, Q extends QueriesArray$1 = QueriesArray$1> {
310
+ /** Enable lazy loading (default: true) */
311
+ enabled?: boolean;
312
+ /** Preload on hover for interactive elements (default: false) */
313
+ preloadOnHover?: boolean;
314
+ /** Preload on focus for keyboard navigation (default: false) */
315
+ preloadOnFocus?: boolean;
316
+ /** Preload after render with delay (in ms, default: undefined - no delay) */
317
+ preloadAfterRender?: number;
318
+ /** Fallback component to show while loading (default: null) */
319
+ suspenseFallback?: React.ReactNode;
320
+ /** Custom error boundary component for lazy-loaded modules */
321
+ errorBoundary?: React.ComponentType<{
322
+ error: Error;
323
+ retry: () => void;
324
+ }>;
325
+ /** Maximum time to wait before showing error state (in ms, default: 30000) */
326
+ timeout?: number;
327
+ /** Log performance metrics for lazy loading (development only) */
328
+ logMetrics?: boolean;
329
+ /** IntersectionObserver threshold (0-1, default: 0.1) - alias for intersectionThreshold */
330
+ threshold?: number | Array<number>;
331
+ /** IntersectionObserver threshold (0-1, default: 0.1) */
332
+ intersectionThreshold?: number | Array<number>;
333
+ /** IntersectionObserver root margin (default: "100px") - alias for intersectionRootMargin */
334
+ rootMargin?: string;
335
+ /** IntersectionObserver root margin (default: "100px") */
336
+ intersectionRootMargin?: string;
337
+ /** Trigger type for lazy loading: viewport (IntersectionObserver), interaction (manual), or conditional (based on function) */
338
+ trigger?: 'viewport' | 'interaction' | 'conditional';
339
+ /** Conditional function to determine if content should load (for trigger: "conditional") */
340
+ condition?: (context: MetadataEvaluatorContext<F, Q>) => boolean;
341
+ /** Placeholder component to show before lazy content loads */
342
+ placeholder?: React.ReactNode;
343
+ }
344
+ /**
345
+ * Entry for the llms.txt file
346
+ */
347
+ interface LlmsTxtEntry {
348
+ /** URL of the page */
349
+ url: string;
350
+ /** Short title / label for this page */
351
+ title: string;
352
+ /** Brief description for the LLM */
353
+ description?: string;
354
+ }
355
+ /**
356
+ * Configuration for llms.txt generation
357
+ */
358
+ interface LlmsTxtConfig {
359
+ /** Site title / name shown at the top of llms.txt */
360
+ siteName: string;
361
+ /** Brief description of the site */
362
+ siteDescription?: string;
363
+ /** Curated list of pages to expose in llms.txt */
364
+ entries: Array<LlmsTxtEntry>;
365
+ }
366
+
367
+ /**
368
+ * Metadata Store, DOM Application, and Server Collection
369
+ *
370
+ * Architecture:
371
+ * - `createMetadataStore()` → request-scoped store (SSR-safe)
372
+ * - `applyMetadataToDom(resolved)` → client-side DOM manipulation
373
+ * - `collectMetadataToHtml(resolved)` → server-side HTML string collection
374
+ * - `setMetadata / getMetadata / resetMetadata` → backward-compatible global API
375
+ *
376
+ * @module config/metadata
377
+ */
378
+
379
+ /**
380
+ * Create a new request-scoped metadata store.
381
+ * In SSR, each incoming request should create its own store
382
+ * to avoid cross-request data leaks.
383
+ * On the client, a single global store is used (see below).
384
+ */
385
+ declare function createMetadataStore(): MetadataStore;
386
+ /**
387
+ * Apply resolved metadata to the document `<head>`.
388
+ * Client-only: this function does nothing if `document` is not available.
389
+ * Covers: title, description, canonical, lang, keywords, author, viewport,
390
+ * themeColor, Open Graph (advanced), Twitter Card, alternates/hreflang,
391
+ * icons, manifest, structured data JSON-LD, AI hints, robots, customMeta.
392
+ */
393
+ declare function applyMetadataToDom(resolved: ResolvedMetadata): void;
394
+ /**
395
+ * Collect resolved metadata as an HTML string for SSR injection into `<head>`.
396
+ * Pure function — no DOM, no side effects.
397
+ */
398
+ declare function collectMetadataToHtml(resolved: ResolvedMetadata): string;
399
+ /**
400
+ * Apply metadata configuration to the page.
401
+ * Merges with existing metadata in the global store.
402
+ * On web: also applies changes to the DOM.
403
+ *
404
+ * @deprecated Prefer using `MetadataStoreProvider` + `resolveMetadata` + `applyMetadataToDom`
405
+ * for SSR-safe, request-scoped metadata management.
406
+ */
407
+ declare const setMetadata: (config: MetadataConfig) => void;
408
+ /**
409
+ * Get current metadata from the global store.
410
+ * @deprecated Prefer using `MetadataStoreProvider` context in SSR.
411
+ */
412
+ declare const getMetadata: () => MetadataConfig;
413
+ /**
414
+ * Reset all metadata in the global store.
415
+ * @deprecated Prefer using `MetadataStoreProvider` context in SSR.
416
+ */
417
+ declare const resetMetadata: () => void;
418
+
419
+ /**
420
+ * resolveMetadata — Pure function that evaluates dynamic MetadataConfig into ResolvedMetadata.
421
+ *
422
+ * All evaluator functions (title, description, og fields, twitter fields, etc.)
423
+ * are called with the provided context. The result is a plain object with no functions.
424
+ *
425
+ * This function has NO side effects: no DOM, no global state.
426
+ *
427
+ * @module config/resolveMetadata
428
+ */
429
+
430
+ /**
431
+ * Resolve a MetadataConfig (which may contain evaluator functions)
432
+ * into a plain ResolvedMetadata object.
433
+ *
434
+ * @param meta - The metadata configuration (static or with dynamic functions)
435
+ * @param ctx - The context providing get/set accessors for queries, form, state
436
+ * @returns Fully resolved metadata with all functions evaluated
437
+ */
438
+ declare function resolveMetadata<F extends FieldValues$1 = FieldValues$1, Q extends QueriesArray$1 = QueriesArray$1>(meta: MetadataConfig<F, Q>, ctx: MetadataEvaluatorContext<F, Q>): ResolvedMetadata;
439
+
440
+ interface MetadataStoreProviderProps {
441
+ /** Optional pre-created store. If not provided, a new one is created. */
442
+ store?: MetadataStore;
443
+ children: React.ReactNode;
444
+ }
445
+ /**
446
+ * Provides a request-scoped MetadataStore via React Context.
447
+ *
448
+ * @example SSR (one per request)
449
+ * ```tsx
450
+ * import { createMetadataStore, MetadataStoreProvider } from '@/core/pages';
451
+ *
452
+ * function handleRequest(req, res) {
453
+ * const store = createMetadataStore();
454
+ * const html = renderToString(
455
+ * <MetadataStoreProvider store={store}>
456
+ * <App />
457
+ * </MetadataStoreProvider>
458
+ * );
459
+ * const headHtml = collectMetadataToHtml(store.getMetadata());
460
+ * // inject headHtml into <head>
461
+ * }
462
+ * ```
463
+ */
464
+ declare function MetadataStoreProvider({ store, children, }: MetadataStoreProviderProps): react_jsx_runtime.JSX.Element;
465
+ /**
466
+ * Access the nearest request-scoped MetadataStore.
467
+ * Returns `null` if no provider is found (falls back to global store in consumers).
468
+ */
469
+ declare function useMetadataStore(): MetadataStore | null;
470
+
471
+ /**
472
+ * Optional dev-only metadata logging.
473
+ *
474
+ * Tracks what metadata was resolved and applied, useful for debugging
475
+ * metadata issues during development.
476
+ *
477
+ * Logging is a no-op in production builds.
478
+ *
479
+ * @module config/metadataLogger
480
+ */
481
+
482
+ interface MetadataLogEntry {
483
+ pageId: string;
484
+ action: 'resolve' | 'apply-dom' | 'apply-store' | 'translate';
485
+ metadata: ResolvedMetadata;
486
+ timestamp: number;
487
+ }
488
+ /**
489
+ * Enable or disable metadata logging.
490
+ * Only effective in development mode.
491
+ */
492
+ declare function setMetadataLogging(enabled: boolean): void;
493
+ /**
494
+ * Log a metadata action (resolve, apply, translate).
495
+ * No-op in production or when logging is disabled.
496
+ */
497
+ declare function logMetadata(pageId: string, action: MetadataLogEntry['action'], metadata: ResolvedMetadata): void;
498
+ /**
499
+ * Get all logged metadata entries (dev only).
500
+ * Useful for inspecting metadata in browser devtools.
501
+ */
502
+ declare function getMetadataLog(): Array<MetadataLogEntry>;
503
+ /**
504
+ * Clear the metadata log.
505
+ */
506
+ declare function clearMetadataLog(): void;
507
+
508
+ interface DefaultContainerProps<F extends FieldValues$1 = FieldValues$1, Q extends QueriesArray$1 = QueriesArray$1, V extends Record<string, unknown> = Record<string, unknown>> {
509
+ children?: Array<React.JSX.Element>;
510
+ allContents: Array<ContentItem<F, Q, V> | FormManagerConfig$1<F> | Submit$1<F>>;
511
+ handleRefresh?: () => void;
512
+ viewSettings?: ViewSettings;
513
+ pageId?: string;
514
+ }
515
+ type PageAuthState = {
516
+ id: string;
517
+ accountVerified?: boolean;
518
+ isLogged?: boolean;
519
+ token?: string;
520
+ phoneNumber?: string;
521
+ email?: string;
522
+ };
523
+ interface PageTranslationOptions {
524
+ [key: string]: string | number | boolean | undefined;
525
+ ns?: string;
526
+ }
527
+ interface PageConfigProps {
528
+ HeaderContainer: <F extends FieldValues$1 = FieldValues$1, Q extends QueriesArray$1 = QueriesArray$1, V extends Record<string, unknown> = Record<string, unknown>>(props: Omit<DefaultContainerProps<F, Q, V>, 'viewSettings'> & ViewSettings['header']) => React.ReactNode;
529
+ FooterContainer: <F extends FieldValues$1 = FieldValues$1, Q extends QueriesArray$1 = QueriesArray$1, V extends Record<string, unknown> = Record<string, unknown>>(props: Omit<DefaultContainerProps<F, Q, V>, 'viewSettings'> & ViewSettings['footer']) => React.ReactNode;
530
+ BodyContainer: <F extends FieldValues$1 = FieldValues$1, Q extends QueriesArray$1 = QueriesArray$1, V extends Record<string, unknown> = Record<string, unknown>>(props: DefaultContainerProps<F, Q, V>) => React.ReactNode;
531
+ authPageImage: string;
532
+ authPageProps: PageProps;
533
+ isLogged: (val: AuthState | null) => boolean;
534
+ ItemsContainer: (props: {
535
+ children: React.ReactNode;
536
+ }) => React.ReactNode;
537
+ LoaderComponent?: (props: {
538
+ loading?: boolean;
539
+ message?: string;
540
+ ns?: string;
541
+ }) => React.ReactNode;
542
+ PageContainer: (props: {
543
+ children: React.ReactNode;
544
+ id: string;
545
+ }) => React.ReactNode;
546
+ meta?: {
547
+ title?: string;
548
+ description?: string;
549
+ };
550
+ defaultMetadata: MetadataConfig;
551
+ setMetadata: (config: MetadataConfig) => void;
552
+ getMetadata: () => MetadataConfig;
553
+ resetMetadata: () => void;
554
+ lazyLoading: LazyLoadingConfig;
555
+ authValues?: PageAuthState | null;
556
+ locale?: string;
557
+ translateText?: (key: string, options?: PageTranslationOptions) => string;
558
+ }
559
+ declare function getPageConfig(): PageConfigProps;
560
+ declare const pageConfigAtom: _gaddario98_react_state.PrimitiveAtom<PageConfigProps>;
561
+ declare const usePageConfigValue: () => PageConfigProps;
562
+ declare const usePageConfigState: () => [PageConfigProps, (value: PageConfigProps) => void];
563
+ declare const usePageConfigReset: () => () => void;
564
+
565
+ type StringKey$1<T> = Extract<keyof T, string>;
566
+ type VariableTopKey<V> = StringKey$1<V>;
567
+ type VariableValue<V, K extends VariableTopKey<V>> = V[K];
568
+ type QueryTopKey$1<Q extends QueriesArray$1> = StringKey$1<MultipleQueryResponse$1<Q>>;
569
+ type QuerySubKey$1<Q extends QueriesArray$1, K extends QueryTopKey$1<Q>> = StringKey$1<MultipleQueryResponse$1<Q>[K]>;
570
+ type QueryCompositeKey$1<Q extends QueriesArray$1> = {
571
+ [K in QueryTopKey$1<Q>]: K | `${K}.${QuerySubKey$1<Q, K>}`;
572
+ }[QueryTopKey$1<Q>];
573
+ type QueryValue$1<Q extends QueriesArray$1, K extends QueryCompositeKey$1<Q>> = K extends `${infer Top}.${infer Sub}` ? Top extends QueryTopKey$1<Q> ? Sub extends QuerySubKey$1<Q, Top> ? MultipleQueryResponse$1<Q>[Top][Sub] : never : never : K extends QueryTopKey$1<Q> ? MultipleQueryResponse$1<Q>[K] : never;
574
+ type MutationTopKey$1<Q extends QueriesArray$1> = StringKey$1<AllMutation$1<Q>>;
575
+ type MutationSubKey$1<Q extends QueriesArray$1, K extends MutationTopKey$1<Q>> = StringKey$1<AllMutation$1<Q>[K]>;
576
+ type MutationCompositeKey$1<Q extends QueriesArray$1> = {
577
+ [K in MutationTopKey$1<Q>]: K | `${K}.${MutationSubKey$1<Q, K>}`;
578
+ }[MutationTopKey$1<Q>];
579
+ type MutationValue$1<Q extends QueriesArray$1, K extends MutationCompositeKey$1<Q>> = K extends `${infer Top}.${infer Sub}` ? Top extends MutationTopKey$1<Q> ? Sub extends MutationSubKey$1<Q, Top> ? AllMutation$1<Q>[Top][Sub] : never : never : K extends MutationTopKey$1<Q> ? AllMutation$1<Q>[K] : never;
580
+ type GetFunction<F extends FieldValues$1, Q extends QueriesArray$1, V extends Record<string, unknown> = Record<string, unknown>> = {
581
+ <K extends QueryTopKey$1<Q>>(type: 'query', key: K): MultipleQueryResponse$1<Q>[K];
582
+ <K extends QueryCompositeKey$1<Q>>(type: 'query', key: K): QueryValue$1<Q, K>;
583
+ <K extends QueryCompositeKey$1<Q>>(type: 'query', key: K, defaultValue: unknown): NonNullable<QueryValue$1<Q, K>>;
584
+ <K extends QueryTopKey$1<Q>>(type: 'query', key: K, defaultValue: MultipleQueryResponse$1<Q>[K]['data']): MultipleQueryResponse$1<Q>[K]['data'];
585
+ <K extends QueryCompositeKey$1<Q>>(type: 'query', key: K, defaultValue: QueryValue$1<Q, K>): NonNullable<QueryValue$1<Q, K>>;
586
+ <K extends MutationTopKey$1<Q>>(type: 'mutation', key: K): AllMutation$1<Q>[K];
587
+ <K extends MutationCompositeKey$1<Q>>(type: 'mutation', key: K): MutationValue$1<Q, K>;
588
+ <K extends MutationCompositeKey$1<Q>>(type: 'mutation', key: K, defaultValue: unknown): NonNullable<MutationValue$1<Q, K>>;
589
+ <K extends MutationTopKey$1<Q>>(type: 'mutation', key: K, defaultValue: AllMutation$1<Q>[K]['data']): AllMutation$1<Q>[K]['data'];
590
+ <K extends MutationCompositeKey$1<Q>>(type: 'mutation', key: K, defaultValue: MutationValue$1<Q, K>): NonNullable<MutationValue$1<Q, K>>;
591
+ <K extends VariableTopKey<V>>(type: 'state', key: K): VariableValue<V, K>;
592
+ <K extends VariableTopKey<V>>(type: 'state', key: K, defaultValue: VariableValue<V, K>): NonNullable<VariableValue<V, K>>;
593
+ <TField extends DeepKeys<F>>(type: 'form', key: TField): DeepValue<F, TField> | undefined;
594
+ <TField extends DeepKeys<F>>(type: 'form', key: TField, defaultValue: DeepValue<F, TField>): NonNullable<DeepValue<F, TField>>;
595
+ };
596
+ type SetFunction<F extends FieldValues$1, V extends Record<string, unknown> = Record<string, unknown>> = {
597
+ (type: 'form'): SetValueFunction$1<F>;
598
+ (type: 'state'): <K extends VariableTopKey<V>>(key: K, value: VariableValue<V, K>) => void;
599
+ };
600
+ type FunctionProps<F extends FieldValues$1, Q extends QueriesArray$1, V extends Record<string, unknown> = Record<string, unknown>> = {
601
+ /**
602
+ * Read the current query/mutation value by key.
603
+ * Example: get('query', 'bookings')
604
+ */
605
+ get: GetFunction<F, Q, V>;
606
+ /**
607
+ * Generic setter accessor.
608
+ * - set('form') returns `setValue`
609
+ * - set('state') returns state setter
610
+ */
611
+ set: SetFunction<F, V>;
612
+ };
613
+ type MappedItemsFunction<F extends FieldValues$1, Q extends QueriesArray$1, ComponentType, V extends Record<string, unknown> = Record<string, unknown>> = (props: FunctionProps<F, Q, V>) => ComponentType;
614
+ /**
615
+ * Context passed to lifecycle callbacks
616
+ * Provides access to form, queries, mutations, and utilities
617
+ */
618
+ type LifecycleContext<F extends FieldValues$1 = FieldValues$1, Q extends QueriesArray$1 = QueriesArray$1, V extends Record<string, unknown> = Record<string, unknown>> = FunctionProps<F, Q, V> & {
619
+ ns?: string;
620
+ pageId?: string;
621
+ pageConfig?: PageProps<F, Q, V>;
622
+ };
623
+ type Items<F extends FieldValues$1, Q extends QueriesArray$1, V extends Record<string, unknown> = Record<string, unknown>> = {
624
+ type: 'custom';
625
+ component: React.JSX.Element | ((props: FunctionProps<F, Q, V>) => React.JSX.Element);
626
+ index?: number;
627
+ usedBoxes?: number;
628
+ renderInFooter?: boolean;
629
+ renderInHeader?: boolean;
630
+ hidden?: boolean | MappedItemsFunction<F, Q, boolean, V>;
631
+ isDraggable?: boolean;
632
+ isInDraggableView?: boolean;
633
+ key?: string;
634
+ lazy?: boolean;
635
+ lazyTrigger?: 'viewport' | 'interaction' | 'conditional';
636
+ lazyCondition?: MappedItemsFunction<F, Q, boolean, V>;
637
+ };
638
+ type ContainerItem<F extends FieldValues$1, Q extends QueriesArray$1, V extends Record<string, unknown> = Record<string, unknown>> = {
639
+ type: 'container';
640
+ component?: PageConfigProps['ItemsContainer'];
641
+ items: ContentItemsType<F, Q, V>;
642
+ index?: number;
643
+ usedBoxes?: number;
644
+ renderInFooter?: boolean;
645
+ renderInHeader?: boolean;
646
+ hidden?: boolean | MappedItemsFunction<F, Q, boolean, V>;
647
+ isDraggable?: boolean;
648
+ isInDraggableView?: boolean;
649
+ key?: string;
650
+ lazy?: boolean;
651
+ lazyTrigger?: 'viewport' | 'interaction' | 'conditional';
652
+ lazyCondition?: MappedItemsFunction<F, Q, boolean, V>;
653
+ };
654
+ type ContentItem<F extends FieldValues$1, Q extends QueriesArray$1, V extends Record<string, unknown> = Record<string, unknown>> = Items<F, Q, V> | ContainerItem<F, Q, V>;
655
+ type MappedContents<F extends FieldValues$1, Q extends QueriesArray$1, V extends Record<string, unknown> = Record<string, unknown>> = MappedItemsFunction<F, Q, Array<ContentItem<F, Q, V>>, V>;
656
+ type ContentItemsType<F extends FieldValues$1, Q extends QueriesArray$1 = QueriesArray$1, V extends Record<string, unknown> = Record<string, unknown>> = Array<ContentItem<F, Q, V>> | MappedContents<F, Q, V>;
657
+ type FormPageProps<F extends FieldValues$1, Q extends QueriesArray$1, V extends Record<string, unknown> = Record<string, unknown>> = Omit<ComponentProps<typeof FormManager$1<F>>, 'updateFormValues' | 'submit' | 'data'> & {
658
+ defaultValueQueryKey?: Array<string>;
659
+ defaultValueQueryMap?: (props: ExtractQuery$1<Q>['response']) => DeepValue<F, DeepKeys<F>>;
660
+ submit?: Array<Submit$1<F>> | MappedItemsFunction<F, Q, Array<Submit$1<F>>, V>;
661
+ index?: number;
662
+ data?: Array<FormManagerConfig$1<F> | MappedItemsFunction<F, Q, FormManagerConfig$1<F>, V>>;
663
+ debounceDelay?: number;
664
+ hidden?: boolean | MappedItemsFunction<F, Q, boolean, V>;
665
+ };
666
+ type SingleQueryConfig$1<F extends FieldValues$1, Q extends QueryDefinition$1<any, any, any, any, any>, V extends Record<string, unknown> = Record<string, unknown>> = Q extends QueryDefinition$1<infer K, infer T, infer P, infer R, infer C> ? T extends 'mutation' ? {
667
+ type: 'mutation';
668
+ mutationConfig: (<Qa extends QueriesArray$1>(props: FunctionProps<F, Qa, V>) => MutationConfig$1<P, R, C>) | MutationConfig$1<P, R, C>;
669
+ key: K;
670
+ } : {
671
+ type: 'query';
672
+ queryConfig?: (<Qa extends QueriesArray$1>(props: FunctionProps<F, Qa, V>) => Omit<QueryProps$1<K, R>, 'keyToMap'>) | Omit<QueryProps$1<K, R>, 'keyToMap'>;
673
+ key: K;
674
+ } : never;
675
+ type QueryPageConfigArray<F extends FieldValues$1, Q extends QueriesArray$1, V extends Record<string, unknown> = Record<string, unknown>> = {
676
+ [I in keyof Q]: SingleQueryConfig$1<F, QueryAtIndex$1<Q, I>, V>;
677
+ };
678
+ interface PageProps<F extends FieldValues$1 = FieldValues$1, Q extends QueriesArray$1 = QueriesArray$1, V extends Record<string, unknown> = Record<string, unknown>> {
679
+ id: string;
680
+ ns?: string;
681
+ contents?: ContentItemsType<F, Q, V>;
682
+ queries?: QueryPageConfigArray<F, Q, V>;
683
+ form?: FormPageProps<F, Q, V>;
684
+ variables?: V;
685
+ viewSettings?: MappedItemsFunction<F, Q, ViewSettings, V> | ViewSettings;
686
+ meta?: MetadataConfig<F, Q>;
687
+ lazyLoading?: LazyLoadingConfig;
688
+ platformOverrides?: PlatformOverrides<F, Q, V>;
689
+ lifecycleCallbacks?: {
690
+ onMountComplete?: (context: LifecycleContext<F, Q, V>) => void | Promise<void>;
691
+ onQuerySuccess?: (context: LifecycleContext<F, Q, V>, queryKey: string, data: unknown) => void | Promise<void>;
692
+ onQueryError?: (context: LifecycleContext<F, Q, V>, queryKey: string, error: Error) => void | Promise<void>;
693
+ onFormSubmit?: (context: LifecycleContext<F, Q, V>, result: unknown) => void | Promise<void>;
694
+ onValuesChange?: MappedItemsFunction<F, Q, void, V>;
695
+ };
696
+ enableAuthControl?: boolean;
697
+ }
698
+ /**
699
+ * Platform-specific configuration overrides (proper type with PageProps reference)
700
+ * Allows different behavior on web vs React Native
701
+ */
702
+ type PlatformOverrides<F extends FieldValues$1 = FieldValues$1, Q extends QueriesArray$1 = QueriesArray$1, V extends Record<string, unknown> = Record<string, unknown>> = {
703
+ /** Web-specific overrides (React DOM) */
704
+ web?: Partial<PageProps<F, Q, V>>;
705
+ /** React Native-specific overrides */
706
+ native?: Partial<PageProps<F, Q, V>>;
707
+ };
708
+ type ViewSettings = {
709
+ withoutPadding?: boolean;
710
+ header?: {
711
+ withoutPadding?: boolean;
712
+ };
713
+ footer?: {
714
+ withoutPadding?: boolean;
715
+ };
716
+ disableRefreshing?: boolean;
717
+ layoutComponent?: <F extends FieldValues$1 = FieldValues$1, Q extends QueriesArray$1 = QueriesArray$1, V extends Record<string, unknown> = Record<string, unknown>>(props: DefaultContainerProps<F, Q, V> & Record<string, unknown>) => React.ReactNode;
718
+ layoutProps?: Record<string, unknown>;
719
+ pageContainerComponent?: React.ComponentType<{
720
+ children: React.ReactNode;
721
+ id: string;
722
+ } & Record<string, unknown>>;
723
+ pageContainerProps?: Record<string, unknown>;
724
+ /** @deprecated Use layoutComponent instead */
725
+ customLayoutComponent?: PageConfigProps['BodyContainer'];
726
+ /** @deprecated Use pageContainerComponent instead */
727
+ customPageContainer?: PageConfigProps['PageContainer'];
728
+ };
729
+ /**
730
+ * Dependency Graph Node
731
+ * Tracks which queries, form values, and mutations a component depends on
732
+ */
733
+ interface DependencyNode {
734
+ componentId: string;
735
+ parentComponent: string | null;
736
+ childComponents: Array<string>;
737
+ }
738
+ /**
739
+ * Dependency Graph
740
+ * Maps component IDs to their dependency nodes for selective re-rendering
741
+ */
742
+ interface DependencyGraph {
743
+ nodes: Map<string, DependencyNode>;
744
+ addNode: (node: DependencyNode) => void;
745
+ getNode: (componentId: string) => DependencyNode | undefined;
746
+ getAffectedComponents: (changedKeys: Array<string>) => Array<string>;
747
+ }
748
+ /**
749
+ * Memoization Cache Types
750
+ * For tracking memoized computations and their cache hits
751
+ */
752
+ interface MemoizationCacheStats {
753
+ hits: number;
754
+ misses: number;
755
+ size: number;
756
+ maxSize: number;
757
+ }
758
+ interface RenderComponentsProps<F extends FieldValues$1 = FieldValues$1, Q extends QueriesArray$1 = QueriesArray$1, V extends Record<string, unknown> = Record<string, unknown>> {
759
+ content: ContentItem<F, Q, V>;
760
+ ns: string;
761
+ pageId: string;
762
+ key: string;
763
+ }
764
+
765
+ declare const PageGenerator: <F extends FieldValues$1 = FieldValues$1, Q extends QueriesArray$1 = QueriesArray$1, V extends Record<string, unknown> = Record<string, unknown>>({ enableAuthControl, meta, variables, ...props }: PageProps<F, Q, V>) => react_jsx_runtime.JSX.Element;
766
+
767
+ declare const RenderComponents: <F extends FieldValues$1, Q extends QueriesArray$1, V extends Record<string, unknown> = Record<string, unknown>>(props: RenderComponentsProps<F, Q, V>) => react_jsx_runtime.JSX.Element;
768
+
769
+ interface Props<F extends FieldValues$1 = FieldValues$1, Q extends QueriesArray$1 = QueriesArray$1, V extends Record<string, unknown> = Record<string, unknown>> {
770
+ content: ContentItem<F, Q, V>;
771
+ ns: string;
772
+ pageId: string;
773
+ }
774
+ interface ContentProps<F extends FieldValues$1 = FieldValues$1, Q extends QueriesArray$1 = QueriesArray$1, V extends Record<string, unknown> = Record<string, unknown>> extends Omit<Props<F, Q, V>, 'content'> {
775
+ content: Items<F, Q, V>;
776
+ pageId: string;
777
+ }
778
+ interface ItemContainerProps<F extends FieldValues$1 = FieldValues$1, Q extends QueriesArray$1 = QueriesArray$1, V extends Record<string, unknown> = Record<string, unknown>> extends Omit<Props<F, Q, V>, 'content'> {
779
+ content: ContainerItem<F, Q, V>;
780
+ }
781
+
782
+ declare const usePageConfig: <F extends FieldValues$1, Q extends QueriesArray$1, V extends Record<string, unknown> = Record<string, unknown>>({ queries, form, ns, viewSettings, meta, lazyLoading, variables, pageId, }: {
783
+ queries: QueryPageConfigArray<F, Q, V>;
784
+ form?: FormPageProps<F, Q, V>;
785
+ ns: string;
786
+ viewSettings?: MappedItemsFunction<F, Q, ViewSettings, V> | ViewSettings;
787
+ meta?: MetadataConfig<F, Q>;
788
+ lazyLoading?: LazyLoadingConfig;
789
+ variables?: V;
790
+ pageId: string;
791
+ }) => {
792
+ formData: {
793
+ formContents: (_gaddario98_react_form.Submit<F, _gaddario98_react_form.SubmitKeysArg<F>> | _gaddario98_react_form.FormManagerConfig<F>)[];
794
+ elements: _gaddario98_react_form.FormElements[];
795
+ errors: any[];
796
+ formValues: F;
797
+ setValue: _gaddario98_react_form.SetValueFunction<F>;
798
+ };
799
+ form: FormPageProps<F, Q, V> | undefined;
800
+ mappedViewSettings: ViewSettings;
801
+ meta: MetadataConfig<F, Q> | undefined;
802
+ lazyLoading: LazyLoadingConfig<FieldValues$1, QueriesArray$1> | undefined;
803
+ globalConfig: PageConfigProps;
804
+ };
805
+
806
+ interface GenerateContentProps<F extends FieldValues$1, Q extends QueriesArray$1, V extends Record<string, unknown> = Record<string, unknown>> {
807
+ pageId: string;
808
+ ns?: string;
809
+ contents: ContentItemsType<F, Q, V>;
810
+ pageConfig: ReturnType<typeof usePageConfig<F, Q, V>>;
811
+ }
812
+ declare const useGenerateContent: <F extends FieldValues$1, Q extends QueriesArray$1, V extends Record<string, unknown> = Record<string, unknown>>({ pageId, ns, contents, pageConfig, }: GenerateContentProps<F, Q, V>) => {
813
+ header: react_jsx_runtime.JSX.Element[];
814
+ body: react_jsx_runtime.JSX.Element[];
815
+ footer: react_jsx_runtime.JSX.Element[];
816
+ allContents: (ContentItem<F, Q, V> | _gaddario98_react_form.Submit<F, _gaddario98_react_form.SubmitKeysArg<F>> | _gaddario98_react_form.FormManagerConfig<F>)[];
817
+ };
818
+
819
+ interface GenerateContentRenderProps<F extends FieldValues$1, Q extends QueriesArray$1, V extends Record<string, unknown> = Record<string, unknown>> {
820
+ contents?: ContentItemsType<F, Q, V>;
821
+ ns?: string;
822
+ pageId: string;
823
+ formData: {
824
+ formContents: Array<Submit$1<F, SubmitKeysArg$1<F>> | FormManagerConfig$1<F>>;
825
+ elements: Array<FormElements$1>;
826
+ errors: Array<unknown>;
827
+ formValues: F;
828
+ setValue: SetValueFunction$1<F>;
829
+ };
830
+ }
831
+ interface Elements {
832
+ index: number;
833
+ element: JSX.Element;
834
+ renderInFooter: boolean;
835
+ renderInHeader: boolean;
836
+ key: string;
837
+ }
838
+ declare const useGenerateContentRender: <F extends FieldValues$1, Q extends QueriesArray$1, V extends Record<string, unknown> = Record<string, unknown>>({ pageId, ns, contents, formData, }: GenerateContentRenderProps<F, Q, V>) => {
839
+ components: {
840
+ element: react_jsx_runtime.JSX.Element;
841
+ index: number;
842
+ renderInFooter: boolean;
843
+ renderInHeader: boolean;
844
+ key: string;
845
+ }[];
846
+ allContents: (ContentItem<F, Q, V> | Submit$1<F, SubmitKeysArg$1<F>> | FormManagerConfig$1<F>)[];
847
+ };
848
+
849
+ /**
850
+ * Specialized hook for managing view settings
851
+ * Optimized to prevent unnecessary re-renders
852
+ * @param viewSettings - View settings configuration (static or function)
853
+ * @param allQuery - All query results
854
+ * @param allMutation - All mutation handlers
855
+ * @param formValues - Current form values
856
+ * @param setValue - Form setValue function
857
+ * @returns Processed view settings
858
+ */
859
+ declare function useViewSettings<F extends FieldValues$1, Q extends QueriesArray$1, V extends Record<string, unknown> = Record<string, unknown>>({ viewSettings, pageId, }: {
860
+ viewSettings?: MappedItemsFunction<F, Q, ViewSettings, V> | ViewSettings;
861
+ pageId: string;
862
+ }): ViewSettings;
863
+
864
+ /**
865
+ * Specialized hook for managing form data processing
866
+ * Uses useMemo to prevent unnecessary re-computation
867
+ * @param form - Form configuration
868
+ * @param isAllQueryMapped - Whether all queries are mapped
869
+ * @param formValues - Current form values
870
+ * @param extractMutationsHandle - Extracted mutations
871
+ * @param extractQueryHandle - Extracted queries
872
+ * @param setValue - Form setValue function
873
+ * @returns Processed form data and submit handlers
874
+ */
875
+ declare function useFormData<F extends FieldValues$1, Q extends QueriesArray$1, V extends Record<string, unknown> = Record<string, unknown>>({ form, pageId }: {
876
+ form?: FormPageProps<F, Q, V>;
877
+ pageId: string;
878
+ }): {
879
+ mappedFormData: FormManagerConfig$1<F>[];
880
+ formSubmit: Submit$1<F, _gaddario98_react_form.SubmitKeysArg<F>>[];
881
+ };
882
+
883
+ /**
884
+ * useMetadata Hook
885
+ * Evaluates dynamic metadata with query data and form values
886
+ * Integrates i18n for metadata translation
887
+ * Uses resolveMetadata + applyMetadataToDom for clean separation
888
+ *
889
+ * @module hooks/useMetadata
890
+ */
891
+
892
+ /**
893
+ * Props for useMetadata hook
894
+ */
895
+ interface UseMetadataProps<F extends FieldValues$1 = FieldValues$1, Q extends QueriesArray$1 = QueriesArray$1> {
896
+ /** Base metadata configuration (static or dynamic function) */
897
+ meta?: MetadataConfig<F, Q> | MappedItemsFunction<F, Q, MetadataConfig>;
898
+ /** Namespace for i18n translations */
899
+ ns?: string;
900
+ /** Whether to automatically apply metadata (default: true) */
901
+ autoApply?: boolean;
902
+ pageId: string;
903
+ }
904
+ /**
905
+ * Hook for evaluating and managing dynamic metadata.
906
+ *
907
+ * Pipeline:
908
+ * 1. Evaluate `meta` (if it's a MappedItemsFunction, call it with get/set)
909
+ * 2. Resolve all dynamic functions via `resolveMetadata()`
910
+ * 3. Translate strings via i18n
911
+ * 4. Auto-apply to DOM (client) or store (SSR) via `applyMetadataToDom` / MetadataStore
912
+ *
913
+ * @returns Resolved and translated metadata
914
+ */
915
+ declare function useMetadata<F extends FieldValues$1 = FieldValues$1, Q extends QueriesArray$1 = QueriesArray$1>({ meta, autoApply, pageId }: UseMetadataProps<F, Q>): ResolvedMetadata;
916
+ /**
917
+ * Hook to manually apply metadata (when autoApply is false)
918
+ * @returns Function to apply resolved metadata to the DOM
919
+ */
920
+ declare function useApplyMetadata(): (meta: ResolvedMetadata) => void;
921
+
922
+ /**
923
+ * Optimized shallow equality check for objects and functions
924
+ * @param objA - First object to compare
925
+ * @param objB - Second object to compare
926
+ * @returns True if objects are shallow equal
927
+ */
928
+ declare function shallowEqual(objA: any, objB: any): boolean;
929
+ /**
930
+ * Checks if a value is stable for React dependency arrays
931
+ * @param value - Value to check for stability
932
+ * @returns True if value is considered stable
933
+ */
934
+ declare function isStableValue(value: any): boolean;
935
+ /**
936
+ * Creates an optimized dependency array by filtering unstable values
937
+ * @param deps - Array of dependencies to optimize
938
+ * @returns Filtered array of stable dependencies
939
+ */
940
+ declare function optimizeDeps(deps: Array<any>): Array<any>;
941
+ /**
942
+ * Custom prop comparator for React.memo() to prevent unnecessary re-renders
943
+ * Compares props shallowly and ignores function references if they have the same name
944
+ * @param prevProps - Previous component props
945
+ * @param nextProps - Next component props
946
+ * @returns True if props are equal (component should NOT re-render)
947
+ */
948
+ declare function memoPropsComparator<P extends Record<string, any>>(prevProps: Readonly<P>, nextProps: Readonly<P>): boolean;
949
+ /**
950
+ * Deep equality check for complex objects
951
+ * Use sparingly - prefer shallow equality for performance
952
+ * Uses fast-deep-equal library for optimized deep comparison with circular reference protection
953
+ * @param objA - First object
954
+ * @param objB - Second object
955
+ * @returns True if objects are deeply equal
956
+ */
957
+ declare function deepEqual(objA: any, objB: any): boolean;
958
+ /**
959
+ * Memoization cache for expensive computations
960
+ * Simple LRU cache with configurable size
961
+ */
962
+ declare class MemoizationCache<K, V> {
963
+ private cache;
964
+ private maxSize;
965
+ constructor(maxSize?: number);
966
+ get(key: K): V | undefined;
967
+ set(key: K, value: V): void;
968
+ has(key: K): boolean;
969
+ clear(): void;
970
+ }
971
+ /**
972
+ * Creates a memoized function with custom cache key generator
973
+ * @param fn - Function to memoize
974
+ * @param cacheKeyFn - Optional function to generate cache key from arguments
975
+ * @returns Memoized function
976
+ */
977
+ declare function memoize<Args extends Array<any>, Result>(fn: (...args: Args) => Result, cacheKeyFn?: (...args: Args) => string): (...args: Args) => Result;
978
+
979
+ declare const pageVariablesAtomFamily: jotai_family.AtomFamily<string, jotai.PrimitiveAtom<Record<string, unknown>> & {
980
+ init: Record<string, unknown>;
981
+ }>;
982
+ /**
983
+ * Global atom storing all page variables.
984
+ * Key format: "scopeId:pageId"
985
+ */
986
+ declare const pageVariablesAtom: jotai.PrimitiveAtom<Record<string, Record<string, unknown>>> & {
987
+ init: Record<string, Record<string, unknown>>;
988
+ };
989
+ /**
990
+ * Helper to generate composite keys for page variables.
991
+ */
992
+ declare const getPageVariablesCompositeKey: (scopeId: string, key: string) => string;
993
+ /**
994
+ * Creates a derived atom for accessing page variables of a specific scope.
995
+ */
996
+ declare const createScopePageVariablesAtom: (scopeId: string) => jotai.WritableAtom<Record<string, Record<string, unknown>>, [update: Record<string, Record<string, unknown>>], void>;
997
+
998
+ /**
999
+ * Next.js Integration Helpers
1000
+ *
1001
+ * Provides helpers for using the pages metadata system with Next.js:
1002
+ * - `toNextMetadata()` — App Router (`generateMetadata`)
1003
+ * - `NextHeadFromMetadata` — Pages Router (`next/head`)
1004
+ *
1005
+ * @module integrations/next
1006
+ */
1007
+
1008
+ /**
1009
+ * Subset of Next.js Metadata type that we map to.
1010
+ * Consumers can use this directly as the return type of `generateMetadata`.
1011
+ */
1012
+ interface NextMetadata {
1013
+ title?: string;
1014
+ description?: string;
1015
+ keywords?: Array<string>;
1016
+ authors?: Array<{
1017
+ name?: string;
1018
+ url?: string;
1019
+ }>;
1020
+ viewport?: string;
1021
+ themeColor?: string;
1022
+ robots?: string | {
1023
+ index?: boolean;
1024
+ follow?: boolean;
1025
+ noarchive?: boolean;
1026
+ nosnippet?: boolean;
1027
+ 'max-image-preview'?: 'none' | 'standard' | 'large';
1028
+ 'max-snippet'?: number;
1029
+ };
1030
+ alternates?: {
1031
+ canonical?: string;
1032
+ languages?: Record<string, string>;
1033
+ media?: Record<string, string>;
1034
+ types?: Record<string, string>;
1035
+ };
1036
+ openGraph?: {
1037
+ title?: string;
1038
+ description?: string;
1039
+ url?: string;
1040
+ siteName?: string;
1041
+ locale?: string;
1042
+ type?: string;
1043
+ images?: Array<{
1044
+ url: string;
1045
+ alt?: string;
1046
+ width?: number;
1047
+ height?: number;
1048
+ type?: string;
1049
+ }>;
1050
+ publishedTime?: string;
1051
+ modifiedTime?: string;
1052
+ authors?: Array<string>;
1053
+ section?: string;
1054
+ tags?: Array<string>;
1055
+ };
1056
+ twitter?: {
1057
+ card?: 'summary' | 'summary_large_image' | 'app' | 'player';
1058
+ site?: string;
1059
+ creator?: string;
1060
+ title?: string;
1061
+ description?: string;
1062
+ images?: Array<string | {
1063
+ url: string;
1064
+ alt?: string;
1065
+ }>;
1066
+ };
1067
+ icons?: {
1068
+ icon?: Array<{
1069
+ url: string;
1070
+ type?: string;
1071
+ sizes?: string;
1072
+ }>;
1073
+ apple?: Array<{
1074
+ url: string;
1075
+ type?: string;
1076
+ sizes?: string;
1077
+ }>;
1078
+ shortcut?: string;
1079
+ };
1080
+ manifest?: string;
1081
+ other?: Record<string, string>;
1082
+ }
1083
+ /**
1084
+ * Convert ResolvedMetadata into a Next.js Metadata object
1085
+ * for use with App Router's `generateMetadata` or `metadata` export.
1086
+ *
1087
+ * @example
1088
+ * ```ts
1089
+ * // app/page.tsx
1090
+ * import { resolveMetadata, toNextMetadata } from '@/core/pages';
1091
+ *
1092
+ * export async function generateMetadata() {
1093
+ * const resolved = resolveMetadata(pageConfig.meta, context);
1094
+ * return toNextMetadata(resolved);
1095
+ * }
1096
+ * ```
1097
+ */
1098
+ declare function toNextMetadata(resolved: ResolvedMetadata): NextMetadata;
1099
+ /**
1100
+ * Convert ResolvedMetadata into an array of React-compatible head tag descriptors
1101
+ * for use with `next/head` in the Pages Router.
1102
+ *
1103
+ * @example
1104
+ * ```tsx
1105
+ * // pages/index.tsx
1106
+ * import Head from 'next/head';
1107
+ * import { toNextHeadTags, resolveMetadata } from '@/core/pages';
1108
+ *
1109
+ * export default function Page() {
1110
+ * const resolved = resolveMetadata(pageConfig.meta, context);
1111
+ * const tags = toNextHeadTags(resolved);
1112
+ * return (
1113
+ * <>
1114
+ * <Head>{tags.map(t => t.html)}</Head>
1115
+ * <PageContent />
1116
+ * </>
1117
+ * );
1118
+ * }
1119
+ * ```
1120
+ *
1121
+ * Each tag has a `key` (for React list rendering) and `html` (raw HTML string).
1122
+ * For a JSX-based approach, use `collectMetadataToHtml` and inject via dangerouslySetInnerHTML.
1123
+ */
1124
+ interface HeadTag {
1125
+ key: string;
1126
+ tag: string;
1127
+ attributes: Record<string, string>;
1128
+ content?: string;
1129
+ }
1130
+ declare function toNextHeadTags(resolved: ResolvedMetadata): Array<HeadTag>;
1131
+
1132
+ /**
1133
+ * Sitemap & Robots.txt Generation Helpers
1134
+ *
1135
+ * Provides functions for generating sitemap.xml and robots.txt content
1136
+ * from page metadata. Useful for:
1137
+ * - Next.js App Router `app/sitemap.ts` and `app/robots.ts`
1138
+ * - Any SSR/SSG framework that needs sitemap generation
1139
+ *
1140
+ * @module integrations/sitemap
1141
+ */
1142
+ interface SitemapEntry {
1143
+ /** Absolute URL of the page */
1144
+ url: string;
1145
+ /** Last modification date (ISO 8601) */
1146
+ lastModified?: string | Date;
1147
+ /** Change frequency hint */
1148
+ changeFrequency?: 'always' | 'hourly' | 'daily' | 'weekly' | 'monthly' | 'yearly' | 'never';
1149
+ /** Priority (0.0 to 1.0, default 0.5) */
1150
+ priority?: number;
1151
+ /** Alternate language URLs */
1152
+ alternates?: Record<string, string>;
1153
+ }
1154
+ /**
1155
+ * Generate a sitemap.xml string from a list of entries.
1156
+ *
1157
+ * @example
1158
+ * ```ts
1159
+ * // app/sitemap.ts (Next.js App Router)
1160
+ * import { generateSitemapXml } from '@/core/pages/integrations/sitemap';
1161
+ *
1162
+ * export default function sitemap() {
1163
+ * return generateSitemapEntries([
1164
+ * { url: 'https://example.com', changeFrequency: 'daily', priority: 1.0 },
1165
+ * { url: 'https://example.com/about', changeFrequency: 'monthly', priority: 0.8 },
1166
+ * ]);
1167
+ * }
1168
+ * ```
1169
+ */
1170
+ declare function generateSitemapXml(entries: Array<SitemapEntry>): string;
1171
+ /**
1172
+ * Generate structured sitemap entries compatible with Next.js App Router `sitemap()`.
1173
+ * Returns plain objects that Next.js can serialize.
1174
+ */
1175
+ declare function generateSitemapEntries(entries: Array<SitemapEntry>): Array<{
1176
+ url: string;
1177
+ lastModified?: Date;
1178
+ changeFrequency?: string;
1179
+ priority?: number;
1180
+ }>;
1181
+ interface RobotsTxtConfig {
1182
+ /** Rules for specific or all user agents */
1183
+ rules: Array<{
1184
+ /** User agent string (e.g., "*", "Googlebot") */
1185
+ userAgent: string | Array<string>;
1186
+ /** Allowed paths */
1187
+ allow?: Array<string>;
1188
+ /** Disallowed paths */
1189
+ disallow?: Array<string>;
1190
+ /** Crawl delay in seconds */
1191
+ crawlDelay?: number;
1192
+ }>;
1193
+ /** Sitemap URLs to reference */
1194
+ sitemap?: string | Array<string>;
1195
+ /** Host directive */
1196
+ host?: string;
1197
+ }
1198
+ /**
1199
+ * Generate a robots.txt string from configuration.
1200
+ *
1201
+ * @example
1202
+ * ```ts
1203
+ * // app/robots.ts (Next.js App Router)
1204
+ * import { generateRobotsTxt } from '@/core/pages/integrations/sitemap';
1205
+ *
1206
+ * export default function robots() {
1207
+ * return generateRobotsTxt({
1208
+ * rules: [
1209
+ * { userAgent: '*', allow: ['/'], disallow: ['/admin'] },
1210
+ * { userAgent: 'Googlebot', allow: ['/'] },
1211
+ * ],
1212
+ * sitemap: 'https://example.com/sitemap.xml',
1213
+ * });
1214
+ * }
1215
+ * ```
1216
+ */
1217
+ declare function generateRobotsTxt(config: RobotsTxtConfig): string;
1218
+
1219
+ /**
1220
+ * JSON-LD Structured Data Builders
1221
+ *
1222
+ * Helpers to build valid schema.org JSON-LD objects for common types.
1223
+ * These can be passed to MetadataConfig.structuredData.schema or used
1224
+ * directly in a <script type="application/ld+json"> tag.
1225
+ *
1226
+ * @module integrations/jsonld
1227
+ */
1228
+ interface OrganizationJsonLdInput {
1229
+ name: string;
1230
+ url: string;
1231
+ logo?: string;
1232
+ description?: string;
1233
+ sameAs?: Array<string>;
1234
+ contactPoint?: {
1235
+ telephone?: string;
1236
+ contactType?: string;
1237
+ email?: string;
1238
+ areaServed?: string | Array<string>;
1239
+ availableLanguage?: string | Array<string>;
1240
+ };
1241
+ }
1242
+ declare function buildOrganizationJsonLd(input: OrganizationJsonLdInput): Record<string, unknown>;
1243
+ interface WebSiteJsonLdInput {
1244
+ name: string;
1245
+ url: string;
1246
+ description?: string;
1247
+ /** Enable sitelinks searchbox */
1248
+ potentialAction?: {
1249
+ /** URL template for search, e.g., "https://example.com/search?q={search_term_string}" */
1250
+ target: string;
1251
+ queryInput: string;
1252
+ };
1253
+ }
1254
+ declare function buildWebSiteJsonLd(input: WebSiteJsonLdInput): Record<string, unknown>;
1255
+ interface BreadcrumbItem {
1256
+ name: string;
1257
+ url: string;
1258
+ }
1259
+ declare function buildBreadcrumbListJsonLd(items: Array<BreadcrumbItem>): Record<string, unknown>;
1260
+ interface ArticleJsonLdInput {
1261
+ headline: string;
1262
+ description?: string;
1263
+ image?: string | Array<string>;
1264
+ datePublished?: string;
1265
+ dateModified?: string;
1266
+ author?: {
1267
+ name: string;
1268
+ url?: string;
1269
+ } | Array<{
1270
+ name: string;
1271
+ url?: string;
1272
+ }>;
1273
+ publisher?: {
1274
+ name: string;
1275
+ logo?: string;
1276
+ };
1277
+ url?: string;
1278
+ mainEntityOfPage?: string;
1279
+ }
1280
+ declare function buildArticleJsonLd(input: ArticleJsonLdInput): Record<string, unknown>;
1281
+ interface FAQItem {
1282
+ question: string;
1283
+ answer: string;
1284
+ }
1285
+ declare function buildFAQPageJsonLd(items: Array<FAQItem>): Record<string, unknown>;
1286
+ interface ProductJsonLdInput {
1287
+ name: string;
1288
+ description?: string;
1289
+ image?: string | Array<string>;
1290
+ brand?: string;
1291
+ sku?: string;
1292
+ offers?: {
1293
+ price: number;
1294
+ priceCurrency: string;
1295
+ availability?: 'InStock' | 'OutOfStock' | 'PreOrder' | 'SoldOut' | 'BackOrder';
1296
+ url?: string;
1297
+ priceValidUntil?: string;
1298
+ };
1299
+ aggregateRating?: {
1300
+ ratingValue: number;
1301
+ reviewCount: number;
1302
+ bestRating?: number;
1303
+ worstRating?: number;
1304
+ };
1305
+ }
1306
+ declare function buildProductJsonLd(input: ProductJsonLdInput): Record<string, unknown>;
1307
+
1308
+ /**
1309
+ * LLMs.txt Generation Support
1310
+ *
1311
+ * Generates `llms.txt` and `llms-full.txt` content following the
1312
+ * llms.txt specification (https://llmstxt.org/).
1313
+ *
1314
+ * The llms.txt file helps LLMs and AI agents discover what a site offers
1315
+ * and where to find key documentation/content.
1316
+ *
1317
+ * @module integrations/llms
1318
+ */
1319
+
1320
+ /**
1321
+ * Generate llms.txt content from configuration.
1322
+ *
1323
+ * Format (per spec):
1324
+ * ```
1325
+ * # Site Name
1326
+ *
1327
+ * > Brief description of the site
1328
+ *
1329
+ * ## Docs
1330
+ *
1331
+ * - [Title](url): Description
1332
+ * - [Title](url): Description
1333
+ * ```
1334
+ *
1335
+ * @example
1336
+ * ```ts
1337
+ * const content = generateLlmsTxt({
1338
+ * siteName: 'My App',
1339
+ * siteDescription: 'A great application for doing things.',
1340
+ * entries: [
1341
+ * { url: '/docs/getting-started', title: 'Getting Started', description: 'How to set up My App' },
1342
+ * { url: '/docs/api', title: 'API Reference', description: 'Complete API documentation' },
1343
+ * ],
1344
+ * });
1345
+ * // Write `content` to /llms.txt
1346
+ * ```
1347
+ */
1348
+ declare function generateLlmsTxt(config: LlmsTxtConfig): string;
1349
+ /**
1350
+ * Generate a full markdown version (llms-full.txt) that includes
1351
+ * more detailed content for each entry.
1352
+ *
1353
+ * This is useful for providing LLMs with the complete documentation
1354
+ * in a single file.
1355
+ */
1356
+ declare function generateLlmsFullTxt(config: LlmsTxtConfig, pageContents: Array<{
1357
+ entry: LlmsTxtEntry;
1358
+ markdown: string;
1359
+ }>): string;
1360
+ /**
1361
+ * Helper to convert a ResolvedMetadata + page text into a clean markdown
1362
+ * representation suitable for llms-full.txt or standalone .md endpoints.
1363
+ *
1364
+ * Strips HTML chrome, keeps headings coherent, and prepends metadata summary.
1365
+ */
1366
+ declare function pageToMarkdown(options: {
1367
+ title: string;
1368
+ description?: string;
1369
+ url: string;
1370
+ content: string;
1371
+ }): string;
1372
+
1373
+ interface FormNotificationMessage {
1374
+ message: string;
1375
+ type: 'success' | 'error' | 'info' | 'warning';
1376
+ autoHideDuration?: number;
1377
+ textTransOption?: Record<string, unknown>;
1378
+ ns?: string;
1379
+ }
1380
+ interface FormTranslationOptions {
1381
+ [key: string]: string | number | boolean | undefined;
1382
+ ns?: string;
1383
+ }
1384
+ interface FormConfigProps {
1385
+ formFieldContainer: React.FC<PropsWithChildren>;
1386
+ showNotification?: (notification: FormNotificationMessage) => void;
1387
+ translateText?: (key: string, options?: FormTranslationOptions) => string;
1388
+ }
1389
+ declare const formConfigAtom: _gaddario98_react_state.PrimitiveAtom<FormConfigProps>;
1390
+ declare const useFormConfigValue: () => FormConfigProps;
1391
+ declare const useFormConfigState: () => [FormConfigProps, (value: FormConfigProps) => void];
1392
+ declare const useFormConfigReset: () => () => void;
1393
+
1394
+ interface UseCustomFormOptions<TData extends FieldValues> extends FormOptions<TData, any, any, any, any, any, any, any, any, any, any, any> {
1395
+ formId?: string;
1396
+ }
1397
+ declare function useJotaiForm<TData extends FieldValues>(formOptions: UseCustomFormOptions<TData>): _tanstack_react_form.ReactFormExtendedApi<TData, any, any, any, any, any, any, any, any, any, any, any>;
1398
+
1399
+ interface FormElements {
1400
+ index: number;
1401
+ element: JSX$1.Element;
1402
+ renderInFooter: boolean;
1403
+ renderInHeader: boolean;
1404
+ isSubmit?: boolean;
1405
+ }
1406
+ declare const useFormManager: <F extends FieldValues = FieldValues>({ data, onInvalid, submit, notification, formOptions, onValuesChange, globalErrorNs, id, }: UseFormManagerProps<F>) => {
1407
+ elements: FormElements[];
1408
+ formContents: (FormManagerConfig<F> | ((props: FormFunctionProps<F>) => FormManagerConfig<F>) | Submit<F, SubmitKeysArg<F>>)[];
1409
+ errors: any[];
1410
+ formValues: F;
1411
+ setValue: SetValueFunction<F>;
1412
+ };
1413
+
1414
+ interface UseFormValuesProps {
1415
+ formId: string;
1416
+ scopeId?: string;
1417
+ }
1418
+ declare const useFormValues: <F extends FieldValues>({ formId, }: UseFormValuesProps) => FormFunctionProps<F>;
1419
+
1420
+ type FieldValues = Record<string, any>;
1421
+ type SetValueFunction<F extends FieldValues> = <TField extends DeepKeys<F>>(field: TField, value: DeepValue<F, TField>) => void;
1422
+ type GetFormValuesFunction<F extends FieldValues> = {
1423
+ <TField extends DeepKeys<F>>(key: TField): DeepValue<F, TField> | undefined;
1424
+ <TField extends DeepKeys<F>>(key: TField, defaultValue: DeepValue<F, TField>): NonNullable<DeepValue<F, TField>>;
1425
+ };
1426
+ type GenericFormApi<TData extends FieldValues> = ReactFormExtendedApi<TData, any, any, any, any, any, any, any, any, any, any, any>;
1427
+ type GenericFieldApi<TData extends FieldValues> = FieldApi<TData, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any>;
1428
+ type GenericFieldState<TData extends FieldValues> = FieldState<TData, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any>;
1429
+ type SubmitKeysArg<T> = ReadonlyArray<keyof T> | undefined;
1430
+ type SubmitPayload<T, K extends SubmitKeysArg<T>> = K extends ReadonlyArray<keyof T> ? Pick<T, K[number]> : T;
1431
+ type FormFunctionProps<F extends FieldValues> = {
1432
+ get: GetFormValuesFunction<F>;
1433
+ set: SetValueFunction<F>;
1434
+ };
1435
+ interface Submit<T extends FieldValues = FieldValues, K extends SubmitKeysArg<T> = SubmitKeysArg<T>> {
1436
+ onSuccess?: (values: T) => void;
1437
+ onError?: (err: Error) => void;
1438
+ values?: K;
1439
+ index?: number;
1440
+ buttonProps?: Record<string, unknown>;
1441
+ renderInFooter?: boolean;
1442
+ hidden?: boolean;
1443
+ renderInHeader?: boolean;
1444
+ isDisabled?: boolean;
1445
+ isDraggable?: boolean;
1446
+ isInDraggableView?: boolean;
1447
+ isLoading?: boolean;
1448
+ usedBoxes?: number;
1449
+ type?: 'submit' | 'button';
1450
+ key?: string;
1451
+ component?: (props: {
1452
+ onClick: () => void;
1453
+ index: number;
1454
+ key: string;
1455
+ type: 'submit' | 'button';
1456
+ }) => React__default.JSX.Element;
1457
+ }
1458
+ interface ViewSettingsContainerProps {
1459
+ children: React__default.ReactNode;
1460
+ }
1461
+ type FormManagerProps<T extends FieldValues = FieldValues> = {
1462
+ data: Array<FormManagerConfig<T> | ((props: FormFunctionProps<T>) => FormManagerConfig<T>)>;
1463
+ defaultValues: T;
1464
+ onInvalid?: (err: unknown) => void;
1465
+ isHiddenErrors?: boolean;
1466
+ ns?: string;
1467
+ globalErrorNs?: string;
1468
+ submit?: Array<Submit<T>>;
1469
+ notification?: {
1470
+ success?: FormNotificationMessage | ((res: unknown) => FormNotificationMessage);
1471
+ error?: FormNotificationMessage | ((error: string) => FormNotificationMessage);
1472
+ ns?: string;
1473
+ };
1474
+ onValuesChange?: (props: T, setValue: (name: any, value: any) => void) => void;
1475
+ formSettings?: UseCustomFormOptions<T>;
1476
+ isDraggable?: boolean;
1477
+ isInDraggableView?: boolean;
1478
+ id?: string;
1479
+ viewSettings?: {
1480
+ container?: React__default.ComponentType<ViewSettingsContainerProps>;
1481
+ submitContainer?: React__default.ComponentType<ViewSettingsContainerProps>;
1482
+ bodyContainer?: React__default.ComponentType<ViewSettingsContainerProps>;
1483
+ containerProps?: Record<string, unknown>;
1484
+ submitContainerProps?: Record<string, unknown>;
1485
+ bodyContainerProps?: Record<string, unknown>;
1486
+ };
1487
+ };
1488
+ type UseFormManagerProps<T extends FieldValues> = {
1489
+ data: Array<FormManagerConfig<T> | ((props: FormFunctionProps<T>) => FormManagerConfig<T>)>;
1490
+ onInvalid?: (err: unknown) => void;
1491
+ formOptions: UseCustomFormOptions<T>;
1492
+ isHiddenErrors?: boolean;
1493
+ ns?: string;
1494
+ globalErrorNs?: string;
1495
+ submit?: Array<Submit<T>>;
1496
+ notification?: {
1497
+ success?: FormNotificationMessage | ((res: unknown) => FormNotificationMessage);
1498
+ error?: FormNotificationMessage | ((error: string) => FormNotificationMessage);
1499
+ ns?: string;
1500
+ };
1501
+ onValuesChange?: (props: T, setValue: (name: any, value: any) => void) => void;
1502
+ id?: string;
1503
+ };
1504
+ interface FieldComponentProps<T extends FieldValues> {
1505
+ value: any;
1506
+ onChange: (value: any) => void;
1507
+ onBlur: () => void;
1508
+ error?: boolean;
1509
+ errorMessage?: string;
1510
+ formValues?: T;
1511
+ label?: string;
1512
+ helperMessage?: string;
1513
+ }
1514
+ type FormManagerConfig<T extends FieldValues> = Omit<FormFieldConfig<T>, 'field' | 'fieldState' | 'fieldValues'>;
1515
+ type MappedFormItemsFunction<F extends FieldValues, ComponentType> = (props: FormFunctionProps<F>) => ComponentType;
1516
+ type Rules = {
1517
+ validate?: (value: any) => string | undefined | Promise<string | undefined>;
1518
+ onChange?: (value: any) => void;
1519
+ onBlur?: () => void;
1520
+ onMount?: (value: any) => void;
1521
+ };
1522
+ type FormFieldConfig<T extends FieldValues> = {
1523
+ name: any;
1524
+ label?: string;
1525
+ rules?: Rules | MappedFormItemsFunction<T, Rules>;
1526
+ field: GenericFieldApi<T>;
1527
+ fieldState: GenericFieldState<T>;
1528
+ containerStyle?: string;
1529
+ component: (props: Omit<FieldComponentProps<T>, 'formValues'>) => React__default.JSX.Element;
1530
+ container?: React__default.FC<PropsWithChildren>;
1531
+ ns?: string;
1532
+ errorNs?: string;
1533
+ index?: number;
1534
+ renderInFooter?: boolean;
1535
+ renderInHeader?: boolean;
1536
+ usedBoxes?: number;
1537
+ key?: string;
1538
+ isDraggable?: boolean;
1539
+ isInDraggableView?: boolean;
1540
+ helper?: {
1541
+ text?: string;
1542
+ translationOption?: FormTranslationOptions;
1543
+ };
1544
+ onFieldChange?: (value: any) => void;
1545
+ hidden?: boolean | MappedFormItemsFunction<T, boolean>;
1546
+ };
1547
+ interface ErrorComponentProps {
1548
+ message?: string;
1549
+ fieldName?: string;
1550
+ }
1551
+ interface FormContainerProps {
1552
+ className?: string;
1553
+ children: React__default.ReactNode;
1554
+ }
1555
+ interface FormFieldProps<T extends FieldValues> {
1556
+ config: FormFieldConfig<T>;
1557
+ onFieldChange?: (value: T) => void;
1558
+ ns?: string;
1559
+ globalErrorNs?: string;
1560
+ container?: React__default.FC<PropsWithChildren>;
1561
+ }
1562
+
1563
+ interface DefaultFormContainerProps {
1564
+ children: React.ReactNode;
1565
+ }
1566
+ declare let DefaultContainer: ({ children }: ViewSettingsContainerProps) => React$1.ReactNode;
1567
+ declare const setDefaultFormContainer: (val: ({ children, }: ViewSettingsContainerProps) => React.ReactNode) => void;
1568
+ declare const DefaultFormContainer: <_T extends FieldValues = FieldValues>({ children, }: ViewSettingsContainerProps) => react_jsx_runtime.JSX.Element;
1569
+
1570
+ declare const FormManager: <T extends Record<string, any> = FieldValues>({ data, defaultValues, onInvalid, submit, ns, globalErrorNs, notification, formSettings, viewSettings, onValuesChange, id, }: FormManagerProps<T>) => react_jsx_runtime.JSX.Element;
1571
+
1572
+ declare const FormField: <T extends FieldValues>({ config, onFieldChange, ns: globalNs, globalErrorNs, }: FormFieldProps<T>) => react_jsx_runtime.JSX.Element;
1573
+
1574
+ interface FormStoreEntry<F extends FieldValues = FieldValues> {
1575
+ formValues: F;
1576
+ setValue: SetValueFunction<F>;
1577
+ }
1578
+ declare const DEFAULT_FORM_ENTRY: FormStoreEntry<FieldValues>;
1579
+ /**
1580
+ * Global atom storing all form state.
1581
+ * Key format: "scopeId:formId" or just "formId" for backward compatibility.
1582
+ */
1583
+ declare const formAtom: jotai.PrimitiveAtom<Record<string, FormStoreEntry<FieldValues>>> & {
1584
+ init: Record<string, FormStoreEntry<FieldValues>>;
1585
+ };
1586
+ /**
1587
+ * Helper to generate composite keys for forms.
1588
+ */
1589
+ declare const getFormCompositeKey: (scopeId: string, key: string) => string;
1590
+ /**
1591
+ * Creates a derived atom for accessing forms of a specific scope.
1592
+ */
1593
+ declare const createScopeFormsAtom: (scopeId: string) => jotai.WritableAtom<Record<string, FormStoreEntry<FieldValues>>, [update: Record<string, FormStoreEntry<FieldValues>>], void>;
1594
+ declare const createFormSelector: <F extends FieldValues = FieldValues>(formId: string) => jotai.Atom<FormStoreEntry<F>>;
1595
+ declare const useFormValue: <F extends FieldValues>(formId: string) => FormStoreEntry<F>;
1596
+ declare const useFormState: <F extends FieldValues>() => [Record<string, FormStoreEntry<F>>, (value: Record<string, FormStoreEntry<F>>) => void];
1597
+ declare const useSetFormState: <F extends FieldValues>(formId: string) => (val: Partial<FormStoreEntry<F>>) => void;
1598
+
1599
+ type Locale = string;
1600
+ type TranslationResources = Record<string, any>;
1601
+ /**
1602
+ * Opzioni di formattazione per i diversi tipi di valori
1603
+ */
1604
+ interface FormatOptions {
1605
+ number?: Intl.NumberFormatOptions;
1606
+ date?: Intl.DateTimeFormatOptions;
1607
+ currency?: Intl.NumberFormatOptions & {
1608
+ currency?: string;
1609
+ };
1610
+ }
1611
+ /**
1612
+ * Opzioni per la traduzione con supporto parametri avanzati
1613
+ */
1614
+ interface TranslationOptions {
1615
+ [key: string]: any;
1616
+ defaultValue?: string;
1617
+ /**
1618
+ * Opzioni di formattazione per i parametri specifici
1619
+ *
1620
+ * @example
1621
+ * ```ts
1622
+ * t('welcome', {
1623
+ * price: 1234.56,
1624
+ * formatOptions: {
1625
+ * price: {
1626
+ * currency: { currency: 'EUR', minimumFractionDigits: 2 }
1627
+ * }
1628
+ * }
1629
+ * })
1630
+ * ```
1631
+ */
1632
+ formatOptions?: Record<string, FormatOptions>;
1633
+ ns?: string;
1634
+ }
1635
+ /**
1636
+ * Funzione di traduzione con supporto parametri avanzati
1637
+ *
1638
+ * @example Interpolazione semplice
1639
+ * ```ts
1640
+ * t('welcome', { name: 'Mario' })
1641
+ * // "Benvenuto {{name}}" -> "Benvenuto Mario"
1642
+ * ```
1643
+ *
1644
+ * @example Formattazione numeri
1645
+ * ```ts
1646
+ * t('items_count', { count: 1000 })
1647
+ * // "Hai {{count, number}} elementi" -> "Hai 1,000 elementi"
1648
+ * ```
1649
+ *
1650
+ * @example Formattazione date
1651
+ * ```ts
1652
+ * t('last_login', { date: new Date() })
1653
+ * // "Ultimo accesso: {{date, date}}" -> "Ultimo accesso: 15/12/2025"
1654
+ * ```
1655
+ *
1656
+ * @example Formattazione valuta
1657
+ * ```ts
1658
+ * t('total', {
1659
+ * price: 99.99,
1660
+ * formatOptions: {
1661
+ * price: { currency: { currency: 'EUR' } }
1662
+ * }
1663
+ * })
1664
+ * // "Totale: {{price, currency}}" -> "Totale: €99.99"
1665
+ * ```
1666
+ *
1667
+ * @example Pluralizzazione
1668
+ * ```ts
1669
+ * t('items', { count: 0 })
1670
+ * // "{{count, plural, =0{Nessun elemento} one{Un elemento} other{# elementi}}}"
1671
+ * // -> "Nessun elemento"
1672
+ *
1673
+ * t('items', { count: 1 })
1674
+ * // -> "Un elemento"
1675
+ *
1676
+ * t('items', { count: 5 })
1677
+ * // -> "5 elementi"
1678
+ * ```
1679
+ *
1680
+ * @example Selezione
1681
+ * ```ts
1682
+ * t('greeting', { gender: 'male' })
1683
+ * // "{{gender, select, male{Benvenuto} female{Benvenuta} other{Benvenuto/a}}}"
1684
+ * // -> "Benvenuto"
1685
+ * ```
1686
+ */
1687
+ type TranslateFunction = (key: string, options?: TranslationOptions) => string;
1688
+ interface I18nConfig {
1689
+ defaultLocale: Locale;
1690
+ supportedLocales: Array<Locale>;
1691
+ }
1692
+
1693
+ interface LocalizationConfigProps {
1694
+ currentLocale: Locale;
1695
+ locales: Record<Locale, TranslationResources>;
1696
+ }
1697
+ declare const localizationConfigAtom: _gaddario98_react_state.PrimitiveAtom<LocalizationConfigProps>;
1698
+ declare const useLocalizationConfigValue: () => LocalizationConfigProps;
1699
+ declare const useLocalizationConfigState: () => [LocalizationConfigProps, (value: LocalizationConfigProps) => void];
1700
+ declare const useLocalizationConfigReset: () => () => void;
1701
+ /**
1702
+ * Hook per gestire le operazioni di localization
1703
+ */
1704
+ declare const useLocalizationActions: () => {
1705
+ /**
1706
+ * Aggiunge o aggiorna una locale con le sue risorse
1707
+ */
1708
+ addLocale: (locale: Locale, resources: TranslationResources) => void;
1709
+ /**
1710
+ * Switch alla locale specificata
1711
+ */
1712
+ switchLocale: (locale: Locale) => void;
1713
+ /**
1714
+ * Inizializza con una locale di default
1715
+ */
1716
+ initializeLocale: (locale: Locale, resources: TranslationResources) => void;
1717
+ };
1718
+
1719
+ /**
1720
+ * Funzione core per risolvere una traduzione.
1721
+ */
1722
+ declare const resolveTranslation: (key: string, resources: TranslationResources, options?: TranslationOptions, locale?: string) => string;
1723
+
1724
+ declare const useTranslation: (_ns?: string) => {
1725
+ t: TranslateFunction;
1726
+ locale: Locale;
1727
+ };
1728
+
1729
+ /**
1730
+ * Crea un'istanza di traduzione per l'uso lato server (o fuori dai componenti React).
1731
+ */
1732
+ declare const createServerTranslator: (resources: TranslationResources, locale?: Locale) => {
1733
+ t: TranslateFunction;
1734
+ locale: Locale;
1735
+ };
1736
+
1737
+ type TranslationFunction = (key: string, options?: TranslationOptions) => string;
1738
+ /**
1739
+ * Hook per tradurre testi che si adatta al sistema di traduzione interno.
1740
+ * Wrapper di retro-compatibilità per useTranslation.
1741
+ *
1742
+ * @param ns - Namespace opzionale (ignorato nella nuova implementazione)
1743
+ * @returns Un oggetto con la funzione traslateText (e alias t)
1744
+ */
1745
+ declare const useTranslatedText: (ns?: string) => {
1746
+ traslateText: (text: string, options?: TranslationOptions) => string;
1747
+ t: (text: string, options?: TranslationOptions) => string;
1748
+ };
1749
+
1750
+ type ProviderConfig = React__default.ComponentType<{
1751
+ children: ReactNode;
1752
+ }> | [React__default.ComponentType<any>, any];
1753
+ interface AppProvidersProps {
1754
+ providers?: Array<ProviderConfig>;
1755
+ }
1756
+ declare const AppProviders: React__default.FC<PropsWithChildren<AppProvidersProps>>;
1757
+
1758
+ type ApiMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
1759
+ type Endpoint = Record<string, string>;
1760
+ interface QueriesProps<TProps, TResponse, TConverter = null> {
1761
+ endpoint: [keyof Endpoint, string] | [keyof Endpoint];
1762
+ queryKeyToInvalidate?: Array<string>;
1763
+ headers?: AxiosRequestConfig['headers'];
1764
+ method: ApiMethod;
1765
+ converter?: (props: TProps) => TConverter;
1766
+ customRequest?: (url: string, method: string, data: TProps) => Promise<TResponse>;
1767
+ mutateOptions?: MutateOptions<TResponse, Error, TProps, unknown>;
1768
+ isTest?: boolean;
1769
+ notification?: {
1770
+ success?: NotificationConfig | ((res: TResponse) => NotificationConfig);
1771
+ error?: NotificationConfig | ((error: string) => NotificationConfig);
1772
+ translationOption?: Record<string, any>;
1773
+ };
1774
+ }
1775
+ interface QueryProps<Key extends string, TResponse> {
1776
+ endpoint: [keyof Endpoint, string] | [keyof Endpoint];
1777
+ queryKey: Array<string>;
1778
+ enabled: boolean;
1779
+ keyToMap: Key;
1780
+ disableLoading?: boolean;
1781
+ customQueryFn?: () => Promise<TResponse>;
1782
+ headers?: AxiosRequestConfig['headers'];
1783
+ disableAuthControl?: boolean;
1784
+ onDataChanged?: (data: TResponse) => void;
1785
+ onStateChange?: (state: QueryResult<TResponse>) => void;
1786
+ options?: Omit<Parameters<typeof useQuery<TResponse>>['0'], 'queryKey' | 'queryFn'>;
1787
+ }
1788
+ interface CustomQueryOptions<TResponse> extends Omit<UseQueryOptions<TResponse, Error>, 'queryKey' | 'queryFn'> {
1789
+ endpoint: [keyof Endpoint, string] | [keyof Endpoint];
1790
+ queryKey: Array<string>;
1791
+ headers?: AxiosRequestConfig['headers'];
1792
+ disableAuthControl?: boolean;
1793
+ onDataChanged?: (data: TResponse | undefined) => void;
1794
+ onStateChange?: (state: QueryResult<TResponse>) => void;
1795
+ options?: Omit<Parameters<typeof useQuery<TResponse>>['0'], 'queryKey' | 'queryFn'>;
1796
+ keyToMap?: string;
1797
+ disableLoading?: boolean;
1798
+ customQueryFn?: () => Promise<TResponse>;
1799
+ }
1800
+ interface CustomMutationOptions<TProps, TResponse> extends UseMutationOptions<TResponse, Error, TProps, unknown> {
1801
+ endpoint: [keyof Endpoint, string] | [keyof Endpoint];
1802
+ method: ApiMethod;
1803
+ headers?: AxiosRequestConfig['headers'];
1804
+ queryKeyToInvalidate?: Array<string>;
1805
+ customRequest?: (url: string, method: string, data: TProps) => Promise<TResponse>;
1806
+ converter?: (props: TProps) => any;
1807
+ isTest?: boolean;
1808
+ notification?: {
1809
+ success?: NotificationConfig | ((res: TResponse) => NotificationConfig);
1810
+ error?: NotificationConfig | ((error: string) => NotificationConfig);
1811
+ translationOption?: Record<string, any>;
1812
+ };
1813
+ }
1814
+ type QueryDefinition<K extends string, T extends 'query' | 'mutation' | 'websocket', P, R, C = any> = {
1815
+ key: K;
1816
+ props: P;
1817
+ response?: R;
1818
+ converter: C;
1819
+ type: T;
1820
+ };
1821
+ type QueriesArray = Array<QueryDefinition<string, any, any, any, any>>;
1822
+ type ExtractQuery<Q extends QueriesArray> = Extract<Q[number], {
1823
+ type: 'query';
1824
+ }>;
1825
+ type ExtractWebSocket<Q extends QueriesArray> = Extract<Q[number], {
1826
+ type: 'websocket';
1827
+ }>;
1828
+ type ExtractQueryResponse<Q extends QueriesArray, K extends Q[number]['key']> = Extract<Q[number], {
1829
+ key: K;
1830
+ }>;
1831
+ type ExtractMutation<Q extends QueriesArray> = Extract<Q[number], {
1832
+ type: 'mutation';
1833
+ }>;
1834
+ type CustomMutation<TData = unknown, TError = Error, TVariables = void, TOnMutateResult = unknown> = typeof useMutation<TData, TError, TVariables, TOnMutateResult> & {
1835
+ endpoint: string;
1836
+ };
1837
+ type AllMutation<Q extends QueriesArray = QueriesArray> = {
1838
+ [K in ExtractMutation<Q>['key']]: ReturnType<CustomMutation<ExtractQueryResponse<Q, K>['response'], Error, ExtractQueryResponse<Q, K>['props'], unknown>> & {
1839
+ endpoint: QueriesProps<any, any>['endpoint'];
1840
+ };
1841
+ };
1842
+ type ExtractMutationByKey<Q extends QueriesArray = QueriesArray, K extends ExtractMutation<Q>['key'] = ExtractMutation<Q>['key']> = ReturnType<CustomMutation<ExtractQueryResponse<Q, K>['response'], Error, ExtractQueryResponse<Q, K>['props'], unknown>>;
1843
+ type ExtractQueryByKey<Q extends QueriesArray = QueriesArray, K extends ExtractQuery<Q>['key'] = ExtractQuery<Q>['key']> = {
1844
+ data?: ExtractQueryResponse<Q, K>['response'];
1845
+ isLoading: boolean;
1846
+ isLoadingMapped: boolean;
1847
+ isFetching: boolean;
1848
+ isPending: boolean;
1849
+ error: Error | null;
1850
+ refetch: () => Promise<unknown>;
1851
+ };
1852
+ interface MutationConfig<TProps = unknown, TResponse = unknown, TConverter = any> extends QueriesProps<TProps, TResponse, TConverter> {
1853
+ method: 'POST' | 'PUT' | 'DELETE' | 'PATCH';
1854
+ onStateChange?: (state: MutationStateInternal<TResponse>) => void;
1855
+ }
1856
+ interface QueryResult<TResponse> {
1857
+ data?: TResponse;
1858
+ isLoading: boolean;
1859
+ isLoadingMapped: boolean;
1860
+ isFetching: boolean;
1861
+ isPending: boolean;
1862
+ error: Error | null;
1863
+ refetch: () => Promise<unknown>;
1864
+ }
1865
+ type MultipleQueryResponse<Q extends QueriesArray> = {
1866
+ [K in ExtractQuery<Q>['key']]: {
1867
+ data: ExtractQueryResponse<Q, K>['response'];
1868
+ isLoading: boolean;
1869
+ isLoadingMapped: boolean;
1870
+ isFetching: boolean;
1871
+ isPending: boolean;
1872
+ error: Error | null;
1873
+ refetch: () => Promise<unknown>;
1874
+ };
1875
+ };
1876
+ interface QueryConfig<K extends string, TResponse> extends CustomQueryOptions<TResponse> {
1877
+ keyToMap: K;
1878
+ }
1879
+ type SingleQueryConfig<Q extends QueryDefinition<any, any, any, any>> = Q extends QueryDefinition<infer K, infer T, infer P, infer R, infer C> ? T extends 'mutation' ? {
1880
+ type: 'mutation';
1881
+ mutationConfig: MutationConfig<P, R, C>;
1882
+ key: K;
1883
+ } : T extends 'query' ? {
1884
+ type: 'query';
1885
+ queryConfig?: Omit<QueryConfig<K, R>, 'keyToMap'>;
1886
+ key: K;
1887
+ } : WebSocketDefinition<K> : never;
1888
+ type QueryAtIndex<Q extends QueriesArray, I extends keyof Q> = Q[I] extends QueryDefinition<infer K, infer T, infer P, infer R, infer C> ? QueryDefinition<K, T, P, R, C> : never;
1889
+ type QueryConfigArray<Q extends QueriesArray> = {
1890
+ [I in keyof Q]: SingleQueryConfig<QueryAtIndex<Q, I>>;
1891
+ };
1892
+ interface ContextValue<Q extends QueriesArray> {
1893
+ allMutation: AllMutation<Q>;
1894
+ allQuery: MultipleQueryResponse<Q>;
1895
+ allWebSocket: MultipleWebSocketResponse<Q[number]['key']>;
1896
+ refreshQueries: () => void;
1897
+ }
1898
+ type MultipleWebSocketResponse<K extends string = string> = {
1899
+ [key in K]: WebSocketResult;
1900
+ };
1901
+ type MutationItem<Q extends QueriesArray> = Extract<QueryConfigArray<Q>[number], {
1902
+ type: 'mutation';
1903
+ mutationConfig: any;
1904
+ }>;
1905
+ type QueryItem<Q extends QueriesArray> = Extract<QueryConfigArray<Q>[number], {
1906
+ type: 'query';
1907
+ }>;
1908
+ interface WebSocketDefinition<TKey extends string = string> {
1909
+ key: TKey;
1910
+ endpoint?: string;
1911
+ onMessage?: (data: any) => void;
1912
+ invalidateQueriesOnMessage?: Array<string>;
1913
+ autoConnect?: boolean;
1914
+ type: 'websocket';
1915
+ }
1916
+ type WebSocketsArray = Array<WebSocketDefinition<string>>;
1917
+ interface WebSocketResult {
1918
+ lastMessage: any;
1919
+ sendMessage: (message: any) => void;
1920
+ status: 'connecting' | 'open' | 'closed';
1921
+ }
1922
+ interface MutationStateInternal<TData = unknown> {
1923
+ status: 'idle' | 'pending' | 'success' | 'error';
1924
+ data: TData | undefined;
1925
+ error: Error | null;
1926
+ submittedAt: number | null;
1927
+ variables: unknown | undefined;
1928
+ }
1929
+ type MutationActionInternal = {
1930
+ type: 'RESET';
1931
+ key: string;
1932
+ } | {
1933
+ type: 'PENDING';
1934
+ key: string;
1935
+ submittedAt: number;
1936
+ variables: unknown;
1937
+ } | {
1938
+ type: 'SUCCESS';
1939
+ key: string;
1940
+ data: unknown;
1941
+ } | {
1942
+ type: 'ERROR';
1943
+ key: string;
1944
+ error: Error;
1945
+ };
1946
+ type StringKey<T> = Extract<keyof T, string>;
1947
+ type QueryTopKey<Q extends QueriesArray> = StringKey<MultipleQueryResponse<Q>>;
1948
+ type QuerySubKey<Q extends QueriesArray, K extends QueryTopKey<Q>> = StringKey<MultipleQueryResponse<Q>[K]>;
1949
+ type QueryCompositeKey<Q extends QueriesArray> = {
1950
+ [K in QueryTopKey<Q>]: K | `${K}.${QuerySubKey<Q, K>}`;
1951
+ }[QueryTopKey<Q>];
1952
+ type QueryValue<Q extends QueriesArray, K extends QueryCompositeKey<Q>> = K extends `${infer Top}.${infer Sub}` ? Top extends QueryTopKey<Q> ? Sub extends QuerySubKey<Q, Top> ? MultipleQueryResponse<Q>[Top][Sub] : never : never : K extends QueryTopKey<Q> ? MultipleQueryResponse<Q>[K] : never;
1953
+ type MutationTopKey<Q extends QueriesArray> = StringKey<AllMutation<Q>>;
1954
+ type MutationSubKey<Q extends QueriesArray, K extends MutationTopKey<Q>> = StringKey<AllMutation<Q>[K]>;
1955
+ type MutationCompositeKey<Q extends QueriesArray> = {
1956
+ [K in MutationTopKey<Q>]: K | `${K}.${MutationSubKey<Q, K>}`;
1957
+ }[MutationTopKey<Q>];
1958
+ type MutationValue<Q extends QueriesArray, K extends MutationCompositeKey<Q>> = K extends `${infer Top}.${infer Sub}` ? Top extends MutationTopKey<Q> ? Sub extends MutationSubKey<Q, Top> ? AllMutation<Q>[Top][Sub] : never : never : K extends MutationTopKey<Q> ? AllMutation<Q>[K] : never;
1959
+ type GetApiValuesFunction<Q extends QueriesArray> = {
1960
+ <K extends QueryTopKey<Q>>(type: 'query', key: K): MultipleQueryResponse<Q>[K];
1961
+ <K extends QueryCompositeKey<Q>>(type: 'query', key: K): QueryValue<Q, K>;
1962
+ <K extends QueryCompositeKey<Q>>(type: 'query', key: K, defaultValue: unknown): NonNullable<QueryValue<Q, K>>;
1963
+ <K extends MutationCompositeKey<Q>>(type: 'mutation', key: K, defaultValue: unknown): NonNullable<MutationValue<Q, K>>;
1964
+ <K extends QueryTopKey<Q>>(type: 'query', key: K, defaultValue: MultipleQueryResponse<Q>[K]['data']): MultipleQueryResponse<Q>[K]['data'];
1965
+ <K extends QueryCompositeKey<Q>>(type: 'query', key: K, defaultValue: QueryValue<Q, K>): NonNullable<QueryValue<Q, K>>;
1966
+ <K extends MutationTopKey<Q>>(type: 'mutation', key: K): AllMutation<Q>[K];
1967
+ <K extends MutationCompositeKey<Q>>(type: 'mutation', key: K): MutationValue<Q, K>;
1968
+ <K extends MutationTopKey<Q>>(type: 'mutation', key: K, defaultValue: AllMutation<Q>[K]['data']): AllMutation<Q>[K]['data'];
1969
+ <K extends MutationCompositeKey<Q>>(type: 'mutation', key: K, defaultValue: MutationValue<Q, K>): NonNullable<MutationValue<Q, K>>;
1970
+ (type: 'query' | 'mutation', key: string, defaultValue?: unknown): unknown;
1971
+ };
1972
+
1973
+ type QueryStoreEntry<Q extends QueriesArray = QueriesArray> = QueryResult<Q[number]['response']>;
1974
+ type MutationStoreEntry<Q extends QueriesArray = QueriesArray> = UseMutationResult<Q[number]['response'], Error, Q[number]['props'], unknown>;
1975
+ declare const DEFAULT_QUERY_ENTRY: QueryStoreEntry;
1976
+ declare const DEFAULT_MUTATION_ENTRY: MutationStoreEntry;
1977
+ /**
1978
+ * Global atom storing all query results.
1979
+ * Key format: "scopeId:queryKey"
1980
+ */
1981
+ declare const queriesAtom: jotai.WritableAtom<Record<string, QueryStoreEntry<QueriesArray>>, [Record<string, QueryStoreEntry<QueriesArray>> | typeof jotai_utils.RESET | ((prev: Record<string, QueryStoreEntry<QueriesArray>>) => Record<string, QueryStoreEntry<QueriesArray>> | typeof jotai_utils.RESET)], void>;
1982
+ /**
1983
+ * Global atom storing all mutation results.
1984
+ * Key format: "scopeId:mutationKey"
1985
+ */
1986
+ declare const mutationsAtom: jotai.PrimitiveAtom<Record<string, MutationStoreEntry<QueriesArray>>> & {
1987
+ init: Record<string, MutationStoreEntry<QueriesArray>>;
1988
+ };
1989
+ declare const getCompositeKey: (scopeId: string, key: string) => string;
1990
+ /**
1991
+ * Creates a derived atom for accessing queries of a specific scope.
1992
+ */
1993
+ declare const createScopeQueriesAtom: (scopeId: string) => jotai.WritableAtom<Record<string, QueryStoreEntry<QueriesArray>>, [update: Record<string, QueryStoreEntry<QueriesArray>>], void>;
1994
+ /**
1995
+ * Creates a derived atom for accessing mutations of a specific scope.
1996
+ */
1997
+ declare const createScopeMutationsAtom: (scopeId: string) => jotai.WritableAtom<Record<string, MutationStoreEntry<QueriesArray>>, [update: Record<string, MutationStoreEntry<QueriesArray>>], void>;
1998
+ declare const createQuerySelector: <Q extends QueriesArray>(scopeId: string, queryKey: string) => jotai.Atom<QueryStoreEntry<Q>>;
1999
+ declare const createMutationSelector: <Q extends QueriesArray>(scopeId: string, mutationKey: string) => jotai.Atom<MutationStoreEntry<Q>>;
2000
+
2001
+ interface EncryptionConfig {
2002
+ secretKey: string;
2003
+ enabled?: boolean;
2004
+ encryptFn?: (data: unknown, key: string) => Promise<string>;
2005
+ decryptFn?: (data: string, key: string) => Promise<unknown>;
2006
+ }
2007
+ type ApiConverter<TProps, TConverter> = (props: TProps) => TConverter;
2008
+ interface ApiRequestFnProps<TProps, TConverter = TProps> {
2009
+ url: string;
2010
+ method: ApiMethod;
2011
+ body?: TProps;
2012
+ headers?: AxiosRequestConfig['headers'];
2013
+ converter?: ApiConverter<TProps, TConverter>;
2014
+ }
2015
+ interface ApiNotificationMessage {
2016
+ message: string;
2017
+ type: 'success' | 'error' | 'info' | 'warning';
2018
+ autoHideDuration?: number;
2019
+ textTransOption?: Record<string, unknown>;
2020
+ ns?: string;
2021
+ }
2022
+ interface ApiConfig {
2023
+ endpoints: Endpoint;
2024
+ requestFn: <TProps, TResponse, TConverter = TProps>(props: ApiRequestFnProps<TProps, TConverter>) => Promise<TResponse>;
2025
+ validateAuthFn?: () => boolean;
2026
+ defaultHeaders?: Record<string, string>;
2027
+ persistOptions?: Omit<PersistQueryClientOptions, 'queryClient'>;
2028
+ queryClient: QueryClient;
2029
+ websocketConfig?: {
2030
+ url: string;
2031
+ onMessage?: (message: unknown) => void;
2032
+ autoConnect?: boolean;
2033
+ };
2034
+ encryption?: EncryptionConfig;
2035
+ showNotification?: (notification: ApiNotificationMessage) => void;
2036
+ }
2037
+ declare const apiConfigAtom: _gaddario98_react_state.PrimitiveAtom<ApiConfig>;
2038
+ declare const useApiConfigValue: () => ApiConfig;
2039
+ declare const useApiConfigState: () => [ApiConfig, (value: ApiConfig) => void];
2040
+ declare const useApiConfigReset: () => () => void;
2041
+
2042
+ declare const useQueryApi: <TResponse>(options: CustomQueryOptions<TResponse>, id?: string) => QueryResult<TResponse>;
2043
+
2044
+ declare const useMutateApi: <TProps, TResponse>(options: CustomMutationOptions<TProps, TResponse>, id?: string) => _tanstack_react_query.UseMutationResult<TResponse, Error, TProps, unknown>;
2045
+
2046
+ declare const useMultipleQuery: <Q extends QueriesArray>(settings?: Array<QueryProps<Q[number]["key"], Q[number]["response"]>>) => MultipleQueryResponse<Q>;
2047
+
2048
+ declare const useMultipleMutation: <Q extends QueriesArray>(configs: Array<MutationItem<Q>>) => AllMutation<Q>;
2049
+
2050
+ declare const useMultipleWebSocket: <K extends string>(configs?: Array<WebSocketDefinition<K>>) => MultipleWebSocketResponse<K>;
2051
+
2052
+ interface UseApiOptions {
2053
+ /**
2054
+ * Unique identifier for this scope. Used as the key prefix for Jotai atoms.
2055
+ * @default 'default'
2056
+ */
2057
+ scopeId?: string;
2058
+ /**
2059
+ * Whether to persist query/mutation results to Jotai atoms.
2060
+ * @default true
2061
+ */
2062
+ persistToAtoms?: boolean;
2063
+ }
2064
+ /**
2065
+ * Main hook that integrates TanStack Query with Jotai for state persistence.
2066
+ */
2067
+ declare function useApi<Q extends QueriesArray>(configs: QueryConfigArray<Q>, options?: UseApiOptions): ContextValue<Q>;
2068
+ /**
2069
+ * @deprecated Use options object instead: useApi(configs, { scopeId: 'my-scope' })
2070
+ */
2071
+ declare function useApi<Q extends QueriesArray>(configs: QueryConfigArray<Q>, id?: string): ContextValue<Q>;
2072
+
2073
+ declare const useWebSocket: (endpoint?: string, // specific socket endpoint if different from default
2074
+ options?: {
2075
+ onMessage?: (data: unknown) => void;
2076
+ invalidateQueriesOnMessage?: Array<string>;
2077
+ }) => WebSocketResult;
2078
+
2079
+ declare const useInvalidateQueries: () => {
2080
+ invalidateQueries: (queryKeys: Array<Array<string>>) => Promise<void>;
2081
+ };
2082
+
2083
+ /**
2084
+ * Hook to read all queries for a scope.
2085
+ */
2086
+ declare function useJotaiQueries<Q extends QueriesArray>(options: {
2087
+ scopeId: string;
2088
+ }): Record<string, QueryStoreEntry<Q>>;
2089
+ /**
2090
+ * Hook to read all mutations for a scope.
2091
+ */
2092
+ declare function useJotaiMutations<Q extends QueriesArray>(options: {
2093
+ scopeId: string;
2094
+ }): Record<string, MutationStoreEntry<Q>>;
2095
+
2096
+ interface UseApiValuesProps {
2097
+ scopeId: string;
2098
+ }
2099
+ declare const useApiValues: <Q extends QueriesArray>({ scopeId, }: UseApiValuesProps) => {
2100
+ get: GetApiValuesFunction<Q>;
2101
+ };
2102
+
2103
+ declare const QueriesProvider: React.FC<PropsWithChildren>;
2104
+
2105
+ declare const algorithm: {
2106
+ name: string;
2107
+ length: number;
2108
+ };
2109
+ declare const str2ab: (str: string) => ArrayBuffer;
2110
+ declare const ab2str: (buf: ArrayBuffer) => string;
2111
+ declare const importKey: (secretKey: string) => Promise<CryptoKey>;
2112
+ declare const encryptData: (data: any, secretKey: string) => Promise<string>;
2113
+ declare const decryptData: (encryptedData: string, secretKey: string) => Promise<any>;
2114
+
2115
+ declare const apiRequest: <TProps, TResponse, TConverter = TProps>({ method, url, body, headers, converter, }: ApiRequestFnProps<TProps, TConverter>) => Promise<TResponse>;
2116
+ declare const fetchRequest: <TProps, TResponse>(url: string, headers?: AxiosRequestConfig["headers"]) => Promise<TResponse>;
2117
+
2118
+ type SyncStorage = Pick<Storage, 'getItem' | 'setItem' | 'removeItem'>;
2119
+ declare let storage: SyncStorage;
2120
+ declare const setCustomStorage: (newStorage: SyncStorage) => void;
2121
+
2122
+ type AtomGeneratorOptions<T> = {
2123
+ key: string;
2124
+ defaultValue: T;
2125
+ persist?: boolean;
2126
+ storage?: Pick<Storage, 'getItem' | 'setItem' | 'removeItem'>;
2127
+ };
2128
+ type AtomState<T> = {
2129
+ atom: PrimitiveAtom<T>;
2130
+ useValue: () => T;
2131
+ useState: () => [T, (value: T) => void];
2132
+ useReset: () => () => void;
2133
+ };
2134
+ declare function atomStateGenerator<T>(options: AtomGeneratorOptions<T> & {
2135
+ persist: true;
2136
+ }): AtomState<T>;
2137
+ declare function atomStateGenerator<T>(options: AtomGeneratorOptions<T> & {
2138
+ persist?: false;
2139
+ }): AtomState<T>;
2140
+
2141
+ declare function cn(...inputs: Array<ClassValue>): string;
2142
+
2143
+ type ExtractorCache<T> = Map<string, T>;
2144
+ declare function createExtractor<T extends Record<string, unknown>, K extends keyof T = keyof T>(allData?: T, cache?: ExtractorCache<Partial<T>>, usedKeys?: Array<K>): T;
2145
+
2146
+ type PropsAreEqual<P> = (prevProps: Readonly<P>, nextProps: Readonly<P>) => boolean;
2147
+ /**
2148
+ * Wrapper per React.memo che preserva i tipi generici
2149
+ */
2150
+ declare function withMemo<T extends React.ComponentType<any>>(Component: T, propsAreEqual?: PropsAreEqual<React.ComponentProps<T>>): T;
2151
+
2152
+ export { AppProviders, DEFAULT_FORM_ENTRY, DEFAULT_MUTATION_ENTRY, DEFAULT_QUERY_ENTRY, DefaultContainer, DefaultFormContainer, FormField, FormManager, MemoizationCache, MetadataStoreProvider, PageGenerator, QueriesProvider, RenderComponents, ab2str, algorithm, apiConfigAtom, apiRequest, applyMetadataToDom, atomStateGenerator, buildArticleJsonLd, buildBreadcrumbListJsonLd, buildFAQPageJsonLd, buildOrganizationJsonLd, buildProductJsonLd, buildWebSiteJsonLd, clearMetadataLog, cn, collectMetadataToHtml, createExtractor, createFormSelector, createMetadataStore, createMutationSelector, createQuerySelector, createScopeFormsAtom, createScopeMutationsAtom, createScopePageVariablesAtom, createScopeQueriesAtom, createServerTranslator, decryptData, deepEqual, encryptData, fetchRequest, formAtom, formConfigAtom, generateLlmsFullTxt, generateLlmsTxt, generateRobotsTxt, generateSitemapEntries, generateSitemapXml, getCompositeKey, getFormCompositeKey, getMetadata, getMetadataLog, getPageConfig, getPageVariablesCompositeKey, importKey, isStableValue, localizationConfigAtom, logMetadata, memoPropsComparator, memoize, mutationsAtom, optimizeDeps, pageConfigAtom, pageToMarkdown, pageVariablesAtom, pageVariablesAtomFamily, queriesAtom, resetMetadata, resolveMetadata, resolveTranslation, setCustomStorage, setDefaultFormContainer, setMetadata, setMetadataLogging, shallowEqual, storage, str2ab, toNextHeadTags, toNextMetadata, useApi, useApiConfigReset, useApiConfigState, useApiConfigValue, useApiValues, useApplyMetadata, useFormConfigReset, useFormConfigState, useFormConfigValue, useFormData, useFormManager, useFormState, useFormValue, useFormValues, useGenerateContent, useGenerateContentRender, useInvalidateQueries, useJotaiForm, useJotaiMutations, useJotaiQueries, useLocalizationActions, useLocalizationConfigReset, useLocalizationConfigState, useLocalizationConfigValue, useMetadata, useMetadataStore, useMultipleMutation, useMultipleQuery, useMultipleWebSocket, useMutateApi, usePageConfig, usePageConfigReset, usePageConfigState, usePageConfigValue, useQueryApi, useSetFormState, useTranslatedText, useTranslation, useViewSettings, useWebSocket, withMemo };
2153
+ export type { AIHintsConfig, AllMutation, AlternatesConfig, ApiConfig, ApiConverter, ApiMethod, ApiNotificationMessage, ApiRequestFnProps, AppProvidersProps, ArticleJsonLdInput, AtomGeneratorOptions, AtomState, BreadcrumbItem, ContainerItem, ContentItem, ContentItemsType, ContentProps, ContextValue, CustomMutation, CustomMutationOptions, CustomQueryOptions, DefaultContainerProps, DefaultFormContainerProps, DependencyGraph, DependencyNode, Elements, EncryptionConfig, Endpoint, ErrorComponentProps, ExtractMutation, ExtractMutationByKey, ExtractQuery, ExtractQueryByKey, ExtractQueryResponse, ExtractWebSocket, ExtractorCache, FAQItem, FieldComponentProps, FieldValues, FormConfigProps, FormContainerProps, FormElements, FormFieldConfig, FormFieldProps, FormFunctionProps, FormManagerConfig, FormManagerProps, FormNotificationMessage, FormPageProps, FormStoreEntry, FormTranslationOptions, FormatOptions, FunctionProps, GenerateContentProps, GenerateContentRenderProps, GenericFieldApi, GenericFieldState, GenericFormApi, GetApiValuesFunction, GetFormValuesFunction, GetFunction, HeadTag, I18nConfig, IconConfig, IconsConfig, ItemContainerProps, Items, LazyLoadingConfig, LlmsTxtConfig, LlmsTxtEntry, Locale, LocalizationConfigProps, MappedContents, MappedFormItemsFunction, MappedItemsFunction, MemoizationCacheStats, MetaTag, MetadataConfig, MetadataProvider, MetadataStore, MultipleQueryResponse, MultipleWebSocketResponse, MutationActionInternal, MutationConfig, MutationItem, MutationStateInternal, MutationStoreEntry, NextMetadata, OpenGraphArticle, OpenGraphConfig, OpenGraphImage, OrganizationJsonLdInput, PageAuthState, PageConfigProps, MetadataConfig as PageMetadataProps, PageProps, PageTranslationOptions, PlatformOverrides, ProductJsonLdInput, Props, ProviderConfig, QueriesArray, QueriesProps, QueryAtIndex, QueryConfig, QueryConfigArray, QueryDefinition, QueryItem, QueryPageConfigArray, QueryProps, QueryResult, QueryStoreEntry, RenderComponentsProps, ResolvedMetadata, RobotsConfig, RobotsTxtConfig, Rules, SetFunction, SetValueFunction, SingleQueryConfig, SitemapEntry, StructuredDataConfig, Submit, SubmitKeysArg, SubmitPayload, SyncStorage, TranslateFunction, TranslationFunction, TranslationOptions, TranslationResources, TwitterCardConfig, UseApiOptions, UseCustomFormOptions, UseFormManagerProps, UseFormValuesProps, UseMetadataProps, ViewSettings, ViewSettingsContainerProps, WebSiteJsonLdInput, WebSocketDefinition, WebSocketResult, WebSocketsArray };