plossy 0.3.1 → 0.5.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/dist/plossy.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Plossy v0.3.1 | MIT License
2
+ * Plossy v0.5.0 | MIT License
3
3
  *
4
4
  * Includes icons from Lucide (https://lucide.dev), some of them derived from Feather.
5
5
  * Full third-party notices (also shipped as LICENSE-LUCIDE):
@@ -53,11 +53,272 @@
53
53
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
54
54
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
55
55
 
56
+ // src/js/locale/en.js
57
+ var en_default = {
58
+ // Shared
59
+ close: "Close",
60
+ clear: "Clear",
61
+ previous: "Previous",
62
+ next: "Next",
63
+ loading: "Loading",
64
+ // Combobox
65
+ "combobox.empty": "No results",
66
+ "combobox.loading": "Searching\u2026",
67
+ "combobox.create": "Add",
68
+ "combobox.options": "Options",
69
+ "combobox.remove": "Remove: {label}",
70
+ "combobox.minLength": { one: "Type at least {n} character to search", other: "Type at least {n} characters to search" },
71
+ "combobox.error": "Couldn\u2019t load results",
72
+ // Datepicker
73
+ "datepicker.dialog": "Choose a date",
74
+ "datepicker.prevMonth": "Previous month",
75
+ "datepicker.nextMonth": "Next month",
76
+ "datepicker.prevYear": "Previous year",
77
+ "datepicker.nextYear": "Next year",
78
+ "datepicker.prevYears": "Previous years",
79
+ "datepicker.nextYears": "Next years",
80
+ "datepicker.pickMonth": "Choose a month",
81
+ "datepicker.pickYear": "Choose a year",
82
+ "datepicker.today": "Today",
83
+ "datepicker.clear": "Clear",
84
+ // Countdown (screen reader text)
85
+ "countdown.days": "days",
86
+ "countdown.hours": "hr",
87
+ "countdown.minutes": "min",
88
+ "countdown.seconds": "s",
89
+ // Slider, Slideshow
90
+ "slider.carousel": "carousel",
91
+ "slider.slide": "slide",
92
+ "slider.position": "{n} of {count}",
93
+ "slider.previous": "Previous slide",
94
+ "slider.next": "Next slide",
95
+ "slider.goto": "Slide {n}",
96
+ // Lightbox
97
+ "lightbox.label": "Gallery",
98
+ "lightbox.role": "gallery",
99
+ "lightbox.thumbs": "Thumbnails",
100
+ "lightbox.item": "Item {n}",
101
+ "lightbox.error": "Couldn\u2019t load the content.",
102
+ "lightbox.embed": "Embedded content",
103
+ // Modal (Plossy.modal.alert / confirm / prompt)
104
+ "modal.ok": "OK",
105
+ "modal.cancel": "Cancel",
106
+ "modal.close": "Close",
107
+ // Notification, Offcanvas, To top
108
+ "notification.close": "Close notification",
109
+ "offcanvas.label": "Side panel",
110
+ "totop.label": "Back to top",
111
+ // Quantity, Rating, OTP
112
+ "quantity.label": "Quantity",
113
+ "quantity.minus": "Decrease",
114
+ "quantity.plus": "Increase",
115
+ "rating.label": "Rating",
116
+ "otp.label": "One-time code",
117
+ "otp.char": "Character {n} of {count}",
118
+ // Password toggle, password strength
119
+ "password.show": "Show password",
120
+ "password.hide": "Hide password",
121
+ "strength.levels": "Weak, Fair, Good, Strong",
122
+ "strength.meter": "Password strength",
123
+ "strength.empty": "No password",
124
+ "strength.met": "met",
125
+ "strength.unmet": "not met",
126
+ "strength.rule.length": { one: "At least {n} character", other: "At least {n} characters" },
127
+ "strength.rule.case": "Lowercase and uppercase letter",
128
+ "strength.rule.digit": "At least one digit",
129
+ "strength.rule.symbol": "A special character (e.g. ! @ # ?)",
130
+ // Form validation
131
+ "validation.required": "This field is required.",
132
+ "validation.checkbox": "Check this box to continue.",
133
+ "validation.radio": "Choose one of the options.",
134
+ "validation.file": "Choose a file.",
135
+ "validation.select": "Choose an item from the list.",
136
+ "validation.email": "Enter a valid email address, e.g. jane@example.com.",
137
+ "validation.url": "Enter a valid URL, e.g. https://example.com.",
138
+ "validation.type": "Enter a value in the correct format.",
139
+ "validation.pattern": "Enter a value in the required format.",
140
+ "validation.minlength": { one: "Enter at least {n} character (currently {length}).", other: "Enter at least {n} characters (currently {length})." },
141
+ "validation.maxlength": { one: "Enter at most {n} character (currently {length}).", other: "Enter at most {n} characters (currently {length})." },
142
+ "validation.min": "The value can\u2019t be less than {min}.",
143
+ "validation.max": "The value can\u2019t be greater than {max}.",
144
+ "validation.step": "Enter a value that matches the allowed step.",
145
+ "validation.bad": "Enter a valid value.",
146
+ // Upload
147
+ "upload.choose": "Choose files",
148
+ "upload.type": "The file \u201C{name}\u201D has a format that isn\u2019t allowed.",
149
+ "upload.size": "The file \u201C{name}\u201D is too large ({size}). The maximum size is {max} MB.",
150
+ "upload.count": { one: "You can add at most {n} file.", other: "You can add at most {n} files." },
151
+ "upload.remove": "Remove file {name}",
152
+ "upload.progress": "Upload progress: {name}",
153
+ "upload.uploading": "Uploading\u2026 {percent}%",
154
+ "upload.done": "Uploaded",
155
+ "upload.failed": "Couldn\u2019t upload the file.",
156
+ "upload.failedStatus": "Couldn\u2019t upload the file (error {status}).",
157
+ "upload.failedNetwork": "Couldn\u2019t upload the file \u2014 check your connection.",
158
+ // Sortable (screen reader announcements)
159
+ "sortable.help": "Press space to pick up an item. Use the arrow keys to move it, space or Enter to drop it, and Escape to cancel.",
160
+ "sortable.role": "sortable item",
161
+ "sortable.lifted": "Picked up: {label}. Position {n} of {count}. Use the arrow keys to move, space to drop, Escape to cancel.",
162
+ "sortable.moved": "Position {n} of {count}.",
163
+ "sortable.cancelled": "Cancelled. {label} returns to position {n} of {count}.",
164
+ "sortable.dropped": "Dropped: {label}. Position {n} of {count}."
165
+ };
166
+
167
+ // src/js/locale/pl.js
168
+ var pl_default = {
169
+ close: "Zamknij",
170
+ clear: "Wyczy\u015B\u0107",
171
+ previous: "Poprzedni",
172
+ next: "Nast\u0119pny",
173
+ loading: "Wczytywanie",
174
+ "combobox.empty": "Brak wynik\xF3w",
175
+ "combobox.loading": "Szukam\u2026",
176
+ "combobox.create": "Dodaj",
177
+ "combobox.options": "Opcje",
178
+ "combobox.remove": "Usu\u0144: {label}",
179
+ "combobox.minLength": "Wpisz co najmniej {n} zn., aby wyszuka\u0107",
180
+ "combobox.error": "Nie uda\u0142o si\u0119 pobra\u0107 wynik\xF3w",
181
+ "datepicker.dialog": "Wybierz dat\u0119",
182
+ "datepicker.prevMonth": "Poprzedni miesi\u0105c",
183
+ "datepicker.nextMonth": "Nast\u0119pny miesi\u0105c",
184
+ "datepicker.prevYear": "Poprzedni rok",
185
+ "datepicker.nextYear": "Nast\u0119pny rok",
186
+ "datepicker.prevYears": "Poprzednie lata",
187
+ "datepicker.nextYears": "Nast\u0119pne lata",
188
+ "datepicker.pickMonth": "Wybierz miesi\u0105c",
189
+ "datepicker.pickYear": "Wybierz rok",
190
+ "datepicker.today": "Dzi\u015B",
191
+ "datepicker.clear": "Wyczy\u015B\u0107",
192
+ "countdown.days": "dni",
193
+ "countdown.hours": "godz.",
194
+ "countdown.minutes": "min",
195
+ "countdown.seconds": "s",
196
+ "slider.carousel": "karuzela",
197
+ "slider.slide": "slajd",
198
+ "slider.position": "{n} z {count}",
199
+ "slider.previous": "Poprzedni slajd",
200
+ "slider.next": "Nast\u0119pny slajd",
201
+ "slider.goto": "Slajd {n}",
202
+ "lightbox.label": "Galeria",
203
+ "lightbox.role": "galeria",
204
+ "lightbox.thumbs": "Miniatury",
205
+ "lightbox.item": "Pozycja {n}",
206
+ "lightbox.error": "Nie uda\u0142o si\u0119 wczyta\u0107 zawarto\u015Bci.",
207
+ "lightbox.embed": "Osadzona tre\u015B\u0107",
208
+ "modal.ok": "OK",
209
+ "modal.cancel": "Anuluj",
210
+ "modal.close": "Zamknij",
211
+ "notification.close": "Zamknij powiadomienie",
212
+ "offcanvas.label": "Panel boczny",
213
+ "totop.label": "Wr\xF3\u0107 na g\xF3r\u0119 strony",
214
+ "quantity.label": "Ilo\u015B\u0107",
215
+ "quantity.minus": "Mniej",
216
+ "quantity.plus": "Wi\u0119cej",
217
+ "rating.label": "Ocena",
218
+ "otp.label": "Kod jednorazowy",
219
+ "otp.char": "Znak {n} z {count}",
220
+ "password.show": "Poka\u017C has\u0142o",
221
+ "password.hide": "Ukryj has\u0142o",
222
+ "strength.levels": "S\u0142abe, \u015Arednie, Dobre, Silne",
223
+ "strength.meter": "Si\u0142a has\u0142a",
224
+ "strength.empty": "Brak has\u0142a",
225
+ "strength.met": "spe\u0142nione",
226
+ "strength.unmet": "niespe\u0142nione",
227
+ "strength.rule.length": "Co najmniej {n} znak\xF3w",
228
+ "strength.rule.case": "Ma\u0142a i wielka litera",
229
+ "strength.rule.digit": "Co najmniej jedna cyfra",
230
+ "strength.rule.symbol": "Znak specjalny (np. ! @ # ?)",
231
+ "validation.required": "To pole jest wymagane.",
232
+ "validation.checkbox": "Zaznacz to pole, aby kontynuowa\u0107.",
233
+ "validation.radio": "Wybierz jedn\u0105 z opcji.",
234
+ "validation.file": "Wybierz plik.",
235
+ "validation.select": "Wybierz pozycj\u0119 z listy.",
236
+ "validation.email": "Podaj poprawny adres e-mail, np. jan@example.com.",
237
+ "validation.url": "Podaj poprawny adres URL, np. https://example.com.",
238
+ "validation.type": "Podaj warto\u015B\u0107 w poprawnym formacie.",
239
+ "validation.pattern": "Podaj warto\u015B\u0107 w wymaganym formacie.",
240
+ "validation.minlength": {
241
+ one: "Wpisz co najmniej {n} znak (obecnie {length}).",
242
+ few: "Wpisz co najmniej {n} znaki (obecnie {length}).",
243
+ many: "Wpisz co najmniej {n} znak\xF3w (obecnie {length}).",
244
+ other: "Wpisz co najmniej {n} znaku (obecnie {length})."
245
+ },
246
+ "validation.maxlength": {
247
+ one: "Wpisz najwy\u017Cej {n} znak (obecnie {length}).",
248
+ few: "Wpisz najwy\u017Cej {n} znaki (obecnie {length}).",
249
+ many: "Wpisz najwy\u017Cej {n} znak\xF3w (obecnie {length}).",
250
+ other: "Wpisz najwy\u017Cej {n} znaku (obecnie {length})."
251
+ },
252
+ "validation.min": "Warto\u015B\u0107 nie mo\u017Ce by\u0107 mniejsza ni\u017C {min}.",
253
+ "validation.max": "Warto\u015B\u0107 nie mo\u017Ce by\u0107 wi\u0119ksza ni\u017C {max}.",
254
+ "validation.step": "Podaj warto\u015B\u0107 zgodn\u0105 z dozwolonym krokiem.",
255
+ "validation.bad": "Podaj poprawn\u0105 warto\u015B\u0107.",
256
+ "upload.choose": "Wybierz pliki",
257
+ "upload.type": "Plik \u201E{name}\u201D ma niedozwolony format.",
258
+ "upload.size": "Plik \u201E{name}\u201D jest za du\u017Cy ({size}). Maksymalny rozmiar to {max} MB.",
259
+ "upload.count": {
260
+ one: "Mo\u017Cna doda\u0107 najwy\u017Cej {n} plik.",
261
+ few: "Mo\u017Cna doda\u0107 najwy\u017Cej {n} pliki.",
262
+ many: "Mo\u017Cna doda\u0107 najwy\u017Cej {n} plik\xF3w.",
263
+ other: "Mo\u017Cna doda\u0107 najwy\u017Cej {n} pliku."
264
+ },
265
+ "upload.remove": "Usu\u0144 plik {name}",
266
+ "upload.progress": "Post\u0119p przesy\u0142ania: {name}",
267
+ "upload.uploading": "Przesy\u0142anie\u2026 {percent}%",
268
+ "upload.done": "Przes\u0142ano",
269
+ "upload.failed": "Nie uda\u0142o si\u0119 przes\u0142a\u0107 pliku.",
270
+ "upload.failedStatus": "Nie uda\u0142o si\u0119 przes\u0142a\u0107 pliku (b\u0142\u0105d {status}).",
271
+ "upload.failedNetwork": "Nie uda\u0142o si\u0119 przes\u0142a\u0107 pliku \u2014 sprawd\u017A po\u0142\u0105czenie.",
272
+ "sortable.help": "Naci\u015Bnij spacj\u0119, aby podnie\u015B\u0107 element. Strza\u0142kami zmie\u0144 jego pozycj\u0119, spacj\u0105 lub Enterem upu\u015B\u0107, klawiszem Escape anuluj.",
273
+ "sortable.role": "element sortowalny",
274
+ "sortable.lifted": "Podniesiono: {label}. Pozycja {n} z {count}. Strza\u0142kami zmie\u0144 pozycj\u0119, spacj\u0105 upu\u015B\u0107, Escape anuluje.",
275
+ "sortable.moved": "Pozycja {n} z {count}.",
276
+ "sortable.cancelled": "Anulowano. {label} wraca na pozycj\u0119 {n} z {count}.",
277
+ "sortable.dropped": "Upuszczono: {label}. Pozycja {n} z {count}."
278
+ };
279
+
56
280
  // src/js/core.js
57
281
  var registry = /* @__PURE__ */ new Map();
58
282
  var store = /* @__PURE__ */ new WeakMap();
283
+ var meta = /* @__PURE__ */ new WeakMap();
284
+ var dormant = /* @__PURE__ */ new WeakMap();
285
+ var dormantCount = 0;
286
+ var liveCount = 0;
287
+ var dormantGone = typeof FinalizationRegistry === "function" ? new FinalizationRegistry(() => dormantCount--) : null;
59
288
  var started = false;
60
289
  var selector = "";
290
+ var PERSIST = "data-pl-persist";
291
+ var config = {
292
+ /** Niszczy instancje elementów usuniętych z dokumentu. `false` — dawne zachowanie (instancje żyją dalej). */
293
+ autoDestroy: true,
294
+ /** Język tekstów interfejsu (np. 'pl'). `null` — według atrybutu `lang` elementu lub strony, domyślnie angielski. */
295
+ locale: null
296
+ };
297
+ var locales = { en: en_default, pl: pl_default };
298
+ function langOf(el) {
299
+ if (config.locale) return String(config.locale);
300
+ const owner = el?.closest?.("[lang]") || document.documentElement;
301
+ return owner.getAttribute("lang") || "en";
302
+ }
303
+ function localeOf(el) {
304
+ const tag = langOf(el).toLowerCase();
305
+ if (locales[tag]) return tag;
306
+ const base = tag.split("-")[0];
307
+ return locales[base] ? base : "en";
308
+ }
309
+ function t(key, vars = {}, el = null) {
310
+ const lang = localeOf(el);
311
+ let text = locales[lang][key] ?? locales.en[key] ?? key;
312
+ if (typeof text === "object") {
313
+ const form = new Intl.PluralRules(lang).select(Number(vars.n) || 0);
314
+ text = text[form] ?? text.other;
315
+ }
316
+ return String(text).replace(/\{(\w+)\}/g, (match, name) => name in vars ? String(vars[name]) : match);
317
+ }
318
+ function addLocale(code, messages) {
319
+ const key = String(code).toLowerCase();
320
+ locales[key] = { ...locales[key] || {}, ...messages };
321
+ }
61
322
  var api = {};
62
323
  var $ = (sel, ctx = document) => typeof sel === "string" ? ctx.querySelector(sel) : sel || null;
63
324
  var $$ = (sel, ctx = document) => typeof sel === "string" ? [...ctx.querySelectorAll(sel)] : sel ? sel instanceof Element ? [sel] : [...sel] : [];
@@ -119,34 +380,46 @@
119
380
  }
