@plitzi/plitzi-ui 1.6.11 → 1.6.12

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.
@@ -7,4 +7,4 @@ var n = () => {
7
7
  return n;
8
8
  };
9
9
  //#endregion
10
- export { n as default };
10
+ export { n as default, n as useAccordion };
@@ -1,7 +1,7 @@
1
1
  import e from "../../hooks/useDidUpdateEffect/index.js";
2
2
  import { PopupContextFloating as t, PopupContextLeft as n, PopupContextRight as r } from "./PopupContext.js";
3
3
  import i from "./components/PopupSidePanel/index.js";
4
- import a from "./helpers/PopupManager.js";
4
+ import { PopupManager as a } from "./helpers/PopupManager.js";
5
5
  import o from "./PopupFloatingArea.js";
6
6
  import { useCallback as s, useEffect as c, useMemo as l, useRef as u, useState as d } from "react";
7
7
  import { jsx as f, jsxs as p } from "react/jsx-runtime";
@@ -240,4 +240,4 @@ var e = class {
240
240
  }
241
241
  };
242
242
  //#endregion
243
- export { e as default };
243
+ export { e as PopupManager, e as default };
@@ -1,7 +1,7 @@
1
1
  import { PopupContextFloating as e, PopupContextLeft as t, PopupContextRight as n } from "./PopupContext.js";
2
2
  import r from "./hooks/usePopup.js";
3
3
  import i from "./components/PopupSidePanel/index.js";
4
- import a from "./helpers/PopupManager.js";
4
+ import { PopupManager as a } from "./helpers/PopupManager.js";
5
5
  import o from "./Popup.js";
6
6
  import s from "./Popup.styles.js";
7
7
  import c from "./PopupProvider.js";
@@ -99,7 +99,7 @@ import Xe from "./Popup/hooks/usePopup.js";
99
99
  import Ze from "./Sidebar/Sidebar.styles.js";
100
100
  import Qe from "./Sidebar/index.js";
101
101
  import $e from "./Popup/components/PopupSidePanel/index.js";
102
- import et from "./Popup/helpers/PopupManager.js";
102
+ import { PopupManager as et } from "./Popup/helpers/PopupManager.js";
103
103
  import tt from "./Popup/Popup.styles.js";
104
104
  import nt from "./Popup/PopupProvider.js";
105
105
  import rt from "./Popup/index.js";
@@ -29,10 +29,10 @@ function t(e, n = /* @__PURE__ */ new WeakMap()) {
29
29
  let r = [];
30
30
  return n.set(e, r), e.forEach((e, i) => r[i] = t(e, n)), r;
31
31
  }
32
- let r = Object.create(Object.getPrototypeOf(e));
33
- n.set(e, r);
34
- for (let i in e) Object.prototype.hasOwnProperty.call(e, i) && (r[i] = t(e[i], n));
35
- return r;
32
+ let r = Object.getPrototypeOf(e), i = Object.create(r);
33
+ n.set(e, i);
34
+ for (let r in e) Object.prototype.hasOwnProperty.call(e, r) && (i[r] = t(e[r], n));
35
+ return i;
36
36
  }
37
37
  var n = (e) => Object.assign(Object.create(Object.getPrototypeOf(e)), e);
