@trunkjs/browser-utils 1.0.17 → 1.0.19
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/CHANGELOG.md +8 -0
- package/index.js +25 -25
- package/lib/wait-for.d.ts +2 -2
- package/mixins/EventBindingsMixin.d.ts +2 -2
- package/mixins/LoggingMixin.d.ts +3 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
## 1.0.19 (2025-09-11)
|
|
2
|
+
|
|
3
|
+
This was a version bump only for browser-utils to align it with other projects, there were no code changes.
|
|
4
|
+
|
|
5
|
+
## 1.0.18 (2025-09-11)
|
|
6
|
+
|
|
7
|
+
This was a version bump only for browser-utils to align it with other projects, there were no code changes.
|
|
8
|
+
|
|
1
9
|
## 1.0.17 (2025-09-11)
|
|
2
10
|
|
|
3
11
|
This was a version bump only for browser-utils to align it with other projects, there were no code changes.
|
package/index.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
var
|
|
1
|
+
var x = Object.defineProperty;
|
|
2
2
|
var L = (t) => {
|
|
3
3
|
throw TypeError(t);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var u = (t, e, n) =>
|
|
7
|
-
var a = (t, e, n) => (w(t, e, "read from private field"), n ? n.call(t) : e.get(t)),
|
|
8
|
-
const
|
|
5
|
+
var D = (t, e, n) => e in t ? x(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
6
|
+
var u = (t, e, n) => D(t, typeof e != "symbol" ? e + "" : e, n), w = (t, e, n) => e.has(t) || L("Cannot " + n);
|
|
7
|
+
var a = (t, e, n) => (w(t, e, "read from private field"), n ? n.call(t) : e.get(t)), d = (t, e, n) => e.has(t) ? L("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, n), c = (t, e, n, i) => (w(t, e, "write to private field"), i ? i.call(t, n) : e.set(t, n), n), v = (t, e, n) => (w(t, e, "access private method"), n);
|
|
8
|
+
const m = [
|
|
9
9
|
{ name: "xs", minWidth: 0 },
|
|
10
10
|
{ name: "sm", minWidth: 576 },
|
|
11
11
|
{ name: "md", minWidth: 768 },
|
|
12
12
|
{ name: "lg", minWidth: 992 },
|
|
13
13
|
{ name: "xl", minWidth: 1200 },
|
|
14
14
|
{ name: "xxl", minWidth: 1400 }
|
|
15
|
-
], y =
|
|
15
|
+
], y = m.reduce(
|
|
16
16
|
(t, e) => (t[e.name] = e.minWidth, t),
|
|
17
17
|
{}
|
|
18
18
|
);
|
|
@@ -23,9 +23,9 @@ function P(t) {
|
|
|
23
23
|
}
|
|
24
24
|
function B(t) {
|
|
25
25
|
t === void 0 && (t = window.innerWidth);
|
|
26
|
-
for (let e =
|
|
27
|
-
if (t >=
|
|
28
|
-
return
|
|
26
|
+
for (let e = m.length - 1; e >= 0; e--)
|
|
27
|
+
if (t >= m[e].minWidth)
|
|
28
|
+
return m[e].name;
|
|
29
29
|
return "xs";
|
|
30
30
|
}
|
|
31
31
|
function _(t, e = {}, n = []) {
|
|
@@ -145,7 +145,7 @@ function U() {
|
|
|
145
145
|
}) : Promise.resolve();
|
|
146
146
|
}
|
|
147
147
|
function H(t = null) {
|
|
148
|
-
if (t || (t =
|
|
148
|
+
if (t || (t = window), t instanceof Window) {
|
|
149
149
|
if (document.readyState === "complete")
|
|
150
150
|
return Promise.resolve();
|
|
151
151
|
} else if (t instanceof HTMLImageElement) {
|
|
@@ -156,7 +156,7 @@ function H(t = null) {
|
|
|
156
156
|
t.addEventListener("loadeddata", () => e(), { once: !0 });
|
|
157
157
|
});
|
|
158
158
|
return new Promise((e) => {
|
|
159
|
-
|
|
159
|
+
t.addEventListener("load", () => e());
|
|
160
160
|
});
|
|
161
161
|
}
|
|
162
162
|
function G(t) {
|
|
@@ -198,8 +198,8 @@ function q(t) {
|
|
|
198
198
|
class e extends t {
|
|
199
199
|
constructor(...o) {
|
|
200
200
|
super(...o);
|
|
201
|
-
|
|
202
|
-
|
|
201
|
+
d(this, i);
|
|
202
|
+
d(this, n);
|
|
203
203
|
this[p] = !0;
|
|
204
204
|
}
|
|
205
205
|
connectedCallback() {
|
|
@@ -207,18 +207,18 @@ function q(t) {
|
|
|
207
207
|
(o = super.connectedCallback) == null || o.call(this), v(this, i, I).call(this);
|
|
208
208
|
}
|
|
209
209
|
disconnectedCallback() {
|
|
210
|
-
var o,
|
|
211
|
-
(o = a(this, n)) == null || o.abort(), (
|
|
210
|
+
var o, l;
|
|
211
|
+
(o = a(this, n)) == null || o.abort(), (l = super.disconnectedCallback) == null || l.call(this);
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
214
|
return n = new WeakMap(), i = new WeakSet(), I = function() {
|
|
215
|
-
var
|
|
216
|
-
(
|
|
215
|
+
var l, b, E;
|
|
216
|
+
(l = a(this, n)) == null || l.abort(), c(this, n, new AbortController());
|
|
217
217
|
const o = this.constructor[f] || [];
|
|
218
|
-
for (const
|
|
219
|
-
const T = A(this, (b =
|
|
220
|
-
for (const
|
|
221
|
-
T.addEventListener(
|
|
218
|
+
for (const h of o) {
|
|
219
|
+
const T = A(this, (b = h.opts) == null ? void 0 : b.target), M = ((E = h.opts) == null ? void 0 : E.options) ?? {}, W = this[h.method].bind(this);
|
|
220
|
+
for (const $ of h.events)
|
|
221
|
+
T.addEventListener($, W, { ...M, signal: a(this, n).signal });
|
|
222
222
|
}
|
|
223
223
|
}, e;
|
|
224
224
|
}
|
|
@@ -228,9 +228,9 @@ function z(t) {
|
|
|
228
228
|
class e extends t {
|
|
229
229
|
constructor() {
|
|
230
230
|
super(...arguments);
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
231
|
+
d(this, n, null);
|
|
232
|
+
d(this, i, R++);
|
|
233
|
+
d(this, r, null);
|
|
234
234
|
}
|
|
235
235
|
/**
|
|
236
236
|
* Clears the cached debug flag so the attribute will be checked again
|
|
@@ -268,7 +268,7 @@ export {
|
|
|
268
268
|
z as LoggingMixin,
|
|
269
269
|
O as Stopwatch,
|
|
270
270
|
y as breakpointMap,
|
|
271
|
-
|
|
271
|
+
m as breakpoints,
|
|
272
272
|
_ as create_element,
|
|
273
273
|
P as getBreakpointMinWidth,
|
|
274
274
|
B as getCurrentBreakpoint,
|
package/lib/wait-for.d.ts
CHANGED
|
@@ -4,13 +4,13 @@ export declare function waitForDomContentLoaded(): Promise<void>;
|
|
|
4
4
|
* Waits for the load event of the given element or the window if no element is provided.
|
|
5
5
|
*
|
|
6
6
|
* Hanles:
|
|
7
|
-
* -
|
|
7
|
+
* - Window: waits for 'load' event if not already loaded
|
|
8
8
|
* - HTMLImageElement: waits for 'load' event if not already complete
|
|
9
9
|
* - HTMLVideoElement and HTMLAudioElement: waits for 'loadeddata' event if not
|
|
10
10
|
*
|
|
11
11
|
*
|
|
12
12
|
* @param element
|
|
13
13
|
*/
|
|
14
|
-
export declare function waitForLoad(element?: HTMLElement |
|
|
14
|
+
export declare function waitForLoad(element?: HTMLElement | Window | null): Promise<void>;
|
|
15
15
|
export declare function sleep(ms: number): Promise<void>;
|
|
16
16
|
export declare function waitForAnimationEnd(element: HTMLElement): Promise<AnimationEvent>;
|
|
@@ -9,9 +9,9 @@ type OneOrMany<N extends EventName> = N | readonly N[];
|
|
|
9
9
|
type EventFromInput<I extends OneOrMany<EventName>> = I extends readonly (infer K)[] ? K extends EventName ? DocumentEventMap[K] : never : I extends EventName ? DocumentEventMap[I] : never;
|
|
10
10
|
export declare function Listen<I extends OneOrMany<EventName>>(type: I, opts?: ListenOpts): <This, Fn extends (this: This, ev: EventFromInput<I>, ...args: any[]) => any>(value: Fn, context: ClassMethodDecoratorContext<This, Fn>) => Fn;
|
|
11
11
|
export declare function EventBindingsMixin<TBase extends Ctor<object>>(Base: TBase): (abstract new (...a: any[]) => {
|
|
12
|
-
"__#
|
|
12
|
+
"__#2378@#ac"?: AbortController;
|
|
13
13
|
connectedCallback(): void;
|
|
14
14
|
disconnectedCallback(): void;
|
|
15
|
-
"__#
|
|
15
|
+
"__#2378@#bindEventListeners"(): void;
|
|
16
16
|
}) & TBase;
|
|
17
17
|
export {};
|
package/mixins/LoggingMixin.d.ts
CHANGED
|
@@ -26,14 +26,14 @@ type Constructor<T = object> = abstract new (...args: any[]) => T;
|
|
|
26
26
|
* <my-element debug></my-element> // enables debug logging
|
|
27
27
|
*/
|
|
28
28
|
export declare function LoggingMixin<TBase extends Constructor<object>>(Base: TBase): (abstract new (...args: any[]) => {
|
|
29
|
-
"__#
|
|
30
|
-
"__#
|
|
29
|
+
"__#2379@#debugCached": boolean | null;
|
|
30
|
+
"__#2379@#myElementId": number;
|
|
31
31
|
/**
|
|
32
32
|
* Clears the cached debug flag so the attribute will be checked again
|
|
33
33
|
* on the next log/warn/error call.
|
|
34
34
|
*/
|
|
35
35
|
invalidateDebugCache(): void;
|
|
36
|
-
"__#
|
|
36
|
+
"__#2379@#myLoggerInstance": Logger | null;
|
|
37
37
|
readonly _debug: boolean;
|
|
38
38
|
getLogger(instanceId?: string): Logger;
|
|
39
39
|
log(...args: any[]): void;
|