@ilo-org/twig 0.2.24 → 0.2.26

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.
@@ -1,9 +1,9 @@
1
1
 
2
- > @ilo-org/twig@0.2.24 build:lib /home/runner/work/designsystem/designsystem/packages/twig
2
+ > @ilo-org/twig@0.2.26 build:lib /home/runner/work/designsystem/designsystem/packages/twig
3
3
  > node importprefix.js && node importsvgs.js && pnpm output
4
4
 
5
5
  theme prefix added
6
6
 
7
- > @ilo-org/twig@0.2.24 output /home/runner/work/designsystem/designsystem/packages/twig
7
+ > @ilo-org/twig@0.2.26 output /home/runner/work/designsystem/designsystem/packages/twig
8
8
  > node outputtwigs.js
9
9
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @ilo-org/twig
2
2
 
3
+ ## 0.2.26
4
+
5
+ ### Patch Changes
6
+
7
+ - 4dd7f57a5: Add an if statement to all Drupal.behaviors to avoid calling js functions more than once.
8
+ - 44ff8b6db: Add responsive image structure to card images. Add loading attribute for card images and image component.
9
+
10
+ ## 0.2.25
11
+
12
+ ### Patch Changes
13
+
14
+ - 48900c9ac: Add an if statement to all Drupal.behaviors to avoid calling js functions more than once.
15
+
3
16
  ## 0.2.24
4
17
 
5
18
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ilo-org/twig",
3
- "version": "0.2.24",
3
+ "version": "0.2.26",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Twig components for the ILO's Design System",
6
6
  "main": "",
@@ -5,9 +5,12 @@ Drupal.behaviors.breadcrumb = {
5
5
  Array.prototype.forEach.call(
6
6
  document.querySelectorAll(`[data-loadcomponent="Breadcrumb"]`),
7
7
  (element) => {
8
- // eslint-disable-next-line no-console
9
- console.log("loading Breadcrumb component....");
10
- new Breadcrumb(element);
8
+ if(!element.dataset.jsProcessed) {
9
+ // eslint-disable-next-line no-console
10
+ console.log("loading Breadcrumb component....");
11
+ new Breadcrumb(element);
12
+ element.dataset.jsProcessed = true;
13
+ }
11
14
  }
12
15
  );
13
16
  },
@@ -5,9 +5,12 @@ Drupal.behaviors.callout = {
5
5
  Array.prototype.forEach.call(
6
6
  document.querySelectorAll(`[data-loadcomponent="Callout"]`),
7
7
  (element) => {
8
- // eslint-disable-next-line no-console
9
- console.log("loading Callout component....");
10
- new Callout(element);
8
+ if(!element.dataset.jsProcessed) {
9
+ // eslint-disable-next-line no-console
10
+ console.log("loading Callout component....");
11
+ new Callout(element);
12
+ element.dataset.jsProcessed = true;
13
+ }
11
14
  }
12
15
  );
13
16
  },
@@ -12,7 +12,14 @@
12
12
  {% if image %}
13
13
  <div class="{{prefix}}--card--image--wrapper">
14
14
  {% block card_image %}
15
- <picture><img class="{{prefix}}--card--image" src="{{image}}" alt="{{title}}"></picture>
15
+ <picture>
16
+ {% for img in url|reverse %}
17
+ {% if loop.last == false %}
18
+ <source srcset="{{img.src}}" media="(min-width: {{img.breakpoint}}px)">
19
+ {% endif %}
20
+ {% endfor %}
21
+ <img class="{{prefix}}--card--image" src="{{url|reverse|last.src}}" alt="{{alt}}" {% if loading %}loading="{{ loading }}"{% endif %}>
22
+ </picture>
16
23
  {% endblock %}
17
24
  </div>
18
25
  {% endif %}
@@ -26,7 +33,14 @@
26
33
  {% if type == "multilink" or type == "data" and image %}
27
34
  <div class="{{prefix}}--card--image--wrapper">
28
35
  {% block card_image_multilink_or_data %}
29
- <picture><img class="{{prefix}}--card--image" src="{{image}}" alt="{{title}}"></picture>
36
+ <picture>
37
+ {% for img in url|reverse %}
38
+ {% if loop.last == false %}
39
+ <source srcset="{{img.src}}" media="(min-width: {{img.breakpoint}}px)">
40
+ {% endif %}
41
+ {% endfor %}
42
+ <img class="{{prefix}}--card--image" src="{{url|reverse|last.src}}" alt="{{alt}}" {% if loading %}loading="{{ loading }}"{% endif %}>
43
+ </picture>
30
44
  {% endblock %}
