vanta-admin 0.5.0__tar.gz → 0.5.1__tar.gz

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.
Files changed (44) hide show
  1. {vanta_admin-0.5.0/vanta_admin.egg-info → vanta_admin-0.5.1}/PKG-INFO +1 -1
  2. {vanta_admin-0.5.0 → vanta_admin-0.5.1}/pyproject.toml +1 -1
  3. {vanta_admin-0.5.0 → vanta_admin-0.5.1}/vanta_admin/static/admin/js/sidebar.js +79 -17
  4. {vanta_admin-0.5.0 → vanta_admin-0.5.1/vanta_admin.egg-info}/PKG-INFO +1 -1
  5. {vanta_admin-0.5.0 → vanta_admin-0.5.1}/LICENSE +0 -0
  6. {vanta_admin-0.5.0 → vanta_admin-0.5.1}/MANIFEST.in +0 -0
  7. {vanta_admin-0.5.0 → vanta_admin-0.5.1}/README.md +0 -0
  8. {vanta_admin-0.5.0 → vanta_admin-0.5.1}/setup.cfg +0 -0
  9. {vanta_admin-0.5.0 → vanta_admin-0.5.1}/vanta_admin/__init__.py +0 -0
  10. {vanta_admin-0.5.0 → vanta_admin-0.5.1}/vanta_admin/apps.py +0 -0
  11. {vanta_admin-0.5.0 → vanta_admin-0.5.1}/vanta_admin/static/admin/css/theme.admin.css +0 -0
  12. {vanta_admin-0.5.0 → vanta_admin-0.5.1}/vanta_admin/static/admin/css/theme.base.css +0 -0
  13. {vanta_admin-0.5.0 → vanta_admin-0.5.1}/vanta_admin/static/admin/css/theme.css +0 -0
  14. {vanta_admin-0.5.0 → vanta_admin-0.5.1}/vanta_admin/static/admin/css/theme.login.css +0 -0
  15. {vanta_admin-0.5.0 → vanta_admin-0.5.1}/vanta_admin/static/admin/css/theme.responsive.css +0 -0
  16. {vanta_admin-0.5.0 → vanta_admin-0.5.1}/vanta_admin/static/admin/css/theme.tokens.css +0 -0
  17. {vanta_admin-0.5.0 → vanta_admin-0.5.1}/vanta_admin/static/admin/css/two_factor.css +0 -0
  18. {vanta_admin-0.5.0 → vanta_admin-0.5.1}/vanta_admin/static/admin/img/favicon.png +0 -0
  19. {vanta_admin-0.5.0 → vanta_admin-0.5.1}/vanta_admin/static/admin/js/changelist.js +0 -0
  20. {vanta_admin-0.5.0 → vanta_admin-0.5.1}/vanta_admin/static/admin/js/forms.js +0 -0
  21. {vanta_admin-0.5.0 → vanta_admin-0.5.1}/vanta_admin/static/admin/js/messages.js +0 -0
  22. {vanta_admin-0.5.0 → vanta_admin-0.5.1}/vanta_admin/static/admin/js/vanta-theme.js +0 -0
  23. {vanta_admin-0.5.0 → vanta_admin-0.5.1}/vanta_admin/templates/admin/app_index.html +0 -0
  24. {vanta_admin-0.5.0 → vanta_admin-0.5.1}/vanta_admin/templates/admin/base.html +0 -0
  25. {vanta_admin-0.5.0 → vanta_admin-0.5.1}/vanta_admin/templates/admin/base_site.html +0 -0
  26. {vanta_admin-0.5.0 → vanta_admin-0.5.1}/vanta_admin/templates/admin/change_form.html +0 -0
  27. {vanta_admin-0.5.0 → vanta_admin-0.5.1}/vanta_admin/templates/admin/change_list.html +0 -0
  28. {vanta_admin-0.5.0 → vanta_admin-0.5.1}/vanta_admin/templates/admin/filter.html +0 -0
  29. {vanta_admin-0.5.0 → vanta_admin-0.5.1}/vanta_admin/templates/admin/includes/breadcrumbs.html +0 -0
  30. {vanta_admin-0.5.0 → vanta_admin-0.5.1}/vanta_admin/templates/admin/index.html +0 -0
  31. {vanta_admin-0.5.0 → vanta_admin-0.5.1}/vanta_admin/templates/admin/login.html +0 -0
  32. {vanta_admin-0.5.0 → vanta_admin-0.5.1}/vanta_admin/templates/admin/nav_sidebar.html +0 -0
  33. {vanta_admin-0.5.0 → vanta_admin-0.5.1}/vanta_admin/templates/two_factor/_base.html +0 -0
  34. {vanta_admin-0.5.0 → vanta_admin-0.5.1}/vanta_admin/templates/two_factor/_base_focus.html +0 -0
  35. {vanta_admin-0.5.0 → vanta_admin-0.5.1}/vanta_admin/templates/two_factor/_wizard_actions.html +0 -0
  36. {vanta_admin-0.5.0 → vanta_admin-0.5.1}/vanta_admin/templates/two_factor/core/login.html +0 -0
  37. {vanta_admin-0.5.0 → vanta_admin-0.5.1}/vanta_admin/templates/two_factor/core/setup_complete.html +0 -0
  38. {vanta_admin-0.5.0 → vanta_admin-0.5.1}/vanta_admin/templates/two_factor/profile/profile.html +0 -0
  39. {vanta_admin-0.5.0 → vanta_admin-0.5.1}/vanta_admin/templatetags/__init__.py +0 -0
  40. {vanta_admin-0.5.0 → vanta_admin-0.5.1}/vanta_admin/templatetags/admin_theme.py +0 -0
  41. {vanta_admin-0.5.0 → vanta_admin-0.5.1}/vanta_admin.egg-info/SOURCES.txt +0 -0
  42. {vanta_admin-0.5.0 → vanta_admin-0.5.1}/vanta_admin.egg-info/dependency_links.txt +0 -0
  43. {vanta_admin-0.5.0 → vanta_admin-0.5.1}/vanta_admin.egg-info/requires.txt +0 -0
  44. {vanta_admin-0.5.0 → vanta_admin-0.5.1}/vanta_admin.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: vanta-admin
