@har-analyzer/components 0.0.4 → 0.0.8

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.
@@ -0,0 +1,14 @@
1
+ import { Har } from 'har-format';
2
+ import { JSX } from 'react/jsx-runtime';
3
+
4
+ declare type HARContent = Har;
5
+
6
+ declare function HARContentViewer(props: HARContentViewerProps): JSX.Element;
7
+ export default HARContentViewer;
8
+
9
+ declare interface HARContentViewerProps {
10
+ harFileName: string;
11
+ harContent: HARContent;
12
+ }
13
+
14
+ export { }
@@ -0,0 +1,149 @@
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import { useMemo as I, useState as g, useEffect as S } from "react";
3
+ import w from "@cloudscape-design/board-components/board";
4
+ import $ from "@cloudscape-design/board-components/board-item";
5
+ import b from "@cloudscape-design/components/button";
6
+ import H from "@cloudscape-design/components/header";
7
+ import { u as C } from "./chunks/index.js";
8
+ import { u as B, H as z } from "./chunks/index2.js";
9
+ import L from "./har-entry-viewer.js";
10
+ import { a as _ } from "./chunks/har.js";
11
+ const F = {
12
+ dragHandleAriaLabel: "Drag handle",
13
+ dragHandleAriaDescription: "Use Space or Enter to activate drag, arrow keys to move, Space or Enter to submit, or Escape to discard. Be sure to temporarily disable any screen reader navigation feature that may interfere with the functionality of the arrow keys.",
14
+ resizeHandleAriaLabel: "Resize handle",
15
+ resizeHandleAriaDescription: "Use Space or Enter to activate resize, arrow keys to move, Space or Enter to submit, or Escape to discard. Be sure to temporarily disable any screen reader navigation feature that may interfere with the functionality of the arrow keys."
16
+ };
17
+ function d(e, n, t) {
18
+ const i = n.length > 0 ? `Conflicts with ${n.map((r) => r.id).join(", ")}.` : "", s = t.length > 0 ? `Disturbed ${t.length} items.` : "";
19
+ return [e, i, s].filter(Boolean).join(" ");
20
+ }
21
+ const N = {
22
+ liveAnnouncementDndStarted: (e) => e === "resize" ? "Resizing" : "Dragging",
23
+ liveAnnouncementDndItemReordered: (e) => {
24
+ const n = `column ${e.placement.x + 1}`, t = `row ${e.placement.y + 1}`;
25
+ return d(
26
+ `Item moved to ${e.direction === "horizontal" ? n : t}.`,
27
+ e.conflicts,
28
+ e.disturbed
29
+ );
30
+ },
31
+ liveAnnouncementDndItemResized: (e) => {
32
+ const n = e.isMinimalColumnsReached ? " (minimal)" : "", t = e.isMinimalRowsReached ? " (minimal)" : "", i = e.direction === "horizontal" ? `columns ${e.placement.width}${n}` : `rows ${e.placement.height}${t}`;
33
+ return d(`Item resized to ${i}.`, e.conflicts, e.disturbed);
34
+ },
35
+ liveAnnouncementDndItemInserted: (e) => {
36
+ const n = `column ${e.placement.x + 1}`, t = `row ${e.placement.y + 1}`;
37
+ return d(`Item inserted to ${n}, ${t}.`, e.conflicts, e.disturbed);
38
+ },
39
+ liveAnnouncementDndCommitted: (e) => `${e} committed`,
40
+ liveAnnouncementDndDiscarded: (e) => `${e} discarded`,
41
+ liveAnnouncementItemRemoved: (e) => d(`Removed item ${e.item.id}.`, [], e.disturbed),
42
+ navigationAriaLabel: "Board navigation",
43
+ navigationAriaDescription: "Click on non-empty item to move focus over",
44
+ navigationItemAriaLabel: (e) => e ? e.id : "Empty"
45
+ };
46
+ function T(e) {
47
+ const {
48
+ components: n,
49
+ definitions: t,
50
+ onDefinitionsChange: i,
51
+ empty: s
52
+ } = e;
53
+ return /* @__PURE__ */ o(
54
+ w,
55
+ {
56
+ i18nStrings: N,
57
+ items: t,
58
+ renderItem: ({ id: r }, { removeItem: c }) => {
59
+ const {
60
+ title: m,
61
+ content: l,
62
+ actions: u,
63
+ counter: f,
64
+ canRemove: h
65
+ } = n[r] ?? {};
66
+ return /* @__PURE__ */ o(
67
+ $,
68
+ {
69
+ header: /* @__PURE__ */ o(H, { counter: f, actions: u, children: m }),
70
+ i18nStrings: F,
71
+ settings: h && /* @__PURE__ */ o(b, { variant: "icon", iconName: "close", onClick: c }),
72
+ children: l
73
+ }
74
+ );
75
+ },
76
+ onItemsChange: ({ detail: { items: r } }) => {
77
+ i(r);
78
+ },
79
+ empty: s
80
+ }
81
+ );
82
+ }
83
+ function k(e, n) {
84
+ return B(`boardDefinitionsPreference_${e}`, n);
85
+ }
86
+ const v = 6, D = "har-entries-viewer", E = "selected-har-entry-viewer", R = [
87
+ {
88
+ id: D,
89
+ rowSpan: v,
90
+ columnSpan: 12
91
+ }
92
+ ], O = [
93
+ ...R,
94
+ {
95
+ id: E,
96
+ rowSpan: v,
97
+ columnSpan: 12
98
+ }
99
+ ];
100
+ function K(e) {
101
+ const { harFileName: n, harContent: t } = e, i = I(() => _(t), [t]), [s, r] = g(), [c, m] = g(R);
102
+ S(() => {
103
+ r(void 0);
104
+ }, [i]);
105
+ const [l, u] = k(
106
+ "har-contents-viewer",
107
+ O
108
+ ), f = (a) => {
109
+ m(a), a.length > 1 && u(a);
110
+ }, h = (a) => {
111
+ r(a), c.length === 1 && m(l);
112
+ }, {
113
+ HAREntriesFilters: p,
114
+ filteredHAREntries: A
115
+ } = C(i), y = {
116
+ [D]: {
117
+ title: n,
118
+ counter: `(${A.length} / ${i.length})`,
119
+ actions: /* @__PURE__ */ o(p, {}),
120
+ content: /* @__PURE__ */ o(
121
+ z,
122
+ {
123
+ harEntries: A,
124
+ onChange: h
125
+ }
126
+ )
127
+ },
128
+ [E]: s ? {
129
+ title: "Details",
130
+ content: /* @__PURE__ */ o(L, { harEntry: s }),
131
+ canRemove: !0
132
+ } : {
133
+ title: "Select an entry to see details",
134
+ content: null,
135
+ canRemove: !0
136
+ }
137
+ };
138
+ return /* @__PURE__ */ o(
139
+ T,
140
+ {
141
+ components: y,
142
+ definitions: c,
143
+ onDefinitionsChange: f
144
+ }
145
+ );
146
+ }
147
+ export {
148
+ K as default
149
+ };
@@ -0,0 +1,23 @@
1
+ import { Entry } from 'har-format';
2
+ import { Har } from 'har-format';
3
+ import { JSX } from 'react/jsx-runtime';
4
+
5
+ declare function getEntriesFromHAR(harContent?: Har): Entry[];
6
+
7
+ declare type HAREntry = Omit<HAREntryWithoutError, 'response'> & {
8
+ response: HARResponseWithError;
9
+ };
10
+
11
+ declare type HAREntryWithoutError = ReturnType<typeof getEntriesFromHAR>[number];
12
+
13
+ declare type HARResponseWithError = HAREntryWithoutError['response'] & {
14
+ _error?: string;
15
+ };
16
+
17
+ declare function useHAREntriesFilters(harEntries: HAREntry[]): {
18
+ filteredHAREntries: HAREntry[];
19
+ HAREntriesFilters: () => JSX.Element;
20
+ };
21
+ export default useHAREntriesFilters;
22
+
23
+ export { }
@@ -0,0 +1,7 @@
1
+ import "react/jsx-runtime";
2
+ import "react";
3
+ import { u as i } from "./chunks/index.js";
4
+ import "./chunks/har.js";
5
+ export {
6
+ i as default
7
+ };
@@ -1,27 +1,26 @@
1
- import type { Har } from 'har-format';
1
+ import { Entry } from 'har-format';
2
+ import { Har } from 'har-format';
2
3
  import { JSX } from 'react/jsx-runtime';
