Files
lucide/docs/.vitepress/theme
NanashiandEric Fennis 390e824cfe feat(site): Preselect external libraries via ?library= URL param (#5180)
* feat(site): Preselect external libraries via `?library=` URL param

Opening /icons/?library=lab now enables the Lab library on load, and
toggling the checkbox keeps the address bar in sync, so the current
selection can be shared as a link.

- Repeated params (?library=a&library=b) and comma lists are accepted;
  unknown values and duplicates are dropped.
- The param is applied in onMounted rather than during setup, so the
  fetch watchers already exist and hydration doesn't mismatch on the
  checkbox.
- The URL is updated with replaceState, preserving history.state and
  other params such as ?search=.

* fix(site): Keep `?library=` across navigation and the icon drawer

The library param was only read on the first mount and was dropped by
the icon drawer, so it stopped matching the selection:

- /icons/?library=lab -> Categories -> uncheck Lab -> Back restored
  ?library=lab in the URL but left nothing selected.
- Opening and closing an icon drawer on desktop kept Lab selected but
  removed ?library= from the URL, so sharing or refreshing lost it.

Now the selection is reconciled with the URL on every mount and on
popstate: a valid ?library= wins, and when the URL has none but a
library is selected, the param is written back with replaceState.
The drawer's pushState calls in IconItem.vue and IconsOverview.vue
keep the param via a new setLibraryParams helper.

* Add localstorage

* Refactor code

---------

Co-authored-by: Eric Fennis <eric.fennis@gmail.com>
2026-11-19 14:47:14 +01:00
..