@cat-of-summer/st-script 1.0.5 → 1.0.7
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 +7 -3
- package/dist/app/form.esm.min.js +2 -1
- package/dist/app/form.esm.min.js.map +7 -0
- package/dist/app/form.min.js +2 -1
- package/dist/app/form.min.js.map +7 -0
- package/dist/app.esm.min.js +1 -0
- package/dist/app.esm.min.js.map +7 -0
- package/dist/app.min.js +1 -0
- package/dist/app.min.js.map +7 -0
- package/dist/cookie.esm.min.js +1 -0
- package/dist/cookie.esm.min.js.map +7 -0
- package/dist/cookie.min.js +1 -0
- package/dist/cookie.min.js.map +7 -0
- package/dist/core.esm.min.js +1 -0
- package/dist/core.esm.min.js.map +7 -0
- package/dist/core.min.js +1 -0
- package/dist/core.min.js.map +7 -0
- package/dist/loader.esm.min.js +1 -0
- package/dist/loader.esm.min.js.map +7 -0
- package/dist/loader.min.js +1 -0
- package/dist/loader.min.js.map +7 -0
- package/dist/mask.esm.min.js +2 -1
- package/dist/mask.esm.min.js.map +7 -0
- package/dist/mask.min.js +2 -1
- package/dist/mask.min.js.map +7 -0
- package/dist/modal.esm.min.js +2 -1
- package/dist/modal.esm.min.js.map +7 -0
- package/dist/modal.min.js +2 -1
- package/dist/modal.min.js.map +7 -0
- package/dist/observer.esm.min.js +2 -0
- package/dist/observer.esm.min.js.map +7 -0
- package/dist/observer.min.js +3 -0
- package/dist/observer.min.js.map +7 -0
- package/dist/route.esm.min.js +1 -0
- package/dist/route.esm.min.js.map +7 -0
- package/dist/route.min.js +1 -0
- package/dist/route.min.js.map +7 -0
- package/dist/select.esm.min.js +1 -0
- package/dist/select.esm.min.js.map +7 -0
- package/dist/select.min.js +1 -0
- package/dist/select.min.js.map +7 -0
- package/dist/st_button_widget.esm.min.js +1 -0
- package/dist/st_button_widget.esm.min.js.map +7 -0
- package/dist/st_button_widget.min.js +1 -0
- package/dist/st_button_widget.min.js.map +7 -0
- package/dist/st_links_widget.esm.min.js +1 -0
- package/dist/st_links_widget.esm.min.js.map +7 -0
- package/dist/st_links_widget.min.js +1 -0
- package/dist/st_links_widget.min.js.map +7 -0
- package/dist/st_typograf.esm.min.js +1 -0
- package/dist/st_typograf.esm.min.js.map +7 -0
- package/dist/st_typograf.min.js +1 -0
- package/dist/st_typograf.min.js.map +7 -0
- package/dist/toggle.esm.min.js +1 -0
- package/dist/toggle.esm.min.js.map +7 -0
- package/dist/toggle.min.js +1 -0
- package/dist/toggle.min.js.map +7 -0
- package/dist/uploader.esm.min.js +1 -0
- package/dist/uploader.esm.min.js.map +7 -0
- package/dist/uploader.min.js +1 -0
- package/dist/uploader.min.js.map +7 -0
- package/dist/validator.esm.min.js +2 -0
- package/dist/validator.esm.min.js.map +7 -0
- package/dist/validator.min.js +3 -0
- package/dist/validator.min.js.map +7 -0
- package/package.json +1 -1
- package/src/app/form/index.js +10 -1
- package/src/index.js +2 -2
- package/src/mask/_engine.js +29 -9
- package/src/mask/index.js +16 -1
- package/src/modal/index.js +4 -2
- package/src/observer/_engine.js +71 -0
- package/src/observer/index.js +287 -0
- package/src/validator/index.js +156 -0
- package/dist/st_observer.esm.min.js +0 -1
- package/dist/st_observer.min.js +0 -2
- package/dist/st_validator.esm.min.js +0 -1
- package/dist/st_validator.min.js +0 -2
- package/src/st_observer/index.js +0 -426
- package/src/st_validator/index.js +0 -57
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
import { element, elements, find, own } from '../_traits/hasInstanceSymbol.js';
|
|
2
|
+
import { parse_zone, measure, state_of, progress_of, intersects, steps } from './_engine.js';
|
|
3
|
+
|
|
4
|
+
const CALLBACKS = ['before_init', 'on_init', 'on_enter', 'on_leave', 'on_progress', 'on_cross', 'on_uncross'];
|
|
5
|
+
|
|
6
|
+
export default class Observer {
|
|
7
|
+
|
|
8
|
+
static #CONFIG = ['target', 'root', 'cross'];
|
|
9
|
+
|
|
10
|
+
// атрибут-флаг: нет атрибута → значение по умолчанию, '' / 'true' → да, 'false' → нет
|
|
11
|
+
static #flag(attr, fallback) {
|
|
12
|
+
return attr == null ? !!fallback : attr != 'false';
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
#params = {};
|
|
16
|
+
#methods = {};
|
|
17
|
+
#zone = null;
|
|
18
|
+
#root = null;
|
|
19
|
+
#states = new Map();
|
|
20
|
+
#done = new WeakSet();
|
|
21
|
+
#goals = [];
|
|
22
|
+
#frame = 0;
|
|
23
|
+
#io = null;
|
|
24
|
+
#mo = null;
|
|
25
|
+
#ro = null;
|
|
26
|
+
#schedule = () => { this.#frame ||= requestAnimationFrame(() => this.#tick()); };
|
|
27
|
+
#later = () => requestAnimationFrame(this.#schedule);
|
|
28
|
+
|
|
29
|
+
static find = find;
|
|
30
|
+
|
|
31
|
+
get params() { return this.#params; }
|
|
32
|
+
|
|
33
|
+
get elements() { return [...this.#states.keys()]; }
|
|
34
|
+
|
|
35
|
+
clone(params) {
|
|
36
|
+
return new Observer({ ...this.#params, ...this.#methods, ...params, parent: this });
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
constructor(params) {
|
|
40
|
+
params = {
|
|
41
|
+
target: '[observe]',
|
|
42
|
+
root: null,
|
|
43
|
+
axis: 'y',
|
|
44
|
+
start: 'top bottom',
|
|
45
|
+
end: 'bottom top',
|
|
46
|
+
once: false,
|
|
47
|
+
progress: false,
|
|
48
|
+
stagger: 0,
|
|
49
|
+
live: false,
|
|
50
|
+
cross: null,
|
|
51
|
+
...Object.fromEntries(CALLBACKS.map(k => [k, () => {}])),
|
|
52
|
+
...params
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
for (let [key, value] of Object.entries(params))
|
|
56
|
+
if (typeof value == "function" && !Observer.#CONFIG.includes(key)) {
|
|
57
|
+
this[key] = value.bind(this);
|
|
58
|
+
this.#methods[key] = value;
|
|
59
|
+
} else
|
|
60
|
+
this.#params[key] = value;
|
|
61
|
+
|
|
62
|
+
this.before_init(this.#params);
|
|
63
|
+
|
|
64
|
+
this.#zone = parse_zone(this.#params.start, this.#params.end);
|
|
65
|
+
this.#root = this.#params.root == null ? null : element(this.#params.root) ?? null;
|
|
66
|
+
|
|
67
|
+
// гейт: каждый кадр меряются только элементы в пределах ещё одного root с каждой стороны
|
|
68
|
+
this.#io = new IntersectionObserver(entries => {
|
|
69
|
+
for (let entry of entries) {
|
|
70
|
+
let st = this.#states.get(entry.target);
|
|
71
|
+
if (!st) continue;
|
|
72
|
+
st.near = entry.isIntersecting;
|
|
73
|
+
st.dirty = true;
|
|
74
|
+
}
|
|
75
|
+
this.#schedule();
|
|
76
|
+
}, { root: this.#root, rootMargin: '100%' });
|
|
77
|
+
|
|
78
|
+
// scroll не всплывает, но ловится на захвате: так видна прокрутка и окна, и вложенных контейнеров
|
|
79
|
+
document.addEventListener('scroll', this.#schedule, { capture: true, passive: true });
|
|
80
|
+
window.addEventListener('resize', this.#schedule, { passive: true });
|
|
81
|
+
|
|
82
|
+
this.#ro = new ResizeObserver(this.#schedule);
|
|
83
|
+
this.#ro.observe(this.#root ?? document.documentElement);
|
|
84
|
+
|
|
85
|
+
if (this.#params.live && typeof this.#params.target == 'string') {
|
|
86
|
+
let pending = false;
|
|
87
|
+
this.#mo = new MutationObserver(records => {
|
|
88
|
+
if (pending || !records.some(r => [...r.addedNodes, ...r.removedNodes].some(n => n instanceof Element)))
|
|
89
|
+
return;
|
|
90
|
+
pending = true;
|
|
91
|
+
queueMicrotask(() => { pending = false; this.refresh(); });
|
|
92
|
+
});
|
|
93
|
+
this.#mo.observe(document.documentElement, { childList: true, subtree: true });
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
this.#goals = elements(this.#params.cross);
|
|
97
|
+
for (let el of elements(this.#params.target)) this.#bind(el);
|
|
98
|
+
|
|
99
|
+
this.on_init(this.#params);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// явный observe берёт и отпущенные раньше элементы (после once или unobserve)
|
|
103
|
+
observe(target) {
|
|
104
|
+
for (let el of elements(target)) {
|
|
105
|
+
this.#done.delete(el);
|
|
106
|
+
this.#bind(el);
|
|
107
|
+
}
|
|
108
|
+
return this;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
unobserve(target) {
|
|
112
|
+
for (let el of elements(target)) {
|
|
113
|
+
this.#done.add(el);
|
|
114
|
+
this.#release(el);
|
|
115
|
+
}
|
|
116
|
+
return this;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// Пересканировать target и цели cross, отпустить элементы, ушедшие из DOM, пересчитать всё.
|
|
120
|
+
// Отпущенные через once / unobserve при пересканировании не берутся заново
|
|
121
|
+
refresh() {
|
|
122
|
+
for (let el of this.#states.keys()) if (!el.isConnected) this.#release(el);
|
|
123
|
+
if (typeof this.#params.target == 'string')
|
|
124
|
+
for (let el of elements(this.#params.target)) if (!this.#done.has(el)) this.#bind(el);
|
|
125
|
+
this.#goals = elements(this.#params.cross);
|
|
126
|
+
for (let st of this.#states.values()) st.dirty = true;
|
|
127
|
+
this.#schedule();
|
|
128
|
+
return this;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
state(target) {
|
|
132
|
+
let st = this.#states.get(element(target));
|
|
133
|
+
return st ? { state: st.state, progress: st.value, direction: st.direction } : null;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
destroy() {
|
|
137
|
+
for (let el of [...this.#states.keys()]) this.#release(el);
|
|
138
|
+
cancelAnimationFrame(this.#frame);
|
|
139
|
+
this.#frame = 0;
|
|
140
|
+
this.#io.disconnect();
|
|
141
|
+
this.#ro.disconnect();
|
|
142
|
+
this.#mo?.disconnect();
|
|
143
|
+
document.removeEventListener('scroll', this.#schedule, { capture: true });
|
|
144
|
+
window.removeEventListener('resize', this.#schedule);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
#bind(el) {
|
|
148
|
+
if (this.#states.has(el)) return;
|
|
149
|
+
let owner = find(el);
|
|
150
|
+
if (owner instanceof Observer && owner !== this) {
|
|
151
|
+
console.warn('Observer: элемент уже отслеживается другим Observer — пропущен', el);
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
own(el, this);
|
|
155
|
+
|
|
156
|
+
let attr = name => el.getAttribute('observe-' + name);
|
|
157
|
+
let start = attr('start'), end = attr('end');
|
|
158
|
+
|
|
159
|
+
// начальное состояние — before: вход в зону на следующих кадрах проигрывает CSS-переход
|
|
160
|
+
this.#states.set(el, {
|
|
161
|
+
zone: start == null && end == null ? this.#zone
|
|
162
|
+
: parse_zone(start ?? this.#params.start, end ?? this.#params.end),
|
|
163
|
+
once: Observer.#flag(attr('once'), this.#params.once),
|
|
164
|
+
progress: Observer.#flag(attr('progress'), this.#params.progress),
|
|
165
|
+
state: 'before', direction: null, value: null, index: 0,
|
|
166
|
+
near: true, dirty: true, timer: 0, pending: null, crossing: new Set()
|
|
167
|
+
});
|
|
168
|
+
el.setAttribute('state', 'before');
|
|
169
|
+
|
|
170
|
+
this.#io.observe(el);
|
|
171
|
+
this.#later();
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// forget = false оставляет владение: Observer.find(el) после once по-прежнему отвечает
|
|
175
|
+
#release(el, forget = true) {
|
|
176
|
+
let st = this.#states.get(el);
|
|
177
|
+
if (!st) return;
|
|
178
|
+
clearTimeout(st.timer);
|
|
179
|
+
this.#states.delete(el);
|
|
180
|
+
this.#io.unobserve(el);
|
|
181
|
+
if (forget && find(el) === this) own(el, undefined);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
#root_rect() {
|
|
185
|
+
if (!this.#root) {
|
|
186
|
+
let doc = document.documentElement;
|
|
187
|
+
return { top: 0, left: 0, width: doc.clientWidth, height: doc.clientHeight };
|
|
188
|
+
}
|
|
189
|
+
let r = this.#root.getBoundingClientRect();
|
|
190
|
+
return { top: r.top + this.#root.clientTop, left: r.left + this.#root.clientLeft,
|
|
191
|
+
width: this.#root.clientWidth, height: this.#root.clientHeight };
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// Кадр: сначала все чтения геометрии, потом все записи — без layout thrashing
|
|
195
|
+
#tick() {
|
|
196
|
+
this.#frame = 0;
|
|
197
|
+
|
|
198
|
+
let root = this.#root_rect(), axis = this.#params.axis;
|
|
199
|
+
let goals = this.#goals.filter(g => g.isConnected).map(g => [g, g.getBoundingClientRect()]);
|
|
200
|
+
let reads = [];
|
|
201
|
+
|
|
202
|
+
for (let [el, st] of this.#states) {
|
|
203
|
+
if (!el.isConnected || !st.near && !st.dirty && !goals.length) continue;
|
|
204
|
+
st.dirty = false;
|
|
205
|
+
|
|
206
|
+
let rect = el.getBoundingClientRect();
|
|
207
|
+
let { a, b } = measure(rect, root, st.zone, axis);
|
|
208
|
+
let crossing = goals.length
|
|
209
|
+
? new Set(goals.filter(([g, r]) => g !== el && intersects(rect, r)).map(([g]) => g))
|
|
210
|
+
: null;
|
|
211
|
+
reads.push([el, st, state_of(a, b), progress_of(a, b), crossing]);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
let entering = [];
|
|
215
|
+
|
|
216
|
+
for (let [el, st, next, progress, crossing] of reads) {
|
|
217
|
+
if (st.progress) this.#progress(el, st, progress);
|
|
218
|
+
if (crossing) this.#cross(el, st, crossing);
|
|
219
|
+
|
|
220
|
+
// отложенный stagger-вход ждёт своей очереди; если цель сменилась — отменяется,
|
|
221
|
+
// и события считаются от уже показанного состояния
|
|
222
|
+
if (st.timer) {
|
|
223
|
+
if (st.pending == next) continue;
|
|
224
|
+
clearTimeout(st.timer);
|
|
225
|
+
st.timer = 0;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
let events = steps(st.state, next);
|
|
229
|
+
if (!events.length) continue;
|
|
230
|
+
|
|
231
|
+
if (this.#params.stagger > 0 && events[0].hook == 'on_enter') entering.push([el, st, next, events]);
|
|
232
|
+
else this.#commit(el, st, next, events);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
if (!entering.length) return;
|
|
236
|
+
|
|
237
|
+
entering.sort(([x], [y]) => x.compareDocumentPosition(y) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1);
|
|
238
|
+
entering.forEach(([el, st, next, events], index) => {
|
|
239
|
+
st.index = index;
|
|
240
|
+
st.pending = next;
|
|
241
|
+
el.style.setProperty('--index', index);
|
|
242
|
+
st.timer = setTimeout(() => this.#commit(el, st, next, events), index * this.#params.stagger * 1000);
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
#commit(el, st, next, events) {
|
|
247
|
+
st.timer = 0;
|
|
248
|
+
|
|
249
|
+
// once: первый вход фиксирует active навсегда, дальше элемент не отслеживается
|
|
250
|
+
let once = st.once && events[0].hook == 'on_enter';
|
|
251
|
+
if (once) [events, next] = [[events[0]], 'active'];
|
|
252
|
+
|
|
253
|
+
let prev = st.state;
|
|
254
|
+
st.state = next;
|
|
255
|
+
st.direction = events.at(-1).direction;
|
|
256
|
+
el.setAttribute('state', next);
|
|
257
|
+
|
|
258
|
+
for (let { hook, direction, state } of events)
|
|
259
|
+
this.#call(hook, el, { state, prev, direction, progress: st.value, index: st.index });
|
|
260
|
+
|
|
261
|
+
if (once) {
|
|
262
|
+
this.#done.add(el);
|
|
263
|
+
this.#release(el, false);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
#progress(el, st, progress) {
|
|
268
|
+
let value = Math.round(progress * 1e4) / 1e4;
|
|
269
|
+
if (value === st.value) return;
|
|
270
|
+
st.value = value;
|
|
271
|
+
el.style.setProperty('--progress', value);
|
|
272
|
+
this.#call('on_progress', el, { state: st.state, prev: st.state, direction: st.direction, progress: value, index: st.index });
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
#cross(el, st, crossing) {
|
|
276
|
+
for (let goal of st.crossing)
|
|
277
|
+
if (!crossing.has(goal)) { st.crossing.delete(goal); this.#call('on_uncross', el, goal); }
|
|
278
|
+
for (let goal of crossing)
|
|
279
|
+
if (!st.crossing.has(goal)) { st.crossing.add(goal); this.#call('on_cross', el, goal); }
|
|
280
|
+
el.toggleAttribute('crossing', st.crossing.size > 0);
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
// ошибка в пользовательском хуке не должна ронять кадр для остальных элементов
|
|
284
|
+
#call(hook, ...args) {
|
|
285
|
+
try { this[hook](...args); } catch (e) { console.error(e); }
|
|
286
|
+
}
|
|
287
|
+
}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { elements, expose, find, own } from '../_traits/hasInstanceSymbol.js';
|
|
2
|
+
|
|
3
|
+
export default class Validator {
|
|
4
|
+
|
|
5
|
+
static #CONFIG = ['target', 'test', 'message'];
|
|
6
|
+
|
|
7
|
+
#params = {};
|
|
8
|
+
#methods = {};
|
|
9
|
+
#elements = [];
|
|
10
|
+
|
|
11
|
+
static find = find;
|
|
12
|
+
|
|
13
|
+
get params() { return this.#params; }
|
|
14
|
+
|
|
15
|
+
// Валидность по привязанным элементам без state и хуков (customValidity синхронизируется).
|
|
16
|
+
get valid() { return this.#elements.map(el => this.#sync(el).valid); }
|
|
17
|
+
|
|
18
|
+
clone(params) {
|
|
19
|
+
return new Validator({ ...this.#params, ...this.#methods, ...params, parent: this });
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
constructor(params) {
|
|
23
|
+
params = {
|
|
24
|
+
target: '[validate]',
|
|
25
|
+
events: ['input', 'blur'],
|
|
26
|
+
|
|
27
|
+
test: null,
|
|
28
|
+
property: null,
|
|
29
|
+
attribute: null,
|
|
30
|
+
message: 'Некорректное значение',
|
|
31
|
+
|
|
32
|
+
native: true,
|
|
33
|
+
check_on_init: false,
|
|
34
|
+
|
|
35
|
+
before_init: () => {},
|
|
36
|
+
on_init: () => {},
|
|
37
|
+
before_check: () => {},
|
|
38
|
+
on_valid: () => {},
|
|
39
|
+
on_invalid: () => {},
|
|
40
|
+
on_check: () => {},
|
|
41
|
+
|
|
42
|
+
...params
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
for (let [key, value] of Object.entries(params))
|
|
46
|
+
if (typeof value == "function" && !Validator.#CONFIG.includes(key)) {
|
|
47
|
+
this[key] = value.bind(this);
|
|
48
|
+
this.#methods[key] = value;
|
|
49
|
+
} else
|
|
50
|
+
this.#params[key] = value;
|
|
51
|
+
|
|
52
|
+
this.before_init(this.#params);
|
|
53
|
+
|
|
54
|
+
for (let el of elements(this.#params.target))
|
|
55
|
+
this.#bind(el);
|
|
56
|
+
|
|
57
|
+
if (this.#params.check_on_init) this.check();
|
|
58
|
+
|
|
59
|
+
this.on_init(this.#params);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
check(target = this.#elements) {
|
|
63
|
+
return this.#own(target).map(el => this.#check(el)).every(Boolean);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
reset(target = this.#elements) {
|
|
67
|
+
for (let el of this.#own(target)) {
|
|
68
|
+
el.removeAttribute('state');
|
|
69
|
+
this.#sync(el);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
#own(target) {
|
|
74
|
+
return elements(target).filter(el => find(el) === this);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
#bind(el) {
|
|
78
|
+
if (find(el)) throw new Error("Валидатор уже привязан к этому элементу");
|
|
79
|
+
own(el, this);
|
|
80
|
+
this.#elements.push(el);
|
|
81
|
+
|
|
82
|
+
expose(el, {
|
|
83
|
+
check: () => this.check(el),
|
|
84
|
+
reset: () => this.reset(el)
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
for (let event of this.#params.events)
|
|
88
|
+
el.addEventListener(event, () => this.#check(el));
|
|
89
|
+
|
|
90
|
+
// Попытка отправить форму: браузер шлёт invalid каждому невалидному полю.
|
|
91
|
+
el.addEventListener('invalid', () => this.#check(el));
|
|
92
|
+
|
|
93
|
+
(el.form ?? el.closest('form'))
|
|
94
|
+
?.addEventListener('reset', () => queueMicrotask(() => this.reset(el)));
|
|
95
|
+
|
|
96
|
+
this.#sync(el);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
#check(el) {
|
|
100
|
+
if (this.before_check(el) === false) return el.getAttribute('state') != 'invalid';
|
|
101
|
+
|
|
102
|
+
let { valid, message } = this.#sync(el);
|
|
103
|
+
|
|
104
|
+
el.setAttribute('state', valid ? 'valid' : 'invalid');
|
|
105
|
+
|
|
106
|
+
if (valid) this.on_valid(el);
|
|
107
|
+
else this.on_invalid(el, message);
|
|
108
|
+
|
|
109
|
+
this.on_check(el, valid, message);
|
|
110
|
+
|
|
111
|
+
return valid;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
#sync(el) {
|
|
115
|
+
let result = this.#test(el);
|
|
116
|
+
|
|
117
|
+
if (this.#native(el))
|
|
118
|
+
el.setCustomValidity(result.valid ? '' : result.message || ' ');
|
|
119
|
+
|
|
120
|
+
return result;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
#native(el) {
|
|
124
|
+
return this.#params.native && typeof el.setCustomValidity == 'function';
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
#test(el) {
|
|
128
|
+
let { test, property, attribute } = this.#params;
|
|
129
|
+
|
|
130
|
+
// Встроенные ограничения (required, type, pattern…) проверяются первыми.
|
|
131
|
+
if (this.#native(el)) {
|
|
132
|
+
el.setCustomValidity('');
|
|
133
|
+
if (!el.validity.valid) return { valid: false, message: el.validationMessage };
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
if (attribute && !el.hasAttribute(attribute)) return this.#fail(el);
|
|
137
|
+
|
|
138
|
+
let source = String((property ? el[property]
|
|
139
|
+
: attribute ? el.getAttribute(attribute)
|
|
140
|
+
: el.value) ?? '');
|
|
141
|
+
|
|
142
|
+
for (let rule of [test ?? []].flat()) {
|
|
143
|
+
let result = typeof rule == 'function' ? rule.call(this, el) : new RegExp(rule).test(source);
|
|
144
|
+
|
|
145
|
+
if (typeof result == 'string') return { valid: false, message: result };
|
|
146
|
+
if (!result) return this.#fail(el);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
return { valid: true, message: '' };
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
#fail(el) {
|
|
153
|
+
let message = this.#params.message;
|
|
154
|
+
return { valid: false, message: typeof message == 'function' ? message.call(this, el) : message };
|
|
155
|
+
}
|
|
156
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var v=class C{static#e=new Map;constructor(s={}){let e=Object.assign({selector:null,root:null,rootMargin:"0px",threshold:0,before_init:()=>{},on_init:()=>{}},s);if(!e.selector)throw new Error("st_observer: selector required");let r=typeof e.selector=="string"?e.selector:Symbol("selector");if(C.#e.has(r))return this._internal=C.#e.get(r),this;let n={key:r,selector:e.selector,options:{root:e.root,rootMargin:e.rootMargin,threshold:e.threshold},observer:null,callbacks:new WeakMap,elements:new Set,_connected:!1,crossRules:new Map};e.before_init();let a=()=>({on_show:new Set,once_show:new Set,while_show:new Set,on_hide:new Set,once_hide:new Set,while_hide:new Set,_once_shown:!1,_once_hidden:!1,_wasIntersecting:!1}),l=(t,...i)=>{try{t(...i)}catch(d){console.error(d)}},h=(t,i)=>!(t.right<=i.left||t.left>=i.right||t.bottom<=i.top||t.top>=i.bottom),f=t=>t?typeof t=="string"?Array.from(document.querySelectorAll(t)):t instanceof Element?[t]:NodeList.prototype.isPrototypeOf(t)||Array.isArray(t)?Array.from(t):[]:typeof n.selector=="string"?Array.from(document.querySelectorAll(n.selector)):n.selector instanceof Element?[n.selector]:NodeList.prototype.isPrototypeOf(n.selector)||Array.isArray(n.selector)?Array.from(n.selector):[],_=t=>({goals:new Set(t),on_cross:new Set,once_cross:new Set,while_cross:new Set,_once_done:new Set,_wasCrossing:new Map}),u=t=>{let i=n.crossRules.get(t);if(!i||!i.length||!document.contains(t))return;let d=t.getBoundingClientRect();for(let o of i)for(let c of o.goals){if(!document.contains(c)){o._wasCrossing.set(c,!1);continue}let k=c.getBoundingClientRect(),m=h(d,k);m&&o.while_cross.forEach(y=>l(y,{target:t,goal:c},t,c)),!!!o._wasCrossing.get(c)&&m&&o.on_cross.forEach(y=>l(y,{target:t,goal:c},t,c)),m&&!o._once_done.has(c)&&(o.once_cross.forEach(y=>l(y,{target:t,goal:c},t,c)),o._once_done.add(c)),o._wasCrossing.set(c,!!m)}},g=()=>{for(let t of Array.from(n.crossRules.keys()))if(document.contains(t))try{u(t)}catch(i){console.error(i)}},w=()=>t=>{for(let i of t){let d=i.target,o=n.callbacks.get(d);o||(o=a(),n.callbacks.set(d,o)),i.isIntersecting?(o.while_show.forEach(c=>l(c,i,d)),o._wasIntersecting||o.on_show.forEach(c=>l(c,i,d)),o._once_shown||(o._once_shown=!0,o.once_show.forEach(c=>l(c,i,d))),o._wasIntersecting=!0):(o.while_hide.forEach(c=>l(c,i,d)),o._wasIntersecting&&o.on_hide.forEach(c=>l(c,i,d)),o._once_hidden||(o._once_hidden=!0,o.once_hide.forEach(c=>l(c,i,d))),o._wasIntersecting=!1)}g()};this._internal=n,this._createCbObj=a,this._resolveTargets=f,this._createCrossRule=_,this._checkCrossForTarget=u,this._runAllCrossChecks=g,this._makeIoCallback=w;let b=f();for(let t of b)n.elements.add(t),e.on_init(t),n.callbacks.get(t)||n.callbacks.set(t,a());C.#e.set(r,n),this.connect()}enableAutoCrossChecks(s={}){let e=Object.assign({strategy:"all",watchScrollAncestors:!0,watchResize:!0,rAFWhileAnimating:!1},s);if(this._autoChecks)return this._autoChecks.cfg=e,this;let r=this._internal,n=this,a=!1,l=()=>{a||(a=!0,requestAnimationFrame(()=>{a=!1,(e.strategy==="all"||e.strategy==="entryOnly")&&n._runAllCrossChecks()}))},h=w=>{let b=new Set,t=w.parentNode;for(;t&&t!==document;){if(t instanceof HTMLElement){let i=getComputedStyle(t),d=i.overflow+i.overflowX+i.overflowY;/(auto|scroll|overlay)/.test(d)&&b.add(t)}t=t.parentNode}return b.add(window),Array.from(b)},f=()=>l(),_=new Set;if(e.watchScrollAncestors)for(let w of Array.from(r.elements))h(w).forEach(t=>{_.has(t)||(t.addEventListener("scroll",f,{passive:!0}),_.add(t))});else window.addEventListener("scroll",f,{passive:!0}),_.add(window);e.watchResize&&window.addEventListener("resize",f,{passive:!0});let u=null,g=()=>{n._runAllCrossChecks(),u=requestAnimationFrame(g)};return this._autoChecks={cfg:e,scrollTargets:_,onScrollOrResize:f,rafId:u,startRaf:()=>{u||g()},stopRaf:()=>{u&&(cancelAnimationFrame(u),u=null)}},this}disableAutoCrossChecks(){if(!this._autoChecks)return this;let s=this._autoChecks;s.scrollTargets.forEach(e=>{try{e.removeEventListener("scroll",s.onScrollOrResize)}catch{}});try{window.removeEventListener("resize",s.onScrollOrResize)}catch{}return s.stopRaf(),this._autoChecks=null,this}_register(s,e,r){if(typeof e!="function")return this;let n=this._internal,a=this._resolveTargets(r);for(let l of a){let h=n.callbacks.get(l);if(h||(h=this._createCbObj(),n.callbacks.set(l,h)),h[s].add(e),!n.elements.has(l)&&(n.elements.add(l),n._connected&&n.observer))try{n.observer.observe(l)}catch{}}return this}on_show(s,e){return this._register("on_show",s,e)}while_show(s,e){return this._register("while_show",s,e)}once_show(s,e){return this._register("once_show",s,e)}on_hide(s,e){return this._register("on_hide",s,e)}while_hide(s,e){return this._register("while_hide",s,e)}once_hide(s,e){return this._register("once_hide",s,e)}observe(s){let e=this._resolveTargets(s);for(let r of e)if(this._internal.callbacks.get(r)||this._internal.callbacks.set(r,this._createCbObj()),this._internal.elements.add(r),this._internal._connected&&this._internal.observer)try{this._internal.observer.observe(r)}catch{}return this}unobserve(s){let e=this._resolveTargets(s);for(let r of e){try{this._internal.observer&&this._internal.observer.unobserve(r)}catch{}this._internal.callbacks.delete(r),this._internal.elements.delete(r)}return this}disconnect(){try{this._internal.observer&&this._internal.observer.disconnect()}catch{}return this._internal.observer=null,this._internal._connected=!1,this}connect(s={}){if(this._internal._connected)return this;if(s.root!==void 0&&(this._internal.options.root=s.root),s.rootMargin!==void 0&&(this._internal.options.rootMargin=s.rootMargin),s.threshold!==void 0&&(this._internal.options.threshold=s.threshold),this._internal.observer=new IntersectionObserver(this._makeIoCallback(),this._internal.options),s.resetFlags)for(let e of Array.from(this._internal.elements)){let r=this._internal.callbacks.get(e);r&&(r._once_shown=!1,r._once_hidden=!1,r._wasIntersecting=!1)}for(let e of Array.from(this._internal.elements))try{this._internal.observer.observe(e)}catch{}return this._internal._connected=!0,this}reconnect(s={}){return this.connect(s)}resetOnceFlags(s){let e=s?this._resolveTargets(s):Array.from(this._internal.elements);for(let r of e){let n=this._internal.callbacks.get(r);n&&(n._once_shown=!1,n._once_hidden=!1,n._wasIntersecting=!1)}return this}isConnected(){return!!this._internal._connected}getObservedElements(){return Array.from(this._internal.elements)}_registerCross(s,e,r,n){if(typeof e!="function")return this;let a=this._internal;n===void 0&&(typeof r=="string"||r instanceof Element||NodeList.prototype.isPrototypeOf(r)||Array.isArray(r))&&(n=r,r=void 0);let l=this._resolveTargets(r),h=this._resolveTargets(n);if(!h.length)return console.warn("st_observer: cross registration no goals"),this;for(let f of l){a.callbacks.get(f)||a.callbacks.set(f,this._createCbObj()),a.elements.add(f);let _=a.crossRules.get(f);_||(_=[],a.crossRules.set(f,_));let u=_.find(g=>{if(g.goals.size!==h.length)return!1;for(let w of h)if(!g.goals.has(w))return!1;return!0});u||(u=this._createCrossRule(h),_.push(u)),u[s].add(e);for(let g of h)a.elements.add(g)}return this._runAllCrossChecks(),this}on_cross(s,e,r){return this._registerCross("on_cross",s,e,r)}once_cross(s,e,r){return this._registerCross("once_cross",s,e,r)}while_cross(s,e,r){return this._registerCross("while_cross",s,e,r)}resetCrossOnceFlags(s,e){let r=this._internal,n=s?this._resolveTargets(s):Array.from(r.crossRules.keys()),a=e?this._resolveTargets(e):null;for(let l of n){let h=r.crossRules.get(l);if(h)for(let f of h)if(!a)f._once_done.clear();else for(let _ of a)f._once_done.delete(_)}return this}},p=v;export{p as default};
|
package/dist/st_observer.min.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var st_observer=(()=>{var v=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var R=Object.prototype.hasOwnProperty;var E=(g,e)=>{for(var s in e)v(g,s,{get:e[s],enumerable:!0})},O=(g,e,s,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of S(e))!R.call(g,r)&&r!==s&&v(g,r,{get:()=>e[r],enumerable:!(n=p(e,r))||n.enumerable});return g};var T=g=>O(v({},"__esModule",{value:!0}),g);var j={};E(j,{default:()=>I});var k=class g{static#e=new Map;constructor(e={}){let s=Object.assign({selector:null,root:null,rootMargin:"0px",threshold:0,before_init:()=>{},on_init:()=>{}},e);if(!s.selector)throw new Error("st_observer: selector required");let n=typeof s.selector=="string"?s.selector:Symbol("selector");if(g.#e.has(n))return this._internal=g.#e.get(n),this;let r={key:n,selector:s.selector,options:{root:s.root,rootMargin:s.rootMargin,threshold:s.threshold},observer:null,callbacks:new WeakMap,elements:new Set,_connected:!1,crossRules:new Map};s.before_init();let a=()=>({on_show:new Set,once_show:new Set,while_show:new Set,on_hide:new Set,once_hide:new Set,while_hide:new Set,_once_shown:!1,_once_hidden:!1,_wasIntersecting:!1}),l=(t,...i)=>{try{t(...i)}catch(d){console.error(d)}},h=(t,i)=>!(t.right<=i.left||t.left>=i.right||t.bottom<=i.top||t.top>=i.bottom),f=t=>t?typeof t=="string"?Array.from(document.querySelectorAll(t)):t instanceof Element?[t]:NodeList.prototype.isPrototypeOf(t)||Array.isArray(t)?Array.from(t):[]:typeof r.selector=="string"?Array.from(document.querySelectorAll(r.selector)):r.selector instanceof Element?[r.selector]:NodeList.prototype.isPrototypeOf(r.selector)||Array.isArray(r.selector)?Array.from(r.selector):[],_=t=>({goals:new Set(t),on_cross:new Set,once_cross:new Set,while_cross:new Set,_once_done:new Set,_wasCrossing:new Map}),u=t=>{let i=r.crossRules.get(t);if(!i||!i.length||!document.contains(t))return;let d=t.getBoundingClientRect();for(let o of i)for(let c of o.goals){if(!document.contains(c)){o._wasCrossing.set(c,!1);continue}let A=c.getBoundingClientRect(),C=h(d,A);C&&o.while_cross.forEach(m=>l(m,{target:t,goal:c},t,c)),!!!o._wasCrossing.get(c)&&C&&o.on_cross.forEach(m=>l(m,{target:t,goal:c},t,c)),C&&!o._once_done.has(c)&&(o.once_cross.forEach(m=>l(m,{target:t,goal:c},t,c)),o._once_done.add(c)),o._wasCrossing.set(c,!!C)}},w=()=>{for(let t of Array.from(r.crossRules.keys()))if(document.contains(t))try{u(t)}catch(i){console.error(i)}},b=()=>t=>{for(let i of t){let d=i.target,o=r.callbacks.get(d);o||(o=a(),r.callbacks.set(d,o)),i.isIntersecting?(o.while_show.forEach(c=>l(c,i,d)),o._wasIntersecting||o.on_show.forEach(c=>l(c,i,d)),o._once_shown||(o._once_shown=!0,o.once_show.forEach(c=>l(c,i,d))),o._wasIntersecting=!0):(o.while_hide.forEach(c=>l(c,i,d)),o._wasIntersecting&&o.on_hide.forEach(c=>l(c,i,d)),o._once_hidden||(o._once_hidden=!0,o.once_hide.forEach(c=>l(c,i,d))),o._wasIntersecting=!1)}w()};this._internal=r,this._createCbObj=a,this._resolveTargets=f,this._createCrossRule=_,this._checkCrossForTarget=u,this._runAllCrossChecks=w,this._makeIoCallback=b;let y=f();for(let t of y)r.elements.add(t),s.on_init(t),r.callbacks.get(t)||r.callbacks.set(t,a());g.#e.set(n,r),this.connect()}enableAutoCrossChecks(e={}){let s=Object.assign({strategy:"all",watchScrollAncestors:!0,watchResize:!0,rAFWhileAnimating:!1},e);if(this._autoChecks)return this._autoChecks.cfg=s,this;let n=this._internal,r=this,a=!1,l=()=>{a||(a=!0,requestAnimationFrame(()=>{a=!1,(s.strategy==="all"||s.strategy==="entryOnly")&&r._runAllCrossChecks()}))},h=b=>{let y=new Set,t=b.parentNode;for(;t&&t!==document;){if(t instanceof HTMLElement){let i=getComputedStyle(t),d=i.overflow+i.overflowX+i.overflowY;/(auto|scroll|overlay)/.test(d)&&y.add(t)}t=t.parentNode}return y.add(window),Array.from(y)},f=()=>l(),_=new Set;if(s.watchScrollAncestors)for(let b of Array.from(n.elements))h(b).forEach(t=>{_.has(t)||(t.addEventListener("scroll",f,{passive:!0}),_.add(t))});else window.addEventListener("scroll",f,{passive:!0}),_.add(window);s.watchResize&&window.addEventListener("resize",f,{passive:!0});let u=null,w=()=>{r._runAllCrossChecks(),u=requestAnimationFrame(w)};return this._autoChecks={cfg:s,scrollTargets:_,onScrollOrResize:f,rafId:u,startRaf:()=>{u||w()},stopRaf:()=>{u&&(cancelAnimationFrame(u),u=null)}},this}disableAutoCrossChecks(){if(!this._autoChecks)return this;let e=this._autoChecks;e.scrollTargets.forEach(s=>{try{s.removeEventListener("scroll",e.onScrollOrResize)}catch{}});try{window.removeEventListener("resize",e.onScrollOrResize)}catch{}return e.stopRaf(),this._autoChecks=null,this}_register(e,s,n){if(typeof s!="function")return this;let r=this._internal,a=this._resolveTargets(n);for(let l of a){let h=r.callbacks.get(l);if(h||(h=this._createCbObj(),r.callbacks.set(l,h)),h[e].add(s),!r.elements.has(l)&&(r.elements.add(l),r._connected&&r.observer))try{r.observer.observe(l)}catch{}}return this}on_show(e,s){return this._register("on_show",e,s)}while_show(e,s){return this._register("while_show",e,s)}once_show(e,s){return this._register("once_show",e,s)}on_hide(e,s){return this._register("on_hide",e,s)}while_hide(e,s){return this._register("while_hide",e,s)}once_hide(e,s){return this._register("once_hide",e,s)}observe(e){let s=this._resolveTargets(e);for(let n of s)if(this._internal.callbacks.get(n)||this._internal.callbacks.set(n,this._createCbObj()),this._internal.elements.add(n),this._internal._connected&&this._internal.observer)try{this._internal.observer.observe(n)}catch{}return this}unobserve(e){let s=this._resolveTargets(e);for(let n of s){try{this._internal.observer&&this._internal.observer.unobserve(n)}catch{}this._internal.callbacks.delete(n),this._internal.elements.delete(n)}return this}disconnect(){try{this._internal.observer&&this._internal.observer.disconnect()}catch{}return this._internal.observer=null,this._internal._connected=!1,this}connect(e={}){if(this._internal._connected)return this;if(e.root!==void 0&&(this._internal.options.root=e.root),e.rootMargin!==void 0&&(this._internal.options.rootMargin=e.rootMargin),e.threshold!==void 0&&(this._internal.options.threshold=e.threshold),this._internal.observer=new IntersectionObserver(this._makeIoCallback(),this._internal.options),e.resetFlags)for(let s of Array.from(this._internal.elements)){let n=this._internal.callbacks.get(s);n&&(n._once_shown=!1,n._once_hidden=!1,n._wasIntersecting=!1)}for(let s of Array.from(this._internal.elements))try{this._internal.observer.observe(s)}catch{}return this._internal._connected=!0,this}reconnect(e={}){return this.connect(e)}resetOnceFlags(e){let s=e?this._resolveTargets(e):Array.from(this._internal.elements);for(let n of s){let r=this._internal.callbacks.get(n);r&&(r._once_shown=!1,r._once_hidden=!1,r._wasIntersecting=!1)}return this}isConnected(){return!!this._internal._connected}getObservedElements(){return Array.from(this._internal.elements)}_registerCross(e,s,n,r){if(typeof s!="function")return this;let a=this._internal;r===void 0&&(typeof n=="string"||n instanceof Element||NodeList.prototype.isPrototypeOf(n)||Array.isArray(n))&&(r=n,n=void 0);let l=this._resolveTargets(n),h=this._resolveTargets(r);if(!h.length)return console.warn("st_observer: cross registration no goals"),this;for(let f of l){a.callbacks.get(f)||a.callbacks.set(f,this._createCbObj()),a.elements.add(f);let _=a.crossRules.get(f);_||(_=[],a.crossRules.set(f,_));let u=_.find(w=>{if(w.goals.size!==h.length)return!1;for(let b of h)if(!w.goals.has(b))return!1;return!0});u||(u=this._createCrossRule(h),_.push(u)),u[e].add(s);for(let w of h)a.elements.add(w)}return this._runAllCrossChecks(),this}on_cross(e,s,n){return this._registerCross("on_cross",e,s,n)}once_cross(e,s,n){return this._registerCross("once_cross",e,s,n)}while_cross(e,s,n){return this._registerCross("while_cross",e,s,n)}resetCrossOnceFlags(e,s){let n=this._internal,r=e?this._resolveTargets(e):Array.from(n.crossRules.keys()),a=s?this._resolveTargets(s):null;for(let l of r){let h=n.crossRules.get(l);if(h)for(let f of h)if(!a)f._once_done.clear();else for(let _ of a)f._once_done.delete(_)}return this}},I=k;return T(j);})();
|
|
2
|
-
if(typeof st_observer!=="undefined"&&st_observer&&st_observer.default)globalThis.st_observer=st_observer.default;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var r=class{#e=null;#t=null;constructor(t){this.#e=function(e){(!t.validator||t.validator(e))&&(()=>{if(t.regexp){let o=new RegExp(t.regexp);return!t.attribute&&!t.property?o.test(e.value):t.attribute&&t.property?e.hasAttribute(t.attribute)&&o.test(e[t.property]):(t.attribute?o.test(e.getAttribute(t.attribute)):!0)&&(t.property?o.test(e[t.property]):!0)}else return t.attribute?e.hasAttribute(t.attribute):!0})()?t.on_valid(e):t.on_invalid(e),t.after_check&&t.after_check(e)},this.#t=t.selector,typeof t.onload=="function"?t.onload(this.#t):t.onload===!0&&this.apply(),document.querySelectorAll(this.#t).forEach(e=>{(t.events??["input","blur"]).forEach(o=>{e.addEventListener(o,()=>{this.#e(e)})})})}apply(t){document.querySelectorAll(t??this.#t).forEach(this.#e,this)}},i=r;export{i as default};
|
package/dist/st_validator.min.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var st_validator=(()=>{var i=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var h=(r,t)=>{for(var e in t)i(r,e,{get:t[e],enumerable:!0})},n=(r,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let l of c(t))!f.call(r,l)&&l!==e&&i(r,l,{get:()=>t[l],enumerable:!(o=u(t,l))||o.enumerable});return r};var b=r=>n(i({},"__esModule",{value:!0}),r);var y={};h(y,{default:()=>d});var s=class{#e=null;#t=null;constructor(t){this.#e=function(e){(!t.validator||t.validator(e))&&(()=>{if(t.regexp){let o=new RegExp(t.regexp);return!t.attribute&&!t.property?o.test(e.value):t.attribute&&t.property?e.hasAttribute(t.attribute)&&o.test(e[t.property]):(t.attribute?o.test(e.getAttribute(t.attribute)):!0)&&(t.property?o.test(e[t.property]):!0)}else return t.attribute?e.hasAttribute(t.attribute):!0})()?t.on_valid(e):t.on_invalid(e),t.after_check&&t.after_check(e)},this.#t=t.selector,typeof t.onload=="function"?t.onload(this.#t):t.onload===!0&&this.apply(),document.querySelectorAll(this.#t).forEach(e=>{(t.events??["input","blur"]).forEach(o=>{e.addEventListener(o,()=>{this.#e(e)})})})}apply(t){document.querySelectorAll(t??this.#t).forEach(this.#e,this)}},d=s;return b(y);})();
|
|
2
|
-
if(typeof st_validator!=="undefined"&&st_validator&&st_validator.default)globalThis.st_validator=st_validator.default;
|