ontowave 1.0.4 → 1.0.6

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/ontowave.js CHANGED
@@ -579,6 +579,114 @@
579
579
  color: #155724;
580
580
  }
581
581
 
582
+ /* === FIX #1: STYLES TABLEAUX === */
583
+ .ontowave-table {
584
+ width: 100%;
585
+ border-collapse: collapse;
586
+ margin: 16px 0;
587
+ font-size: 14px;
588
+ box-shadow: 0 1px 3px rgba(0,0,0,0.1);
589
+ }
590
+
591
+ .ontowave-table th {
592
+ background: #f6f8fa;
593
+ padding: 12px 16px;
594
+ font-weight: 600;
595
+ border: 1px solid #d0d7de;
596
+ color: #24292f;
597
+ }
598
+
599
+ .ontowave-table td {
600
+ padding: 12px 16px;
601
+ border: 1px solid #d0d7de;
602
+ color: #24292f;
603
+ }
604
+
605
+ .ontowave-table tbody tr:nth-child(even) {
606
+ background: #f6f8fa;
607
+ }
608
+
609
+ .ontowave-table tbody tr:hover {
610
+ background: #eaeef2;
611
+ }
612
+ /* === FIN FIX #1 === */
613
+
614
+ /* === FIX #4: STYLES CODE SOURCE PLANTUML + DIAGRAMME === */
615
+ .ontowave-plantuml-container {
616
+ margin: 20px 0;
617
+ }
618
+
619
+ .ontowave-plantuml-source {
620
+ margin-bottom: 30px;
621
+ border: 1px solid #d0d7de;
622
+ border-radius: 6px;
623
+ overflow: hidden;
624
+ }
625
+
626
+ .ontowave-plantuml-source h3 {
627
+ margin: 0;
628
+ padding: 12px 16px;
629
+ background: #f6f8fa;
630
+ border-bottom: 1px solid #d0d7de;
631
+ font-size: 16px;
632
+ font-weight: 600;
633
+ color: #24292f;
634
+ }
635
+
636
+ .ontowave-plantuml-source pre {
637
+ margin: 0;
638
+ background: #ffffff;
639
+ padding: 16px;
640
+ overflow-x: auto;
641
+ max-height: 500px;
642
+ overflow-y: auto;
643
+ }
644
+
645
+ .ontowave-plantuml-source code {
646
+ font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
647
+ font-size: 13px;
648
+ line-height: 1.6;
649
+ }
650
+
651
+ .ontowave-plantuml-render {
652
+ /* Bordure désactivée à la demande de l'utilisateur */
653
+ /* border: 1px solid #d0d7de; */
654
+ /* border-radius: 6px; */
655
+ overflow: hidden;
656
+ background: #ffffff;
657
+ }
658
+
659
+ .ontowave-plantuml-render h3 {
660
+ margin: 0;
661
+ padding: 12px 16px;
662
+ background: #f6f8fa;
663
+ border-bottom: 1px solid #d0d7de;
664
+ font-size: 16px;
665
+ font-weight: 600;
666
+ color: #24292f;
667
+ }
668
+
669
+ .ontowave-plantuml-render img {
670
+ padding: 20px;
671
+ display: block;
672
+ margin: 0 auto;
673
+ }
674
+
675
+ /* Styles pour les liens dans les SVG PlantUML */
676
+ .plantuml-diagram a.ontowave-internal-link {
677
+ transition: opacity 0.2s;
678
+ }
679
+
680
+ .plantuml-diagram a.ontowave-internal-link:hover {
681
+ opacity: 0.7;
682
+ }
683
+
684
+ .plantuml-diagram svg {
685
+ max-width: 100%;
686
+ height: auto;
687
+ }
688
+ /* === FIN FIX #4 === */
689
+
582
690
  @media (max-width: 768px) {
583
691
  .ontowave-header {
584
692
  padding: 1rem;
@@ -617,6 +725,54 @@
617
725
  this.prismLoaded = false;
618
726
  this.currentPage = null;
619
727
  this.currentLanguage = null; // Langue courante stockée
728
+
729
+ // === CACHE SVG POUR PERFORMANCE ===
730
+ this.svgCache = new Map(); // Cache: URL -> {svg: string, timestamp: number}
731
+ this.svgCacheTTL = 5 * 60 * 1000; // 5 minutes par défaut
732
+ this.svgCacheEnabled = config.svgCache !== false; // Activé par défaut
733
+ }
734
+
735
+ /**
736
+ * Récupère un SVG du cache s'il est valide
737
+ */
738
+ getCachedSVG(url) {
739
+ if (!this.svgCacheEnabled) return null;
740
+
741
+ const cached = this.svgCache.get(url);
742
+ if (!cached) return null;
743
+
744
+ // Vérifier si le cache est expiré
745
+ const now = Date.now();
746
+ if (now - cached.timestamp > this.svgCacheTTL) {
747
+ this.svgCache.delete(url);
748
+ return null;
749
+ }
750
+
751
+ console.log('✅ SVG récupéré du cache:', url);
752
+ return cached.svg;
753
+ }
754
+
755
+ /**
756
+ * Ajoute un SVG au cache
757
+ */
758
+ cacheSVG(url, svg) {
759
+ if (!this.svgCacheEnabled) return;
760
+
761
+ this.svgCache.set(url, {
762
+ svg: svg,
763
+ timestamp: Date.now()
764
+ });
765
+
766
+ console.log('💾 SVG mis en cache:', url, `(${this.svgCache.size} entrées)`);
767
+ }
768
+
769
+ /**
770
+ * Vide le cache SVG
771
+ */
772
+ clearSVGCache() {
773
+ const count = this.svgCache.size;
774
+ this.svgCache.clear();
775
+ console.log(`🗑️ Cache SVG vidé (${count} entrées supprimées)`);
620
776
  }
621
777
 
622
778
  getCurrentLanguage() {
@@ -994,6 +1150,12 @@
994
1150
  script.onload = () => {
995
1151
  console.log('🎨 Prism core loaded');
996
1152
 
1153
+ // FIX: Préparer des stubs pour éviter les erreurs de dépendances circulaires
1154
+ // Certains composants Prism essaient de lire des propriétés avant qu'elles soient définies
1155
+ if (!window.Prism.languages.javascript) {
1156
+ window.Prism.languages.javascript = { 'class-name': null };
1157
+ }
1158
+
997
1159
  // Charger les langages essentiels et attendre leur chargement
998
1160
  const essentialLanguages = ['markup', 'css', 'javascript'];
999
1161
  let loadedCount = 0;
@@ -1012,19 +1174,79 @@
1012
1174
  console.log('✅ Prism ready with essential languages');
1013
1175
  resolve();
1014
1176
 
1015
- // Charger les langages supplémentaires en arrière-plan
1016
- const additionalLanguages = ['python', 'java', 'bash', 'json', 'yaml', 'typescript'];
1017
- additionalLanguages.forEach(lang => {
1018
- const langScript = document.createElement('script');
1019
- langScript.src = `https://cdn.jsdelivr.net/npm/prismjs@1.29.0/components/prism-${lang}.min.js`;
1020
- langScript.onload = () => {
1021
- console.log(`🔤 Additional Prism language loaded: ${lang}`);
1177
+ // === FIX #4: DÉFINITION LANGAGE PLANTUML POUR PRISM ===
1178
+ // PlantUML n'a pas de plugin officiel, on crée la définition
1179
+ if (window.Prism && window.Prism.languages) {
1180
+ window.Prism.languages.plantuml = {
1181
+ 'comment': /'[^\n]*/,
1182
+ 'keyword': /@startuml|@enduml|@startmindmap|@endmindmap|@startsalt|@endsalt|@startgantt|@endgantt|participant|actor|boundary|control|entity|database|collections|queue|as|title|note|over|left|right|end|alt|else|opt|loop|par|break|critical|group|autonumber|activate|deactivate|destroy|create|hide|show|class|interface|abstract|enum|extends|implements|package|namespace|skinparam|style|sprite/,
1183
+ 'string': {
1184
+ pattern: /"(?:\\.|[^\\"\r\n])*"/,
1185
+ greedy: true
1186
+ },
1187
+ 'arrow': /(?:--|->|o-|-o|\*-|-\*|\.-|-\.)/,
1188
+ 'operator': /[:=[\](){}|]/,
1189
+ 'tag': /#[a-zA-Z0-9]+/,
1190
+ 'function': /\[\[.*?\]\]/,
1191
+ 'number': /\b\d+\b/,
1192
+ 'punctuation': /[,;]/
1022
1193
  };
1023
- langScript.onerror = () => {
1024
- console.warn(`⚠️ Failed to load Prism language: ${lang}`);
1194
+ console.log('🏭 PlantUML language definition added to Prism');
1195
+ }
1196
+ // === FIN FIX #4 ===
1197
+
1198
+ // Charger les langages supplémentaires en arrière-plan (séquentiellement pour respecter les dépendances)
1199
+ // Attendre que JavaScript soit complètement prêt avant de charger TypeScript qui l'étend
1200
+ setTimeout(() => {
1201
+ // Langages qui n'étendent PAS JavaScript (chargement sûr)
1202
+ const safeLanguages = ['python', 'java', 'bash', 'json', 'yaml', 'mermaid'];
1203
+ // TypeScript sera chargé EN DERNIER après vérification
1204
+
1205
+ let loadIndex = 0;
1206
+
1207
+ const loadNextLanguage = () => {
1208
+ if (loadIndex >= safeLanguages.length) {
1209
+ console.log('✅ All safe Prism languages loaded');
1210
+ // Maintenant charger TypeScript avec vérification
1211
+ loadTypescript();
1212
+ return;
1213
+ }
1214
+
1215
+ const lang = safeLanguages[loadIndex++];
1216
+ const langScript = document.createElement('script');
1217
+ langScript.src = `https://cdn.jsdelivr.net/npm/prismjs@1.29.0/components/prism-${lang}.min.js`;
1218
+ langScript.onload = () => {
1219
+ console.log(`🔤 Additional Prism language loaded: ${lang}`);
1220
+ // Petit délai entre chaque langage pour éviter les conflits
1221
+ setTimeout(loadNextLanguage, 10);
1222
+ };
1223
+ langScript.onerror = () => {
1224
+ console.warn(`⚠️ Failed to load Prism language: ${lang}`);
1225
+ loadNextLanguage(); // Continuer même en cas d'erreur
1226
+ };
1227
+ document.head.appendChild(langScript);
1025
1228
  };
1026
- document.head.appendChild(langScript);
1027
- });
1229
+
1230
+ const loadTypescript = () => {
1231
+ // Vérifier que JavaScript est complet avant de charger TypeScript
1232
+ if (!window.Prism.languages.javascript || !window.Prism.languages.javascript['class-name']) {
1233
+ console.warn('⚠️ JavaScript grammar incomplete, skipping TypeScript');
1234
+ return;
1235
+ }
1236
+
1237
+ const tsScript = document.createElement('script');
1238
+ tsScript.src = 'https://cdn.jsdelivr.net/npm/prismjs@1.29.0/components/prism-typescript.min.js';
1239
+ tsScript.onload = () => {
1240
+ console.log('🔤 Additional Prism language loaded: typescript');
1241
+ };
1242
+ tsScript.onerror = () => {
1243
+ console.warn('⚠️ Failed to load Prism language: typescript');
1244
+ };
1245
+ document.head.appendChild(tsScript);
1246
+ };
1247
+
1248
+ loadNextLanguage(); // Démarrer le chargement séquentiel
1249
+ }, 100); // Attendre 100ms pour que JavaScript soit stable
1028
1250
  }
1029
1251
  };
1030
1252
 
@@ -1354,6 +1576,39 @@
1354
1576
  async loadInitialPage() {
1355
1577
  const currentHash = location.hash.replace('#', '');
1356
1578
 
1579
+ // === FIX #3: DÉTECTION AUTOMATIQUE LANGUE NAVIGATEUR ===
1580
+ // Détecter la langue du navigateur si pas de hash et pas de langue explicite
1581
+ if (!currentHash && this.config.languages && this.config.languages.supported) {
1582
+ const browserLang = navigator.language.split('-')[0].toLowerCase(); // 'en-US' → 'en'
1583
+ console.log('🌍 Browser language detected:', browserLang);
1584
+
1585
+ const supportedLangs = this.config.languages.supported.split(',').map(l => l.trim().toLowerCase());
1586
+ const fallbackLang = this.config.languages.fallback || 'fr';
1587
+
1588
+ // Vérifier si la langue du navigateur est supportée et différente du fallback
1589
+ if (supportedLangs.includes(browserLang) && browserLang !== fallbackLang) {
1590
+ console.log(`🌍 Auto-redirecting to browser language: ${browserLang}`);
1591
+
1592
+ // Construire le nom de page dans la langue du navigateur
1593
+ const basePage = this.config.defaultPage.replace(/\.([a-z]{2})\.md$/, '.md').replace(/\.md$/, '');
1594
+ const langPage = `${basePage}.${browserLang}.md`;
1595
+
1596
+ // Vérifier si la page existe
1597
+ try {
1598
+ const testResponse = await fetch(this.config.baseUrl + langPage, { method: 'HEAD' });
1599
+ if (testResponse.ok) {
1600
+ console.log(`🌍 Language page found: ${langPage}`);
1601
+ location.hash = '#' + langPage;
1602
+ await this.loadPage(langPage);
1603
+ return;
1604
+ }
1605
+ } catch (e) {
1606
+ console.log(`🌍 Language page not found: ${langPage}, using fallback`);
1607
+ }
1608
+ }
1609
+ }
1610
+ // === FIN FIX #3 ===
1611
+
1357
1612
  // Mode multilingue : redirection automatique si pas de hash
1358
1613
  if (this.isMultilingualMode() && !currentHash) {
1359
1614
  const defaultSource = this.config.sources[this.config.defaultLocale];
@@ -1430,16 +1685,63 @@
1430
1685
  throw new Error(`HTTP ${response.status}: ${response.statusText}`);
1431
1686
  }
1432
1687
 
1433
- const markdown = await response.text();
1434
- console.log('✅ Content loaded:', markdown.length, 'characters');
1688
+ const content = await response.text();
1689
+ console.log('✅ Content loaded:', content.length, 'characters');
1435
1690
 
1436
- // Rendre le markdown
1437
- const html = await this.renderMarkdown(markdown);
1691
+ // === FIX #2A: SUPPORT FICHIERS .PUML (avec coloration Prism) ===
1692
+ let html;
1693
+ if (pagePath.endsWith('.puml')) {
1694
+ // Fichier PlantUML direct
1695
+ console.log('🏭 Processing .puml file');
1696
+
1697
+ // Fonction d'encodage PlantUML (réutiliser celle existante)
1698
+ function encodePlantUML(text) {
1699
+ const utf8Encoder = new TextEncoder();
1700
+ const utf8Bytes = utf8Encoder.encode(text);
1701
+ let hex = '';
1702
+ for (let i = 0; i < utf8Bytes.length; i++) {
1703
+ hex += utf8Bytes[i].toString(16).padStart(2, '0');
1704
+ }
1705
+ return 'h' + hex;
1706
+ }
1707
+
1708
+ const encodedContent = encodePlantUML(content);
1709
+ const plantUMLUrl = `${this.config.plantuml.server}/${this.config.plantuml.format}/~${encodedContent}`;
1710
+
1711
+ // Échapper le code source pour l'affichage
1712
+ const escapedContent = content.replace(/</g, '&lt;').replace(/>/g, '&gt;');
1713
+
1714
+ // === FIX #4: CODE SOURCE COLORÉ + DIAGRAMME (SVG inline) ===
1715
+ html = `
1716
+ <div class="ontowave-plantuml-container">
1717
+ <div class="ontowave-plantuml-source">
1718
+ <h3>📝 Code Source PlantUML</h3>
1719
+ <pre><code class="language-plantuml">${escapedContent}</code></pre>
1720
+ </div>
1721
+ <div class="ontowave-plantuml-render">
1722
+ <h3>🎨 Diagramme Rendu</h3>
1723
+ <div class="plantuml-diagram" data-plantuml-url="${plantUMLUrl}">⏳ Chargement diagramme PlantUML...</div>
1724
+ </div>
1725
+ </div>
1726
+ `;
1727
+ } else {
1728
+ // Fichier markdown classique
1729
+ html = await this.renderMarkdown(content);
1730
+ }
1731
+ // === FIN FIX #2A ===
1732
+
1438
1733
  contentDiv.innerHTML = html;
1734
+
1735
+ // Supprimer explicitement tous les éléments de loading restants
1736
+ const loadingElements = document.querySelectorAll('.ontowave-loading');
1737
+ loadingElements.forEach(el => el.remove());
1439
1738
 
1440
- // Traiter les diagrammes
1739
+ // Traiter les diagrammes Mermaid
1441
1740
  await this.processDiagrams(contentDiv);
1442
1741
 
1742
+ // Traiter les diagrammes PlantUML (SVG inline)
1743
+ await this.processPlantUML(contentDiv);
1744
+
1443
1745
  // Traiter la coloration syntaxique
1444
1746
  await this.processPrism(contentDiv);
1445
1747
 
@@ -1475,6 +1777,53 @@
1475
1777
  // Rendu markdown corrigé avec support complet
1476
1778
  let html = markdown;
1477
1779
 
1780
+ // === FIX #1: SUPPORT TABLEAUX MARKDOWN ===
1781
+ // Traiter les tableaux AVANT les blocs de code
1782
+ html = html.replace(/\n(\|[^\n]+\|\n)+/gm, (match) => {
1783
+ const lines = match.trim().split('\n');
1784
+ if (lines.length < 2) return match;
1785
+
1786
+ // Ligne 1 = headers, Ligne 2 = alignements, Reste = données
1787
+ const headers = lines[0].split('|').map(h => h.trim()).filter(h => h);
1788
+ const alignments = lines[1].split('|').map(a => a.trim()).filter(a => a);
1789
+ const rows = lines.slice(2).map(line =>
1790
+ line.split('|').map(cell => cell.trim()).filter(cell => cell !== '')
1791
+ );
1792
+
1793
+ // Déterminer alignements: :--- = left, :---: = center, ---: = right
1794
+ const aligns = alignments.map(a => {
1795
+ if (a.startsWith(':') && a.endsWith(':')) return 'center';
1796
+ if (a.endsWith(':')) return 'right';
1797
+ return 'left';
1798
+ });
1799
+
1800
+ // Générer HTML table
1801
+ let table = '<table class="ontowave-table">';
1802
+
1803
+ // Headers
1804
+ table += '<thead><tr>';
1805
+ headers.forEach((header, i) => {
1806
+ const align = aligns[i] || 'left';
1807
+ table += `<th style="text-align: ${align}">${header}</th>`;
1808
+ });
1809
+ table += '</tr></thead>';
1810
+
1811
+ // Body
1812
+ table += '<tbody>';
1813
+ rows.forEach(row => {
1814
+ table += '<tr>';
1815
+ row.forEach((cell, i) => {
1816
+ const align = aligns[i] || 'left';
1817
+ table += `<td style="text-align: ${align}">${cell}</td>`;
1818
+ });
1819
+ table += '</tr>';
1820
+ });
1821
+ table += '</tbody></table>';
1822
+
1823
+ return '\n' + table + '\n';
1824
+ });
1825
+ // === FIN FIX #1 ===
1826
+
1478
1827
  // Traiter les blocs de code AVANT les autres transformations
1479
1828
  const codeBlocks = [];
1480
1829
  html = html.replace(/```(\w+)([\s\S]*?)```/g, (match, language, content) => {
@@ -1483,32 +1832,27 @@
1483
1832
 
1484
1833
  if (language === 'mermaid') {
1485
1834
  const id = 'mermaid-' + Math.random().toString(36).substr(2, 9);
1486
- codeBlocks.push(`<div class="ontowave-mermaid">
1487
- <div style="margin-bottom: 8px; font-weight: bold; color: #586069;">🧜‍♀️ Diagramme Mermaid</div>
1488
- <div class="mermaid" id="${id}">${trimmedContent}</div>
1489
- </div>`);
1835
+ codeBlocks.push(`<div class="mermaid" id="${id}">${trimmedContent}</div>`);
1490
1836
  } else if (language === 'plantuml') {
1491
1837
  const id = 'plantuml-' + Math.random().toString(36).substr(2, 9);
1492
1838
 
1839
+ // === NOUVEAU: SVG INLINE DIRECT (comme Mermaid) ===
1493
1840
  // Fonction d'encodage PlantUML avec support UTF-8
1494
1841
  function encodePlantUML(text) {
1495
- // Encoder le texte en UTF-8 puis en hexadécimal
1496
1842
  const utf8Encoder = new TextEncoder();
1497
1843
  const utf8Bytes = utf8Encoder.encode(text);
1498
1844
  let hex = '';
1499
1845
  for (let i = 0; i < utf8Bytes.length; i++) {
1500
1846
  hex += utf8Bytes[i].toString(16).padStart(2, '0');
1501
1847
  }
1502
- return 'h' + hex; // Le préfixe ~h sera ajouté dans l'URL
1848
+ return 'h' + hex;
1503
1849
  }
1504
1850
 
1505
1851
  const encodedContent = encodePlantUML(trimmedContent);
1506
1852
  const plantUMLUrl = `${this.config.plantuml.server}/${this.config.plantuml.format}/~${encodedContent}`;
1507
- codeBlocks.push(`<div class="ontowave-plantuml" id="${id}">
1508
- <div style="margin-bottom: 8px; font-weight: bold; color: #586069;">🏭 Diagramme PlantUML</div>
1509
- <img src="${plantUMLUrl}" alt="Diagramme PlantUML" style="max-width: 100%; height: auto;"
1510
- onerror="this.parentElement.innerHTML='<div style=\\'color: #d73a49; padding: 20px;\\'>❌ Erreur de rendu PlantUML</div>'" />
1511
- </div>`);
1853
+
1854
+ // Placeholder pour le SVG qui sera chargé de manière asynchrone
1855
+ codeBlocks.push(`<div class="plantuml-diagram" id="${id}" data-plantuml-url="${plantUMLUrl}">⏳ Chargement diagramme PlantUML...</div>`);
1512
1856
  } else {
1513
1857
  const codeClass = this.prismLoaded ? `language-${language}` : '';
1514
1858
  console.log(`📝 Processing code block: language="${language}", prismLoaded=${this.prismLoaded}, class="${codeClass}"`);
@@ -1835,6 +2179,101 @@ td:empty::before {
1835
2179
  }
1836
2180
  }
1837
2181
 
2182
+ // === NOUVEAU: TRAITEMENT SVG PLANTUML INLINE ===
2183
+ async processPlantUML(container) {
2184
+ const plantUMLElements = container.querySelectorAll('.plantuml-diagram[data-plantuml-url]');
2185
+ if (plantUMLElements.length === 0) return;
2186
+
2187
+ console.log('🌱 Processing', plantUMLElements.length, 'PlantUML diagrams');
2188
+
2189
+ // Traiter tous les diagrammes en parallèle pour la performance
2190
+ const promises = Array.from(plantUMLElements).map(async (element) => {
2191
+ const plantUMLUrl = element.getAttribute('data-plantuml-url');
2192
+
2193
+ try {
2194
+ let svgText;
2195
+
2196
+ // === CACHE SVG ===
2197
+ const cachedSVG = this.getCachedSVG(plantUMLUrl);
2198
+ if (cachedSVG) {
2199
+ svgText = cachedSVG;
2200
+ } else {
2201
+ // Fetch le SVG depuis le serveur PlantUML
2202
+ const response = await fetch(plantUMLUrl);
2203
+ if (!response.ok) {
2204
+ throw new Error(`HTTP ${response.status}: ${response.statusText}`);
2205
+ }
2206
+
2207
+ svgText = await response.text();
2208
+
2209
+ // Mettre en cache
2210
+ this.cacheSVG(plantUMLUrl, svgText);
2211
+ }
2212
+
2213
+ // Parser le SVG
2214
+ const temp = document.createElement('div');
2215
+ temp.innerHTML = svgText;
2216
+ const svg = temp.querySelector('svg');
2217
+
2218
+ if (!svg) {
2219
+ throw new Error('No SVG found in response');
2220
+ }
2221
+
2222
+ // Appliquer les styles au SVG
2223
+ svg.style.maxWidth = '100%';
2224
+ svg.style.height = 'auto';
2225
+ svg.style.display = 'block';
2226
+ svg.style.margin = '0 auto';
2227
+
2228
+ // === GESTION DES LIENS CLIQUABLES ===
2229
+ const links = svg.querySelectorAll('a[href]');
2230
+ console.log(`🔗 Found ${links.length} links in PlantUML diagram`);
2231
+
2232
+ links.forEach(link => {
2233
+ const href = link.getAttribute('href');
2234
+
2235
+ // Si c'est un lien interne (.md, .html, .puml), utiliser le router OntoWave
2236
+ if (href && (href.endsWith('.md') || href.endsWith('.html') || href.endsWith('.puml'))) {
2237
+ link.addEventListener('click', (e) => {
2238
+ e.preventDefault();
2239
+ e.stopPropagation();
2240
+ console.log(`🔗 Navigating to: ${href}`);
2241
+ this.loadPage(href);
2242
+ });
2243
+
2244
+ // Style hover pour indiquer que c'est cliquable
2245
+ link.style.cursor = 'pointer';
2246
+ link.setAttribute('class', (link.getAttribute('class') || '') + ' ontowave-internal-link');
2247
+ }
2248
+ });
2249
+
2250
+ // Remplacer le placeholder par le SVG
2251
+ element.innerHTML = '';
2252
+ element.appendChild(svg);
2253
+
2254
+ console.log('✅ PlantUML diagram rendered with', links.length, 'clickable links');
2255
+
2256
+ } catch (error) {
2257
+ console.error('❌ Failed to load PlantUML diagram:', error);
2258
+ element.innerHTML = `
2259
+ <div style="color: #d73a49; padding: 20px; background: #fff5f5; border: 1px solid #feb2b2; border-radius: 6px;">
2260
+ <strong>❌ Erreur de rendu PlantUML</strong>
2261
+ <p style="margin: 5px 0; font-size: 14px;">${error.message}</p>
2262
+ <details style="margin-top: 10px;">
2263
+ <summary style="cursor: pointer; color: #0366d6;">Détails techniques</summary>
2264
+ <pre style="background: #f6f8fa; padding: 10px; margin-top: 5px; border-radius: 4px; overflow-x: auto; font-size: 12px;">URL: ${plantUMLUrl}</pre>
2265
+ </details>
2266
+ </div>
2267
+ `;
2268
+ }
2269
+ });
2270
+
2271
+ // Attendre que tous les diagrammes soient traités
2272
+ await Promise.all(promises);
2273
+ console.log('✅ All PlantUML diagrams processed');
2274
+ }
2275
+ // === FIN TRAITEMENT PLANTUML ===
2276
+
1838
2277
  async processPrism(container) {
1839
2278
  console.log('🔍 processPrism called - prismLoaded:', this.prismLoaded, 'window.Prism:', !!window.Prism);
1840
2279
 
@@ -1843,6 +2282,23 @@ td:empty::before {
1843
2282
  return;
1844
2283
  }
1845
2284
 
2285
+ // Attendre que JavaScript soit chargé (langage essentiel)
2286
+ if (!window.Prism.languages || !window.Prism.languages.javascript) {
2287
+ console.log('⏳ JavaScript not loaded yet, waiting...');
2288
+ // Attendre maximum 2 secondes
2289
+ for (let i = 0; i < 20; i++) {
2290
+ await new Promise(resolve => setTimeout(resolve, 100));
2291
+ if (window.Prism.languages && window.Prism.languages.javascript) {
2292
+ console.log('✅ JavaScript language now available');
2293
+ break;
2294
+ }
2295
+ }
2296
+
2297
+ if (!window.Prism.languages || !window.Prism.languages.javascript) {
2298
+ console.warn('⚠️ JavaScript language still not available after waiting');
2299
+ }
2300
+ }
2301
+
1846
2302
  try {
1847
2303
  // Vérifier les langages disponibles
1848
2304
  console.log('🔤 Available Prism languages:', window.Prism.languages ? Object.keys(window.Prism.languages) : 'none');
@@ -1916,6 +2372,11 @@ td:empty::before {
1916
2372
  }
1917
2373
  }
1918
2374
 
2375
+ // === ANCIENNE FONCTION SUPPRIMÉE ===
2376
+ // attachPlantUMLLinks() n'est plus nécessaire car on insère directement le SVG inline
2377
+ // Les liens sont attachés dans processPlantUML()
2378
+ // === FIN SUPPRESSION ===
2379
+
1919
2380
  showConfigurationInterface() {
1920
2381
  const contentDiv = document.getElementById('ontowave-content');
1921
2382
  if (!contentDiv) return;
@@ -1,4 +1,4 @@
1
- (d=>{let o={fr:{menuHome:"Accueil",menuGallery:"Galerie",menuConfiguration:"Configuration",configTitle:"OntoWave - Configuration Complète",configGeneral:"Général",configSiteTitle:"Titre du site :",configDefaultPage:"Page par défaut :",configBaseUrl:"URL de base :",configLanguages:"Langues et Localisation",configSupportedLanguages:"Langues supportées (séparées par des virgules) :",configFallbackLanguage:"Langue de fallback :",configNavigation:"Navigation et Interface",configShowGallery:"Afficher la galerie d'exemples",configHomeButton:"Bouton Accueil",configBreadcrumb:"Fil d'Ariane (breadcrumb)",configToc:"Table des matières",configMermaid:"Diagrammes Mermaid",configMermaidTheme:"Thème Mermaid :",configMermaidAuto:"Démarrage automatique",configMermaidMaxWidth:"Utiliser la largeur maximale",configPlantuml:"Diagrammes PlantUML",configPlantumlServer:"Serveur PlantUML :",configPlantumlFormat:"Format de sortie :",configPrism:"Coloration Syntaxique (Prism.js)",configPrismTheme:"Thème Prism :",configPrismAutoload:"Chargement automatique",configUI:"Interface Utilisateur",configUITheme:"Thème de l'interface :",configUIResponsive:"Design responsive",configUIAnimations:"Animations et transitions",configApply:"Appliquer Configuration",configDownloadHTML:"Télécharger HTML",configDownloadJS:"Télécharger ontowave.min.js",configReset:"Réinitialiser",configLanguageNote:"Laissez vide pour un site monolingue"},en:{menuHome:"Home",menuGallery:"Gallery",menuConfiguration:"Configuration",configTitle:"OntoWave - Complete Configuration",configGeneral:"General",configSiteTitle:"Site title:",configDefaultPage:"Default page:",configBaseUrl:"Base URL:",configLanguages:"Languages and Localization",configSupportedLanguages:"Supported languages (comma separated):",configFallbackLanguage:"Fallback language:",configNavigation:"Navigation and Interface",configShowGallery:"Show examples gallery",configHomeButton:"Home button",configBreadcrumb:"Breadcrumb navigation",configToc:"Table of contents",configMermaid:"Mermaid Diagrams",configMermaidTheme:"Mermaid theme:",configMermaidAuto:"Auto start",configMermaidMaxWidth:"Use maximum width",configPlantuml:"PlantUML Diagrams",configPlantumlServer:"PlantUML server:",configPlantumlFormat:"Output format:",configPrism:"Syntax Highlighting (Prism.js)",configPrismTheme:"Prism theme:",configPrismAutoload:"Auto loading",configUI:"User Interface",configUITheme:"Interface theme:",configUIResponsive:"Responsive design",configUIAnimations:"Animations and transitions",configApply:"Apply Configuration",configDownloadHTML:"Download HTML",configDownloadJS:"Download ontowave.min.js",configReset:"Reset",configLanguageNote:"Leave empty for monolingual site"}},t={title:"OntoWave Documentation",baseUrl:"/",defaultPage:"index.md",containerId:"ontowave-container",locales:["fr","en"],fallbackLocale:"en",showGallery:!1,mermaid:{theme:"default",startOnLoad:!0,flowchart:{useMaxWidth:!0},sequence:{useMaxWidth:!0},gantt:{useMaxWidth:!0},journey:{useMaxWidth:!0}},plantuml:{server:"https://www.plantuml.com/plantuml",format:"svg"},prism:{theme:"default",autoload:!0},navigation:{showHome:!0,showBreadcrumb:!0,showToc:!0},ui:{theme:"default",responsive:!0,animations:!0,languageButtons:"menu"}};class n{constructor(e={}){this.config={...t,...e},e.i18n&&(e.i18n.supported&&(this.config.locales=e.i18n.supported),e.i18n.default)&&(this.config.fallbackLocale=e.i18n.default),this.container=null,this.mermaidLoaded=!1,this.prismLoaded=!1,this.currentPage=null,this.currentLanguage=null}getCurrentLanguage(){if(this.currentLanguage)return this.currentLanguage;var e=document.getElementById("lang-fr"),t=document.getElementById("lang-en");if(e&&t){if(e.classList.contains("visible")||!e.classList.contains("hidden")&&"none"!==e.style.display)return"fr";if(t.classList.contains("visible")||!t.classList.contains("hidden")&&"none"!==t.style.display)return"en"}e=document.getElementById("btn-fr"),t=document.getElementById("btn-en");if(e&&t){if(e.classList.contains("active"))return"fr";if(t.classList.contains("active"))return"en"}return this.resolveLocale()||"en"}t(e,t=null){t=t||this.getCurrentLanguage();return(o[t]||o.en)[e]||e}updateInterfaceTexts(e=null){let t=e||this.getCurrentLanguage();console.log("🌐 Interface texts updating for language:",t);e=document.querySelector('.ontowave-menu-option[onclick*="goHome"]'),e&&(e.innerHTML="🏠 "+this.t("menuHome",t)),e=document.querySelector('.ontowave-menu-option[onclick*="gallery.html"]'),e&&(e.innerHTML="🎨 "+this.t("menuGallery",t)),e=document.querySelector('.ontowave-menu-option[onclick*="toggleConfigurationPanel"]'),e&&(e.innerHTML="⚙️ "+this.t("menuConfiguration",t)),e=document.getElementById("ontowave-config-panel");if(e){let n=document.getElementById("config-title-full")?.value||this.config.title,i=document.getElementById("config-defaultPage-full")?.value||this.config.defaultPage,a=document.getElementById("config-baseUrl-full")?.value||this.config.baseUrl;e.remove();e=document.querySelector('.ontowave-menu-option[onclick*="toggleConfigurationPanel"]');e&&e.classList.remove("selected"),setTimeout(()=>{this.toggleConfigurationPanel(null,t),setTimeout(()=>{var e=document.getElementById("config-title-full"),t=document.getElementById("config-defaultPage-full"),o=document.getElementById("config-baseUrl-full");e&&(e.value=n),t&&(t.value=i),o&&(o.value=a)},100)},50)}console.log("🌐 Interface texts updated for language:",t)}switchLanguage(e){this.currentLanguage=e,this.updateLanguageButtonsState(e),this.updateInterfaceTexts(e);e=(this.config.sources||{})[e]||this.config.defaultPage;e&&this.loadPage(e)}updateLanguageButtonsState(e=null){let t=e||this.getCurrentLanguage();document.querySelectorAll(".ontowave-lang-btn").forEach(e=>{e.classList.remove("active"),e.textContent.includes(t.toUpperCase())&&e.classList.add("active")}),document.querySelectorAll(".ontowave-fixed-lang-btn").forEach(e=>{e.classList.remove("active"),e.textContent.includes(t.toUpperCase())&&e.classList.add("active")}),console.log("🌐 État des boutons de langue mis à jour pour:",t)}goHome(){var e=this.getCurrentLanguage(),e=(this.config.sources||{})[e]||this.config.defaultPage;this.loadPage(e)}getBrowserLocales(){var e=[];return navigator.languages&&e.push(...navigator.languages),navigator.language&&e.push(navigator.language),navigator.userLanguage&&e.push(navigator.userLanguage),[...new Set(e)]}resolveLocale(){var e=this.getBrowserLocales(),o=this.config.locales||[],t=this.config.defaultLocale||this.config.fallbackLocale;if(console.log("🌐 Browser locales:",e),console.log("🌐 Supported locales:",o),console.log("🌐 Default locale:",t),0===o.length)return null;var n,i,a,l=d.location.hash||d.location.pathname;console.log("🔍 Current URL:",l);for(n of o)if(new RegExp(`\\.${n}\\.(md|html)`).test(l))return console.log("🎯 Page language detected from URL:",n,"in",l),n;for(i of e)if(o.includes(i))return console.log("🎯 Exact browser match found:",i),i;for(a of e){var r;a.split("-")[0];for(r of e){let t=r.split("-")[0];var s=o.find(e=>e.startsWith(t));if(s)return console.log("🎯 Prefix match found:",r,"->",s),s}if(t&&o.includes(t))return console.log("🎯 Using configured default locale:",t),t}var c=o[0];return console.log("🎯 Using fallback locale:",c),c}isMultilingualMode(){return this.config.locales&&0<this.config.locales.length&&this.config.sources}generatePageCandidates(e){var t,o=this.resolveLocale(),n=[];return o?(t=e.replace(/\.md$/,""),n.push(t+`.${o}.md`),o.includes("-")&&(o=o.split("-")[0],n.push(t+`.${o}.md`)),n.push(e),console.log("📄 Page candidates for",e,":",n)):n.push(e),n}async init(){try{await this.loadConfigFromScript(),this.injectStyles(),await this.loadMermaid(),await this.loadPrism(),this.createInterface(),this.currentLanguage=this.resolveLocale(),this.initializeNavigation(),this.updateLanguageButtonsState(),await this.loadInitialPage(),console.log("✅ OntoWave successfully initialized")}catch(e){console.error("❌ OntoWave initialization failed:",e),this.showError("Erreur d'initialisation OntoWave: "+e.message)}}async loadConfigFromScript(){if(d.ontoWaveConfig)this.config={...this.config,...d.ontoWaveConfig},console.log("📄 Configuration loaded from window.ontoWaveConfig"),console.log("📄 Final config:",this.config);else{var e=document.getElementById("ontowave-config");if(e&&"application/json"===e.type)try{var t=JSON.parse(e.textContent);this.config={...this.config,...t},console.log("📄 Configuration loaded from script tag"),console.log("📄 Final config:",this.config)}catch(e){console.warn("⚠️ Invalid JSON in ontowave-config script tag:",e)}}}injectStyles(){var e=document.createElement("style");e.textContent=`
1
+ (d=>{let o={fr:{menuHome:"Accueil",menuGallery:"Galerie",menuConfiguration:"Configuration",configTitle:"OntoWave - Configuration Complète",configGeneral:"Général",configSiteTitle:"Titre du site :",configDefaultPage:"Page par défaut :",configBaseUrl:"URL de base :",configLanguages:"Langues et Localisation",configSupportedLanguages:"Langues supportées (séparées par des virgules) :",configFallbackLanguage:"Langue de fallback :",configNavigation:"Navigation et Interface",configShowGallery:"Afficher la galerie d'exemples",configHomeButton:"Bouton Accueil",configBreadcrumb:"Fil d'Ariane (breadcrumb)",configToc:"Table des matières",configMermaid:"Diagrammes Mermaid",configMermaidTheme:"Thème Mermaid :",configMermaidAuto:"Démarrage automatique",configMermaidMaxWidth:"Utiliser la largeur maximale",configPlantuml:"Diagrammes PlantUML",configPlantumlServer:"Serveur PlantUML :",configPlantumlFormat:"Format de sortie :",configPrism:"Coloration Syntaxique (Prism.js)",configPrismTheme:"Thème Prism :",configPrismAutoload:"Chargement automatique",configUI:"Interface Utilisateur",configUITheme:"Thème de l'interface :",configUIResponsive:"Design responsive",configUIAnimations:"Animations et transitions",configApply:"Appliquer Configuration",configDownloadHTML:"Télécharger HTML",configDownloadJS:"Télécharger ontowave.min.js",configReset:"Réinitialiser",configLanguageNote:"Laissez vide pour un site monolingue"},en:{menuHome:"Home",menuGallery:"Gallery",menuConfiguration:"Configuration",configTitle:"OntoWave - Complete Configuration",configGeneral:"General",configSiteTitle:"Site title:",configDefaultPage:"Default page:",configBaseUrl:"Base URL:",configLanguages:"Languages and Localization",configSupportedLanguages:"Supported languages (comma separated):",configFallbackLanguage:"Fallback language:",configNavigation:"Navigation and Interface",configShowGallery:"Show examples gallery",configHomeButton:"Home button",configBreadcrumb:"Breadcrumb navigation",configToc:"Table of contents",configMermaid:"Mermaid Diagrams",configMermaidTheme:"Mermaid theme:",configMermaidAuto:"Auto start",configMermaidMaxWidth:"Use maximum width",configPlantuml:"PlantUML Diagrams",configPlantumlServer:"PlantUML server:",configPlantumlFormat:"Output format:",configPrism:"Syntax Highlighting (Prism.js)",configPrismTheme:"Prism theme:",configPrismAutoload:"Auto loading",configUI:"User Interface",configUITheme:"Interface theme:",configUIResponsive:"Responsive design",configUIAnimations:"Animations and transitions",configApply:"Apply Configuration",configDownloadHTML:"Download HTML",configDownloadJS:"Download ontowave.min.js",configReset:"Reset",configLanguageNote:"Leave empty for monolingual site"}},t={title:"OntoWave Documentation",baseUrl:"/",defaultPage:"index.md",containerId:"ontowave-container",locales:["fr","en"],fallbackLocale:"en",showGallery:!1,mermaid:{theme:"default",startOnLoad:!0,flowchart:{useMaxWidth:!0},sequence:{useMaxWidth:!0},gantt:{useMaxWidth:!0},journey:{useMaxWidth:!0}},plantuml:{server:"https://www.plantuml.com/plantuml",format:"svg"},prism:{theme:"default",autoload:!0},navigation:{showHome:!0,showBreadcrumb:!0,showToc:!0},ui:{theme:"default",responsive:!0,animations:!0,languageButtons:"menu"}};class n{constructor(e={}){this.config={...t,...e},e.i18n&&(e.i18n.supported&&(this.config.locales=e.i18n.supported),e.i18n.default)&&(this.config.fallbackLocale=e.i18n.default),this.container=null,this.mermaidLoaded=!1,this.prismLoaded=!1,this.currentPage=null,this.currentLanguage=null,this.svgCache=new Map,this.svgCacheTTL=3e5,this.svgCacheEnabled=!1!==e.svgCache}getCachedSVG(e){var t;return this.svgCacheEnabled&&(t=this.svgCache.get(e))?Date.now()-t.timestamp>this.svgCacheTTL?(this.svgCache.delete(e),null):(console.log("✅ SVG récupéré du cache:",e),t.svg):null}cacheSVG(e,t){this.svgCacheEnabled&&(this.svgCache.set(e,{svg:t,timestamp:Date.now()}),console.log("💾 SVG mis en cache:",e,`(${this.svgCache.size} entrées)`))}clearSVGCache(){var e=this.svgCache.size;this.svgCache.clear(),console.log(`🗑️ Cache SVG vidé (${e} entrées supprimées)`)}getCurrentLanguage(){if(this.currentLanguage)return this.currentLanguage;var e=document.getElementById("lang-fr"),t=document.getElementById("lang-en");if(e&&t){if(e.classList.contains("visible")||!e.classList.contains("hidden")&&"none"!==e.style.display)return"fr";if(t.classList.contains("visible")||!t.classList.contains("hidden")&&"none"!==t.style.display)return"en"}e=document.getElementById("btn-fr"),t=document.getElementById("btn-en");if(e&&t){if(e.classList.contains("active"))return"fr";if(t.classList.contains("active"))return"en"}return this.resolveLocale()||"en"}t(e,t=null){t=t||this.getCurrentLanguage();return(o[t]||o.en)[e]||e}updateInterfaceTexts(e=null){let t=e||this.getCurrentLanguage();console.log("🌐 Interface texts updating for language:",t);e=document.querySelector('.ontowave-menu-option[onclick*="goHome"]'),e&&(e.innerHTML="🏠 "+this.t("menuHome",t)),e=document.querySelector('.ontowave-menu-option[onclick*="gallery.html"]'),e&&(e.innerHTML="🎨 "+this.t("menuGallery",t)),e=document.querySelector('.ontowave-menu-option[onclick*="toggleConfigurationPanel"]'),e&&(e.innerHTML="⚙️ "+this.t("menuConfiguration",t)),e=document.getElementById("ontowave-config-panel");if(e){let n=document.getElementById("config-title-full")?.value||this.config.title,a=document.getElementById("config-defaultPage-full")?.value||this.config.defaultPage,i=document.getElementById("config-baseUrl-full")?.value||this.config.baseUrl;e.remove();e=document.querySelector('.ontowave-menu-option[onclick*="toggleConfigurationPanel"]');e&&e.classList.remove("selected"),setTimeout(()=>{this.toggleConfigurationPanel(null,t),setTimeout(()=>{var e=document.getElementById("config-title-full"),t=document.getElementById("config-defaultPage-full"),o=document.getElementById("config-baseUrl-full");e&&(e.value=n),t&&(t.value=a),o&&(o.value=i)},100)},50)}console.log("🌐 Interface texts updated for language:",t)}switchLanguage(e){this.currentLanguage=e,this.updateLanguageButtonsState(e),this.updateInterfaceTexts(e);e=(this.config.sources||{})[e]||this.config.defaultPage;e&&this.loadPage(e)}updateLanguageButtonsState(e=null){let t=e||this.getCurrentLanguage();document.querySelectorAll(".ontowave-lang-btn").forEach(e=>{e.classList.remove("active"),e.textContent.includes(t.toUpperCase())&&e.classList.add("active")}),document.querySelectorAll(".ontowave-fixed-lang-btn").forEach(e=>{e.classList.remove("active"),e.textContent.includes(t.toUpperCase())&&e.classList.add("active")}),console.log("🌐 État des boutons de langue mis à jour pour:",t)}goHome(){var e=this.getCurrentLanguage(),e=(this.config.sources||{})[e]||this.config.defaultPage;this.loadPage(e)}getBrowserLocales(){var e=[];return navigator.languages&&e.push(...navigator.languages),navigator.language&&e.push(navigator.language),navigator.userLanguage&&e.push(navigator.userLanguage),[...new Set(e)]}resolveLocale(){var e=this.getBrowserLocales(),o=this.config.locales||[],t=this.config.defaultLocale||this.config.fallbackLocale;if(console.log("🌐 Browser locales:",e),console.log("🌐 Supported locales:",o),console.log("🌐 Default locale:",t),0===o.length)return null;var n,a,i,l=d.location.hash||d.location.pathname;console.log("🔍 Current URL:",l);for(n of o)if(new RegExp(`\\.${n}\\.(md|html)`).test(l))return console.log("🎯 Page language detected from URL:",n,"in",l),n;for(a of e)if(o.includes(a))return console.log("🎯 Exact browser match found:",a),a;for(i of e){var r;i.split("-")[0];for(r of e){let t=r.split("-")[0];var s=o.find(e=>e.startsWith(t));if(s)return console.log("🎯 Prefix match found:",r,"->",s),s}if(t&&o.includes(t))return console.log("🎯 Using configured default locale:",t),t}var c=o[0];return console.log("🎯 Using fallback locale:",c),c}isMultilingualMode(){return this.config.locales&&0<this.config.locales.length&&this.config.sources}generatePageCandidates(e){var t,o=this.resolveLocale(),n=[];return o?(t=e.replace(/\.md$/,""),n.push(t+`.${o}.md`),o.includes("-")&&(o=o.split("-")[0],n.push(t+`.${o}.md`)),n.push(e),console.log("📄 Page candidates for",e,":",n)):n.push(e),n}async init(){try{await this.loadConfigFromScript(),this.injectStyles(),await this.loadMermaid(),await this.loadPrism(),this.createInterface(),this.currentLanguage=this.resolveLocale(),this.initializeNavigation(),this.updateLanguageButtonsState(),await this.loadInitialPage(),console.log("✅ OntoWave successfully initialized")}catch(e){console.error("❌ OntoWave initialization failed:",e),this.showError("Erreur d'initialisation OntoWave: "+e.message)}}async loadConfigFromScript(){if(d.ontoWaveConfig)this.config={...this.config,...d.ontoWaveConfig},console.log("📄 Configuration loaded from window.ontoWaveConfig"),console.log("📄 Final config:",this.config);else{var e=document.getElementById("ontowave-config");if(e&&"application/json"===e.type)try{var t=JSON.parse(e.textContent);this.config={...this.config,...t},console.log("📄 Configuration loaded from script tag"),console.log("📄 Final config:",this.config)}catch(e){console.warn("⚠️ Invalid JSON in ontowave-config script tag:",e)}}}injectStyles(){var e=document.createElement("style");e.textContent=`
2
2
  .ontowave-container {
3
3
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
4
4
  line-height: 1.6;
@@ -452,6 +452,114 @@
452
452
  color: #155724;
453
453
  }
454
454
 
455
+ /* === FIX #1: STYLES TABLEAUX === */
456
+ .ontowave-table {
457
+ width: 100%;
458
+ border-collapse: collapse;
459
+ margin: 16px 0;
460
+ font-size: 14px;
461
+ box-shadow: 0 1px 3px rgba(0,0,0,0.1);
462
+ }
463
+
464
+ .ontowave-table th {
465
+ background: #f6f8fa;
466
+ padding: 12px 16px;
467
+ font-weight: 600;
468
+ border: 1px solid #d0d7de;
469
+ color: #24292f;
470
+ }
471
+
472
+ .ontowave-table td {
473
+ padding: 12px 16px;
474
+ border: 1px solid #d0d7de;
475
+ color: #24292f;
476
+ }
477
+
478
+ .ontowave-table tbody tr:nth-child(even) {
479
+ background: #f6f8fa;
480
+ }
481
+
482
+ .ontowave-table tbody tr:hover {
483
+ background: #eaeef2;
484
+ }
485
+ /* === FIN FIX #1 === */
486
+
487
+ /* === FIX #4: STYLES CODE SOURCE PLANTUML + DIAGRAMME === */
488
+ .ontowave-plantuml-container {
489
+ margin: 20px 0;
490
+ }
491
+
492
+ .ontowave-plantuml-source {
493
+ margin-bottom: 30px;
494
+ border: 1px solid #d0d7de;
495
+ border-radius: 6px;
496
+ overflow: hidden;
497
+ }
498
+
499
+ .ontowave-plantuml-source h3 {
500
+ margin: 0;
501
+ padding: 12px 16px;
502
+ background: #f6f8fa;
503
+ border-bottom: 1px solid #d0d7de;
504
+ font-size: 16px;
505
+ font-weight: 600;
506
+ color: #24292f;
507
+ }
508
+
509
+ .ontowave-plantuml-source pre {
510
+ margin: 0;
511
+ background: #ffffff;
512
+ padding: 16px;
513
+ overflow-x: auto;
514
+ max-height: 500px;
515
+ overflow-y: auto;
516
+ }
517
+
518
+ .ontowave-plantuml-source code {
519
+ font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
520
+ font-size: 13px;
521
+ line-height: 1.6;
522
+ }
523
+
524
+ .ontowave-plantuml-render {
525
+ /* Bordure désactivée à la demande de l'utilisateur */
526
+ /* border: 1px solid #d0d7de; */
527
+ /* border-radius: 6px; */
528
+ overflow: hidden;
529
+ background: #ffffff;
530
+ }
531
+
532
+ .ontowave-plantuml-render h3 {
533
+ margin: 0;
534
+ padding: 12px 16px;
535
+ background: #f6f8fa;
536
+ border-bottom: 1px solid #d0d7de;
537
+ font-size: 16px;
538
+ font-weight: 600;
539
+ color: #24292f;
540
+ }
541
+
542
+ .ontowave-plantuml-render img {
543
+ padding: 20px;
544
+ display: block;
545
+ margin: 0 auto;
546
+ }
547
+
548
+ /* Styles pour les liens dans les SVG PlantUML */
549
+ .plantuml-diagram a.ontowave-internal-link {
550
+ transition: opacity 0.2s;
551
+ }
552
+
553
+ .plantuml-diagram a.ontowave-internal-link:hover {
554
+ opacity: 0.7;
555
+ }
556
+
557
+ .plantuml-diagram svg {
558
+ max-width: 100%;
559
+ height: auto;
560
+ }
561
+ /* === FIN FIX #4 === */
562
+
455
563
  @media (max-width: 768px) {
456
564
  .ontowave-header {
457
565
  padding: 1rem;
@@ -469,7 +577,7 @@
469
577
  padding: 1rem;
470
578
  }
471
579
  }
472
- `,document.head.appendChild(e)}async loadMermaid(){return new Promise(e=>{var t;d.mermaid?(this.mermaidLoaded=!0,this.initializeMermaid(),e()):((t=document.createElement("script")).src="https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.min.js",t.onload=()=>{this.mermaidLoaded=!0,this.initializeMermaid(),e()},t.onerror=()=>{console.warn("⚠️ Failed to load Mermaid library"),e()},document.head.appendChild(t))})}initializeMermaid(){d.mermaid&&(d.mermaid.initialize(this.config.mermaid),console.log("🎨 Mermaid initialized"))}async loadPrism(){return new Promise(n=>{if(d.Prism)return this.prismLoaded=!0,console.log("🎨 Prism already loaded"),n();var e=document.createElement("link"),e=(e.rel="stylesheet",e.href="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/themes/prism.min.css",document.head.appendChild(e),document.createElement("script"));e.src="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/components/prism-core.min.js",e.onload=()=>{console.log("🎨 Prism core loaded");let e=["markup","css","javascript"],t=0,o=()=>{t++,console.log(`🔤 Essential language loaded: ${t}/`+e.length),t>=e.length&&(d.Prism.languages.markup&&(d.Prism.languages.html=d.Prism.languages.markup,console.log("🔤 HTML alias created from markup")),this.prismLoaded=!0,console.log("✅ Prism ready with essential languages"),n(),["python","java","bash","json","yaml","typescript"].forEach(e=>{var t=document.createElement("script");t.src=`https://cdn.jsdelivr.net/npm/prismjs@1.29.0/components/prism-${e}.min.js`,t.onload=()=>{console.log("🔤 Additional Prism language loaded: "+e)},t.onerror=()=>{console.warn("⚠️ Failed to load Prism language: "+e)},document.head.appendChild(t)}))};e.forEach(e=>{var t=document.createElement("script");t.src=`https://cdn.jsdelivr.net/npm/prismjs@1.29.0/components/prism-${e}.min.js`,t.onload=o,t.onerror=()=>{console.warn("⚠️ Failed to load essential Prism language: "+e),o()},document.head.appendChild(t)})},e.onerror=()=>{console.warn("⚠️ Failed to load Prism library"),n()},document.head.appendChild(e)})}createInterface(t=null){this.container=document.getElementById(this.config.containerId),this.container||(this.container=document.createElement("div"),this.container.id=this.config.containerId,document.body.appendChild(this.container)),this.container.className="ontowave-container";var e=this.config.showGallery?`<span class="ontowave-menu-option" onclick="window.location.href='gallery.html'">🎨 ${this.t("menuGallery",t)}</span>`:"",o=this.config.ui?.languageButtons||"menu",o=this.config.locales&&1<this.config.locales.length&&("menu"===o||"both"===o)?this.config.locales.map(e=>`<span class="ontowave-menu-option ontowave-lang-btn${(t||this.getCurrentLanguage())===e?" active":""}" onclick="event.stopPropagation(); window.OntoWave.instance.switchLanguage('${e}');">🌐 ${e.toUpperCase()}</span>`).join(""):"";this.container.innerHTML=`
580
+ `,document.head.appendChild(e)}async loadMermaid(){return new Promise(e=>{var t;d.mermaid?(this.mermaidLoaded=!0,this.initializeMermaid(),e()):((t=document.createElement("script")).src="https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.min.js",t.onload=()=>{this.mermaidLoaded=!0,this.initializeMermaid(),e()},t.onerror=()=>{console.warn("⚠️ Failed to load Mermaid library"),e()},document.head.appendChild(t))})}initializeMermaid(){d.mermaid&&(d.mermaid.initialize(this.config.mermaid),console.log("🎨 Mermaid initialized"))}async loadPrism(){return new Promise(n=>{if(d.Prism)return this.prismLoaded=!0,console.log("🎨 Prism already loaded"),n();var e=document.createElement("link"),e=(e.rel="stylesheet",e.href="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/themes/prism.min.css",document.head.appendChild(e),document.createElement("script"));e.src="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/components/prism-core.min.js",e.onload=()=>{console.log("🎨 Prism core loaded"),d.Prism.languages.javascript||(d.Prism.languages.javascript={"class-name":null});let e=["markup","css","javascript"],t=0,o=()=>{t++,console.log(`🔤 Essential language loaded: ${t}/`+e.length),t>=e.length&&(d.Prism.languages.markup&&(d.Prism.languages.html=d.Prism.languages.markup,console.log("🔤 HTML alias created from markup")),this.prismLoaded=!0,console.log("✅ Prism ready with essential languages"),n(),d.Prism&&d.Prism.languages&&(d.Prism.languages.plantuml={comment:/'[^\n]*/,keyword:/@startuml|@enduml|@startmindmap|@endmindmap|@startsalt|@endsalt|@startgantt|@endgantt|participant|actor|boundary|control|entity|database|collections|queue|as|title|note|over|left|right|end|alt|else|opt|loop|par|break|critical|group|autonumber|activate|deactivate|destroy|create|hide|show|class|interface|abstract|enum|extends|implements|package|namespace|skinparam|style|sprite/,string:{pattern:/"(?:\\.|[^\\"\r\n])*"/,greedy:!0},arrow:/(?:--|->|o-|-o|\*-|-\*|\.-|-\.)/,operator:/[:=[\](){}|]/,tag:/#[a-zA-Z0-9]+/,function:/\[\[.*?\]\]/,number:/\b\d+\b/,punctuation:/[,;]/},console.log("🏭 PlantUML language definition added to Prism")),setTimeout(()=>{let o=["python","java","bash","json","yaml","mermaid"],n=0,a=()=>{if(n>=o.length)console.log("✅ All safe Prism languages loaded"),e();else{let e=o[n++];var t=document.createElement("script");t.src=`https://cdn.jsdelivr.net/npm/prismjs@1.29.0/components/prism-${e}.min.js`,t.onload=()=>{console.log("🔤 Additional Prism language loaded: "+e),setTimeout(a,10)},t.onerror=()=>{console.warn("⚠️ Failed to load Prism language: "+e),a()},document.head.appendChild(t)}},e=()=>{var e;d.Prism.languages.javascript&&d.Prism.languages.javascript["class-name"]?((e=document.createElement("script")).src="https://cdn.jsdelivr.net/npm/prismjs@1.29.0/components/prism-typescript.min.js",e.onload=()=>{console.log("🔤 Additional Prism language loaded: typescript")},e.onerror=()=>{console.warn("⚠️ Failed to load Prism language: typescript")},document.head.appendChild(e)):console.warn("⚠️ JavaScript grammar incomplete, skipping TypeScript")};a()},100))};e.forEach(e=>{var t=document.createElement("script");t.src=`https://cdn.jsdelivr.net/npm/prismjs@1.29.0/components/prism-${e}.min.js`,t.onload=o,t.onerror=()=>{console.warn("⚠️ Failed to load essential Prism language: "+e),o()},document.head.appendChild(t)})},e.onerror=()=>{console.warn("⚠️ Failed to load Prism library"),n()},document.head.appendChild(e)})}createInterface(t=null){this.container=document.getElementById(this.config.containerId),this.container||(this.container=document.createElement("div"),this.container.id=this.config.containerId,document.body.appendChild(this.container)),this.container.className="ontowave-container";var e=this.config.showGallery?`<span class="ontowave-menu-option" onclick="window.location.href='gallery.html'">🎨 ${this.t("menuGallery",t)}</span>`:"",o=this.config.ui?.languageButtons||"menu",o=this.config.locales&&1<this.config.locales.length&&("menu"===o||"both"===o)?this.config.locales.map(e=>`<span class="ontowave-menu-option ontowave-lang-btn${(t||this.getCurrentLanguage())===e?" active":""}" onclick="event.stopPropagation(); window.OntoWave.instance.switchLanguage('${e}');">🌐 ${e.toUpperCase()}</span>`).join(""):"";this.container.innerHTML=`
473
581
  <div class="ontowave-floating-menu" id="ontowave-floating-menu" title="OntoWave Menu">
474
582
  <span class="ontowave-menu-icon" id="ontowave-menu-icon">&#127754;</span>
475
583
  <div class="ontowave-menu-content" id="ontowave-menu-content">
@@ -497,18 +605,22 @@
497
605
  <li><strong>Navigation:</strong> Hash préservé</li>
498
606
  </ul>
499
607
  </div>
500
- `,this.createFixedLanguageButtons(t)}createFixedLanguageButtons(e=null){var t=document.getElementById("ontowave-fixed-lang-buttons"),t=(t&&t.remove(),this.config.ui?.languageButtons||"menu");if(this.config.locales&&1<this.config.locales.length&&("fixed"===t||"both"===t)){let n=e||this.getCurrentLanguage();var e=document.createElement("div"),o=(e.id="ontowave-fixed-lang-buttons",e.className="ontowave-fixed-lang-buttons",this.config.locales.map(e=>{var t=n===e?" active":"",o=this.getLanguageFlag(e);return`<button class="ontowave-fixed-lang-btn${t}" onclick="window.OntoWave.instance.switchLanguage('${e}')" title="Changer en ${e.toUpperCase()}">${o} ${e.toUpperCase()}</button>`}).join(""));e.innerHTML=o,document.body.appendChild(e),console.log("🌐 Boutons de langue fixés créés:",this.config.locales,"Mode:",t)}}getLanguageFlag(e){return{fr:"🇫🇷",en:"🇬🇧",es:"🇪🇸",de:"🇩🇪",it:"🇮🇹",pt:"🇵🇹",zh:"🇨🇳",ja:"🇯🇵",ko:"🇰🇷",ru:"🇷🇺"}[e]||"🌐"}initializeNavigation(){d.addEventListener("hashchange",()=>{var e=location.hash.replace("#","")||this.config.defaultPage;this.loadPage(e)}),this.createDefaultNavigation(),this.initializeFloatingMenu()}initializeFloatingMenu(){let l=document.getElementById("ontowave-floating-menu");var e=document.getElementById("ontowave-menu-icon");if(l&&e){let o=!1,i=!1,a={x:0,y:0};function t(){!o&&!document.querySelector(".ontowave-config-panel")?l.classList.remove("no-drag"):(l.classList.add("no-drag"),i=!1,document.body.style.userSelect="",document.body.style.cursor="")}function n(){i=!1,l.style.cursor="move",document.body.style.userSelect="",document.body.style.cursor=""}d.ontowaveUpdateDragState=t,e.addEventListener("click",e=>{e.stopPropagation(),(o=!o)?l.classList.add("expanded"):l.classList.remove("expanded"),t()}),document.addEventListener("click",e=>{!l.contains(e.target)&&o&&(o=!1,l.classList.remove("expanded"),t())}),l.addEventListener("mousedown",e=>{var t;o||document.querySelector(".ontowave-config-panel")||e.target.closest("a, .ontowave-menu-option")||(i=!0,t=l.getBoundingClientRect(),a.x=e.clientX-t.left,a.y=e.clientY-t.top,l.style.cursor="grabbing",document.body.style.userSelect="none",e.preventDefault(),e.stopPropagation())}),document.addEventListener("mousemove",e=>{var t,o,n;i&&(t=e.clientX-a.x,e=e.clientY-a.y,o=d.innerWidth-l.offsetWidth,n=d.innerHeight-l.offsetHeight,l.style.left=Math.max(0,Math.min(o,t))+"px",l.style.top=Math.max(0,Math.min(n,e))+"px")}),document.addEventListener("mouseup",()=>{i&&(i=!1,l.style.cursor="move",document.body.style.userSelect="")}),document.addEventListener("visibilitychange",n),d.addEventListener("blur",n),d.addEventListener("focus",n),d.resetOntoWaveDragState=n,l.addEventListener("touchstart",e=>{var t;e.target.closest("a, .ontowave-menu-option")||(e=e.touches[0],t=l.getBoundingClientRect(),a.x=e.clientX-t.left,a.y=e.clientY-t.top,i=!0)}),document.addEventListener("touchmove",e=>{var t,o,n;i&&(e.preventDefault(),t=(e=e.touches[0]).clientX-a.x,e=e.clientY-a.y,o=d.innerWidth-l.offsetWidth,n=d.innerHeight-l.offsetHeight,l.style.left=Math.max(0,Math.min(o,t))+"px",l.style.top=Math.max(0,Math.min(n,e))+"px")}),document.addEventListener("touchend",()=>{i=!1}),t(),this.enhanceMenuOptionClicks()}}enhanceMenuOptionClicks(){var e=document.querySelector('.ontowave-menu-option[onclick*="toggleConfigurationPanel"]');e&&e.addEventListener("click",e=>{e.preventDefault(),e.stopPropagation(),console.log("Configuration button clicked via event listener"),this.toggleConfigurationPanel(e)},{capture:!0})}createDefaultNavigation(){var e=document.getElementById("ontowave-nav-grid");e&&(e.innerHTML=[{href:"index.md",icon:"🏠",label:"Accueil"},{href:"en/index.md",icon:"🇬🇧",label:"English"},{href:"fr/index.md",icon:"🇫🇷",label:"Français"},{href:"demo/mermaid.md",icon:"🧜‍♀️",label:"Démo Mermaid"},{href:"demo/plantuml.md",icon:"🏭",label:"PlantUML"},{href:"demo/advanced-shapes.md",icon:"🎯",label:"Formes Avancées"}].map(e=>`
608
+ `,this.createFixedLanguageButtons(t)}createFixedLanguageButtons(e=null){var t=document.getElementById("ontowave-fixed-lang-buttons"),t=(t&&t.remove(),this.config.ui?.languageButtons||"menu");if(this.config.locales&&1<this.config.locales.length&&("fixed"===t||"both"===t)){let n=e||this.getCurrentLanguage();var e=document.createElement("div"),o=(e.id="ontowave-fixed-lang-buttons",e.className="ontowave-fixed-lang-buttons",this.config.locales.map(e=>{var t=n===e?" active":"",o=this.getLanguageFlag(e);return`<button class="ontowave-fixed-lang-btn${t}" onclick="window.OntoWave.instance.switchLanguage('${e}')" title="Changer en ${e.toUpperCase()}">${o} ${e.toUpperCase()}</button>`}).join(""));e.innerHTML=o,document.body.appendChild(e),console.log("🌐 Boutons de langue fixés créés:",this.config.locales,"Mode:",t)}}getLanguageFlag(e){return{fr:"🇫🇷",en:"🇬🇧",es:"🇪🇸",de:"🇩🇪",it:"🇮🇹",pt:"🇵🇹",zh:"🇨🇳",ja:"🇯🇵",ko:"🇰🇷",ru:"🇷🇺"}[e]||"🌐"}initializeNavigation(){d.addEventListener("hashchange",()=>{var e=location.hash.replace("#","")||this.config.defaultPage;this.loadPage(e)}),this.createDefaultNavigation(),this.initializeFloatingMenu()}initializeFloatingMenu(){let l=document.getElementById("ontowave-floating-menu");var e=document.getElementById("ontowave-menu-icon");if(l&&e){let o=!1,a=!1,i={x:0,y:0};function t(){!o&&!document.querySelector(".ontowave-config-panel")?l.classList.remove("no-drag"):(l.classList.add("no-drag"),a=!1,document.body.style.userSelect="",document.body.style.cursor="")}function n(){a=!1,l.style.cursor="move",document.body.style.userSelect="",document.body.style.cursor=""}d.ontowaveUpdateDragState=t,e.addEventListener("click",e=>{e.stopPropagation(),(o=!o)?l.classList.add("expanded"):l.classList.remove("expanded"),t()}),document.addEventListener("click",e=>{!l.contains(e.target)&&o&&(o=!1,l.classList.remove("expanded"),t())}),l.addEventListener("mousedown",e=>{var t;o||document.querySelector(".ontowave-config-panel")||e.target.closest("a, .ontowave-menu-option")||(a=!0,t=l.getBoundingClientRect(),i.x=e.clientX-t.left,i.y=e.clientY-t.top,l.style.cursor="grabbing",document.body.style.userSelect="none",e.preventDefault(),e.stopPropagation())}),document.addEventListener("mousemove",e=>{var t,o,n;a&&(t=e.clientX-i.x,e=e.clientY-i.y,o=d.innerWidth-l.offsetWidth,n=d.innerHeight-l.offsetHeight,l.style.left=Math.max(0,Math.min(o,t))+"px",l.style.top=Math.max(0,Math.min(n,e))+"px")}),document.addEventListener("mouseup",()=>{a&&(a=!1,l.style.cursor="move",document.body.style.userSelect="")}),document.addEventListener("visibilitychange",n),d.addEventListener("blur",n),d.addEventListener("focus",n),d.resetOntoWaveDragState=n,l.addEventListener("touchstart",e=>{var t;e.target.closest("a, .ontowave-menu-option")||(e=e.touches[0],t=l.getBoundingClientRect(),i.x=e.clientX-t.left,i.y=e.clientY-t.top,a=!0)}),document.addEventListener("touchmove",e=>{var t,o,n;a&&(e.preventDefault(),t=(e=e.touches[0]).clientX-i.x,e=e.clientY-i.y,o=d.innerWidth-l.offsetWidth,n=d.innerHeight-l.offsetHeight,l.style.left=Math.max(0,Math.min(o,t))+"px",l.style.top=Math.max(0,Math.min(n,e))+"px")}),document.addEventListener("touchend",()=>{a=!1}),t(),this.enhanceMenuOptionClicks()}}enhanceMenuOptionClicks(){var e=document.querySelector('.ontowave-menu-option[onclick*="toggleConfigurationPanel"]');e&&e.addEventListener("click",e=>{e.preventDefault(),e.stopPropagation(),console.log("Configuration button clicked via event listener"),this.toggleConfigurationPanel(e)},{capture:!0})}createDefaultNavigation(){var e=document.getElementById("ontowave-nav-grid");e&&(e.innerHTML=[{href:"index.md",icon:"🏠",label:"Accueil"},{href:"en/index.md",icon:"🇬🇧",label:"English"},{href:"fr/index.md",icon:"🇫🇷",label:"Français"},{href:"demo/mermaid.md",icon:"🧜‍♀️",label:"Démo Mermaid"},{href:"demo/plantuml.md",icon:"🏭",label:"PlantUML"},{href:"demo/advanced-shapes.md",icon:"🎯",label:"Formes Avancées"}].map(e=>`
501
609
  <a href="#${e.href}" class="ontowave-nav-item" onclick="window.OntoWave.loadPage('${e.href}')">
502
610
  ${e.icon} ${e.label}
503
611
  </a>
504
- `).join(""))}async loadInitialPage(){var e=location.hash.replace("#","");if(this.isMultilingualMode()&&!e){var t=this.config.sources[this.config.defaultLocale];if(console.log("🌐 Multilingual mode detected"),console.log("🌐 Default locale:",this.config.defaultLocale),console.log("🌐 Default source:",t),console.log("🌐 Sources config:",this.config.sources),t)return console.log("🌐 Multilingual mode: redirecting to",t),void(location.hash="#"+t)}var o,t=e||this.config.defaultPage;if("index.md"===t){let e=!1;for(o of this.generatePageCandidates(t))try{if((await fetch(this.config.baseUrl+o,{method:"HEAD"})).ok){await this.loadPage(o),e=!0;break}}catch(e){continue}e||(console.log("📄 No index file found, showing configuration"),this.showConfigurationInterface())}else await this.loadPage(t)}async loadPage(t){var e=document.getElementById("ontowave-content");if(e){console.log("📄 Loading page:",t),this.currentPage=t,d.resetOntoWaveDragState&&d.resetOntoWaveDragState(),location.hash!=="#"+t&&(location.hash="#"+t),this.updateBreadcrumb(t),e.innerHTML='<div class="ontowave-loading">⏳ Chargement de '+t+"...</div>";try{var o=await fetch(this.config.baseUrl+t);if(!o.ok)throw new Error(`HTTP ${o.status}: `+o.statusText);var n=await o.text(),i=(console.log("✅ Content loaded:",n.length,"characters"),await this.renderMarkdown(n));e.innerHTML=i,await this.processDiagrams(e),await this.processPrism(e)}catch(e){console.error(" Failed to load page:",e),this.showError(`Impossible de charger ${t}: `+e.message)}}}updateBreadcrumb(e){var t=document.getElementById("ontowave-breadcrumb");if(t&&this.config.navigation.showBreadcrumb){let o=e.split("/"),n=['<a href="#'+this.config.defaultPage+'">🏠 Accueil</a>'],i="";o.forEach((e,t)=>{t===o.length-1?n.push("<span>"+e.replace(".md","")+"</span>"):(i+=(i?"/":"")+e,n.push('<a href="#'+i+'/index.md">'+e+"</a>"))}),t.innerHTML=n.join(" <span>›</span> "),t.style.display="block"}}async renderMarkdown(e){let o=e,l=[];return o=(o=o.replace(/```(\w+)([\s\S]*?)```/g,(e,t,o)=>{var n,i,o=o.trim(),a=`__CODE_BLOCK_${l.length}__`;return"mermaid"===t?(n="mermaid-"+Math.random().toString(36).substr(2,9),l.push(`<div class="ontowave-mermaid">
505
- <div style="margin-bottom: 8px; font-weight: bold; color: #586069;">🧜‍♀️ Diagramme Mermaid</div>
506
- <div class="mermaid" id="${n}">${o}</div>
507
- </div>`)):"plantuml"===t?(n="plantuml-"+Math.random().toString(36).substr(2,9),i=(e=>{var t=(new TextEncoder).encode(e);let o="";for(let e=0;e<t.length;e++)o+=t[e].toString(16).padStart(2,"0");return"h"+o})(o),i=`${this.config.plantuml.server}/${this.config.plantuml.format}/~`+i,l.push(`<div class="ontowave-plantuml" id="${n}">
508
- <div style="margin-bottom: 8px; font-weight: bold; color: #586069;">🏭 Diagramme PlantUML</div>
509
- <img src="${i}" alt="Diagramme PlantUML" style="max-width: 100%; height: auto;"
510
- onerror="this.parentElement.innerHTML='<div style=\\'color: #d73a49; padding: 20px;\\'>❌ Erreur de rendu PlantUML</div>'" />
511
- </div>`)):(n=this.prismLoaded?"language-"+t:"",console.log(`📝 Processing code block: language="${t}", prismLoaded=${this.prismLoaded}, class="${n}"`),i=o.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;"),l.push(`<pre class="ontowave-code"><code class="${n}">${i}</code></pre>`)),a})).replace(/^###### (.+)$/gm,"<h6>$1</h6>").replace(/^##### (.+)$/gm,"<h5>$1</h5>").replace(/^#### (.+)$/gm,"<h4>$1</h4>").replace(/^### (.+)$/gm,"<h3>$1</h3>").replace(/^## (.+)$/gm,"<h2>$1</h2>").replace(/^# (.+)$/gm,"<h1>$1</h1>").replace(/^---+$/gm,"<hr>").replace(/!\[([^\]]*)\]\(([^)]+)\)/g,'<img src="$2" alt="$1">').replace(/\[([^\]]+)\]\(([^)]+\.html[^)]*)\)/g,'<a href="$2">$1</a>').replace(/\[([^\]]+)\]\((https?:\/\/[^)]+)\)/g,'<a href="$2" target="_blank">$1</a>').replace(/\[([^\]]+)\]\(([^)]+\.(tar\.gz|zip|pdf|doc|docx|xls|xlsx|ppt|pptx|txt|csv|json|xml|js|css|png|jpg|jpeg|gif|svg|webp)[^)]*)\)/g,'<a href="$2" download>$1</a>').replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="#$2" onclick="window.OntoWave.loadPage(\'$2\')">$1</a>').replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/\*(.+?)\*/g,"<em>$1</em>").replace(/`([^`]+)`/g,"<code>$1</code>"),o=(o=this.renderAdvancedTables(o)).split("\n\n").map(e=>e.trim()).filter(e=>0<e.length).map(e=>e.match(/^<(h[1-6]|hr|div|pre)/)?e:`<p>${e.replace(/\n/g,"<br>")}</p>`).join("\n"),l.forEach((e,t)=>{o=o.replace(`__CODE_BLOCK_${t}__`,e)}),o}renderAdvancedTables(e){let l=!1;return e=e.replace(/(\|[^|\n]*\|[^|\n]*\|[^\n]*\n\|[-:| ]+\|[^\n]*\n(?:\|[^\n]*\n?)*)/g,e=>{var t=e.trim().split("\n");if(t.length<2)return e;var o=t[0],n=t[1],t=t.slice(2);if(!o.includes("|")||!n.includes("|"))return e;l=!0;e=o.split("|").map(e=>e.trim()).filter(e=>e);let i=n.split("|").map(e=>e.trim()).filter(e=>e).map(e=>e.startsWith(":")&&e.endsWith(":")?"center":e.endsWith(":")?"right":(e.startsWith(":"),"left"));o=t.map(e=>e.split("|").map(e=>e.trim()).filter(e=>e)).filter(e=>0<e.length);let a="<table>";return a+="<thead><tr>",e.forEach((e,t)=>{t=i[t]||"left";a+=`<th class="text-${t}">${e}</th>`}),a=a+"</tr></thead>"+"<tbody>",o.forEach(e=>{a+="<tr>",e.forEach((e,t)=>{t=i[t]||"left";a+=`<td class="text-${t}">${e}</td>`}),a+="</tr>"}),a+="</tbody></table>"}),l&&this.injectTableStyles(),e}injectTableStyles(){var e;document.getElementById("ontowave-table-styles")||((e=document.createElement("style")).id="ontowave-table-styles",e.textContent=`
612
+ `).join(""))}async loadInitialPage(){var e=location.hash.replace("#","");if(!e&&this.config.languages&&this.config.languages.supported){var t=navigator.language.split("-")[0].toLowerCase(),o=(console.log("🌍 Browser language detected:",t),this.config.languages.supported.split(",").map(e=>e.trim().toLowerCase())),n=this.config.languages.fallback||"fr";if(o.includes(t)&&t!==n){console.log("🌍 Auto-redirecting to browser language: "+t);o=this.config.defaultPage.replace(/\.([a-z]{2})\.md$/,".md").replace(/\.md$/,"")+`.${t}.md`;try{if((await fetch(this.config.baseUrl+o,{method:"HEAD"})).ok)return console.log("🌍 Language page found: "+o),location.hash="#"+o,void await this.loadPage(o)}catch(e){console.log(`🌍 Language page not found: ${o}, using fallback`)}}}if(this.isMultilingualMode()&&!e){n=this.config.sources[this.config.defaultLocale];if(console.log("🌐 Multilingual mode detected"),console.log("🌐 Default locale:",this.config.defaultLocale),console.log("🌐 Default source:",n),console.log("🌐 Sources config:",this.config.sources),n)return console.log("🌐 Multilingual mode: redirecting to",n),void(location.hash="#"+n)}var a,t=e||this.config.defaultPage;if("index.md"===t){let e=!1;for(a of this.generatePageCandidates(t))try{if((await fetch(this.config.baseUrl+a,{method:"HEAD"})).ok){await this.loadPage(a),e=!0;break}}catch(e){continue}e||(console.log("📄 No index file found, showing configuration"),this.showConfigurationInterface())}else await this.loadPage(t)}async loadPage(t){var o=document.getElementById("ontowave-content");if(o){console.log("📄 Loading page:",t),this.currentPage=t,d.resetOntoWaveDragState&&d.resetOntoWaveDragState(),location.hash!=="#"+t&&(location.hash="#"+t),this.updateBreadcrumb(t),o.innerHTML='<div class="ontowave-loading">⏳ Chargement de '+t+"...</div>";try{var n=await fetch(this.config.baseUrl+t);if(!n.ok)throw new Error(`HTTP ${n.status}: `+n.statusText);var a,i,l=await n.text();console.log("✅ Content loaded:",l.length,"characters");let e;e=t.endsWith(".puml")?(console.log("🏭 Processing .puml file"),a=(e=>{var t=(new TextEncoder).encode(e);let o="";for(let e=0;e<t.length;e++)o+=t[e].toString(16).padStart(2,"0");return"h"+o})(l),i=`${this.config.plantuml.server}/${this.config.plantuml.format}/~`+a,`
613
+ <div class="ontowave-plantuml-container">
614
+ <div class="ontowave-plantuml-source">
615
+ <h3>📝 Code Source PlantUML</h3>
616
+ <pre><code class="language-plantuml">${l.replace(/</g,"&lt;").replace(/>/g,"&gt;")}</code></pre>
617
+ </div>
618
+ <div class="ontowave-plantuml-render">
619
+ <h3>🎨 Diagramme Rendu</h3>
620
+ <div class="plantuml-diagram" data-plantuml-url="${i}">⏳ Chargement diagramme PlantUML...</div>
621
+ </div>
622
+ </div>
623
+ `):await this.renderMarkdown(l),o.innerHTML=e,document.querySelectorAll(".ontowave-loading").forEach(e=>e.remove()),await this.processDiagrams(o),await this.processPlantUML(o),await this.processPrism(o)}catch(e){console.error("❌ Failed to load page:",e),this.showError(`Impossible de charger ${t}: `+e.message)}}}updateBreadcrumb(e){var t=document.getElementById("ontowave-breadcrumb");if(t&&this.config.navigation.showBreadcrumb){let o=e.split("/"),n=['<a href="#'+this.config.defaultPage+'">🏠 Accueil</a>'],a="";o.forEach((e,t)=>{t===o.length-1?n.push("<span>"+e.replace(".md","")+"</span>"):(a+=(a?"/":"")+e,n.push('<a href="#'+a+'/index.md">'+e+"</a>"))}),t.innerHTML=n.join(" <span>›</span> "),t.style.display="block"}}async renderMarkdown(e){let o=e,l=(o=o.replace(/\n(\|[^\n]+\|\n)+/gm,e=>{var t=e.trim().split("\n");if(t.length<2)return e;var e=t[0].split("|").map(e=>e.trim()).filter(e=>e),o=t[1].split("|").map(e=>e.trim()).filter(e=>e),t=t.slice(2).map(e=>e.split("|").map(e=>e.trim()).filter(e=>""!==e));let n=o.map(e=>e.startsWith(":")&&e.endsWith(":")?"center":e.endsWith(":")?"right":"left"),a='<table class="ontowave-table">';return a+="<thead><tr>",e.forEach((e,t)=>{t=n[t]||"left";a+=`<th style="text-align: ${t}">${e}</th>`}),a=a+"</tr></thead>"+"<tbody>",t.forEach(e=>{a+="<tr>",e.forEach((e,t)=>{t=n[t]||"left";a+=`<td style="text-align: ${t}">${e}</td>`}),a+="</tr>"}),"\n"+(a+="</tbody></table>")+"\n"}),[]);return o=(o=o.replace(/```(\w+)([\s\S]*?)```/g,(e,t,o)=>{var n,a,o=o.trim(),i=`__CODE_BLOCK_${l.length}__`;return"mermaid"===t?(n="mermaid-"+Math.random().toString(36).substr(2,9),l.push(`<div class="mermaid" id="${n}">${o}</div>`)):"plantuml"===t?(n="plantuml-"+Math.random().toString(36).substr(2,9),a=(e=>{var t=(new TextEncoder).encode(e);let o="";for(let e=0;e<t.length;e++)o+=t[e].toString(16).padStart(2,"0");return"h"+o})(o),a=`${this.config.plantuml.server}/${this.config.plantuml.format}/~`+a,l.push(`<div class="plantuml-diagram" id="${n}" data-plantuml-url="${a}">⏳ Chargement diagramme PlantUML...</div>`)):(n=this.prismLoaded?"language-"+t:"",console.log(`📝 Processing code block: language="${t}", prismLoaded=${this.prismLoaded}, class="${n}"`),a=o.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;"),l.push(`<pre class="ontowave-code"><code class="${n}">${a}</code></pre>`)),i})).replace(/^###### (.+)$/gm,"<h6>$1</h6>").replace(/^##### (.+)$/gm,"<h5>$1</h5>").replace(/^#### (.+)$/gm,"<h4>$1</h4>").replace(/^### (.+)$/gm,"<h3>$1</h3>").replace(/^## (.+)$/gm,"<h2>$1</h2>").replace(/^# (.+)$/gm,"<h1>$1</h1>").replace(/^---+$/gm,"<hr>").replace(/!\[([^\]]*)\]\(([^)]+)\)/g,'<img src="$2" alt="$1">').replace(/\[([^\]]+)\]\(([^)]+\.html[^)]*)\)/g,'<a href="$2">$1</a>').replace(/\[([^\]]+)\]\((https?:\/\/[^)]+)\)/g,'<a href="$2" target="_blank">$1</a>').replace(/\[([^\]]+)\]\(([^)]+\.(tar\.gz|zip|pdf|doc|docx|xls|xlsx|ppt|pptx|txt|csv|json|xml|js|css|png|jpg|jpeg|gif|svg|webp)[^)]*)\)/g,'<a href="$2" download>$1</a>').replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="#$2" onclick="window.OntoWave.loadPage(\'$2\')">$1</a>').replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/\*(.+?)\*/g,"<em>$1</em>").replace(/`([^`]+)`/g,"<code>$1</code>"),o=(o=this.renderAdvancedTables(o)).split("\n\n").map(e=>e.trim()).filter(e=>0<e.length).map(e=>e.match(/^<(h[1-6]|hr|div|pre)/)?e:`<p>${e.replace(/\n/g,"<br>")}</p>`).join("\n"),l.forEach((e,t)=>{o=o.replace(`__CODE_BLOCK_${t}__`,e)}),o}renderAdvancedTables(e){let l=!1;return e=e.replace(/(\|[^|\n]*\|[^|\n]*\|[^\n]*\n\|[-:| ]+\|[^\n]*\n(?:\|[^\n]*\n?)*)/g,e=>{var t=e.trim().split("\n");if(t.length<2)return e;var o=t[0],n=t[1],t=t.slice(2);if(!o.includes("|")||!n.includes("|"))return e;l=!0;e=o.split("|").map(e=>e.trim()).filter(e=>e);let a=n.split("|").map(e=>e.trim()).filter(e=>e).map(e=>e.startsWith(":")&&e.endsWith(":")?"center":e.endsWith(":")?"right":(e.startsWith(":"),"left"));o=t.map(e=>e.split("|").map(e=>e.trim()).filter(e=>e)).filter(e=>0<e.length);let i="<table>";return i+="<thead><tr>",e.forEach((e,t)=>{t=a[t]||"left";i+=`<th class="text-${t}">${e}</th>`}),i=i+"</tr></thead>"+"<tbody>",o.forEach(e=>{i+="<tr>",e.forEach((e,t)=>{t=a[t]||"left";i+=`<td class="text-${t}">${e}</td>`}),i+="</tr>"}),i+="</tbody></table>"}),l&&this.injectTableStyles(),e}injectTableStyles(){var e;document.getElementById("ontowave-table-styles")||((e=document.createElement("style")).id="ontowave-table-styles",e.textContent=`
512
624
  table {
513
625
  border-collapse: collapse;
514
626
  width: 100%;
@@ -570,7 +682,16 @@ td:empty::before {
570
682
  padding: 8px 12px;
571
683
  min-width: 100px;
572
684
  }
573
- }`,document.head.appendChild(e),console.log("✅ Styles CSS tableaux injectés dans le DOM"))}async processDiagrams(t){if(this.mermaidLoaded&&d.mermaid){let o=t.querySelectorAll(".mermaid");if(0!==o.length){console.log("🎨 Processing",o.length,"Mermaid diagrams");try{o.forEach(e=>{e.removeAttribute("data-processed")}),await d.mermaid.run(),console.log("✅ Mermaid diagrams rendered successfully"),setTimeout(()=>{var e=t.querySelectorAll(".mermaid svg");console.log("🎨 SVG elements found:",e.length),0===e.length&&0<o.length&&(console.log("⚠️ Retrying Mermaid rendering..."),o.forEach(e=>{e.removeAttribute("data-processed")}),d.mermaid.init(void 0,o))},1e3)}catch(t){console.error("❌ Mermaid rendering error:",t),o.forEach(e=>{e.querySelector("svg")||(e.innerHTML=`<div style="color: #d73a49; padding: 10px;">❌ Erreur de rendu Mermaid: ${t.message}</div><pre style="background: #f8f8f8; padding: 10px; margin-top: 10px; border-radius: 4px;"><code>${e.textContent}</code></pre>`)})}}}}async processPrism(e){if(console.log("🔍 processPrism called - prismLoaded:",this.prismLoaded,"window.Prism:",!!d.Prism),d.Prism)try{console.log("🔤 Available Prism languages:",d.Prism.languages?Object.keys(d.Prism.languages):"none");var t=e.querySelectorAll('code[class*="language-"]'),o=(console.log("🎨 Found",t.length,"code blocks with language classes"),t.forEach((e,t)=>{console.log(`🔍 Code block ${t}:`),console.log(` - class: "${e.className}"`),console.log(" - content length: "+e.textContent?.length),console.log(` - content preview: "${e.textContent?.substring(0,50)}..."`),console.log(" - parent visible: "+("none"!==d.getComputedStyle(e.parentElement).display)),console.log(" - element visible: "+("none"!==d.getComputedStyle(e).display))}),e.querySelectorAll("code"));if(console.log("📝 Total code blocks found:",o.length),0<t.length){var n=t[0];console.log("🧪 Testing manual highlighting on first element...");var i=n.className.split(" ").find(e=>e.startsWith("language-")),a=i?i.replace("language-",""):"unknown";if(console.log(`🔤 Language detected: "${a}"`),console.log("🔤 Language available in Prism: "+!(!d.Prism.languages||!d.Prism.languages[a])),d.Prism.languages&&d.Prism.languages[a]){console.log("🧪 Attempting manual highlight...");var l=n.textContent;try{var r=d.Prism.highlight(l,d.Prism.languages[a],a);console.log("🎨 Manual highlight result length: "+r.length),console.log(`🎨 Manual highlight preview: "${r.substring(0,100)}..."`),n.innerHTML=r,console.log("✅ Manual highlight applied")}catch(e){console.error("❌ Manual highlight failed:",e)}}d.Prism.highlightAllUnder(e),console.log("✅ Prism syntax highlighting applied to",t.length,"blocks");var s=e.querySelectorAll(".token");console.log("🎨 Tokens created after highlighting:",s.length),0<s.length&&s.forEach((e,t)=>{console.log(`Token ${t}: "${e.textContent}" (class: ${e.className})`)})}else console.log("⚠️ No code blocks with language classes found for Prism")}catch(e){console.error("❌ Prism highlighting error:",e)}else console.log("🎨 Prism not available, skipping syntax highlighting")}showConfigurationInterface(){var e,t=document.getElementById("ontowave-content");t&&(e=JSON.stringify(this.config,null,2).replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),t.innerHTML=`
685
+ }`,document.head.appendChild(e),console.log("✅ Styles CSS tableaux injectés dans le DOM"))}async processDiagrams(t){if(this.mermaidLoaded&&d.mermaid){let o=t.querySelectorAll(".mermaid");if(0!==o.length){console.log("🎨 Processing",o.length,"Mermaid diagrams");try{o.forEach(e=>{e.removeAttribute("data-processed")}),await d.mermaid.run(),console.log("✅ Mermaid diagrams rendered successfully"),setTimeout(()=>{var e=t.querySelectorAll(".mermaid svg");console.log("🎨 SVG elements found:",e.length),0===e.length&&0<o.length&&(console.log("⚠️ Retrying Mermaid rendering..."),o.forEach(e=>{e.removeAttribute("data-processed")}),d.mermaid.init(void 0,o))},1e3)}catch(t){console.error("❌ Mermaid rendering error:",t),o.forEach(e=>{e.querySelector("svg")||(e.innerHTML=`<div style="color: #d73a49; padding: 10px;">❌ Erreur de rendu Mermaid: ${t.message}</div><pre style="background: #f8f8f8; padding: 10px; margin-top: 10px; border-radius: 4px;"><code>${e.textContent}</code></pre>`)})}}}}async processPlantUML(e){var e=e.querySelectorAll(".plantuml-diagram[data-plantuml-url]");0!==e.length&&(console.log("🌱 Processing",e.length,"PlantUML diagrams"),e=Array.from(e).map(async t=>{var o=t.getAttribute("data-plantuml-url");try{let e;var n=this.getCachedSVG(o);if(n)e=n;else{var a=await fetch(o);if(!a.ok)throw new Error(`HTTP ${a.status}: `+a.statusText);e=await a.text(),this.cacheSVG(o,e)}var i=document.createElement("div"),l=(i.innerHTML=e,i.querySelector("svg"));if(!l)throw new Error("No SVG found in response");l.style.maxWidth="100%",l.style.height="auto",l.style.display="block",l.style.margin="0 auto";var r=l.querySelectorAll("a[href]");console.log(`🔗 Found ${r.length} links in PlantUML diagram`),r.forEach(e=>{let t=e.getAttribute("href");t&&(t.endsWith(".md")||t.endsWith(".html")||t.endsWith(".puml"))&&(e.addEventListener("click",e=>{e.preventDefault(),e.stopPropagation(),console.log("🔗 Navigating to: "+t),this.loadPage(t)}),e.style.cursor="pointer",e.setAttribute("class",(e.getAttribute("class")||"")+" ontowave-internal-link"))}),t.innerHTML="",t.appendChild(l),console.log(" PlantUML diagram rendered with",r.length,"clickable links")}catch(e){console.error("❌ Failed to load PlantUML diagram:",e),t.innerHTML=`
686
+ <div style="color: #d73a49; padding: 20px; background: #fff5f5; border: 1px solid #feb2b2; border-radius: 6px;">
687
+ <strong>❌ Erreur de rendu PlantUML</strong>
688
+ <p style="margin: 5px 0; font-size: 14px;">${e.message}</p>
689
+ <details style="margin-top: 10px;">
690
+ <summary style="cursor: pointer; color: #0366d6;">Détails techniques</summary>
691
+ <pre style="background: #f6f8fa; padding: 10px; margin-top: 5px; border-radius: 4px; overflow-x: auto; font-size: 12px;">URL: ${o}</pre>
692
+ </details>
693
+ </div>
694
+ `}}),await Promise.all(e),console.log("✅ All PlantUML diagrams processed"))}async processPrism(e){if(console.log("🔍 processPrism called - prismLoaded:",this.prismLoaded,"window.Prism:",!!d.Prism),d.Prism){if(!d.Prism.languages||!d.Prism.languages.javascript){console.log("⏳ JavaScript not loaded yet, waiting...");for(let e=0;e<20;e++)if(await new Promise(e=>setTimeout(e,100)),d.Prism.languages&&d.Prism.languages.javascript){console.log("✅ JavaScript language now available");break}d.Prism.languages&&d.Prism.languages.javascript||console.warn("⚠️ JavaScript language still not available after waiting")}try{console.log("🔤 Available Prism languages:",d.Prism.languages?Object.keys(d.Prism.languages):"none");var t=e.querySelectorAll('code[class*="language-"]'),o=(console.log("🎨 Found",t.length,"code blocks with language classes"),t.forEach((e,t)=>{console.log(`🔍 Code block ${t}:`),console.log(` - class: "${e.className}"`),console.log(" - content length: "+e.textContent?.length),console.log(` - content preview: "${e.textContent?.substring(0,50)}..."`),console.log(" - parent visible: "+("none"!==d.getComputedStyle(e.parentElement).display)),console.log(" - element visible: "+("none"!==d.getComputedStyle(e).display))}),e.querySelectorAll("code"));if(console.log("📝 Total code blocks found:",o.length),0<t.length){var n=t[0];console.log("🧪 Testing manual highlighting on first element...");var a=n.className.split(" ").find(e=>e.startsWith("language-")),i=a?a.replace("language-",""):"unknown";if(console.log(`🔤 Language detected: "${i}"`),console.log("🔤 Language available in Prism: "+!(!d.Prism.languages||!d.Prism.languages[i])),d.Prism.languages&&d.Prism.languages[i]){console.log("🧪 Attempting manual highlight...");var l=n.textContent;try{var r=d.Prism.highlight(l,d.Prism.languages[i],i);console.log("🎨 Manual highlight result length: "+r.length),console.log(`🎨 Manual highlight preview: "${r.substring(0,100)}..."`),n.innerHTML=r,console.log("✅ Manual highlight applied")}catch(e){console.error("❌ Manual highlight failed:",e)}}d.Prism.highlightAllUnder(e),console.log("✅ Prism syntax highlighting applied to",t.length,"blocks");var s=e.querySelectorAll(".token");console.log("🎨 Tokens created after highlighting:",s.length),0<s.length&&s.forEach((e,t)=>{console.log(`Token ${t}: "${e.textContent}" (class: ${e.className})`)})}else console.log("⚠️ No code blocks with language classes found for Prism")}catch(e){console.error("❌ Prism highlighting error:",e)}}else console.log("🎨 Prism not available, skipping syntax highlighting")}showConfigurationInterface(){var e,t=document.getElementById("ontowave-content");t&&(e=JSON.stringify(this.config,null,2).replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),t.innerHTML=`
574
695
  <div class="ontowave-config-interface">
575
696
  <div class="config-header">
576
697
  <h1>🌊 OntoWave Configuration</h1>
@@ -658,7 +779,7 @@ ${e}
658
779
  </div>
659
780
  </div>
660
781
  </div>
661
- `,this.addConfigStyles(),this.populateConfigForm(),this.updateGeneratedCode())}populateConfigForm(){var e=document.getElementById("config-title"),t=document.getElementById("config-defaultPage"),o=document.getElementById("config-locales"),n=document.getElementById("config-showGallery"),i=document.getElementById("config-mermaidTheme");e&&(e.value=this.config.title),t&&(t.value=this.config.defaultPage),o&&(o.value=this.config.locales.join(", ")),n&&(n.checked=this.config.showGallery),i&&(i.value=this.config.mermaid.theme)}addConfigStyles(){var e;document.getElementById("ontowave-config-styles")||((e=document.createElement("style")).id="ontowave-config-styles",e.textContent=`
782
+ `,this.addConfigStyles(),this.populateConfigForm(),this.updateGeneratedCode())}populateConfigForm(){var e=document.getElementById("config-title"),t=document.getElementById("config-defaultPage"),o=document.getElementById("config-locales"),n=document.getElementById("config-showGallery"),a=document.getElementById("config-mermaidTheme");e&&(e.value=this.config.title),t&&(t.value=this.config.defaultPage),o&&(o.value=this.config.locales.join(", ")),n&&(n.checked=this.config.showGallery),a&&(a.value=this.config.mermaid.theme)}addConfigStyles(){var e;document.getElementById("ontowave-config-styles")||((e=document.createElement("style")).id="ontowave-config-styles",e.textContent=`
662
783
  .ontowave-config-interface {
663
784
  max-width: 1200px;
664
785
  margin: 0 auto;
@@ -793,7 +914,7 @@ ${e}
793
914
  gap: 20px;
794
915
  }
795
916
  }
796
- `,document.head.appendChild(e))}updateConfigFromForm(){var e=document.getElementById("config-title").value,t=document.getElementById("config-defaultPage").value,o=document.getElementById("config-locales").value.split(",").map(e=>e.trim()).filter(e=>0<e.length),n=document.getElementById("config-showGallery").checked,i=document.getElementById("config-mermaidTheme").value;this.config.title=e,this.config.defaultPage=t,this.config.locales=o,this.config.showGallery=n,this.config.mermaid.theme=i,console.log("📝 Configuration updated:",this.config),document.title=this.config.title,this.updateGeneratedCode(),this.showNotification("✅ Configuration mise à jour")}updateGeneratedCode(){var e={title:this.config.title,baseUrl:this.config.baseUrl,defaultPage:this.config.defaultPage,locales:this.config.locales,fallbackLocale:this.config.fallbackLocale,showGallery:this.config.showGallery,mermaid:{theme:this.config.mermaid.theme}},e=JSON.stringify(e,null,2).replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),e=`&lt;!DOCTYPE html&gt;
917
+ `,document.head.appendChild(e))}updateConfigFromForm(){var e=document.getElementById("config-title").value,t=document.getElementById("config-defaultPage").value,o=document.getElementById("config-locales").value.split(",").map(e=>e.trim()).filter(e=>0<e.length),n=document.getElementById("config-showGallery").checked,a=document.getElementById("config-mermaidTheme").value;this.config.title=e,this.config.defaultPage=t,this.config.locales=o,this.config.showGallery=n,this.config.mermaid.theme=a,console.log("📝 Configuration updated:",this.config),document.title=this.config.title,this.updateGeneratedCode(),this.showNotification("✅ Configuration mise à jour")}updateGeneratedCode(){var e={title:this.config.title,baseUrl:this.config.baseUrl,defaultPage:this.config.defaultPage,locales:this.config.locales,fallbackLocale:this.config.fallbackLocale,showGallery:this.config.showGallery,mermaid:{theme:this.config.mermaid.theme}},e=JSON.stringify(e,null,2).replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),e=`&lt;!DOCTYPE html&gt;
797
918
  &lt;html&gt;
798
919
  &lt;head&gt;
799
920
  &lt;meta charset="UTF-8"&gt;
@@ -834,7 +955,7 @@ ${e}
834
955
  from { transform: translateX(100%); opacity: 0; }
835
956
  to { transform: translateX(0); opacity: 1; }
836
957
  }
837
- `,document.head.appendChild(e)),document.body.appendChild(t),setTimeout(()=>{t.style.animation="slideIn 0.3s ease reverse",setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t)},300)},3e3)}showError(e){var t=document.getElementById("ontowave-content");t&&(t.innerHTML=`<div class="ontowave-error">❌ ${e}</div>`)}toggleConfigurationPanel(o,n=null){o&&(o.preventDefault(),o.stopPropagation());o=n||this.getCurrentLanguage(),console.log("⚙️ Opening config panel with locale:",o),n=document.querySelector(".ontowave-menu-content");if(n){var i=document.querySelector('.ontowave-menu-option[onclick*="toggleConfigurationPanel"]');let t=document.getElementById("ontowave-config-panel");if(t){t.remove(),i&&i.classList.remove("selected");let e=document.getElementById("ontowave-floating-menu");e&&e.classList.remove("has-config-panel"),"function"==typeof d.ontowaveUpdateDragState&&d.ontowaveUpdateDragState(),void console.log("Config panel closed")}else{i&&i.classList.add("selected"),(t=document.createElement("div")).id="ontowave-config-panel",t.className="ontowave-config-panel",t.innerHTML=`
958
+ `,document.head.appendChild(e)),document.body.appendChild(t),setTimeout(()=>{t.style.animation="slideIn 0.3s ease reverse",setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t)},300)},3e3)}showError(e){var t=document.getElementById("ontowave-content");t&&(t.innerHTML=`<div class="ontowave-error">❌ ${e}</div>`)}toggleConfigurationPanel(o,n=null){o&&(o.preventDefault(),o.stopPropagation());o=n||this.getCurrentLanguage(),console.log("⚙️ Opening config panel with locale:",o),n=document.querySelector(".ontowave-menu-content");if(n){var a=document.querySelector('.ontowave-menu-option[onclick*="toggleConfigurationPanel"]');let t=document.getElementById("ontowave-config-panel");if(t){t.remove(),a&&a.classList.remove("selected");let e=document.getElementById("ontowave-floating-menu");e&&e.classList.remove("has-config-panel"),"function"==typeof d.ontowaveUpdateDragState&&d.ontowaveUpdateDragState(),void console.log("Config panel closed")}else{a&&a.classList.add("selected"),(t=document.createElement("div")).id="ontowave-config-panel",t.className="ontowave-config-panel",t.innerHTML=`
838
959
  <div class="config-panel-content">
839
960
  <div class="config-full-panel">
840
961
  <h3>🌊 ${this.t("configTitle",o)}</h3>
@@ -1019,7 +1140,7 @@ ${e}
1019
1140
  </div>
1020
1141
  </div>
1021
1142
  </div>
1022
- `,this.addConfigPanelStyles(),n.appendChild(t);let e=document.getElementById("ontowave-floating-menu");e&&e.classList.add("has-config-panel"),"function"==typeof d.ontowaveUpdateDragState&&d.ontowaveUpdateDragState(),this.updateGeneratedCodeMini(),console.log("Config panel opened")}}else console.error("Menu content not found")}updateConfigFromFullPanel(){var e=document.getElementById("config-title-full")?.value||this.config.title,t=document.getElementById("config-defaultPage-full")?.value||this.config.defaultPage,o=document.getElementById("config-baseUrl-full")?.value||this.config.baseUrl,n=document.getElementById("config-locales-full")?.value.split(",").map(e=>e.trim()).filter(e=>0<e.length)||this.config.locales,i=document.getElementById("config-fallbackLocale-full")?.value||this.config.fallbackLocale,a=document.getElementById("config-showGallery-full")?.checked||!1,l=!1!==document.getElementById("config-navHome-full")?.checked,r=!1!==document.getElementById("config-navBreadcrumb-full")?.checked,s=!1!==document.getElementById("config-navToc-full")?.checked,c=document.getElementById("config-mermaidTheme-full")?.value||"default",d=!1!==document.getElementById("config-mermaidStart-full")?.checked,g=!1!==document.getElementById("config-mermaidMaxWidth-full")?.checked,m=document.getElementById("config-plantumlServer-full")?.value||"https://www.plantuml.com/plantuml",u=document.getElementById("config-plantumlFormat-full")?.value||"svg",f=document.getElementById("config-prismTheme-full")?.value||"default",p=!1!==document.getElementById("config-prismAutoload-full")?.checked,h=document.getElementById("config-uiTheme-full")?.value||"default",v=!1!==document.getElementById("config-uiResponsive-full")?.checked,b=!1!==document.getElementById("config-uiAnimations-full")?.checked;this.config.title=e,this.config.defaultPage=t,this.config.baseUrl=o,this.config.locales=n,this.config.fallbackLocale=i,this.config.showGallery=a,this.config.navigation={showHome:l,showBreadcrumb:r,showToc:s},this.config.mermaid={theme:c,startOnLoad:d,flowchart:{useMaxWidth:g},sequence:{useMaxWidth:g},gantt:{useMaxWidth:g},journey:{useMaxWidth:g}},this.config.plantuml={server:m,format:u},this.config.prism={theme:f,autoload:p},this.config.ui={theme:h,responsive:v,animations:b},document.title=this.config.title,this.showNotification("Configuration appliquée avec succès ! 🎉"),console.log("Configuration mise à jour:",this.config)}resetConfigToDefaults(){var e;confirm("Voulez-vous vraiment réinitialiser toute la configuration aux valeurs par défaut ?")&&(Object.assign(this.config,{title:"OntoWave Documentation",baseUrl:"/",defaultPage:"index.md",locales:[],fallbackLocale:"en",showGallery:!1,mermaid:{theme:"default",startOnLoad:!0,flowchart:{useMaxWidth:!0},sequence:{useMaxWidth:!0},gantt:{useMaxWidth:!0},journey:{useMaxWidth:!0}},plantuml:{server:"https://www.plantuml.com/plantuml",format:"svg"},prism:{theme:"default",autoload:!0},navigation:{showHome:!0,showBreadcrumb:!0,showToc:!0},ui:{theme:"default",responsive:!0,animations:!0}}),(e=document.getElementById("ontowave-config-panel"))&&(e.remove(),"function"==typeof d.ontowaveUpdateDragState&&d.ontowaveUpdateDragState(),setTimeout(()=>this.toggleConfigurationPanel(),100)),this.showNotification("Configuration réinitialisée ! 🔄"))}updateConfigFromPanel(){var e=document.getElementById("config-title-mini")?.value||this.config.title,t=document.getElementById("config-locales-mini")?.value.split(",").map(e=>e.trim()).filter(e=>0<e.length)||this.config.locales,o=document.getElementById("config-showGallery-mini")?.checked||this.config.showGallery;this.config.title=e,this.config.locales=t,this.config.showGallery=o,document.title=this.config.title,this.updateGeneratedCodeMini(),this.showNotification("✅ Configuration mise à jour")}downloadConfigFromPanel(){var e={title:this.config.title,baseUrl:this.config.baseUrl,defaultPage:this.config.defaultPage,locales:this.config.locales,fallbackLocale:this.config.fallbackLocale,showGallery:this.config.showGallery,mermaid:{theme:this.config.mermaid.theme}},e=JSON.stringify(e,null,2),e=`<!DOCTYPE html>
1143
+ `,this.addConfigPanelStyles(),n.appendChild(t);let e=document.getElementById("ontowave-floating-menu");e&&e.classList.add("has-config-panel"),"function"==typeof d.ontowaveUpdateDragState&&d.ontowaveUpdateDragState(),this.updateGeneratedCodeMini(),console.log("Config panel opened")}}else console.error("Menu content not found")}updateConfigFromFullPanel(){var e=document.getElementById("config-title-full")?.value||this.config.title,t=document.getElementById("config-defaultPage-full")?.value||this.config.defaultPage,o=document.getElementById("config-baseUrl-full")?.value||this.config.baseUrl,n=document.getElementById("config-locales-full")?.value.split(",").map(e=>e.trim()).filter(e=>0<e.length)||this.config.locales,a=document.getElementById("config-fallbackLocale-full")?.value||this.config.fallbackLocale,i=document.getElementById("config-showGallery-full")?.checked||!1,l=!1!==document.getElementById("config-navHome-full")?.checked,r=!1!==document.getElementById("config-navBreadcrumb-full")?.checked,s=!1!==document.getElementById("config-navToc-full")?.checked,c=document.getElementById("config-mermaidTheme-full")?.value||"default",d=!1!==document.getElementById("config-mermaidStart-full")?.checked,g=!1!==document.getElementById("config-mermaidMaxWidth-full")?.checked,m=document.getElementById("config-plantumlServer-full")?.value||"https://www.plantuml.com/plantuml",u=document.getElementById("config-plantumlFormat-full")?.value||"svg",f=document.getElementById("config-prismTheme-full")?.value||"default",p=!1!==document.getElementById("config-prismAutoload-full")?.checked,h=document.getElementById("config-uiTheme-full")?.value||"default",v=!1!==document.getElementById("config-uiResponsive-full")?.checked,b=!1!==document.getElementById("config-uiAnimations-full")?.checked;this.config.title=e,this.config.defaultPage=t,this.config.baseUrl=o,this.config.locales=n,this.config.fallbackLocale=a,this.config.showGallery=i,this.config.navigation={showHome:l,showBreadcrumb:r,showToc:s},this.config.mermaid={theme:c,startOnLoad:d,flowchart:{useMaxWidth:g},sequence:{useMaxWidth:g},gantt:{useMaxWidth:g},journey:{useMaxWidth:g}},this.config.plantuml={server:m,format:u},this.config.prism={theme:f,autoload:p},this.config.ui={theme:h,responsive:v,animations:b},document.title=this.config.title,this.showNotification("Configuration appliquée avec succès ! 🎉"),console.log("Configuration mise à jour:",this.config)}resetConfigToDefaults(){var e;confirm("Voulez-vous vraiment réinitialiser toute la configuration aux valeurs par défaut ?")&&(Object.assign(this.config,{title:"OntoWave Documentation",baseUrl:"/",defaultPage:"index.md",locales:[],fallbackLocale:"en",showGallery:!1,mermaid:{theme:"default",startOnLoad:!0,flowchart:{useMaxWidth:!0},sequence:{useMaxWidth:!0},gantt:{useMaxWidth:!0},journey:{useMaxWidth:!0}},plantuml:{server:"https://www.plantuml.com/plantuml",format:"svg"},prism:{theme:"default",autoload:!0},navigation:{showHome:!0,showBreadcrumb:!0,showToc:!0},ui:{theme:"default",responsive:!0,animations:!0}}),(e=document.getElementById("ontowave-config-panel"))&&(e.remove(),"function"==typeof d.ontowaveUpdateDragState&&d.ontowaveUpdateDragState(),setTimeout(()=>this.toggleConfigurationPanel(),100)),this.showNotification("Configuration réinitialisée ! 🔄"))}updateConfigFromPanel(){var e=document.getElementById("config-title-mini")?.value||this.config.title,t=document.getElementById("config-locales-mini")?.value.split(",").map(e=>e.trim()).filter(e=>0<e.length)||this.config.locales,o=document.getElementById("config-showGallery-mini")?.checked||this.config.showGallery;this.config.title=e,this.config.locales=t,this.config.showGallery=o,document.title=this.config.title,this.updateGeneratedCodeMini(),this.showNotification("✅ Configuration mise à jour")}downloadConfigFromPanel(){var e={title:this.config.title,baseUrl:this.config.baseUrl,defaultPage:this.config.defaultPage,locales:this.config.locales,fallbackLocale:this.config.fallbackLocale,showGallery:this.config.showGallery,mermaid:{theme:this.config.mermaid.theme}},e=JSON.stringify(e,null,2),e=`<!DOCTYPE html>
1023
1144
  <html>
1024
1145
  <head>
1025
1146
  <meta charset="UTF-8">
@@ -1337,4 +1458,4 @@ ${e}
1337
1458
  max-height: 300px;
1338
1459
  overflow-y: auto;
1339
1460
  }
1340
- `,document.head.appendChild(e))}navigate(e){this.loadPage(e)}getConfig(){return{...this.config}}updateConfig(e){this.config={...this.config,...e},console.log("📝 Configuration updated")}}async function i(){try{var e,t=await fetch("./config.json");if(t.ok)return e=await t.json(),console.log("📁 Configuration chargée depuis config.json:",e),e}catch(e){console.log("📁 Pas de config.json trouvé, utilisation de la configuration par défaut")}return{}}document.addEventListener("DOMContentLoaded",async()=>{let e=d.OntoWaveConfig||{};e=d.OntoWaveConfig?{...await i(),...d.OntoWaveConfig}:await i(),d.OntoWave={instance:new n(e)},await d.OntoWave.instance.init(),console.log("🌊 OntoWave initialisé automatiquement")}),d.OntoWaveClass=n})(window);
1461
+ `,document.head.appendChild(e))}navigate(e){this.loadPage(e)}getConfig(){return{...this.config}}updateConfig(e){this.config={...this.config,...e},console.log("📝 Configuration updated")}}async function a(){try{var e,t=await fetch("./config.json");if(t.ok)return e=await t.json(),console.log("📁 Configuration chargée depuis config.json:",e),e}catch(e){console.log("📁 Pas de config.json trouvé, utilisation de la configuration par défaut")}return{}}document.addEventListener("DOMContentLoaded",async()=>{let e=d.OntoWaveConfig||{};e=d.OntoWaveConfig?{...await a(),...d.OntoWaveConfig}:await a(),d.OntoWave={instance:new n(e)},await d.OntoWave.instance.init(),console.log("🌊 OntoWave initialisé automatiquement")}),d.OntoWaveClass=n})(window);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ontowave",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "Lightweight JavaScript library for creating interactive documentation from Markdown with multilingual support, Prism syntax highlighting, Mermaid diagrams, and PlantUML rendering",
5
5
  "main": "dist/ontowave.js",
6
6
  "unpkg": "dist/ontowave.min.js",