@the-portland-company/shell 0.103.0 → 0.104.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.
- package/dist/app-chrome.cjs +63 -7
- package/dist/app-chrome.cjs.map +1 -1
- package/dist/app-chrome.d.cts +1 -1
- package/dist/app-chrome.d.ts +1 -1
- package/dist/app-chrome.js +21 -6
- package/dist/app-chrome.js.map +1 -1
- package/dist/{chunk-KI5P6QKQ.js → chunk-7XWRF7Y2.js} +47 -6
- package/dist/chunk-7XWRF7Y2.js.map +1 -0
- package/dist/{index-lk2Ad_Q0.d.cts → index-BKVWMe9_.d.cts} +18 -1
- package/dist/{index-ND_BS0nl.d.ts → index-DnrsvxhZ.d.ts} +18 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/native.cjs +45 -3
- package/dist/native.cjs.map +1 -1
- package/dist/native.d.cts +1 -1
- package/dist/native.d.ts +1 -1
- package/dist/native.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-KI5P6QKQ.js.map +0 -1
package/dist/app-chrome.cjs
CHANGED
|
@@ -1916,9 +1916,17 @@ var APP_POLLS_CHILDREN = [
|
|
|
1916
1916
|
{ label: "Command Center", icon: "grid", href: "https://polls.politogyvrm.com/" },
|
|
1917
1917
|
{ label: "New Poll", icon: "edit", href: "https://polls.politogyvrm.com/polls/new" }
|
|
1918
1918
|
];
|
|
1919
|
+
var CTAS_ORIGIN = "https://ctas.politogyvrm.com";
|
|
1920
|
+
var ctaRecordTabs = (...tabs) => tabs.map((t) => `${CTAS_ORIGIN}/cta?tab=${t}`);
|
|
1919
1921
|
var APP_CTAS_CHILDREN = [
|
|
1920
|
-
{
|
|
1921
|
-
|
|
1922
|
+
{
|
|
1923
|
+
label: "Calls to action",
|
|
1924
|
+
icon: "list",
|
|
1925
|
+
href: `${CTAS_ORIGIN}/?tab=ctas`,
|
|
1926
|
+
activeOn: ctaRecordTabs("builder", "placement", "audience", "experiments")
|
|
1927
|
+
},
|
|
1928
|
+
{ label: "Performance", icon: "barChart", href: `${CTAS_ORIGIN}/?tab=analytics`, activeOn: ctaRecordTabs("performance") },
|
|
1929
|
+
{ label: "Settings", icon: "settings", href: `${CTAS_ORIGIN}/?tab=site-keys`, activeOn: ctaRecordTabs("settings") }
|
|
1922
1930
|
];
|
|
1923
1931
|
var APP_A2P_CHILDREN = [
|
|
1924
1932
|
{ label: "Dashboard", icon: "grid", path: "dashboard" },
|
|
@@ -2034,7 +2042,10 @@ function standardPolitogyNav(opts) {
|
|
|
2034
2042
|
label: "Calls to action",
|
|
2035
2043
|
icon: icon("mousePointerClick"),
|
|
2036
2044
|
href: withOrg("https://ctas.politogyvrm.com/"),
|
|
2037
|
-
|
|
2045
|
+
// Every page on the CTAs host belongs to this row (§11.3), including
|
|
2046
|
+
// an open CTA at /cta/<id>.
|
|
2047
|
+
activeOn: [`${CTAS_ORIGIN}/`],
|
|
2048
|
+
children: APP_CTAS_CHILDREN.map((c) => ({ label: c.label, icon: icon(c.icon), href: withOrg(c.href), activeOn: c.activeOn }))
|
|
2038
2049
|
},
|
|
2039
2050
|
{
|
|
2040
2051
|
label: "Forms",
|
|
@@ -2177,6 +2188,36 @@ function isNavItemActive(pathname, href) {
|
|
|
2177
2188
|
if (targetPath === "/") return pathname === "/";
|
|
2178
2189
|
return pathname === targetPath || pathname.startsWith(`${targetPath}/`);
|
|
2179
2190
|
}
|
|
2191
|
+
function isUnderNavPattern(pathname, pattern) {
|
|
2192
|
+
let targetPath = pattern;
|
|
2193
|
+
let targetSearch = "";
|
|
2194
|
+
if (/^https?:\/\//i.test(pattern)) {
|
|
2195
|
+
if (typeof window === "undefined") return false;
|
|
2196
|
+
try {
|
|
2197
|
+
const u = new URL(pattern);
|
|
2198
|
+
if (u.host !== window.location.host) return false;
|
|
2199
|
+
targetPath = u.pathname;
|
|
2200
|
+
targetSearch = u.search;
|
|
2201
|
+
} catch {
|
|
2202
|
+
return false;
|
|
2203
|
+
}
|
|
2204
|
+
} else {
|
|
2205
|
+
const qi = pattern.indexOf("?");
|
|
2206
|
+
if (qi >= 0) {
|
|
2207
|
+
targetPath = pattern.slice(0, qi) || "/";
|
|
2208
|
+
targetSearch = pattern.slice(qi);
|
|
2209
|
+
}
|
|
2210
|
+
}
|
|
2211
|
+
const underPath = targetPath === "/" || pathname === targetPath || pathname.startsWith(`${targetPath.replace(/\/$/, "")}/`);
|
|
2212
|
+
if (!underPath) return false;
|
|
2213
|
+
const want = new URLSearchParams(targetSearch);
|
|
2214
|
+
for (const k of ACTIVE_IGNORED_PARAMS) want.delete(k);
|
|
2215
|
+
if (Array.from(want).length === 0) return true;
|
|
2216
|
+
if (typeof window === "undefined") return false;
|
|
2217
|
+
const have = new URLSearchParams(window.location.search);
|
|
2218
|
+
for (const [k, v] of want) if (have.get(k) !== v) return false;
|
|
2219
|
+
return true;
|
|
2220
|
+
}
|
|
2180
2221
|
function groupKeyOf(item, index) {
|
|
2181
2222
|
return item.href ?? `nav-group-${index}-${item.label}`;
|
|
2182
2223
|
}
|
|
@@ -4586,18 +4627,33 @@ function FrameBody({
|
|
|
4586
4627
|
const navItems = core?.nav ?? derivedNavItems;
|
|
4587
4628
|
const navIsActive = react.useMemo(() => {
|
|
4588
4629
|
const childHrefs = /* @__PURE__ */ new Map();
|
|
4630
|
+
const extra = /* @__PURE__ */ new Map();
|
|
4631
|
+
const addExtra = (href, pats) => {
|
|
4632
|
+
if (!pats?.length) return;
|
|
4633
|
+
extra.set(href, [...extra.get(href) ?? [], ...pats]);
|
|
4634
|
+
};
|
|
4589
4635
|
for (const item of navItems) {
|
|
4590
|
-
if (!item.href
|
|
4636
|
+
if (!item.href) continue;
|
|
4637
|
+
addExtra(item.href, item.activeOn);
|
|
4638
|
+
if (!item.children?.length) continue;
|
|
4591
4639
|
const hrefs = [];
|
|
4592
4640
|
for (const child of item.children) {
|
|
4593
|
-
if (child.href)
|
|
4641
|
+
if (child.href) {
|
|
4642
|
+
hrefs.push(child.href);
|
|
4643
|
+
addExtra(child.href, child.activeOn);
|
|
4644
|
+
}
|
|
4645
|
+
addExtra(item.href, child.activeOn);
|
|
4594
4646
|
for (const leaf of child.children ?? []) {
|
|
4595
|
-
if (leaf.href)
|
|
4647
|
+
if (leaf.href) {
|
|
4648
|
+
hrefs.push(leaf.href);
|
|
4649
|
+
addExtra(leaf.href, leaf.activeOn);
|
|
4650
|
+
}
|
|
4651
|
+
addExtra(item.href, leaf.activeOn);
|
|
4596
4652
|
}
|
|
4597
4653
|
}
|
|
4598
4654
|
childHrefs.set(item.href, hrefs);
|
|
4599
4655
|
}
|
|
4600
|
-
return (pathname2, href) => isNavItemActive(pathname2, href) || (childHrefs.get(href) ?? []).some((h) => isNavItemActive(pathname2, h));
|
|
4656
|
+
return (pathname2, href) => isNavItemActive(pathname2, href) || (childHrefs.get(href) ?? []).some((h) => isNavItemActive(pathname2, h)) || (extra.get(href) ?? []).some((p) => isUnderNavPattern(pathname2, p));
|
|
4601
4657
|
}, [navItems]);
|
|
4602
4658
|
const derivedBreadcrumbs = react.useMemo(
|
|
4603
4659
|
() => deriveBreadcrumbs(navItems, pathname, { search, origin: meta.origin }),
|