31
45
  </div>
32
46
  {% endif %}
@@ -9,7 +9,7 @@
9
9
  <source srcset="{{img.src}}" media="(min-width: {{img.breakpoint}}px)">
10
10
  {% endif %}
11
11
  {% endfor %}
12
- <img src="{{url|reverse|last.src}}" alt="{{alt}}">
12
+ <img src="{{url|reverse|last.src}}" alt="{{alt}}" {% if loading %}loading="{{ loading }}"{% endif %}>
13
13
  </picture>
14
14
  {% if not ishero or ishero =='false' %}
15
15
  {% if credit %}
@@ -20,6 +20,15 @@ image:
20
20
  description: string
21
21
  preview: "© Marcel Crozet/ILO"
22
22
  required: true
23
+ loading:
24
+ type: string
25
+ label: Loading
26
+ description: The loading attribute for the image
27
+ required: false
28
+ preview: "lazy"
29
+ options:
30
+ Lazy: lazy
31
+ Eager: eager
23
32
  url:
24
33
  type: object
25
34
  label: URL
@@ -5,9 +5,12 @@ Drupal.behaviors.loading = {
5
5
  Array.prototype.forEach.call(
6
6
  document.querySelectorAll(`[data-loadcomponent="Loading"]`),
7
7
  (element) => {
8
- // eslint-disable-next-line no-console
9
- console.log("loading Loading component....");
10
- new Loading(element);
8
+ if(!element.dataset.jsProcessed) {
9
+ // eslint-disable-next-line no-console
10
+ console.log("loading Loading component....");
11
+ new Loading(element);
12
+ element.dataset.jsProcessed = true;
13
+ }
11
14
  }
12
15
  );
13
16
  },
@@ -5,9 +5,12 @@ Drupal.behaviors.modal = {
5
5
  Array.prototype.forEach.call(
6
6
  document.querySelectorAll(`[data-loadcomponent="Modal"]`),
7
7
  (element) => {
8
- // eslint-disable-next-line no-console
9
- console.log("loading Modal component....");
10
- new Modal(element);
8
+ if(!element.dataset.jsProcessed) {
9
+ // eslint-disable-next-line no-console
10
+ console.log("loading Modal component....");
11
+ new Modal(element);
12
+ element.dataset.jsProcessed = true;
13
+ }
11
14
  }
12
15
  );
13
16
  },
@@ -5,9 +5,12 @@ Drupal.behaviors.navigation = {
5
5
  Array.prototype.forEach.call(
6
6
  document.querySelectorAll(`[data-loadcomponent="Navigation"]`),
7
7
  (element) => {
8
- // eslint-disable-next-line no-console
9
- console.log("loading Navigation component....");
10
- new Navigation(element);
8
+ if(!element.dataset.jsProcessed) {
9
+ // eslint-disable-next-line no-console
10
+ console.log("loading Navigation component....");
11
+ new Navigation(element);
12
+ element.dataset.jsProcessed = true;
13
+ }
11
14
  }
12
15
  );
13
16
  },
@@ -6,9 +6,12 @@ Drupal.behaviors.notification = {
6
6
  Array.prototype.forEach.call(
7
7
  document.querySelectorAll(`[data-loadcomponent="Notification"]`),
8
8
  (element) => {
9
- // eslint-disable-next-line no-console
10
- console.log("loading Notification component....");
11
- new Notification(element);
9
+ if(!element.dataset.jsProcessed) {
10
+ // eslint-disable-next-line no-console
11
+ console.log("loading Notification component....");
12
+ new Notification(element);
13
+ element.dataset.jsProcessed = true;
14
+ }
12
15
  }
13
16
  );
14
17
  },
@@ -5,9 +5,12 @@ Drupal.behaviors.readmore = {
5
5
  Array.prototype.forEach.call(
6
6
  document.querySelectorAll(`[data-loadcomponent="ReadMore"]`),
7
7
  (element) => {
8
- // eslint-disable-next-line no-console
9
- console.log("loading ReadMore component....");
10
- new ReadMore(element);
8
+ if(!element.dataset.jsProcessed) {
9
+ // eslint-disable-next-line no-console
10
+ console.log("loading ReadMore component....");
11
+ new ReadMore(element);
12
+ element.dataset.jsProcessed = true;
13
+ }
11
14
  }
12
15
  );
13
16
  },