120
381
  var Component = class {
121
382
  constructor(el, options = {}) {
122
- const C = this.constructor;
383
+ const name = this.constructor.componentName;
123
384
  this.el = el;
124
- this.options = {
125
- ...C.defaults,
126
- ...parseOptions(el.getAttribute(`data-pl-${C.componentName}`), C.defaults, C.primary),
127
- ...options
128
- };
129
- this._cleanup = [];
130
- let map = store.get(el);
131
- if (!map) store.set(el, map = /* @__PURE__ */ new Map());
132
- map.set(C.componentName, this);
133
- this.init();
385
+ meta.set(this, { options, declarative: el.hasAttribute(`data-pl-${name}`), destroyed: false });
386
+ const destroy = this.destroy;
387
+ Object.defineProperty(this, "destroy", {
388
+ configurable: true,
389
+ writable: true,
390
+ value: () => {
391
+ const state = meta.get(this);
392
+ forget(this);
393
+ if (state.destroyed) return;
394
+ state.destroyed = true;
395
+ destroy.call(this);
396
+ }
397
+ });
398
+ mount(this);
134
399
  }
135
400
  /** Punkt wejścia komponentu. Stan instancji ustawiaj tutaj (nie w polach klasy). */
136
401
  init() {
137
402
  }
403
+ /**
404
+ * AbortSignal bieżącego „życia" instancji — przerywany w destroy(), nowy po ponownym init().
405
+ * Przekazuj go do fetch() i sprawdzaj po każdym await (`if (signal.aborted) return`).
406
+ */
407
+ get signal() {
408
+ return this._life.signal;
409
+ }
138
410
  /** addEventListener z automatycznym sprzątaniem w destroy(). Zwraca funkcję odpinającą. */
139
411
  on(target, type, handler, options) {
140
- if (!target) return () => {
412
+ if (!target || meta.get(this)?.destroyed) return () => {
141
413
  };
142
414
  target.addEventListener(type, handler, options);
143
415
  const off = () => target.removeEventListener(type, handler, options);
144
416
  this._cleanup.push(off);
145
417
  return off;
146
418
  }
147
- /** Rejestruje dowolną funkcję sprzątającą. */
419
+ /** Rejestruje dowolną funkcję sprzątającą. Po destroy() wywołuje ją od razu. */
148
420
  onDestroy(fn) {
149
- this._cleanup.push(fn);
421
+ if (meta.get(this)?.destroyed) fn();
422
+ else this._cleanup.push(fn);
150
423
  }
151
424
  /**
152
425
  * Wysyła zdarzenie `pl:{type}` na elemencie komponentu (bąbelkuje).
@@ -162,19 +435,114 @@
162
435
  return !event.defaultPrevented;
163
436
  }
164
437
  destroy() {
165
- this._cleanup.splice(0).forEach((fn) => fn());
166
- store.get(this.el)?.delete(this.constructor.componentName);
438
+ const state = meta.get(this);
439
+ if (state) state.destroyed = true;
440
+ this._life?.abort();
441
+ const name = this.constructor.componentName;
442
+ for (const fn of this._cleanup.splice(0)) {
443
+ try {
444
+ fn();
445
+ } catch (error) {
446
+ console.error(`[Plossy] ${name}:`, error);
447
+ }
448
+ }
449
+ const map = store.get(this.el);
450
+ if (map?.get(name) === this) {
451
+ map.delete(name);
452
+ liveCount--;
453
+ }
167
454
  }
168
455
  };
169
456
  /** Domyślne opcje — nadpisywane w klasach potomnych. */
170
457
  __publicField(Component, "defaults", {});
171
458
  /** Nazwa opcji, do której trafia „goła" wartość atrybutu (np. data-pl-toggle="#cel"). */
172
459
  __publicField(Component, "primary", null);
460
+ function mount(instance) {
461
+ const C = instance.constructor;
462
+ const el = instance.el;
463
+ const state = meta.get(instance);
464
+ instance.options = {
465
+ ...C.defaults,
466
+ ...parseOptions(el.getAttribute(`data-pl-${C.componentName}`), C.defaults, C.primary),
467
+ ...state.options
468
+ };
469
+ instance._cleanup = [];
470
+ instance._life = new AbortController();
471
+ state.destroyed = false;
472
+ let map = store.get(el);
473
+ if (!map) store.set(el, map = /* @__PURE__ */ new Map());
474
+ if (!map.has(C.componentName)) liveCount++;
475
+ map.set(C.componentName, instance);
476
+ instance.init();
477
+ }
173
478
  function getInstance(el, name) {
174
479
  return store.get(el)?.get(name) || null;
175
480
  }
176
481
  function create(el, name, options) {
177
- return getInstance(el, name) || new (registry.get(name))(el, options);
482
+ return getInstance(el, name) || wake(el, name) || new (registry.get(name))(el, options);
483
+ }
484
+ function keep(instance) {
485
+ const el = instance.el;
486
+ let map = dormant.get(el);
487
+ if (!map) {
488
+ dormant.set(el, map = /* @__PURE__ */ new Map());
489
+ dormantCount++;
490
+ dormantGone?.register(el, null, map);
491
+ }
492
+ map.set(instance.constructor.componentName, instance);
493
+ }
494
+ function forget(instance) {
495
+ const map = dormant.get(instance.el);
496
+ const name = instance.constructor.componentName;
497
+ if (map?.get(name) !== instance) return;
498
+ map.delete(name);
499
+ if (!map.size) {
500
+ dormant.delete(instance.el);
501
+ dormantCount--;
502
+ dormantGone?.unregister(map);
503
+ }
504
+ }
505
+ function wake(el, only) {
506
+ const map = dormant.get(el);
507
+ if (!map) return null;
508
+ let woken = null;
509
+ for (const [name, instance] of [...map]) {
510
+ if (only && name !== only) continue;
511
+ forget(instance);
512
+ if (getInstance(el, name) || meta.get(instance).declarative && !el.hasAttribute(`data-pl-${name}`)) continue;
513
+ try {
514
+ mount(instance);
515
+ woken = instance;
516
+ } catch (error) {
517
+ console.error(`[Plossy] ${name}:`, error);
518
+ }
519
+ }
520
+ return woken;
521
+ }
522
+ var subtree = (root) => root instanceof Element ? [root, ...root.querySelectorAll("*")] : [...root.querySelectorAll("*")];
523
+ function release(root) {
524
+ if (!liveCount || root.isConnected) return;
525
+ for (const el of subtree(root).reverse()) {
526
+ const map = store.get(el);
527
+ if (!map || el.isConnected || el.closest(`[${PERSIST}]`)) continue;
528
+ for (const [name, instance] of [...map]) {
529
+ if (map.get(name) !== instance) continue;
530
+ try {
531
+ instance.destroy();
532
+ } catch (error) {
533
+ console.error(`[Plossy] ${name}:`, error);
534
+ }
535
+ keep(instance);
536
+ }
537
+ }
538
+ }
539
+ var removed = /* @__PURE__ */ new Set();
540
+ var releaseTimer = 0;
541
+ function flushRemoved() {
542
+ releaseTimer = 0;
543
+ const roots = [...removed];
544
+ removed.clear();
545
+ if (config.autoDestroy) roots.forEach(release);
178
546
  }
179
547
  function register(name, Class) {
180
548
  Class.componentName = name;
@@ -191,6 +559,7 @@
191
559
  return Class;
192
560
  }
193
561
  function scan(root = document) {
562
+ if (dormantCount) subtree(root).forEach((el) => wake(el));
194
563
  if (!selector) return;
195
564
  const nodes = [...root.querySelectorAll(selector)];
196
565
  if (root instanceof Element && root.matches(selector)) nodes.unshift(root);
@@ -213,10 +582,16 @@
213
582
  scan(document);
214
583
  new MutationObserver((records) => {
215
584
  for (const record of records) {
585
+ if (config.autoDestroy && !record.target.closest?.(`[${PERSIST}]`)) {
586
+ for (const node of record.removedNodes) {
587
+ if (node.nodeType === 1) removed.add(node);
588
+ }
589
+ }
216
590
  for (const node of record.addedNodes) {
217
- if (node.nodeType === 1) scan(node);
591
+ if (node.nodeType === 1 && node.isConnected) scan(node);
218
592
  }
219
593
  }
594
+ if (removed.size && !releaseTimer) releaseTimer = setTimeout(flushRemoved);
220
595
  }).observe(document.documentElement, { childList: true, subtree: true });
221
596
  };
222
597
  if (document.readyState === "loading") {
@@ -369,6 +744,9 @@
369
744
  register,
370
745
  scan,
371
746
  getInstance,
747
+ config,
748
+ addLocale,
749
+ locales,
372
750
  Component,
373
751
  util: {
374
752
  $,
@@ -376,6 +754,8 @@
376
754
  uid,
377
755
  clamp,
378
756
  parseOptions,
757
+ t,
758
+ langOf,
379
759
  queryTargets,
380
760
  focusables,
381
761
  animationsDone,
@@ -600,7 +980,6 @@
600
980
  ["minutes", 60],
601
981
  ["seconds", 1]
602
982
  ];
603
- var LABELS = { days: "dni", hours: "godz.", minutes: "min", seconds: "s" };
604
983
  var Countdown = class extends Component {
605
984
  init() {
606
985
  this.timer = null;
@@ -635,7 +1014,7 @@
635
1014
  if (date !== "" && date !== null && date !== void 0) {
636
1015
  const time = typeof date === "number" ? date : Date.parse(date);
637
1016
  if (!Number.isNaN(time)) return time;
638
- console.warn(`[Plossy] countdown: nieprawid\u0142owa data \u201E${date}"`);
1017
+ console.warn(`[Plossy] countdown: invalid date "${date}"`);
639
1018
  }
640
1019
  return Date.now() + Math.max(0, Number(seconds) || 0) * 1e3;
641
1020
  }
@@ -717,7 +1096,7 @@
717
1096
  }
718
1097
  if (!changed) return;
719
1098
  this.el.style.setProperty("--pl-countdown-progress", this.total ? String(1 - ms / this.total) : "0");
720
- const key = Object.entries(values).filter(([unit]) => unit !== "seconds" || Object.keys(values).length === 1).map(([unit, value]) => `${value} ${LABELS[unit]}`).join(" ");
1099
+ const key = Object.entries(values).filter(([unit]) => unit !== "seconds" || Object.keys(values).length === 1).map(([unit, value]) => `${value} ${t(`countdown.${unit}`, {}, this.el)}`).join(" ");
721
1100
  if (key !== this.srKey) {
722
1101
  this.srKey = key;
723
1102
  this.sr.textContent = key;
@@ -1174,7 +1553,7 @@
1174
1553
  const { el } = this;
1175
1554
  this.active = null;
1176
1555
  if (!el.hasAttribute("aria-label") && !el.textContent.trim()) {
1177
- el.setAttribute("aria-label", "Wr\xF3\u0107 na g\xF3r\u0119 strony");
1556
+ el.setAttribute("aria-label", t("totop.label", {}, el));
1178
1557
  }
1179
1558
  if (!el.matches("a[href], button")) {
1180
1559
  if (!el.hasAttribute("role")) el.setAttribute("role", "button");
@@ -1266,14 +1645,14 @@
1266
1645
  // src/js/components/upload.js
1267
1646
  var svg = (name) => `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${icons_default[name] || ""}</svg>`;
1268
1647
  var escapeHtml = (str) => String(str).replace(/[&<>"']/g, (c) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" })[c]);
1269
- function formatSize(bytes) {
1648
+ function formatSize(bytes, lang = "en") {
1270
1649
  const units = ["B", "KB", "MB", "GB"];
1271
1650
  let i = 0;
1272
1651
  while (bytes >= 1024 && i < units.length - 1) {
1273
1652
  bytes /= 1024;
1274
1653
  i++;
1275
1654
  }
1276
- return `${bytes.toLocaleString("pl-PL", { maximumFractionDigits: i ? 1 : 0 })} ${units[i]}`;
1655
+ return `${bytes.toLocaleString(lang, { maximumFractionDigits: i ? 1 : 0 })} ${units[i]}`;
1277
1656
  }
1278
1657
  function typeIcon(file) {
1279
1658
  const type = file.type || "";
@@ -1309,7 +1688,7 @@
1309
1688
  this.input.type = "file";
1310
1689
  this.input.tabIndex = -1;
1311
1690
  this.input.name = options.name;
1312
- this.input.setAttribute("aria-label", "Wybierz pliki");
1691
+ this.input.setAttribute("aria-label", t("upload.choose", {}, el));
1313
1692
  this.input.hidden = true;
1314
1693
  el.append(this.input);
1315
1694
  if (!el.hasAttribute("tabindex")) el.tabIndex = 0;
@@ -1401,14 +1780,14 @@
1401
1780
  for (const file of files) {
1402
1781
  let error = null;
1403
1782
  if (!matchesAccept(file, options.accept)) {
1404
- error = { type: "type", message: `Plik \u201E${file.name}\u201D ma niedozwolony format.` };
1783
+ error = { type: "type", message: t("upload.type", { name: file.name }, this.el) };
1405
1784
  } else if (options.maxSize && file.size > options.maxSize * 1024 * 1024) {
1406
1785
  error = {
1407
1786
  type: "size",
1408
- message: `Plik \u201E${file.name}\u201D jest za du\u017Cy (${formatSize(file.size)}). Maksymalny rozmiar to ${options.maxSize} MB.`
1787
+ message: t("upload.size", { name: file.name, size: formatSize(file.size, langOf(this.el)), max: options.maxSize }, this.el)
1409
1788
  };
1410
1789
  } else if (options.maxFiles && this.entries.length + accepted.length >= options.maxFiles) {
1411
- error = { type: "count", message: `Mo\u017Cna doda\u0107 najwy\u017Cej ${options.maxFiles} ${plural(options.maxFiles)}.` };
1790
+ error = { type: "count", message: t("upload.count", { n: options.maxFiles }, this.el) };
1412
1791
  }
1413
1792
  if (error) {
1414
1793
  if (error.type !== "count" || !errors.some((other) => other.type === "count")) errors.push({ ...error, file });
@@ -1439,7 +1818,7 @@
1439
1818
  thumb = `<img src="${entry.objectUrl}" alt="">`;
1440
1819
  }
1441
1820
  const name = escapeHtml(file.name);
1442
- item.innerHTML = `<span class="pl-upload-thumb">${thumb}</span><span class="pl-upload-info"><span class="pl-upload-name" title="${name}">${name}</span><span class="pl-upload-meta"></span></span><button class="pl-upload-remove" type="button" aria-label="Usu\u0144 plik ${name}">${svg("x")}</button><span class="pl-upload-progress" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0" aria-label="Post\u0119p przesy\u0142ania: ${name}"><span class="pl-upload-bar"></span></span>`;
1821
+ item.innerHTML = `<span class="pl-upload-thumb">${thumb}</span><span class="pl-upload-info"><span class="pl-upload-name" title="${name}">${name}</span><span class="pl-upload-meta"></span></span><button class="pl-upload-remove" type="button" aria-label="${escapeHtml(t("upload.remove", { name: file.name }, this.el))}">${svg("x")}</button><span class="pl-upload-progress" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0" aria-label="${escapeHtml(t("upload.progress", { name: file.name }, this.el))}"><span class="pl-upload-bar"></span></span>`;
1443
1822
  entry.el = item;
1444
1823
  this.list.append(item);
1445
1824
  this.describe(entry);
@@ -1449,9 +1828,9 @@
1449
1828
  describe(entry, text) {
1450
1829
  const { file } = entry;
1451
1830
  const ext = file.name.includes(".") ? file.name.split(".").pop().toUpperCase() : "";
1452
- const base = [formatSize(file.size), ext].filter(Boolean).join(" \xB7 ");
1453
- const meta = $(".pl-upload-meta", entry.el);
1454
- if (meta) meta.textContent = text ? `${text}` : base;
1831
+ const base = [formatSize(file.size, langOf(this.el)), ext].filter(Boolean).join(" \xB7 ");
1832
+ const meta2 = $(".pl-upload-meta", entry.el);
1833
+ if (meta2) meta2.textContent = text ? `${text}` : base;
1455
1834
  entry.base = base;
1456
1835
  }
1457
1836
  find(target) {
@@ -1469,7 +1848,7 @@
1469
1848
  entry.el.classList.remove("pl-upload-item-error");
1470
1849
  entry.el.style.setProperty("--pl-upload-value", percent / 100);
1471
1850
  $(".pl-upload-progress", entry.el)?.setAttribute("aria-valuenow", percent);
1472
- this.describe(entry, `Przesy\u0142anie\u2026 ${percent}%`);
1851
+ this.describe(entry, t("upload.uploading", { percent }, this.el));
1473
1852
  this.emit("progress", { file: entry.file, percent, ...detail });
1474
1853
  }
1475
1854
  /** Oznacza plik jako przesłany. */
@@ -1482,12 +1861,12 @@
1482
1861
  entry.el.classList.remove("pl-upload-item-uploading", "pl-upload-item-error");
1483
1862
  entry.el.classList.add("pl-upload-item-done");
1484
1863
  this.describe(entry);
1485
- this.describe(entry, `${entry.base} \xB7 Przes\u0142ano`);
1864
+ this.describe(entry, `${entry.base} \xB7 ${t("upload.done", {}, this.el)}`);
1486
1865
  this.emit("complete", { file: entry.file, response, xhr });
1487
1866
  if (this.entries.every((other) => other.status === "done")) this.emit("completeall", { files: this.files });
1488
1867
  }
1489
1868
  /** Oznacza plik jako nieprzesłany. */
1490
- fail(target, message = "Nie uda\u0142o si\u0119 przes\u0142a\u0107 pliku.", xhr = null) {
1869
+ fail(target, message = t("upload.failed", {}, this.el), xhr = null) {
1491
1870
  const entry = this.find(target);
1492
1871
  if (!entry) return;
1493
1872
  entry.status = "error";
@@ -1523,12 +1902,12 @@
1523
1902
  }
1524
1903
  this.complete(entry, response, xhr);
1525
1904
  } else {
1526
- this.fail(entry, `Nie uda\u0142o si\u0119 przes\u0142a\u0107 pliku (b\u0142\u0105d ${xhr.status}).`, xhr);
1905
+ this.fail(entry, t("upload.failedStatus", { status: xhr.status }, this.el), xhr);
1527
1906
  }
1528
1907
  });
1529
1908
  xhr.addEventListener("error", () => {
1530
1909
  entry.xhr = null;
1531
- this.fail(entry, "Nie uda\u0142o si\u0119 przes\u0142a\u0107 pliku \u2014 sprawd\u017A po\u0142\u0105czenie.", xhr);
1910
+ this.fail(entry, t("upload.failedNetwork", {}, this.el), xhr);
1532
1911
  });
1533
1912
  if (!this.emit("beforesend", { file: entry.file, xhr, data }, true)) {
1534
1913
  entry.xhr = null;
@@ -1557,14 +1936,14 @@
1557
1936
  }
1558
1937
  /** Usuwa wszystkie pliki. */
1559
1938
  clear(silent = false) {
1560
- const removed = this.entries.splice(0);
1561
- removed.forEach((entry) => {
1939
+ const removed2 = this.entries.splice(0);
1940
+ removed2.forEach((entry) => {
1562
1941
  this.release(entry);
1563
1942
  entry.el.remove();
1564
1943
  });
1565
1944
  this.clearErrors();
1566
1945
  this.sync();
1567
- if (!silent) removed.forEach((entry) => this.emit("remove", { file: entry.file }));
1946
+ if (!silent) removed2.forEach((entry) => this.emit("remove", { file: entry.file }));
1568
1947
  }
1569
1948
  /** Utrzymuje `input.files` w zgodzie z listą — zwykły formularz wyśle to, co widać. */
1570
1949
  sync() {
@@ -1620,12 +1999,6 @@
1620
1999
  messages: true
1621
2000
  // pokazuj komunikaty błędów pod strefą
1622
2001
  });
1623
- function plural(n) {
1624
- if (n === 1) return "plik";
1625
- const mod10 = n % 10;
1626
- const mod100 = n % 100;
1627
- return mod10 >= 2 && mod10 <= 4 && !(mod100 >= 12 && mod100 <= 14) ? "pliki" : "plik\xF3w";
1628
- }
1629
2002
  register("upload", Upload);
1630
2003
 
1631
2004
  // src/js/components/otp.js
@@ -1650,7 +2023,7 @@
1650
2023
  const disabled = this.input.disabled;
1651
2024
  const initial = this.sanitize(this.input.value || "");
1652
2025
  el.setAttribute("role", "group");
1653
- if (!el.hasAttribute("aria-label") && !el.hasAttribute("aria-labelledby")) el.setAttribute("aria-label", options.label);
2026
+ if (!el.hasAttribute("aria-label") && !el.hasAttribute("aria-labelledby")) el.setAttribute("aria-label", options.label ?? t("otp.label", {}, el));
1654
2027
  this.boxes = [];
1655
2028
  this.generated = [];
1656
2029
  let group = null;
@@ -1678,7 +2051,7 @@
1678
2051
  box.spellcheck = false;
1679
2052
  box.disabled = disabled;
1680
2053
  box.style.setProperty("--pl-otp-index", i);
1681
- box.setAttribute("aria-label", `Znak ${i + 1} z ${length}`);
2054
+ box.setAttribute("aria-label", t("otp.char", { n: i + 1, count: length }, this.el));
1682
2055
  group.append(box);
1683
2056
  this.boxes.push(box);
1684
2057
  }
@@ -1705,20 +2078,20 @@
1705
2078
  const box = event.target;
1706
2079
  if (!box.classList?.contains("pl-otp-box")) return;
1707
2080
  const index = this.boxes.indexOf(box);
1708
- let chars2 = this.sanitize(box.value);
2081
+ let chars = this.sanitize(box.value);
1709
2082
  const prev = this.prev?.[index];
1710
- if (prev && chars2.length === 2) chars2 = chars2.replace(prev, "") || prev;
2083
+ if (prev && chars.length === 2) chars = chars.replace(prev, "") || prev;
1711
2084
  box.value = "";
1712
- if (chars2) this.fill(chars2.length >= this.options.length ? 0 : index, chars2);
2085
+ if (chars) this.fill(chars.length >= this.options.length ? 0 : index, chars);
1713
2086
  else this.update();
1714
2087
  });
1715
2088
  this.on(el, "paste", (event) => {
1716
2089
  const box = event.target;
1717
2090
  if (!box.classList?.contains("pl-otp-box")) return;
1718
2091
  event.preventDefault();
1719
- const chars2 = this.sanitize(event.clipboardData?.getData("text") || "");
1720
- if (!chars2) return this.reject(box);
1721
- this.fill(chars2.length >= this.options.length ? 0 : this.boxes.indexOf(box), chars2);
2092
+ const chars = this.sanitize(event.clipboardData?.getData("text") || "");
2093
+ if (!chars) return this.reject(box);
2094
+ this.fill(chars.length >= this.options.length ? 0 : this.boxes.indexOf(box), chars);
1722
2095
  });
1723
2096
  this.on(el, "keydown", (event) => {
1724
2097
  const box = event.target;
@@ -1790,10 +2163,10 @@
1790
2163
  return this.boxes.every((box) => box.value);
1791
2164
  }
1792
2165
  /** Wpisuje znaki od pozycji `index` i przenosi fokus dalej. */
1793
- fill(index, chars2) {
2166
+ fill(index, chars) {
1794
2167
  index = Math.max(0, index);
1795
2168
  let last = index;
1796
- [...chars2].slice(0, this.boxes.length - index).forEach((char, offset) => {
2169
+ [...chars].slice(0, this.boxes.length - index).forEach((char, offset) => {
1797
2170
  const box = this.boxes[index + offset];
1798
2171
  box.value = char;
1799
2172
  this.pop(box);
@@ -1819,9 +2192,9 @@
1819
2192
  setTimeout(() => box.classList.remove("pl-otp-shake"), 450);
1820
2193
  }
1821
2194
  write(code, silent = false) {
1822
- const chars2 = [...this.sanitize(code)];
2195
+ const chars = [...this.sanitize(code)];
1823
2196
  this.boxes.forEach((box, i) => {
1824
- box.value = chars2[i] || "";
2197
+ box.value = chars[i] || "";
1825
2198
  });
1826
2199
  this.update(silent);
1827
2200
  }
@@ -1910,24 +2283,21 @@
1910
2283
  autofocus: false,
1911
2284
  submit: false,
1912
2285
  // po wpisaniu całego kodu wysyła formularz
1913
- label: "Kod jednorazowy"
2286
+ label: null
2287
+ // domyślnie z tekstów języka strony
1914
2288
  });
1915
2289
  __publicField(Otp, "primary", "length");
1916
2290
  register("otp", Otp);
1917
2291
 
1918
2292
  // src/js/components/strength.js
1919
- var RULES = {
1920
- length: (min) => `Co najmniej ${min} znak\xF3w`,
1921
- case: () => "Ma\u0142a i wielka litera",
1922
- digit: () => "Co najmniej jedna cyfra",
1923
- symbol: () => "Znak specjalny (np. ! @ # ?)"
1924
- };
2293
+ var RULES = ["length", "case", "digit", "symbol"];
1925
2294
  var Strength = class extends Component {
1926
2295
  init() {
1927
2296
  var _a;
1928
2297
  const { el, options } = this;
1929
2298
  el.classList.add("pl-strength");
1930
2299
  this.input = options.input && $(options.input) || $("input", el);
2300
+ options.labels ?? (options.labels = t("strength.levels", {}, el));
1931
2301
  if (typeof options.labels === "string") options.labels = options.labels.split(",").map((label) => label.trim());
1932
2302
  this.created = [];
1933
2303
  this.score = 0;
@@ -1944,7 +2314,7 @@
1944
2314
  for (let i = 0; i < 4; i++) this.meter.append(this.make("span", "pl-strength-segment"));
1945
2315
  }
1946
2316
  this.meter.setAttribute("role", "meter");
1947
- this.meter.setAttribute("aria-label", "Si\u0142a has\u0142a");
2317
+ this.meter.setAttribute("aria-label", t("strength.meter", {}, el));
1948
2318
  this.meter.setAttribute("aria-valuemin", "0");
1949
2319
  this.meter.setAttribute("aria-valuemax", "4");
1950
2320
  this.labelEl = $(".pl-strength-label", el);
@@ -1961,10 +2331,10 @@
1961
2331
  this.created.push(this.rulesEl);
1962
2332
  }
1963
2333
  if (this.rulesEl && !this.rulesEl.children.length) {
1964
- for (const [rule, text] of Object.entries(RULES)) {
2334
+ for (const rule of RULES) {
1965
2335
  const item = this.make("li", "pl-strength-rule");
1966
2336
  item.dataset.rule = rule;
1967
- item.textContent = text(options.minLength);
2337
+ item.textContent = t(`strength.rule.${rule}`, { n: options.minLength }, el);
1968
2338
  this.rulesEl.append(item);
1969
2339
  }
1970
2340
  }
@@ -2015,13 +2385,13 @@
2015
2385
  this.el.dataset.score = score;
2016
2386
  [...this.meter.children].forEach((segment, i) => segment.classList.toggle("pl-active", i < score));
2017
2387
  this.meter.setAttribute("aria-valuenow", score);
2018
- this.meter.setAttribute("aria-valuetext", label || "Brak has\u0142a");
2388
+ this.meter.setAttribute("aria-valuetext", label || t("strength.empty", {}, this.el));
2019
2389
  if (this.labelEl) this.labelEl.textContent = label;
2020
2390
  if (this.rulesEl) {
2021
2391
  for (const item of this.rulesEl.querySelectorAll("[data-rule]")) {
2022
2392
  const met = !!rules[item.dataset.rule];
2023
2393
  item.classList.toggle("pl-active", met);
2024
- item.setAttribute("aria-label", `${item.textContent} \u2014 ${met ? "spe\u0142nione" : "niespe\u0142nione"}`);
2394
+ item.setAttribute("aria-label", `${item.textContent} \u2014 ${t(met ? "strength.met" : "strength.unmet", {}, this.el)}`);
2025
2395
  }
2026
2396
  }
2027
2397
  const changed = score !== this.score;
@@ -2036,7 +2406,8 @@
2036
2406
  // lista wymagań odhaczanych na żywo
2037
2407
  label: true,
2038
2408
  // etykieta słowna
2039
- labels: ["S\u0142abe", "\u015Arednie", "Dobre", "Silne"],
2409
+ labels: null,
2410
+ // cztery poziomy; domyślnie z tekstów języka strony
2040
2411
  input: "",
2041
2412
  // selektor pola, gdy leży poza komponentem
2042
2413
  emptyLabel: ""
@@ -2054,7 +2425,7 @@
2054
2425
  el.classList.toggle("pl-rating-readonly", !!options.readonly);
2055
2426
  el.style.setProperty("--pl-rating-max", max);
2056
2427
  el.setAttribute("role", "radiogroup");
2057
- if (!el.hasAttribute("aria-label") && !el.hasAttribute("aria-labelledby")) el.setAttribute("aria-label", options.label);
2428
+ if (!el.hasAttribute("aria-label") && !el.hasAttribute("aria-labelledby")) el.setAttribute("aria-label", options.label ?? t("rating.label", {}, el));
2058
2429
  const name = options.name || uid("pl-rating");
2059
2430
  const make = (value) => {
2060
2431
  const input = document.createElement("input");
@@ -2146,7 +2517,8 @@
2146
2517
  readonly: false,
2147
2518
  clearable: true,
2148
2519
  // ponowne kliknięcie wybranej gwiazdki zeruje ocenę
2149
- label: "Ocena",
2520
+ label: null,
2521
+ // domyślnie z tekstów języka strony
2150
2522
  star: "gwiazdka|gwiazdki|gwiazdek"
2151
2523
  // odmiana do etykiet ARIA
2152
2524
  });
@@ -2168,12 +2540,12 @@
2168
2540
  }
2169
2541
  this.input.classList.add("pl-quantity-input");
2170
2542
  if (!this.input.hasAttribute("inputmode")) this.input.inputMode = "numeric";
2171
- if (!this.input.hasAttribute("aria-label") && !this.input.labels?.length) this.input.setAttribute("aria-label", "Ilo\u015B\u0107");
2543
+ if (!this.input.hasAttribute("aria-label") && !this.input.labels?.length) this.input.setAttribute("aria-label", t("quantity.label", {}, el));
2172
2544
  const make = (dir) => {
2173
2545
  const button = document.createElement("button");
2174
2546
  button.type = "button";
2175
2547
  button.className = `pl-quantity-button ${dir < 0 ? "pl-quantity-minus" : "pl-quantity-plus"}`;
2176
- button.setAttribute("aria-label", dir < 0 ? options.minusLabel : options.plusLabel);
2548
+ button.setAttribute("aria-label", dir < 0 ? options.minusLabel ?? t("quantity.minus", {}, el) : options.plusLabel ?? t("quantity.plus", {}, el));
2177
2549
  button.tabIndex = -1;
2178
2550
  this.on(button, "pointerdown", (event) => {
2179
2551
  if (event.button) return;
@@ -2289,8 +2661,9 @@
2289
2661
  step: null,
2290
2662
  repeat: true,
2291
2663
  // przytrzymanie przycisku powtarza zmianę
2292
- minusLabel: "Mniej",
2293
- plusLabel: "Wi\u0119cej"
2664
+ minusLabel: null,
2665
+ // domyślnie z tekstów języka strony
2666
+ plusLabel: null
2294
2667
  });
2295
2668
  register("quantity", Quantity);
2296
2669
 
@@ -2308,6 +2681,9 @@
2308
2681
  var Combobox = class extends Component {
2309
2682
  init() {
2310
2683
  const { el, options } = this;
2684
+ options.emptyText ?? (options.emptyText = t("combobox.empty", {}, el));
2685
+ options.loadingText ?? (options.loadingText = t("combobox.loading", {}, el));
2686
+ options.createText ?? (options.createText = t("combobox.create", {}, el));
2311
2687
  this.isSelect = el.tagName === "SELECT";
2312
2688
  this.multiple = this.isSelect && el.multiple;
2313
2689
  this.isOpen = false;
@@ -2380,7 +2756,7 @@
2380
2756
  this.clearButton.type = "button";
2381
2757
  this.clearButton.className = "pl-combobox-clear";
2382
2758
  this.clearButton.tabIndex = -1;
2383
- this.clearButton.setAttribute("aria-label", "Wyczy\u015B\u0107");
2759
+ this.clearButton.setAttribute("aria-label", t("clear", {}, el));
2384
2760
  this.clearButton.innerHTML = svg2("x");
2385
2761
  this.clearButton.hidden = true;
2386
2762
  if (options.clearable) control.append(this.clearButton);
@@ -2395,7 +2771,7 @@
2395
2771
  list.hidden = true;
2396
2772
  if (this.multiple) list.setAttribute("aria-multiselectable", "true");
2397
2773
  if (input.getAttribute("aria-labelledby")) list.setAttribute("aria-labelledby", input.getAttribute("aria-labelledby"));
2398
- else list.setAttribute("aria-label", this.placeholder || "Opcje");
2774
+ else list.setAttribute("aria-label", this.placeholder || t("combobox.options", {}, el));
2399
2775
  wrapper.append(control, list);
2400
2776
  this.onDestroy(() => {
2401
2777
  this.stopPlace?.();
@@ -2504,13 +2880,15 @@
2504
2880
  });
2505
2881
  if (this.isSelect) {
2506
2882
  this.on(this.el, "focus", () => input.focus());
2507
- this.on(this.el.form, "reset", () => setTimeout(() => this.refresh()));
2883
+ this.on(this.el.form, "reset", () => setTimeout(() => !this.signal.aborted && this.refresh()));
2508
2884
  } else {
2509
2885
  this.on(input, "change", () => {
2510
2886
  if (!this.syncing) this.emit("change", { value: input.value, item: null });
2511
2887
  });
2512
2888
  }
2513
- this.load = debounce((query) => this.fetch(query), options.delay);
2889
+ const { signal } = this;
2890
+ this.load = debounce((query) => !signal.aborted && this.fetch(query), options.delay);
2891
+ this.onDestroy(() => clearTimeout(this.typedTimer));
2514
2892
  }
2515
2893
  // ── Wartość ─────────────────────────────────────────────────────────────
2516
2894
  get hasValue() {
@@ -2533,7 +2911,7 @@
2533
2911
  const chip = document.createElement("span");
2534
2912
  chip.className = "pl-combobox-chip";
2535
2913
  chip.dataset.value = item.value;
2536
- chip.innerHTML = `<span class="pl-combobox-chip-label">${escapeHtml2(item.label)}</span><button class="pl-combobox-chip-remove" type="button" tabindex="-1" aria-label="Usu\u0144: ${escapeHtml2(item.label)}">${svg2("x")}</button>`;
2914
+ chip.innerHTML = `<span class="pl-combobox-chip-label">${escapeHtml2(item.label)}</span><button class="pl-combobox-chip-remove" type="button" tabindex="-1" aria-label="${escapeHtml2(t("combobox.remove", { label: item.label }, this.el))}">${svg2("x")}</button>`;
2537
2915
  control.insertBefore(chip, input);
2538
2916
  }
2539
2917
  chips.forEach((chip) => chip.remove());
@@ -2636,9 +3014,9 @@
2636
3014
  setOptions(list, silent = false) {
2637
3015
  const items = normalize(list);
2638
3016
  if (this.isSelect) {
2639
- const keep = new Set(this.selected.map((item) => item.value));
3017
+ const keep2 = new Set(this.selected.map((item) => item.value));
2640
3018
  [...this.el.options].forEach((option) => {
2641
- if (option !== this.placeholderOption && !keep.has(option.value)) option.remove();
3019
+ if (option !== this.placeholderOption && !keep2.has(option.value)) option.remove();
2642
3020
  });
2643
3021
  this.el.querySelectorAll("optgroup:empty").forEach((group) => group.remove());
2644
3022
  for (const item of items) {
@@ -2670,7 +3048,7 @@
2670
3048
  this.request++;
2671
3049
  this.setLoading(false);
2672
3050
  this.items = this.isSelect ? [...this.selected] : [];
2673
- this.renderList(options.minLength > 0 ? `Wpisz co najmniej ${options.minLength} zn., aby wyszuka\u0107` : options.emptyText);
3051
+ this.renderList(options.minLength > 0 ? t("combobox.minLength", { n: options.minLength }, this.el) : options.emptyText);
2674
3052
  return;
2675
3053
  }
2676
3054
  this.setLoading(true);
@@ -2683,18 +3061,19 @@
2683
3061
  async fetch(query) {
2684
3062
  const { options } = this;
2685
3063
  const token2 = ++this.request;
3064
+ const { signal } = this;
2686
3065
  try {
2687
3066
  const source = options.source;
2688
- const result = typeof source === "function" ? await source(query) : await fetch(`${source}${encodeURIComponent(query)}`).then((response) => response.json());
2689
- if (token2 !== this.request) return;
3067
+ const result = typeof source === "function" ? await source(query, { signal }) : await fetch(`${source}${encodeURIComponent(query)}`, { signal }).then((response) => response.json());
3068
+ if (signal.aborted || token2 !== this.request) return;
2690
3069
  const items = normalize(result);
2691
3070
  this.items = items.map((item) => this.selected.find((other) => other.value === item.value) || item);
2692
3071
  this.setLoading(false);
2693
3072
  if (this.isOpen) this.renderList(null, void 0, true);
2694
3073
  } catch (error) {
2695
- if (token2 !== this.request) return;
3074
+ if (signal.aborted || token2 !== this.request) return;
2696
3075
  this.setLoading(false);
2697
- this.renderMessage("Nie uda\u0142o si\u0119 pobra\u0107 wynik\xF3w");
3076
+ this.renderMessage(t("combobox.error", {}, this.el));
2698
3077
  this.emit("error", { error });
2699
3078
  }
2700
3079
  }
@@ -2941,8 +3320,9 @@
2941
3320
  if (this.isSelect) this.renderValue();
2942
3321
  this.emit("close");
2943
3322
  list.classList.add("pl-combobox-list-out");
3323
+ const { signal } = this;
2944
3324
  await animationsDone(list);
2945
- if (this.isOpen) return;
3325
+ if (signal.aborted || this.isOpen) return;
2946
3326
  this.stopPlace?.();
2947
3327
  this.stopPlace = null;
2948
3328
  list.classList.remove("pl-combobox-list-out");
@@ -2967,16 +3347,17 @@
2967
3347
  options: null,
2968
3348
  // lista pozycji (JS)
2969
3349
  source: null,
2970
- // funkcja async (q) => [...] lub adres URL (doklejane ?q)
3350
+ // funkcja async (q, { signal }) => [...] lub adres URL (doklejane ?q)
2971
3351
  minLength: 0,
2972
3352
  // minimalna długość zapytania dla `source`
2973
3353
  delay: 220,
2974
3354
  // opóźnienie zapytań `source` (ms)
2975
3355
  placement: "bottom-start",
2976
3356
  offset: 6,
2977
- emptyText: "Brak wynik\xF3w",
2978
- loadingText: "Szukam\u2026",
2979
- createText: "Dodaj"
3357
+ emptyText: null,
3358
+ // domyślnie z tekstów języka strony
3359
+ loadingText: null,
3360
+ createText: null
2980
3361
  });
2981
3362
  register("combobox", Combobox);
2982
3363
 
@@ -3007,26 +3388,16 @@
3007
3388
  return date.getMonth() === Number(match[2]) - 1 ? date : null;
3008
3389
  }
3009
3390
  var TOKENS = /yyyy|yy|MMMM|MMM|MM|M|dd|d/g;
3010
- var LABELS2 = {
3011
- dialog: "Wybierz dat\u0119",
3012
- prevMonth: "Poprzedni miesi\u0105c",
3013
- nextMonth: "Nast\u0119pny miesi\u0105c",
3014
- prevYear: "Poprzedni rok",
3015
- nextYear: "Nast\u0119pny rok",
3016
- prevYears: "Poprzednie lata",
3017
- nextYears: "Nast\u0119pne lata",
3018
- pickMonth: "Wybierz miesi\u0105c",
3019
- pickYear: "Wybierz rok",
3020
- today: "Dzi\u015B",
3021
- clear: "Wyczy\u015B\u0107"
3022
- };
3391
+ var LABEL_KEYS = ["dialog", "prevMonth", "nextMonth", "prevYear", "nextYear", "prevYears", "nextYears", "pickMonth", "pickYear", "today", "clear"];
3023
3392
  var Datepicker = class extends Component {
3024
3393
  init() {
3025
3394
  const { el, options } = this;
3026
3395
  this.isInput = el.tagName === "INPUT";
3027
3396
  this.inline = !!options.inline || !this.isInput;
3028
3397
  this.input = this.isInput ? el : null;
3029
- this.labels = { ...LABELS2, ...options.labels || {} };
3398
+ options.locale ?? (options.locale = langOf(el));
3399
+ const defaults = Object.fromEntries(LABEL_KEYS.map((key) => [key, t(`datepicker.${key}`, {}, el)]));
3400
+ this.labels = { ...defaults, ...options.labels || {} };
3030
3401
  this.isOpen = false;
3031
3402
  this.view = "days";
3032
3403
  this.start = null;
@@ -3087,7 +3458,7 @@
3087
3458
  try {
3088
3459
  return new Intl.DateTimeFormat(options.locale, opts);
3089
3460
  } catch {
3090
- return new Intl.DateTimeFormat("pl", opts);
3461
+ return new Intl.DateTimeFormat("en", opts);
3091
3462
  }
3092
3463
  };
3093
3464
  this.fmt = {
@@ -3648,8 +4019,9 @@
3648
4019
  if (focus || picker.contains(document.activeElement)) el.focus({ preventScroll: true });
3649
4020
  this.emit("close");
3650
4021
  picker.classList.add("pl-datepicker-out");
4022
+ const { signal } = this;
3651
4023
  await animationsDone(picker);
3652
- if (this.isOpen) return;
4024
+ if (signal.aborted || this.isOpen) return;
3653
4025
  this.stopPlace?.();
3654
4026
  this.stopPlace = null;
3655
4027
  picker.classList.remove("pl-datepicker-out");
@@ -3672,7 +4044,8 @@
3672
4044
  // dni tygodnia: 0 = niedziela … 6 = sobota, np. "0,6"
3673
4045
  disabledDates: "",
3674
4046
  // konkretne daty ISO rozdzielone przecinkami
3675
- locale: "pl",
4047
+ locale: null,
4048
+ // domyślnie język strony (atrybut lang)
3676
4049
  format: "dd.MM.yyyy",
3677
4050
  separator: " \u2013 ",
3678
4051
  // łącznik dat zakresu
@@ -3691,7 +4064,6 @@
3691
4064
  register("datepicker", Datepicker);
3692
4065
 
3693
4066
  // src/js/components/range.js
3694
- var numberFormat = typeof Intl !== "undefined" ? new Intl.NumberFormat("pl-PL", { maximumFractionDigits: 6 }) : null;
3695
4067
  var Range = class extends Component {
3696
4068
  init() {
3697
4069
  const { el, options } = this;
@@ -3799,7 +4171,8 @@
3799
4171
  return max > min ? clamp((Number(input.value) - min) / (max - min), 0, 1) : 0;
3800
4172
  }
3801
4173
  format(value) {
3802
- const text = numberFormat ? numberFormat.format(value) : String(value);
4174
+ this.numberFormat ?? (this.numberFormat = new Intl.NumberFormat(langOf(this.el), { maximumFractionDigits: 6 }));
4175
+ const text = this.numberFormat.format(value);
3803
4176
  return `${this.options.prefix}${text}${this.options.suffix}`;
3804
4177
  }
3805
4178
  /** Wartość (liczba) albo para [od, do] w trybie dual. */
@@ -4014,7 +4387,7 @@
4014
4387
  const { el, options } = this;
4015
4388
  const visible = this.visible;
4016
4389
  el.setAttribute("aria-pressed", String(visible));
4017
- el.setAttribute("aria-label", visible ? options.labelHide : options.labelShow);
4390
+ el.setAttribute("aria-label", visible ? options.labelHide ?? t("password.hide", {}, el) : options.labelShow ?? t("password.show", {}, el));
4018
4391
  el.classList.toggle("pl-active", visible);
4019
4392
  const icon = el.matches("[data-pl-icon]") ? el : $("[data-pl-icon]", el);
4020
4393
  if (icon) {
@@ -4045,8 +4418,9 @@
4045
4418
  // selektor pola; domyślnie pole hasła w tym samym opakowaniu
4046
4419
  iconShow: "eye",
4047
4420
  iconHide: "eye-off",
4048
- labelShow: "Poka\u017C has\u0142o",
4049
- labelHide: "Ukryj has\u0142o"
4421
+ labelShow: null,
4422
+ // domyślnie z tekstów języka strony
4423
+ labelHide: null
4050
4424
  });
4051
4425
  __publicField(PasswordToggle, "primary", "target");
4052
4426
  register("password-toggle", PasswordToggle);
@@ -4102,7 +4476,7 @@
4102
4476
  init() {
4103
4477
  const { el } = this;
4104
4478
  if (el.matches("button") && !el.hasAttribute("type")) el.type = "button";
4105
- if (!el.hasAttribute("aria-label") && !el.textContent.trim()) el.setAttribute("aria-label", "Wyczy\u015B\u0107");
4479
+ if (!el.hasAttribute("aria-label") && !el.textContent.trim()) el.setAttribute("aria-label", t("clear", {}, el));
4106
4480
  this.on(el, "click", (event) => {
4107
4481
  event.preventDefault();
4108
4482
  this.clear();
@@ -4122,38 +4496,31 @@
4122
4496
  __publicField(FormClear, "defaults", { target: "" });
4123
4497
  __publicField(FormClear, "primary", "target");
4124
4498
  register("form-clear", FormClear);
4125
- var plural2 = (n, one, few, many) => {
4126
- const mod10 = n % 10;
4127
- const mod100 = n % 100;
4128
- if (n === 1) return one;
4129
- if (mod10 >= 2 && mod10 <= 4 && (mod100 < 12 || mod100 > 14)) return few;
4130
- return many;
4131
- };
4132
- var chars = (n) => `${n} ${plural2(n, "znak", "znaki", "znak\xF3w")}`;
4133
4499
  function messageFor(field) {
4134
4500
  const v = field.validity;
4135
4501
  const custom = (key) => field.getAttribute(`data-pl-message-${key}`);
4502
+ const text = (key, vars) => t(`validation.${key}`, vars, field);
4136
4503
  if (v.valueMissing) {
4137
4504
  if (custom("required")) return custom("required");
4138
- if (field.type === "checkbox") return "Zaznacz to pole, aby kontynuowa\u0107.";
4139
- if (field.type === "radio") return "Wybierz jedn\u0105 z opcji.";
4140
- if (field.type === "file") return "Wybierz plik.";
4141
- if (field.matches("select")) return "Wybierz pozycj\u0119 z listy.";
4142
- return "To pole jest wymagane.";
4505
+ if (field.type === "checkbox") return text("checkbox");
4506
+ if (field.type === "radio") return text("radio");
4507
+ if (field.type === "file") return text("file");
4508
+ if (field.matches("select")) return text("select");
4509
+ return text("required");
4143
4510
  }
4144
4511
  if (v.typeMismatch) {
4145
4512
  if (custom("type")) return custom("type");
4146
- if (field.type === "email") return "Podaj poprawny adres e-mail, np. jan@example.com.";
4147
- if (field.type === "url") return "Podaj poprawny adres URL, np. https://example.com.";
4148
- return "Podaj warto\u015B\u0107 w poprawnym formacie.";
4149
- }
4150
- if (v.patternMismatch) return custom("pattern") || field.title || "Podaj warto\u015B\u0107 w wymaganym formacie.";
4151
- if (v.tooShort) return custom("minlength") || `Wpisz co najmniej ${chars(field.minLength)} (obecnie ${field.value.length}).`;
4152
- if (v.tooLong) return custom("maxlength") || `Wpisz najwy\u017Cej ${chars(field.maxLength)} (obecnie ${field.value.length}).`;
4153
- if (v.rangeUnderflow) return custom("min") || `Warto\u015B\u0107 nie mo\u017Ce by\u0107 mniejsza ni\u017C ${field.min}.`;
4154
- if (v.rangeOverflow) return custom("max") || `Warto\u015B\u0107 nie mo\u017Ce by\u0107 wi\u0119ksza ni\u017C ${field.max}.`;
4155
- if (v.stepMismatch) return custom("step") || "Podaj warto\u015B\u0107 zgodn\u0105 z dozwolonym krokiem.";
4156
- if (v.badInput) return custom("type") || "Podaj poprawn\u0105 warto\u015B\u0107.";
4513
+ if (field.type === "email") return text("email");
4514
+ if (field.type === "url") return text("url");
4515
+ return text("type");
4516
+ }
4517
+ if (v.patternMismatch) return custom("pattern") || field.title || text("pattern");
4518
+ if (v.tooShort) return custom("minlength") || text("minlength", { n: field.minLength, length: field.value.length });
4519
+ if (v.tooLong) return custom("maxlength") || text("maxlength", { n: field.maxLength, length: field.value.length });
4520
+ if (v.rangeUnderflow) return custom("min") || text("min", { min: field.min });
4521
+ if (v.rangeOverflow) return custom("max") || text("max", { max: field.max });
4522
+ if (v.stepMismatch) return custom("step") || text("step");
4523
+ if (v.badInput) return custom("type") || text("bad");
4157
4524
  if (v.customError) return field.validationMessage;
4158
4525
  return "";
4159
4526
  }
@@ -4513,6 +4880,7 @@
4513
4880
  });
4514
4881
  const { el, toggleEl } = this;
4515
4882
  const token2 = ++this.token;
4883
+ const { signal } = this;
4516
4884
  this.isOpen = true;
4517
4885
  open.push(this);
4518
4886
  el.classList.remove("pl-leave");
@@ -4530,7 +4898,7 @@
4530
4898
  });
4531
4899
  this.emit("show");
4532
4900
  animationsDone(el).then(() => {
4533
- if (token2 === this.token && this.isOpen) this.emit("shown");
4901
+ if (!signal.aborted && token2 === this.token && this.isOpen) this.emit("shown");
4534
4902
  });
4535
4903
  }
4536
4904
  /** Zamyka drop; `refocus` przenosi fokus z powrotem na przełącznik. */
@@ -4543,6 +4911,7 @@
4543
4911
  });
4544
4912
  const { el, toggleEl } = this;
4545
4913
  const token2 = ++this.token;
4914
+ const { signal } = this;
4546
4915
  const hadFocus = el.contains(document.activeElement);
4547
4916
  this.isOpen = false;
4548
4917
  const index = open.indexOf(this);
@@ -4558,7 +4927,7 @@
4558
4927
  el.classList.remove("pl-open");
4559
4928
  this.emit("hide");
4560
4929
  await animationsDone(el);
4561
- if (token2 !== this.token) return;
4930
+ if (signal.aborted || token2 !== this.token) return;
4562
4931
  this.teardown();
4563
4932
  this.emit("hidden");
4564
4933
  }
@@ -4881,7 +5250,7 @@
4881
5250
  const button = document.createElement("button");
4882
5251
  button.type = "button";
4883
5252
  button.className = "pl-close";
4884
- button.setAttribute("aria-label", "Zamknij");
5253
+ button.setAttribute("aria-label", t("close", {}, this.el));
4885
5254
  button.setAttribute("data-pl-popover-close", "");
4886
5255
  return button;
4887
5256
  };
@@ -4958,6 +5327,7 @@
4958
5327
  if (other !== this && !other.pop?.contains(el)) other.hide();
4959
5328
  });