3
4
 
4
- declare function getEntriesFromHAR(harContent?: Har) {
5
- return harContent?.log.entries || [];
6
- }
7
-
8
- declare type HarContent = Har;
5
+ declare function getEntriesFromHAR(harContent?: Har): Entry[];
9
6
 
10
- declare function HAREntriesViewer({ harFileName, harContent, onChange }: HAREntriesViewerProps): JSX.Element | undefined;
7
+ declare function HAREntriesViewer({ id, harEntries, onChange, }: HAREntriesViewerProps): JSX.Element;
11
8
  export default HAREntriesViewer;
12
9
 
13
10
  declare interface HAREntriesViewerProps {
14
- harFileName?: string;
15
- harContent?: HarContent;
11
+ id?: string;
12
+ harEntries: HAREntry[];
16
13
  onChange: (selectedHAREntry: HAREntry) => void;
17
14
  }
18
15
 
19
16
  declare type HAREntry = Omit<HAREntryWithoutError, 'response'> & {
20
- response: HARResponseWithError;
17
+ response: HARResponseWithError;
21
18
  };
22
19
 
23
20
  declare type HAREntryWithoutError = ReturnType<typeof getEntriesFromHAR>[number];
24
21
 
25
- declare type HARResponseWithError = HAREntryWithoutError['response'] & { _error?: string };
22
+ declare type HARResponseWithError = HAREntryWithoutError['response'] & {
23
+ _error?: string;
24
+ };
26
25
 
