@the-portland-company/shell 0.99.0 → 0.100.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/CHANGELOG.md +17 -0
- package/dist/app-chrome.cjs +117 -10
- package/dist/app-chrome.cjs.map +1 -1
- package/dist/app-chrome.d.cts +8 -1
- package/dist/app-chrome.d.ts +8 -1
- package/dist/app-chrome.js +41 -4
- package/dist/app-chrome.js.map +1 -1
- package/dist/{chunk-YMCWLO2L.js → chunk-2JH5AWUG.js} +74 -4
- package/dist/chunk-2JH5AWUG.js.map +1 -0
- package/dist/{index-Di9AyVsU.d.ts → index-2RNBy1XE.d.ts} +16 -1
- package/dist/{index-DhrhpBVm.d.cts → index-B57_u6pS.d.cts} +16 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/native.cjs +73 -0
- 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-YMCWLO2L.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { orgIdTail, authBaseUrl } from './chunk-5LO5W7W5.js';
|
|
2
2
|
import { PageHeaderView, BreadcrumbBarView, resolveOrgLogoUrl, topBarIconButtonClass, TopBarTooltip, TopBarPanelArrow, NavThemeControl, NAV_DISPLAY_OPTIONS, useTopBarIconSlotGlyph, resolveBrandGlyph, TOPBAR_GLYPH_SIZE, resolveTabGlyph, warnDeprecated, SpeculationRulesScript } from './chunk-PQQLCUNO.js';
|
|
3
3
|
import { readRailPreference, writeRailPreference } from './chunk-7YVJ7HQG.js';
|
|
4
|
-
import { createContext,
|
|
4
|
+
import { createContext, useEffect, useRef, useMemo, useState, Fragment as Fragment$1, useLayoutEffect, useContext } from 'react';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
6
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
7
7
|
import { LuSignpost, LuDoorOpen, LuChartNoAxesColumn, LuLandmark, LuCrosshair, LuCircleUser, LuClipboardList, LuMousePointerClick, LuUsersRound, LuLayoutDashboard, LuFlag, LuTarget, LuMapPin, LuMap, LuPhone, LuShare2, LuDollarSign, LuCreditCard, LuSettings, LuBriefcase, LuChartColumn, LuUser, LuClock, LuSend, LuFileText, LuPencil, LuUpload, LuList, LuLayoutGrid, LuLifeBuoy, LuActivity, LuMessageSquare, LuMail, LuUsers, LuHouse } from 'react-icons/lu';
|
|
@@ -54,6 +54,75 @@ function shouldShowOrgFilter(count) {
|
|
|
54
54
|
function normalize(s) {
|
|
55
55
|
return s.normalize("NFD").replace(/[̀-ͯ]/g, "").toLowerCase().trim();
|
|
56
56
|
}
|
|
57
|
+
var PAGE_KEYS = ["mode", "page", "tab"];
|
|
58
|
+
function pageIdentityOf(pathname, search) {
|
|
59
|
+
const params = new URLSearchParams(search.startsWith("?") ? search.slice(1) : search);
|
|
60
|
+
const path = pathname.length > 1 ? pathname.replace(/\/+$/, "") : pathname;
|
|
61
|
+
return {
|
|
62
|
+
pathname: path || "/",
|
|
63
|
+
mode: params.get("mode") || null,
|
|
64
|
+
page: params.get("page") || null,
|
|
65
|
+
tab: params.get("tab") || null
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
function isNewPage(prev, next) {
|
|
69
|
+
if (prev.pathname !== next.pathname) return true;
|
|
70
|
+
return PAGE_KEYS.some((k) => prev[k] !== null && next[k] !== prev[k]);
|
|
71
|
+
}
|
|
72
|
+
function scrollWindowToTop() {
|
|
73
|
+
if (window.scrollX === 0 && window.scrollY === 0) return;
|
|
74
|
+
try {
|
|
75
|
+
window.scrollTo({ top: 0, left: 0, behavior: "instant" });
|
|
76
|
+
} catch {
|
|
77
|
+
window.scrollTo(0, 0);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
var lastIdentity = null;
|
|
81
|
+
var listeners = 0;
|
|
82
|
+
var detach = null;
|
|
83
|
+
function currentIdentity() {
|
|
84
|
+
return pageIdentityOf(window.location.pathname, window.location.search);
|
|
85
|
+
}
|
|
86
|
+
function check(traverse = false) {
|
|
87
|
+
const next = currentIdentity();
|
|
88
|
+
const prev = lastIdentity;
|
|
89
|
+
lastIdentity = next;
|
|
90
|
+
if (!prev || traverse) return;
|
|
91
|
+
if (!isNewPage(prev, next)) return;
|
|
92
|
+
if (window.location.hash) return;
|
|
93
|
+
scrollWindowToTop();
|
|
94
|
+
}
|
|
95
|
+
function attach() {
|
|
96
|
+
const nav = window.navigation;
|
|
97
|
+
if (nav && typeof nav.addEventListener === "function") {
|
|
98
|
+
const onEntryChange = (e) => {
|
|
99
|
+
check(e.navigationType === "traverse");
|
|
100
|
+
};
|
|
101
|
+
nav.addEventListener("currententrychange", onEntryChange);
|
|
102
|
+
return () => nav.removeEventListener("currententrychange", onEntryChange);
|
|
103
|
+
}
|
|
104
|
+
const onPopState = () => check(true);
|
|
105
|
+
window.addEventListener("popstate", onPopState);
|
|
106
|
+
return () => window.removeEventListener("popstate", onPopState);
|
|
107
|
+
}
|
|
108
|
+
var useIsoLayoutEffect = typeof window === "undefined" ? useEffect : useLayoutEffect;
|
|
109
|
+
function useScrollToTopOnNewPage() {
|
|
110
|
+
useEffect(() => {
|
|
111
|
+
if (listeners === 0) detach = attach();
|
|
112
|
+
listeners += 1;
|
|
113
|
+
return () => {
|
|
114
|
+
listeners -= 1;
|
|
115
|
+
if (listeners === 0) {
|
|
116
|
+
detach?.();
|
|
117
|
+
detach = null;
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
}, []);
|
|
121
|
+
useIsoLayoutEffect(() => {
|
|
122
|
+
if (lastIdentity) check();
|
|
123
|
+
else lastIdentity = currentIdentity();
|
|
124
|
+
});
|
|
125
|
+
}
|
|
57
126
|
function PageHeader(props) {
|
|
58
127
|
return /* @__PURE__ */ jsx(PageHeaderView, { ...props });
|
|
59
128
|
}
|
|
@@ -1945,6 +2014,7 @@ function NavAppShell({
|
|
|
1945
2014
|
children
|
|
1946
2015
|
}) {
|
|
1947
2016
|
useCloseNavDetailsOnOutsideClick();
|
|
2017
|
+
useScrollToTopOnNewPage();
|
|
1948
2018
|
if (contentWrapper === "bare") {
|
|
1949
2019
|
warnDeprecated(
|
|
1950
2020
|
"contentWrapper",
|
|
@@ -2033,6 +2103,6 @@ function NavAppShell({
|
|
|
2033
2103
|
);
|
|
2034
2104
|
}
|
|
2035
2105
|
|
|
2036
|
-
export { BETA_BANNER_DISMISS_KEY, BreadcrumbBar, CAMPAIGN_FEATURE_AVAILABILITY, NavAppShell, NavBetaBanner, NavSidebar, NavTabStrip, NavTopBar, PageHeader, buildLineParts, clearBetaBannerDismissal, envChipClasses, isNavItemActive, modeIdFromLabel, shortEnvLabel, shortUserName, standardNavIcons, standardPolitogyNav };
|
|
2037
|
-
//# sourceMappingURL=chunk-
|
|
2038
|
-
//# sourceMappingURL=chunk-
|
|
2106
|
+
export { BETA_BANNER_DISMISS_KEY, BreadcrumbBar, CAMPAIGN_FEATURE_AVAILABILITY, NavAppShell, NavBetaBanner, NavSidebar, NavTabStrip, NavTopBar, PageHeader, buildLineParts, clearBetaBannerDismissal, envChipClasses, isNavItemActive, isNewPage, modeIdFromLabel, pageIdentityOf, shortEnvLabel, shortUserName, standardNavIcons, standardPolitogyNav, useScrollToTopOnNewPage };
|
|
2107
|
+
//# sourceMappingURL=chunk-2JH5AWUG.js.map
|
|
2108
|
+
//# sourceMappingURL=chunk-2JH5AWUG.js.map
|