4960
5329
  const token2 = ++this.token;
5330
+ const { signal } = this;
4961
5331
  this.isOpen = true;
4962
5332
  open2.push(this);
4963
5333
  pop.classList.remove("pl-leave");
@@ -4974,7 +5344,7 @@
4974
5344
  }
4975
5345
  this.emit("show");
4976
5346
  animationsDone(pop).then(() => {
4977
- if (token2 === this.token && this.isOpen) this.emit("shown");
5347
+ if (!signal.aborted && token2 === this.token && this.isOpen) this.emit("shown");
4978
5348
  });
4979
5349
  }
4980
5350
  /** Zamyka popover; `refocus` wymusza powrót fokusu na element wyzwalający. */
@@ -4987,6 +5357,7 @@
4987
5357
  if (other !== this && pop.contains(other.el)) other.hide();
4988
5358
  });
4989
5359
  const token2 = ++this.token;
5360
+ const { signal } = this;
4990
5361
  const hadFocus = pop.contains(document.activeElement);
4991
5362
  this.isOpen = false;
4992
5363
  const index = open2.indexOf(this);
@@ -5003,7 +5374,7 @@
5003
5374
  pop.classList.remove("pl-open");
5004
5375
  this.emit("hide");
5005
5376
  await animationsDone(pop);