27
26
  export { }
@@ -1,7 +1,9 @@
1
- import "./chunks/content-type.js";
2
- import { H as i } from "./chunks/index.js";
1
+ import "react/jsx-runtime";
2
+ import "@cloudscape-design/components/link";
3
+ import "@cloudscape-design/components/status-indicator";
4
+ import { H as e } from "./chunks/index2.js";
3
5
  import "react";
4
- import "./chunks/index4.js";
6
+ import "./chunks/har.js";
5
7
  export {
6
- i as default
8
+ e as default
7
9
  };
@@ -1,12 +1,11 @@
1
- import type { Har } from 'har-format';
1
+ import { Entry } from 'har-format';
2
+ import { Har } from 'har-format';
2
3
  import { JSX } from 'react/jsx-runtime';
3
4
 
4
- declare function getEntriesFromHAR(harContent?: Har) {
5
- return harContent?.log.entries || [];
6
- }
5
+ declare function getEntriesFromHAR(harContent?: Har): Entry[];
7
6
 
8
7
  declare type HAREntry = Omit<HAREntryWithoutError, 'response'> & {
9
- response: HARResponseWithError;
8
+ response: HARResponseWithError;
10
9
  };
11
10
 
12
11
  declare function HAREntryViewer({ harEntry }: HAREntryViewerProps): JSX.Element;
@@ -18,6 +17,8 @@ declare interface HAREntryViewerProps {
18
17
 
19
18
  declare type HAREntryWithoutError = ReturnType<typeof getEntriesFromHAR>[number];
20
19
 
21
- declare type HARResponseWithError = HAREntryWithoutError['response'] & { _error?: string };
20
+ declare type HARResponseWithError = HAREntryWithoutError['response'] & {
21
+ _error?: string;
22
+ };
22
23
 
23
24
  export { }