@har-analyzer/components 0.0.5 → 0.0.9

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,35 +1,8 @@
1
- import { _ as i, u as p, I as l, a as g, j as u, S as c } from "./content-type.js";
2
- import f from "react";
3
- function o() {
4
- return o = Object.assign ? Object.assign.bind() : function(n) {
5
- for (var a = 1; a < arguments.length; a++) {
6
- var e = arguments[a];
7
- for (var r in e) ({}).hasOwnProperty.call(e, r) && (n[r] = e[r]);
8
- }
9
- return n;
10
- }, o.apply(null, arguments);
11
- }
12
- function m(n) {
13
- var { variant: a = "div", margin: e = {}, padding: r = {} } = n, t = i(n, ["variant", "margin", "padding"]);
14
- const s = p("Box", {
15
- props: {
16
- color: t.color,
17
- display: t.display,
18
- float: t.float,
19
- fontSize: t.fontSize,
20
- fontWeight: t.fontWeight,
21
- textAlign: t.textAlign,
22
- variant: a
23
- }
24
- });
25
- return f.createElement(l, Object.assign({ variant: a, margin: e, padding: r }, t, s));
26
- }
27
- g(m, "Box");
28
- function v({ children: n, ...a }) {
29
- return /* @__PURE__ */ u.jsx(c, { size: "xxl", ...a, children: n });
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import o from "@cloudscape-design/components/space-between";
3
+ function a({ children: e, ...r }) {
4
+ return /* @__PURE__ */ t(o, { size: "xxl", ...r, children: e });
30
5
  }
31
6
  export {
32
- m as B,
33
- v as V,
34
- o as _
7
+ a as V
35
8
  };
@@ -0,0 +1,18 @@
1
+ import { Dispatch } from 'react';
2
+ import { JSX } from 'react/jsx-runtime';
3
+ import { PropsWithChildren } from 'react';
4
+ import { SetStateAction } from 'react';
5
+
6
+ declare function HARAnalyzerPreferencesProvider({ store, children }: PropsWithChildren<{
7
+ store: UserPreferenceStore;
8
+ }>): JSX.Element;
9
+ export default HARAnalyzerPreferencesProvider;
10
+
11
+ export declare function useHARAnalyzerPreferences<T>(preferenceKey: string, defaultValue: T): readonly [T, Dispatch<SetStateAction<T>>];
12
+
13
+ declare interface UserPreferenceStore {
14
+ getPreference: (key: string) => Promise<string | undefined>;
15
+ setPreference: (key: string, value: string) => Promise<void>;
16
+ }
17
+
18
+ export { }
@@ -0,0 +1,97 @@
1
+ import { jsx as v } from "react/jsx-runtime";
2
+ import { createContext as D, use as E, useState as F, useCallback as h, useEffect as m } from "react";
3
+ function x(t, e) {
4
+ try {
5
+ return JSON.parse(t ?? "");
6
+ } catch (r) {
7
+ return console.warn("Failed to parse JSON string:", t, "Error:", r), e;
8
+ }
9
+ }
10
+ async function i(t, e) {
11
+ return new Promise((r, n) => {
12
+ t.addEventListener("success", () => {
13
+ r(t.result);
14
+ }), t.addEventListener("error", () => {
15
+ n(e);
16
+ });
17
+ });
18
+ }
19
+ var y = function(t, e, r, n, o) {
20
+ if (n === "m") throw new TypeError("Private method is not writable");
21
+ if (n === "a" && !o) throw new TypeError("Private accessor was defined without a setter");
22
+ if (typeof e == "function" ? t !== e || !o : !e.has(t)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
23
+ return n === "a" ? o.call(t, r) : o ? o.value = r : e.set(t, r), r;
24
+ }, a = function(t, e, r, n) {
25
+ if (r === "a" && !n) throw new TypeError("Private accessor was defined without a getter");
26
+ if (typeof e == "function" ? t !== e || !n : !e.has(t)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
27
+ return r === "m" ? n : r === "a" ? n.call(t) : n ? n.value : e.get(t);
28
+ }, s, l, c, d, b, g;
29
+ class A {
30
+ constructor({ name: e }) {
31
+ s.add(this), l.set(this, void 0), c.set(this, void 0), y(this, l, e, "f");
32
+ }
33
+ async getItem(e) {
34
+ const r = await a(this, s, "m", d).call(this);
35
+ return i(r.get(e), "Failed to get item");
36
+ }
37
+ async setItem(e, r) {
38
+ const n = await a(this, s, "m", d).call(this);
39
+ return i(n.put(r, e), "Failed to set item");
40
+ }
41
+ async removeItem(e) {
42
+ const r = await a(this, s, "m", d).call(this);
43
+ return i(r.delete(e), "Failed to remove item");
44
+ }
45
+ async clear() {
46
+ const e = await a(this, s, "m", d).call(this);
47
+ return i(e.clear(), "Failed to clear store");
48
+ }
49
+ }
50
+ l = /* @__PURE__ */ new WeakMap(), c = /* @__PURE__ */ new WeakMap(), s = /* @__PURE__ */ new WeakSet(), d = async function() {
51
+ return (await a(this, s, "m", b).call(this)).transaction("store", "readwrite").objectStore("store");
52
+ }, b = async function() {
53
+ return a(this, c, "f") === void 0 && y(this, c, a(this, s, "m", g).call(this), "f"), a(this, c, "f");
54
+ }, g = async function() {
55
+ const e = indexedDB.open(a(this, l, "f"), 1);
56
+ return e.addEventListener("upgradeneeded", () => {
57
+ e.result.createObjectStore("store");
58
+ }), i(e, "Failed to open IndexedDB");
59
+ };
60
+ const _ = new A({ name: "node_modules/local-db-storage" }), p = {
61
+ get: async (t) => await _.getItem(t),
62
+ set: async (t, e) => {
63
+ await _.setItem(t, e);
64
+ }
65
+ }, P = D(void 0);
66
+ function T({ store: t, children: e }) {
67
+ return /* @__PURE__ */ v(P, { value: t, children: e });
68
+ }
69
+ const C = {
70
+ getPreference: p.get,
71
+ setPreference: p.set
72
+ };
73
+ function z(t, e) {
74
+ let r = E(P);
75
+ r || (console.warn("Invoked outside of HARAnalyzerPreferencesProvider. Falling back to use fallback preferences store."), r = C);
76
+ const [n, o] = F(e), f = h(async () => {
77
+ const u = await r.getPreference(t), S = x(u, e);
78
+ o(S);
79
+ }, [r, t, e]);
80
+ m(() => {
81
+ f();
82
+ }, [f]);
83
+ const w = h(async () => {
84
+ try {
85
+ await r.setPreference(t, JSON.stringify(n));
86
+ } catch (u) {
87
+ console.error(`Failed to update preference for key ${t}:`, u);
88
+ }
89
+ }, [r, t, n]);
90
+ return m(() => {
91
+ w();
92
+ }, [w]), [n, o];
93
+ }
94
+ export {
95
+ T as default,
96
+ z as useHARAnalyzerPreferences
97
+ };
@@ -1,11 +1,11 @@
1
1
  import { JSX } from 'react/jsx-runtime';
2
2
 
3
- declare function HarAnalyzer({ logo, appName }: HarAnalyzerProps): JSX.Element;
4
- export default HarAnalyzer;
3
+ declare function HARAnalyzer({ logo, appName }: HARAnalyzerProps): JSX.Element;
4
+ export default HARAnalyzer;
5
5
 
6
- declare interface HarAnalyzerProps {
6
+ declare interface HARAnalyzerProps {
7
7
  logo?: React.ReactNode;
8
- appName: string;
8
+ appName?: string;
9
9
  }
10
10
 
11
11
  export { }