@iris.interactive/handcook 7.2.2-beta → 8.0.0-alpha.2

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.
Files changed (60) hide show
  1. package/.gitlab-ci.yml +2 -2
  2. package/.nvmrc +1 -1
  3. package/.stylelintrc +89 -0
  4. package/README.md +1 -1
  5. package/biome.json +43 -0
  6. package/package.json +35 -40
  7. package/public/index.css +1 -0
  8. package/public/index.html +33 -36
  9. package/public/index.js +240 -0
  10. package/public/scripts/components/collapse/collapse.component.js +1 -82
  11. package/public/scripts/components/collapse/collapse.component.scss +4 -4
  12. package/public/scripts/components/dropdown/dropdown.component.js +1 -68
  13. package/public/scripts/components/lazyload/lazyload.component.js +1 -48
  14. package/public/scripts/components/lightbox/lightbox.component.js +1 -78
  15. package/public/scripts/components/modal/modal.component.js +1 -70
  16. package/public/scripts/components/nats/nats.component.js +1 -49
  17. package/public/scripts/components/overlay/overlay.component.js +1 -88
  18. package/public/scripts/components/popin/popin.component.js +1 -137
  19. package/public/scripts/components/scroll-reveal/scroll-reveal.component.js +1 -155
  20. package/public/scripts/components/scrollspy/scrollspy.component.js +1 -93
  21. package/public/scripts/components/share/share.component.js +1 -51
  22. package/public/scripts/components/slider/slider.component.js +1 -312
  23. package/public/scripts/components/smooth-scroll/smooth-scroll.component.js +1 -45
  24. package/public/scripts/components/tab/tab.component.js +1 -69
  25. package/public/scripts/components/toggle/toggle.component.js +1 -38
  26. package/public/scripts/components/tooltip/tooltip.component.js +1 -106
  27. package/public/scripts/enumerators/element.enum.js +1 -27
  28. package/public/scripts/enumerators/share.enum.js +1 -6
  29. package/public/scripts/enumerators/smooth-scroll.enum.js +1 -6
  30. package/public/scripts/enumerators/tooltip.enum.js +1 -12
  31. package/public/scripts/handcook.js +1 -36
  32. package/public/scripts/hc_swiper_v11.js +5 -0
  33. package/public/scripts/libraries/swiper-11/index.js +7 -0
  34. package/public/scripts/libraries/swiper-8/index.js +7 -0
  35. package/public/scripts/support/cookie.support.js +1 -22
  36. package/public/scripts/support/hash.support.js +1 -11
  37. package/public/scripts/support/toggle-html.support.js +1 -5
  38. package/public/scripts/support/wrap-select.support.js +1 -3
  39. package/public/styles/hc_swiper_v11.css +1 -0
  40. package/public/styles/hc_swiper_v11.js +1 -0
  41. package/public/styles/scss/_utils.scss +21 -17
  42. package/public/styles/scss/handcook.scss +5 -5
  43. package/public/styles/scss/mixins/_mixin-font.scss +19 -6
  44. package/public/styles/scss/mixins/_mixin-layout.scss +10 -7
  45. package/public/styles/scss/mixins/_mixin-style.scss +63 -60
  46. package/public/styles/scss/style.css +1 -172
  47. package/mix-manifest.json +0 -57
  48. package/public/scripts/components/collapse/collapse.component.min.js +0 -1
  49. package/public/scripts/components/dropdown/dropdown.component.min.js +0 -1
  50. package/public/scripts/components/lazyload/lazyload.component.min.js +0 -1
  51. package/public/scripts/components/lightbox/lightbox.component.min.js +0 -1
  52. package/public/scripts/components/modal/modal.component.min.js +0 -1
  53. package/public/scripts/components/scrollspy/scrollspy.component.min.js +0 -1
  54. package/public/scripts/components/slider/slider.component.min.js +0 -1
  55. package/public/scripts/components/smooth-scroll/smooth-scroll.component.min.js +0 -1
  56. package/public/scripts/components/tab/tab.component.min.js +0 -1
  57. package/public/scripts/components/toggle/toggle.component.min.js +0 -1
  58. package/public/scripts/components/tooltip/tooltip.component.min.js +0 -1
  59. package/public/scripts/index.js.LICENSE.txt +0 -1
  60. package/public/styles/style.css +0 -28
@@ -11,85 +11,4 @@
11
11
  * @author Lucas ROCHE
12
12
  * @date 21/02/2022 17:30
