@net7/boilerplate-muruca 5.5.13 → 5.5.18
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/esm2022/lib/data-sources/facets/facet-map.ds.mjs +7 -2
- package/esm2022/lib/data-sources/parallel-text-viewer.ds.mjs +97 -3
- package/fesm2022/net7-boilerplate-muruca.mjs +102 -3
- package/fesm2022/net7-boilerplate-muruca.mjs.map +1 -1
- package/lib/data-sources/parallel-text-viewer.ds.d.ts +4 -0
- package/package.json +1 -1
|
@@ -2745,6 +2745,20 @@ class MrParallelTextViewerDS extends DataSource {
|
|
|
2745
2745
|
// Attacca al primo caricamento
|
|
2746
2746
|
document.addEventListener('pb-end-update', attachListeners);
|
|
2747
2747
|
setTimeout(attachListeners, 500);
|
|
2748
|
+
// Cross-highlight per termini multi-@ana: quando un pb-highlight con key "vox2_vox3"
|
|
2749
|
+
// emette pb-highlight-on (hover sul termine o sulla tab aperta), ri-emettiamo pb-highlight-on
|
|
2750
|
+
// per ogni token individuale ("vox2", "vox3") così i termini correlati si evidenziano.
|
|
2751
|
+
document.addEventListener('pb-highlight-on', (ev) => {
|
|
2752
|
+
const key = ev.detail?.id;
|
|
2753
|
+
const channel = ev.detail?.key;
|
|
2754
|
+
if (key && key.includes('_')) {
|
|
2755
|
+
key.split('_').forEach((token) => {
|
|
2756
|
+
document.dispatchEvent(new CustomEvent('pb-highlight-on', {
|
|
2757
|
+
detail: { key: channel, id: token, source: ev.detail.source },
|
|
2758
|
+
}));
|
|
2759
|
+
});
|
|
2760
|
+
}
|
|
2761
|
+
});
|
|
2748
2762
|
}
|
|
2749
2763
|
onClick(payload) {
|
|
2750
2764
|
// console.log('🔵 onClick chiamato!', payload);
|
|
@@ -2762,6 +2776,7 @@ class MrParallelTextViewerDS extends DataSource {
|
|
|
2762
2776
|
// console.log('Chiusura dell\'elemento tei-app');
|
|
2763
2777
|
parentAppItem.style.display = 'none';
|
|
2764
2778
|
parentAppItem.style.transform = '';
|
|
2779
|
+
this.resetHighlights();
|
|
2765
2780
|
payload.stopPropagation();
|
|
2766
2781
|
return;
|
|
2767
2782
|
}
|
|
@@ -2783,6 +2798,7 @@ class MrParallelTextViewerDS extends DataSource {
|
|
|
2783
2798
|
// console.log('Chiusura dell\'elemento note-item');
|
|
2784
2799
|
parentNoteItem.style.display = 'none';
|
|
2785
2800
|
parentNoteItem.style.transform = '';
|
|
2801
|
+
this.resetHighlights();
|
|
2786
2802
|
payload.stopPropagation();
|
|
2787
2803
|
return;
|
|
2788
2804
|
}
|
|
@@ -2795,13 +2811,11 @@ class MrParallelTextViewerDS extends DataSource {
|
|
|
2795
2811
|
}
|
|
2796
2812
|
if (target && target.getAttribute('type') === 'app_lem') {
|
|
2797
2813
|
const appId = target.getAttribute('key');
|
|
2798
|
-
// console.log('appId:', appId);
|
|
2799
2814
|
// Posizione elemento cliccato
|
|
2800
2815
|
const clickedElementPosition = target.getBoundingClientRect().top;
|
|
2801
2816
|
const clickedView = clickPath.find((el) => el.id && el.id.endsWith('-view'));
|
|
2802
2817
|
const clickedViewId = clickedView ? clickedView.id : null;
|
|
2803
2818
|
const apparatusView = document.querySelectorAll('.n7-parallel-text-viewer [id$="-view"]');
|
|
2804
|
-
// console.log('Numero di view trovate:', apparatusView.length);
|
|
2805
2819
|
let anchorElement = null;
|
|
2806
2820
|
let teiAppElement = null;
|
|
2807
2821
|
apparatusView.forEach((view) => {
|
|
@@ -2824,9 +2838,33 @@ class MrParallelTextViewerDS extends DataSource {
|
|
|
2824
2838
|
});
|
|
2825
2839
|
if (teiAppElement) {
|
|
2826
2840
|
const isVisible = teiAppElement.style.display === 'block';
|
|
2841
|
+
// Determina se il pb-highlight cliccato è una cit esterna (contiene cit annidate).
|
|
2842
|
+
const nestedCits = target.querySelectorAll('span.quote');
|
|
2843
|
+
const isOuterCit = nestedCits.length > 0;
|
|
2844
|
+
const segElements = target.querySelectorAll('.seg-outer-inner');
|
|
2845
|
+
// console.log('[seg-outer-inner] click su:', target.getAttribute('key'), '| isOuterCit:', isOuterCit, '| seg trovati:', segElements.length, '| panel isVisible:', isVisible);
|
|
2846
|
+
// console.log(' nestedCits keys:', Array.from(nestedCits).map((el) => el.getAttribute('key')));
|
|
2847
|
+
// segElements.forEach((el, i) => {
|
|
2848
|
+
// console.log(` seg[${i}] backgroundColor attuale: "${(el as HTMLElement).style.backgroundColor}"`);
|
|
2849
|
+
// let node = (el as HTMLElement).parentElement;
|
|
2850
|
+
// const chain = [];
|
|
2851
|
+
// while (node && chain.length < 6) {
|
|
2852
|
+
// chain.push(`${node.tagName}${node.className ? '.' + node.className.replace(/\s+/g, '.') : ''}${node.getAttribute('key') ? '[key=' + node.getAttribute('key').substring(0, 20) + ']' : ''}`);
|
|
2853
|
+
// node = node.parentElement;
|
|
2854
|
+
// }
|
|
2855
|
+
// console.log(` seg[${i}] ancestors:`, chain.join(' > '));
|
|
2856
|
+
// });
|
|
2827
2857
|
if (isVisible) {
|
|
2828
2858
|
teiAppElement.style.display = 'none';
|
|
2829
2859
|
teiAppElement.style.transform = '';
|
|
2860
|
+
this.resetHighlights();
|
|
2861
|
+
if (isOuterCit) {
|
|
2862
|
+
// Pannello esterno chiuso: ripristina il background dei seg annidati
|
|
2863
|
+
segElements.forEach((el) => {
|
|
2864
|
+
el.style.backgroundColor = '';
|
|
2865
|
+
// console.log(' [outer CLOSE] seg backgroundColor → ""');
|
|
2866
|
+
});
|
|
2867
|
+
}
|
|
2830
2868
|
}
|
|
2831
2869
|
else {
|
|
2832
2870
|
teiAppElement.style.display = 'block';
|
|
@@ -2836,6 +2874,25 @@ class MrParallelTextViewerDS extends DataSource {
|
|
|
2836
2874
|
const positionDifference = clickedElementPosition - elementPosition;
|
|
2837
2875
|
// spostamento
|
|
2838
2876
|
teiAppElement.style.transform = `translateY(${positionDifference}px)`;
|
|
2877
|
+
if (isOuterCit) {
|
|
2878
|
+
// Pannello esterno aperto: dopo che pb-highlight si attiva (giallo),
|
|
2879
|
+
// imposta sfondo bianco sui seg che appartengono semanticamente alla cit esterna
|
|
2880
|
+
requestAnimationFrame(() => {
|
|
2881
|
+
segElements.forEach((el) => {
|
|
2882
|
+
el.style.backgroundColor = 'white';
|
|
2883
|
+
// console.log(' [outer OPEN rAF] seg backgroundColor → "white"');
|
|
2884
|
+
});
|
|
2885
|
+
});
|
|
2886
|
+
}
|
|
2887
|
+
else {
|
|
2888
|
+
// Pannello interno aperto: ripristina eventuali soppressioni sui seg interni
|
|
2889
|
+
requestAnimationFrame(() => {
|
|
2890
|
+
segElements.forEach((el) => {
|
|
2891
|
+
el.style.backgroundColor = '';
|
|
2892
|
+
// console.log(' [inner OPEN rAF] seg backgroundColor → ""');
|
|
2893
|
+
});
|
|
2894
|
+
});
|
|
2895
|
+
}
|
|
2839
2896
|
}
|
|
2840
2897
|
}
|
|
2841
2898
|
else {
|
|
@@ -2871,6 +2928,19 @@ class MrParallelTextViewerDS extends DataSource {
|
|
|
2871
2928
|
}
|
|
2872
2929
|
}
|
|
2873
2930
|
}
|
|
2931
|
+
else if (target && target.getAttribute('type') === 'parallel_anchor') {
|
|
2932
|
+
const sectionId = target.getAttribute('key');
|
|
2933
|
+
if (sectionId) {
|
|
2934
|
+
document.dispatchEvent(new CustomEvent('pb-toggle', {
|
|
2935
|
+
detail: {
|
|
2936
|
+
properties: { id: sectionId },
|
|
2937
|
+
action: 'refresh',
|
|
2938
|
+
key: 'transcription',
|
|
2939
|
+
},
|
|
2940
|
+
bubbles: true,
|
|
2941
|
+
}));
|
|
2942
|
+
}
|
|
2943
|
+
}
|
|
2874
2944
|
else if (target && target.getAttribute('key') && target.getAttribute('scrollview') !== null) {
|
|
2875
2945
|
// Per scroll su indice
|
|
2876
2946
|
const key = target.getAttribute('key');
|
|
@@ -2889,6 +2959,30 @@ class MrParallelTextViewerDS extends DataSource {
|
|
|
2889
2959
|
else
|
|
2890
2960
|
this.output.toggleColumn = false;
|
|
2891
2961
|
}
|
|
2962
|
+
/**
|
|
2963
|
+
* Resetta tutti gli highlight attivi del testo
|
|
2964
|
+
*/
|
|
2965
|
+
resetHighlights() {
|
|
2966
|
+
document.querySelectorAll('[id$="-view"]').forEach((view) => {
|
|
2967
|
+
if (!view.shadowRoot)
|
|
2968
|
+
return;
|
|
2969
|
+
const content = view.shadowRoot.getElementById('view') || view.shadowRoot;
|
|
2970
|
+
// console.log('[resetHighlights] processing view:', view.id, '| pb-highlights:', content.querySelectorAll('pb-highlight').length);
|
|
2971
|
+
// Rimuove il giallo e re-abilita tutti i pb-highlight
|
|
2972
|
+
content.querySelectorAll('pb-highlight').forEach((hl) => {
|
|
2973
|
+
hl._className = 'highlight-off';
|
|
2974
|
+
hl.disabled = false;
|
|
2975
|
+
});
|
|
2976
|
+
// Rimuove classe 'disable' da qualsiasi elemento (residuo da plain reading view)
|
|
2977
|
+
content.querySelectorAll('.disable').forEach((el) => {
|
|
2978
|
+
el.classList.remove('disable');
|
|
2979
|
+
});
|
|
2980
|
+
// Ripristina il background dei seg-outer-inner (potrebbe essere rimasto 'white'
|
|
2981
|
+
content.querySelectorAll('.seg-outer-inner').forEach((el) => {
|
|
2982
|
+
el.style.backgroundColor = '';
|
|
2983
|
+
});
|
|
2984
|
+
});
|
|
2985
|
+
}
|
|
2892
2986
|
viewListenerUpdate() {
|
|
2893
2987
|
document.addEventListener('pb-start-update', function _listener() {
|
|
2894
2988
|
document.removeEventListener('pb-start-update', _listener, true);
|
|
@@ -7350,6 +7444,8 @@ class FacetMapDS extends DataSource {
|
|
|
7350
7444
|
return this.MARKER_ICON_SELECTED;
|
|
7351
7445
|
if (counter > 0)
|
|
7352
7446
|
return this.MARKER_ICON;
|
|
7447
|
+
if (this.options.libOptions?.hideUnavailablePin)
|
|
7448
|
+
return null;
|
|
7353
7449
|
return this.MARKER_ICON_UNAVAILABLE;
|
|
7354
7450
|
};
|
|
7355
7451
|
this.getZindex = (id, counter) => {
|
|
@@ -7441,8 +7537,11 @@ class FacetMapDS extends DataSource {
|
|
|
7441
7537
|
});
|
|
7442
7538
|
markers.forEach(({ coords, template, id, slug, counter }) => {
|
|
7443
7539
|
// create custom icon marker
|
|
7540
|
+
const icon = this.getIcon(id, counter);
|
|
7541
|
+
if (!icon)
|
|
7542
|
+
return;
|
|
7444
7543
|
const newMarker = L.marker(coords, {
|
|
7445
|
-
icon
|
|
7544
|
+
icon,
|
|
7446
7545
|
zIndexOffset: this.getZindex(id, counter)
|
|
7447
7546
|
});
|
|
7448
7547
|
if (id && slug) {
|