living-ai-documentation 1.9.0 → 1.11.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.
|
@@ -281,6 +281,16 @@
|
|
|
281
281
|
"snippet.inline_edit_btn_heading_2": "Edit heading level 2",
|
|
282
282
|
"snippet.inline_edit_btn_heading_3": "Edit heading level 3",
|
|
283
283
|
"snippet.inline_edit_btn_heading_4": "Edit heading level 4",
|
|
284
|
+
"snippet.picker_search_placeholder": "Search a snippet…",
|
|
285
|
+
"snippet.picker_back": "Back",
|
|
286
|
+
"snippet.picker_no_results": "No matching snippet.",
|
|
287
|
+
"snippet.picker_cat_structure": "Structure",
|
|
288
|
+
"snippet.picker_cat_lists": "Lists",
|
|
289
|
+
"snippet.picker_cat_lists_code_data": "Lists, code & data",
|
|
290
|
+
"snippet.picker_cat_rich_text": "Rich text",
|
|
291
|
+
"snippet.picker_cat_code_data": "Code & data",
|
|
292
|
+
"snippet.picker_cat_links_media": "Links & media",
|
|
293
|
+
"snippet.picker_cat_advanced": "Advanced",
|
|
284
294
|
"snippet.link_text_label": "Link text",
|
|
285
295
|
"snippet.link_text_placeholder": "My link",
|
|
286
296
|
"snippet.link_url_label": "URL",
|
|
@@ -281,6 +281,16 @@
|
|
|
281
281
|
"snippet.inline_edit_btn_heading_2": "Éditer le titre niveau 2",
|
|
282
282
|
"snippet.inline_edit_btn_heading_3": "Éditer le titre niveau 3",
|
|
283
283
|
"snippet.inline_edit_btn_heading_4": "Éditer le titre niveau 4",
|
|
284
|
+
"snippet.picker_search_placeholder": "Rechercher un snippet…",
|
|
285
|
+
"snippet.picker_back": "Retour",
|
|
286
|
+
"snippet.picker_no_results": "Aucun snippet ne correspond.",
|
|
287
|
+
"snippet.picker_cat_structure": "Structure",
|
|
288
|
+
"snippet.picker_cat_lists": "Listes",
|
|
289
|
+
"snippet.picker_cat_lists_code_data": "Listes, code & données",
|
|
290
|
+
"snippet.picker_cat_rich_text": "Texte enrichi",
|
|
291
|
+
"snippet.picker_cat_code_data": "Code & données",
|
|
292
|
+
"snippet.picker_cat_links_media": "Liens & médias",
|
|
293
|
+
"snippet.picker_cat_advanced": "Avancés",
|
|
284
294
|
"snippet.link_text_label": "Texte du lien",
|
|
285
295
|
"snippet.link_text_placeholder": "Mon lien",
|
|
286
296
|
"snippet.link_url_label": "URL",
|
|
@@ -1429,7 +1429,7 @@
|
|
|
1429
1429
|
>
|
|
1430
1430
|
<div
|
|
1431
1431
|
id="snippet-modal-card"
|
|
1432
|
-
class="bg-white dark:bg-gray-900 rounded-xl shadow-xl w-full max-w-
|
|
1432
|
+
class="bg-white dark:bg-gray-900 rounded-xl shadow-xl w-full max-w-6xl mx-4 p-6 space-y-5 max-h-[90vh] overflow-y-auto"
|
|
1433
1433
|
>
|
|
1434
1434
|
<h3 class="text-base font-semibold text-gray-900 dark:text-gray-50">
|
|
1435
1435
|
<span id="snippet-modal-title" data-i18n="snippet.modal_title">🧩 Insert a snippet</span>
|
|
@@ -1440,8 +1440,38 @@
|
|
|
1440
1440
|
class="hidden rounded-lg px-3 py-2 text-xs"
|
|
1441
1441
|
></div>
|
|
1442
1442
|
|
|
1443
|
-
<!-- Snippet
|
|
1444
|
-
<div class="space-y-
|
|
1443
|
+
<!-- Snippet picker (insertion mode) -->
|
|
1444
|
+
<div id="snippet-picker" class="hidden space-y-4">
|
|
1445
|
+
<input
|
|
1446
|
+
id="snippet-picker-search"
|
|
1447
|
+
type="text"
|
|
1448
|
+
data-i18n-placeholder="snippet.picker_search_placeholder"
|
|
1449
|
+
placeholder="Search a snippet…"
|
|
1450
|
+
oninput="snippetPickerSearchChanged()"
|
|
1451
|
+
onkeydown="snippetPickerSearchKeydown(event)"
|
|
1452
|
+
class="w-full px-3 py-2 text-sm rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500"
|
|
1453
|
+
/>
|
|
1454
|
+
<div id="snippet-picker-categories" class="space-y-4 max-h-[60vh] overflow-y-auto pr-1"></div>
|
|
1455
|
+
<div
|
|
1456
|
+
id="snippet-picker-no-results"
|
|
1457
|
+
data-i18n="snippet.picker_no_results"
|
|
1458
|
+
class="hidden text-center text-sm text-gray-500 dark:text-gray-400 py-4"
|
|
1459
|
+
>No matching snippet.</div>
|
|
1460
|
+
</div>
|
|
1461
|
+
|
|
1462
|
+
<!-- Back to picker (panel mode after picker selection) -->
|
|
1463
|
+
<button
|
|
1464
|
+
type="button"
|
|
1465
|
+
id="snippet-picker-back"
|
|
1466
|
+
onclick="snippetPickerBack()"
|
|
1467
|
+
class="hidden inline-flex items-center gap-2 text-xs font-medium text-blue-700 dark:text-blue-300 hover:underline"
|
|
1468
|
+
>
|
|
1469
|
+
<i class="fa-solid fa-arrow-left" aria-hidden="true"></i>
|
|
1470
|
+
<span data-i18n="snippet.picker_back">Back</span>
|
|
1471
|
+
</button>
|
|
1472
|
+
|
|
1473
|
+
<!-- Snippet type selector (hidden in picker UX, kept for state binding) -->
|
|
1474
|
+
<div id="snippet-type-wrapper" class="hidden space-y-1.5">
|
|
1445
1475
|
<label
|
|
1446
1476
|
data-i18n="snippet.type_label"
|
|
1447
1477
|
class="block text-xs font-medium text-gray-500 dark:text-gray-400"
|
|
@@ -37,10 +37,374 @@ const _SNIPPET_TYPE_TO_PANEL = {
|
|
|
37
37
|
"heading-4": "heading",
|
|
38
38
|
};
|
|
39
39
|
|
|
40
|
+
const _SNIPPET_ORDERED_LIST_DEFAULT = [
|
|
41
|
+
"Élément 1",
|
|
42
|
+
"Élément 2",
|
|
43
|
+
" Sous-élément 2.1",
|
|
44
|
+
" Sous-élément 2.2",
|
|
45
|
+
"Élément 3",
|
|
46
|
+
" Sous-élément 3.1",
|
|
47
|
+
" Sous-sous-élément 3.1.1",
|
|
48
|
+
].join("\n");
|
|
49
|
+
|
|
50
|
+
const _SNIPPET_UNORDERED_LIST_DEFAULT = [
|
|
51
|
+
"Élément 1",
|
|
52
|
+
"Élément 2",
|
|
53
|
+
" Sous-élément 2.1",
|
|
54
|
+
" Sous-élément 2.2",
|
|
55
|
+
"Élément 3",
|
|
56
|
+
" Sous-élément 3.1",
|
|
57
|
+
" Sous-sous-élément 3.1.1",
|
|
58
|
+
].join("\n");
|
|
59
|
+
|
|
40
60
|
function _snippetPanelForType(type) {
|
|
41
61
|
return _SNIPPET_TYPE_TO_PANEL[type] || type;
|
|
42
62
|
}
|
|
43
63
|
|
|
64
|
+
function _snippetFillTextareaDefault(id, value) {
|
|
65
|
+
const textarea = document.getElementById(id);
|
|
66
|
+
if (textarea && textarea.value.trim() === "") textarea.value = value;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const _SNIPPET_PICKER_ICONS = {
|
|
70
|
+
"heading-1": "fa-solid fa-heading",
|
|
71
|
+
"heading-2": "fa-solid fa-heading",
|
|
72
|
+
"heading-3": "fa-solid fa-heading",
|
|
73
|
+
"heading-4": "fa-solid fa-heading",
|
|
74
|
+
separator: "fa-solid fa-minus",
|
|
75
|
+
collapsible: "fa-solid fa-caret-right",
|
|
76
|
+
"unordered-list": "fa-solid fa-list-ul",
|
|
77
|
+
"ordered-list": "fa-solid fa-list-ol",
|
|
78
|
+
tree: "fa-solid fa-folder-tree",
|
|
79
|
+
"colored-text": "fa-solid fa-highlighter",
|
|
80
|
+
"colored-section": "fa-solid fa-fill-drip",
|
|
81
|
+
blockquote: "fa-solid fa-quote-right",
|
|
82
|
+
"code-block": "fa-solid fa-code",
|
|
83
|
+
table: "fa-solid fa-table-cells",
|
|
84
|
+
link: "fa-solid fa-link",
|
|
85
|
+
"doc-link": "fa-solid fa-file-lines",
|
|
86
|
+
"anchor-link": "fa-solid fa-anchor",
|
|
87
|
+
"anchor-doc-link": "fa-solid fa-anchor",
|
|
88
|
+
image: "fa-solid fa-image",
|
|
89
|
+
diagram: "fa-solid fa-diagram-project",
|
|
90
|
+
emojis: "fa-solid fa-face-smile",
|
|
91
|
+
attachment: "fa-solid fa-paperclip",
|
|
92
|
+
"local-search": "fa-solid fa-magnifying-glass",
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
const _SNIPPET_PICKER_CATEGORIES = [
|
|
96
|
+
{
|
|
97
|
+
key: "structure",
|
|
98
|
+
labelKey: "snippet.picker_cat_structure",
|
|
99
|
+
types: ["heading-1", "heading-2", "heading-3", "heading-4", "separator", "collapsible"],
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
key: "lists-code-data",
|
|
103
|
+
labelKey: "snippet.picker_cat_lists_code_data",
|
|
104
|
+
types: ["unordered-list", "ordered-list", "tree", "code-block", "table", "diagram"],
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
key: "rich-text",
|
|
108
|
+
labelKey: "snippet.picker_cat_rich_text",
|
|
109
|
+
types: ["colored-text", "colored-section", "blockquote", "emojis", "local-search"],
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
key: "links-media",
|
|
113
|
+
labelKey: "snippet.picker_cat_links_media",
|
|
114
|
+
types: ["link", "doc-link", "anchor-link", "anchor-doc-link", "image", "attachment"],
|
|
115
|
+
},
|
|
116
|
+
];
|
|
117
|
+
|
|
118
|
+
const _SNIPPET_PICKER_PALETTE = {
|
|
119
|
+
blueLight: {
|
|
120
|
+
card:
|
|
121
|
+
"border-sky-200 dark:border-sky-800 bg-sky-50 dark:bg-sky-950/40 hover:bg-sky-100 dark:hover:bg-sky-900/50 hover:border-sky-300 dark:hover:border-sky-700",
|
|
122
|
+
icon: "text-sky-700 dark:text-sky-300",
|
|
123
|
+
},
|
|
124
|
+
blue: {
|
|
125
|
+
card:
|
|
126
|
+
"border-blue-200 dark:border-blue-800 bg-blue-50 dark:bg-blue-950/40 hover:bg-blue-100 dark:hover:bg-blue-900/50 hover:border-blue-300 dark:hover:border-blue-700",
|
|
127
|
+
icon: "text-blue-700 dark:text-blue-300",
|
|
128
|
+
},
|
|
129
|
+
blueDark: {
|
|
130
|
+
card:
|
|
131
|
+
"border-indigo-200 dark:border-indigo-800 bg-indigo-50 dark:bg-indigo-950/40 hover:bg-indigo-100 dark:hover:bg-indigo-900/50 hover:border-indigo-300 dark:hover:border-indigo-700",
|
|
132
|
+
icon: "text-indigo-700 dark:text-indigo-300",
|
|
133
|
+
},
|
|
134
|
+
blueDarker: {
|
|
135
|
+
card:
|
|
136
|
+
"border-blue-300 dark:border-blue-700 bg-blue-100 dark:bg-blue-900/50 hover:bg-blue-200 dark:hover:bg-blue-800/60 hover:border-blue-400 dark:hover:border-blue-600",
|
|
137
|
+
icon: "text-blue-900 dark:text-blue-100",
|
|
138
|
+
},
|
|
139
|
+
gray: {
|
|
140
|
+
card:
|
|
141
|
+
"border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 hover:border-gray-300 dark:hover:border-gray-600",
|
|
142
|
+
icon: "text-gray-700 dark:text-gray-200",
|
|
143
|
+
},
|
|
144
|
+
violet: {
|
|
145
|
+
card:
|
|
146
|
+
"border-violet-200 dark:border-violet-800 bg-violet-50 dark:bg-violet-950/40 hover:bg-violet-100 dark:hover:bg-violet-900/50 hover:border-violet-300 dark:hover:border-violet-700",
|
|
147
|
+
icon: "text-violet-700 dark:text-violet-300",
|
|
148
|
+
},
|
|
149
|
+
green: {
|
|
150
|
+
card:
|
|
151
|
+
"border-emerald-200 dark:border-emerald-800 bg-emerald-50 dark:bg-emerald-950/40 hover:bg-emerald-100 dark:hover:bg-emerald-900/50 hover:border-emerald-300 dark:hover:border-emerald-700",
|
|
152
|
+
icon: "text-emerald-700 dark:text-emerald-300",
|
|
153
|
+
},
|
|
154
|
+
greenDark: {
|
|
155
|
+
card:
|
|
156
|
+
"border-green-300 dark:border-green-700 bg-green-100 dark:bg-green-900/50 hover:bg-green-200 dark:hover:bg-green-800/60 hover:border-green-400 dark:hover:border-green-600",
|
|
157
|
+
icon: "text-green-900 dark:text-green-100",
|
|
158
|
+
},
|
|
159
|
+
teal: {
|
|
160
|
+
card:
|
|
161
|
+
"border-teal-200 dark:border-teal-800 bg-teal-50 dark:bg-teal-950/40 hover:bg-teal-100 dark:hover:bg-teal-900/50 hover:border-teal-300 dark:hover:border-teal-700",
|
|
162
|
+
icon: "text-teal-700 dark:text-teal-300",
|
|
163
|
+
},
|
|
164
|
+
dark: {
|
|
165
|
+
card:
|
|
166
|
+
"border-slate-300 dark:border-slate-600 bg-slate-100 dark:bg-slate-800 hover:bg-slate-200 dark:hover:bg-slate-700 hover:border-slate-400 dark:hover:border-slate-500",
|
|
167
|
+
icon: "text-slate-900 dark:text-slate-100",
|
|
168
|
+
},
|
|
169
|
+
orange: {
|
|
170
|
+
card:
|
|
171
|
+
"border-orange-200 dark:border-orange-800 bg-orange-50 dark:bg-orange-950/40 hover:bg-orange-100 dark:hover:bg-orange-900/50 hover:border-orange-300 dark:hover:border-orange-700",
|
|
172
|
+
icon: "text-orange-700 dark:text-orange-300",
|
|
173
|
+
},
|
|
174
|
+
orangeLight: {
|
|
175
|
+
card:
|
|
176
|
+
"border-amber-200 dark:border-amber-800 bg-amber-50 dark:bg-amber-950/40 hover:bg-amber-100 dark:hover:bg-amber-900/50 hover:border-amber-300 dark:hover:border-amber-700",
|
|
177
|
+
icon: "text-amber-700 dark:text-amber-300",
|
|
178
|
+
},
|
|
179
|
+
orangeDark: {
|
|
180
|
+
card:
|
|
181
|
+
"border-orange-300 dark:border-orange-700 bg-orange-100 dark:bg-orange-900/50 hover:bg-orange-200 dark:hover:bg-orange-800/60 hover:border-orange-400 dark:hover:border-orange-600",
|
|
182
|
+
icon: "text-orange-900 dark:text-orange-100",
|
|
183
|
+
},
|
|
184
|
+
red: {
|
|
185
|
+
card:
|
|
186
|
+
"border-red-200 dark:border-red-800 bg-red-50 dark:bg-red-950/40 hover:bg-red-100 dark:hover:bg-red-900/50 hover:border-red-300 dark:hover:border-red-700",
|
|
187
|
+
icon: "text-red-700 dark:text-red-300",
|
|
188
|
+
},
|
|
189
|
+
pink: {
|
|
190
|
+
card:
|
|
191
|
+
"border-pink-200 dark:border-pink-800 bg-pink-50 dark:bg-pink-950/40 hover:bg-pink-100 dark:hover:bg-pink-900/50 hover:border-pink-300 dark:hover:border-pink-700",
|
|
192
|
+
icon: "text-pink-700 dark:text-pink-300",
|
|
193
|
+
},
|
|
194
|
+
amber: {
|
|
195
|
+
card:
|
|
196
|
+
"border-amber-200 dark:border-amber-800 bg-amber-50 dark:bg-amber-950/40 hover:bg-amber-100 dark:hover:bg-amber-900/50 hover:border-amber-300 dark:hover:border-amber-700",
|
|
197
|
+
icon: "text-amber-700 dark:text-amber-300",
|
|
198
|
+
},
|
|
199
|
+
yellow: {
|
|
200
|
+
card:
|
|
201
|
+
"border-yellow-300 dark:border-yellow-700 bg-yellow-100 dark:bg-yellow-900/50 hover:bg-yellow-200 dark:hover:bg-yellow-800/60 hover:border-yellow-400 dark:hover:border-yellow-600",
|
|
202
|
+
icon: "text-yellow-700 dark:text-yellow-200",
|
|
203
|
+
},
|
|
204
|
+
indigo: {
|
|
205
|
+
card:
|
|
206
|
+
"border-indigo-200 dark:border-indigo-800 bg-indigo-50 dark:bg-indigo-950/40 hover:bg-indigo-100 dark:hover:bg-indigo-900/50 hover:border-indigo-300 dark:hover:border-indigo-700",
|
|
207
|
+
icon: "text-indigo-700 dark:text-indigo-300",
|
|
208
|
+
},
|
|
209
|
+
cyan: {
|
|
210
|
+
card:
|
|
211
|
+
"border-cyan-200 dark:border-cyan-800 bg-cyan-50 dark:bg-cyan-950/40 hover:bg-cyan-100 dark:hover:bg-cyan-900/50 hover:border-cyan-300 dark:hover:border-cyan-700",
|
|
212
|
+
icon: "text-cyan-700 dark:text-cyan-300",
|
|
213
|
+
},
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
const _SNIPPET_PICKER_TYPE_PALETTE = {
|
|
217
|
+
"heading-1": "blueLight",
|
|
218
|
+
"heading-2": "blue",
|
|
219
|
+
"heading-3": "blueDark",
|
|
220
|
+
"heading-4": "blueDarker",
|
|
221
|
+
separator: "gray",
|
|
222
|
+
collapsible: "dark",
|
|
223
|
+
"unordered-list": "green",
|
|
224
|
+
"ordered-list": "greenDark",
|
|
225
|
+
tree: "cyan",
|
|
226
|
+
"code-block": "dark",
|
|
227
|
+
table: "orange",
|
|
228
|
+
diagram: "red",
|
|
229
|
+
"colored-text": "pink",
|
|
230
|
+
"colored-section": "violet",
|
|
231
|
+
blockquote: "gray",
|
|
232
|
+
link: "orangeLight",
|
|
233
|
+
"doc-link": "orange",
|
|
234
|
+
"anchor-link": "orangeDark",
|
|
235
|
+
"anchor-doc-link": "orangeDark",
|
|
236
|
+
image: "amber",
|
|
237
|
+
attachment: "orange",
|
|
238
|
+
emojis: "yellow",
|
|
239
|
+
"local-search": "cyan",
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
const _SNIPPET_TYPE_I18N_KEY = {
|
|
243
|
+
"heading-1": "snippet.heading_1",
|
|
244
|
+
"heading-2": "snippet.heading_2",
|
|
245
|
+
"heading-3": "snippet.heading_3",
|
|
246
|
+
"heading-4": "snippet.heading_4",
|
|
247
|
+
separator: "snippet.separator",
|
|
248
|
+
collapsible: "snippet.collapsible",
|
|
249
|
+
"unordered-list": "snippet.bullet_list",
|
|
250
|
+
"ordered-list": "snippet.numbered_list",
|
|
251
|
+
tree: "snippet.tree",
|
|
252
|
+
"colored-text": "snippet.colored_text",
|
|
253
|
+
"colored-section": "snippet.colored_section",
|
|
254
|
+
blockquote: "snippet.blockquote",
|
|
255
|
+
"code-block": "snippet.code_block",
|
|
256
|
+
table: "snippet.table",
|
|
257
|
+
link: "snippet.link",
|
|
258
|
+
"doc-link": "snippet.link_doc",
|
|
259
|
+
"anchor-link": "snippet.link_anchor",
|
|
260
|
+
"anchor-doc-link": "snippet.link_doc_anchor",
|
|
261
|
+
image: "snippet.image",
|
|
262
|
+
diagram: "snippet.diagram",
|
|
263
|
+
emojis: "snippet.emojis",
|
|
264
|
+
attachment: "snippet.attachment",
|
|
265
|
+
"local-search": "snippet.local_search",
|
|
266
|
+
};
|
|
267
|
+
|
|
268
|
+
function _snippetPickerCleanLabel(raw) {
|
|
269
|
+
if (!raw) return "";
|
|
270
|
+
const parts = raw.split(/\s+/);
|
|
271
|
+
if (parts.length > 1 && !/^[\p{L}\p{N}]/u.test(parts[0])) {
|
|
272
|
+
return parts.slice(1).join(" ");
|
|
273
|
+
}
|
|
274
|
+
return raw;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
function _snippetPickerLabel(type) {
|
|
278
|
+
const key = _SNIPPET_TYPE_I18N_KEY[type];
|
|
279
|
+
const raw = key ? window.t(key) : type;
|
|
280
|
+
return _snippetPickerCleanLabel(raw);
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
function _renderSnippetPicker() {
|
|
284
|
+
const container = document.getElementById("snippet-picker-categories");
|
|
285
|
+
if (!container) return;
|
|
286
|
+
container.innerHTML = "";
|
|
287
|
+
for (const cat of _SNIPPET_PICKER_CATEGORIES) {
|
|
288
|
+
const section = document.createElement("section");
|
|
289
|
+
section.dataset.snippetCategory = cat.key;
|
|
290
|
+
section.className = "space-y-2";
|
|
291
|
+
|
|
292
|
+
const h3 = document.createElement("h3");
|
|
293
|
+
h3.className =
|
|
294
|
+
"text-[11px] font-semibold uppercase tracking-wider text-gray-500 dark:text-gray-400";
|
|
295
|
+
h3.textContent = window.t(cat.labelKey);
|
|
296
|
+
section.appendChild(h3);
|
|
297
|
+
|
|
298
|
+
const grid = document.createElement("div");
|
|
299
|
+
grid.className =
|
|
300
|
+
"grid grid-cols-3 sm:grid-cols-4 md:grid-cols-5 lg:grid-cols-7 xl:grid-cols-8 gap-2";
|
|
301
|
+
|
|
302
|
+
for (const type of cat.types) {
|
|
303
|
+
const paletteName = _SNIPPET_PICKER_TYPE_PALETTE[type] || "indigo";
|
|
304
|
+
const colorClasses =
|
|
305
|
+
_SNIPPET_PICKER_PALETTE[paletteName] ||
|
|
306
|
+
_SNIPPET_PICKER_PALETTE.indigo;
|
|
307
|
+
const btn = document.createElement("button");
|
|
308
|
+
btn.type = "button";
|
|
309
|
+
btn.dataset.snippetType = type;
|
|
310
|
+
btn.className =
|
|
311
|
+
"snippet-card min-h-[76px] flex flex-col items-center justify-center gap-2 p-2 rounded-lg border text-gray-800 dark:text-gray-100 transition-colors " +
|
|
312
|
+
colorClasses.card;
|
|
313
|
+
btn.onclick = () => snippetPickerSelect(type);
|
|
314
|
+
|
|
315
|
+
const i = document.createElement("i");
|
|
316
|
+
i.className =
|
|
317
|
+
(_SNIPPET_PICKER_ICONS[type] || "fa-solid fa-puzzle-piece") +
|
|
318
|
+
" text-xl " +
|
|
319
|
+
colorClasses.icon;
|
|
320
|
+
i.setAttribute("aria-hidden", "true");
|
|
321
|
+
btn.appendChild(i);
|
|
322
|
+
|
|
323
|
+
const label = document.createElement("span");
|
|
324
|
+
label.className = "text-xs font-medium text-center leading-tight";
|
|
325
|
+
label.textContent = _snippetPickerLabel(type);
|
|
326
|
+
btn.appendChild(label);
|
|
327
|
+
|
|
328
|
+
grid.appendChild(btn);
|
|
329
|
+
}
|
|
330
|
+
section.appendChild(grid);
|
|
331
|
+
container.appendChild(section);
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
function _showSnippetPicker() {
|
|
336
|
+
_renderSnippetPicker();
|
|
337
|
+
document.getElementById("snippet-picker").classList.remove("hidden");
|
|
338
|
+
document.getElementById("snippet-picker-back").classList.add("hidden");
|
|
339
|
+
document.getElementById("snippet-submit-btn").classList.add("hidden");
|
|
340
|
+
_SNIPPET_PANELS.forEach((p) => {
|
|
341
|
+
const panel = document.getElementById("snip-panel-" + p);
|
|
342
|
+
if (panel) panel.classList.add("hidden");
|
|
343
|
+
});
|
|
344
|
+
const previewWrap = document.getElementById("snippet-preview-wrap");
|
|
345
|
+
if (previewWrap) previewWrap.classList.add("hidden");
|
|
346
|
+
const search = document.getElementById("snippet-picker-search");
|
|
347
|
+
if (search) {
|
|
348
|
+
search.value = "";
|
|
349
|
+
_snippetPickerFilter("");
|
|
350
|
+
setTimeout(() => search.focus(), 50);
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
function _showSnippetPanelOnly() {
|
|
355
|
+
document.getElementById("snippet-picker").classList.add("hidden");
|
|
356
|
+
document.getElementById("snippet-submit-btn").classList.remove("hidden");
|
|
357
|
+
const back = document.getElementById("snippet-picker-back");
|
|
358
|
+
if (back) back.classList.toggle("hidden", _snippetInlineEdit);
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
function _snippetPickerFilter(query) {
|
|
362
|
+
const container = document.getElementById("snippet-picker-categories");
|
|
363
|
+
if (!container) return;
|
|
364
|
+
const q = (query || "").toLowerCase().trim();
|
|
365
|
+
let totalVisible = 0;
|
|
366
|
+
container.querySelectorAll("[data-snippet-category]").forEach((section) => {
|
|
367
|
+
let visibleCount = 0;
|
|
368
|
+
section.querySelectorAll("[data-snippet-type]").forEach((card) => {
|
|
369
|
+
const label = (card.querySelector("span")?.textContent || "").toLowerCase();
|
|
370
|
+
const match = !q || label.includes(q);
|
|
371
|
+
card.classList.toggle("hidden", !match);
|
|
372
|
+
if (match) visibleCount += 1;
|
|
373
|
+
});
|
|
374
|
+
section.classList.toggle("hidden", visibleCount === 0);
|
|
375
|
+
totalVisible += visibleCount;
|
|
376
|
+
});
|
|
377
|
+
const noResults = document.getElementById("snippet-picker-no-results");
|
|
378
|
+
if (noResults) noResults.classList.toggle("hidden", totalVisible > 0);
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
function snippetPickerSearchChanged() {
|
|
382
|
+
const input = document.getElementById("snippet-picker-search");
|
|
383
|
+
_snippetPickerFilter(input ? input.value : "");
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
function snippetPickerSearchKeydown(event) {
|
|
387
|
+
if (event.key === "Enter") {
|
|
388
|
+
event.preventDefault();
|
|
389
|
+
const firstVisible = document.querySelector(
|
|
390
|
+
"#snippet-picker-categories [data-snippet-type]:not(.hidden)",
|
|
391
|
+
);
|
|
392
|
+
if (firstVisible) snippetPickerSelect(firstVisible.dataset.snippetType);
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
function snippetPickerSelect(type) {
|
|
397
|
+
document.getElementById("snippet-type").value = type;
|
|
398
|
+
snippetTypeChanged();
|
|
399
|
+
_showSnippetPanelOnly();
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
function snippetPickerBack() {
|
|
403
|
+
const msgEl = document.getElementById("snippet-detect-msg");
|
|
404
|
+
if (msgEl) msgEl.classList.add("hidden");
|
|
405
|
+
_showSnippetPicker();
|
|
406
|
+
}
|
|
407
|
+
|
|
44
408
|
// Each emoji has search tags (bilingual FR/EN, space-separated, lowercase).
|
|
45
409
|
// Filter matches a 2+ char query against any tag prefix or substring.
|
|
46
410
|
const _EMOJI_CATEGORIES = [
|
|
@@ -676,8 +1040,8 @@ function _setSnippetModalMode(mode) {
|
|
|
676
1040
|
}
|
|
677
1041
|
const card = document.getElementById("snippet-modal-card");
|
|
678
1042
|
if (card) {
|
|
679
|
-
card.classList.toggle("max-w-
|
|
680
|
-
card.classList.toggle("max-w-5xl",
|
|
1043
|
+
card.classList.toggle("max-w-6xl", !isInlineEdit);
|
|
1044
|
+
card.classList.toggle("max-w-5xl", isInlineEdit);
|
|
681
1045
|
}
|
|
682
1046
|
}
|
|
683
1047
|
|
|
@@ -691,49 +1055,22 @@ function _openSnippetsModalForText(selectedText, detectedOverride = null) {
|
|
|
691
1055
|
snippetAnchorDocChanged();
|
|
692
1056
|
|
|
693
1057
|
const msgEl = document.getElementById("snippet-detect-msg");
|
|
1058
|
+
if (msgEl) msgEl.classList.add("hidden");
|
|
1059
|
+
const detected = selectedText
|
|
1060
|
+
? detectedOverride || detectSnippetType(selectedText)
|
|
1061
|
+
: null;
|
|
694
1062
|
|
|
695
|
-
if (
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
snippetTypeChanged();
|
|
700
|
-
parseAndFillSnippet(selectedText, detected);
|
|
701
|
-
const labels = {
|
|
702
|
-
collapsible: window.t('snippet.collapsible'),
|
|
703
|
-
link: window.t('snippet.link'),
|
|
704
|
-
"doc-link": window.t('snippet.link_doc'),
|
|
705
|
-
"anchor-link": window.t('snippet.link_anchor'),
|
|
706
|
-
"anchor-doc-link": window.t('snippet.link_doc_anchor'),
|
|
707
|
-
"ordered-list": window.t('snippet.numbered_list'),
|
|
708
|
-
"unordered-list": window.t('snippet.bullet_list'),
|
|
709
|
-
"code-block": window.t('snippet.code_block'),
|
|
710
|
-
blockquote: window.t('snippet.blockquote'),
|
|
711
|
-
separator: window.t('snippet.separator'),
|
|
712
|
-
image: window.t('snippet.image'),
|
|
713
|
-
table: window.t('snippet.table'),
|
|
714
|
-
tree: window.t('snippet.tree'),
|
|
715
|
-
"heading-1": window.t('snippet.heading_1'),
|
|
716
|
-
"heading-2": window.t('snippet.heading_2'),
|
|
717
|
-
"heading-3": window.t('snippet.heading_3'),
|
|
718
|
-
"heading-4": window.t('snippet.heading_4'),
|
|
719
|
-
"colored-section": window.t('snippet.colored_section'),
|
|
720
|
-
"colored-text": window.t('snippet.colored_text'),
|
|
721
|
-
};
|
|
722
|
-
msgEl.textContent = window.t('snippet.detected_msg').replace('{type}', labels[detected] ?? detected);
|
|
723
|
-
msgEl.className =
|
|
724
|
-
"rounded-lg px-3 py-2 text-xs bg-green-50 dark:bg-green-900/20 text-green-700 dark:text-green-300 border border-green-200 dark:border-green-800";
|
|
725
|
-
} else {
|
|
726
|
-
document.getElementById("snippet-type").value = "diagram";
|
|
727
|
-
snippetTypeChanged();
|
|
728
|
-
msgEl.textContent = window.t('snippet.unknown_type_msg');
|
|
729
|
-
msgEl.className =
|
|
730
|
-
"rounded-lg px-3 py-2 text-xs bg-amber-50 dark:bg-amber-900/20 text-amber-700 dark:text-amber-300 border border-amber-200 dark:border-amber-800";
|
|
731
|
-
}
|
|
732
|
-
msgEl.classList.remove("hidden");
|
|
733
|
-
} else {
|
|
734
|
-
msgEl.classList.add("hidden");
|
|
735
|
-
document.getElementById("snippet-type").value = "diagram";
|
|
1063
|
+
if (_snippetInlineInsert) {
|
|
1064
|
+
_showSnippetPicker();
|
|
1065
|
+
} else if (detected) {
|
|
1066
|
+
document.getElementById("snippet-type").value = detected;
|
|
736
1067
|
snippetTypeChanged();
|
|
1068
|
+
parseAndFillSnippet(selectedText, detected);
|
|
1069
|
+
_showSnippetPanelOnly();
|
|
1070
|
+
} else if (selectedText) {
|
|
1071
|
+
_showSnippetPicker();
|
|
1072
|
+
} else {
|
|
1073
|
+
_showSnippetPicker();
|
|
737
1074
|
}
|
|
738
1075
|
|
|
739
1076
|
document.getElementById("snippets-modal").classList.remove("hidden");
|
|
@@ -805,7 +1142,20 @@ function snippetTypeChanged() {
|
|
|
805
1142
|
else if (type === "emojis") emojiInit();
|
|
806
1143
|
else if (type === "attachment") {
|
|
807
1144
|
/* no preview — file picker opens on Insert */
|
|
808
|
-
} else
|
|
1145
|
+
} else {
|
|
1146
|
+
if (type === "ordered-list") {
|
|
1147
|
+
_snippetFillTextareaDefault(
|
|
1148
|
+
"snip-ordered-list-content",
|
|
1149
|
+
_SNIPPET_ORDERED_LIST_DEFAULT,
|
|
1150
|
+
);
|
|
1151
|
+
} else if (type === "unordered-list") {
|
|
1152
|
+
_snippetFillTextareaDefault(
|
|
1153
|
+
"snip-unordered-list-content",
|
|
1154
|
+
_SNIPPET_UNORDERED_LIST_DEFAULT,
|
|
1155
|
+
);
|
|
1156
|
+
}
|
|
1157
|
+
snippetUpdatePreview();
|
|
1158
|
+
}
|
|
809
1159
|
}
|
|
810
1160
|
|
|
811
1161
|
async function snippetDiagInit() {
|
|
@@ -926,15 +1276,7 @@ function buildSnippetMarkdown() {
|
|
|
926
1276
|
case "ordered-list": {
|
|
927
1277
|
const content =
|
|
928
1278
|
document.getElementById("snip-ordered-list-content").value ||
|
|
929
|
-
|
|
930
|
-
"Élément 1",
|
|
931
|
-
"Élément 2",
|
|
932
|
-
" Sous-élément 2.1",
|
|
933
|
-
" Sous-élément 2.2",
|
|
934
|
-
"Élément 3",
|
|
935
|
-
" Sous-élément 3.1",
|
|
936
|
-
" Sous-sous-élément 3.1.1",
|
|
937
|
-
].join("\n");
|
|
1279
|
+
_SNIPPET_ORDERED_LIST_DEFAULT;
|
|
938
1280
|
const countersByIndent = new Map();
|
|
939
1281
|
return content
|
|
940
1282
|
.split("\n")
|
|
@@ -954,15 +1296,7 @@ function buildSnippetMarkdown() {
|
|
|
954
1296
|
case "unordered-list": {
|
|
955
1297
|
const content =
|
|
956
1298
|
document.getElementById("snip-unordered-list-content").value ||
|
|
957
|
-
|
|
958
|
-
"Élément 1",
|
|
959
|
-
"Élément 2",
|
|
960
|
-
" Sous-élément 2.1",
|
|
961
|
-
" Sous-élément 2.2",
|
|
962
|
-
"Élément 3",
|
|
963
|
-
" Sous-élément 3.1",
|
|
964
|
-
" Sous-sous-élément 3.1.1",
|
|
965
|
-
].join("\n");
|
|
1299
|
+
_SNIPPET_UNORDERED_LIST_DEFAULT;
|
|
966
1300
|
return content
|
|
967
1301
|
.split("\n")
|
|
968
1302
|
.filter((line) => line.trim())
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "living-ai-documentation",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.11.0",
|
|
4
4
|
"description": "Local Markdown documentation hub with a built-in MCP server — coding agents create ADRs, draw diagrams and detect drift while you code.",
|
|
5
5
|
"main": "dist/src/server.js",
|
|
6
6
|
"bin": {
|