gavaengine 0.1.2 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth/index.d.ts +42 -0
- package/dist/auth/index.js +12 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/{chunk-D5PTZWTT.js → chunk-ICIFEKSX.js} +2 -2
- package/dist/chunk-IK24OCFW.js +534 -0
- package/dist/chunk-IK24OCFW.js.map +1 -0
- package/dist/{chunk-3C3AAR3S.js → chunk-KQHQOMGL.js} +2 -2
- package/dist/chunk-QO42DDRU.js +113 -0
- package/dist/chunk-QO42DDRU.js.map +1 -0
- package/dist/components/index.js +2 -2
- package/dist/handlers/index.d.ts +33 -2
- package/dist/handlers/index.js +384 -126
- package/dist/handlers/index.js.map +1 -1
- package/dist/i18n/index.d.ts +114 -0
- package/dist/i18n/index.js +249 -0
- package/dist/i18n/index.js.map +1 -0
- package/dist/{index-B1ZYC5TP.d.ts → index-Ng6yRSAA.d.ts} +117 -1
- package/dist/index.d.ts +19 -5
- package/dist/index.js +69 -39
- package/dist/index.js.map +1 -1
- package/dist/providers/index.d.ts +2 -1
- package/dist/providers/index.js +2 -2
- package/dist/types-d8-k_4dN.d.ts +19 -0
- package/package.json +12 -1
- package/dist/chunk-BVLJYZ6T.js +0 -252
- package/dist/chunk-BVLJYZ6T.js.map +0 -1
- /package/dist/{chunk-D5PTZWTT.js.map → chunk-ICIFEKSX.js.map} +0 -0
- /package/dist/{chunk-3C3AAR3S.js.map → chunk-KQHQOMGL.js.map} +0 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { G as GEAuthAdapter } from '../types-d8-k_4dN.js';
|
|
2
|
+
export { a as GEAuthSession, b as GEAuthUser } from '../types-d8-k_4dN.js';
|
|
3
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
+
import { ReactNode } from 'react';
|
|
5
|
+
|
|
6
|
+
interface NextAuthFunctions {
|
|
7
|
+
auth: () => Promise<any>;
|
|
8
|
+
signIn?: (provider: string, credentials: Record<string, unknown>) => Promise<any>;
|
|
9
|
+
signOut?: () => Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
declare function createNextAuthAdapter({ auth, signIn, signOut, }: NextAuthFunctions): GEAuthAdapter;
|
|
12
|
+
|
|
13
|
+
interface GEAuthUser {
|
|
14
|
+
id: string;
|
|
15
|
+
name?: string | null;
|
|
16
|
+
email?: string | null;
|
|
17
|
+
role: string;
|
|
18
|
+
}
|
|
19
|
+
interface GEAuthSession {
|
|
20
|
+
user: GEAuthUser;
|
|
21
|
+
}
|
|
22
|
+
interface GEAuthContextValue {
|
|
23
|
+
session: GEAuthSession | null;
|
|
24
|
+
user: GEAuthUser | null;
|
|
25
|
+
status: "loading" | "authenticated" | "unauthenticated";
|
|
26
|
+
signIn?: (credentials: Record<string, unknown>) => Promise<{
|
|
27
|
+
error?: string;
|
|
28
|
+
} | void>;
|
|
29
|
+
signOut?: () => Promise<void>;
|
|
30
|
+
}
|
|
31
|
+
declare function useGavaAuth(): GEAuthContextValue;
|
|
32
|
+
interface AuthProviderProps {
|
|
33
|
+
children: ReactNode;
|
|
34
|
+
getSession: () => Promise<GEAuthSession | null>;
|
|
35
|
+
signIn?: (credentials: Record<string, unknown>) => Promise<{
|
|
36
|
+
error?: string;
|
|
37
|
+
} | void>;
|
|
38
|
+
signOut?: () => Promise<void>;
|
|
39
|
+
}
|
|
40
|
+
declare function AuthProvider({ children, getSession, signIn, signOut, }: AuthProviderProps): react_jsx_runtime.JSX.Element;
|
|
41
|
+
|
|
42
|
+
export { AuthProvider, GEAuthAdapter, createNextAuthAdapter, useGavaAuth };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
ActionsProvider,
|
|
4
4
|
ConfigProvider,
|
|
5
5
|
SplashProvider
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-IK24OCFW.js";
|
|
7
7
|
|
|
8
8
|
// src/providers/GavaEngineProvider.tsx
|
|
9
9
|
import { useRouter } from "next/navigation";
|
|
@@ -64,4 +64,4 @@ export {
|
|
|
64
64
|
GavaEngineProvider,
|
|
65
65
|
ThemeToggle
|
|
66
66
|
};
|
|
67
|
-
//# sourceMappingURL=chunk-
|
|
67
|
+
//# sourceMappingURL=chunk-ICIFEKSX.js.map
|
|
@@ -0,0 +1,534 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// src/i18n/it.ts
|
|
4
|
+
var it = {
|
|
5
|
+
content: {
|
|
6
|
+
articles: "Articoli",
|
|
7
|
+
newArticle: "Nuovo articolo",
|
|
8
|
+
titlePlaceholder: "Titolo dell'articolo",
|
|
9
|
+
excerptPlaceholder: "Breve descrizione dell'articolo...",
|
|
10
|
+
slugPlaceholder: "slug-articolo",
|
|
11
|
+
authorPlaceholder: "Nome dell'autore",
|
|
12
|
+
category: "Categoria",
|
|
13
|
+
selectCategory: "Seleziona categoria",
|
|
14
|
+
excerpt: "Estratto",
|
|
15
|
+
author: "Autore",
|
|
16
|
+
slugUrl: "Slug URL",
|
|
17
|
+
noArticles: "Nessun articolo.",
|
|
18
|
+
noArticlesSearch: "Nessun articolo trovato.",
|
|
19
|
+
searchArticles: "Cerca articoli...",
|
|
20
|
+
coverImageLabel: "Immagine di copertina",
|
|
21
|
+
coverImageHint: "Scegli dalla libreria o carica un nuovo file",
|
|
22
|
+
viewArticle: "Vedi articolo pubblicato",
|
|
23
|
+
untitled: "Senza titolo"
|
|
24
|
+
},
|
|
25
|
+
editor: {
|
|
26
|
+
publish: "Pubblica",
|
|
27
|
+
unpublish: "Ritira",
|
|
28
|
+
saveDraft: "Salva bozza",
|
|
29
|
+
revisions: "Cronologia",
|
|
30
|
+
saving: "Salvando...",
|
|
31
|
+
saved: "Salvato",
|
|
32
|
+
saveError: "Errore nel salvataggio",
|
|
33
|
+
noRevisions: "Nessuna revisione salvata.",
|
|
34
|
+
restore: "Ripristina",
|
|
35
|
+
restoreConfirm: "Ripristinare questa revisione? Lo stato attuale verr\xE0 salvato prima del ripristino.",
|
|
36
|
+
beforeRestore: "Prima del ripristino",
|
|
37
|
+
publishedNote: "Pubblicato",
|
|
38
|
+
preview: "Anteprima",
|
|
39
|
+
placeholder: "Inizia a scrivere il tuo articolo..."
|
|
40
|
+
},
|
|
41
|
+
media: {
|
|
42
|
+
media: "Media",
|
|
43
|
+
noMedia: "Nessun file caricato.",
|
|
44
|
+
noMediaSearch: "Nessun file trovato.",
|
|
45
|
+
chooseFile: "Scegli file",
|
|
46
|
+
dragHint: "Trascina un'immagine qui oppure",
|
|
47
|
+
uploadHint: "JPEG, PNG, WebP, GIF (max 5MB)",
|
|
48
|
+
mediaLibrary: "Libreria media",
|
|
49
|
+
uploadNew: "Carica nuovo",
|
|
50
|
+
searchFiles: "Cerca file...",
|
|
51
|
+
selectImage: "Seleziona immagine",
|
|
52
|
+
noImages: "Nessuna immagine nella libreria.",
|
|
53
|
+
noImagesSearch: "Nessuna immagine trovata.",
|
|
54
|
+
copyUrl: "Copia URL",
|
|
55
|
+
editImage: "Modifica immagine",
|
|
56
|
+
restoreOriginal: "Ripristina originale",
|
|
57
|
+
freeAspect: "Libero"
|
|
58
|
+
},
|
|
59
|
+
users: {
|
|
60
|
+
users: "Utenti",
|
|
61
|
+
name: "Nome",
|
|
62
|
+
email: "Email",
|
|
63
|
+
password: "Password",
|
|
64
|
+
passwordEditHint: " (lascia vuoto per non modificarla)",
|
|
65
|
+
role: "Ruolo",
|
|
66
|
+
createdAt: "Creato il",
|
|
67
|
+
actions: "Azioni",
|
|
68
|
+
createUser: "Crea utente",
|
|
69
|
+
unauthorized: "Non autorizzato",
|
|
70
|
+
notAuthenticated: "Non autenticato",
|
|
71
|
+
allFieldsRequired: "Tutti i campi sono obbligatori.",
|
|
72
|
+
passwordMinLength: "La password deve avere almeno 6 caratteri.",
|
|
73
|
+
emailExists: "Esiste gi\xE0 un utente con questa email.",
|
|
74
|
+
invalidRole: "Ruolo non valido.",
|
|
75
|
+
cannotDeleteSelf: "Non puoi eliminare il tuo stesso account."
|
|
76
|
+
},
|
|
77
|
+
common: {
|
|
78
|
+
statistics: "Statistiche",
|
|
79
|
+
settings: "Impostazioni",
|
|
80
|
+
delete: "Elimina",
|
|
81
|
+
edit: "Modifica",
|
|
82
|
+
search: "Cerca",
|
|
83
|
+
draft: "Bozza",
|
|
84
|
+
published: "Pubblicato",
|
|
85
|
+
all: "Tutti",
|
|
86
|
+
drafts: "Bozze",
|
|
87
|
+
loading: "Caricamento...",
|
|
88
|
+
confirm: "Conferma",
|
|
89
|
+
cancel: "Annulla",
|
|
90
|
+
apply: "Applica",
|
|
91
|
+
change: "Cambia",
|
|
92
|
+
logout: "Esci",
|
|
93
|
+
saveChanges: "Salva modifiche",
|
|
94
|
+
updated: "Aggiornato",
|
|
95
|
+
status: "Stato",
|
|
96
|
+
title: "Titolo",
|
|
97
|
+
deleteConfirm: (title) => `Eliminare "${title || "Senza titolo"}"?`,
|
|
98
|
+
unpublishConfirm: (title) => `Ritirare "${title || "Senza titolo"}"? L'articolo torner\xE0 in bozza.`,
|
|
99
|
+
deleteUserConfirm: (name) => `Sei sicuro di voler eliminare l'utente "${name}"?`,
|
|
100
|
+
totalArticles: (count) => `${count} articol${count === 1 ? "o" : "i"} totali`,
|
|
101
|
+
totalFiles: (count) => `${count} file caricati`
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
// src/i18n/en.ts
|
|
106
|
+
var en = {
|
|
107
|
+
content: {
|
|
108
|
+
articles: "Articles",
|
|
109
|
+
newArticle: "New article",
|
|
110
|
+
titlePlaceholder: "Article title",
|
|
111
|
+
excerptPlaceholder: "Brief description of the article...",
|
|
112
|
+
slugPlaceholder: "article-slug",
|
|
113
|
+
authorPlaceholder: "Author name",
|
|
114
|
+
category: "Category",
|
|
115
|
+
selectCategory: "Select category",
|
|
116
|
+
excerpt: "Excerpt",
|
|
117
|
+
author: "Author",
|
|
118
|
+
slugUrl: "URL Slug",
|
|
119
|
+
noArticles: "No articles.",
|
|
120
|
+
noArticlesSearch: "No articles found.",
|
|
121
|
+
searchArticles: "Search articles...",
|
|
122
|
+
coverImageLabel: "Cover image",
|
|
123
|
+
coverImageHint: "Choose from library or upload a new file",
|
|
124
|
+
viewArticle: "View published article",
|
|
125
|
+
untitled: "Untitled"
|
|
126
|
+
},
|
|
127
|
+
editor: {
|
|
128
|
+
publish: "Publish",
|
|
129
|
+
unpublish: "Unpublish",
|
|
130
|
+
saveDraft: "Save draft",
|
|
131
|
+
revisions: "History",
|
|
132
|
+
saving: "Saving...",
|
|
133
|
+
saved: "Saved",
|
|
134
|
+
saveError: "Error saving",
|
|
135
|
+
noRevisions: "No revisions saved.",
|
|
136
|
+
restore: "Restore",
|
|
137
|
+
restoreConfirm: "Restore this revision? The current state will be saved before restoring.",
|
|
138
|
+
beforeRestore: "Before restore",
|
|
139
|
+
publishedNote: "Published",
|
|
140
|
+
preview: "Preview",
|
|
141
|
+
placeholder: "Start writing your article..."
|
|
142
|
+
},
|
|
143
|
+
media: {
|
|
144
|
+
media: "Media",
|
|
145
|
+
noMedia: "No files uploaded.",
|
|
146
|
+
noMediaSearch: "No files found.",
|
|
147
|
+
chooseFile: "Choose file",
|
|
148
|
+
dragHint: "Drag an image here or",
|
|
149
|
+
uploadHint: "JPEG, PNG, WebP, GIF (max 5MB)",
|
|
150
|
+
mediaLibrary: "Media library",
|
|
151
|
+
uploadNew: "Upload new",
|
|
152
|
+
searchFiles: "Search files...",
|
|
153
|
+
selectImage: "Select image",
|
|
154
|
+
noImages: "No images in library.",
|
|
155
|
+
noImagesSearch: "No images found.",
|
|
156
|
+
copyUrl: "Copy URL",
|
|
157
|
+
editImage: "Edit image",
|
|
158
|
+
restoreOriginal: "Restore original",
|
|
159
|
+
freeAspect: "Free"
|
|
160
|
+
},
|
|
161
|
+
users: {
|
|
162
|
+
users: "Users",
|
|
163
|
+
name: "Name",
|
|
164
|
+
email: "Email",
|
|
165
|
+
password: "Password",
|
|
166
|
+
passwordEditHint: " (leave blank to keep current)",
|
|
167
|
+
role: "Role",
|
|
168
|
+
createdAt: "Created at",
|
|
169
|
+
actions: "Actions",
|
|
170
|
+
createUser: "Create user",
|
|
171
|
+
unauthorized: "Unauthorized",
|
|
172
|
+
notAuthenticated: "Not authenticated",
|
|
173
|
+
allFieldsRequired: "All fields are required.",
|
|
174
|
+
passwordMinLength: "Password must be at least 6 characters.",
|
|
175
|
+
emailExists: "A user with this email already exists.",
|
|
176
|
+
invalidRole: "Invalid role.",
|
|
177
|
+
cannotDeleteSelf: "You cannot delete your own account."
|
|
178
|
+
},
|
|
179
|
+
common: {
|
|
180
|
+
statistics: "Statistics",
|
|
181
|
+
settings: "Settings",
|
|
182
|
+
delete: "Delete",
|
|
183
|
+
edit: "Edit",
|
|
184
|
+
search: "Search",
|
|
185
|
+
draft: "Draft",
|
|
186
|
+
published: "Published",
|
|
187
|
+
all: "All",
|
|
188
|
+
drafts: "Drafts",
|
|
189
|
+
loading: "Loading...",
|
|
190
|
+
confirm: "Confirm",
|
|
191
|
+
cancel: "Cancel",
|
|
192
|
+
apply: "Apply",
|
|
193
|
+
change: "Change",
|
|
194
|
+
logout: "Logout",
|
|
195
|
+
saveChanges: "Save changes",
|
|
196
|
+
updated: "Updated",
|
|
197
|
+
status: "Status",
|
|
198
|
+
title: "Title",
|
|
199
|
+
deleteConfirm: (title) => `Delete "${title || "Untitled"}"?`,
|
|
200
|
+
unpublishConfirm: (title) => `Unpublish "${title || "Untitled"}"? The article will go back to draft.`,
|
|
201
|
+
deleteUserConfirm: (name) => `Are you sure you want to delete user "${name}"?`,
|
|
202
|
+
totalArticles: (count) => `${count} total article${count === 1 ? "" : "s"}`,
|
|
203
|
+
totalFiles: (count) => `${count} uploaded file${count === 1 ? "" : "s"}`
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
// src/i18n/index.ts
|
|
208
|
+
var builtinLocales = { it, en };
|
|
209
|
+
function loadLocale(locale) {
|
|
210
|
+
const found = builtinLocales[locale];
|
|
211
|
+
if (!found) {
|
|
212
|
+
throw new Error(
|
|
213
|
+
`Locale "${locale}" not found. Available: ${Object.keys(builtinLocales).join(", ")}`
|
|
214
|
+
);
|
|
215
|
+
}
|
|
216
|
+
return found;
|
|
217
|
+
}
|
|
218
|
+
function defineLocale(locale) {
|
|
219
|
+
return locale;
|
|
220
|
+
}
|
|
221
|
+
function mergeLocales(base, overrides) {
|
|
222
|
+
return deepMergeLocale(base, overrides);
|
|
223
|
+
}
|
|
224
|
+
function registerLocale(key, locale) {
|
|
225
|
+
builtinLocales[key] = locale;
|
|
226
|
+
}
|
|
227
|
+
function deepMergeLocale(target, source) {
|
|
228
|
+
const result = { ...target };
|
|
229
|
+
for (const key of Object.keys(source)) {
|
|
230
|
+
const sourceVal = source[key];
|
|
231
|
+
const targetVal = target[key];
|
|
232
|
+
if (sourceVal && typeof sourceVal === "object" && !Array.isArray(sourceVal) && typeof targetVal === "object" && !Array.isArray(targetVal) && typeof sourceVal !== "function") {
|
|
233
|
+
result[key] = deepMergeLocale(
|
|
234
|
+
targetVal,
|
|
235
|
+
sourceVal
|
|
236
|
+
);
|
|
237
|
+
} else if (sourceVal !== void 0) {
|
|
238
|
+
result[key] = sourceVal;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
return result;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
// src/config.ts
|
|
245
|
+
function localeToStrings(locale) {
|
|
246
|
+
return {
|
|
247
|
+
// content
|
|
248
|
+
articles: locale.content.articles,
|
|
249
|
+
newArticle: locale.content.newArticle,
|
|
250
|
+
titlePlaceholder: locale.content.titlePlaceholder,
|
|
251
|
+
excerptPlaceholder: locale.content.excerptPlaceholder,
|
|
252
|
+
slugPlaceholder: locale.content.slugPlaceholder,
|
|
253
|
+
authorPlaceholder: locale.content.authorPlaceholder,
|
|
254
|
+
category: locale.content.category,
|
|
255
|
+
selectCategory: locale.content.selectCategory,
|
|
256
|
+
excerpt: locale.content.excerpt,
|
|
257
|
+
author: locale.content.author,
|
|
258
|
+
slugUrl: locale.content.slugUrl,
|
|
259
|
+
noArticles: locale.content.noArticles,
|
|
260
|
+
noArticlesSearch: locale.content.noArticlesSearch,
|
|
261
|
+
searchArticles: locale.content.searchArticles,
|
|
262
|
+
coverImageLabel: locale.content.coverImageLabel,
|
|
263
|
+
coverImageHint: locale.content.coverImageHint,
|
|
264
|
+
viewArticle: locale.content.viewArticle,
|
|
265
|
+
untitled: locale.content.untitled,
|
|
266
|
+
// editor
|
|
267
|
+
publish: locale.editor.publish,
|
|
268
|
+
unpublish: locale.editor.unpublish,
|
|
269
|
+
saveDraft: locale.editor.saveDraft,
|
|
270
|
+
revisions: locale.editor.revisions,
|
|
271
|
+
saving: locale.editor.saving,
|
|
272
|
+
saved: locale.editor.saved,
|
|
273
|
+
saveError: locale.editor.saveError,
|
|
274
|
+
noRevisions: locale.editor.noRevisions,
|
|
275
|
+
restore: locale.editor.restore,
|
|
276
|
+
restoreConfirm: locale.editor.restoreConfirm,
|
|
277
|
+
beforeRestore: locale.editor.beforeRestore,
|
|
278
|
+
publishedNote: locale.editor.publishedNote,
|
|
279
|
+
preview: locale.editor.preview,
|
|
280
|
+
// media
|
|
281
|
+
media: locale.media.media,
|
|
282
|
+
noMedia: locale.media.noMedia,
|
|
283
|
+
noMediaSearch: locale.media.noMediaSearch,
|
|
284
|
+
chooseFile: locale.media.chooseFile,
|
|
285
|
+
dragHint: locale.media.dragHint,
|
|
286
|
+
uploadHint: locale.media.uploadHint,
|
|
287
|
+
mediaLibrary: locale.media.mediaLibrary,
|
|
288
|
+
uploadNew: locale.media.uploadNew,
|
|
289
|
+
searchFiles: locale.media.searchFiles,
|
|
290
|
+
selectImage: locale.media.selectImage,
|
|
291
|
+
noImages: locale.media.noImages,
|
|
292
|
+
noImagesSearch: locale.media.noImagesSearch,
|
|
293
|
+
copyUrl: locale.media.copyUrl,
|
|
294
|
+
editImage: locale.media.editImage,
|
|
295
|
+
restoreOriginal: locale.media.restoreOriginal,
|
|
296
|
+
freeAspect: locale.media.freeAspect,
|
|
297
|
+
// users
|
|
298
|
+
users: locale.users.users,
|
|
299
|
+
name: locale.users.name,
|
|
300
|
+
email: locale.users.email,
|
|
301
|
+
password: locale.users.password,
|
|
302
|
+
passwordEditHint: locale.users.passwordEditHint,
|
|
303
|
+
role: locale.users.role,
|
|
304
|
+
createdAt: locale.users.createdAt,
|
|
305
|
+
actions: locale.users.actions,
|
|
306
|
+
createUser: locale.users.createUser,
|
|
307
|
+
unauthorized: locale.users.unauthorized,
|
|
308
|
+
notAuthenticated: locale.users.notAuthenticated,
|
|
309
|
+
allFieldsRequired: locale.users.allFieldsRequired,
|
|
310
|
+
passwordMinLength: locale.users.passwordMinLength,
|
|
311
|
+
emailExists: locale.users.emailExists,
|
|
312
|
+
invalidRole: locale.users.invalidRole,
|
|
313
|
+
cannotDeleteSelf: locale.users.cannotDeleteSelf,
|
|
314
|
+
// common
|
|
315
|
+
statistics: locale.common.statistics,
|
|
316
|
+
settings: locale.common.settings,
|
|
317
|
+
delete: locale.common.delete,
|
|
318
|
+
edit: locale.common.edit,
|
|
319
|
+
search: locale.common.search,
|
|
320
|
+
draft: locale.common.draft,
|
|
321
|
+
published: locale.common.published,
|
|
322
|
+
all: locale.common.all,
|
|
323
|
+
drafts: locale.common.drafts,
|
|
324
|
+
loading: locale.common.loading,
|
|
325
|
+
confirm: locale.common.confirm,
|
|
326
|
+
cancel: locale.common.cancel,
|
|
327
|
+
apply: locale.common.apply,
|
|
328
|
+
change: locale.common.change,
|
|
329
|
+
logout: locale.common.logout,
|
|
330
|
+
saveChanges: locale.common.saveChanges,
|
|
331
|
+
updated: locale.common.updated,
|
|
332
|
+
status: locale.common.status,
|
|
333
|
+
title: locale.common.title,
|
|
334
|
+
deleteConfirm: locale.common.deleteConfirm,
|
|
335
|
+
unpublishConfirm: locale.common.unpublishConfirm,
|
|
336
|
+
deleteUserConfirm: locale.common.deleteUserConfirm,
|
|
337
|
+
totalArticles: locale.common.totalArticles,
|
|
338
|
+
totalFiles: locale.common.totalFiles
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
var DEFAULT_STRINGS = localeToStrings(loadLocale("it"));
|
|
342
|
+
var DEFAULT_CONFIG = {
|
|
343
|
+
branding: {
|
|
344
|
+
name: "GavaEngine"
|
|
345
|
+
},
|
|
346
|
+
roles: {
|
|
347
|
+
list: ["admin", "redattore", "scrittore", "lettore"],
|
|
348
|
+
labels: {
|
|
349
|
+
admin: "Amministratore",
|
|
350
|
+
redattore: "Redattore",
|
|
351
|
+
scrittore: "Scrittore",
|
|
352
|
+
lettore: "Lettore"
|
|
353
|
+
},
|
|
354
|
+
canEdit: (role) => role !== "lettore",
|
|
355
|
+
canPublish: (role) => role === "admin" || role === "redattore",
|
|
356
|
+
adminRole: "admin"
|
|
357
|
+
},
|
|
358
|
+
statuses: {
|
|
359
|
+
draft: "bozza",
|
|
360
|
+
published: "pubblicato"
|
|
361
|
+
},
|
|
362
|
+
locale: "it",
|
|
363
|
+
models: {
|
|
364
|
+
article: "article",
|
|
365
|
+
articleRevision: "articleRevision",
|
|
366
|
+
articleView: "articleView",
|
|
367
|
+
media: "media",
|
|
368
|
+
user: "user"
|
|
369
|
+
},
|
|
370
|
+
categories: [
|
|
371
|
+
"Cultura ed Intercultura",
|
|
372
|
+
"Fatti ed Eventi",
|
|
373
|
+
"Poeti e Prosatori",
|
|
374
|
+
"Famiglia, Istituzioni e Territorio",
|
|
375
|
+
"Amici del Meucci"
|
|
376
|
+
],
|
|
377
|
+
upload: {
|
|
378
|
+
endpoint: "/api/upload",
|
|
379
|
+
imageTypes: ["image/jpeg", "image/png", "image/webp", "image/gif"],
|
|
380
|
+
videoTypes: ["video/mp4", "video/webm", "video/quicktime"],
|
|
381
|
+
maxImageSize: 5 * 1024 * 1024,
|
|
382
|
+
maxVideoSize: 50 * 1024 * 1024
|
|
383
|
+
},
|
|
384
|
+
editor: {
|
|
385
|
+
placeholder: "Inizia a scrivere il tuo articolo...",
|
|
386
|
+
autoSaveDelay: 2e3,
|
|
387
|
+
revisionThrottleMinutes: 5,
|
|
388
|
+
headingLevels: [2, 3]
|
|
389
|
+
},
|
|
390
|
+
routes: {
|
|
391
|
+
articles: "/dashboard/articoli",
|
|
392
|
+
articleEdit: (id) => `/dashboard/articoli/${id}`,
|
|
393
|
+
articleNew: "/dashboard/articoli/nuovo",
|
|
394
|
+
articleView: (slug) => `/articoli/${slug}`,
|
|
395
|
+
articlePreview: (id) => `/anteprima/${id}`,
|
|
396
|
+
users: "/dashboard/utenti",
|
|
397
|
+
userEdit: (id) => `/dashboard/utenti/${id}`,
|
|
398
|
+
userNew: "/dashboard/utenti/nuovo",
|
|
399
|
+
media: "/dashboard/media",
|
|
400
|
+
dashboard: "/dashboard",
|
|
401
|
+
login: "/login",
|
|
402
|
+
home: "/"
|
|
403
|
+
},
|
|
404
|
+
strings: DEFAULT_STRINGS
|
|
405
|
+
};
|
|
406
|
+
function deepMerge(target, source) {
|
|
407
|
+
const result = { ...target };
|
|
408
|
+
for (const key of Object.keys(source)) {
|
|
409
|
+
const sourceVal = source[key];
|
|
410
|
+
const targetVal = target[key];
|
|
411
|
+
if (sourceVal && typeof sourceVal === "object" && !Array.isArray(sourceVal) && typeof targetVal === "object" && !Array.isArray(targetVal) && typeof sourceVal !== "function") {
|
|
412
|
+
result[key] = deepMerge(
|
|
413
|
+
targetVal,
|
|
414
|
+
sourceVal
|
|
415
|
+
);
|
|
416
|
+
} else if (sourceVal !== void 0) {
|
|
417
|
+
result[key] = sourceVal;
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
return result;
|
|
421
|
+
}
|
|
422
|
+
function defineConfig(overrides = {}) {
|
|
423
|
+
const locale = overrides.locale ?? DEFAULT_CONFIG.locale;
|
|
424
|
+
const baseStrings = localeToStrings(loadLocale(locale));
|
|
425
|
+
const configWithLocale = {
|
|
426
|
+
...DEFAULT_CONFIG,
|
|
427
|
+
strings: baseStrings
|
|
428
|
+
};
|
|
429
|
+
if (!overrides.editor?.placeholder) {
|
|
430
|
+
const localeData = loadLocale(locale);
|
|
431
|
+
configWithLocale.editor = {
|
|
432
|
+
...configWithLocale.editor,
|
|
433
|
+
placeholder: localeData.editor.placeholder
|
|
434
|
+
};
|
|
435
|
+
}
|
|
436
|
+
return deepMerge(configWithLocale, overrides);
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
// src/providers/ConfigContext.tsx
|
|
440
|
+
import { createContext, useContext } from "react";
|
|
441
|
+
import { jsx } from "react/jsx-runtime";
|
|
442
|
+
var ConfigContext = createContext(DEFAULT_CONFIG);
|
|
443
|
+
function useGavaConfig() {
|
|
444
|
+
return useContext(ConfigContext);
|
|
445
|
+
}
|
|
446
|
+
function ConfigProvider({
|
|
447
|
+
config,
|
|
448
|
+
children
|
|
449
|
+
}) {
|
|
450
|
+
return /* @__PURE__ */ jsx(ConfigContext.Provider, { value: config, children });
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
// src/providers/ActionsContext.tsx
|
|
454
|
+
import { createContext as createContext2, useContext as useContext2 } from "react";
|
|
455
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
456
|
+
var ActionsContext = createContext2(null);
|
|
457
|
+
function useGavaActions() {
|
|
458
|
+
const ctx = useContext2(ActionsContext);
|
|
459
|
+
if (!ctx) {
|
|
460
|
+
throw new Error(
|
|
461
|
+
"useGavaActions must be used within a <GavaEngineProvider> with actions provided."
|
|
462
|
+
);
|
|
463
|
+
}
|
|
464
|
+
return ctx;
|
|
465
|
+
}
|
|
466
|
+
function ActionsProvider({
|
|
467
|
+
actions,
|
|
468
|
+
children
|
|
469
|
+
}) {
|
|
470
|
+
return /* @__PURE__ */ jsx2(ActionsContext.Provider, { value: actions, children });
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
// src/providers/SplashContext.tsx
|
|
474
|
+
import {
|
|
475
|
+
createContext as createContext3,
|
|
476
|
+
useContext as useContext3,
|
|
477
|
+
useState,
|
|
478
|
+
useCallback
|
|
479
|
+
} from "react";
|
|
480
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
481
|
+
var SplashContext = createContext3({
|
|
482
|
+
phase: "idle",
|
|
483
|
+
navigateWithSplash: () => {
|
|
484
|
+
},
|
|
485
|
+
openSplash: () => {
|
|
486
|
+
}
|
|
487
|
+
});
|
|
488
|
+
function useSplash() {
|
|
489
|
+
return useContext3(SplashContext);
|
|
490
|
+
}
|
|
491
|
+
function SplashProvider({
|
|
492
|
+
children,
|
|
493
|
+
navigate
|
|
494
|
+
}) {
|
|
495
|
+
const [phase, setPhase] = useState("idle");
|
|
496
|
+
const navigateWithSplash = useCallback(
|
|
497
|
+
(url) => {
|
|
498
|
+
if (phase !== "idle") return;
|
|
499
|
+
setPhase("closing");
|
|
500
|
+
setTimeout(() => {
|
|
501
|
+
setPhase("closed");
|
|
502
|
+
navigate(url);
|
|
503
|
+
}, 700);
|
|
504
|
+
},
|
|
505
|
+
[phase, navigate]
|
|
506
|
+
);
|
|
507
|
+
const openSplash = useCallback(() => {
|
|
508
|
+
if (phase !== "closed") return;
|
|
509
|
+
requestAnimationFrame(() => {
|
|
510
|
+
setPhase("opening");
|
|
511
|
+
setTimeout(() => setPhase("idle"), 900);
|
|
512
|
+
});
|
|
513
|
+
}, [phase]);
|
|
514
|
+
return /* @__PURE__ */ jsx3(SplashContext.Provider, { value: { phase, navigateWithSplash, openSplash }, children });
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
export {
|
|
518
|
+
it,
|
|
519
|
+
en,
|
|
520
|
+
loadLocale,
|
|
521
|
+
defineLocale,
|
|
522
|
+
mergeLocales,
|
|
523
|
+
registerLocale,
|
|
524
|
+
localeToStrings,
|
|
525
|
+
DEFAULT_CONFIG,
|
|
526
|
+
defineConfig,
|
|
527
|
+
useGavaConfig,
|
|
528
|
+
ConfigProvider,
|
|
529
|
+
useGavaActions,
|
|
530
|
+
ActionsProvider,
|
|
531
|
+
useSplash,
|
|
532
|
+
SplashProvider
|
|
533
|
+
};
|
|
534
|
+
//# sourceMappingURL=chunk-IK24OCFW.js.map
|