@profitlich/template-toolkit 5.2.3 → 5.3.1

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.
@@ -15,7 +15,7 @@ export class Toolbar {
15
15
 
16
16
  constructor() {
17
17
  // State aus localStorage laden
18
- const defaults = { visible: false, grid: 'aus', imageSize: false, contentType: false };
18
+ const defaults = { visible: false, grid: 'aus', imageSize: false, sizes: false, contentType: false };
19
19
  const saved = localStorage.getItem('devTools');
20
20
  this.#state = saved ? { ...defaults, ...JSON.parse(saved) } : defaults;
21
21
 
@@ -42,7 +42,11 @@ export class Toolbar {
42
42
  this.#gui.add(this.#state, 'imageSize')
43
43
  .name('Bildgrössen')
44
44
  .onChange(() => this.#onStateChange());
45
-
45
+
46
+ this.#gui.add(this.#state, 'sizes')
47
+ .name('Sizes')
48
+ .onChange(() => this.#onStateChange());
49
+
46
50
  this.#gui.add(this.#state, 'contentType')
47
51
  .name('Inhaltstypen')
48
52
  .onChange(() => this.#onStateChange());
@@ -73,6 +77,7 @@ export class Toolbar {
73
77
  document.body.setAttribute('data-dev-grid', this.#state.grid);
74
78
  document.body.setAttribute('data-dev-content-types', this.#state.contentType);
75
79
  this.#updateImageSize();
80
+ this.#updateSizes();
76
81
  this.#updateContentTypeLabels();
77
82
  }
78
83
 
@@ -109,9 +114,35 @@ export class Toolbar {
109
114
  }
110
115
  }
111
116
 
117
+ #updateSizes() {
118
+ if (!this.#pictureElements) return;
119
+ const pictures = Array.from(this.#pictureElements);
120
+ if (this.#state.sizes) {
121
+ pictures.forEach((picture) => {
122
+ const sizes = picture.querySelector('img')?.getAttribute('sizes');
123
+ if (!sizes) {
124
+ picture.setAttribute('data-dev-sizes', '');
125
+ return;
126
+ }
127
+ // Media-Conditions in Klammern entfernen, nur die Längenwerte behalten
128
+ const shortened = sizes
129
+ .split(',')
130
+ .map(part => part.replace(/\([^)]*\)/g, '').trim())
131
+ .filter(Boolean)
132
+ .join(' / ');
133
+ picture.setAttribute('data-dev-sizes', shortened);
134
+ });
135
+ } else {
136
+ pictures.forEach((picture) => {
137
+ picture.setAttribute('data-dev-sizes', '');
138
+ });
139
+ }
140
+ }
141
+
112
142
  #onResize = () => {
113
143
  this.#gui.title(this.#getViewportText());
114
144
  this.#updateImageSize();
145
+ this.#updateSizes();
115
146
  this.#updateContentTypeLabels();
116
147
  }
117
148
 
@@ -1,12 +1,16 @@
1
1
  @use "sass:map";
2
2
  @use "../../scss/forward" as *;
3
3
 
4
+ // lil-gui z-index
5
+ .lil-gui.lil-root {
6
+ z-index: 9999999;
7
+ }
8
+
4
9
  // grid
5
10
  $color--dev-grid: rgba(0, 0, 255, 0.5);
6
11
  $color--dev-grid-ribbons: rgba(191, 255, 254, 0.5);
7
12
  $color--dev-grid-center: rgba(0, 0, 0, 0.2);
8
13
 
9
-
10
14
  @mixin dev-toolbar-grid($layout, $columns, $gutter, $margin-left, $margin-right) {
11
15
 
12
16
  $gutter: size($layout, $gutter);
@@ -46,11 +50,6 @@ $color--dev-grid-center: rgba(0, 0, 0, 0.2);
46
50
  }
47
51
  }
48
52
 
49
- // lil-gui z-index
50
- .lil-gui.root {
51
- z-index: 9999999;
52
- }
53
-
54
53
  .dev-toolbar__grid {
55
54
  display: none;
56
55
  width: 100%;
@@ -97,6 +96,18 @@ picture {
97
96
  text-shadow: 0 0 10px black;
98
97
  z-index: 10;
99
98
  }
99
+
100
+ &::after{
101
+ content: attr(data-dev-sizes);
102
+ font-family: sans-serif;
103
+ position: absolute;
104
+ top: 34px;
105
+ left: 10px;
106
+ color: white;
107
+ font-size: 20px;
108
+ text-shadow: 0 0 10px black;
109
+ z-index: 10;
110
+ }
100
111
  }
101
112
 
102
113
  .dev-toolbar__content-types {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@profitlich/template-toolkit",
3
- "version": "5.2.3",
3
+ "version": "5.3.1",
4
4
  "description": "Shared SCSS layout system, JS utilities, components and build scripts for profitlich template repos",
5
5
  "type": "module",
6
6
  "sass": "scss/forward.scss",