3
- Version: 0.5.0
3
+ Version: 0.5.1
4
4
  Summary: A sharp, dark, and portable Django admin theme forged for builders who want the admin to feel less default.
5
5
  Author: oli-dev0
6
6
  License-Expression: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "vanta-admin"
7
- version = "0.5.0"
7
+ version = "0.5.1"
8
8
  description = "A sharp, dark, and portable Django admin theme forged for builders who want the admin to feel less default."
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -13,7 +13,9 @@
13
13
  const navFilter = document.getElementById('admin-nav-filter');
14
14
  const mobileQuery = window.matchMedia('(max-width: 1024px)');
15
15
  const navSections = Array.from(document.querySelectorAll('[data-admin-nav-section]'));
16
- let isFilteringNavigation = false;
16
+ const programmaticSectionToggles = new WeakSet();
17
+ let filterBaselineOpenSections = null;
18
+ let hadFilterQuery = false;
17
19
 
18
20
  function setCollapsed(isCollapsed, shouldPersist) {
19
21
  body.classList.toggle('admin-sidebar-collapsed', isCollapsed);
@@ -60,6 +62,10 @@
60
62
  return section.dataset.adminNavSection;
61
63
  }
62
64
 
65
+ function isCurrentSection(section) {
66
+ return section.classList.contains('is-current-app');
67
+ }
68
+
63
69
  function syncSectionAria(section) {
64
70
  const summary = section.querySelector('.admin-sidebar__group-title');
65
71
  if (summary) {
@@ -67,6 +73,13 @@
67
73
  }
68
74
  }
69
75
 