@@ -5,9 +5,12 @@ Drupal.behaviors.table = {
5
5
  Array.prototype.forEach.call(
6
6
  document.querySelectorAll(`[data-loadcomponent="Table"]`),
7
7
  (element) => {
8
- // eslint-disable-next-line no-console
9
- console.log("loading Table component....");
10
- new Table(element);
8
+ if(!element.dataset.jsProcessed) {
9
+ // eslint-disable-next-line no-console
10
+ console.log("loading Table component....");
11
+ new Table(element);
12
+ element.dataset.jsProcessed = true;
13
+ }
11
14
  }
12
15
  );
13
16
  },
@@ -5,9 +5,12 @@ Drupal.behaviors.tableofcontents = {
5
5
  Array.prototype.forEach.call(
6
6
  document.querySelectorAll(`[data-loadcomponent="TableOfContents"]`),
7
7
  (element) => {
8
- // eslint-disable-next-line no-console
9
- console.log("loading TableOfContents component....");
10
- new TableOfContents(element);
8
+ if(!element.dataset.jsProcessed) {
9
+ // eslint-disable-next-line no-console
10
+ console.log("loading TableOfContents component....");
11
+ new TableOfContents(element);
12
+ element.dataset.jsProcessed = true;
13
+ }
11
14
  }
12
15
  );
13
16
  },
@@ -6,17 +6,23 @@ Drupal.behaviors.tabs = {
6
6
  Array.prototype.forEach.call(
7
7
  document.querySelectorAll(`[data-loadcomponent="Tabs"]`),
8
8
  (element) => {
9
- // eslint-disable-next-line no-console
10
- console.log("loading Tabs component....");
11
- new Tabs(element);
9
+ if(!element.dataset.jsProcessed) {
10
+ // eslint-disable-next-line no-console
11
+ console.log("loading Tabs component....");
12
+ new Tabs(element);
13
+ element.dataset.jsProcessed = true;
14
+ }
12
15
  }
13
16
  );
14
17
  Array.prototype.forEach.call(
15
18
  document.querySelectorAll(`[data-loadcomponent="Tooltip"]`),
16
19
  (element) => {
17
- // eslint-disable-next-line no-console
18
- console.log("loading Tooltip component....");
19
- new Tooltip(element);
20
+ if(!element.dataset.jsProcessed) {
21
+ // eslint-disable-next-line no-console
22
+ console.log("loading Tooltip component....");
23
+ new Tooltip(element);
24
+ element.dataset.jsProcessed = true;
25
+ }
20
26
  }
21
27
  );
22
28
  },
@@ -5,9 +5,12 @@ Drupal.behaviors.tag = {
5
5
  Array.prototype.forEach.call(
6
6
  document.querySelectorAll(`[data-loadcomponent="Tag"]`),
7
7
  (element) => {
8
- // eslint-disable-next-line no-console
9
- console.log("loading Tag component....");
10
- new Tag(element);
8
+ if(!element.dataset.jsProcessed) {
9
+ // eslint-disable-next-line no-console
10
+ console.log("loading Tag component....");
11
+ new Tag(element);
12
+ element.dataset.jsProcessed = true;
13
+ }
11
14
  }
12
15
  );
13
16
  },
@@ -5,9 +5,12 @@ Drupal.behaviors.tooltip = {
5
5
  Array.prototype.forEach.call(
6
6
  document.querySelectorAll(`[data-loadcomponent="Tooltip"]`),
7
7
  (element) => {
8
- // eslint-disable-next-line no-console
9
- console.log("loading Tooltip component....");
10
- new Tooltip(element);
8
+ if(!element.dataset.jsProcessed) {
9
+ // eslint-disable-next-line no-console
10
+ console.log("loading Tooltip component....");
11
+ new Tooltip(element);
12
+ element.dataset.jsProcessed = true;
13
+ }
11
14
  }
12
15
  );
13
16
  },
@@ -5,9 +5,12 @@ Drupal.behaviors.media = {
5
5
  Array.prototype.forEach.call(
6
6
  document.querySelectorAll(`[data-loadcomponent="Video"]`),
7
7
  (element) => {
8
- // eslint-disable-next-line no-console
9
- console.log("loading Video component....");
10
- new Video(element);
8
+ if(!element.dataset.jsProcessed) {
9
+ // eslint-disable-next-line no-console
10
+ console.log("loading Video component....");
11
+ new Video(element);
12
+ element.dataset.jsProcessed = true;
13
+ }
11
14
  }
12
15
  );
13
16
  },