13
13
  * @copyright Copyright (c) 2002-2022 IRIS Interactive, Inc. (http://www.iris-interactive.fr)
14
- */
15
-
16
- import ElementEnum from "../../enumerators/element.enum";
17
- import "./collapse.component.scss";
18
- import Collapse from "bootstrap/js/src/collapse";
19
-
20
- export class HcCollapse {
21
-
22
- showEvent;
23
- shownEvent;
24
- hideEvent;
25
- hiddenEvent;
26
-
27
- constructor(elements = ElementEnum.collapse, type = "collapse") {
28
- this.createEvent();
29
- const collapseElementList = [].slice.call(document.querySelectorAll(elements));
30
- const collapseList = collapseElementList.map(function (collapseElement) {
31
- const parent = collapseElement.getAttribute('data-hc-collapse-parent');
32
- let option = {
33
- toggle: false
34
- };
35
- if (parent !== null) {
36
- option.parent = parent;
37
- }
38
- return new Collapse(collapseElement, option);
39
- });
40
- collapseList.map(function (collapse) {
41
- document.querySelectorAll(`[data-hc-collapse-trigger="${collapse._element.getAttribute("data-hc-collapse")}"]`).forEach(trigger => {
42
- const handleTriggerAction = (e) => {
43
- e.preventDefault();
44
- collapse.toggle();
45
- };
46
- trigger.addEventListener('click', handleTriggerAction);
47
- trigger.addEventListener('keydown', (e) => {
48
- if (e.which == 13 ) {
49
- handleTriggerAction(e);
50
- }
51
- });
52
- });
53
- });
54
- document.querySelectorAll('[data-hc-collapse]').forEach(trigger => {
55
- const triggerEls = document.querySelectorAll(`[data-hc-collapse-trigger="${trigger.getAttribute('id')}"]`);
56
- trigger.addEventListener('hide.bs.collapse', (e) => {
57
- triggerEls.forEach(triggerEl => {
58
- if (triggerEl.classList.contains('active')) {
59
- triggerEl.classList.remove('active');
60
- }
61
- triggerEl.setAttribute('aria-expanded', 'false');
62
- });
63
- trigger.dispatchEvent(this.hideEvent);
64
- });
65
- trigger.addEventListener('hidden.bs.collapse', (e) => {
66
- trigger.dispatchEvent(this.hiddenEvent);
67
- });
68
- trigger.addEventListener('show.bs.collapse', (e) => {
69
- triggerEls.forEach(triggerEl => {
70
- if (!triggerEl.classList.contains('active')) {
71
- triggerEl.classList.add('active');
72
- }
73
- triggerEl.setAttribute('aria-expanded', 'true');
74
- });
75
- trigger.dispatchEvent(this.showEvent);
76
- });
77
- trigger.addEventListener('shown.bs.collapse', (e) => {
78
- trigger.dispatchEvent(this.shownEvent);
79
- });
80
- });
81
- }
82
-
83
- createEvent() {
84
- this.showEvent = new Event("show.hc.collapse");
85
- this.shownEvent = new Event("shown.hc.collapse");
86
- this.hideEvent = new Event("hide.hc.collapse");
87
- this.hiddenEvent = new Event("hidden.hc.collapse");
88
- }
89
-
90
- }
91
-
92
- const hc_collapse = function (trigger) {
93
- return new HcCollapse(trigger);
94
- };
95
- export default hc_collapse;
14
+ */import e from"../../enumerators/element.enum";import"./collapse.component.scss";import t from"bootstrap/js/src/collapse";export class HcCollapse{showEvent;shownEvent;hideEvent;hiddenEvent;constructor(s=e.collapse,l="collapse"){for(let e of(this.createEvent(),[].slice.call(document.querySelectorAll(s)).map(e=>{let s=e.getAttribute("data-hc-collapse-parent"),l={toggle:!1};return null!==s&&(l.parent=s),new t(e,l)}).map(e=>{for(let t of document.querySelectorAll(`[data-hc-collapse-trigger="${e._element.getAttribute("data-hc-collapse")}"]`)){let s=t=>{t.preventDefault(),e.toggle()};t.addEventListener("click",s),t.addEventListener("keydown",e=>{13===e.which&&s(e)})}}),document.querySelectorAll("[data-hc-collapse-trigger]"))){let t=document.querySelectorAll(`[data-hc-collapse-trigger="${e.getAttribute("id")}"]`);e.addEventListener("hide.bs.collapse",s=>{for(let e of t)e.classList.contains("active")&&e.classList.remove("active"),e.setAttribute("aria-expanded","false");e.dispatchEvent(this.hideEvent)}),e.addEventListener("hidden.bs.collapse",t=>{e.dispatchEvent(this.hiddenEvent)}),e.addEventListener("show.bs.collapse",s=>{for(let e of t)e.classList.contains("active")||e.classList.add("active"),e.setAttribute("aria-expanded","true");e.dispatchEvent(this.showEvent)}),e.addEventListener("shown.bs.collapse",t=>{e.dispatchEvent(this.shownEvent)})}}createEvent(){this.showEvent=new Event("show.hc.collapse"),this.shownEvent=new Event("shown.hc.collapse"),this.hideEvent=new Event("hide.hc.collapse"),this.hiddenEvent=new Event("hidden.hc.collapse")}}let hc_collapse=e=>new HcCollapse(e);export default hc_collapse;
@@ -13,7 +13,7 @@
13
13
  * @copyright Copyright (c) 2002-2022 IRIS Interactive, Inc. (http://www.iris-interactive.fr)
14
14
  */
15
15
 
16
- @import "~bootstrap/scss/functions";
17
- @import "~bootstrap/scss/variables";
18
- @import "~bootstrap/scss/mixins";
19
- @import "~bootstrap/scss/transitions";
16
+ @import "bootstrap/scss/functions";
17
+ @import "bootstrap/scss/variables";
18
+ @import "bootstrap/scss/mixins";
19
+ @import "bootstrap/scss/transitions";
@@ -11,71 +11,4 @@
11
11
  * @author Lucas ROCHE
12
12
  * @date 21/02/2022 10:14
13
13
  * @copyright Copyright (c) 2002-2022 IRIS Interactive, Inc. (http://www.iris-interactive.fr)
14
- */
15
-
16
-
17
- import ElementEnum from "../../enumerators/element.enum";
18
- import tippy, {hideAll} from "tippy.js";
19
- import "tippy.js/dist/tippy.css";
20
- import "./dropdown.component.scss";
21
-
22
- export class HcDropdown {
23
-
24
- showEvent;
25
- shownEvent;
26
- hideEvent;
27
- hiddenEvent;
28
-
29
- constructor(elements = ElementEnum.dropdown) {
30
-
31
- window.hc_dropdown = window.hc_dropdown || [];
32
-
33
- this.createEvent();
34
- document.querySelectorAll(elements).forEach(element => {
35
-
36
- const template = document.querySelector(element.dataset.hcDropdownMenu);
37
- const tippyObject = tippy(element, {
38
- trigger: 'click',
39
- allowHTML: true,
40
- content: template.innerHTML,
41
- arrow: false,
42
- placement: "bottom",
43
- theme: "dropdown",
44
- interactive: true,
45
- onShow: (instance) => {
46
- instance.reference.dispatchEvent(this.showEvent)
47
- },
48
- onShown: (instance) => {
49
- instance.reference.dispatchEvent(this.shownEvent)
50
- },
51
- onHide: (instance) => {
52
- instance.reference.dispatchEvent(this.hideEvent)
53
- },
54
- onHidden: (instance) => {
55
- instance.reference.dispatchEvent(this.hiddenEvent)
56
- },
57
- });
58
- window.hc_dropdown.push(tippyObject);
59
- });
60
- }
61
-
62
- static hideAll() {
63
- if (window.hc_dropdown !== undefined) {
64
- window.hc_dropdown.forEach( instance => {
65
- instance.hide();
66
- } )
67
- }
68
- }
69
-
70
- createEvent() {
71
- this.showEvent = new Event('show.hc.dropdown');
72
- this.shownEvent = new Event('shown.hc.dropdown');
73
- this.hideEvent = new Event('hide.hc.dropdown');
74
- this.hiddenEvent = new Event('hidden.hc.dropdown');
75
- }
76
- }
77
-
78
- const hc_dropdown = function (trigger) {
79
- return new HcDropdown(trigger);
80
- }
81
- export default hc_dropdown;
14
+ */import e,{hideAll as n}from"tippy.js";import o from"../../enumerators/element.enum";import"tippy.js/dist/tippy.css";import"./dropdown.component.scss";export class HcDropdown{showEvent;shownEvent;hideEvent;hiddenEvent;constructor(n=o.dropdown){for(let o of(window.hc_dropdown=window.hc_dropdown||[],this.createEvent(),n)){let n=document.querySelector(o.dataset.hcDropdownMenu),t=e(o,{trigger:"click",allowHTML:!0,content:n.innerHTML,arrow:!1,placement:"bottom",theme:"dropdown",interactive:!0,onShow:e=>{e.reference.dispatchEvent(this.showEvent)},onShown:e=>{e.reference.dispatchEvent(this.shownEvent)},onHide:e=>{e.reference.dispatchEvent(this.hideEvent)},onHidden:e=>{e.reference.dispatchEvent(this.hiddenEvent)}});window.hc_dropdown.push(t)}}static hideAll(){if(void 0!==window.hc_dropdown)for(let e of window.hc_dropdown)e.hide()}createEvent(){this.showEvent=new Event("show.hc.dropdown"),this.shownEvent=new Event("shown.hc.dropdown"),this.hideEvent=new Event("hide.hc.dropdown"),this.hiddenEvent=new Event("hidden.hc.dropdown")}}let hc_dropdown=e=>new HcDropdown(e);export default hc_dropdown;
@@ -11,51 +11,4 @@
11
11
  * @author Lucas ROCHE
12
12
  * @date 22/02/2022 14:16
13
13
  * @copyright Copyright (c) 2002-2022 IRIS Interactive, Inc. (http://www.iris-interactive.fr)
14
- */
15
-
16
-
17
- import LazyLoad from "vanilla-lazyload";
18
-
19
- export class HcLazyload {
20
-
21
- static instance;
22
-
23
- constructor(options = {}) {
24
- options = Object.assign({
25
- elements_selector: '[data-hc-src], [data-hc-bg], [data-hc-bg-hidpi], [data-hc-srcset]',
26
- data_src: 'hc-src',
27
- data_bg: 'hc-bg',
28
- data_bg_hidpi: 'hc-bg-hidpi',
29
- data_srcset: 'hc-srcset'
30
- }, options);
31
-
32
- this.lazyLoadInstance = new LazyLoad(options);
33
- }
34
-
35
- static getInstance(options = {}) {
36
- if (!HcLazyload.instance) {
37
- HcLazyload.instance = new HcLazyload(options);
38
- }
39
- return HcLazyload.instance.lazyLoadInstance;
40
- }
41
-
42
- static update(options = {}) {
43
- const instance = HcLazyload.getInstance(options);
44
- if (instance && typeof instance.update === 'function') {
45
- instance.update();
46
- }
47
- }
48
-
49
- static loadAll(options = {}) {
50
- const instance = HcLazyload.getInstance(options);
51
- if (instance && typeof instance.loadAll === 'function') {
52
- instance.loadAll();
53
- }
54
- }
55
- }
56
-
57
- const hc_lazyload = function (options = {}) {
58
- return HcLazyload.getInstance(options);
59
- }
60
-
61
- export default hc_lazyload;
14
+ */import a from"vanilla-lazyload";export class HcLazyload{static instance;constructor(t={}){let c=Object.assign({elements_selector:"[data-hc-src], [data-hc-bg], [data-hc-bg-hidpi], [data-hc-srcset]",data_src:"hc-src",data_bg:"hc-bg",data_bg_hidpi:"hc-bg-hidpi",data_srcset:"hc-srcset"},t);this.lazyLoadInstance=new a(c)}static getInstance(a={}){return HcLazyload.instance||(HcLazyload.instance=new HcLazyload(a)),HcLazyload.instance.lazyLoadInstance}static update(a={}){let t=HcLazyload.getInstance(a);t&&"function"==typeof t.update&&t.update()}static loadAll(a={}){let t=HcLazyload.getInstance(a);t&&"function"==typeof t.loadAll&&t.loadAll()}}let hc_lazyload=(a={})=>HcLazyload.getInstance(a);export default hc_lazyload;
@@ -11,81 +11,4 @@
11
11
  * @author Lucas ROCHE
12
12
  * @date 21/02/2022 09:57
13
13
  * @copyright Copyright (c) 2002-2022 IRIS Interactive, Inc. (http://www.iris-interactive.fr)
14
- */
15
-
16
- import {Fancybox} from "@fancyapps/ui";
17
- import '@fancyapps/ui/dist/fancybox.css';
18
- import "./lightbox.component.scss";
19
- import ElementEnum from "../../enumerators/element.enum";
20
-
21
- export class HcLightbox {
22
-
23
- constructor(elements = ElementEnum.lightbox, options = {}) {
24
- if (elements === ElementEnum.lightbox) {
25
- Object.assign(options, {
26
- groupAttr: ElementEnum.lightboxAttr,
27
- l10n: this.getTranslation()
28
- });
29
- }
30
- Fancybox.bind(elements, options);
31
-
32
- this.attachEventToShowButton();
33
- }
34
-
35
- attachEventToShowButton() {
36
- document.querySelectorAll("[data-hc-lightbox-show]").forEach(trigger => {
37
- trigger.addEventListener('click', (e) => {
38
- e.preventDefault();
39
- document.querySelector(trigger.getAttribute('href') + ' img').click();
40
- });
41
- })
42
- }
43
-
44
- getTranslation() {
45
- const lang = document.querySelector('html')?.getAttribute('lang');
46
-
47
- if ( typeof lang == "string" && lang.indexOf('fr-FR') !== false) {
48
- return {
49
- CLOSE: "Fermer",
50
- NEXT: "Suivant",
51
- PREV: "Précédent",
52
- MODAL: "Vous pouvez fermer la modal avec la touche echap",
53
- ERROR: "Quelque chose c'est mal passé. Merci d'essayer plus tard\n",
54
- IMAGE_ERROR: "Image introuvable",
55
- ELEMENT_NOT_FOUND: "Élement HTML introuvable",
56
- AJAX_NOT_FOUND: "Erreur de chargement AJAX : Introuvable",
57
- AJAX_FORBIDDEN: "Erreur de chargement AJAX : Interdit",
58
- IFRAME_ERROR: "Erreur du chargement de la page",
59
- TOGGLE_ZOOM: "Zoome/dezoome",
60
- TOGGLE_THUMBS: "Affiche/cache les miniatures",
61
- TOGGLE_SLIDESHOW: "Active/désactive le défilement automatique",
62
- TOGGLE_FULLSCREEN: "Bascule le mode plein écran",
63
- DOWNLOAD: "Télécharger",
64
- };
65
- }
66
-
67
- return {
68
- CLOSE: "Close",
69
- NEXT: "Next",
70
- PREV: "Previous",
71
- MODAL: "You can close this modal content with the ESC key",
72
- ERROR: "Something Went Wrong, Please Try Again Later",
73
- IMAGE_ERROR: "Image Not Found",
74
- ELEMENT_NOT_FOUND: "HTML Element Not Found",
75
- AJAX_NOT_FOUND: "Error Loading AJAX : Not Found",
76
- AJAX_FORBIDDEN: "Error Loading AJAX : Forbidden",
77
- IFRAME_ERROR: "Error Loading Page",
78
- TOGGLE_ZOOM: "Toggle zoom level",
79
- TOGGLE_THUMBS: "Toggle thumbnails",
80
- TOGGLE_SLIDESHOW: "Toggle slideshow",
81
- TOGGLE_FULLSCREEN: "Toggle full-screen mode",
82
- DOWNLOAD: "Download",
83
- };
84
- }
85
- }
86
-
87
- const hc_lightbox = function (trigger = ElementEnum.lightbox, options = {}) {
88
- return new HcLightbox(trigger, options);
89
- }
90
-
91
- export default hc_lightbox;
14
+ */import{Fancybox as e}from"@fancyapps/ui";import"@fancyapps/ui/dist/fancybox.css";import"./lightbox.component.scss";import t from"../../enumerators/element.enum";export class HcLightbox{constructor(o=t.lightbox,r={}){o===t.lightbox&&Object.assign(r,{groupAttr:t.lightboxAttr,l10n:this.getTranslation()}),e.bind(o,r),this.attachEventToShowButton()}attachEventToShowButton(){for(let e of document.querySelectorAll("[data-hc-lightbox-show]"))e.addEventListener("click",t=>{t.preventDefault(),document.querySelector(`${e.getAttribute("href")} img`).click()})}getTranslation(){let e=document.querySelector("html")?.getAttribute("lang");return"string"==typeof e&&!1!==e.indexOf("fr-FR")?{CLOSE:"Fermer",NEXT:"Suivant",PREV:"Pr\xe9c\xe9dent",MODAL:"Vous pouvez fermer la modal avec la touche echap",ERROR:"Quelque chose c'est mal pass\xe9. Merci d'essayer plus tard\n",IMAGE_ERROR:"Image introuvable",ELEMENT_NOT_FOUND:"\xc9lement HTML introuvable",AJAX_NOT_FOUND:"Erreur de chargement AJAX : Introuvable",AJAX_FORBIDDEN:"Erreur de chargement AJAX : Interdit",IFRAME_ERROR:"Erreur du chargement de la page",TOGGLE_ZOOM:"Zoome/dezoome",TOGGLE_THUMBS:"Affiche/cache les miniatures",TOGGLE_SLIDESHOW:"Active/d\xe9sactive le d\xe9filement automatique",TOGGLE_FULLSCREEN:"Bascule le mode plein \xe9cran",DOWNLOAD:"T\xe9l\xe9charger"}:{CLOSE:"Close",NEXT:"Next",PREV:"Previous",MODAL:"You can close this modal content with the ESC key",ERROR:"Something Went Wrong, Please Try Again Later",IMAGE_ERROR:"Image Not Found",ELEMENT_NOT_FOUND:"HTML Element Not Found",AJAX_NOT_FOUND:"Error Loading AJAX : Not Found",AJAX_FORBIDDEN:"Error Loading AJAX : Forbidden",IFRAME_ERROR:"Error Loading Page",TOGGLE_ZOOM:"Toggle zoom level",TOGGLE_THUMBS:"Toggle thumbnails",TOGGLE_SLIDESHOW:"Toggle slideshow",TOGGLE_FULLSCREEN:"Toggle full-screen mode",DOWNLOAD:"Download"}}}let hc_lightbox=(e=t.lightbox,o={})=>new HcLightbox(e,o);export default hc_lightbox;
@@ -11,73 +11,4 @@
11
11
  * @author Lucas ROCHE
12
12
  * @date 01/02/2022 11:01
13
13
  * @copyright Copyright (c) 2002-2022 IRIS Interactive, Inc. (http://www.iris-interactive.fr)
14
- */
15
-
16
- import ElementEnum from "../../enumerators/element.enum";
17
- import {Fancybox} from "@fancyapps/ui";
18
- import '@fancyapps/ui/dist/fancybox.css';
19
- import './modal.component.scss';
20
-
21
- export class HcModal {
22
-
23
- showEvent;
24
- hideEvent;
25
- options = {};
26
-
27
- constructor(elements = ElementEnum.modal, overrideOptions = {}) {
28
- this.createEvent();
29
- document.querySelectorAll(elements).forEach(element => {
30
- this.initOptions();
31
- Object.assign(this.options, overrideOptions);
32
- this.options.src = this.options.src != '' ? this.options.src : (element.hasAttribute('href') ? element.getAttribute('href') : (element.hasAttribute('data-src') ? element.dataset.src : ''));
33
- this.options.parentEl = this.options.parentEl !== null ? document.querySelector(this.options.parentEl) : (element.hasAttribute('data-hc-modal-parent') ? document.querySelector(element.getAttribute('data-hc-modal-parent')) : '');
34
- this.options.autoFocus = element.hasAttribute('data-hc-modal-autofocus') ? true : false;
35
-
36
- const item = `${ElementEnum.modal}[${element.hasAttribute('data-src') ? 'data-src' : 'href'}="${this.options.src}"]`;
37
- Fancybox.bind(item, Object.assign(this.options, {
38
- on: {
39
- done: () => {
40
- document.dispatchEvent(this.showEvent);
41
- },
42
- closing: () => {
43
- document.dispatchEvent(this.hideEvent);
44
- }
45
- }
46
- }));
47
- });
48
-
49
- document.querySelectorAll(ElementEnum.modalClose).forEach(element => {
50
- element.addEventListener('click', (e) => {
51
- e.preventDefault();
52
- const all = e.currentTarget.dataset.hcModalClose === "" ? true : e.currentTarget.dataset.hcModalClose;
53
- HcModal.close(all);
54
- });
55
- });
56
- }
57
-
58
- static show(options) {
59
- Fancybox.show([options]);
60
- }
61
-
62
- static close(all) {
63
- Fancybox.close(all);
64
- }
65
-
66
- initOptions() {
67
- this.options = {
68
- src: '',
69
- type: 'inline',
70
- parentEl: null
71
- };
72
- }
73
-
74
- createEvent() {
75
- this.showEvent = new Event("show.hc.modal");
76
- this.hideEvent = new Event("hide.hc.modal");
77
- }
78
- }
79
-
80
- const hc_modal = function (trigger, options) {
81
- return new HcModal(trigger, options);
82
- }
83
- export default hc_modal;
14
+ */import{Fancybox as t}from"@fancyapps/ui";import e from"../../enumerators/element.enum";import"@fancyapps/ui/dist/fancybox.css";import"./modal.component.scss";export class HcModal{showEvent;hideEvent;options={};constructor(o=e.modal,s={}){for(let a of(this.createEvent(),o)){this.initOptions(),Object.assign(this.options,s),this.options.src=""!==this.options.src?this.options.src:a.hasAttribute("href")?a.getAttribute("href"):a.hasAttribute("data-src")?a.dataset.src:"",this.options.parentEl=null!==this.options.parentEl?document.querySelector(this.options.parentEl):a.hasAttribute("data-hc-modal-parent")?document.querySelector(a.getAttribute("data-hc-modal-parent")):"",this.options.autoFocus=!!a.hasAttribute("data-hc-modal-autofocus");let o=`${e.modal}[${a.hasAttribute("data-src")?"data-src":"href"}="${this.options.src}"]`;t.bind(o,Object.assign(this.options,{on:{done:()=>{document.dispatchEvent(this.showEvent)},closing:()=>{document.dispatchEvent(this.hideEvent)}}}))}for(let t of e.modalClose)t.addEventListener("click",t=>{t.preventDefault();let e=""===t.currentTarget.dataset.hcModalClose||t.currentTarget.dataset.hcModalClose;HcModal.close(e)})}static show(e){t.show([e])}static close(e){t.close(e)}initOptions(){this.options={src:"",type:"inline",parentEl:null}}createEvent(){this.showEvent=new Event("show.hc.modal"),this.hideEvent=new Event("hide.hc.modal")}}let hc_modal=(t,e)=>new HcModal(t,e);export default hc_modal;
@@ -11,52 +11,4 @@
11
11
  * @author Nicolas PAYS
12
12
  * @date 10/10/2024 14:30
13
13
  * @copyright Copyright (c) 2002-2024 IRIS Interactive, Inc. (http://www.iris-interactive.fr)
14
- */
15
-
16
- import {wsconnect} from "@nats-io/nats-core";
17
-
18
- export class HcNats {
19
- static server = 'wss://nats.iris-interactive.fr:443';
20
-
21
- constructor() {
22
- }
23
-
24
- static async initialize() {
25
- try {
26
- window.natsConnection = await wsconnect({
27
- servers: this.server,
28
- name: 'IrisNatsSender',
29
- user: "irisinteractive",
30
- pass: "2G4cF4**#*72zBe5%HAmPc89"
31
- });
32
- } catch (_err) {
33
- console.log(`error connecting to ${JSON.stringify(_err)}`);
34
- }
35
- }
36
-
37
- async publishMessage(subject, content) {
38
- try {
39
- if( window.natsConnection === undefined ) {
40
- await HcNats.initialize();
41
- }
42
-
43
- const message = {
44
- lat: window.IRISCollectionTheme.coordinates.latitude,
45
- long: window.IRISCollectionTheme.coordinates.longitude,
46
- blogName : window.IRISCollectionTheme.blogInfos.blogName,
47
- blogUrl : window.IRISCollectionTheme.blogInfos.blogUrl,
48
- content: content
49
- }
50
-
51
- window.natsConnection.publish(subject, JSON.stringify(message));
52
- } catch (_err) {
53
- console.log(`error messaging to ${JSON.stringify(_err)}`);
54
- }
55
-
56
- }
57
- }
58
-
59
- const hc_nats = function () {
60
- return new HcNats();
61
- }
62
- export default hc_nats;
14
+ */import{wsconnect as t}from"@nats-io/nats-core";export class HcNats{static server="wss://nats.iris-interactive.fr:443";static async initialize(){try{window.natsConnection=await t({servers:HcNats.server,name:"IrisNatsSender",user:"irisinteractive",pass:"2G4cF4**#*72zBe5%HAmPc89"})}catch(t){console.log(`error connecting to ${JSON.stringify(t)}`)}}async publishMessage(t,e){try{void 0===window.natsConnection&&await HcNats.initialize();let n={lat:window.IRISCollectionTheme.coordinates.latitude,long:window.IRISCollectionTheme.coordinates.longitude,blogName:window.IRISCollectionTheme.blogInfos.blogName,blogUrl:window.IRISCollectionTheme.blogInfos.blogUrl,content:e};window.natsConnection.publish(t,JSON.stringify(n))}catch(t){console.log(`error messaging to ${JSON.stringify(t)}`)}}}let hc_nats=()=>new HcNats;export default hc_nats;
@@ -1,88 +1 @@
1
- import ElementEnum from "../../enumerators/element.enum";
2
- import './overlay.component.scss';
3
-
4
- export class HcOverlay {
5
-
6
- showEvent;
7
- hideEvent;
8
-
9
- constructor(elements = ElementEnum.overlay) {
10
- const HcOverlay = this;
11
- document.querySelectorAll(elements).forEach(element => {
12
- HcOverlay.createEvent(element);
13
-
14
- //Init class
15
- element.classList.add('hc-overlay-init');
16
-
17
- //Open triggers
18
- document.querySelectorAll('[data-hc-overlay-trigger]').forEach(open => {
19
- open.addEventListener('click', (e) => {
20
- let target = e.currentTarget.getAttribute('data-hc-overlay-trigger') ? e.currentTarget.getAttribute('data-hc-overlay-trigger'):e.currentTarget.getAttribute('href') ? e.currentTarget.getAttribute('href').substring(1):null;
21
- HcOverlay.show(document.getElementById(target));
22
- });
23
- });
24
-
25
- //Close triggers
26
- document.querySelectorAll('[data-hc-overlay-close]').forEach(close => {
27
- close.addEventListener('click', (e) => {
28
- e.preventDefault();
29
- let closeTarget = e.currentTarget.getAttribute('data-hc-overlay-close');
30
- if (closeTarget) {
31
- HcOverlay.close(document.getElementById(closeTarget));
32
- }
33
- });
34
- });
35
-
36
- //Close all overlays on background click
37
- document.querySelectorAll('[data-hc-overlay-background]').forEach(background => {
38
- background.addEventListener('click', (e) => {
39
- console.log('click');
40
- e.preventDefault();
41
- document.querySelectorAll(ElementEnum.overlay).forEach(overlay => {
42
- HcOverlay.close(overlay);
43
- })
44
- });
45
- });
46
-
47
- //Close all overlays on escape key
48
- document.onkeyup = function(event) {
49
- if (event.key === 'Escape') {
50
- document.querySelectorAll(ElementEnum.overlay).forEach(overlay => {
51
- HcOverlay.close(overlay);
52
- })
53
- }
54
- }
55
- });
56
- }
57
-
58
- show(element) {
59
- element.classList.add('hc-overlay-show');
60
- document.body.classList.add('hc-overlay-lock');
61
- document.dispatchEvent(this.showEvent);
62
- }
63
-
64
- close(element) {
65
- element.classList.remove('hc-overlay-show');
66
- document.body.classList.remove('hc-overlay-lock');
67
- document.dispatchEvent(this.hideEvent);
68
- }
69
-
70
- createEvent(element) {
71
- this.showEvent = new CustomEvent("show.hc.overlay", {
72
- detail: {
73
- element
74
- }
75
- });
76
-
77
- this.hideEvent = new CustomEvent("hide.hc.overlay", {
78
- detail: {
79
- element
80
- }
81
- });
82
- }
83
- }
84
-
85
- const hc_overlay = function (elements) {
86
- return new HcOverlay(elements);
87
- }
88
- export default hc_overlay;
1
+ import e from"../../enumerators/element.enum";import"./overlay.component.scss";export class HcOverlay{showEvent;hideEvent;constructor(t=e.overlay){for(let r of t){for(let e of(this.createEvent(r),r.classList.add("hc-overlay-init"),r.querySelectorAll("[data-hc-overlay-trigger]")))e.addEventListener("click",e=>{let t=e.currentTarget.getAttribute("data-hc-overlay-trigger")?e.currentTarget.getAttribute("data-hc-overlay-trigger"):e.currentTarget.getAttribute("href")?e.currentTarget.getAttribute("href").substring(1):null;this.show(document.getElementById(t))});for(let e of r.querySelectorAll("[data-hc-overlay-close]"))e.addEventListener("click",e=>{e.preventDefault();let t=e.currentTarget.getAttribute("data-hc-overlay-close");t&&this.close(document.getElementById(t))});for(let t of r.querySelectorAll("[data-hc-overlay-background]"))t.addEventListener("click",t=>{for(let r of(console.log("click"),t.preventDefault(),document.querySelectorAll(e.overlay)))this.close(r)});document.onkeyup=t=>{if("Escape"===t.key)for(let t of document.querySelectorAll(e.overlay))this.close(t)}}}show(e){e.classList.add("hc-overlay-show"),document.body.classList.add("hc-overlay-lock"),document.dispatchEvent(this.showEvent)}close(e){e.classList.remove("hc-overlay-show"),document.body.classList.remove("hc-overlay-lock"),document.dispatchEvent(this.hideEvent)}createEvent(e){this.showEvent=new CustomEvent("show.hc.overlay",{detail:{element:e}}),this.hideEvent=new CustomEvent("hide.hc.overlay",{detail:{element:e}})}}let hc_overlay=e=>new HcOverlay(e);export default hc_overlay;