baaz-custom-components 3.2.9 → 3.2.11
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.
- package/dist/index.js +10 -2
- package/dist/index.mjs +10 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -738,12 +738,13 @@ function buildFullHref(base, child) {
|
|
|
738
738
|
return new URL(child, base).toString();
|
|
739
739
|
}
|
|
740
740
|
function isRouteActive(fullHref, currentPathname) {
|
|
741
|
-
const
|
|
741
|
+
const hrefPathRaw = extractPathname(fullHref);
|
|
742
742
|
const hrefOrigin = extractOrigin(fullHref);
|
|
743
743
|
const currentOrigin = getCurrentOrigin();
|
|
744
744
|
if (hrefOrigin && currentOrigin && hrefOrigin !== currentOrigin) {
|
|
745
745
|
return false;
|
|
746
746
|
}
|
|
747
|
+
const hrefPath = hrefPathRaw.endsWith("/-") ? hrefPathRaw.slice(0, -2) : hrefPathRaw;
|
|
747
748
|
return currentPathname === hrefPath || currentPathname.startsWith(hrefPath + "/");
|
|
748
749
|
}
|
|
749
750
|
function treeContainsPath({
|
|
@@ -756,10 +757,17 @@ function treeContainsPath({
|
|
|
756
757
|
if (baseOrigin && currentOrigin && baseOrigin !== currentOrigin) {
|
|
757
758
|
return false;
|
|
758
759
|
}
|
|
760
|
+
function normalizeDynamic(path) {
|
|
761
|
+
if (path.endsWith("/-")) {
|
|
762
|
+
return path.slice(0, -2);
|
|
763
|
+
}
|
|
764
|
+
return path;
|
|
765
|
+
}
|
|
759
766
|
for (const node of data) {
|
|
760
767
|
if (typeof node.routes === "string") {
|
|
761
768
|
const full = buildFullHref(base, node.routes);
|
|
762
|
-
|
|
769
|
+
let hrefPath = extractPathname(full);
|
|
770
|
+
hrefPath = normalizeDynamic(hrefPath);
|
|
763
771
|
if (pathname === hrefPath || pathname.startsWith(hrefPath + "/")) {
|
|
764
772
|
return true;
|
|
765
773
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -704,12 +704,13 @@ function buildFullHref(base, child) {
|
|
|
704
704
|
return new URL(child, base).toString();
|
|
705
705
|
}
|
|
706
706
|
function isRouteActive(fullHref, currentPathname) {
|
|
707
|
-
const
|
|
707
|
+
const hrefPathRaw = extractPathname(fullHref);
|
|
708
708
|
const hrefOrigin = extractOrigin(fullHref);
|
|
709
709
|
const currentOrigin = getCurrentOrigin();
|
|
710
710
|
if (hrefOrigin && currentOrigin && hrefOrigin !== currentOrigin) {
|
|
711
711
|
return false;
|
|
712
712
|
}
|
|
713
|
+
const hrefPath = hrefPathRaw.endsWith("/-") ? hrefPathRaw.slice(0, -2) : hrefPathRaw;
|
|
713
714
|
return currentPathname === hrefPath || currentPathname.startsWith(hrefPath + "/");
|
|
714
715
|
}
|
|
715
716
|
function treeContainsPath({
|
|
@@ -722,10 +723,17 @@ function treeContainsPath({
|
|
|
722
723
|
if (baseOrigin && currentOrigin && baseOrigin !== currentOrigin) {
|
|
723
724
|
return false;
|
|
724
725
|
}
|
|
726
|
+
function normalizeDynamic(path) {
|
|
727
|
+
if (path.endsWith("/-")) {
|
|
728
|
+
return path.slice(0, -2);
|
|
729
|
+
}
|
|
730
|
+
return path;
|
|
731
|
+
}
|
|
725
732
|
for (const node of data) {
|
|
726
733
|
if (typeof node.routes === "string") {
|
|
727
734
|
const full = buildFullHref(base, node.routes);
|
|
728
|
-
|
|
735
|
+
let hrefPath = extractPathname(full);
|
|
736
|
+
hrefPath = normalizeDynamic(hrefPath);
|
|
729
737
|
if (pathname === hrefPath || pathname.startsWith(hrefPath + "/")) {
|
|
730
738
|
return true;
|
|
731
739
|
}
|