@lystech/sections 0.2.0 → 0.3.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/SectionsProvider.d.ts +23 -1
- package/dist/editeur/Connexion.d.ts +6 -0
- package/dist/editeur/TexteEnPlace.d.ts +7 -0
- package/dist/editeur/index.d.ts +12 -0
- package/dist/editeur/pont.d.ts +9 -0
- package/dist/editeur/styles.d.ts +2 -1
- package/dist/editeur.js +795 -306
- package/dist/index.d.ts +2 -0
- package/dist/index.js +186 -164
- package/dist/morceaux/sourceTexte-BMPMpNg9.js +71 -0
- package/dist/sourceTexte.d.ts +34 -0
- package/package.json +7 -3
package/dist/editeur.js
CHANGED
|
@@ -1,50 +1,190 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { createRoot as
|
|
3
|
-
import { useState as
|
|
4
|
-
function
|
|
1
|
+
import { jsx as e, jsxs as b, Fragment as Q } from "react/jsx-runtime";
|
|
2
|
+
import { createRoot as Z } from "react-dom/client";
|
|
3
|
+
import { useState as k, useRef as F, useEffect as B, useCallback as H, useMemo as W } from "react";
|
|
4
|
+
function se({
|
|
5
5
|
jeton: n,
|
|
6
6
|
site: t,
|
|
7
|
-
apiBaseUrl:
|
|
7
|
+
apiBaseUrl: c,
|
|
8
8
|
surJetonRefuse: r
|
|
9
9
|
}) {
|
|
10
|
-
const
|
|
10
|
+
const a = {
|
|
11
11
|
"Content-Type": "application/json",
|
|
12
12
|
Authorization: "Bearer " + n
|
|
13
13
|
};
|
|
14
|
-
function
|
|
15
|
-
if (
|
|
14
|
+
function f(o, i) {
|
|
15
|
+
if (i && (o.status === 401 || o.status === 403) && r(), !o.ok) throw new Error(String(o.status));
|
|
16
16
|
}
|
|
17
|
-
async function
|
|
18
|
-
const
|
|
19
|
-
headers:
|
|
17
|
+
async function u(o, i = !0) {
|
|
18
|
+
const h = await fetch(c + o, {
|
|
19
|
+
headers: i ? a : void 0
|
|
20
20
|
});
|
|
21
|
-
return
|
|
21
|
+
return f(h, i), await h.json();
|
|
22
22
|
}
|
|
23
|
-
async function
|
|
24
|
-
const
|
|
25
|
-
method:
|
|
26
|
-
headers:
|
|
27
|
-
body:
|
|
23
|
+
async function m(o, i, h) {
|
|
24
|
+
const g = await fetch(c + o, {
|
|
25
|
+
method: i,
|
|
26
|
+
headers: a,
|
|
27
|
+
body: h === void 0 ? void 0 : JSON.stringify(h)
|
|
28
28
|
});
|
|
29
|
-
return
|
|
29
|
+
return f(g, !0), await g.json();
|
|
30
30
|
}
|
|
31
31
|
return {
|
|
32
32
|
/** Les blocs que le site a déclaré savoir afficher. Route publique. */
|
|
33
|
-
schemas: () =>
|
|
33
|
+
schemas: () => u("/site-sections/public/" + encodeURIComponent(t) + "/schemas", !1),
|
|
34
34
|
/** Ce qui existe sur une page, brouillons compris. */
|
|
35
|
-
pourPage: (
|
|
36
|
-
creer: (
|
|
37
|
-
enregistrerBrouillon: (
|
|
38
|
-
publier: (
|
|
35
|
+
pourPage: (o) => u("/site-sections?page=" + encodeURIComponent(o)),
|
|
36
|
+
creer: (o, i, h) => m("/site-sections", "POST", { page: o, blockType: i, draft: h }),
|
|
37
|
+
enregistrerBrouillon: (o, i) => m("/site-sections/" + o + "/draft", "PUT", { draft: i }),
|
|
38
|
+
publier: (o) => m("/site-sections/" + o + "/publish", "POST"),
|
|
39
39
|
/** Ramène le brouillon à ce qui est en ligne. */
|
|
40
|
-
annuler: (
|
|
40
|
+
annuler: (o) => m("/site-sections/" + o + "/revert", "POST")
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
|
-
function
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
function ce({
|
|
44
|
+
site: n,
|
|
45
|
+
apiBaseUrl: t,
|
|
46
|
+
surJeton: c,
|
|
47
|
+
surFermer: r
|
|
48
|
+
}) {
|
|
49
|
+
const [a, f] = k(""), [u, m] = k(""), [o, i] = k({ nom: "repos" }), h = async (v) => {
|
|
50
|
+
if (!a || !u) {
|
|
51
|
+
i({ nom: "erreur", texte: "Entrez votre adresse et votre mot de passe." });
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
i({ nom: "envoi" });
|
|
55
|
+
try {
|
|
56
|
+
const S = await fetch(t + "/site-sections/edit-login", {
|
|
57
|
+
method: "POST",
|
|
58
|
+
headers: { "Content-Type": "application/json" },
|
|
59
|
+
body: JSON.stringify({ site: n, email: a, password: u, demanderAcces: v })
|
|
60
|
+
});
|
|
61
|
+
if (S.status === 429) {
|
|
62
|
+
i({
|
|
63
|
+
nom: "erreur",
|
|
64
|
+
texte: "Trop de tentatives. Réessayez dans quelques minutes."
|
|
65
|
+
});
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const _ = await S.json().catch(() => null);
|
|
69
|
+
if (_?.ok && _?.token) {
|
|
70
|
+
c(_.token);
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
if (_?.raison === "sans_acces") {
|
|
74
|
+
i({ nom: "sans-acces" });
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
if (_?.raison === "demande_envoyee") {
|
|
78
|
+
i({ nom: "demande-envoyee" });
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
if (_?.raison === "trop_de_demandes") {
|
|
82
|
+
i({
|
|
83
|
+
nom: "erreur",
|
|
84
|
+
texte: "Trop de demandes aujourd'hui. Réessayez demain."
|
|
85
|
+
});
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
i({
|
|
89
|
+
nom: "erreur",
|
|
90
|
+
texte: "Adresse ou mot de passe incorrect."
|
|
91
|
+
});
|
|
92
|
+
} catch {
|
|
93
|
+
i({
|
|
94
|
+
nom: "erreur",
|
|
95
|
+
texte: "Connexion au serveur impossible. Vérifiez votre réseau."
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
}, g = o.nom === "envoi";
|
|
99
|
+
return /* @__PURE__ */ e("div", { className: "voile", role: "dialog", "aria-modal": "true", "aria-label": "Modifier ce site", children: /* @__PURE__ */ b("div", { className: "fenetre", children: [
|
|
100
|
+
/* @__PURE__ */ b("div", { className: "panneau__tete", children: [
|
|
101
|
+
/* @__PURE__ */ b("div", { style: { flex: 1 }, children: [
|
|
102
|
+
/* @__PURE__ */ e("h2", { className: "panneau__titre", children: "Modifier ce site" }),
|
|
103
|
+
/* @__PURE__ */ e("p", { className: "panneau__sous", children: "Vous vous connectez à Lystech. Cet accès ne sert qu'à modifier le contenu de ce site." })
|
|
104
|
+
] }),
|
|
105
|
+
/* @__PURE__ */ e(
|
|
106
|
+
"button",
|
|
107
|
+
{
|
|
108
|
+
type: "button",
|
|
109
|
+
className: "bouton bouton--icone bouton--discret",
|
|
110
|
+
onClick: r,
|
|
111
|
+
"aria-label": "Fermer",
|
|
112
|
+
children: "✕"
|
|
113
|
+
}
|
|
114
|
+
)
|
|
115
|
+
] }),
|
|
116
|
+
/* @__PURE__ */ b(
|
|
117
|
+
"form",
|
|
118
|
+
{
|
|
119
|
+
className: "panneau__corps",
|
|
120
|
+
onSubmit: (v) => {
|
|
121
|
+
v.preventDefault(), h(!1);
|
|
122
|
+
},
|
|
123
|
+
children: [
|
|
124
|
+
o.nom === "erreur" && /* @__PURE__ */ e("p", { className: "message message--erreur", children: o.texte }),
|
|
125
|
+
o.nom === "sans-acces" && /* @__PURE__ */ e("p", { className: "message message--info", children: "Vous êtes bien reconnu, mais vous n'avez pas encore le droit de modifier ce site. Vous pouvez le demander : la personne responsable recevra un courriel." }),
|
|
126
|
+
o.nom === "demande-envoyee" && /* @__PURE__ */ e("p", { className: "message message--ok", children: "Demande envoyée. La personne responsable du site vous répondra." }),
|
|
127
|
+
o.nom !== "demande-envoyee" && /* @__PURE__ */ b(Q, { children: [
|
|
128
|
+
/* @__PURE__ */ b("div", { className: "champ", children: [
|
|
129
|
+
/* @__PURE__ */ e("label", { className: "champ__etiquette", htmlFor: "lys-courriel", children: "Adresse courriel" }),
|
|
130
|
+
/* @__PURE__ */ e(
|
|
131
|
+
"input",
|
|
132
|
+
{
|
|
133
|
+
id: "lys-courriel",
|
|
134
|
+
type: "text",
|
|
135
|
+
inputMode: "email",
|
|
136
|
+
autoComplete: "email",
|
|
137
|
+
value: a,
|
|
138
|
+
disabled: g,
|
|
139
|
+
onChange: (v) => f(v.target.value)
|
|
140
|
+
}
|
|
141
|
+
)
|
|
142
|
+
] }),
|
|
143
|
+
/* @__PURE__ */ b("div", { className: "champ", children: [
|
|
144
|
+
/* @__PURE__ */ e("label", { className: "champ__etiquette", htmlFor: "lys-mdp", children: "Mot de passe" }),
|
|
145
|
+
/* @__PURE__ */ e(
|
|
146
|
+
"input",
|
|
147
|
+
{
|
|
148
|
+
id: "lys-mdp",
|
|
149
|
+
type: "password",
|
|
150
|
+
autoComplete: "current-password",
|
|
151
|
+
value: u,
|
|
152
|
+
disabled: g,
|
|
153
|
+
onChange: (v) => m(v.target.value)
|
|
154
|
+
}
|
|
155
|
+
)
|
|
156
|
+
] })
|
|
157
|
+
] }),
|
|
158
|
+
/* @__PURE__ */ e("div", { style: { display: "flex", gap: 8, marginTop: 4 }, children: o.nom === "sans-acces" ? /* @__PURE__ */ e(
|
|
159
|
+
"button",
|
|
160
|
+
{
|
|
161
|
+
type: "button",
|
|
162
|
+
className: "bouton bouton--principal",
|
|
163
|
+
disabled: g,
|
|
164
|
+
onClick: () => {
|
|
165
|
+
h(!0);
|
|
166
|
+
},
|
|
167
|
+
children: "Demander l'accès"
|
|
168
|
+
}
|
|
169
|
+
) : o.nom === "demande-envoyee" ? /* @__PURE__ */ e("button", { type: "button", className: "bouton", onClick: r, children: "Fermer" }) : /* @__PURE__ */ e(
|
|
170
|
+
"button",
|
|
171
|
+
{
|
|
172
|
+
type: "submit",
|
|
173
|
+
className: "bouton bouton--principal",
|
|
174
|
+
disabled: g,
|
|
175
|
+
children: g ? "Vérification…" : "Se connecter"
|
|
176
|
+
}
|
|
177
|
+
) })
|
|
178
|
+
]
|
|
179
|
+
}
|
|
180
|
+
)
|
|
181
|
+
] }) });
|
|
182
|
+
}
|
|
183
|
+
function le(n, t) {
|
|
184
|
+
const c = n && typeof n == "object" && !Array.isArray(n) ? Object.keys(n).filter((a) => /^[a-z]{2}(-[A-Za-z]{2})?$/.test(a)) : [], r = t.slice(0, 2);
|
|
185
|
+
return Array.from(/* @__PURE__ */ new Set([r, ...c]));
|
|
46
186
|
}
|
|
47
|
-
function
|
|
187
|
+
function ue(n) {
|
|
48
188
|
switch (n.type) {
|
|
49
189
|
case "number":
|
|
50
190
|
return 0;
|
|
@@ -56,164 +196,164 @@ function $(n) {
|
|
|
56
196
|
return "";
|
|
57
197
|
}
|
|
58
198
|
}
|
|
59
|
-
function
|
|
199
|
+
function G({ champ: n, valeur: t, changer: c }) {
|
|
60
200
|
switch (n.type) {
|
|
61
201
|
case "richText":
|
|
62
|
-
return /* @__PURE__ */
|
|
202
|
+
return /* @__PURE__ */ e(
|
|
63
203
|
"textarea",
|
|
64
204
|
{
|
|
65
205
|
value: String(t ?? ""),
|
|
66
|
-
onChange: (r) =>
|
|
206
|
+
onChange: (r) => c(r.target.value)
|
|
67
207
|
}
|
|
68
208
|
);
|
|
69
209
|
case "number":
|
|
70
|
-
return /* @__PURE__ */
|
|
210
|
+
return /* @__PURE__ */ e(
|
|
71
211
|
"input",
|
|
72
212
|
{
|
|
73
213
|
type: "number",
|
|
74
214
|
value: t === "" || t == null ? "" : String(t),
|
|
75
|
-
onChange: (r) =>
|
|
215
|
+
onChange: (r) => c(r.target.value === "" ? "" : Number(r.target.value))
|
|
76
216
|
}
|
|
77
217
|
);
|
|
78
218
|
case "boolean":
|
|
79
|
-
return /* @__PURE__ */
|
|
80
|
-
/* @__PURE__ */
|
|
219
|
+
return /* @__PURE__ */ b("label", { className: "bascule", children: [
|
|
220
|
+
/* @__PURE__ */ e(
|
|
81
221
|
"input",
|
|
82
222
|
{
|
|
83
223
|
type: "checkbox",
|
|
84
224
|
checked: t === !0,
|
|
85
|
-
onChange: (r) =>
|
|
225
|
+
onChange: (r) => c(r.target.checked)
|
|
86
226
|
}
|
|
87
227
|
),
|
|
88
|
-
/* @__PURE__ */
|
|
228
|
+
/* @__PURE__ */ e("span", { children: t === !0 ? "Oui" : "Non" })
|
|
89
229
|
] });
|
|
90
230
|
case "date":
|
|
91
|
-
return /* @__PURE__ */
|
|
231
|
+
return /* @__PURE__ */ e(
|
|
92
232
|
"input",
|
|
93
233
|
{
|
|
94
234
|
type: "date",
|
|
95
235
|
value: String(t ?? "").slice(0, 10),
|
|
96
|
-
onChange: (r) =>
|
|
236
|
+
onChange: (r) => c(r.target.value)
|
|
97
237
|
}
|
|
98
238
|
);
|
|
99
239
|
case "choice":
|
|
100
|
-
return /* @__PURE__ */
|
|
240
|
+
return /* @__PURE__ */ b(
|
|
101
241
|
"select",
|
|
102
242
|
{
|
|
103
243
|
value: String(t ?? ""),
|
|
104
|
-
onChange: (r) =>
|
|
244
|
+
onChange: (r) => c(r.target.value),
|
|
105
245
|
children: [
|
|
106
|
-
/* @__PURE__ */
|
|
107
|
-
(n.options ?? []).map((r) => /* @__PURE__ */
|
|
246
|
+
/* @__PURE__ */ e("option", { value: "", children: "—" }),
|
|
247
|
+
(n.options ?? []).map((r) => /* @__PURE__ */ e("option", { value: r, children: r }, r))
|
|
108
248
|
]
|
|
109
249
|
}
|
|
110
250
|
);
|
|
111
251
|
case "url":
|
|
112
|
-
return /* @__PURE__ */
|
|
252
|
+
return /* @__PURE__ */ e(
|
|
113
253
|
"input",
|
|
114
254
|
{
|
|
115
255
|
type: "url",
|
|
116
256
|
value: String(t ?? ""),
|
|
117
|
-
onChange: (r) =>
|
|
257
|
+
onChange: (r) => c(r.target.value),
|
|
118
258
|
placeholder: "https://"
|
|
119
259
|
}
|
|
120
260
|
);
|
|
121
261
|
case "image":
|
|
122
|
-
return /* @__PURE__ */
|
|
123
|
-
/* @__PURE__ */
|
|
262
|
+
return /* @__PURE__ */ b(Q, { children: [
|
|
263
|
+
/* @__PURE__ */ e(
|
|
124
264
|
"input",
|
|
125
265
|
{
|
|
126
266
|
type: "url",
|
|
127
267
|
value: String(t ?? ""),
|
|
128
|
-
onChange: (r) =>
|
|
268
|
+
onChange: (r) => c(r.target.value),
|
|
129
269
|
placeholder: "https://…"
|
|
130
270
|
}
|
|
131
271
|
),
|
|
132
|
-
String(t ?? "").startsWith("http") && /* @__PURE__ */
|
|
272
|
+
String(t ?? "").startsWith("http") && /* @__PURE__ */ e("img", { className: "vignette", src: String(t), alt: "" })
|
|
133
273
|
] });
|
|
134
274
|
default:
|
|
135
|
-
return /* @__PURE__ */
|
|
275
|
+
return /* @__PURE__ */ e(
|
|
136
276
|
"input",
|
|
137
277
|
{
|
|
138
278
|
type: "text",
|
|
139
279
|
value: String(t ?? ""),
|
|
140
|
-
onChange: (r) =>
|
|
280
|
+
onChange: (r) => c(r.target.value)
|
|
141
281
|
}
|
|
142
282
|
);
|
|
143
283
|
}
|
|
144
284
|
}
|
|
145
|
-
function
|
|
285
|
+
function ee({ champ: n, valeur: t, changer: c, langue: r }) {
|
|
146
286
|
if (n.type === "list") {
|
|
147
|
-
const
|
|
148
|
-
const
|
|
149
|
-
|
|
287
|
+
const a = Array.isArray(t) ? t : [], f = n.of ?? [], u = (m, o, i) => {
|
|
288
|
+
const h = a.map((g, v) => v === m ? { ...g, [o]: i } : g);
|
|
289
|
+
c(h);
|
|
150
290
|
};
|
|
151
|
-
return /* @__PURE__ */
|
|
152
|
-
/* @__PURE__ */
|
|
153
|
-
n.help && /* @__PURE__ */
|
|
154
|
-
|
|
155
|
-
/* @__PURE__ */
|
|
156
|
-
/* @__PURE__ */
|
|
157
|
-
/* @__PURE__ */
|
|
158
|
-
/* @__PURE__ */
|
|
291
|
+
return /* @__PURE__ */ b("div", { className: "champ", children: [
|
|
292
|
+
/* @__PURE__ */ e("span", { className: "champ__etiquette", children: n.label }),
|
|
293
|
+
n.help && /* @__PURE__ */ e("p", { className: "champ__aide", children: n.help }),
|
|
294
|
+
a.map((m, o) => /* @__PURE__ */ b("div", { className: "liste__item", children: [
|
|
295
|
+
/* @__PURE__ */ b("div", { className: "liste__tete", children: [
|
|
296
|
+
/* @__PURE__ */ e("span", { className: "liste__rang", children: o + 1 }),
|
|
297
|
+
/* @__PURE__ */ b("span", { style: { display: "flex", gap: 4 }, children: [
|
|
298
|
+
/* @__PURE__ */ e(
|
|
159
299
|
"button",
|
|
160
300
|
{
|
|
161
301
|
type: "button",
|
|
162
302
|
className: "bouton bouton--icone bouton--discret",
|
|
163
303
|
title: "Monter",
|
|
164
|
-
disabled:
|
|
304
|
+
disabled: o === 0,
|
|
165
305
|
onClick: () => {
|
|
166
|
-
const
|
|
167
|
-
[
|
|
306
|
+
const i = [...a];
|
|
307
|
+
[i[o - 1], i[o]] = [i[o], i[o - 1]], c(i);
|
|
168
308
|
},
|
|
169
309
|
children: "↑"
|
|
170
310
|
}
|
|
171
311
|
),
|
|
172
|
-
/* @__PURE__ */
|
|
312
|
+
/* @__PURE__ */ e(
|
|
173
313
|
"button",
|
|
174
314
|
{
|
|
175
315
|
type: "button",
|
|
176
316
|
className: "bouton bouton--icone bouton--discret",
|
|
177
317
|
title: "Descendre",
|
|
178
|
-
disabled:
|
|
318
|
+
disabled: o === a.length - 1,
|
|
179
319
|
onClick: () => {
|
|
180
|
-
const
|
|
181
|
-
[
|
|
320
|
+
const i = [...a];
|
|
321
|
+
[i[o], i[o + 1]] = [i[o + 1], i[o]], c(i);
|
|
182
322
|
},
|
|
183
323
|
children: "↓"
|
|
184
324
|
}
|
|
185
325
|
),
|
|
186
|
-
/* @__PURE__ */
|
|
326
|
+
/* @__PURE__ */ e(
|
|
187
327
|
"button",
|
|
188
328
|
{
|
|
189
329
|
type: "button",
|
|
190
330
|
className: "bouton bouton--icone bouton--discret",
|
|
191
331
|
title: "Retirer",
|
|
192
|
-
onClick: () =>
|
|
332
|
+
onClick: () => c(a.filter((i, h) => h !== o)),
|
|
193
333
|
children: "✕"
|
|
194
334
|
}
|
|
195
335
|
)
|
|
196
336
|
] })
|
|
197
337
|
] }),
|
|
198
|
-
|
|
199
|
-
|
|
338
|
+
f.map((i) => /* @__PURE__ */ e(
|
|
339
|
+
ee,
|
|
200
340
|
{
|
|
201
|
-
champ:
|
|
341
|
+
champ: i,
|
|
202
342
|
langue: r,
|
|
203
|
-
valeur:
|
|
204
|
-
changer: (
|
|
343
|
+
valeur: m?.[i.key],
|
|
344
|
+
changer: (h) => u(o, i.key, h)
|
|
205
345
|
},
|
|
206
|
-
|
|
346
|
+
i.key
|
|
207
347
|
))
|
|
208
|
-
] },
|
|
209
|
-
/* @__PURE__ */
|
|
348
|
+
] }, o)),
|
|
349
|
+
/* @__PURE__ */ e(
|
|
210
350
|
"button",
|
|
211
351
|
{
|
|
212
352
|
type: "button",
|
|
213
353
|
className: "bouton",
|
|
214
|
-
onClick: () =>
|
|
215
|
-
...
|
|
216
|
-
Object.fromEntries(
|
|
354
|
+
onClick: () => c([
|
|
355
|
+
...a,
|
|
356
|
+
Object.fromEntries(f.map((m) => [m.key, ue(m)]))
|
|
217
357
|
]),
|
|
218
358
|
children: "+ Ajouter"
|
|
219
359
|
}
|
|
@@ -221,264 +361,509 @@ function P({ champ: n, valeur: t, changer: s, langue: r }) {
|
|
|
221
361
|
] });
|
|
222
362
|
}
|
|
223
363
|
if (n.localized) {
|
|
224
|
-
const
|
|
225
|
-
return /* @__PURE__ */
|
|
226
|
-
/* @__PURE__ */
|
|
227
|
-
n.help && /* @__PURE__ */
|
|
228
|
-
|
|
229
|
-
/* @__PURE__ */
|
|
230
|
-
/* @__PURE__ */
|
|
231
|
-
|
|
364
|
+
const a = le(t, r), f = t && typeof t == "object" && !Array.isArray(t) ? t : {};
|
|
365
|
+
return /* @__PURE__ */ b("div", { className: "champ", children: [
|
|
366
|
+
/* @__PURE__ */ e("span", { className: "champ__etiquette", children: n.label }),
|
|
367
|
+
n.help && /* @__PURE__ */ e("p", { className: "champ__aide", children: n.help }),
|
|
368
|
+
a.map((u) => /* @__PURE__ */ b("div", { style: { marginBottom: 8 }, children: [
|
|
369
|
+
/* @__PURE__ */ e("span", { className: "champ__langue", children: u }),
|
|
370
|
+
/* @__PURE__ */ e(
|
|
371
|
+
G,
|
|
232
372
|
{
|
|
233
373
|
champ: n,
|
|
234
|
-
valeur:
|
|
235
|
-
changer: (
|
|
374
|
+
valeur: f[u],
|
|
375
|
+
changer: (m) => c({ ...f, [u]: m })
|
|
236
376
|
}
|
|
237
377
|
)
|
|
238
|
-
] },
|
|
378
|
+
] }, u))
|
|
239
379
|
] });
|
|
240
380
|
}
|
|
241
|
-
return /* @__PURE__ */
|
|
242
|
-
/* @__PURE__ */
|
|
243
|
-
/* @__PURE__ */
|
|
244
|
-
n.help && /* @__PURE__ */
|
|
381
|
+
return /* @__PURE__ */ b("div", { className: "champ", children: [
|
|
382
|
+
/* @__PURE__ */ e("label", { className: "champ__etiquette", children: n.label }),
|
|
383
|
+
/* @__PURE__ */ e(G, { champ: n, valeur: t, changer: c }),
|
|
384
|
+
n.help && /* @__PURE__ */ e("p", { className: "champ__aide", children: n.help })
|
|
245
385
|
] });
|
|
246
386
|
}
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
387
|
+
const de = ["lystech-editeur-hote", "lystech-connexion-hote"];
|
|
388
|
+
function pe(n) {
|
|
389
|
+
const t = /* @__PURE__ */ new Map();
|
|
390
|
+
for (const [c, r] of Object.entries(n))
|
|
391
|
+
for (const [a, f] of Object.entries(r)) {
|
|
392
|
+
const u = String(f ?? "").trim();
|
|
393
|
+
if (u.length < 2 || u.includes("{{")) continue;
|
|
394
|
+
const m = t.get(u);
|
|
395
|
+
m ? m.push({ ns: c, chemin: a }) : t.set(u, [{ ns: c, chemin: a }]);
|
|
396
|
+
}
|
|
397
|
+
return t;
|
|
398
|
+
}
|
|
399
|
+
function me(n) {
|
|
400
|
+
const t = /* @__PURE__ */ new Map(), c = document.body.querySelectorAll("*");
|
|
401
|
+
for (const r of c) {
|
|
402
|
+
if (de.some((u) => r.id === u || r.closest("#" + u)) || r.children.length > 0) continue;
|
|
403
|
+
const a = (r.textContent ?? "").trim();
|
|
404
|
+
if (a.length < 2) continue;
|
|
405
|
+
const f = n.get(a);
|
|
406
|
+
f && t.set(r, { valeur: a, candidats: f });
|
|
407
|
+
}
|
|
408
|
+
return t;
|
|
409
|
+
}
|
|
410
|
+
function be({
|
|
411
|
+
source: n,
|
|
412
|
+
actif: t,
|
|
413
|
+
surModification: c
|
|
414
|
+
}) {
|
|
415
|
+
const r = F(/* @__PURE__ */ new Map()), a = F(null), [f, u] = k(null), m = F(n);
|
|
416
|
+
m.current = n;
|
|
417
|
+
const o = F(c);
|
|
418
|
+
return o.current = c, B(() => {
|
|
419
|
+
if (!t) return;
|
|
420
|
+
const i = m.current.langueCourante(), h = pe(m.current.dictionnaire(i)), g = () => {
|
|
421
|
+
r.current = me(h);
|
|
422
|
+
};
|
|
423
|
+
g();
|
|
424
|
+
let v;
|
|
425
|
+
const S = new MutationObserver(() => {
|
|
426
|
+
a.current || (clearTimeout(v), v = setTimeout(g, 250));
|
|
427
|
+
});
|
|
428
|
+
S.observe(document.body, { childList: !0, subtree: !0 });
|
|
429
|
+
const _ = "outline:2px dashed rgba(59,165,141,.85);outline-offset:3px;border-radius:3px;cursor:text;", U = (d) => {
|
|
430
|
+
const s = d.target;
|
|
431
|
+
!(s instanceof HTMLElement) || a.current || r.current.has(s) && (s.dataset.lysStyleAvant || (s.dataset.lysStyleAvant = s.getAttribute("style") ?? ""), s.setAttribute(
|
|
432
|
+
"style",
|
|
433
|
+
(s.dataset.lysStyleAvant ?? "") + _
|
|
434
|
+
));
|
|
435
|
+
}, z = (d) => {
|
|
436
|
+
const s = d.target;
|
|
437
|
+
if (!(s instanceof HTMLElement) || a.current?.el === s || s.dataset.lysStyleAvant === void 0) return;
|
|
438
|
+
const y = s.dataset.lysStyleAvant;
|
|
439
|
+
delete s.dataset.lysStyleAvant, y ? s.setAttribute("style", y) : s.removeAttribute("style");
|
|
440
|
+
}, T = (d, s) => {
|
|
441
|
+
const y = d.getAttribute("style") ?? "";
|
|
442
|
+
a.current = {
|
|
443
|
+
el: d,
|
|
444
|
+
avant: (d.textContent ?? "").trim(),
|
|
445
|
+
ns: s.ns,
|
|
446
|
+
chemin: s.chemin,
|
|
447
|
+
styleAvant: d.dataset.lysStyleAvant ?? y
|
|
448
|
+
}, d.setAttribute("contenteditable", "plaintext-only"), d.setAttribute(
|
|
449
|
+
"style",
|
|
450
|
+
(d.dataset.lysStyleAvant ?? "") + "outline:2px solid #3ba58d;outline-offset:3px;border-radius:3px;"
|
|
451
|
+
), d.focus();
|
|
452
|
+
const P = window.getSelection(), O = document.createRange();
|
|
453
|
+
O.selectNodeContents(d), P?.removeAllRanges(), P?.addRange(O);
|
|
454
|
+
}, w = async (d) => {
|
|
455
|
+
const s = a.current;
|
|
456
|
+
if (!s) return;
|
|
457
|
+
a.current = null;
|
|
458
|
+
const y = (s.el.textContent ?? "").trim();
|
|
459
|
+
s.el.removeAttribute("contenteditable");
|
|
460
|
+
const P = s.el.dataset.lysStyleAvant;
|
|
461
|
+
if (delete s.el.dataset.lysStyleAvant, P ? s.el.setAttribute("style", P) : s.el.removeAttribute("style"), d || y === s.avant) {
|
|
462
|
+
d && (s.el.textContent = s.avant);
|
|
463
|
+
return;
|
|
464
|
+
}
|
|
465
|
+
const O = m.current.langueCourante();
|
|
466
|
+
m.current.poser(O, s.ns, s.chemin, y), await o.current(s.ns, s.chemin, O, y);
|
|
467
|
+
}, N = (d) => {
|
|
468
|
+
const s = d.target;
|
|
469
|
+
if (!(s instanceof HTMLElement)) return;
|
|
470
|
+
if (a.current) {
|
|
471
|
+
if (a.current.el === s) return;
|
|
472
|
+
w(!1);
|
|
473
|
+
}
|
|
474
|
+
const y = r.current.get(s);
|
|
475
|
+
if (y) {
|
|
476
|
+
if (d.preventDefault(), d.stopPropagation(), y.candidats.length === 1) {
|
|
477
|
+
T(s, y.candidats[0]);
|
|
478
|
+
return;
|
|
479
|
+
}
|
|
480
|
+
u({
|
|
481
|
+
el: s,
|
|
482
|
+
candidats: y.candidats,
|
|
483
|
+
x: d.clientX,
|
|
484
|
+
y: d.clientY
|
|
276
485
|
});
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
},
|
|
281
|
-
|
|
486
|
+
}
|
|
487
|
+
}, A = (d) => {
|
|
488
|
+
a.current && (d.key === "Escape" ? (d.preventDefault(), w(!0)) : d.key === "Enter" && !d.shiftKey && (d.preventDefault(), w(!1)));
|
|
489
|
+
}, M = () => {
|
|
490
|
+
a.current && w(!1);
|
|
491
|
+
};
|
|
492
|
+
document.addEventListener("mouseover", U, !0), document.addEventListener("mouseout", z, !0), document.addEventListener("click", N, !0);
|
|
493
|
+
const I = (d) => {
|
|
494
|
+
if (!a.current) return;
|
|
495
|
+
const s = d.inputType;
|
|
496
|
+
(s === "insertParagraph" || s === "insertLineBreak") && (d.preventDefault(), w(!1));
|
|
282
497
|
};
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
498
|
+
return document.addEventListener("beforeinput", I, !0), document.addEventListener("keydown", A, !0), document.addEventListener("focusout", M, !0), window.__lysChoisir = (d, s) => {
|
|
499
|
+
u(null), T(s, d);
|
|
500
|
+
}, () => {
|
|
501
|
+
clearTimeout(v), S.disconnect(), document.removeEventListener("mouseover", U, !0), document.removeEventListener("mouseout", z, !0), document.removeEventListener("click", N, !0), document.removeEventListener("beforeinput", I, !0), document.removeEventListener("keydown", A, !0), document.removeEventListener("focusout", M, !0), a.current && w(!0), delete window.__lysChoisir;
|
|
287
502
|
};
|
|
288
|
-
}, []),
|
|
503
|
+
}, [t]), f ? /* @__PURE__ */ b(
|
|
504
|
+
"div",
|
|
505
|
+
{
|
|
506
|
+
className: "choix",
|
|
507
|
+
style: {
|
|
508
|
+
top: Math.min(f.y + 10, window.innerHeight - 200),
|
|
509
|
+
left: Math.min(f.x, window.innerWidth - 280)
|
|
510
|
+
},
|
|
511
|
+
children: [
|
|
512
|
+
/* @__PURE__ */ e("p", { className: "choix__titre", children: "Ce texte apparaît à plusieurs endroits." }),
|
|
513
|
+
/* @__PURE__ */ e("p", { className: "choix__aide", children: "Lequel corrigez-vous ?" }),
|
|
514
|
+
f.candidats.map((i) => /* @__PURE__ */ b(
|
|
515
|
+
"button",
|
|
516
|
+
{
|
|
517
|
+
type: "button",
|
|
518
|
+
className: "choix__option",
|
|
519
|
+
onClick: () => window.__lysChoisir?.(i, f.el),
|
|
520
|
+
children: [
|
|
521
|
+
/* @__PURE__ */ e("span", { className: "choix__chemin", children: i.chemin }),
|
|
522
|
+
/* @__PURE__ */ e("span", { className: "choix__ns", children: i.ns })
|
|
523
|
+
]
|
|
524
|
+
},
|
|
525
|
+
i.ns + ":" + i.chemin
|
|
526
|
+
)),
|
|
527
|
+
/* @__PURE__ */ e(
|
|
528
|
+
"button",
|
|
529
|
+
{
|
|
530
|
+
type: "button",
|
|
531
|
+
className: "bouton bouton--discret",
|
|
532
|
+
onClick: () => u(null),
|
|
533
|
+
children: "Annuler"
|
|
534
|
+
}
|
|
535
|
+
)
|
|
536
|
+
]
|
|
537
|
+
}
|
|
538
|
+
) : null;
|
|
289
539
|
}
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
540
|
+
const Y = /^i18n:([^:]+):(.*)$/, J = "commun";
|
|
541
|
+
function K(n, t) {
|
|
542
|
+
return JSON.stringify(n ?? {}) === JSON.stringify(t ?? {});
|
|
543
|
+
}
|
|
544
|
+
function fe({ api: n, pont: t }) {
|
|
545
|
+
const [c, r] = k([]), [a, f] = k([]), [u, m] = k(t.page), [o, i] = k(null), [h, g] = k({}), [v, S] = k(!1), [_, U] = k("modifier"), [z, T] = k(!1), [w, N] = k(
|
|
546
|
+
null
|
|
547
|
+
);
|
|
548
|
+
B(() => (t.surChangementDePage = (l) => {
|
|
549
|
+
m(l), i(null), S(!1);
|
|
294
550
|
}, () => {
|
|
295
551
|
t.surChangementDePage = void 0;
|
|
296
552
|
}), [t]);
|
|
297
|
-
const
|
|
553
|
+
const A = H(async () => {
|
|
298
554
|
try {
|
|
299
|
-
const
|
|
300
|
-
|
|
555
|
+
const [l, p] = await Promise.all([
|
|
556
|
+
n.pourPage(u),
|
|
557
|
+
u === J ? Promise.resolve([]) : n.pourPage(J)
|
|
558
|
+
]), x = [...l, ...p];
|
|
559
|
+
return f(x), x;
|
|
301
560
|
} catch {
|
|
302
|
-
return
|
|
561
|
+
return N({
|
|
562
|
+
ton: "erreur",
|
|
563
|
+
texte: "Impossible de lire le contenu du site."
|
|
564
|
+
}), [];
|
|
303
565
|
}
|
|
304
|
-
}, [n,
|
|
305
|
-
|
|
566
|
+
}, [n, u]);
|
|
567
|
+
B(() => {
|
|
306
568
|
n.schemas().then(r).catch(() => r([]));
|
|
307
|
-
}, [n]),
|
|
308
|
-
|
|
309
|
-
}, [
|
|
310
|
-
const
|
|
311
|
-
(
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
569
|
+
}, [n]), B(() => {
|
|
570
|
+
A();
|
|
571
|
+
}, [A]);
|
|
572
|
+
const M = H(
|
|
573
|
+
(l, p) => {
|
|
574
|
+
let x = null, C = -1;
|
|
575
|
+
for (const R of c) {
|
|
576
|
+
const L = Y.exec(R.blockType);
|
|
577
|
+
if (!L || L[1] !== l) continue;
|
|
578
|
+
const q = L[2];
|
|
579
|
+
(q === "" || p === q || p.startsWith(q + ".")) && q.length > C && (x = R, C = q.length);
|
|
580
|
+
}
|
|
581
|
+
if (!x) return null;
|
|
582
|
+
const E = Y.exec(x.blockType)?.[2] ?? "", j = E ? p.slice(E.length + 1) : p;
|
|
583
|
+
return { bloc: x, champ: j };
|
|
322
584
|
},
|
|
323
585
|
[c]
|
|
324
|
-
),
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
586
|
+
), I = H(
|
|
587
|
+
(l) => c.find((p) => p.blockType === l),
|
|
588
|
+
[c]
|
|
589
|
+
), d = W(
|
|
590
|
+
() => c.filter((l) => {
|
|
591
|
+
const p = l.pages ?? [];
|
|
592
|
+
return p.includes(u) || p.includes(J);
|
|
593
|
+
}),
|
|
594
|
+
[c, u]
|
|
595
|
+
), s = W(
|
|
596
|
+
() => a.filter((l) => l.draft && !K(l.draft, l.data)),
|
|
597
|
+
[a]
|
|
598
|
+
), y = H(
|
|
599
|
+
async (l, p, x, C) => {
|
|
600
|
+
const E = M(l, p);
|
|
601
|
+
if (!E) {
|
|
602
|
+
N({
|
|
603
|
+
ton: "erreur",
|
|
604
|
+
texte: `Ce texte (${l}:${p}) n'appartient à aucun bloc déclaré.`
|
|
605
|
+
});
|
|
606
|
+
return;
|
|
607
|
+
}
|
|
608
|
+
const j = a.find((X) => X.blockType === E.bloc.blockType), R = j?.draft ?? j?.data ?? {}, L = R[E.champ], q = L && typeof L == "object" && !Array.isArray(L) ? { ...L, [x]: C } : { [x]: C }, $ = { ...R, [E.champ]: q };
|
|
609
|
+
try {
|
|
610
|
+
if (j?.UID)
|
|
611
|
+
await n.enregistrerBrouillon(j.UID, $);
|
|
612
|
+
else {
|
|
613
|
+
const X = E.bloc.pages?.[0] ?? u;
|
|
614
|
+
await n.creer(X, E.bloc.blockType, $);
|
|
615
|
+
}
|
|
616
|
+
await A(), N(null);
|
|
617
|
+
} catch {
|
|
618
|
+
N({
|
|
619
|
+
ton: "erreur",
|
|
620
|
+
texte: "Enregistrement impossible. Votre texte est toujours à l'écran."
|
|
621
|
+
});
|
|
622
|
+
}
|
|
332
623
|
},
|
|
333
|
-
[
|
|
334
|
-
),
|
|
335
|
-
if (!
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
}, [n, e, d, c, u]), M = async () => {
|
|
339
|
-
w(!0), f(null);
|
|
624
|
+
[n, M, u, A, a]
|
|
625
|
+
), P = async () => {
|
|
626
|
+
if (!s.length) return;
|
|
627
|
+
T(!0), N(null);
|
|
628
|
+
const l = s.length;
|
|
340
629
|
try {
|
|
341
|
-
|
|
630
|
+
for (const p of s) await n.publier(p.UID);
|
|
631
|
+
await A(), t.recharger(), N({
|
|
632
|
+
ton: "ok",
|
|
633
|
+
texte: l === 1 ? "Publié. Vos visiteurs le voient maintenant." : `${l} modifications publiées.`
|
|
634
|
+
});
|
|
342
635
|
} catch {
|
|
343
|
-
|
|
636
|
+
N({
|
|
637
|
+
ton: "erreur",
|
|
638
|
+
texte: "La publication a échoué. Rien n'a été mis en ligne."
|
|
639
|
+
});
|
|
344
640
|
} finally {
|
|
345
|
-
|
|
641
|
+
T(!1);
|
|
346
642
|
}
|
|
347
|
-
},
|
|
348
|
-
|
|
643
|
+
}, O = async () => {
|
|
644
|
+
T(!0);
|
|
349
645
|
try {
|
|
350
|
-
const
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
646
|
+
for (const p of s) await n.annuler(p.UID);
|
|
647
|
+
const l = await A();
|
|
648
|
+
if (t.sourceTexte) {
|
|
649
|
+
const { appliquerAuxTextes: p } = await import("./morceaux/sourceTexte-BMPMpNg9.js");
|
|
650
|
+
p(
|
|
651
|
+
l.map((x) => ({ blockType: x.blockType, data: x.data })),
|
|
652
|
+
t.sourceTexte
|
|
653
|
+
);
|
|
654
|
+
}
|
|
655
|
+
N({
|
|
656
|
+
ton: "info",
|
|
657
|
+
texte: "Modifications abandonnées. On est revenu à ce qui est en ligne."
|
|
658
|
+
});
|
|
355
659
|
} finally {
|
|
356
|
-
|
|
660
|
+
T(!1);
|
|
357
661
|
}
|
|
358
|
-
},
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
662
|
+
}, oe = (l) => {
|
|
663
|
+
const p = a.find((x) => x.blockType === l);
|
|
664
|
+
g({ ...p?.draft ?? p?.data ?? {} }), i(l), S(!1), N(null);
|
|
665
|
+
}, re = (l, p) => g((x) => ({ ...x, [l]: p })), ae = async () => {
|
|
666
|
+
if (o) {
|
|
667
|
+
T(!0);
|
|
668
|
+
try {
|
|
669
|
+
const l = a.find((x) => x.blockType === o);
|
|
670
|
+
if (l?.UID) await n.enregistrerBrouillon(l.UID, h);
|
|
671
|
+
else {
|
|
672
|
+
const x = I(o)?.pages?.[0] ?? u;
|
|
673
|
+
await n.creer(x, o, h);
|
|
674
|
+
}
|
|
675
|
+
const p = await A();
|
|
676
|
+
if (t.sourceTexte) {
|
|
677
|
+
const { appliquerAuxTextes: x } = await import("./morceaux/sourceTexte-BMPMpNg9.js");
|
|
678
|
+
x(
|
|
679
|
+
p.map((C) => ({ blockType: C.blockType, data: C.draft ?? C.data })),
|
|
680
|
+
t.sourceTexte
|
|
681
|
+
);
|
|
682
|
+
}
|
|
683
|
+
N({
|
|
684
|
+
ton: "ok",
|
|
685
|
+
texte: "Enregistré. Rien n'a encore changé pour vos visiteurs."
|
|
686
|
+
});
|
|
687
|
+
} catch {
|
|
688
|
+
N({ ton: "erreur", texte: "L'enregistrement a échoué." });
|
|
689
|
+
} finally {
|
|
690
|
+
T(!1);
|
|
691
|
+
}
|
|
370
692
|
}
|
|
371
|
-
},
|
|
693
|
+
}, ie = () => {
|
|
372
694
|
try {
|
|
373
695
|
window.sessionStorage.removeItem("lystech-edit");
|
|
374
696
|
} catch {
|
|
375
697
|
}
|
|
376
698
|
window.location.reload();
|
|
377
|
-
},
|
|
378
|
-
return /* @__PURE__ */
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
699
|
+
}, D = o ? I(o) : void 0, V = !o && !v;
|
|
700
|
+
return /* @__PURE__ */ b("div", { className: "calque", children: [
|
|
701
|
+
t.sourceTexte && /* @__PURE__ */ e(
|
|
702
|
+
be,
|
|
703
|
+
{
|
|
704
|
+
source: t.sourceTexte,
|
|
705
|
+
actif: V && !z && _ === "modifier",
|
|
706
|
+
surModification: y
|
|
707
|
+
}
|
|
708
|
+
),
|
|
709
|
+
V && /* @__PURE__ */ b("div", { className: "barre", children: [
|
|
710
|
+
/* @__PURE__ */ e("span", { className: "barre__point" }),
|
|
711
|
+
/* @__PURE__ */ e("span", { className: "barre__texte", children: _ === "modifier" ? "Cliquez un texte pour le corriger" : "Navigation libre — les clics ouvrent les liens" }),
|
|
712
|
+
/* @__PURE__ */ e(
|
|
713
|
+
"button",
|
|
382
714
|
{
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
715
|
+
type: "button",
|
|
716
|
+
className: "bouton " + (_ === "circuler" ? "bouton--principal" : ""),
|
|
717
|
+
onClick: () => U((l) => l === "modifier" ? "circuler" : "modifier"),
|
|
718
|
+
title: _ === "modifier" ? "Passer en navigation pour changer de page" : "Revenir a la modification des textes",
|
|
719
|
+
children: _ === "modifier" ? "Circuler" : "Modifier"
|
|
720
|
+
}
|
|
721
|
+
),
|
|
722
|
+
s.length > 0 ? /* @__PURE__ */ b(Q, { children: [
|
|
723
|
+
/* @__PURE__ */ e("span", { className: "barre__compte", children: s.length === 1 ? "1 modification non publiée" : `${s.length} modifications non publiées` }),
|
|
724
|
+
/* @__PURE__ */ e(
|
|
725
|
+
"button",
|
|
726
|
+
{
|
|
727
|
+
type: "button",
|
|
728
|
+
className: "bouton bouton--principal",
|
|
729
|
+
onClick: P,
|
|
730
|
+
disabled: z,
|
|
731
|
+
children: "Publier"
|
|
389
732
|
}
|
|
733
|
+
),
|
|
734
|
+
/* @__PURE__ */ e(
|
|
735
|
+
"button",
|
|
736
|
+
{
|
|
737
|
+
type: "button",
|
|
738
|
+
className: "bouton bouton--discret",
|
|
739
|
+
onClick: O,
|
|
740
|
+
disabled: z,
|
|
741
|
+
children: "Abandonner"
|
|
742
|
+
}
|
|
743
|
+
)
|
|
744
|
+
] }) : /* @__PURE__ */ e("span", { className: "barre__compte", children: "tout est publié" }),
|
|
745
|
+
/* @__PURE__ */ e(
|
|
746
|
+
"button",
|
|
747
|
+
{
|
|
748
|
+
type: "button",
|
|
749
|
+
className: "bouton bouton--discret",
|
|
750
|
+
onClick: () => S(!0),
|
|
751
|
+
children: "Plus…"
|
|
390
752
|
}
|
|
391
753
|
),
|
|
392
|
-
/* @__PURE__ */
|
|
754
|
+
/* @__PURE__ */ e(
|
|
393
755
|
"button",
|
|
394
756
|
{
|
|
395
757
|
type: "button",
|
|
396
|
-
className: "
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
children: [
|
|
400
|
-
"✎ ",
|
|
401
|
-
A(i.blockType)?.label ?? i.blockType
|
|
402
|
-
]
|
|
758
|
+
className: "bouton bouton--discret",
|
|
759
|
+
onClick: ie,
|
|
760
|
+
children: "Quitter"
|
|
403
761
|
}
|
|
404
762
|
)
|
|
405
|
-
] }, i.blockType)),
|
|
406
|
-
!e && /* @__PURE__ */ p("div", { className: "barre", children: [
|
|
407
|
-
/* @__PURE__ */ o("span", { className: "barre__point" }),
|
|
408
|
-
/* @__PURE__ */ p("span", { className: "barre__texte", children: [
|
|
409
|
-
"Mode édition — ",
|
|
410
|
-
/* @__PURE__ */ o("b", { children: t.site })
|
|
411
|
-
] }),
|
|
412
|
-
/* @__PURE__ */ o("span", { className: "barre__compte", children: E.length === 0 ? "aucune section sur cette page" : E.length === 1 ? "1 section modifiable" : E.length + " sections modifiables" }),
|
|
413
|
-
/* @__PURE__ */ o("button", { type: "button", className: "bouton bouton--discret", onClick: J, children: "Quitter" })
|
|
414
763
|
] }),
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
764
|
+
w && V && /* @__PURE__ */ e("div", { className: "flottant", children: /* @__PURE__ */ e("p", { className: "message message--" + w.ton, children: w.texte }) }),
|
|
765
|
+
v && /* @__PURE__ */ b("div", { className: "panneau", role: "dialog", "aria-label": "Tous les contenus", children: [
|
|
766
|
+
/* @__PURE__ */ b("div", { className: "panneau__tete", children: [
|
|
767
|
+
/* @__PURE__ */ b("div", { style: { flex: 1 }, children: [
|
|
768
|
+
/* @__PURE__ */ e("h2", { className: "panneau__titre", children: "Tous les contenus" }),
|
|
769
|
+
/* @__PURE__ */ e("p", { className: "panneau__sous", children: "Y compris ce qui ne s'affiche pas dans la page : titre de l'onglet, description dans les moteurs de recherche, textes contenant une valeur calculée." })
|
|
420
770
|
] }),
|
|
421
|
-
/* @__PURE__ */
|
|
771
|
+
/* @__PURE__ */ e(
|
|
422
772
|
"button",
|
|
423
773
|
{
|
|
424
774
|
type: "button",
|
|
425
775
|
className: "bouton bouton--icone bouton--discret",
|
|
426
|
-
onClick:
|
|
776
|
+
onClick: () => S(!1),
|
|
427
777
|
"aria-label": "Fermer",
|
|
428
778
|
children: "✕"
|
|
429
779
|
}
|
|
430
780
|
)
|
|
431
781
|
] }),
|
|
432
|
-
/* @__PURE__ */
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
className: "bouton bouton--discret",
|
|
451
|
-
onClick: F,
|
|
452
|
-
disabled: x,
|
|
453
|
-
children: "Abandonner"
|
|
454
|
-
}
|
|
455
|
-
),
|
|
456
|
-
/* @__PURE__ */ o("span", { className: "espace" }),
|
|
457
|
-
/* @__PURE__ */ o(
|
|
458
|
-
"button",
|
|
459
|
-
{
|
|
460
|
-
type: "button",
|
|
461
|
-
className: "bouton",
|
|
462
|
-
onClick: M,
|
|
463
|
-
disabled: x || !_,
|
|
464
|
-
children: "Enregistrer"
|
|
465
|
-
}
|
|
466
|
-
),
|
|
467
|
-
/* @__PURE__ */ o(
|
|
468
|
-
"button",
|
|
469
|
-
{
|
|
470
|
-
type: "button",
|
|
471
|
-
className: "bouton bouton--principal",
|
|
472
|
-
onClick: B,
|
|
473
|
-
disabled: x,
|
|
474
|
-
children: "Publier"
|
|
475
|
-
}
|
|
476
|
-
)
|
|
782
|
+
/* @__PURE__ */ b("div", { className: "panneau__corps", children: [
|
|
783
|
+
d.length === 0 && /* @__PURE__ */ e("p", { className: "message message--info", children: "Aucun contenu déclaré pour cette page." }),
|
|
784
|
+
d.map((l) => {
|
|
785
|
+
const p = a.find((C) => C.blockType === l.blockType), x = p?.draft && !K(p.draft, p.data);
|
|
786
|
+
return /* @__PURE__ */ b(
|
|
787
|
+
"button",
|
|
788
|
+
{
|
|
789
|
+
type: "button",
|
|
790
|
+
className: "rangee",
|
|
791
|
+
onClick: () => oe(l.blockType),
|
|
792
|
+
children: [
|
|
793
|
+
/* @__PURE__ */ e("span", { className: "rangee__nom", children: l.label }),
|
|
794
|
+
/* @__PURE__ */ e("span", { className: "rangee__info", children: x ? "non publié" : `${l.fields.length} textes` })
|
|
795
|
+
]
|
|
796
|
+
},
|
|
797
|
+
l.blockType
|
|
798
|
+
);
|
|
799
|
+
})
|
|
477
800
|
] })
|
|
478
|
-
] })
|
|
801
|
+
] }),
|
|
802
|
+
o && D && /* @__PURE__ */ b(
|
|
803
|
+
"div",
|
|
804
|
+
{
|
|
805
|
+
className: "panneau",
|
|
806
|
+
role: "dialog",
|
|
807
|
+
"aria-label": "Modifier " + D.label,
|
|
808
|
+
children: [
|
|
809
|
+
/* @__PURE__ */ b("div", { className: "panneau__tete", children: [
|
|
810
|
+
/* @__PURE__ */ b("div", { style: { flex: 1 }, children: [
|
|
811
|
+
/* @__PURE__ */ e("h2", { className: "panneau__titre", children: D.label }),
|
|
812
|
+
D.description && /* @__PURE__ */ e("p", { className: "panneau__sous", children: D.description })
|
|
813
|
+
] }),
|
|
814
|
+
/* @__PURE__ */ e(
|
|
815
|
+
"button",
|
|
816
|
+
{
|
|
817
|
+
type: "button",
|
|
818
|
+
className: "bouton bouton--icone bouton--discret",
|
|
819
|
+
onClick: () => i(null),
|
|
820
|
+
"aria-label": "Fermer",
|
|
821
|
+
children: "✕"
|
|
822
|
+
}
|
|
823
|
+
)
|
|
824
|
+
] }),
|
|
825
|
+
/* @__PURE__ */ b("div", { className: "panneau__corps", children: [
|
|
826
|
+
w && /* @__PURE__ */ e("p", { className: "message message--" + w.ton, children: w.texte }),
|
|
827
|
+
D.fields.map((l) => /* @__PURE__ */ e(
|
|
828
|
+
ee,
|
|
829
|
+
{
|
|
830
|
+
champ: l,
|
|
831
|
+
langue: t.langue,
|
|
832
|
+
valeur: h[l.key],
|
|
833
|
+
changer: (p) => re(l.key, p)
|
|
834
|
+
},
|
|
835
|
+
l.key
|
|
836
|
+
))
|
|
837
|
+
] }),
|
|
838
|
+
/* @__PURE__ */ b("div", { className: "panneau__pied", children: [
|
|
839
|
+
/* @__PURE__ */ e(
|
|
840
|
+
"button",
|
|
841
|
+
{
|
|
842
|
+
type: "button",
|
|
843
|
+
className: "bouton bouton--discret",
|
|
844
|
+
onClick: () => i(null),
|
|
845
|
+
disabled: z,
|
|
846
|
+
children: "Fermer"
|
|
847
|
+
}
|
|
848
|
+
),
|
|
849
|
+
/* @__PURE__ */ e("span", { className: "espace" }),
|
|
850
|
+
/* @__PURE__ */ e(
|
|
851
|
+
"button",
|
|
852
|
+
{
|
|
853
|
+
type: "button",
|
|
854
|
+
className: "bouton bouton--principal",
|
|
855
|
+
onClick: ae,
|
|
856
|
+
disabled: z,
|
|
857
|
+
children: "Enregistrer"
|
|
858
|
+
}
|
|
859
|
+
)
|
|
860
|
+
] })
|
|
861
|
+
]
|
|
862
|
+
}
|
|
863
|
+
)
|
|
479
864
|
] });
|
|
480
865
|
}
|
|
481
|
-
const
|
|
866
|
+
const xe = `
|
|
482
867
|
:host {
|
|
483
868
|
all: initial;
|
|
484
869
|
--fond: #16181d;
|
|
@@ -598,6 +983,32 @@ const te = `
|
|
|
598
983
|
}
|
|
599
984
|
.panneau__pied .espace { flex: 1; }
|
|
600
985
|
|
|
986
|
+
/* --------------------------------------------------- CONNEXION ---------- */
|
|
987
|
+
|
|
988
|
+
/* Le voile PREND les clics, lui : une boite de dialogue qui demande un mot de
|
|
989
|
+
passe ne doit pas laisser cliquer la page derriere elle. C'est l'exception
|
|
990
|
+
a la regle du calque, et elle est volontaire. */
|
|
991
|
+
.voile {
|
|
992
|
+
position: fixed;
|
|
993
|
+
inset: 0;
|
|
994
|
+
display: flex;
|
|
995
|
+
align-items: center;
|
|
996
|
+
justify-content: center;
|
|
997
|
+
padding: 16px;
|
|
998
|
+
background: rgba(8, 10, 14, 0.62);
|
|
999
|
+
backdrop-filter: blur(2px);
|
|
1000
|
+
}
|
|
1001
|
+
|
|
1002
|
+
.fenetre {
|
|
1003
|
+
width: min(420px, 100%);
|
|
1004
|
+
max-height: 90vh;
|
|
1005
|
+
overflow-y: auto;
|
|
1006
|
+
border: 1px solid var(--bord);
|
|
1007
|
+
border-radius: 12px;
|
|
1008
|
+
background: var(--fond);
|
|
1009
|
+
box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
|
|
1010
|
+
}
|
|
1011
|
+
|
|
601
1012
|
/* ------------------------------------------------------------ CHAMPS ---- */
|
|
602
1013
|
|
|
603
1014
|
.champ { margin-bottom: 16px; }
|
|
@@ -677,43 +1088,121 @@ input:focus, select:focus, textarea:focus {
|
|
|
677
1088
|
@media (prefers-reduced-motion: reduce) {
|
|
678
1089
|
* { transition: none !important; animation: none !important; }
|
|
679
1090
|
}
|
|
680
|
-
`,
|
|
681
|
-
|
|
1091
|
+
`, he = `
|
|
1092
|
+
/* --------------------------------------------------------- CHOIX -------- */
|
|
1093
|
+
|
|
1094
|
+
/* Quand un meme texte vient de plusieurs cles, on demande laquelle plutot que
|
|
1095
|
+
de deviner — et de modifier la mauvaise sans que personne le voie. */
|
|
1096
|
+
.choix {
|
|
1097
|
+
position: fixed;
|
|
1098
|
+
width: 260px;
|
|
1099
|
+
padding: 12px;
|
|
1100
|
+
border: 1px solid var(--bord);
|
|
1101
|
+
border-radius: 10px;
|
|
1102
|
+
background: var(--fond);
|
|
1103
|
+
box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45);
|
|
1104
|
+
}
|
|
1105
|
+
.choix__titre { margin: 0 0 2px; font-size: 12.5px; font-weight: 650; }
|
|
1106
|
+
.choix__aide { margin: 0 0 10px; font-size: 11.5px; color: var(--texte-doux); }
|
|
1107
|
+
.choix__option {
|
|
1108
|
+
display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
|
|
1109
|
+
width: 100%; margin-bottom: 6px; padding: 7px 9px;
|
|
1110
|
+
border: 1px solid var(--bord); border-radius: 7px;
|
|
1111
|
+
background: var(--fond-clair); color: var(--texte);
|
|
1112
|
+
font: inherit; text-align: left; cursor: pointer;
|
|
1113
|
+
}
|
|
1114
|
+
.choix__option:hover { background: #2a2e37; border-color: var(--accent); }
|
|
1115
|
+
.choix__chemin { font-size: 12px; font-weight: 600; }
|
|
1116
|
+
.choix__ns { font-size: 10.5px; color: var(--texte-doux); }
|
|
1117
|
+
|
|
1118
|
+
/* ------------------------------------------------------- RANGEES -------- */
|
|
1119
|
+
|
|
1120
|
+
.rangee {
|
|
1121
|
+
display: flex; align-items: center; justify-content: space-between; gap: 10px;
|
|
1122
|
+
width: 100%; margin-bottom: 6px; padding: 10px 12px;
|
|
1123
|
+
border: 1px solid var(--bord); border-radius: 8px;
|
|
1124
|
+
background: var(--fond-clair); color: var(--texte);
|
|
1125
|
+
font: inherit; text-align: left; cursor: pointer;
|
|
1126
|
+
}
|
|
1127
|
+
.rangee:hover { background: #2a2e37; border-color: var(--accent); }
|
|
1128
|
+
.rangee__nom { font-size: 13px; font-weight: 600; }
|
|
1129
|
+
.rangee__info { font-size: 11.5px; color: var(--texte-doux); white-space: nowrap; }
|
|
1130
|
+
|
|
1131
|
+
/* ------------------------------------------------------ FLOTTANT -------- */
|
|
1132
|
+
|
|
1133
|
+
/* Un message au-dessus de la barre, pour confirmer sans ouvrir de panneau. */
|
|
1134
|
+
.flottant {
|
|
1135
|
+
position: fixed;
|
|
1136
|
+
left: 50%; bottom: 76px;
|
|
1137
|
+
transform: translateX(-50%);
|
|
1138
|
+
max-width: min(460px, calc(100vw - 24px));
|
|
1139
|
+
}
|
|
1140
|
+
.flottant .message { margin: 0; box-shadow: 0 8px 26px rgba(0,0,0,.4); }
|
|
1141
|
+
`, ge = "lystech-editeur-hote", ve = "lystech-connexion-hote";
|
|
1142
|
+
function te(n) {
|
|
1143
|
+
document.getElementById(n)?.remove();
|
|
1144
|
+
const t = document.createElement("div");
|
|
1145
|
+
t.id = n, document.body.appendChild(t);
|
|
1146
|
+
const c = t.attachShadow({ mode: "open" }), r = document.createElement("style");
|
|
1147
|
+
r.textContent = xe + he, c.appendChild(r);
|
|
1148
|
+
const a = document.createElement("div");
|
|
1149
|
+
return c.appendChild(a), { hote: t, point: a };
|
|
1150
|
+
}
|
|
1151
|
+
function ne(n, t) {
|
|
1152
|
+
let c = n;
|
|
1153
|
+
return () => {
|
|
1154
|
+
const r = c;
|
|
1155
|
+
c = null, setTimeout(() => {
|
|
1156
|
+
r?.unmount(), t.remove();
|
|
1157
|
+
}, 0);
|
|
1158
|
+
};
|
|
1159
|
+
}
|
|
1160
|
+
function we({
|
|
1161
|
+
site: n,
|
|
1162
|
+
apiBaseUrl: t,
|
|
1163
|
+
surJeton: c
|
|
1164
|
+
}) {
|
|
1165
|
+
const { hote: r, point: a } = te(ve), f = Z(a), u = () => m();
|
|
1166
|
+
f.render(
|
|
1167
|
+
/* @__PURE__ */ e(
|
|
1168
|
+
ce,
|
|
1169
|
+
{
|
|
1170
|
+
site: n,
|
|
1171
|
+
apiBaseUrl: t,
|
|
1172
|
+
surJeton: (o) => {
|
|
1173
|
+
m(), c(o);
|
|
1174
|
+
},
|
|
1175
|
+
surFermer: u
|
|
1176
|
+
}
|
|
1177
|
+
)
|
|
1178
|
+
);
|
|
1179
|
+
const m = ne(f, r);
|
|
1180
|
+
return m;
|
|
1181
|
+
}
|
|
1182
|
+
function ke({
|
|
682
1183
|
jeton: n,
|
|
683
1184
|
site: t,
|
|
684
|
-
apiBaseUrl:
|
|
1185
|
+
apiBaseUrl: c,
|
|
685
1186
|
pont: r
|
|
686
1187
|
}) {
|
|
687
|
-
|
|
688
|
-
const c = document.createElement("div");
|
|
689
|
-
c.id = D, document.body.appendChild(c);
|
|
690
|
-
const b = c.attachShadow({ mode: "open" }), d = document.createElement("style");
|
|
691
|
-
d.textContent = te, b.appendChild(d);
|
|
692
|
-
const l = document.createElement("div");
|
|
693
|
-
b.appendChild(l);
|
|
694
|
-
let e = H(l);
|
|
695
|
-
const a = () => {
|
|
1188
|
+
const { hote: a, point: f } = te(ge), u = Z(f), m = () => {
|
|
696
1189
|
try {
|
|
697
1190
|
window.sessionStorage.removeItem("lystech-edit");
|
|
698
1191
|
} catch {
|
|
699
1192
|
}
|
|
700
1193
|
window.location.reload();
|
|
701
1194
|
};
|
|
702
|
-
return
|
|
703
|
-
/* @__PURE__ */
|
|
704
|
-
|
|
1195
|
+
return u.render(
|
|
1196
|
+
/* @__PURE__ */ e(
|
|
1197
|
+
fe,
|
|
705
1198
|
{
|
|
706
|
-
api:
|
|
1199
|
+
api: se({ jeton: n, site: t, apiBaseUrl: c, surJetonRefuse: m }),
|
|
707
1200
|
pont: r
|
|
708
1201
|
}
|
|
709
1202
|
)
|
|
710
|
-
), ()
|
|
711
|
-
const u = e;
|
|
712
|
-
e = null, setTimeout(() => {
|
|
713
|
-
u?.unmount(), c.remove();
|
|
714
|
-
}, 0);
|
|
715
|
-
};
|
|
1203
|
+
), ne(u, a);
|
|
716
1204
|
}
|
|
717
1205
|
export {
|
|
718
|
-
|
|
1206
|
+
we as monterConnexion,
|
|
1207
|
+
ke as monterEditeur
|
|
719
1208
|
};
|