5006
- if (token2 !== this.token) return;
5377
+ if (signal.aborted || token2 !== this.token) return;
5007
5378
  this.teardown();
5008
5379
  this.emit("hidden");
5009
5380
  }
@@ -5135,8 +5506,9 @@
5135
5506
  if (!this.options.stack) {
5136
5507
  [...opened].filter((other) => other !== this && !other.el.contains(el)).forEach((other) => other.hide());
5137
5508
  }
5138
- this.opener = opener instanceof Element ? opener : document.activeElement;
5139
5509
  if (!el.isConnected) document.body.append(el);
5510
+ if (getInstance(el, this.constructor.componentName) !== this) scan(el);
5511
+ this.opener = opener instanceof Element ? opener : document.activeElement;
5140
5512
  el.classList.remove("pl-closing");
5141
5513
  if (el.open) el.close();
5142
5514
  this.state = "open";
@@ -5166,7 +5538,10 @@
5166
5538
  this.state = "closing";
5167
5539
  this.el.classList.add("pl-closing");
5168
5540
  this.emit("hide");
5169
- this.closing = settle([this.el, this.panel]).then(() => this.finish());
5541
+ const { signal } = this;
5542
+ this.closing = settle([this.el, this.panel]).then(() => {
5543
+ if (!signal.aborted) this.finish();
5544
+ });
5170
5545
  return this.closing;
