@har-analyzer/components 0.0.19 → 0.0.20

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.
@@ -1,11 +1,11 @@
1
1
  import { jsx as C, jsxs as q, Fragment as j } from "react/jsx-runtime";
2
2
  import { colorBorderDividerDefault as B, borderWidthField as K, borderRadiusContainer as Y } from "@cloudscape-design/design-tokens";
3
- import { useMemo as z, useRef as O, useEffect as D, useCallback as G, useState as P } from "react";
3
+ import { useMemo as P, useRef as O, useEffect as H, useCallback as G, useState as z } from "react";
4
4
  import N from "@cloudscape-design/components/button";
5
5
  import V from "@cloudscape-design/components/box";
6
6
  import { L as X } from "./chunks/index.js";
7
7
  import { D as $, V as Z } from "./chunks/index2.js";
8
- import { d as H } from "./chunks/har.js";
8
+ import { d as S } from "./chunks/har.js";
9
9
  import './assets/har-entries-viewer.css';function J(E) {
10
10
  const { onClose: e } = E;
11
11
  return /* @__PURE__ */ C(
@@ -31,7 +31,7 @@ import './assets/har-entries-viewer.css';function J(E) {
31
31
  function Q({ children: E }) {
32
32
  return /* @__PURE__ */ C(V, { padding: "m", children: E });
33
33
  }
34
- class T {
34
+ class D {
35
35
  constructor(e, t) {
36
36
  this.layouts = /* @__PURE__ */ new Map(), this.editable = !1, this.layoutChangeCallback = () => {
37
37
  }, this.selectionChangeCallback = () => {
@@ -140,7 +140,7 @@ class T {
140
140
  const t = this.getTargetElement(e);
141
141
  this.resizeHandle = t ? this.checkResizeHandle(t, e) : void 0;
142
142
  }
143
- !this.dragging && this.dragKey && (I(this.dragEndX - this.dragStartX) > this.fn.DRAG_THRESHOLD || I(this.dragEndY - this.dragStartY) > this.fn.DRAG_THRESHOLD) && (this.dragging = !0, (!this.selection.has(this.dragKey) || this.resizeHandle) && this.setSelection(new Set(this.dragKey)));
143
+ !this.dragging && this.dragKey && (T(this.dragEndX - this.dragStartX) > this.fn.DRAG_THRESHOLD || T(this.dragEndY - this.dragStartY) > this.fn.DRAG_THRESHOLD) && (this.dragging = !0, (!this.selection.has(this.dragKey) || this.resizeHandle) && this.setSelection(new Set(this.dragKey)));
144
144
  }
145
145
  }
146
146
  handleMouseUp(e) {
@@ -158,7 +158,7 @@ class T {
158
158
  }
159
159
  handlePointerUp(e) {
160
160
  if (this.editable !== !1 && e.pointerType !== "mouse" && e.pointerId === this.dragPointerId) {
161
- if (this.dragStartTime > Date.now() - this.fn.TAP_DELAY && I(this.dragEndX - this.dragStartX) < this.fn.TAP_THRESHOLD && I(this.dragEndY - this.dragStartY) < this.fn.TAP_THRESHOLD) {
161
+ if (this.dragStartTime > Date.now() - this.fn.TAP_DELAY && T(this.dragEndX - this.dragStartX) < this.fn.TAP_THRESHOLD && T(this.dragEndY - this.dragStartY) < this.fn.TAP_THRESHOLD) {
162
162
  const t = this.getTargetElement(e);
163
163
  t?.dataset.key ? this.toggleSelection(t.dataset.key, !0) : this.clearSelection();
164
164
  } else
@@ -230,14 +230,14 @@ class T {
230
230
  static compileBreakpoints(e) {
231
231
  var t, n, s, a, g, u, f;
232
232
  const l = Object.entries((t = e.breakpoints) !== null && t !== void 0 ? t : {}).map(([o, r]) => {
233
- var m, d, h, c, y, v, k, w, _, b, S, A;
233
+ var m, d, h, c, y, v, k, w, b, _, M, A;
234
234
  return {
235
235
  name: o,
236
236
  maxWidth: r.maxWidth,
237
237
  columns: (d = (m = r.columns) !== null && m !== void 0 ? m : e.columns) !== null && d !== void 0 ? d : 12,
238
238
  rowHeight: (c = (h = r.rowHeight) !== null && h !== void 0 ? h : e.rowHeight) !== null && c !== void 0 ? c : 30,
239
239
  rowGap: (w = (k = (v = (y = r.rowGap) !== null && y !== void 0 ? y : r.gap) !== null && v !== void 0 ? v : e.rowGap) !== null && k !== void 0 ? k : e.gap) !== null && w !== void 0 ? w : 0,
240
- columnGap: (A = (S = (b = (_ = r.columnGap) !== null && _ !== void 0 ? _ : r.gap) !== null && b !== void 0 ? b : e.columnGap) !== null && S !== void 0 ? S : e.gap) !== null && A !== void 0 ? A : 0
240
+ columnGap: (A = (M = (_ = (b = r.columnGap) !== null && b !== void 0 ? b : r.gap) !== null && _ !== void 0 ? _ : e.columnGap) !== null && M !== void 0 ? M : e.gap) !== null && A !== void 0 ? A : 0
241
241
  };
242
242
  }).sort((o, r) => o.maxWidth - r.maxWidth);
243
243
  return l.push({
@@ -269,8 +269,8 @@ class T {
269
269
  c.classList.add("item"), c.classList.toggle("-dynamic", !v.static), c.classList.toggle("-static", !!v.static);
270
270
  const k = v.y + v.h;
271
271
  k > r && (r = k);
272
- const w = R(v.w * i - a) + "px", _ = R(v.h * l - g) + "px", b = "translate(" + R(v.x * i) + "px, " + R(v.y * l) + "px)";
273
- c.style.width !== w && (c.style.width = w), c.style.height !== _ && (c.style.height = _), c.style.transform !== b && (c.style.transform = b);
272
+ const w = R(v.w * i - a) + "px", b = R(v.h * l - g) + "px", _ = "translate(" + R(v.x * i) + "px, " + R(v.y * l) + "px)";
273
+ c.style.width !== w && (c.style.width = w), c.style.height !== b && (c.style.height = b), c.style.transform !== _ && (c.style.transform = _);
274
274
  }
275
275
  const m = R(r * l - g) + "px";
276
276
  e.style.height !== m && (e.style.height = m);
@@ -429,10 +429,10 @@ class T {
429
429
  return p = L(p, n, x(s, t)), i = L(i, a, g), u = L(u, 0, t - p), f < 0 && (f = 0), e.x === u && e.y === f && e.w === p && e.h === i ? e : Object.assign(Object.assign({}, e), { x: u, y: f, w: p, h: i });
430
430
  }
431
431
  }
432
- T.RESIZE_THRESHOLD = 10;
433
- T.TAP_DELAY = 250;
434
- T.TAP_THRESHOLD = 10;
435
- T.DRAG_THRESHOLD = 7;
432
+ D.RESIZE_THRESHOLD = 10;
433
+ D.TAP_DELAY = 250;
434
+ D.TAP_THRESHOLD = 10;
435
+ D.DRAG_THRESHOLD = 7;
436
436
  function ee(E, e) {
437
437
  if (E === e)
438
438
  return !0;
@@ -446,7 +446,7 @@ function ee(E, e) {
446
446
  function L(E, e, t) {
447
447
  return E < e ? e : E > t ? t : E;
448
448
  }
449
- const I = Math.abs, x = Math.min, R = Math.round, W = { capture: !0 }, U = { passive: !0 };
449
+ const T = Math.abs, x = Math.min, R = Math.round, W = { capture: !0 }, U = { passive: !0 };
450
450
  function te(E) {
451
451
  const {
452
452
  layout: e,
@@ -455,21 +455,21 @@ function te(E) {
455
455
  gap: s = 0,
456
456
  rowHeight: a = 120,
457
457
  children: g
458
- } = E, u = z(() => ({
458
+ } = E, u = P(() => ({
459
459
  columns: n,
460
460
  gap: s,
461
461
  rowHeight: a
462
462
  }), [n, s, a]), f = O(null), p = O(null);
463
- return D(() => {
463
+ return H(() => {
464
464
  if (!f.current)
465
465
  return;
466
- const i = new T(f.current, u);
466
+ const i = new D(f.current, u);
467
467
  return i.setEditable(!0), i.setLayout(e), i.onLayoutChange(t), p.current = i, () => {
468
468
  i.disconnect();
469
469
  };
470
- }, []), D(() => {
470
+ }, []), H(() => {
471
471
  p.current?.setConfig(u);
472
- }, [u]), D(() => {
472
+ }, [u]), H(() => {
473
473
  const i = p.current;
474
474
  i?.onLayoutChange(() => {
475
475
  }), i?.setLayout(e), i?.onLayoutChange(t);
@@ -484,7 +484,7 @@ function ne(E) {
484
484
  layoutItemStyle: s = {},
485
485
  totalColumns: a = ie,
486
486
  gap: g
487
- } = E, u = z(() => e.map((i) => {
487
+ } = E, u = P(() => e.map((i) => {
488
488
  const { id: l, props: o } = i, r = t(l, o);
489
489
  return /* @__PURE__ */ C(
490
490
  "div",
@@ -498,7 +498,7 @@ function ne(E) {
498
498
  },
499
499
  l
500
500
  );
501
- }), [e, s, t]), f = z(() => e.map((i) => {
501
+ }), [e, s, t]), f = P(() => e.map((i) => {
502
502
  const {
503
503
  id: l,
504
504
  props: o,
@@ -535,7 +535,7 @@ function ne(E) {
535
535
  }
536
536
  );
537
537
  }
538
- const F = "list-har-entries", M = 12, se = [
538
+ const F = "list-har-entries", I = 12, se = [
539
539
  {
540
540
  x: 0,
541
541
  y: 0,
@@ -551,19 +551,19 @@ function fe(E) {
551
551
  const {
552
552
  harEntries: e,
553
553
  tableTitle: t
554
- } = E, [n, s] = P([]), [a, g] = P(se), [u, f] = P($);
555
- D(() => {
556
- const i = new Set(e.map(H));
554
+ } = E, [n, s] = z([]), [a, g] = z(se), [u, f] = z($);
555
+ H(() => {
556
+ const i = new Set(e.map(S));
557
557
  s((l) => {
558
558
  if (!l.length)
559
559
  return l;
560
560
  const o = l.filter(
561
- (r) => i.has(H(r))
561
+ (r) => i.has(S(r))
562
562
  );
563
563
  return o.length === l.length ? l : o;
564
564
  });
565
- }, [e]), D(() => {
566
- const i = n.map(H), l = new Set(i);
565
+ }, [e]), H(() => {
566
+ const i = n.map(S), l = new Set(i);
567
567
  g((o) => {
568
568
  let r = o.filter(({ props: { instanceId: w } }) => l.has(w) || w === F);
569
569
  const m = new Set(r.map(({ props: { instanceId: w } }) => w)), d = i.filter((w) => !m.has(w));
@@ -582,25 +582,25 @@ function fe(E) {
582
582
  w: c.w,
583
583
  h: c.h
584
584
  }), y && c?.props.instanceId === y.props.instanceId && (h.x = h.x + h.w), o.length === 1 && r.length === 1) {
585
- const w = r[0], _ = w.x + w.w;
586
- let b = M - _, S = w.x + b;
587
- b || (b = M / 2, S = b, r = [
585
+ const w = r[0];
586
+ let b = w.x + w.w, _ = I - b;
587
+ _ < 1 && (_ = I / 2, b = _, r = [
588
588
  {
589
589
  ...w,
590
590
  x: 0,
591
591
  y: 0,
592
- w: b
592
+ w: _
593
593
  }
594
594
  ]), h = {
595
- x: S,
595
+ x: b,
596
596
  y: 0,
597
- w: b,
597
+ w: _,
598
598
  h: w.h
599
599
  };
600
600
  }
601
601
  const v = d.map((w) => {
602
- h.x >= M && (h.x = 0, h.y += h.h);
603
- const _ = {
602
+ h.x >= I && (h.x = 0, h.y += h.h);
603
+ const b = {
604
604
  w: h.w,
605
605
  h: h.h,
606
606
  x: h.x,
@@ -609,10 +609,10 @@ function fe(E) {
609
609
  instanceId: w
610
610
  }
611
611
  };
612
- return h.x = h.x + h.w, _;
613
- }), k = [...r, ...v].map((w, _) => ({
612
+ return h.x = h.x + h.w, b;
613
+ }), k = [...r, ...v].map((w, b) => ({
614
614
  ...w,
615
- id: String(_)
615
+ id: String(b)
616
616
  }));
617
617
  return console.warn({ layoutDefinitions: k }), k;
618
618
  });
@@ -628,14 +628,14 @@ function fe(E) {
628
628
  onSelectionChange: s
629
629
  }
630
630
  ) });
631
- const o = n.find((r) => H(r) === l);
631
+ const o = n.find((r) => S(r) === l);
632
632
  if (o)
633
633
  return /* @__PURE__ */ q(j, { children: [
634
634
  /* @__PURE__ */ C(
635
635
  J,
636
636
  {
637
637
  onClose: () => {
638
- s((r) => r.filter((m) => H(m) !== l));
638
+ s((r) => r.filter((m) => S(m) !== l));
639
639
  }
640
640
  }
641
641
  ),
@@ -652,7 +652,7 @@ function fe(E) {
652
652
  return /* @__PURE__ */ C(
653
653
  ne,
654
654
  {
655
- totalColumns: M,
655
+ totalColumns: I,
656
656
  gap: 16,
657
657
  layoutItemStyle: {
658
658
  borderRadius: Y,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@har-analyzer/components",
3
3
  "type": "module",
4
- "version": "0.0.19",
4
+ "version": "0.0.20",
5
5
  "description": "Reusable React components for HAR Analyzer",
6
6
  "author": "Allan Joshua",
7
7
  "license": "MIT",