hd-wallet-ui 1.5.0 → 1.6.0

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 (2) hide show
  1. package/package.json +2 -2
  2. package/src/app.js +14 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hd-wallet-ui",
3
- "version": "1.5.0",
3
+ "version": "1.6.0",
4
4
  "description": "HD Wallet modal UI — login, keys, identity, trust map, and security bond. Attach to any button in your app.",
5
5
  "type": "module",
6
6
  "main": "src/app.js",
@@ -40,7 +40,7 @@
40
40
  "buffer": "^6.0.3",
41
41
  "flatbuffers": "^25.9.23",
42
42
  "flatc-wasm": "^26.1.15",
43
- "hd-wallet-wasm": "^1.5.0",
43
+ "hd-wallet-wasm": "^1.6.0",
44
44
  "qrcode": "^1.5.3",
45
45
  "spacedatastandards.org": "^23.3.3-0.3.4",
46
46
  "vcard-cryptoperson": "^1.1.11"
package/src/app.js CHANGED
@@ -77,6 +77,16 @@ const $ = (id) => {
77
77
  if (_root !== document) return document.getElementById(id);
78
78
  return null;
79
79
  };
80
+
81
+ export function normalizeTabHash(rawHash) {
82
+ return String(rawHash || '')
83
+ .replace(/^\/+/g, '')
84
+ .split(/[/?#]/)[0]
85
+ .replace(/[^a-z0-9_-]/gi, '')
86
+ .replace(/-tab$/i, '')
87
+ .toLowerCase();
88
+ }
89
+
80
90
  const $q = (sel) => _root.querySelector(sel) || (_root !== document ? document.querySelector(sel) : null);
81
91
  const $qa = (sel) => {
82
92
  const list = _root.querySelectorAll(sel);
@@ -5825,14 +5835,15 @@ export async function init(rootElement, options = {}) {
5825
5835
 
5826
5836
  // Handle initial hash navigation
5827
5837
  const initialHash = window.location.hash.slice(1);
5828
- if (initialHash) {
5829
- const tabEl = $(`${initialHash}-tab`);
5838
+ const normalizedTab = normalizeTabHash(initialHash);
5839
+ if (normalizedTab) {
5840
+ const tabEl = $(`${normalizedTab}-tab`);
5830
5841
  if (tabEl) {
5831
5842
  setTimeout(() => {
5832
5843
  tabEl.scrollIntoView({ behavior: 'smooth', block: 'start' });
5833
5844
  $qa('.nav-link[data-tab]').forEach(link => {
5834
5845
  link.classList.remove('active');
5835
- if (link.dataset.tab === initialHash) {
5846
+ if (link.dataset.tab === normalizedTab) {
5836
5847
  link.classList.add('active');
5837
5848
  }
5838
5849
  });