76
+ function getCurrentOpenSections() {
77
+ return new Set(navSections
78
+ .filter(isSectionOpen)
79
+ .map(getSectionKey)
80
+ .filter(Boolean));
81
+ }
82
+
70
83
  function getStoredOpenSections() {
71
84
  try {
72
85
  const value = JSON.parse(localStorage.getItem(navSectionsStateKey));
@@ -77,16 +90,40 @@
77
90
  }
78
91
 
79
92
  function persistOpenSections() {
80
- if (isFilteringNavigation) {
93
+ const openSections = Array.from(getCurrentOpenSections());
94
+
95
+ localStorage.setItem(navSectionsStateKey, JSON.stringify(openSections));
96
+ }
97
+
98
+ function persistFilteredSectionToggle(section) {
99
+ const sectionKey = getSectionKey(section);
100
+ if (!sectionKey) {
81
101
  return;
82
102
  }
83
103
 
84
- const openSections = navSections
85
- .filter(isSectionOpen)
86
- .map(getSectionKey)
87
- .filter(Boolean);
104
+ const openSections = new Set(filterBaselineOpenSections || getStoredOpenSections() || []);
88
105
 
89
- localStorage.setItem(navSectionsStateKey, JSON.stringify(openSections));
106
+ if (isSectionOpen(section)) {
107
+ openSections.add(sectionKey);
108
+ } else {
109
+ openSections.delete(sectionKey);
110
+ }
111
+
112
+ filterBaselineOpenSections = openSections;
113
+ localStorage.setItem(navSectionsStateKey, JSON.stringify(Array.from(openSections)));
114
+ }
115
+
116
+ function setSectionOpen(section, isOpen, shouldPersist) {
117
+ if (section.open === isOpen) {
118
+ return;
119
+ }
120
+
121
+ if (!shouldPersist) {
122
+ programmaticSectionToggles.add(section);
123
+ }
124
+
125
+ section.open = isOpen;
126
+ syncSectionAria(section);
90
127
  }
91
128
 
92
129
  function normalizeFilterValue(value) {
@@ -105,7 +142,9 @@
105
142
  const query = normalizeFilterValue(navFilter.value);
106
143
  const hasQuery = query.length > 0;
107
144
 
108
- isFilteringNavigation = true;
145
+ if (hasQuery && !hadFilterQuery) {
146
+ filterBaselineOpenSections = getCurrentOpenSections();
147
+ }
109
148
 
110
149
  navSections.forEach((section) => {
111
150
  const sectionTitle = section.querySelector('.admin-sidebar__group-title span');
@@ -124,46 +163,59 @@
124
163
  section.hidden = hasQuery && !matchesSection && !hasVisibleModel;
125
164
 
126
165
  if (hasQuery && !section.hidden) {
127
- section.open = true;
166
+ setSectionOpen(section, true, false);
128
167
  }
129
168
 
130
169
  syncSectionAria(section);
131
170
  });
132
171
 
133
172
  if (!hasQuery) {
134
- applyStoredOpenSections();
173
+ applyOpenSections(filterBaselineOpenSections || getStoredOpenSections());
135
174
  navSections.forEach((section) => {
136
175
  section.hidden = false;
137
176
  section.querySelectorAll('.admin-sidebar__model').forEach((item) => {
138
177
  item.hidden = false;
139
178
  });
140
179
  });
180
+ filterBaselineOpenSections = null;
141
181
  }
142
182
 
143
- isFilteringNavigation = false;
183
+ hadFilterQuery = hasQuery;
144
184
  }
145
185
 
146
- function applyStoredOpenSections() {
147
- const storedOpenSections = getStoredOpenSections();
148
-
149
- if (!storedOpenSections) {
186
+ function applyOpenSections(openSections, shouldPersist) {
187
+ if (!openSections) {
150
188
  root.classList.remove('admin-nav-state-pending');
151
189
  return;
152
190
  }
153
191
 
192
+ const nextOpenSections = new Set(openSections);
193
+ navSections
194
+ .filter(isCurrentSection)
195
+ .map(getSectionKey)
196
+ .filter(Boolean)
197
+ .forEach((sectionKey) => nextOpenSections.add(sectionKey));
198
+
154
199
  navSections.forEach((section) => {
155
200
  const sectionKey = getSectionKey(section);
156
201
  if (!sectionKey) {
157
202
  return;
158
203
  }
159
204
 
160
- section.open = storedOpenSections.has(sectionKey);
161
- syncSectionAria(section);
205
+ setSectionOpen(section, nextOpenSections.has(sectionKey), false);
162
206
  });
163
207
 
208
+ if (shouldPersist) {
209
+ localStorage.setItem(navSectionsStateKey, JSON.stringify(Array.from(nextOpenSections)));
210
+ }
211
+
164
212
  root.classList.remove('admin-nav-state-pending');
165
213
  }
166
214
 
215
+ function applyStoredOpenSections() {
216
+ applyOpenSections(getStoredOpenSections(), true);
217
+ }
218
+
167
219
  const storedCollapsed = localStorage.getItem(sidebarStateKey);
168
220
  setCollapsed(storedCollapsed === 'true', false);
169
221
  setMobileOpen(false);
@@ -190,6 +242,16 @@
190
242
  syncSectionAria(section);
191
243
  section.addEventListener('toggle', () => {
192
244
  syncSectionAria(section);
245
+ if (programmaticSectionToggles.has(section)) {
246
+ programmaticSectionToggles.delete(section);
247
+ return;
248
+ }
249
+
250
+ if (hadFilterQuery) {
251
+ persistFilteredSectionToggle(section);
252
+ return;
253
+ }
254
+
193
255
  persistOpenSections();
194
256
  });
195
257
  });
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: vanta-admin
3
- Version: 0.5.0
3
+ Version: 0.5.1
4
4
  Summary: A sharp, dark, and portable Django admin theme forged for builders who want the admin to feel less default.
5
5
  Author: oli-dev0
6
6
  License-Expression: MIT
File without changes
File without changes
File without changes
File without changes