38
38
  function r(t, r) {
@@ -19,4 +19,4 @@ var l = /* @__PURE__ */ e({
19
19
  useValueMemo: () => t
20
20
  });
21
21
  //#endregion
22
- export { l as hooks_exports };
22
+ export { l as hooks_exports, r as useDidUpdateEffect, i as useDisclosure, a as useReducerWithMiddleware, o as useStateDebounce, s as useStateMemo, c as useStorage, n as useTheme, t as useValueMemo };
@@ -1,2 +1,3 @@
1
- declare function useLocalStorage<T = unknown>(keyProp: string, initialValue: T, mode?: 'localStorage' | 'sessionStorage', autoSync?: boolean): readonly [T, import('react').Dispatch<import('react').SetStateAction<T>>];
1
+ type StorageMode = 'localStorage' | 'sessionStorage' | 'cookie';
2
+ declare function useLocalStorage<T = unknown>(keyProp: string, initialValue: T, mode?: StorageMode, autoSync?: boolean): readonly [T, import('react').Dispatch<import('react').SetStateAction<T>>];
2
3
  export default useLocalStorage;
@@ -1,43 +1,40 @@
1
1
  import { get as e } from "../../helpers/lodash/get.js";
2
2
  import { set as t } from "../../helpers/lodash/set.js";
3
3
  import n from "../useDidUpdateEffect/index.js";
4
- import { storageProxy as r } from "./useStorageHelper.js";
5
- import { useCallback as i, useEffect as a, useMemo as o, useRef as s, useState as c } from "react";
6
- import { produce as l } from "immer";
4
+ import { cookieStorage as r, storageProxy as i } from "./useStorageHelper.js";
5
+ import { useCallback as a, useEffect as o, useMemo as s, useRef as c, useState as l } from "react";
6
+ import { produce as u } from "immer";
7
7
  //#region src/hooks/useStorage/useStorage.ts
8
- function u(u, d, f = "localStorage", p = !0) {
9
- let [m, h] = o(() => {
10
- if (u.includes(".")) {
11
- let e = u.split(".").filter(Boolean);
8
+ var d = (e) => e === "cookie" ? typeof document < "u" ? i(r()) : void 0 : e === "sessionStorage" ? typeof sessionStorage < "u" ? i(sessionStorage) : void 0 : typeof localStorage < "u" ? i(localStorage) : void 0;
9
+ function f(r, i, f = "localStorage", p = !0) {
10
+ let [m, h] = s(() => {
11
+ if (r.includes(".")) {
12
+ let e = r.split(".").filter(Boolean);
12
13
  return [e.shift(), e.join(".")];
13
14
  }
14
- return [u, ""];
15
- }, [u]), g = s(f === "localStorage" ? typeof localStorage < "u" ? r(localStorage) : void 0 : typeof sessionStorage < "u" ? r(sessionStorage) : void 0);
15
+ return [r, ""];
16
+ }, [r]), g = c(d(f));
16
17
  n(() => {
17
- if (f === "localStorage" && typeof localStorage > "u" || f === "sessionStorage" && typeof sessionStorage > "u") {
18
- g.current = void 0;
19
- return;
20
- }
21
- g.current = r(f === "localStorage" ? localStorage : sessionStorage);
18
+ g.current = d(f);
22
19
  }, [f]);
23
- let [_, v] = c(() => {
20
+ let [_, v] = l(() => {
24
21
  try {
25
- if (!g.current) return d;
22
+ if (!g.current) return i;
26
23
  let t = g.current.getItem(m);
27
- if (!t) return d;
24
+ if (!t) return i;
28
25
  let n = JSON.parse(t);
29
- return h ? e(n, h, d) : n;
26
+ return h ? e(n, h, i) : n;
30
27
  } catch {
31
- return d;
28
+ return i;
32
29
  }
33
30
  });
34
- a(() => {
31
+ o(() => {
35
32
  try {
36
33
  if (!g.current) return;
37
34
  let e = _;
38
35
  if (h) {
39
36
  let n = g.current.getItem(m);
40
- e = l(n ? JSON.parse(n) : {}, (e) => {
37
+ e = u(n ? JSON.parse(n) : {}, (e) => {
41
38
  t(e, h, _);
42
39
  });
43
40
  }
@@ -50,26 +47,26 @@ function u(u, d, f = "localStorage", p = !0) {
50
47
  h,
51
48
  _
52
49
  ]);
53
- let y = i((t) => {
50
+ let y = a((t) => {
54
51
  if (t.key === m) try {
55
- let n = t.newValue ? JSON.parse(t.newValue) : d;
56
- v(h ? e(n, h, d) : n);
52
+ let n = t.newValue ? JSON.parse(t.newValue) : i;
53
+ v(h ? e(n, h, i) : n);
57
54
  } catch {}
58
55
  }, [
59
56
  m,
60
57
  h,
61
- d
62
- ]), b = i((t) => {
58
+ i
59
+ ]), b = a((t) => {
63
60
  if (t.detail.key === m) try {
64
- let n = t.detail.newValue ? JSON.parse(t.detail.newValue) : d;
65
- v(h ? e(n, h, d) : n);
61
+ let n = t.detail.newValue ? JSON.parse(t.detail.newValue) : i;
62
+ v(h ? e(n, h, i) : n);
66
63
  } catch {}
67
64
  }, [
68
65
  m,
69
66
  h,
70
- d
67
+ i
71
68
  ]);
72
- return a(() => {
69
+ return o(() => {
73
70
  if (!(typeof window > "u" || !p)) return window.addEventListener("storage", y), window.addEventListener("customstorage-changed", b), () => {
74
71
  window.removeEventListener("storage", y), window.removeEventListener("customstorage-changed", b);
75
72
  };
@@ -81,4 +78,4 @@ function u(u, d, f = "localStorage", p = !0) {
81
78
  ]), [_, v];
82
79
  }
83
80
  //#endregion
84
- export { u as default };
81
+ export { f as default };
@@ -1 +1,2 @@
1
+ export declare const cookieStorage: () => Storage;
1
2
  export declare const storageProxy: (storage: Storage) => Storage;
@@ -11,7 +11,38 @@ var e = (e, t, n) => {
11
11
  oldValue: t,
12
12
  newValue: n
13
13
  } }));
14
- }, t = (t) => new Proxy(t, { get(t, n, r) {
14
+ }, t = 3600 * 24 * 365, n = () => {
15
+ let e = {};
16
+ if (typeof document > "u" || !document.cookie) return e;
17
+ for (let t of document.cookie.split(";")) {
18
+ let n = t.indexOf("=");
19
+ n !== -1 && (e[t.slice(0, n).trim()] = decodeURIComponent(t.slice(n + 1).trim()));
20
+ }
21
+ return e;
22
+ }, r = () => {
23
+ let e = {
24
+ getItem(e) {
25
+ let t = n();
26
+ return e in t ? t[e] : null;
27
+ },
28
+ setItem(e, n) {
29
+ typeof document > "u" || (document.cookie = `${e}=${encodeURIComponent(n)}; path=/; max-age=${t}; samesite=lax`);
30
+ },
31
+ removeItem(e) {
32
+ typeof document > "u" || (document.cookie = `${e}=; path=/; max-age=0; samesite=lax`);
33
+ },
34
+ clear() {
35
+ for (let t of Object.keys(n())) e.removeItem(t);
36
+ },
37
+ key(e) {
38
+ return Object.keys(n())[e] ?? null;
39
+ },
40
+ get length() {
41
+ return Object.keys(n()).length;
42
+ }
43
+ };
44
+ return e;
45
+ }, i = (t) => new Proxy(t, { get(t, n, r) {
15
46
  if (n === "setItem") return (n, r) => {
16
47
  let i = t.getItem(n);
17
48
  t.setItem.call(t, n, r), i !== r && e(n, i, r);
@@ -24,4 +55,4 @@ var e = (e, t, n) => {
24
55
  return typeof i == "function" ? i.bind(t) : i;
25
56
  } });
26
57
  //#endregion
27
- export { t as storageProxy };
58
+ export { r as cookieStorage, i as storageProxy };
package/dist/index.js CHANGED
@@ -117,7 +117,7 @@ import gt from "./components/Popup/hooks/usePopup.js";
117
117
  import _t from "./components/Sidebar/Sidebar.styles.js";
118
118
  import vt from "./components/Sidebar/index.js";
119
119
  import yt from "./components/Popup/components/PopupSidePanel/index.js";
120
- import bt from "./components/Popup/helpers/PopupManager.js";
120
+ import { PopupManager as bt } from "./components/Popup/helpers/PopupManager.js";
121
121
  import xt from "./components/Popup/Popup.styles.js";
122
122
  import St from "./components/Popup/PopupProvider.js";
123
123
  import Ct from "./components/Popup/index.js";
@@ -3,4 +3,4 @@ import t from "./deepEqual/index.js";
3
3
  //#region src/utils/index.ts
4
4
  var n = /* @__PURE__ */ e({ deepEqual: () => t });
5
5
  //#endregion
6
- export { n as utils_exports };
6
+ export { t as deepEqual, n as utils_exports };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plitzi/plitzi-ui",
3
- "version": "1.6.11",
3
+ "version": "1.6.12",
4
4
  "homepage": "./",
5
5
  "license": "Apache-2.0",
6
6
  "files": [
@@ -90,15 +90,15 @@
90
90
  ],
91
91
  "dependencies": {
92
92
  "@codemirror/autocomplete": "^6.20.3",
93
- "@codemirror/commands": "^6.10.3",
93
+ "@codemirror/commands": "^6.10.4",
94
94
  "@codemirror/lang-css": "^6.3.1",
95
95
  "@codemirror/lang-html": "^6.4.11",
96
96
  "@codemirror/lang-javascript": "^6.2.5",
97
97
  "@codemirror/lang-json": "^6.0.2",
98
98
  "@codemirror/search": "^6.7.1",
99
- "@codemirror/state": "^6.6.0",
99
+ "@codemirror/state": "^6.7.0",
100
100
  "@codemirror/theme-one-dark": "^6.1.3",
101
- "@codemirror/view": "^6.43.1",
101
+ "@codemirror/view": "^6.43.4",
102
102
  "@hookform/resolvers": "^5.4.0",
103
103
  "@uiw/color-convert": "^2.10.3",
104
104
  "@uiw/react-color-sketch": "^2.10.3",
@@ -137,13 +137,13 @@
137
137
  "@testing-library/react": "^16.3.2",
138
138
  "@types/lodash": "^4.17.24",
139
139
  "@types/lodash-es": "^4.17.12",
140
- "@types/node": "^26.0.0",
140
+ "@types/node": "^26.0.1",
141
141
  "@types/react": "^19.2.17",
142
142
  "@types/react-color": "^3.0.13",
143
143
  "@types/react-dom": "^19.2.3",
144
144
  "@types/react-syntax-highlighter": "^15.5.13",
145
145
  "@types/tinycolor2": "^1.4.6",
146
- "@vitejs/plugin-react": "^6.0.2",
146
+ "@vitejs/plugin-react": "^6.0.3",
147
147
  "cssnano": "^8.0.2",
148
148
  "eslint": "^9.39.4",
149
149
  "eslint-plugin-import": "^2.32.0",
@@ -152,24 +152,24 @@
152
152
  "eslint-plugin-react-hooks": "^7.1.1",
153
153
  "eslint-plugin-react-refresh": "^0.5.3",
154
154
  "eslint-plugin-storybook": "^10.4.6",
155
- "flow-bin": "^0.320.0",
156
- "globals": "^17.6.0",
155
+ "flow-bin": "^0.321.0",
156
+ "globals": "^17.7.0",
157
157
  "jsdom": "^29.1.1",
158
158
  "lodash": "^4.18.1",
159
159
  "lodash-es": "^4.18.1",
160
160
  "postcss": "^8.5.15",
161
161
  "postcss-scss": "^4.0.9",
162
- "prettier": "^3.8.4",
162
+ "prettier": "^3.9.0",
163
163
  "sass": "^1.101.0",
164
164
  "storybook": "^10.4.6",
165
- "stylelint": "^17.13.0",
165
+ "stylelint": "^17.14.0",
166
166
  "stylelint-order": "^8.1.1",
167
167
  "stylelint-scss": "^7.2.0",
168
168
  "tailwindcss": "4.3.1",
169
169
  "typescript": "^6.0.3",
170
- "typescript-eslint": "^8.61.1",
171
- "vite": "^8.0.16",
172
- "vite-plugin-dts": "^5.0.2",
170
+ "typescript-eslint": "^8.62.0",
171
+ "vite": "^8.1.0",
172
+ "vite-plugin-dts": "^5.0.3",
173
173
  "vite-plugin-static-copy": "^4.1.1",
174
174
  "vitest": "^4.1.9",
175
175
  "vitest-fetch-mock": "^0.4.5"
@@ -204,5 +204,5 @@
204
204
  "last 1 safari version"
205
205
  ]
206
206
  },
207
- "packageManager": "yarn@4.2.2"
207
+ "packageManager": "yarn@4.17.0"
208
208
  }