5171
5546
  }
5172
5547
  /** Domyka okno po animacji (lub natychmiast, gdy zamknęła je przeglądarka). */
@@ -5221,7 +5596,7 @@
5221
5596
  __publicField(Modal, "defaults", { ...Overlay.defaults });
5222
5597
  register("modal", Modal);
5223
5598
  delegateOpen("modal");
5224
- var labels = { ok: "OK", cancel: "Anuluj", close: "Zamknij" };
5599
+ var labels = {};
5225
5600
  var escapeHtml3 = (value) => String(value ?? "").replace(/[&<>"']/g, (c) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" })[c]);
5226
5601
  function dialog(content, options = {}) {
5227
5602
  const { cls = "", ...rest } = options;
@@ -5246,8 +5621,8 @@
5246
5621
  const {
5247
5622
  title = "",
5248
5623
  html = false,
5249
- ok = labels.ok,
5250
- cancel = labels.cancel,
5624
+ ok = labels.ok ?? t("modal.ok"),
5625
+ cancel = labels.cancel ?? t("modal.cancel"),
5251
5626
  tone = "primary",
5252
5627
  cls = "pl-modal-small pl-modal-center",
5253
5628
  placeholder = "",
@@ -5311,7 +5686,7 @@
5311
5686
  this.side = side;
5312
5687
  SIDES.forEach((name) => el.classList.toggle(`pl-offcanvas-${name}`, name === side));
5313
5688
  el.classList.toggle("pl-offcanvas-no-overlay", !this.options.overlay);
5314
- if (!el.hasAttribute("aria-labelledby") && !el.hasAttribute("aria-label")) el.setAttribute("aria-label", "Panel boczny");
5689
+ if (!el.hasAttribute("aria-labelledby") && !el.hasAttribute("aria-label")) el.setAttribute("aria-label", t("offcanvas.label", {}, el));
5315
5690
  this.on(el, "click", (event) => {
5316
5691
  if (!this.options.anchorClose) return;
5317
5692
  const link = event.target.closest('a[href^="#"]');
@@ -5501,8 +5876,8 @@
5501
5876
  action.className = "pl-notification-action";
5502
5877
  action.textContent = String(options.action.label);
5503
5878
  action.addEventListener("click", () => {
5504
- const keep = options.action.onClick?.(this.handle) === false;
5505
- if (!keep) this.close();
5879
+ const keep2 = options.action.onClick?.(this.handle) === false;
5880
+ if (!keep2) this.close();
5506
5881
  });
5507
5882
  content.append(action);
5508
5883
  }
@@ -5511,7 +5886,7 @@
5511
5886
  const close = document.createElement("button");
5512
5887
  close.type = "button";
5513
5888
  close.className = "pl-close pl-notification-close";
5514
- close.setAttribute("aria-label", "Zamknij powiadomienie");
5889
+ close.setAttribute("aria-label", t("notification.close"));
5515
5890
  close.addEventListener("click", () => this.close());
5516
5891
  el.append(close);
5517
5892
  }
@@ -5779,20 +6154,20 @@
5779
6154
  const el = document.createElement("dialog");
5780
6155
  el.className = `pl-lightbox pl-lightbox-${animation === "fade" ? "fade" : "slide"}`;
5781
6156
  el.dataset.plTheme = "dark";
5782
- el.setAttribute("aria-label", "Galeria");
5783
- el.setAttribute("aria-roledescription", "galeria");
6157
+ el.setAttribute("aria-label", t("lightbox.label", {}, el));
6158
+ el.setAttribute("aria-roledescription", t("lightbox.role", {}, el));
5784
6159
  el.innerHTML = `
5785
6160
  <div class="pl-lightbox-backdrop"></div>
5786
6161
  <div class="pl-lightbox-toolbar">
5787
6162
  ${counter && many ? '<span class="pl-lightbox-counter" aria-live="polite"></span>' : ""}
5788
- <button class="pl-close pl-lightbox-close" type="button" aria-label="Zamknij"></button>
6163
+ <button class="pl-close pl-lightbox-close" type="button" aria-label="${t("close", {}, el)}"></button>
5789
6164
  </div>
5790
6165
  <div class="pl-lightbox-stage"></div>
5791
- ${many ? `<button class="pl-lightbox-nav pl-lightbox-previous pl-slidenav-previous" type="button" aria-label="Poprzedni">${ICONS2.previous}</button>
5792
- <button class="pl-lightbox-nav pl-lightbox-next pl-slidenav-next" type="button" aria-label="Nast\u0119pny">${ICONS2.next}</button>` : ""}
6166
+ ${many ? `<button class="pl-lightbox-nav pl-lightbox-previous pl-slidenav-previous" type="button" aria-label="${t("previous", {}, el)}">${ICONS2.previous}</button>
6167
+ <button class="pl-lightbox-nav pl-lightbox-next pl-slidenav-next" type="button" aria-label="${t("next", {}, el)}">${ICONS2.next}</button>` : ""}
5793
6168
  <div class="pl-lightbox-footer">
5794
6169
  <div class="pl-lightbox-caption"></div>
5795
- ${thumbs && many ? '<div class="pl-lightbox-thumbs" role="tablist" aria-label="Miniatury"></div>' : ""}
6170
+ ${thumbs && many ? `<div class="pl-lightbox-thumbs" role="tablist" aria-label="${t("lightbox.thumbs", {}, el)}"></div>` : ""}
5796
6171
  </div>`;
5797
6172
  this.el = el;
5798
6173
  this.stage = el.querySelector(".pl-lightbox-stage");
@@ -5807,7 +6182,7 @@
5807
6182
  button.type = "button";
5808
6183
  button.className = "pl-lightbox-thumb";
5809
6184
  button.setAttribute("role", "tab");
5810
- button.setAttribute("aria-label", `Pozycja ${i + 1}${item.caption ? `: ${item.caption}` : ""}`);
6185
+ button.setAttribute("aria-label", `${t("lightbox.item", { n: i + 1 }, this.el)}${item.caption ? `: ${item.caption}` : ""}`);
5811
6186
  const src = item.thumb || (item.type === "image" ? item.source : "");
5812
6187
  if (src) {
5813
6188
  const img = document.createElement("img");
@@ -5917,7 +6292,7 @@
5917
6292
  const spinner = document.createElement("div");
5918
6293
  spinner.className = "pl-lightbox-spinner";
5919
6294
  spinner.setAttribute("role", "status");
5920
- spinner.setAttribute("aria-label", "Wczytywanie");
6295
+ spinner.setAttribute("aria-label", t("loading", {}, this.el));
5921
6296
  const done = () => {
5922
6297
  wrap.classList.remove("pl-loading");
5923
6298
  spinner.remove();
@@ -5926,7 +6301,7 @@
5926
6301
  done();
5927
6302
  const error = document.createElement("div");
5928
6303
  error.className = "pl-lightbox-error";
5929
- error.textContent = "Nie uda\u0142o si\u0119 wczyta\u0107 zawarto\u015Bci.";
6304
+ error.textContent = t("lightbox.error", {}, this.el);
5930
6305
  wrap.querySelector(".pl-lightbox-media")?.replaceWith(error);
5931
6306
  };
5932
6307
  let media;
@@ -5943,7 +6318,7 @@
5943
6318
  media = document.createElement("iframe");
5944
6319
  media.allow = "autoplay; fullscreen; picture-in-picture; encrypted-media";
5945
6320
  media.allowFullscreen = true;
5946
- media.title = item.caption || "Osadzona tre\u015B\u0107";
6321
+ media.title = item.caption || t("lightbox.embed", {}, this.el);
5947
6322
  media.addEventListener("load", done, { once: true });
5948
6323
  media.src = embedUrl(item.source);
5949
6324
  } else {
@@ -6643,6 +7018,7 @@
6643
7018
  if (panel) tab.setAttribute("aria-controls", panel.id || (panel.id = uid("pl-panel")));
6644
7019
  });
6645
7020
  const token2 = ++this.token;
7021
+ const { signal } = this;
6646
7022
  const detail = { index, previous, item: items[index] };
6647
7023
  if (animate && previous > -1) this.emit("hide", { index: previous, item: items[previous] });
6648
7024
  const pending = [];
@@ -6668,7 +7044,7 @@
6668
7044
  if (hash && hash !== location.hash) history.replaceState(null, "", hash);
6669
7045
  }
