@invopop/popui 0.1.102 → 0.1.103

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.
@@ -15,6 +15,7 @@ declare class SidebarState {
15
15
  constructor(props: SidebarStateProps);
16
16
  get isMobile(): boolean;
17
17
  setWidth: (px: number) => void;
18
+ persistWidth: () => void;
18
19
  resetWidth: () => void;
19
20
  handleShortcutKeydown: (e: KeyboardEvent) => void;
20
21
  setOpenMobile: (value: boolean) => void;
@@ -26,13 +26,15 @@ class SidebarState {
26
26
  setWidth = (px) => {
27
27
  const clamped = Math.max(SIDEBAR_MIN_WIDTH_PX, Math.min(SIDEBAR_MAX_WIDTH_PX, px));
28
28
  this.width = `${clamped}px`;
29
- if (typeof localStorage !== 'undefined') {
30
- try {
31
- localStorage.setItem(SIDEBAR_WIDTH_STORAGE_KEY, this.width);
32
- }
33
- catch {
34
- // ignore quota / private-mode errors
35
- }
29
+ };
30
+ persistWidth = () => {
31
+ if (typeof localStorage === 'undefined')
32
+ return;
33
+ try {
34
+ localStorage.setItem(SIDEBAR_WIDTH_STORAGE_KEY, this.width);
35
+ }
36
+ catch {
37
+ // ignore quota / private-mode errors
36
38
  }
37
39
  };
38
40
  resetWidth = () => {
@@ -88,6 +88,9 @@
88
88
  isDragging = false
89
89
  isPointerDown = false
90
90
  sidebar.isResizing = false
91
+ if (dragMoved && !resizeCommitted) {
92
+ sidebar.persistWidth()
93
+ }
91
94
  resizeCommitted = false
92
95
  if (dragMoved) {
93
96
  dragEndTime = Date.now()
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@invopop/popui",
3
3
  "license": "MIT",
4
- "version": "0.1.102",
4
+ "version": "0.1.103",
5
5
  "repository": {
6
6
  "url": "https://github.com/invopop/popui"
7
7
  },