wulf.js 2.1.1 → 2.2.0
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/README.md +217 -11
- package/changelog.md +50 -0
- package/dist/anchor.esm.js +9 -0
- package/dist/anchor.esm.js.map +7 -0
- package/dist/anchor.global.js +695 -0
- package/dist/anchor.global.js.map +7 -0
- package/dist/anchor.global.min.js +6 -0
- package/dist/anchor.global.min.js.map +7 -0
- package/dist/autosize.css +1 -0
- package/dist/autosize.css.map +7 -0
- package/dist/autosize.esm.js +10 -0
- package/dist/autosize.esm.js.map +7 -0
- package/dist/autosize.global.js +657 -0
- package/dist/autosize.global.js.map +7 -0
- package/dist/autosize.global.min.js +6 -0
- package/dist/autosize.global.min.js.map +7 -0
- package/dist/autosize.layered.css +1 -0
- package/dist/autosize.layered.css.map +7 -0
- package/dist/chunks/chunk-22AIMRD5.js +119 -0
- package/dist/chunks/chunk-22AIMRD5.js.map +7 -0
- package/dist/chunks/chunk-5N2IRGDM.js +766 -0
- package/dist/chunks/chunk-5N2IRGDM.js.map +7 -0
- package/dist/chunks/chunk-72FVCNNZ.js +863 -0
- package/dist/chunks/chunk-72FVCNNZ.js.map +7 -0
- package/dist/chunks/chunk-AXZYYW7H.js +865 -0
- package/dist/chunks/chunk-AXZYYW7H.js.map +7 -0
- package/dist/chunks/chunk-CM3SBIVQ.js +1116 -0
- package/dist/chunks/chunk-CM3SBIVQ.js.map +7 -0
- package/dist/chunks/chunk-H4GRLGQ3.js +578 -0
- package/dist/chunks/chunk-H4GRLGQ3.js.map +7 -0
- package/dist/chunks/chunk-ITRU2RFV.js +1195 -0
- package/dist/chunks/chunk-ITRU2RFV.js.map +7 -0
- package/dist/chunks/chunk-NLUQZEL4.js +1029 -0
- package/dist/chunks/chunk-NLUQZEL4.js.map +7 -0
- package/dist/chunks/chunk-QV46A7FV.js +197 -0
- package/dist/chunks/chunk-QV46A7FV.js.map +7 -0
- package/dist/chunks/chunk-SXLUXN6W.js +612 -0
- package/dist/chunks/chunk-SXLUXN6W.js.map +7 -0
- package/dist/chunks/chunk-T2H4EJCW.js +621 -0
- package/dist/chunks/chunk-T2H4EJCW.js.map +7 -0
- package/dist/chunks/chunk-TILLYEF2.js +6044 -0
- package/dist/chunks/chunk-TILLYEF2.js.map +7 -0
- package/dist/chunks/chunk-VJO22BAT.js +72 -0
- package/dist/chunks/chunk-VJO22BAT.js.map +7 -0
- package/dist/chunks/chunk-ZGUU6DMM.js +77 -0
- package/dist/chunks/chunk-ZGUU6DMM.js.map +7 -0
- package/dist/focus-trap.esm.js +6 -594
- package/dist/focus-trap.esm.js.map +3 -3
- package/dist/focus-trap.global.js +176 -61
- package/dist/focus-trap.global.js.map +3 -3
- package/dist/focus-trap.global.min.js +4 -4
- package/dist/focus-trap.global.min.js.map +4 -4
- package/dist/index.esm.js +79 -10448
- package/dist/index.esm.js.map +4 -4
- package/dist/index.global.js +3660 -202
- package/dist/index.global.js.map +4 -4
- package/dist/index.global.min.js +6 -3
- package/dist/index.global.min.js.map +4 -4
- package/dist/mask.esm.js +16 -6094
- package/dist/mask.esm.js.map +4 -4
- package/dist/mask.global.js +44 -55
- package/dist/mask.global.js.map +3 -3
- package/dist/mask.global.min.js +3 -3
- package/dist/mask.global.min.js.map +4 -4
- package/dist/masonry.esm.js +15 -1158
- package/dist/masonry.esm.js.map +4 -4
- package/dist/masonry.global.js +84 -94
- package/dist/masonry.global.js.map +3 -3
- package/dist/masonry.global.min.js +4 -4
- package/dist/masonry.global.min.js.map +4 -4
- package/dist/scroll.css +1 -1
- package/dist/scroll.css.map +2 -2
- package/dist/scroll.esm.js +14 -1252
- package/dist/scroll.esm.js.map +3 -3
- package/dist/scroll.global.js +64 -58
- package/dist/scroll.global.js.map +3 -3
- package/dist/scroll.global.min.js +3 -3
- package/dist/scroll.global.min.js.map +4 -4
- package/dist/scroll.layered.css +1 -1
- package/dist/scroll.layered.css.map +2 -2
- package/dist/shortcut.esm.js +6 -901
- package/dist/shortcut.esm.js.map +4 -4
- package/dist/shortcut.global.js +43 -36
- package/dist/shortcut.global.js.map +3 -3
- package/dist/shortcut.global.min.js +6 -3
- package/dist/shortcut.global.min.js.map +4 -4
- package/dist/size-report.json +319 -0
- package/dist/sortable.css +1 -0
- package/dist/sortable.css.map +7 -0
- package/dist/sortable.esm.js +22 -0
- package/dist/sortable.esm.js.map +7 -0
- package/dist/sortable.global.js +1477 -0
- package/dist/sortable.global.js.map +7 -0
- package/dist/sortable.global.min.js +6 -0
- package/dist/sortable.global.min.js.map +7 -0
- package/dist/sortable.layered.css +1 -0
- package/dist/sortable.layered.css.map +7 -0
- package/dist/sri-manifest.json +64 -0
- package/dist/toast.css +1 -1
- package/dist/toast.css.map +2 -2
- package/dist/toast.esm.js +19 -1208
- package/dist/toast.esm.js.map +3 -3
- package/dist/toast.global.js +314 -111
- package/dist/toast.global.js.map +3 -3
- package/dist/toast.global.min.js +3 -3
- package/dist/toast.global.min.js.map +4 -4
- package/dist/toast.layered.css +1 -1
- package/dist/toast.layered.css.map +2 -2
- package/dist/types/anchor/Anchor.d.ts +41 -0
- package/dist/types/anchor/index.d.ts +3 -0
- package/dist/types/anchor/types.d.ts +115 -0
- package/dist/types/autosize/Autosize.d.ts +71 -0
- package/dist/types/autosize/index.d.ts +3 -0
- package/dist/types/autosize/types.d.ts +66 -0
- package/dist/types/common/AuditableComponent.d.ts +1 -1
- package/dist/types/common/registry.d.ts +40 -0
- package/dist/types/focus-trap/FocusTrap.d.ts +3 -1
- package/dist/types/index.d.ts +13 -1
- package/dist/types/scroll/types.d.ts +6 -0
- package/dist/types/shortcut/ShortcutManager.d.ts +2 -0
- package/dist/types/shortcut/types.d.ts +5 -0
- package/dist/types/sortable/Sortable.d.ts +75 -0
- package/dist/types/sortable/i18n/en.d.ts +2 -0
- package/dist/types/sortable/i18n/fr.d.ts +2 -0
- package/dist/types/sortable/i18n/index.d.ts +9 -0
- package/dist/types/sortable/i18n/types.d.ts +15 -0
- package/dist/types/sortable/index.d.ts +4 -0
- package/dist/types/sortable/types.d.ts +112 -0
- package/dist/types/toast/Toast.d.ts +6 -1
- package/dist/types/toast/ToastInstance.d.ts +7 -0
- package/dist/types/toast/ToastManager.d.ts +2 -2
- package/dist/types/toast/types.d.ts +27 -1
- package/dist/types/undo/UndoManager.d.ts +112 -0
- package/dist/types/undo/i18n/en.d.ts +2 -0
- package/dist/types/undo/i18n/fr.d.ts +2 -0
- package/dist/types/undo/i18n/index.d.ts +9 -0
- package/dist/types/undo/i18n/types.d.ts +6 -0
- package/dist/types/undo/index.d.ts +5 -0
- package/dist/types/undo/types.d.ts +106 -0
- package/dist/undo.esm.js +23 -0
- package/dist/undo.esm.js.map +7 -0
- package/dist/undo.global.js +1029 -0
- package/dist/undo.global.js.map +7 -0
- package/dist/undo.global.min.js +6 -0
- package/dist/undo.global.min.js.map +7 -0
- package/package.json +54 -5
package/dist/masonry.esm.js
CHANGED
|
@@ -1,1166 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
let active = (root ?? document).activeElement;
|
|
16
|
-
while (active && active.shadowRoot && active.shadowRoot.activeElement) {
|
|
17
|
-
active = active.shadowRoot.activeElement;
|
|
18
|
-
}
|
|
19
|
-
return active && typeof active.focus === "function" ? active : null;
|
|
20
|
-
}
|
|
21
|
-
function parseCssDurationMs(duration, fallbackMs = 300, maxMs = 6e4) {
|
|
22
|
-
const safeFallback = Number.isFinite(fallbackMs) && fallbackMs >= 0 ? Math.min(fallbackMs, maxMs) : 300;
|
|
23
|
-
if (typeof duration === "number") {
|
|
24
|
-
return Number.isFinite(duration) && duration >= 0 ? Math.min(duration, maxMs) : safeFallback;
|
|
25
|
-
}
|
|
26
|
-
if (typeof duration === "string") {
|
|
27
|
-
const parts = duration.split(",");
|
|
28
|
-
let maxParsed = -1;
|
|
29
|
-
for (const part of parts) {
|
|
30
|
-
const match = /^\+?(\d+(?:\.\d+)?|\.\d+)(ms|s)?$/i.exec(part.trim());
|
|
31
|
-
if (match) {
|
|
32
|
-
const raw = parseFloat(match[1]);
|
|
33
|
-
if (Number.isFinite(raw) && raw >= 0) {
|
|
34
|
-
const ms = match[2]?.toLowerCase() === "s" ? raw * 1e3 : raw;
|
|
35
|
-
if (ms > maxParsed) {
|
|
36
|
-
maxParsed = ms;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
if (maxParsed >= 0) {
|
|
42
|
-
return Math.min(maxParsed, maxMs);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
return safeFallback;
|
|
46
|
-
}
|
|
47
|
-
function prefersReducedMotion() {
|
|
48
|
-
return typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
49
|
-
}
|
|
50
|
-
function waitForAnimations(element, fallbackMs, signal) {
|
|
51
|
-
const safeFallback = Number.isFinite(fallbackMs) ? Math.min(fallbackMs, 6e4) : 300;
|
|
52
|
-
if (signal?.aborted || safeFallback <= 0 || prefersReducedMotion()) {
|
|
53
|
-
return Promise.resolve();
|
|
54
|
-
}
|
|
55
|
-
const animations = typeof element.getAnimations === "function" ? element.getAnimations().filter((a) => {
|
|
56
|
-
if (a.playState !== "running") return false;
|
|
57
|
-
const timing = a.effect?.getComputedTiming?.();
|
|
58
|
-
return timing ? Number.isFinite(timing.endTime) : true;
|
|
59
|
-
}) : [];
|
|
60
|
-
if (animations.length === 0) {
|
|
61
|
-
return Promise.resolve();
|
|
62
|
-
}
|
|
63
|
-
return new Promise((resolve) => {
|
|
64
|
-
let settled = false;
|
|
65
|
-
let timerId = null;
|
|
66
|
-
const finish = () => {
|
|
67
|
-
if (settled) return;
|
|
68
|
-
settled = true;
|
|
69
|
-
if (timerId !== null) {
|
|
70
|
-
clearTimeout(timerId);
|
|
71
|
-
timerId = null;
|
|
72
|
-
}
|
|
73
|
-
signal?.removeEventListener("abort", finish);
|
|
74
|
-
resolve();
|
|
75
|
-
};
|
|
76
|
-
signal?.addEventListener("abort", finish, { once: true });
|
|
77
|
-
timerId = setTimeout(finish, safeFallback);
|
|
78
|
-
Promise.allSettled(animations.map((a) => a.finished)).then(finish);
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
// src/masonry/LayoutEngine.ts
|
|
83
|
-
var LayoutEngine = class {
|
|
84
|
-
/**
|
|
85
|
-
* Normalise les gouttières horizontales et verticales.
|
|
86
|
-
*/
|
|
87
|
-
static parseGutter(gutterOption) {
|
|
88
|
-
if (typeof gutterOption === "number") {
|
|
89
|
-
const v = Number.isFinite(gutterOption) ? Math.max(0, gutterOption) : 0;
|
|
90
|
-
return { x: v, y: v };
|
|
91
|
-
}
|
|
92
|
-
if (gutterOption && typeof gutterOption === "object") {
|
|
93
|
-
const rawX = Number(gutterOption.x);
|
|
94
|
-
const rawY = Number(gutterOption.y);
|
|
95
|
-
return {
|
|
96
|
-
x: Number.isFinite(rawX) ? Math.max(0, rawX) : 0,
|
|
97
|
-
y: Number.isFinite(rawY) ? Math.max(0, rawY) : 0
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
return { x: 0, y: 0 };
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Résout la largeur effective d'une colonne en pixels.
|
|
104
|
-
*/
|
|
105
|
-
static resolveColumnWidth(container, firstItem, columnWidthOption) {
|
|
106
|
-
if (typeof columnWidthOption === "number" && Number.isFinite(columnWidthOption) && columnWidthOption > 0) {
|
|
107
|
-
return columnWidthOption;
|
|
108
|
-
}
|
|
109
|
-
if (typeof columnWidthOption === "string") {
|
|
110
|
-
const trimmed = columnWidthOption.trim();
|
|
111
|
-
if (/^\d+(\.\d+)?(px|%)?$/i.test(trimmed)) {
|
|
112
|
-
const parsed = parseFloat(trimmed);
|
|
113
|
-
if (Number.isFinite(parsed) && parsed > 0) {
|
|
114
|
-
if (trimmed.endsWith("%")) {
|
|
115
|
-
const containerW2 = container.getBoundingClientRect().width;
|
|
116
|
-
const resolvedPct = containerW2 * parsed / 100;
|
|
117
|
-
if (resolvedPct > 0) return resolvedPct;
|
|
118
|
-
} else {
|
|
119
|
-
return parsed;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
} else if (trimmed) {
|
|
123
|
-
let el = null;
|
|
124
|
-
try {
|
|
125
|
-
el = container.querySelector(trimmed);
|
|
126
|
-
} catch {
|
|
127
|
-
el = null;
|
|
128
|
-
}
|
|
129
|
-
if (el) {
|
|
130
|
-
const w = el.getBoundingClientRect().width;
|
|
131
|
-
if (Number.isFinite(w) && w > 0) return w;
|
|
132
|
-
}
|
|
133
|
-
const parsed = parseFloat(trimmed);
|
|
134
|
-
if (Number.isFinite(parsed) && parsed > 0) {
|
|
135
|
-
return parsed;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
if (columnWidthOption instanceof HTMLElement) {
|
|
140
|
-
const w = columnWidthOption.getBoundingClientRect().width;
|
|
141
|
-
if (w > 0) return w;
|
|
142
|
-
}
|
|
143
|
-
if (firstItem) {
|
|
144
|
-
const w = firstItem.getBoundingClientRect().width;
|
|
145
|
-
if (w > 0) return w;
|
|
146
|
-
}
|
|
147
|
-
const containerW = container.getBoundingClientRect().width;
|
|
148
|
-
return containerW > 0 ? containerW : 200;
|
|
149
|
-
}
|
|
150
|
-
/**
|
|
151
|
-
* Extrait le facteur d'étalement (span) d'un item sur plusieurs colonnes.
|
|
152
|
-
*/
|
|
153
|
-
static getItemSpan(item, colWidth, gutterX, maxCols) {
|
|
154
|
-
const dataSpan = item.getAttribute("data-masonry-span") || item.dataset.masonrySpan;
|
|
155
|
-
if (dataSpan) {
|
|
156
|
-
const parsed = parseInt(dataSpan, 10);
|
|
157
|
-
if (!isNaN(parsed) && parsed > 0) {
|
|
158
|
-
return Math.min(maxCols, parsed);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
for (const cls of item.classList) {
|
|
162
|
-
const match = /^(?:span|col-span)-(\d+)$/.exec(cls);
|
|
163
|
-
if (match && match[1]) {
|
|
164
|
-
const parsed = parseInt(match[1], 10);
|
|
165
|
-
if (!isNaN(parsed) && parsed > 0) {
|
|
166
|
-
return Math.min(maxCols, parsed);
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
return 1;
|
|
171
|
-
}
|
|
172
|
-
/**
|
|
173
|
-
* Calcule les positions optimales de tous les items.
|
|
174
|
-
*/
|
|
175
|
-
static calculate(container, items, options) {
|
|
176
|
-
const containerRect = container.getBoundingClientRect();
|
|
177
|
-
const containerWidth = containerRect.width;
|
|
178
|
-
const { x: gutterX, y: gutterY } = this.parseGutter(options.gutter);
|
|
179
|
-
if (containerWidth <= 0 || items.length === 0) {
|
|
180
|
-
return {
|
|
181
|
-
cols: 1,
|
|
182
|
-
colWidth: containerWidth,
|
|
183
|
-
gutterX,
|
|
184
|
-
gutterY,
|
|
185
|
-
containerHeight: 0,
|
|
186
|
-
containerWidth,
|
|
187
|
-
positions: []
|
|
188
|
-
};
|
|
189
|
-
}
|
|
190
|
-
const firstItem = items[0] || null;
|
|
191
|
-
let colWidth = this.resolveColumnWidth(container, firstItem, options.columnWidth);
|
|
192
|
-
const denom = colWidth + gutterX;
|
|
193
|
-
let cols = denom > 0 ? Math.floor((containerWidth + gutterX) / denom) : 1;
|
|
194
|
-
if (!Number.isFinite(cols) || cols < 1) {
|
|
195
|
-
cols = 1;
|
|
196
|
-
} else if (cols > 1e3) {
|
|
197
|
-
cols = 1e3;
|
|
198
|
-
}
|
|
199
|
-
if (!options.columnWidth && cols > 1) {
|
|
200
|
-
colWidth = (containerWidth - (cols - 1) * gutterX) / cols;
|
|
201
|
-
}
|
|
202
|
-
const fittedWidth = options.fitWidth ? cols * colWidth + (cols - 1) * gutterX : void 0;
|
|
203
|
-
const colHeights = new Array(cols).fill(0);
|
|
204
|
-
const positions = [];
|
|
205
|
-
const itemHeights = items.map((item) => {
|
|
206
|
-
const h = item.classList.contains("wulf-masonry-item--hidden") && item.offsetHeight > 0 ? item.offsetHeight : item.getBoundingClientRect().height;
|
|
207
|
-
return h > 0 ? h : 50;
|
|
208
|
-
});
|
|
209
|
-
const isRtl = typeof window !== "undefined" && typeof window.getComputedStyle === "function" && window.getComputedStyle(container).direction === "rtl";
|
|
210
|
-
let currentHCol = 0;
|
|
211
|
-
for (let i = 0; i < items.length; i++) {
|
|
212
|
-
const item = items[i];
|
|
213
|
-
const itemH = itemHeights[i];
|
|
214
|
-
const span = this.getItemSpan(item, colWidth, gutterX, cols);
|
|
215
|
-
let targetCol = 0;
|
|
216
|
-
let targetY = 0;
|
|
217
|
-
if (options.horizontalOrder) {
|
|
218
|
-
if (currentHCol + span > cols) {
|
|
219
|
-
currentHCol = 0;
|
|
220
|
-
}
|
|
221
|
-
targetCol = currentHCol;
|
|
222
|
-
let maxY = 0;
|
|
223
|
-
for (let s = 0; s < span; s++) {
|
|
224
|
-
if (colHeights[targetCol + s] > maxY) {
|
|
225
|
-
maxY = colHeights[targetCol + s];
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
targetY = maxY;
|
|
229
|
-
currentHCol = (targetCol + span) % cols;
|
|
230
|
-
} else {
|
|
231
|
-
if (span === 1) {
|
|
232
|
-
let minH = colHeights[0];
|
|
233
|
-
targetCol = 0;
|
|
234
|
-
for (let c = 1; c < cols; c++) {
|
|
235
|
-
if (colHeights[c] < minH) {
|
|
236
|
-
minH = colHeights[c];
|
|
237
|
-
targetCol = c;
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
targetY = minH;
|
|
241
|
-
} else {
|
|
242
|
-
let bestMax = Infinity;
|
|
243
|
-
targetCol = 0;
|
|
244
|
-
for (let c = 0; c <= cols - span; c++) {
|
|
245
|
-
let maxInSpan = 0;
|
|
246
|
-
for (let s = 0; s < span; s++) {
|
|
247
|
-
if (colHeights[c + s] > maxInSpan) {
|
|
248
|
-
maxInSpan = colHeights[c + s];
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
if (maxInSpan < bestMax) {
|
|
252
|
-
bestMax = maxInSpan;
|
|
253
|
-
targetCol = c;
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
targetY = bestMax;
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
const itemW = span * colWidth + (span - 1) * gutterX;
|
|
260
|
-
const effectiveWidth = fittedWidth !== void 0 ? fittedWidth : containerWidth;
|
|
261
|
-
const rawX = targetCol * (colWidth + gutterX);
|
|
262
|
-
const targetX = isRtl ? Math.max(0, effectiveWidth - rawX - itemW) : rawX;
|
|
263
|
-
positions.push({
|
|
264
|
-
element: item,
|
|
265
|
-
x: targetX,
|
|
266
|
-
y: targetY,
|
|
267
|
-
width: itemW,
|
|
268
|
-
height: itemH,
|
|
269
|
-
column: targetCol,
|
|
270
|
-
span
|
|
271
|
-
});
|
|
272
|
-
const nextY = targetY + itemH + gutterY;
|
|
273
|
-
for (let s = 0; s < span; s++) {
|
|
274
|
-
colHeights[targetCol + s] = nextY;
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
let maxColH = 0;
|
|
278
|
-
for (let c = 0; c < cols; c++) {
|
|
279
|
-
if (colHeights[c] > maxColH) {
|
|
280
|
-
maxColH = colHeights[c];
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
const containerHeight = Math.max(0, maxColH > 0 ? maxColH - gutterY : 0);
|
|
284
|
-
return {
|
|
285
|
-
cols,
|
|
286
|
-
colWidth,
|
|
287
|
-
gutterX,
|
|
288
|
-
gutterY,
|
|
289
|
-
containerHeight,
|
|
290
|
-
containerWidth,
|
|
291
|
-
fittedWidth,
|
|
292
|
-
positions
|
|
293
|
-
};
|
|
294
|
-
}
|
|
295
|
-
};
|
|
296
|
-
|
|
297
|
-
// src/common/AuditableComponent.ts
|
|
298
|
-
var AuditableComponent = class {
|
|
299
|
-
/**
|
|
300
|
-
* Indication affichée en pied de warning pour expliquer comment désactiver l'audit.
|
|
301
|
-
*/
|
|
302
|
-
getAuditDisableHint() {
|
|
303
|
-
return "Passez { audit: false } dans les options pour d\xE9sactiver cet avertissement";
|
|
304
|
-
}
|
|
305
|
-
/**
|
|
306
|
-
* Exécute l'audit d'accessibilité et émet un avertissement standardisé dans la console
|
|
307
|
-
* si l'audit est activé et que des contraintes manquent.
|
|
308
|
-
*/
|
|
309
|
-
runAuditWarning(enabled = true) {
|
|
310
|
-
if (!enabled) return [];
|
|
311
|
-
const warnings = this.audit();
|
|
312
|
-
if (warnings.length > 0 && typeof console !== "undefined" && typeof console.warn === "function") {
|
|
313
|
-
console.warn(
|
|
314
|
-
`[${this.getAuditPrefix()}] Audit d'accessibilit\xE9 \u2014 ${warnings.length} contrainte(s) manquante(s) sur ${this.getAuditTargetLabel()} :
|
|
315
|
-
` + warnings.map((w) => ` - ${w}`).join("\n") + `
|
|
316
|
-
(${this.getAuditDisableHint()})`
|
|
317
|
-
);
|
|
318
|
-
}
|
|
319
|
-
return warnings;
|
|
320
|
-
}
|
|
321
|
-
/**
|
|
322
|
-
* Vérifie si un attribut de référence d'IDs ARIA (ex: aria-labelledby, aria-describedby, aria-errormessage)
|
|
323
|
-
* pointe vers des éléments réellement présents dans le document (et optionnellement non vides).
|
|
324
|
-
*/
|
|
325
|
-
checkAriaIdReferences(element, attrName, warnings, requireNonEmptyText = false) {
|
|
326
|
-
const rawValue = element.getAttribute(attrName)?.trim();
|
|
327
|
-
if (!rawValue) return false;
|
|
328
|
-
const doc = element.ownerDocument || document;
|
|
329
|
-
const root = typeof element.getRootNode === "function" ? element.getRootNode() : doc;
|
|
330
|
-
const ids = rawValue.split(/\s+/).filter(Boolean);
|
|
331
|
-
const targets = ids.map(
|
|
332
|
-
(id) => typeof ShadowRoot !== "undefined" && root instanceof ShadowRoot ? root.getElementById(id) : doc.getElementById(id)
|
|
333
|
-
);
|
|
334
|
-
const allFound = ids.length > 0 && targets.every((el) => Boolean(el));
|
|
335
|
-
if (!allFound) {
|
|
336
|
-
warnings.push(
|
|
337
|
-
`Attribut ${attrName}="${rawValue}" invalide : l'\xE9l\xE9ment cible est introuvable dans le DOM.`
|
|
338
|
-
);
|
|
339
|
-
return false;
|
|
340
|
-
}
|
|
341
|
-
if (requireNonEmptyText) {
|
|
342
|
-
const hasNonEmptyText = targets.some((el) => {
|
|
343
|
-
if (!el) return false;
|
|
344
|
-
const text = el.textContent?.trim() || el.getAttribute("aria-label")?.trim() || "";
|
|
345
|
-
return text.length > 0;
|
|
346
|
-
});
|
|
347
|
-
if (!hasNonEmptyText) {
|
|
348
|
-
warnings.push(
|
|
349
|
-
`Attribut ${attrName}="${rawValue}" invalide : l'\xE9l\xE9ment cible ne contient aucun texte accessible.`
|
|
350
|
-
);
|
|
351
|
-
return false;
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
return true;
|
|
355
|
-
}
|
|
356
|
-
};
|
|
357
|
-
|
|
358
|
-
// src/common/LocalizedComponent.ts
|
|
359
|
-
var LocalizedComponent = class extends AuditableComponent {
|
|
360
|
-
static _i18n;
|
|
361
|
-
/**
|
|
362
|
-
* Définit la langue globale du composant (ex: 'fr', 'en', 'es').
|
|
363
|
-
*/
|
|
364
|
-
static setLocale(locale) {
|
|
365
|
-
if (this._i18n) {
|
|
366
|
-
this._i18n.setLocale(locale);
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
/**
|
|
370
|
-
* Retourne la langue globale active du composant.
|
|
371
|
-
*/
|
|
372
|
-
static getLocale() {
|
|
373
|
-
return this._i18n ? this._i18n.getLocale() : "";
|
|
374
|
-
}
|
|
375
|
-
/**
|
|
376
|
-
* Enregistre un dictionnaire de traduction pour une langue donnée.
|
|
377
|
-
*/
|
|
378
|
-
static registerLocale(locale, translations) {
|
|
379
|
-
if (this._i18n) {
|
|
380
|
-
this._i18n.registerLocale(locale, translations);
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
/**
|
|
384
|
-
* Surcharge les libellés globalement pour ce composant.
|
|
385
|
-
*/
|
|
386
|
-
static setI18n(overrides) {
|
|
387
|
-
if (this._i18n) {
|
|
388
|
-
this._i18n.setI18n(overrides);
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
/**
|
|
392
|
-
* Retourne l'ensemble des libellés actifs résolus du composant.
|
|
393
|
-
*/
|
|
394
|
-
static getI18n() {
|
|
395
|
-
return this._i18n ? this._i18n.getAll() : {};
|
|
396
|
-
}
|
|
397
|
-
/**
|
|
398
|
-
* Réinitialise les réglages de langue et surcharges globales.
|
|
399
|
-
*/
|
|
400
|
-
static resetI18n() {
|
|
401
|
-
if (this._i18n) {
|
|
402
|
-
this._i18n.reset();
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
/**
|
|
406
|
-
* Résout une clé au niveau statique de la classe.
|
|
407
|
-
*/
|
|
408
|
-
static t(key, instanceOverride) {
|
|
409
|
-
return this._i18n ? this._i18n.t(key, instanceOverride) : String(key);
|
|
410
|
-
}
|
|
411
|
-
/**
|
|
412
|
-
* Surcharges de localisation spécifiques à cette instance.
|
|
413
|
-
*/
|
|
414
|
-
i18nOverrides;
|
|
415
|
-
constructor(i18nOverrides) {
|
|
416
|
-
super();
|
|
417
|
-
this.i18nOverrides = i18nOverrides;
|
|
418
|
-
}
|
|
419
|
-
/**
|
|
420
|
-
* Traduit une clé en tenant compte automatiquement des surcharges de l'instance courante.
|
|
421
|
-
*/
|
|
422
|
-
t(key) {
|
|
423
|
-
const ctor = this.constructor;
|
|
424
|
-
return ctor._i18n ? ctor._i18n.t(key, this.i18nOverrides) : String(key);
|
|
425
|
-
}
|
|
426
|
-
};
|
|
427
|
-
|
|
428
|
-
// src/common/i18n.ts
|
|
429
|
-
var FORBIDDEN_KEYS = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
|
|
430
|
-
function isSafeKey(key) {
|
|
431
|
-
return Boolean(key) && !FORBIDDEN_KEYS.has(key);
|
|
432
|
-
}
|
|
433
|
-
function normalizeLocaleCode(locale) {
|
|
434
|
-
const norm = String(locale ?? "").trim().toLowerCase().replace(/_/g, "-");
|
|
435
|
-
return isSafeKey(norm) ? norm : "";
|
|
436
|
-
}
|
|
437
|
-
function getPrimaryLanguage(normalizedLocale) {
|
|
438
|
-
const dashIndex = normalizedLocale.indexOf("-");
|
|
439
|
-
const primary = dashIndex > 0 ? normalizedLocale.slice(0, dashIndex) : null;
|
|
440
|
-
return primary && isSafeKey(primary) ? primary : null;
|
|
441
|
-
}
|
|
442
|
-
function assignDefined(target, source) {
|
|
443
|
-
if (!source || typeof source !== "object") return target;
|
|
444
|
-
for (const key of Object.keys(source)) {
|
|
445
|
-
if (isSafeKey(String(key)) && Object.hasOwn(source, key) && source[key] !== void 0) {
|
|
446
|
-
target[key] = source[key];
|
|
447
|
-
}
|
|
448
|
-
}
|
|
449
|
-
return target;
|
|
450
|
-
}
|
|
451
|
-
function createI18nManager(defaultLocale, locales) {
|
|
452
|
-
const fallbackLocale = normalizeLocaleCode(defaultLocale) || "fr";
|
|
453
|
-
const initialLocales = /* @__PURE__ */ Object.create(null);
|
|
454
|
-
for (const [loc, dict] of Object.entries(locales)) {
|
|
455
|
-
const norm = normalizeLocaleCode(loc);
|
|
456
|
-
if (norm) {
|
|
457
|
-
initialLocales[norm] = assignDefined(/* @__PURE__ */ Object.create(null), dict);
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
let currentLocale = fallbackLocale;
|
|
461
|
-
let activeLocales = /* @__PURE__ */ Object.create(null);
|
|
462
|
-
for (const [loc, dict] of Object.entries(initialLocales)) {
|
|
463
|
-
activeLocales[loc] = assignDefined(/* @__PURE__ */ Object.create(null), dict);
|
|
464
|
-
}
|
|
465
|
-
let globalOverrides = /* @__PURE__ */ Object.create(null);
|
|
466
|
-
function resolveActiveDictionaries() {
|
|
467
|
-
const dicts = [];
|
|
468
|
-
if (isSafeKey(currentLocale)) {
|
|
469
|
-
const exact = activeLocales[currentLocale];
|
|
470
|
-
if (exact) dicts.push(exact);
|
|
471
|
-
}
|
|
472
|
-
const primary = getPrimaryLanguage(currentLocale);
|
|
473
|
-
if (primary && activeLocales[primary]) {
|
|
474
|
-
dicts.push(activeLocales[primary]);
|
|
475
|
-
}
|
|
476
|
-
return dicts;
|
|
477
|
-
}
|
|
478
|
-
return {
|
|
479
|
-
setLocale(locale) {
|
|
480
|
-
if (locale && typeof locale === "string" && locale.trim()) {
|
|
481
|
-
const norm = normalizeLocaleCode(locale);
|
|
482
|
-
if (norm) {
|
|
483
|
-
currentLocale = norm;
|
|
484
|
-
}
|
|
485
|
-
}
|
|
486
|
-
},
|
|
487
|
-
getLocale() {
|
|
488
|
-
return currentLocale;
|
|
489
|
-
},
|
|
490
|
-
registerLocale(locale, translations) {
|
|
491
|
-
if (!locale || typeof locale !== "string" || !locale.trim() || !translations) return;
|
|
492
|
-
const norm = normalizeLocaleCode(locale);
|
|
493
|
-
if (!norm) return;
|
|
494
|
-
const base = assignDefined(/* @__PURE__ */ Object.create(null), activeLocales[norm]);
|
|
495
|
-
activeLocales[norm] = assignDefined(base, translations);
|
|
496
|
-
},
|
|
497
|
-
setI18n(overrides) {
|
|
498
|
-
if (!overrides || typeof overrides !== "object") return;
|
|
499
|
-
const base = assignDefined(/* @__PURE__ */ Object.create(null), globalOverrides);
|
|
500
|
-
globalOverrides = assignDefined(base, overrides);
|
|
501
|
-
},
|
|
502
|
-
t(key, instanceOverride) {
|
|
503
|
-
if (!isSafeKey(String(key))) {
|
|
504
|
-
return "";
|
|
505
|
-
}
|
|
506
|
-
if (instanceOverride && typeof instanceOverride === "object" && Object.hasOwn(instanceOverride, key) && instanceOverride[key] !== void 0) {
|
|
507
|
-
return String(instanceOverride[key]);
|
|
508
|
-
}
|
|
509
|
-
if (globalOverrides[key] !== void 0) {
|
|
510
|
-
return String(globalOverrides[key]);
|
|
511
|
-
}
|
|
512
|
-
for (const dict of resolveActiveDictionaries()) {
|
|
513
|
-
if (dict[key] !== void 0) {
|
|
514
|
-
return String(dict[key]);
|
|
515
|
-
}
|
|
516
|
-
}
|
|
517
|
-
const fallbackDict = activeLocales[fallbackLocale] || initialLocales[fallbackLocale];
|
|
518
|
-
if (fallbackDict && fallbackDict[key] !== void 0) {
|
|
519
|
-
return String(fallbackDict[key]);
|
|
520
|
-
}
|
|
521
|
-
return String(key);
|
|
522
|
-
},
|
|
523
|
-
getAll(instanceOverride) {
|
|
524
|
-
const result = {};
|
|
525
|
-
const fallback = activeLocales[fallbackLocale] || initialLocales[fallbackLocale];
|
|
526
|
-
assignDefined(result, fallback);
|
|
527
|
-
const activeDicts = resolveActiveDictionaries().reverse();
|
|
528
|
-
for (const dict of activeDicts) {
|
|
529
|
-
assignDefined(result, dict);
|
|
530
|
-
}
|
|
531
|
-
assignDefined(result, globalOverrides);
|
|
532
|
-
assignDefined(result, instanceOverride);
|
|
533
|
-
return result;
|
|
534
|
-
},
|
|
535
|
-
reset() {
|
|
536
|
-
currentLocale = fallbackLocale;
|
|
537
|
-
globalOverrides = /* @__PURE__ */ Object.create(null);
|
|
538
|
-
activeLocales = /* @__PURE__ */ Object.create(null);
|
|
539
|
-
for (const [loc, dict] of Object.entries(initialLocales)) {
|
|
540
|
-
activeLocales[loc] = assignDefined(/* @__PURE__ */ Object.create(null), dict);
|
|
541
|
-
}
|
|
542
|
-
}
|
|
543
|
-
};
|
|
544
|
-
}
|
|
545
|
-
|
|
546
|
-
// src/masonry/i18n/fr.ts
|
|
547
|
-
var masonryFr = {
|
|
548
|
-
gallery: "Galerie en grille asym\xE9trique"
|
|
549
|
-
};
|
|
550
|
-
|
|
551
|
-
// src/masonry/i18n/en.ts
|
|
552
|
-
var masonryEn = {
|
|
553
|
-
gallery: "Masonry grid gallery"
|
|
554
|
-
};
|
|
555
|
-
|
|
556
|
-
// src/masonry/i18n/index.ts
|
|
557
|
-
var masonryI18n = createI18nManager("fr", {
|
|
558
|
-
fr: masonryFr,
|
|
559
|
-
en: masonryEn
|
|
560
|
-
});
|
|
561
|
-
|
|
562
|
-
// src/masonry/Masonry.ts
|
|
563
|
-
var NATIVE_STRUCTURAL_TAGS = /* @__PURE__ */ new Set(["UL", "OL", "MAIN", "NAV", "ASIDE", "ARTICLE", "SECTION"]);
|
|
564
|
-
var Masonry = class extends LocalizedComponent {
|
|
565
|
-
static _i18n = masonryI18n;
|
|
566
|
-
static i18n = masonryI18n;
|
|
567
|
-
root;
|
|
568
|
-
isNativeCSSGrid = false;
|
|
569
|
-
_items = [];
|
|
570
|
-
options;
|
|
571
|
-
resizeObserver = null;
|
|
572
|
-
itemResizeObserver = null;
|
|
573
|
-
observedItems = /* @__PURE__ */ new Set();
|
|
574
|
-
observedItemHeights = /* @__PURE__ */ new WeakMap();
|
|
575
|
-
removingItems = /* @__PURE__ */ new Set();
|
|
576
|
-
layoutRafId = null;
|
|
577
|
-
lastObservedWidth = 0;
|
|
578
|
-
isDestroyed = false;
|
|
579
|
-
hasExplicitAriaRole = false;
|
|
580
|
-
wasRoleInferred = false;
|
|
581
|
-
wasAriaLabelInferred = false;
|
|
582
|
-
hasExplicitAriaLabel = false;
|
|
583
|
-
lastInferredAriaLabel = "";
|
|
584
|
-
abortController = new AbortController();
|
|
585
|
-
watchedImages = /* @__PURE__ */ new WeakSet();
|
|
586
|
-
originalContainerStyles;
|
|
587
|
-
constructor(target, options = {}) {
|
|
588
|
-
super(options.i18n);
|
|
589
|
-
if (typeof target === "string") {
|
|
590
|
-
let el = null;
|
|
591
|
-
try {
|
|
592
|
-
el = document.querySelector(target);
|
|
593
|
-
} catch {
|
|
594
|
-
el = null;
|
|
595
|
-
}
|
|
596
|
-
if (!el) {
|
|
597
|
-
throw new Error(`[Wulf.Masonry] Conteneur introuvable pour le s\xE9lecteur : "${target}"`);
|
|
598
|
-
}
|
|
599
|
-
this.root = el;
|
|
600
|
-
} else if (target instanceof HTMLElement) {
|
|
601
|
-
this.root = target;
|
|
602
|
-
} else {
|
|
603
|
-
throw new Error("[Wulf.Masonry] Cible invalide : fournissez un \xE9l\xE9ment HTMLElement ou un s\xE9lecteur valide.");
|
|
604
|
-
}
|
|
605
|
-
this.originalContainerStyles = {
|
|
606
|
-
height: this.root.style.height,
|
|
607
|
-
width: this.root.style.width
|
|
608
|
-
};
|
|
609
|
-
this.hasExplicitAriaRole = Boolean(options.ariaRole);
|
|
610
|
-
this.hasExplicitAriaLabel = Boolean(options.ariaLabel || options.i18n?.gallery);
|
|
611
|
-
this.options = {
|
|
612
|
-
itemSelector: options.itemSelector || "> *",
|
|
613
|
-
columnWidth: options.columnWidth ?? 0,
|
|
614
|
-
gutter: options.gutter ?? 0,
|
|
615
|
-
percentPosition: Boolean(options.percentPosition),
|
|
616
|
-
fitWidth: Boolean(options.fitWidth),
|
|
617
|
-
horizontalOrder: Boolean(options.horizontalOrder),
|
|
618
|
-
transitionDuration: options.transitionDuration !== void 0 ? options.transitionDuration : 300,
|
|
619
|
-
stagger: options.stagger || 0,
|
|
620
|
-
resize: options.resize !== false,
|
|
621
|
-
autoImages: options.autoImages !== false,
|
|
622
|
-
useNativeCSSGrid: options.useNativeCSSGrid !== false,
|
|
623
|
-
ariaRole: options.ariaRole || "region",
|
|
624
|
-
ariaLabel: options.ariaLabel || this.t("gallery"),
|
|
625
|
-
i18n: options.i18n || {},
|
|
626
|
-
onLayout: options.onLayout || (() => {
|
|
627
|
-
}),
|
|
628
|
-
onItemPlaced: options.onItemPlaced || (() => {
|
|
629
|
-
}),
|
|
630
|
-
audit: options.audit ?? true
|
|
631
|
-
};
|
|
632
|
-
const supportsNativeCSS = typeof CSS !== "undefined" && typeof CSS.supports === "function" && (CSS.supports("display", "grid-lanes") || CSS.supports("grid-template-rows", "masonry"));
|
|
633
|
-
if (this.options.useNativeCSSGrid && supportsNativeCSS) {
|
|
634
|
-
this.isNativeCSSGrid = true;
|
|
635
|
-
this.root.classList.add("wulf-masonry", "wulf-masonry--native");
|
|
636
|
-
this.syncNativeGridVariables();
|
|
637
|
-
} else {
|
|
638
|
-
this.root.classList.add("wulf-masonry");
|
|
639
|
-
}
|
|
640
|
-
this.initAccessibility();
|
|
641
|
-
this.applyTransitionDuration();
|
|
642
|
-
this.reloadItems();
|
|
643
|
-
this.initObservers();
|
|
644
|
-
this.initImages();
|
|
645
|
-
this.layout();
|
|
646
|
-
this.runAuditWarning(this.options.audit);
|
|
647
|
-
}
|
|
648
|
-
get items() {
|
|
649
|
-
return [...this._items];
|
|
650
|
-
}
|
|
651
|
-
/**
|
|
652
|
-
* Initialise les attributs WAI-ARIA du conteneur.
|
|
653
|
-
*/
|
|
654
|
-
initAccessibility() {
|
|
655
|
-
if (this.options.ariaRole && !this.root.hasAttribute("role") && (this.hasExplicitAriaRole || !NATIVE_STRUCTURAL_TAGS.has(this.root.tagName))) {
|
|
656
|
-
this.root.setAttribute("role", this.options.ariaRole);
|
|
657
|
-
this.wasRoleInferred = true;
|
|
658
|
-
}
|
|
659
|
-
const label = this.hasExplicitAriaLabel ? this.options.ariaLabel : this.t("gallery");
|
|
660
|
-
if (label && !this.root.hasAttribute("aria-label") && !this.root.hasAttribute("aria-labelledby")) {
|
|
661
|
-
this.root.setAttribute("aria-label", label);
|
|
662
|
-
this.lastInferredAriaLabel = label;
|
|
663
|
-
this.wasAriaLabelInferred = true;
|
|
664
|
-
}
|
|
665
|
-
}
|
|
666
|
-
/**
|
|
667
|
-
* Synchronise dynamiquement le libellé ARIA si la langue globale change après montage.
|
|
668
|
-
*/
|
|
669
|
-
syncAccessibilityLabels() {
|
|
670
|
-
if (this.wasAriaLabelInferred && !this.hasExplicitAriaLabel) {
|
|
671
|
-
const currentAttr = this.root.getAttribute("aria-label");
|
|
672
|
-
if (currentAttr === this.lastInferredAriaLabel) {
|
|
673
|
-
const nextLabel = this.t("gallery");
|
|
674
|
-
this.root.setAttribute("aria-label", nextLabel);
|
|
675
|
-
this.lastInferredAriaLabel = nextLabel;
|
|
676
|
-
this.options.ariaLabel = nextLabel;
|
|
677
|
-
}
|
|
678
|
-
}
|
|
679
|
-
}
|
|
680
|
-
/**
|
|
681
|
-
* Configure les variables CSS de transition sur le conteneur.
|
|
682
|
-
*/
|
|
683
|
-
applyTransitionDuration() {
|
|
684
|
-
const dur = this.options.transitionDuration;
|
|
685
|
-
let durValue = "300ms";
|
|
686
|
-
if (typeof dur === "number" && Number.isFinite(dur) && dur >= 0) {
|
|
687
|
-
durValue = `${Math.min(dur, 6e4)}ms`;
|
|
688
|
-
} else if (typeof dur === "string" && /^\s*(?:\d+(?:\.\d+)?|\.\d+)(ms|s)\s*$/i.test(dur)) {
|
|
689
|
-
const parsedMs = parseCssDurationMs(dur, 300, 6e4);
|
|
690
|
-
durValue = parsedMs >= 6e4 ? "60000ms" : dur.trim();
|
|
691
|
-
}
|
|
692
|
-
this.root.style.setProperty("--wulf-masonry-duration", durValue);
|
|
693
|
-
}
|
|
694
|
-
/**
|
|
695
|
-
* Réindexe les éléments enfants ciblés par la disposition.
|
|
696
|
-
*/
|
|
697
|
-
reloadItems() {
|
|
698
|
-
if (this.isDestroyed) return;
|
|
699
|
-
let matched = [];
|
|
700
|
-
if (this.options.itemSelector === "> *") {
|
|
701
|
-
matched = Array.from(this.root.children).filter(
|
|
702
|
-
(el) => el instanceof HTMLElement && !el.hasAttribute("data-masonry-ignore") && !this.removingItems.has(el)
|
|
703
|
-
);
|
|
704
|
-
} else {
|
|
705
|
-
try {
|
|
706
|
-
const rawSelector = this.options.itemSelector.trim();
|
|
707
|
-
const selector = rawSelector.startsWith(">") ? `:scope ${rawSelector}` : rawSelector;
|
|
708
|
-
matched = Array.from(this.root.querySelectorAll(selector)).filter(
|
|
709
|
-
(el) => el.parentElement === this.root && !el.hasAttribute("data-masonry-ignore") && !this.removingItems.has(el)
|
|
710
|
-
);
|
|
711
|
-
} catch {
|
|
712
|
-
matched = Array.from(this.root.children).filter(
|
|
713
|
-
(el) => el instanceof HTMLElement && !el.hasAttribute("data-masonry-ignore") && !this.removingItems.has(el)
|
|
714
|
-
);
|
|
715
|
-
}
|
|
716
|
-
}
|
|
717
|
-
if (this.itemResizeObserver) {
|
|
718
|
-
const nextSet = new Set(matched);
|
|
719
|
-
for (const prevEl of this.observedItems) {
|
|
720
|
-
if (!nextSet.has(prevEl)) {
|
|
721
|
-
this.itemResizeObserver.unobserve(prevEl);
|
|
722
|
-
this.observedItems.delete(prevEl);
|
|
723
|
-
this.observedItemHeights.delete(prevEl);
|
|
724
|
-
}
|
|
725
|
-
}
|
|
726
|
-
}
|
|
727
|
-
this._items = matched;
|
|
728
|
-
for (const item of this._items) {
|
|
729
|
-
item.classList.add("wulf-masonry-item");
|
|
730
|
-
if (this.itemResizeObserver && !this.observedItems.has(item)) {
|
|
731
|
-
this.itemResizeObserver.observe(item);
|
|
732
|
-
this.observedItems.add(item);
|
|
733
|
-
}
|
|
734
|
-
}
|
|
735
|
-
}
|
|
736
|
-
/**
|
|
737
|
-
* Active ResizeObserver sur le conteneur et les éléments individuels.
|
|
738
|
-
*/
|
|
739
|
-
initObservers() {
|
|
740
|
-
if (!this.options.resize || typeof ResizeObserver === "undefined") return;
|
|
741
|
-
this.lastObservedWidth = this.root.getBoundingClientRect().width;
|
|
742
|
-
this.resizeObserver = new ResizeObserver((entries) => {
|
|
743
|
-
for (const entry of entries) {
|
|
744
|
-
const currentWidth = entry.contentRect.width;
|
|
745
|
-
if (Math.abs(currentWidth - this.lastObservedWidth) >= 1) {
|
|
746
|
-
this.lastObservedWidth = currentWidth;
|
|
747
|
-
this.scheduleLayout();
|
|
748
|
-
}
|
|
749
|
-
}
|
|
750
|
-
});
|
|
751
|
-
this.resizeObserver.observe(this.root);
|
|
752
|
-
this.itemResizeObserver = new ResizeObserver((entries) => {
|
|
753
|
-
let heightChanged = false;
|
|
754
|
-
for (const entry of entries) {
|
|
755
|
-
const newH = entry.borderBoxSize?.[0]?.blockSize ?? entry.contentRect.height;
|
|
756
|
-
const prevH = this.observedItemHeights.get(entry.target);
|
|
757
|
-
if (prevH === void 0 || Math.abs(newH - prevH) >= 1) {
|
|
758
|
-
this.observedItemHeights.set(entry.target, newH);
|
|
759
|
-
if (prevH !== void 0) {
|
|
760
|
-
heightChanged = true;
|
|
761
|
-
}
|
|
762
|
-
}
|
|
763
|
-
}
|
|
764
|
-
if (heightChanged) {
|
|
765
|
-
this.scheduleLayout();
|
|
766
|
-
}
|
|
767
|
-
});
|
|
768
|
-
for (const item of this._items) {
|
|
769
|
-
this.itemResizeObserver.observe(item);
|
|
770
|
-
this.observedItems.add(item);
|
|
771
|
-
}
|
|
772
|
-
}
|
|
773
|
-
/**
|
|
774
|
-
* Synchronise les variables CSS du mode natif CSS Grid Level 3 depuis les options JS.
|
|
775
|
-
*/
|
|
776
|
-
syncNativeGridVariables() {
|
|
777
|
-
const { x: gutterX, y: gutterY } = LayoutEngine.parseGutter(this.options.gutter);
|
|
778
|
-
this.root.style.setProperty("--wulf-masonry-gutter-x", `${gutterX}px`);
|
|
779
|
-
this.root.style.setProperty("--wulf-masonry-gutter-y", `${gutterY}px`);
|
|
780
|
-
if (typeof this.options.columnWidth === "number" && Number.isFinite(this.options.columnWidth) && this.options.columnWidth > 0) {
|
|
781
|
-
this.root.style.setProperty("--wulf-masonry-col-min", `${this.options.columnWidth}px`);
|
|
782
|
-
} else if (this.options.columnWidth instanceof HTMLElement) {
|
|
783
|
-
const w = this.options.columnWidth.getBoundingClientRect().width;
|
|
784
|
-
if (w > 0) {
|
|
785
|
-
this.root.style.setProperty("--wulf-masonry-col-min", `${w}px`);
|
|
786
|
-
}
|
|
787
|
-
} else if (typeof this.options.columnWidth === "string" && this.options.columnWidth.trim()) {
|
|
788
|
-
const trimmed = this.options.columnWidth.trim();
|
|
789
|
-
if (/^\d+(\.\d+)?(px|%)?$/i.test(trimmed)) {
|
|
790
|
-
const w = LayoutEngine.resolveColumnWidth(this.root, null, trimmed);
|
|
791
|
-
if (w > 0) {
|
|
792
|
-
this.root.style.setProperty("--wulf-masonry-col-min", `${w}px`);
|
|
793
|
-
}
|
|
794
|
-
} else {
|
|
795
|
-
try {
|
|
796
|
-
const el = this.root.querySelector(trimmed);
|
|
797
|
-
if (el) {
|
|
798
|
-
const w = el.getBoundingClientRect().width;
|
|
799
|
-
if (w > 0) {
|
|
800
|
-
this.root.style.setProperty("--wulf-masonry-col-min", `${w}px`);
|
|
801
|
-
}
|
|
802
|
-
}
|
|
803
|
-
} catch {
|
|
804
|
-
}
|
|
805
|
-
}
|
|
806
|
-
}
|
|
807
|
-
}
|
|
808
|
-
/**
|
|
809
|
-
* Détecte les balises <img> sans dimensions prédéfinies et attend leur décodage/chargement.
|
|
810
|
-
*/
|
|
811
|
-
initImages() {
|
|
812
|
-
if (!this.options.autoImages) return;
|
|
813
|
-
const images = Array.from(this.root.querySelectorAll("img"));
|
|
814
|
-
for (const img of images) {
|
|
815
|
-
if (!img.complete && !this.watchedImages.has(img)) {
|
|
816
|
-
this.watchedImages.add(img);
|
|
817
|
-
const attachLoadListener = () => {
|
|
818
|
-
img.addEventListener("load", () => {
|
|
819
|
-
if (!this.isDestroyed) this.scheduleLayout();
|
|
820
|
-
}, { once: true, signal: this.abortController.signal });
|
|
821
|
-
};
|
|
822
|
-
if (typeof img.decode === "function") {
|
|
823
|
-
img.decode().then(() => {
|
|
824
|
-
if (!this.isDestroyed) this.scheduleLayout();
|
|
825
|
-
}).catch(() => {
|
|
826
|
-
attachLoadListener();
|
|
827
|
-
});
|
|
828
|
-
} else {
|
|
829
|
-
attachLoadListener();
|
|
830
|
-
}
|
|
831
|
-
}
|
|
832
|
-
}
|
|
833
|
-
}
|
|
834
|
-
/**
|
|
835
|
-
* Planifie un recalcul au prochain tick d'animation via requestAnimationFrame.
|
|
836
|
-
*/
|
|
837
|
-
scheduleLayout() {
|
|
838
|
-
if (this.isDestroyed) return;
|
|
839
|
-
if (this.layoutRafId !== null) {
|
|
840
|
-
cancelAnimationFrame(this.layoutRafId);
|
|
841
|
-
}
|
|
842
|
-
this.layoutRafId = requestAnimationFrame(() => {
|
|
843
|
-
this.layoutRafId = null;
|
|
844
|
-
this.layout();
|
|
845
|
-
});
|
|
846
|
-
}
|
|
847
|
-
/**
|
|
848
|
-
* Calcule et applique les nouvelles coordonnées GPU de chaque item.
|
|
849
|
-
*/
|
|
850
|
-
layout() {
|
|
851
|
-
if (this.isDestroyed) return;
|
|
852
|
-
this.syncAccessibilityLabels();
|
|
853
|
-
if (this.isNativeCSSGrid) {
|
|
854
|
-
this.syncNativeGridVariables();
|
|
855
|
-
for (const el of this._items) {
|
|
856
|
-
el.classList.remove("wulf-masonry-item--hidden");
|
|
857
|
-
}
|
|
858
|
-
try {
|
|
859
|
-
this.options.onLayout([]);
|
|
860
|
-
} catch (err) {
|
|
861
|
-
console.error("[Wulf.Masonry] Erreur dans onLayout:", err);
|
|
862
|
-
}
|
|
863
|
-
return;
|
|
864
|
-
}
|
|
865
|
-
this.root.setAttribute("aria-busy", "true");
|
|
866
|
-
let positionsResult = [];
|
|
867
|
-
try {
|
|
868
|
-
if (this.options.fitWidth && this.root.classList.contains("wulf-masonry--fit-width")) {
|
|
869
|
-
this.root.style.width = "";
|
|
870
|
-
}
|
|
871
|
-
const result = LayoutEngine.calculate(this.root, this._items, this.options);
|
|
872
|
-
positionsResult = result.positions;
|
|
873
|
-
this.root.style.height = `${result.containerHeight}px`;
|
|
874
|
-
if (this.options.fitWidth && result.fittedWidth !== void 0) {
|
|
875
|
-
this.root.style.width = `${result.fittedWidth}px`;
|
|
876
|
-
this.lastObservedWidth = result.fittedWidth;
|
|
877
|
-
this.root.classList.add("wulf-masonry--fit-width");
|
|
878
|
-
} else {
|
|
879
|
-
this.root.classList.remove("wulf-masonry--fit-width");
|
|
880
|
-
}
|
|
881
|
-
const stagger = this.options.stagger;
|
|
882
|
-
const validStagger = typeof stagger === "number" && Number.isFinite(stagger) && stagger > 0;
|
|
883
|
-
if (validStagger) {
|
|
884
|
-
this.root.style.setProperty("--wulf-masonry-stagger", `${stagger}ms`);
|
|
885
|
-
} else {
|
|
886
|
-
this.root.style.removeProperty("--wulf-masonry-stagger");
|
|
887
|
-
}
|
|
888
|
-
const hasIgnoredChildren = this._items.length !== this.root.children.length;
|
|
889
|
-
const supportsSiblingIndex = !hasIgnoredChildren && typeof CSS !== "undefined" && typeof CSS.supports === "function" && CSS.supports("transition-delay", "calc(sibling-index() * 1ms)");
|
|
890
|
-
const usePercent = this.options.percentPosition && result.containerWidth > 0;
|
|
891
|
-
for (let i = 0; i < result.positions.length; i++) {
|
|
892
|
-
const pos = result.positions[i];
|
|
893
|
-
const item = pos.element;
|
|
894
|
-
if (usePercent) {
|
|
895
|
-
const wPct = Number((pos.width / result.containerWidth * 100).toFixed(4));
|
|
896
|
-
item.style.setProperty("--wulf-masonry-w", `${wPct}%`);
|
|
897
|
-
} else {
|
|
898
|
-
item.style.setProperty("--wulf-masonry-w", `${pos.width}px`);
|
|
899
|
-
}
|
|
900
|
-
item.style.setProperty("--wulf-masonry-x", `${pos.x}px`);
|
|
901
|
-
item.style.setProperty("--wulf-masonry-y", `${pos.y}px`);
|
|
902
|
-
if (validStagger && !supportsSiblingIndex) {
|
|
903
|
-
item.style.setProperty("--wulf-masonry-index", String(i));
|
|
904
|
-
} else {
|
|
905
|
-
item.style.removeProperty("--wulf-masonry-index");
|
|
906
|
-
}
|
|
907
|
-
item.classList.remove("wulf-masonry-item--hidden");
|
|
908
|
-
this.observedItemHeights.set(item, pos.height);
|
|
909
|
-
try {
|
|
910
|
-
this.options.onItemPlaced(item, pos);
|
|
911
|
-
} catch (err) {
|
|
912
|
-
console.error("[Wulf.Masonry] Erreur dans onItemPlaced:", err);
|
|
913
|
-
}
|
|
914
|
-
}
|
|
915
|
-
} finally {
|
|
916
|
-
this.root.setAttribute("aria-busy", "false");
|
|
917
|
-
}
|
|
918
|
-
try {
|
|
919
|
-
this.options.onLayout(positionsResult);
|
|
920
|
-
} catch (err) {
|
|
921
|
-
console.error("[Wulf.Masonry] Erreur dans onLayout:", err);
|
|
922
|
-
}
|
|
923
|
-
}
|
|
924
|
-
/**
|
|
925
|
-
* Ajoute de nouveaux éléments à la fin du conteneur.
|
|
926
|
-
*/
|
|
927
|
-
append(elements) {
|
|
928
|
-
if (this.isDestroyed) return;
|
|
929
|
-
const list = (Array.isArray(elements) ? elements : [elements]).filter(
|
|
930
|
-
(el) => el instanceof HTMLElement && !el.contains(this.root)
|
|
931
|
-
);
|
|
932
|
-
if (list.length === 0) return;
|
|
933
|
-
const frag = document.createDocumentFragment();
|
|
934
|
-
for (const el of list) {
|
|
935
|
-
if (this.isNativeCSSGrid) {
|
|
936
|
-
el.classList.add("wulf-masonry-item");
|
|
937
|
-
} else {
|
|
938
|
-
el.classList.add("wulf-masonry-item", "wulf-masonry-item--hidden");
|
|
939
|
-
}
|
|
940
|
-
frag.appendChild(el);
|
|
941
|
-
}
|
|
942
|
-
this.root.appendChild(frag);
|
|
943
|
-
this.reloadItems();
|
|
944
|
-
this.initImages();
|
|
945
|
-
this.layout();
|
|
946
|
-
}
|
|
947
|
-
/**
|
|
948
|
-
* Ajoute de nouveaux éléments au début du conteneur.
|
|
949
|
-
*/
|
|
950
|
-
prepend(elements) {
|
|
951
|
-
if (this.isDestroyed) return;
|
|
952
|
-
const list = (Array.isArray(elements) ? elements : [elements]).filter(
|
|
953
|
-
(el) => el instanceof HTMLElement && !el.contains(this.root)
|
|
954
|
-
);
|
|
955
|
-
if (list.length === 0) return;
|
|
956
|
-
const first = this.root.firstChild;
|
|
957
|
-
const frag = document.createDocumentFragment();
|
|
958
|
-
for (const el of list) {
|
|
959
|
-
if (this.isNativeCSSGrid) {
|
|
960
|
-
el.classList.add("wulf-masonry-item");
|
|
961
|
-
} else {
|
|
962
|
-
el.classList.add("wulf-masonry-item", "wulf-masonry-item--hidden");
|
|
963
|
-
}
|
|
964
|
-
frag.appendChild(el);
|
|
965
|
-
}
|
|
966
|
-
this.root.insertBefore(frag, first);
|
|
967
|
-
this.reloadItems();
|
|
968
|
-
this.initImages();
|
|
969
|
-
this.layout();
|
|
970
|
-
}
|
|
971
|
-
/**
|
|
972
|
-
* Supprime des éléments avec animation de fondu/sortie synchronisée via Web Animations API.
|
|
973
|
-
*/
|
|
974
|
-
remove(elements) {
|
|
975
|
-
if (this.isDestroyed) return;
|
|
976
|
-
const list = (Array.isArray(elements) ? elements : [elements]).filter(
|
|
977
|
-
(el) => el instanceof HTMLElement
|
|
978
|
-
);
|
|
979
|
-
if (list.length === 0) return;
|
|
980
|
-
const finalizeRemoval = () => {
|
|
981
|
-
if (this.isDestroyed) return;
|
|
982
|
-
for (const el of list) {
|
|
983
|
-
this.removingItems.delete(el);
|
|
984
|
-
if (el.parentElement === this.root) {
|
|
985
|
-
if (this.itemResizeObserver) {
|
|
986
|
-
this.itemResizeObserver.unobserve(el);
|
|
987
|
-
this.observedItems.delete(el);
|
|
988
|
-
this.observedItemHeights.delete(el);
|
|
989
|
-
}
|
|
990
|
-
this.root.removeChild(el);
|
|
991
|
-
}
|
|
992
|
-
}
|
|
993
|
-
this.reloadItems();
|
|
994
|
-
this.layout();
|
|
995
|
-
};
|
|
996
|
-
const activeEl = getDeepActiveElement();
|
|
997
|
-
if (activeEl && list.some((el) => el.contains(activeEl))) {
|
|
998
|
-
const removeSet = new Set(list);
|
|
999
|
-
const firstRemovedIdx = this._items.findIndex((item) => removeSet.has(item));
|
|
1000
|
-
const survivorsAfter = firstRemovedIdx >= 0 ? this._items.slice(firstRemovedIdx + 1).filter((item) => !removeSet.has(item)) : [];
|
|
1001
|
-
const survivorsBefore = firstRemovedIdx > 0 ? this._items.slice(0, firstRemovedIdx).filter((item) => !removeSet.has(item)).reverse() : [];
|
|
1002
|
-
const candidateItem = survivorsAfter[0] || survivorsBefore[0] || null;
|
|
1003
|
-
let handoffDone = false;
|
|
1004
|
-
if (candidateItem) {
|
|
1005
|
-
const focusableChild = candidateItem.querySelector(
|
|
1006
|
-
'a[href], button:not([disabled]), input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])'
|
|
1007
|
-
);
|
|
1008
|
-
const focusTarget = focusableChild || (candidateItem.tabIndex >= 0 ? candidateItem : null);
|
|
1009
|
-
if (focusTarget) {
|
|
1010
|
-
try {
|
|
1011
|
-
focusTarget.focus({ preventScroll: true });
|
|
1012
|
-
handoffDone = true;
|
|
1013
|
-
} catch {
|
|
1014
|
-
handoffDone = false;
|
|
1015
|
-
}
|
|
1016
|
-
}
|
|
1017
|
-
}
|
|
1018
|
-
if (!handoffDone) {
|
|
1019
|
-
activeEl.blur?.();
|
|
1020
|
-
}
|
|
1021
|
-
}
|
|
1022
|
-
for (const el of list) {
|
|
1023
|
-
this.removingItems.add(el);
|
|
1024
|
-
el.setAttribute("inert", "");
|
|
1025
|
-
el.style.transitionDelay = "0ms";
|
|
1026
|
-
el.classList.add("wulf-masonry-item--hidden");
|
|
1027
|
-
}
|
|
1028
|
-
const dur = parseCssDurationMs(this.options.transitionDuration, 300);
|
|
1029
|
-
if (dur <= 0 || this.isNativeCSSGrid) {
|
|
1030
|
-
finalizeRemoval();
|
|
1031
|
-
return;
|
|
1032
|
-
}
|
|
1033
|
-
this.reloadItems();
|
|
1034
|
-
this.layout();
|
|
1035
|
-
Promise.all(
|
|
1036
|
-
list.map((el) => waitForAnimations(el, dur, this.abortController.signal))
|
|
1037
|
-
).then(() => {
|
|
1038
|
-
if (!this.abortController.signal.aborted) {
|
|
1039
|
-
finalizeRemoval();
|
|
1040
|
-
}
|
|
1041
|
-
});
|
|
1042
|
-
}
|
|
1043
|
-
/**
|
|
1044
|
-
* Vérifie la conformité d'accessibilité WAI-ARIA de la grille Masonry
|
|
1045
|
-
* et retourne la liste des contraintes manquantes.
|
|
1046
|
-
*/
|
|
1047
|
-
audit() {
|
|
1048
|
-
const warnings = [];
|
|
1049
|
-
const hasValidLabelledby = this.checkAriaIdReferences(this.root, "aria-labelledby", warnings, true);
|
|
1050
|
-
const hasCustomRootAriaLabel = !this.wasAriaLabelInferred && Boolean(this.root.getAttribute("aria-label")?.trim());
|
|
1051
|
-
if (!this.hasExplicitAriaLabel && !hasCustomRootAriaLabel && !hasValidLabelledby) {
|
|
1052
|
-
warnings.push(
|
|
1053
|
-
"Libell\xE9 contextuel manquant : d\xE9finissez l'option ariaLabel (ou un attribut aria-label / aria-labelledby sur le conteneur) pour qualifier la grille (WCAG 4.1.2)."
|
|
1054
|
-
);
|
|
1055
|
-
}
|
|
1056
|
-
const imagesWithoutAlt = Array.from(this.root.querySelectorAll("img")).filter(
|
|
1057
|
-
(img) => !img.hasAttribute("alt") && img.getAttribute("aria-hidden") !== "true"
|
|
1058
|
-
);
|
|
1059
|
-
if (imagesWithoutAlt.length > 0) {
|
|
1060
|
-
warnings.push(
|
|
1061
|
-
`${imagesWithoutAlt.length} image(s) <img> d\xE9pourvue(s) d'attribut alt : renseignez alt="description" (ou alt="" si d\xE9corative) (WCAG 1.1.1).`
|
|
1062
|
-
);
|
|
1063
|
-
}
|
|
1064
|
-
const positiveTabIndexEls = Array.from(this.root.querySelectorAll("[tabindex]")).filter(
|
|
1065
|
-
(el) => el.tabIndex > 0
|
|
1066
|
-
);
|
|
1067
|
-
if (positiveTabIndexEls.length > 0) {
|
|
1068
|
-
warnings.push(
|
|
1069
|
-
`${positiveTabIndexEls.length} \xE9l\xE9ment(s) avec tabindex > 0 d\xE9tect\xE9(s) : utilisez uniquement tabindex="0" ou "-1" (WCAG 2.4.3).`
|
|
1070
|
-
);
|
|
1071
|
-
}
|
|
1072
|
-
if (!this.options.horizontalOrder && this.root.querySelector('a[href], button, input, select, textarea, [tabindex="0"]') !== null) {
|
|
1073
|
-
warnings.push(
|
|
1074
|
-
"Grille interactive avec horizontalOrder: false : l'ordre visuel peut diverger de l'ordre de tabulation ; envisagez horizontalOrder: true (WCAG 1.3.2 / 2.4.3)."
|
|
1075
|
-
);
|
|
1076
|
-
}
|
|
1077
|
-
return warnings;
|
|
1078
|
-
}
|
|
1079
|
-
getAuditPrefix() {
|
|
1080
|
-
return "Wulf.Masonry";
|
|
1081
|
-
}
|
|
1082
|
-
getAuditTargetLabel() {
|
|
1083
|
-
return this.root.id ? `#${this.root.id}` : `<${this.root.tagName.toLowerCase()}.wulf-masonry>`;
|
|
1084
|
-
}
|
|
1085
|
-
/**
|
|
1086
|
-
* Libère les ressources, déconnecte les observateurs et nettoie les styles injectés.
|
|
1087
|
-
*/
|
|
1088
|
-
destroy() {
|
|
1089
|
-
if (this.isDestroyed) return;
|
|
1090
|
-
this.isDestroyed = true;
|
|
1091
|
-
this.abortController.abort();
|
|
1092
|
-
if (this.layoutRafId !== null) {
|
|
1093
|
-
cancelAnimationFrame(this.layoutRafId);
|
|
1094
|
-
this.layoutRafId = null;
|
|
1095
|
-
}
|
|
1096
|
-
if (this.resizeObserver) {
|
|
1097
|
-
this.resizeObserver.disconnect();
|
|
1098
|
-
this.resizeObserver = null;
|
|
1099
|
-
}
|
|
1100
|
-
if (this.itemResizeObserver) {
|
|
1101
|
-
this.itemResizeObserver.disconnect();
|
|
1102
|
-
this.itemResizeObserver = null;
|
|
1103
|
-
}
|
|
1104
|
-
this.root.classList.remove("wulf-masonry", "wulf-masonry--native", "wulf-masonry--fit-width");
|
|
1105
|
-
this.root.removeAttribute("aria-busy");
|
|
1106
|
-
if (this.wasRoleInferred && this.root.getAttribute("role") === this.options.ariaRole) {
|
|
1107
|
-
this.root.removeAttribute("role");
|
|
1108
|
-
}
|
|
1109
|
-
if (this.wasAriaLabelInferred && this.root.getAttribute("aria-label") === this.lastInferredAriaLabel) {
|
|
1110
|
-
this.root.removeAttribute("aria-label");
|
|
1111
|
-
}
|
|
1112
|
-
this.root.style.removeProperty("--wulf-masonry-duration");
|
|
1113
|
-
this.root.style.removeProperty("--wulf-masonry-stagger");
|
|
1114
|
-
this.root.style.removeProperty("--wulf-masonry-col-min");
|
|
1115
|
-
this.root.style.removeProperty("--wulf-masonry-gutter-x");
|
|
1116
|
-
this.root.style.removeProperty("--wulf-masonry-gutter-y");
|
|
1117
|
-
if (this.originalContainerStyles.height) {
|
|
1118
|
-
this.root.style.height = this.originalContainerStyles.height;
|
|
1119
|
-
} else {
|
|
1120
|
-
this.root.style.removeProperty("height");
|
|
1121
|
-
}
|
|
1122
|
-
if (this.originalContainerStyles.width) {
|
|
1123
|
-
this.root.style.width = this.originalContainerStyles.width;
|
|
1124
|
-
} else {
|
|
1125
|
-
this.root.style.removeProperty("width");
|
|
1126
|
-
}
|
|
1127
|
-
for (const item of this.removingItems) {
|
|
1128
|
-
item.removeAttribute("inert");
|
|
1129
|
-
item.style.removeProperty("transition-delay");
|
|
1130
|
-
item.classList.remove("wulf-masonry-item", "wulf-masonry-item--hidden");
|
|
1131
|
-
item.style.removeProperty("--wulf-masonry-w");
|
|
1132
|
-
item.style.removeProperty("--wulf-masonry-x");
|
|
1133
|
-
item.style.removeProperty("--wulf-masonry-y");
|
|
1134
|
-
item.style.removeProperty("--wulf-masonry-index");
|
|
1135
|
-
}
|
|
1136
|
-
this.removingItems.clear();
|
|
1137
|
-
for (const item of this._items) {
|
|
1138
|
-
item.classList.remove("wulf-masonry-item", "wulf-masonry-item--hidden");
|
|
1139
|
-
item.style.removeProperty("--wulf-masonry-w");
|
|
1140
|
-
item.style.removeProperty("--wulf-masonry-x");
|
|
1141
|
-
item.style.removeProperty("--wulf-masonry-y");
|
|
1142
|
-
item.style.removeProperty("--wulf-masonry-index");
|
|
1143
|
-
}
|
|
1144
|
-
this._items = [];
|
|
1145
|
-
}
|
|
1146
|
-
};
|
|
1147
|
-
|
|
1148
|
-
// src/masonry/index.ts
|
|
1149
|
-
var index_default = Masonry;
|
|
1150
|
-
var wulfNamespace = getSafeWulfNamespace();
|
|
1151
|
-
if (wulfNamespace) {
|
|
1152
|
-
wulfNamespace.Masonry = Object.assign(Masonry, {
|
|
1153
|
-
Masonry,
|
|
1154
|
-
LayoutEngine,
|
|
1155
|
-
i18n: masonryI18n
|
|
1156
|
-
});
|
|
1157
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
LayoutEngine,
|
|
3
|
+
Masonry,
|
|
4
|
+
masonryEn,
|
|
5
|
+
masonryFr,
|
|
6
|
+
masonryI18n,
|
|
7
|
+
masonry_default
|
|
8
|
+
} from "./chunks/chunk-AXZYYW7H.js";
|
|
9
|
+
import {
|
|
10
|
+
LocalizedComponent,
|
|
11
|
+
createI18nManager
|
|
12
|
+
} from "./chunks/chunk-QV46A7FV.js";
|
|
13
|
+
import "./chunks/chunk-22AIMRD5.js";
|
|
14
|
+
import "./chunks/chunk-VJO22BAT.js";
|
|
1158
15
|
export {
|
|
1159
16
|
LayoutEngine,
|
|
1160
17
|
LocalizedComponent,
|
|
1161
18
|
Masonry,
|
|
1162
19
|
createI18nManager,
|
|
1163
|
-
|
|
20
|
+
masonry_default as default,
|
|
1164
21
|
masonryEn,
|
|
1165
22
|
masonryFr,
|
|
1166
23
|
masonryI18n
|