6670
7046
  Promise.all(pending).then(() => {
6671
- if (token2 === this.token) this.emit("shown", detail);
7047
+ if (!signal.aborted && token2 === this.token) this.emit("shown", detail);
6672
7048
  });
6673
7049
  }
6674
7050
  async animateIn(panel, forward) {
@@ -6733,12 +7109,12 @@
6733
7109
 
6734
7110
  // src/js/components/scroll.js
6735
7111
  var EASINGS = {
6736
- linear: (t) => t,
6737
- "ease-in": (t) => t * t * t,
6738
- "ease-out": (t) => 1 - (1 - t) ** 4,
6739
- "ease-in-out": (t) => t < 0.5 ? 8 * t ** 4 : 1 - (-2 * t + 2) ** 4 / 2,
7112
+ linear: (t2) => t2,
7113
+ "ease-in": (t2) => t2 * t2 * t2,
7114
+ "ease-out": (t2) => 1 - (1 - t2) ** 4,
7115
+ "ease-in-out": (t2) => t2 < 0.5 ? 8 * t2 ** 4 : 1 - (-2 * t2 + 2) ** 4 / 2,
6740
7116
  // Lekkie przestrzelenie i powrót.
6741
- spring: (t) => 1 + 2.2 * (t - 1) ** 3 + 1.2 * (t - 1) ** 2
7117
+ spring: (t2) => 1 + 2.2 * (t2 - 1) ** 3 + 1.2 * (t2 - 1) ** 2
6742
7118
  };
6743
7119
  var running = /* @__PURE__ */ new WeakMap();
6744
7120
  function scrollParent(el) {
@@ -6792,9 +7168,9 @@
6792
7168
  finish(false);
6793
7169
  };
6794
7170
  const step = (now) => {
6795
- const t = clamp((now - startTime) / time, 0, 1);
6796
- container.scrollTop = start2 + distance * ease(t);
6797
- if (t < 1) frame = requestAnimationFrame(step);
7171
+ const t2 = clamp((now - startTime) / time, 0, 1);
7172
+ container.scrollTop = start2 + distance * ease(t2);
7173
+ if (t2 < 1) frame = requestAnimationFrame(step);
6798
7174
  else {
6799
7175
  container.scrollTop = end;
6800
7176
  finish(true);
@@ -7587,9 +7963,9 @@
7587
7963
  function velocityTracker() {
7588
7964
  let samples = [];
7589
7965
  return {
7590
- add(x, t) {
7591
- samples.push({ x, t });
7592
- while (samples.length > 2 && t - samples[0].t > 100) samples.shift();
7966
+ add(x, t2) {
7967
+ samples.push({ x, t: t2 });
7968
+ while (samples.length > 2 && t2 - samples[0].t > 100) samples.shift();
7593
7969
  },
7594
7970
  get(now) {
7595
7971
  if (samples.length < 2) return 0;
@@ -7613,15 +7989,16 @@
7613
7989
  this.index = 0;
7614
7990
  this.pauses = /* @__PURE__ */ new Set();
7615
7991
  this.autoplayOn = Boolean(this.options.autoplay);
7616
- this.generatedNavs = /* @__PURE__ */ new WeakSet();
7992
+ this.generatedNavs = /* @__PURE__ */ new Set();
7993
+ this.onDestroy(() => this.generatedNavs.forEach((nav) => nav.replaceChildren()));
7617
7994
  this._timer = 0;
7618
7995
  this._remaining = 0;
7619
7996
  this._startedAt = 0;
7620
- const L = this.constructor.labels;
7997
+ const carousel = t("slider.carousel", {}, el);
7621
7998
  if (!el.hasAttribute("role")) el.setAttribute("role", "region");
7622
- el.setAttribute("aria-roledescription", L.carousel);
7999
+ el.setAttribute("aria-roledescription", carousel);
7623
8000
  if (!el.hasAttribute("aria-label") && !el.hasAttribute("aria-labelledby")) {
7624
- el.setAttribute("aria-label", L.carousel[0].toUpperCase() + L.carousel.slice(1));
8001
+ el.setAttribute("aria-label", carousel[0].toUpperCase() + carousel.slice(1));
7625
8002
  }
7626
8003
  if (!el.hasAttribute("tabindex")) el.tabIndex = 0;
7627
8004
  (_a = this.list).id || (_a.id = uid(`pl-${p}`));
@@ -7681,20 +8058,19 @@
7681
8058
  }
7682
8059
  /** Opisuje slajdy dla czytników ekranu. */
7683
8060
  labelSlides() {
7684
- const L = this.constructor.labels;
7685
8061
  const slides = this.slides;
8062
+ const role = t("slider.slide", {}, this.el);
7686
8063
  slides.forEach((slide, i) => {
7687
8064
  if (!slide.matches("li")) slide.setAttribute("role", "group");
7688
- slide.setAttribute("aria-roledescription", L.slide);
8065
+ slide.setAttribute("aria-roledescription", role);
7689
8066
  if (slide.hasAttribute("aria-label") && !slide.dataset.plAuto) return;
7690
8067
  slide.dataset.plAuto = "1";
7691
- slide.setAttribute("aria-label", `${i + 1} ${L.of} ${slides.length}`);
8068
+ slide.setAttribute("aria-label", t("slider.position", { n: i + 1, count: slides.length }, this.el));
7692
8069
  });
7693
8070
  }
7694
8071
  /** Buduje kropki w pustych `.pl-{p}-nav` i numeruje pozycje własnych nawigacji. */
7695
8072
  buildNav() {
7696
8073
  const p = this.constructor.prefix;
7697
- const L = this.constructor.labels;
7698
8074
  const indexes = this.navIndexes();
7699
8075
  for (const nav of $$(`.pl-${p}-nav`, this.el)) {
7700
8076
  if (!this.owns(nav)) continue;
@@ -7702,7 +8078,7 @@
7702
8078
  this.generatedNavs.add(nav);
7703
8079
  const current2 = [...nav.children].map((li) => li.getAttribute(this.attr)).join();
7704
8080
  if (current2 !== indexes.join()) {
7705
- nav.innerHTML = indexes.map((i) => `<li ${this.attr}="${i}"><a href="#" role="button" aria-label="${L.goto} ${i + 1}"></a></li>`).join("");
8081
+ nav.innerHTML = indexes.map((i) => `<li ${this.attr}="${i}"><a href="#" role="button" aria-label="${t("slider.goto", { n: i + 1 }, this.el)}"></a></li>`).join("");
7706
8082
  }
7707
8083
  } else {
7708
8084
  [...nav.children].forEach((item, i) => {
@@ -7805,14 +8181,6 @@
7805
8181
  }
7806
8182
  };
7807
8183
  __publicField(Carousel, "prefix", "slider");
7808
- __publicField(Carousel, "labels", {
7809
- carousel: "karuzela",
7810
- slide: "slajd",
7811
- of: "z",
7812
- previous: "Poprzedni slajd",
7813
- next: "Nast\u0119pny slajd",
7814
- goto: "Slajd"
7815
- });
7816
8184
  var Slider = class extends Carousel {
7817
8185
  init() {
7818
8186
  if (!this.setup()) return;
@@ -8100,13 +8468,13 @@
8100
8468
  d.tracker.add(event.clientX, event.timeStamp);
8101
8469
  this.render();
8102
8470
  });
8103
- const release = (event) => {
8471
+ const release2 = (event) => {
8104
8472
  const d = this.drag;
8105
8473
  if (!d || event.pointerId !== d.id) return;
8106
8474
  this.endDrag(event.type === "pointercancel", event.timeStamp);
8107
8475
  };
8108
- this.on(window, "pointerup", release);
8109
- this.on(window, "pointercancel", release);
8476
+ this.on(window, "pointerup", release2);
8477
+ this.on(window, "pointercancel", release2);
8110
8478
  this.on(
8111
8479
  c,
8112
8480
  "click",
@@ -8414,7 +8782,7 @@
8414
8782
  d.tracker.add(event.clientX, event.timeStamp);
8415
8783
  this.renderTransition();
8416
8784
  });
8417
- const release = (event) => {
8785
+ const release2 = (event) => {
8418
8786
  const d = this.drag;
8419
8787
  if (!d || event.pointerId !== d.id) return;
8420
8788
  this.drag = null;
@@ -8433,8 +8801,8 @@
8433
8801
  if (forward && this.commit()) this.run(1, v);
8434
8802
  else this.run(0, v);
8435
8803
  };
8436
- this.on(window, "pointerup", release);
8437
- this.on(window, "pointercancel", release);
8804
+ this.on(window, "pointerup", release2);
8805
+ this.on(window, "pointercancel", release2);
8438
8806
  this.on(
8439
8807
  c,
8440
8808
  "click",
@@ -8512,7 +8880,7 @@
8512
8880
  helpText = document.createElement("div");
8513
8881
  helpText.id = "pl-sortable-help";
8514
8882
  helpText.hidden = true;
8515
- helpText.textContent = "Naci\u015Bnij spacj\u0119, aby podnie\u015B\u0107 element. Strza\u0142kami zmie\u0144 jego pozycj\u0119, spacj\u0105 lub Enterem upu\u015B\u0107, klawiszem Escape anuluj.";
8883
+ helpText.textContent = t("sortable.help");
8516
8884
  liveRegion = document.createElement("div");
8517
8885
  liveRegion.setAttribute("aria-live", "assertive");
8518
8886
  liveRegion.setAttribute("aria-atomic", "true");
@@ -8606,7 +8974,7 @@
8606
8974
  if (!item.dataset.plSortableTab && item.hasAttribute("tabindex")) continue;
8607
8975
  item.dataset.plSortableTab = item === current2 ? "0" : "-1";
8608
8976
  item.tabIndex = item === current2 ? 0 : -1;
8609
- item.setAttribute("aria-roledescription", "element sortowalny");
8977
+ item.setAttribute("aria-roledescription", t("sortable.role", {}, this.el));
8610
8978
  item.setAttribute("aria-describedby", help.id);
8611
8979
  }
8612
8980
  }
@@ -8744,22 +9112,22 @@
8744
9112
  return;
8745
9113
  }
8746
9114
  if (animating.has(target)) return;
8747
- const t = target.getBoundingClientRect();
9115
+ const t2 = target.getBoundingClientRect();
8748
9116
  const r = item.getBoundingClientRect();
8749
9117
  let before;
8750
9118
  if (item.parentElement === sortable.el) {
8751
9119
  before = Boolean(item.compareDocumentPosition(target) & Node.DOCUMENT_POSITION_PRECEDING);
8752
- const sameRow = t.top < r.bottom - 1 && t.bottom > r.top + 1;
8753
- if (sameRow && t.width > r.width + 1) {
8754
- if (before ? s.x > t.left + r.width : s.x < t.right - r.width) return;
8755
- } else if (!sameRow && t.height > r.height + 1) {
8756
- if (before ? s.y > t.top + r.height : s.y < t.bottom - r.height) return;
9120
+ const sameRow = t2.top < r.bottom - 1 && t2.bottom > r.top + 1;
9121
+ if (sameRow && t2.width > r.width + 1) {
9122
+ if (before ? s.x > t2.left + r.width : s.x < t2.right - r.width) return;
9123
+ } else if (!sameRow && t2.height > r.height + 1) {
9124
+ if (before ? s.y > t2.top + r.height : s.y < t2.bottom - r.height) return;
8757
9125
  }
8758
9126
  } else {
8759
9127
  const sibling = target.nextElementSibling || target.previousElementSibling;
8760
9128
  const sr = sibling?.getBoundingClientRect();
8761
- const horizontal = sr ? sr.top < t.bottom - 1 && sr.bottom > t.top + 1 : false;
8762
- before = horizontal ? s.x < t.left + t.width / 2 : s.y < t.top + t.height / 2;
9129
+ const horizontal = sr ? sr.top < t2.bottom - 1 && sr.bottom > t2.top + 1 : false;
9130
+ before = horizontal ? s.x < t2.left + t2.width / 2 : s.y < t2.top + t2.height / 2;
8763
9131
  }
8764
9132
  this.insert(sortable, before ? target : target.nextElementSibling);
8765
9133
  }
@@ -8890,7 +9258,7 @@
8890
9258
  if (!this.emit("start", { item, index, from: index }, true)) return;
8891
9259
  this.kb = { item, next: item.nextElementSibling, index };
8892
9260
  item.classList.add("pl-sortable-grabbed");
8893
- announce(`Podniesiono: ${this.label(item)}. Pozycja ${index + 1} z ${count}. Strza\u0142kami zmie\u0144 pozycj\u0119, spacj\u0105 upu\u015B\u0107, Escape anuluje.`);
9261
+ announce(t("sortable.lifted", { label: this.label(item), n: index + 1, count }, this.el));
8894
9262
  } else if (arrow || key === "Home" || key === "End") {
8895
9263
  const next = key === "Home" ? this.items[0] : key === "End" ? this.items[count - 1] : this.neighbor(item, key);
8896
9264
  if (next) {
@@ -8910,7 +9278,7 @@
8910
9278
  item.focus({ preventScroll: true });
8911
9279
  this.kbMoving = false;
8912
9280
  item.scrollIntoView({ block: "nearest", inline: "nearest" });
8913
- announce(`Pozycja ${this.items.indexOf(item) + 1} z ${count}.`);
9281
+ announce(t("sortable.moved", { n: this.items.indexOf(item) + 1, count }, this.el));
8914
9282
  } else if (key === " " || key === "Enter") {
8915
9283
  event.preventDefault();
8916
9284
  this.dropKey();
@@ -8937,7 +9305,7 @@
8937
9305
  const to = this.items.indexOf(item);
8938
9306
  const count = this.items.length;
8939
9307
  announce(
8940
- cancelled ? `Anulowano. ${this.label(item)} wraca na pozycj\u0119 ${to + 1} z ${count}.` : `Upuszczono: ${this.label(item)}. Pozycja ${to + 1} z ${count}.`
9308
+ cancelled ? t("sortable.cancelled", { label: this.label(item), n: to + 1, count }, this.el) : t("sortable.dropped", { label: this.label(item), n: to + 1, count }, this.el)
8941
9309
  );
8942
9310
  if (to !== k.index) this.emit("moved", { item, from: k.index, to });
8943
9311
  this.emit("stop", { item, from: k.index, to, target: this, cancelled });
@@ -8960,7 +9328,6 @@
8960
9328
  // src/js/components/filter.js
8961
9329
  var EASE3 = "cubic-bezier(0.33, 0.5, 0.2, 1)";
8962
9330
  var CONTROL = "[data-pl-filter-control]";
8963
- var collator = typeof Intl !== "undefined" ? new Intl.Collator("pl", { numeric: true, sensitivity: "base" }) : null;
8964
9331
  function parseControl(control) {
8965
9332
  const raw = control.getAttribute("data-pl-filter-control") || "";
8966
9333
  const parsed = parseOptions(raw, { filter: "", group: "", sort: "", order: "asc" }, "filter");
@@ -9086,7 +9453,8 @@
9086
9453
  const [attribute, order] = this.state.sort;
9087
9454
  let sorted = children;
9088
9455
  if (attribute) {
9089
- const compare = (a, b) => collator ? collator.compare(a, b) : a < b ? -1 : a > b ? 1 : 0;
9456
+ const collator = new Intl.Collator(langOf(this.el), { numeric: true, sensitivity: "base" });
9457
+ const compare = (a, b) => collator.compare(a, b);
9090
9458
  sorted = [...children].sort(
9091
9459
  (a, b) => compare(a.getAttribute(attribute) || "", b.getAttribute(attribute) || "") * (order === "desc" ? -1 : 1)
9092
9460
  );
@@ -9238,8 +9606,9 @@
9238
9606
  this.ready = true;
9239
9607
  if (this.wanted) this.play();
9240
9608
  });
9609
+ const { signal } = this;
9241
9610
  setTimeout(() => {
9242
- if (this.ready) return;
9611
+ if (signal.aborted || this.ready) return;
9243
9612
  this.ready = true;
9244
9613
  if (this.wanted) this.play();
9245
9614
  }, 1500);
@@ -9315,9 +9684,9 @@
9315
9684
  this.emit("play");
9316
9685
  }
9317
9686
  /** `keep` — zachowaj zamiar odtwarzania (wznowienie po powrocie na kartę). */
9318
- pause(keep = false) {
9687
+ pause(keep2 = false) {
9319
9688
  const { el, options } = this;
9320
- if (!keep) this.wanted = false;
9689
+ if (!keep2) this.wanted = false;
9321
9690
  if (!this.ready) return;
9322
9691
  if (this.native) {
9323
9692
  el.pause();
@@ -9349,9 +9718,9 @@
9349
9718
 
9350
9719
  // src/js/components/counter.js
9351
9720
  var EASINGS2 = {
9352
- linear: (t) => t,
9353
- "ease-out": (t) => 1 - (1 - t) ** 4,
9354
- "ease-in-out": (t) => t < 0.5 ? 8 * t ** 4 : 1 - (-2 * t + 2) ** 4 / 2
9721
+ linear: (t2) => t2,
9722
+ "ease-out": (t2) => 1 - (1 - t2) ** 4,
9723
+ "ease-in-out": (t2) => t2 < 0.5 ? 8 * t2 ** 4 : 1 - (-2 * t2 + 2) ** 4 / 2
9355
9724
  };
9356
9725
  var Counter = class extends Component {
9357
9726
  init() {
@@ -9360,21 +9729,30 @@
9360
9729
  this.timer = 0;
9361
9730
  this.done = false;
9362
9731
  const text = el.textContent.trim();
9732
+ options.locale ?? (options.locale = langOf(el));
9363
9733
  if (options.to === null || options.to === "") {
9364
- const parsed = parseFloat(text.replace(/[^\d,.-]/g, "").replace(/\.(?=\d{3}(\D|$))/g, "").replace(",", "."));
9734
+ const decimal = (() => {
9735
+ try {
9736
+ return new Intl.NumberFormat(options.locale).format(1.5).replace(/\d/g, "") || ".";
9737
+ } catch {
9738
+ return ".";
9739
+ }
9740
+ })();
9741
+ const digits = text.replace(new RegExp(`[^\\d\\-${decimal === "." ? "\\." : decimal}]`, "g"), "");
9742
+ const parsed = parseFloat(decimal === "." ? digits : digits.replace(decimal, "."));
9365
9743
  this.to = Number.isNaN(parsed) ? 0 : parsed;
9366
9744
  } else {
9367
9745
  this.to = Number(options.to) || 0;
9368
9746
  }
9369
9747
  this.from = Number(options.from) || 0;
9370
9748
  try {
9371
- this.formatter = new Intl.NumberFormat(options.locale || "pl-PL", {
9749
+ this.formatter = new Intl.NumberFormat(options.locale || "en", {
9372
9750
  minimumFractionDigits: options.decimals,
9373
9751
  maximumFractionDigits: options.decimals,
9374
9752
  useGrouping: "always"
9375
9753
  });
9376
9754
  } catch {
9377
- this.formatter = new Intl.NumberFormat("pl-PL", { minimumFractionDigits: options.decimals, maximumFractionDigits: options.decimals });
9755
+ this.formatter = new Intl.NumberFormat("en", { minimumFractionDigits: options.decimals, maximumFractionDigits: options.decimals });
9378
9756
  }
9379
9757
  this.visual = document.createElement("span");
9380
9758
  this.visual.setAttribute("aria-hidden", "true");
@@ -9461,9 +9839,9 @@
9461
9839
  const run = () => {
9462
9840
  const startTime = performance.now();
9463
9841
  const step = (now) => {
9464
- const t = Math.min((now - startTime) / duration, 1);
9465
- if (t < 1) {
9466
- this.render(from + (end - from) * ease(t));
9842
+ const t2 = Math.min((now - startTime) / duration, 1);
9843
+ if (t2 < 1) {
9844
+ this.render(from + (end - from) * ease(t2));
9467
9845
  this.frame = requestAnimationFrame(step);
9468
9846
  } else {
9469
9847
  this.frame = 0;
@@ -9484,12 +9862,13 @@
9484
9862
  delay: 0,
9485
9863
  decimals: 0,
9486
9864
  separator: null,
9487
- // separator tysięcy; domyślnie wg locale (pl-PL: spacja niełamiąca)
9865
+ // separator tysięcy; domyślnie wg języka (pl: spacja niełamiąca, en: przecinek)
9488
9866
  decimal: null,
9489
- // separator dziesiętny; domyślnie wg locale (pl-PL: przecinek)
9867
+ // separator dziesiętny; domyślnie wg języka (pl: przecinek, en: kropka)
9490
9868
  prefix: "",
9491
9869
  suffix: "",
9492
- locale: "pl-PL",
9870
+ locale: null,
9871
+ // domyślnie język strony (atrybut lang)
9493
9872
  easing: "ease-out",
9494
9873
  // linear | ease-out | ease-in-out
9495
9874
  once: true,