@trunkjs/browser-utils 1.0.43 → 1.0.47

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 CHANGED
@@ -1,3 +1,19 @@
1
+ ## 1.0.47 (2026-05-07)
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.46 (2026-05-07)
6
+
7
+ This was a version bump only for browser-utils to align it with other projects, there were no code changes.
8
+
9
+ ## 1.0.45 (2026-05-07)
10
+
11
+ This was a version bump only for browser-utils to align it with other projects, there were no code changes.
12
+
13
+ ## 1.0.44 (2026-05-07)
14
+
15
+ This was a version bump only for browser-utils to align it with other projects, there were no code changes.
16
+
1
17
  ## 1.0.43 (2026-04-23)
2
18
 
3
19
  This was a version bump only for browser-utils to align it with other projects, there were no code changes.
package/index.d.ts CHANGED
@@ -9,4 +9,43 @@ export * from './lib/wait-for';
9
9
  export * from './mixins/BreakPointMixin';
10
10
  export * from './mixins/EventBindingsMixin';
11
11
  export * from './mixins/LoggingMixin';
12
+ export * from './mixins/LoaderMixin';
12
13
  export * from './mixins/SlotVisibilityMixin';
14
+ export type ElementSpec = {
15
+ element: HTMLElement;
16
+ state: 'wait' | 'ready';
17
+ };
18
+ /**
19
+ * THIS IS A COPY of the Loader events
20
+ */
21
+ declare global {
22
+ interface CustomEventMap {
23
+ /**
24
+ * Event to be fired from HtmlElement on connectedCallback to indicate to the loader to wait for a element
25
+ */
26
+ 'init:child-waitreq': CustomEvent<ElementSpec>;
27
+ /**
28
+ * Event to be fired from HtmlElement after the element is fully initialized and ready.
29
+ */
30
+ 'init:child-ready': CustomEvent<ElementSpec>;
31
+ /**
32
+ * Fired as soon as all Elements are ready and displayed but not visual yet (visability: hidden). This can be used to perform any last minute adjustments before the loader is hidden and the content is visible.
33
+ */
34
+ 'loader:ready': CustomEvent<void>;
35
+ /**
36
+ * Fired when the loader is hidden and the content is visible but before blend animation. This can be used to perform any actions that should only be performed when the content is visible, such as starting animations or loading additional resources.
37
+ */
38
+ 'loader:pre-visual': CustomEvent<void>;
39
+ /**
40
+ * Fired when the content is fully visible to the user. This can be used to perform any actions that should only be performed when the content is visible, such as starting animations or loading additional resources.
41
+ */
42
+ 'loader:visual': CustomEvent<void>;
43
+ }
44
+ interface Window {
45
+ /**
46
+ * Flag to indicate that the loader component is active and that custom elements should wait for the
47
+ * loader events before initializing. This is used to prevent
48
+ */
49
+ tj_loader_state: "loading" | "ready" | "pre-visual" | "visual";
50
+ }
51
+ }
package/index.js CHANGED
@@ -1,37 +1,37 @@
1
- var N = Object.defineProperty;
2
- var L = (e) => {
1
+ var D = Object.defineProperty;
2
+ var x = (e) => {
3
3
  throw TypeError(e);
4
4
  };
5
- var B = (e, t, n) => t in e ? N(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
6
- var l = (e, t, n) => B(e, typeof t != "symbol" ? t + "" : t, n), v = (e, t, n) => t.has(e) || L("Cannot " + n);
7
- var u = (e, t, n) => (v(e, t, "read from private field"), n ? n.call(e) : t.get(e)), h = (e, t, n) => t.has(e) ? L("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, n), w = (e, t, n, i) => (v(e, t, "write to private field"), i ? i.call(e, n) : t.set(e, n), n), y = (e, t, n) => (v(e, t, "access private method"), n);
8
- const T = [
5
+ var R = (e, t, n) => t in e ? D(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
6
+ var c = (e, t, n) => R(e, typeof t != "symbol" ? t + "" : t, n), k = (e, t, n) => t.has(e) || x("Cannot " + n);
7
+ var u = (e, t, n) => (k(e, t, "read from private field"), n ? n.call(e) : t.get(e)), h = (e, t, n) => t.has(e) ? x("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, n), w = (e, t, n, i) => (k(e, t, "write to private field"), i ? i.call(e, n) : t.set(e, n), n), y = (e, t, n) => (k(e, t, "access private method"), n);
8
+ const v = [
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
- ], p = T.reduce(
15
+ ], _ = v.reduce(
16
16
  (e, t) => (e[t.name] = t.minWidth, e),
17
17
  {}
18
18
  );
19
19
  function E(e) {
20
- if (!(e in p))
20
+ if (!(e in _))
21
21
  throw new Error(`Unknown breakpoint: ${e}`);
22
- return p[e];
22
+ return _[e];
23
23
  }
24
- function D() {
24
+ function O() {
25
25
  return window.visualViewport ? window.visualViewport.width : window.innerWidth;
26
26
  }
27
- function R(e) {
28
- e === void 0 && (e = D());
29
- for (let t = T.length - 1; t >= 0; t--)
30
- if (e >= T[t].minWidth)
31
- return T[t].name;
27
+ function U(e) {
28
+ e === void 0 && (e = O());
29
+ for (let t = v.length - 1; t >= 0; t--)
30
+ if (e >= v[t].minWidth)
31
+ return v[t].name;
32
32
  return "xs";
33
33
  }
34
- function G(e, t = {}, n = []) {
34
+ function J(e, t = {}, n = []) {
35
35
  Array.isArray(n) || (n = [n]);
36
36
  const i = document.createElement(e);
37
37
  for (const r in t)
@@ -40,16 +40,16 @@ function G(e, t = {}, n = []) {
40
40
  i.append(typeof r == "string" ? document.createTextNode(r) : r);
41
41
  return i;
42
42
  }
43
- class M {
43
+ class P {
44
44
  /**
45
45
  *
46
46
  * @param delay Debounce delay in milliseconds
47
47
  * @param max_delay Maximum delay in milliseconds, if false then no maximum delay is applied
48
48
  */
49
49
  constructor(t, n = !1) {
50
- l(this, "timeout", null);
51
- l(this, "startTimeWithMs", 0);
52
- l(this, "maxTimeout", null);
50
+ c(this, "timeout", null);
51
+ c(this, "startTimeWithMs", 0);
52
+ c(this, "maxTimeout", null);
53
53
  this.delay = t, this.max_delay = n;
54
54
  }
55
55
  async wait() {
@@ -71,20 +71,20 @@ class M {
71
71
  }
72
72
  }
73
73
  }
74
- function J(e, t = !1) {
74
+ function X(e, t = !1) {
75
75
  const n = /* @__PURE__ */ new WeakMap();
76
76
  return function(i, r) {
77
77
  if (r.kind !== "method") return i;
78
78
  const a = r.name;
79
- return function(...c) {
79
+ return function(...d) {
80
80
  let s = n.get(this);
81
81
  s || (s = /* @__PURE__ */ new Map(), n.set(this, s));
82
82
  let o = s.get(a);
83
- o || (o = new M(e, t), s.set(a, o)), o.debounce(() => i.apply(this, c));
83
+ o || (o = new P(e, t), s.set(a, o)), o.debounce(() => i.apply(this, d));
84
84
  };
85
85
  };
86
86
  }
87
- function q(e) {
87
+ function Q(e) {
88
88
  if (typeof e.lineNumber == "number")
89
89
  return {
90
90
  file: e.fileName || e.sourceURL,
@@ -106,7 +106,7 @@ function q(e) {
106
106
  }
107
107
  return { file: e.fileName || e.sourceURL };
108
108
  }
109
- class O {
109
+ class j {
110
110
  constructor(t, n, i, r = "main") {
111
111
  this._debug = t, this.myTag = n, this.myElementId = i, this.instanceId = r;
112
112
  }
@@ -127,13 +127,13 @@ class O {
127
127
  throw this.error(...t), new Error(n);
128
128
  }
129
129
  }
130
- class X {
130
+ class Y {
131
131
  constructor(t, n = !0) {
132
- l(this, "label");
133
- l(this, "last");
134
- l(this, "startTime");
135
- l(this, "running", !1);
136
- l(this, "enabled");
132
+ c(this, "label");
133
+ c(this, "last");
134
+ c(this, "startTime");
135
+ c(this, "running", !1);
136
+ c(this, "enabled");
137
137
  this.label = t, this.enabled = n, this.startTime = this.last = performance.now(), this.running = !0;
138
138
  }
139
139
  lap(t = "") {
@@ -157,10 +157,10 @@ class X {
157
157
  return this.running;
158
158
  }
159
159
  }
160
- function U(e) {
160
+ function V(e) {
161
161
  return typeof e == "object" && e !== null && !Array.isArray(e);
162
162
  }
163
- function V(e) {
163
+ function F(e) {
164
164
  if (e != null)
165
165
  try {
166
166
  return JSON.parse(e);
@@ -168,28 +168,28 @@ function V(e) {
168
168
  return;
169
169
  }
170
170
  }
171
- function x(e) {
171
+ function M(e) {
172
172
  const t = JSON.stringify(e);
173
173
  return t === void 0 ? "null" : t;
174
174
  }
175
175
  function K(e, t) {
176
176
  const n = { ...t };
177
- if (U(e))
177
+ if (V(e))
178
178
  for (const i of Object.keys(t))
179
179
  i in e && (n[i] = e[i]);
180
180
  return n;
181
181
  }
182
- class P {
182
+ class C {
183
183
  constructor(t, n, i) {
184
- l(this, "cache");
184
+ c(this, "cache");
185
185
  this.backend = t, this.storageKey = n, this.initialValue = i;
186
186
  }
187
187
  read() {
188
188
  if (this.cache) return this.cache;
189
- const t = this.backend ? V(this.backend.getItem(this.storageKey)) : void 0, n = K(t, this.initialValue);
189
+ const t = this.backend ? F(this.backend.getItem(this.storageKey)) : void 0, n = K(t, this.initialValue);
190
190
  if (this.backend && this.backend.getItem(this.storageKey) == null)
191
191
  try {
192
- this.backend.setItem(this.storageKey, x(n));
192
+ this.backend.setItem(this.storageKey, M(n));
193
193
  } catch {
194
194
  }
195
195
  return this.cache = n, n;
@@ -197,7 +197,7 @@ class P {
197
197
  write(t) {
198
198
  if (this.cache = t, !!this.backend)
199
199
  try {
200
- this.backend.setItem(this.storageKey, x(t));
200
+ this.backend.setItem(this.storageKey, M(t));
201
201
  } catch {
202
202
  }
203
203
  }
@@ -211,8 +211,8 @@ class P {
211
211
  },
212
212
  set: (n, i, r) => {
213
213
  if (typeof i != "string") return !1;
214
- const c = { ...this.read() };
215
- return c[i] = r, this.write(c), !0;
214
+ const d = { ...this.read() };
215
+ return d[i] = r, this.write(d), !0;
216
216
  },
217
217
  deleteProperty: (n, i) => {
218
218
  if (typeof i != "string") return !1;
@@ -249,16 +249,16 @@ function A(e) {
249
249
  const t = globalThis.window;
250
250
  return (e === "session" ? t == null ? void 0 : t.sessionStorage : t == null ? void 0 : t.localStorage) ?? void 0;
251
251
  }
252
- function Q(e, t) {
253
- return new P(A("session"), e, t).asProxy();
252
+ function Z(e, t) {
253
+ return new C(A("session"), e, t).asProxy();
254
254
  }
255
- function Y(e, t) {
256
- return new P(A("local"), e, t).asProxy();
255
+ function tt(e, t) {
256
+ return new C(A("local"), e, t).asProxy();
257
257
  }
258
- function Z(e, t, n) {
258
+ function T(e, t, n) {
259
259
  return new Promise((i, r) => {
260
- const a = (c) => {
261
- e.removeEventListener(t, a, n), i(c);
260
+ const a = (d) => {
261
+ e.removeEventListener(t, a, n), i(d);
262
262
  };
263
263
  e.addEventListener(t, a, n);
264
264
  });
@@ -268,15 +268,24 @@ function z() {
268
268
  document.addEventListener("DOMContentLoaded", () => e());
269
269
  }) : Promise.resolve();
270
270
  }
271
- function tt(e = window) {
271
+ function et() {
272
+ return window.tj_loader_state ? window.tj_loader_state !== "loading" ? Promise.resolve() : T(window, "loader:ready") : L();
273
+ }
274
+ function nt() {
275
+ return window.tj_loader_state ? window.tj_loader_state === "pre-visual" || window.tj_loader_state === "visual" ? Promise.resolve() : T(window, "loader:pre-visual") : L();
276
+ }
277
+ function it() {
278
+ return window.tj_loader_state ? window.tj_loader_state === "visual" ? Promise.resolve() : T(window, "loader:visual") : L();
279
+ }
280
+ function L(e = window) {
272
281
  return e || (e = window), e === window ? document.readyState === "complete" ? Promise.resolve() : new Promise((t) => window.addEventListener("load", () => t(), { once: !0 })) : e instanceof HTMLImageElement ? e.complete && e.naturalWidth !== 0 ? Promise.resolve() : new Promise((t, n) => {
273
282
  e.addEventListener("load", () => t(), { once: !0 }), e.addEventListener("error", () => n(new Error("image error")), { once: !0 });
274
283
  }) : e instanceof HTMLMediaElement ? e.readyState >= HTMLMediaElement.HAVE_FUTURE_DATA ? Promise.resolve() : new Promise((t) => e.addEventListener("loadeddata", () => t(), { once: !0 })) : new Promise((t) => e.addEventListener("load", () => t(), { once: !0 }));
275
284
  }
276
- function et(e) {
285
+ function rt(e) {
277
286
  return new Promise((t) => setTimeout(t, e));
278
287
  }
279
- function nt(e) {
288
+ function st(e) {
280
289
  return new Promise((t) => {
281
290
  const n = (i) => {
282
291
  e.removeEventListener("animationend", n), t(i);
@@ -284,31 +293,31 @@ function nt(e) {
284
293
  e.addEventListener("animationend", n);
285
294
  });
286
295
  }
287
- function it(e) {
296
+ function ot(e) {
288
297
  var n, i;
289
298
  class t extends e {
290
299
  constructor() {
291
300
  super(...arguments);
292
- h(this, n, new M(200, 5e3));
293
- l(this, "currentBreakPoint", null);
301
+ h(this, n, new P(200, 5e3));
302
+ c(this, "currentBreakPoint", null);
294
303
  h(this, i, async () => {
295
304
  var b;
296
305
  await u(this, n).wait(), await z();
297
- const c = this, s = window.innerWidth;
298
- let o = getComputedStyle(c).getPropertyValue("--breakpoint");
306
+ const d = this, s = window.innerWidth;
307
+ let o = getComputedStyle(d).getPropertyValue("--breakpoint");
299
308
  if (!o || o === "")
300
309
  return;
301
310
  o = o.trim().replace(/^['"]|['"]$/g, "");
302
- const d = o.split(","), m = d[0].trim(), f = ((b = d[1]) == null ? void 0 : b.trim()) ?? m, g = R(s);
303
- this.currentBreakPoint !== g && (E(f) <= E(g) ? c.setAttribute("mode", "desktop") : E(m) > E(g) ? c.setAttribute("mode", "mobile") : c.setAttribute("mode", "tablet"));
311
+ const l = o.split(","), m = l[0].trim(), f = ((b = l[1]) == null ? void 0 : b.trim()) ?? m, g = U(s);
312
+ this.currentBreakPoint !== g && (E(f) <= E(g) ? d.setAttribute("mode", "desktop") : E(m) > E(g) ? d.setAttribute("mode", "mobile") : d.setAttribute("mode", "tablet"));
304
313
  });
305
314
  }
306
315
  connectedCallback() {
307
316
  super.connectedCallback();
308
317
  try {
309
318
  u(this, i).call(this), window.addEventListener("resize", u(this, i)), u(this, i).call(this);
310
- } catch (c) {
311
- throw console.error("Error in BreakPointMixin:", c, "in element", this), c;
319
+ } catch (d) {
320
+ throw console.error("Error in BreakPointMixin:", d, "in element", this), d;
312
321
  }
313
322
  }
314
323
  disconnectedCallback() {
@@ -317,14 +326,14 @@ function it(e) {
317
326
  }
318
327
  return n = new WeakMap(), i = new WeakMap(), t;
319
328
  }
320
- const k = Symbol("listenerDefs"), W = Symbol("withEventBindings");
321
- function rt(e, t) {
329
+ const p = Symbol("listenerDefs"), W = Symbol("withEventBindings");
330
+ function at(e, t) {
322
331
  const n = Array.isArray(e) ? e : [e];
323
332
  return function(i, r) {
324
333
  if (r.kind !== "method") throw new Error("@Listen nur für Methoden");
325
334
  return r.addInitializer(function() {
326
335
  const a = this;
327
- (a[k] || (a[k] = [])).push({
336
+ (a[p] || (a[p] = [])).push({
328
337
  method: r.name,
329
338
  events: [...n],
330
339
  opts: t
@@ -336,11 +345,11 @@ function rt(e, t) {
336
345
  };
337
346
  };
338
347
  }
339
- function F(e, t) {
348
+ function H(e, t) {
340
349
  var n;
341
350
  return !t || t === "host" ? e : t === "document" ? e.ownerDocument ?? document : t === "window" ? ((n = e.ownerDocument) == null ? void 0 : n.defaultView) ?? window : t === "shadowRoot" ? e.shadowRoot ?? e : typeof t == "function" ? t(e) : t;
342
351
  }
343
- function st(e) {
352
+ function ut(e) {
344
353
  var n, i, $;
345
354
  class t extends e {
346
355
  constructor(...s) {
@@ -359,24 +368,24 @@ function st(e) {
359
368
  }
360
369
  }
361
370
  return n = new WeakMap(), i = new WeakSet(), $ = function() {
362
- var o, d, m;
371
+ var o, l, m;
363
372
  (o = u(this, n)) == null || o.abort(), w(this, n, new AbortController());
364
- const s = this[k] || [];
373
+ const s = this[p] || [];
365
374
  for (const f of s) {
366
- const g = F(this, (d = f.opts) == null ? void 0 : d.target), b = ((m = f.opts) == null ? void 0 : m.options) ?? {}, _ = this[f.method].bind(this);
367
- for (const C of f.events)
368
- g.addEventListener(C, _, { ...b, signal: u(this, n).signal });
375
+ const g = H(this, (l = f.opts) == null ? void 0 : l.target), b = ((m = f.opts) == null ? void 0 : m.options) ?? {}, N = this[f.method].bind(this);
376
+ for (const B of f.events)
377
+ g.addEventListener(B, N, { ...b, signal: u(this, n).signal });
369
378
  }
370
379
  }, t;
371
380
  }
372
- let j = 1;
373
- function ot(e) {
381
+ let G = 1;
382
+ function dt(e) {
374
383
  var n, i, r;
375
384
  class t extends e {
376
385
  constructor() {
377
386
  super(...arguments);
378
387
  h(this, n, null);
379
- h(this, i, j++);
388
+ h(this, i, G++);
380
389
  h(this, r, null);
381
390
  }
382
391
  /**
@@ -395,7 +404,7 @@ function ot(e) {
395
404
  }
396
405
  getLogger(s = "main") {
397
406
  const o = "<" + (this.tagName || this.constructor.name || "UnknownElement") + ">";
398
- return u(this, r) || w(this, r, new O(this._debug, o, `${u(this, i)}`, s)), u(this, r);
407
+ return u(this, r) || w(this, r, new j(this._debug, o, `${u(this, i)}`, s)), u(this, r);
399
408
  }
400
409
  debug(...s) {
401
410
  this.getLogger().debug(...s);
@@ -415,25 +424,61 @@ function ot(e) {
415
424
  }
416
425
  return n = new WeakMap(), i = new WeakMap(), r = new WeakMap(), t;
417
426
  }
418
- function at(e) {
427
+ function lt(e) {
428
+ class t extends e {
429
+ connectedCallback() {
430
+ this.dispatchEvent(new CustomEvent("init:child-waitreq", {
431
+ detail: {
432
+ element: this,
433
+ state: "connected"
434
+ },
435
+ bubbles: !0,
436
+ composed: !0
437
+ })), super.connectedCallback();
438
+ }
439
+ firstUpdated(i) {
440
+ var r;
441
+ (r = super.firstUpdated) == null || r.call(this, i), this.dispatchEvent(new CustomEvent("init:child-ready", {
442
+ detail: {
443
+ element: this,
444
+ state: "ready"
445
+ },
446
+ bubbles: !0,
447
+ composed: !0
448
+ }));
449
+ }
450
+ disconnectedCallback() {
451
+ super.disconnectedCallback(), this.dispatchEvent(new CustomEvent("init:child-ready", {
452
+ detail: {
453
+ element: this,
454
+ state: "disconnected"
455
+ },
456
+ bubbles: !0,
457
+ composed: !0
458
+ }));
459
+ }
460
+ }
461
+ return t;
462
+ }
463
+ function ct(e) {
419
464
  var n, I, r, S;
420
465
  class t extends e {
421
466
  constructor() {
422
467
  super(...arguments);
423
468
  h(this, n);
424
469
  h(this, r, (o) => {
425
- const d = o.target;
426
- d.assignedNodes({ flatten: !0 }).filter((g) => y(this, n, S).call(this, g)).length > 0 && d.childNodes.length > 0 && d.classList.remove("slot-empty");
470
+ const l = o.target;
471
+ (l.assignedNodes({ flatten: !0 }).filter((g) => y(this, n, S).call(this, g)).length > 0 || l.childNodes.length > 0) && l.classList.remove("slot-empty");
427
472
  });
428
473
  }
429
474
  firstUpdated(o) {
430
- var d;
431
- (d = super.firstUpdated) == null || d.call(this, o), y(this, n, I).call(this);
475
+ var l;
476
+ (l = super.firstUpdated) == null || l.call(this, o), y(this, n, I).call(this);
432
477
  }
433
478
  }
434
479
  return n = new WeakSet(), I = function() {
435
- var d;
436
- const o = (d = this.shadowRoot) == null ? void 0 : d.querySelectorAll("slot");
480
+ var l;
481
+ const o = (l = this.shadowRoot) == null ? void 0 : l.querySelectorAll("slot");
437
482
  o == null || o.forEach((m) => {
438
483
  m.classList.add("slot-empty"), m.addEventListener("slotchange", (f) => u(this, r).call(this, f));
439
484
  });
@@ -442,27 +487,31 @@ function at(e) {
442
487
  }, t;
443
488
  }
444
489
  export {
445
- it as BreakPointMixin,
446
- M as Debouncer,
447
- st as EventBindingsMixin,
448
- rt as Listen,
449
- O as Logger,
450
- ot as LoggingMixin,
451
- at as SlotVisibilityMixin,
452
- X as Stopwatch,
453
- p as breakpointMap,
454
- T as breakpoints,
455
- G as create_element,
456
- J as debounce,
490
+ ot as BreakPointMixin,
491
+ P as Debouncer,
492
+ ut as EventBindingsMixin,
493
+ at as Listen,
494
+ lt as LoaderMixin,
495
+ j as Logger,
496
+ dt as LoggingMixin,
497
+ ct as SlotVisibilityMixin,
498
+ Y as Stopwatch,
499
+ _ as breakpointMap,
500
+ v as breakpoints,
501
+ J as create_element,
502
+ X as debounce,
457
503
  E as getBreakpointMinWidth,
458
- R as getCurrentBreakpoint,
459
- q as getErrorLocation,
460
- D as getViewportWidth,
461
- Y as local_storage,
462
- Q as session_storage,
463
- et as sleep,
464
- Z as waitFor,
465
- nt as waitForAnimationEnd,
504
+ U as getCurrentBreakpoint,
505
+ Q as getErrorLocation,
506
+ O as getViewportWidth,
507
+ tt as local_storage,
508
+ Z as session_storage,
509
+ rt as sleep,
510
+ T as waitFor,
511
+ st as waitForAnimationEnd,
466
512
  z as waitForDomContentLoaded,
467
- tt as waitForLoad
513
+ L as waitForLoad,
514
+ nt as waitForPreVisual,
515
+ et as waitForReady,
516
+ it as waitForVisual
468
517
  };
package/lib/wait-for.d.ts CHANGED
@@ -1,5 +1,14 @@
1
1
  export declare function waitFor<T>(target: EventTarget, eventName: string, options?: AddEventListenerOptions): Promise<T>;
2
2
  export declare function waitForDomContentLoaded(): Promise<void>;
3
+ export declare function waitForReady(): Promise<void>;
4
+ /**
5
+ * Wait for Loader firing the pre-visual (Elements are visual but might be in animation to show up)
6
+ */
7
+ export declare function waitForPreVisual(): Promise<void>;
8
+ /**
9
+ * Wait for Loader firing visual (the elements are fully visual to the user)
10
+ */
11
+ export declare function waitForVisual(): Promise<void>;
3
12
  /**
4
13
  * Waits for the load event of the given element or the window if no element is provided.
5
14
  *
@@ -0,0 +1,6 @@
1
+ import { LitElement } from 'lit';
2
+ type Constructor<T = object> = abstract new (...args: any[]) => T;
3
+ export interface LoaderMixinInterface {
4
+ }
5
+ export declare function LoaderMixin<TBase extends Constructor<LitElement>>(Base: TBase): TBase & Constructor<LoaderMixinInterface>;
6
+ export {};
package/package.json CHANGED
@@ -1,7 +1,12 @@
1
1
  {
2
2
  "name": "@trunkjs/browser-utils",
3
- "version": "1.0.43",
3
+ "version": "1.0.47",
4
4
  "main": "./index.js",
5
+ "repository": {
6
+ "directory": "packages/browser-utils",
7
+ "type": "git",
8
+ "url": "https://github.com/trunkjs/trunkjs-monorepo"
9
+ },
5
10
  "dependencies": {},
6
11
  "type": "module",
7
12
  "types": "./index.d.ts"