@the-portland-company/shell 0.16.5 → 0.16.7

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/chrome.css CHANGED
@@ -384,3 +384,12 @@
384
384
  .dark .topbar-widget-slot [class*="hover:bg-slate-"]:hover {
385
385
  background-color: var(--panel);
386
386
  }
387
+
388
+ /* Badge anchor: DevNotes nests its count inside an inner `relative` span that
389
+ wraps only the glyph, so identical offsets anchored to the GLYPH, not the
390
+ 32px circle like every other slot. Neutralize inner positioning so the
391
+ badge anchors to the (relative) button — one universal badge placement. */
392
+ .topbar-widget-slot button > span,
393
+ .topbar-widget-slot > div > button:first-of-type > span {
394
+ position: static;
395
+ }
package/dist/native.cjs CHANGED
@@ -214,7 +214,25 @@ function NavChromeProvider({
214
214
  fetchJson,
215
215
  children
216
216
  }) {
217
- return /* @__PURE__ */ jsxRuntime.jsx(NavChromeContext.Provider, { value: { fetchJson }, children });
217
+ const [me, setMe] = react.useState(null);
218
+ const [meLoaded, setMeLoaded] = react.useState(false);
219
+ react.useEffect(() => {
220
+ let cancelled = false;
221
+ fetchJson("me").then((data) => {
222
+ if (!cancelled) setMe(data);
223
+ }).catch(() => {
224
+ }).finally(() => {
225
+ if (!cancelled) setMeLoaded(true);
226
+ });
227
+ return () => {
228
+ cancelled = true;
229
+ };
230
+ }, [fetchJson]);
231
+ return /* @__PURE__ */ jsxRuntime.jsx(NavChromeContext.Provider, { value: { fetchJson, me, meLoaded }, children });
232
+ }
233
+ function useChromeMe() {
234
+ const ctx = react.useContext(NavChromeContext);
235
+ return { me: ctx?.me ?? null, loaded: ctx?.meLoaded ?? false };
218
236
  }
219
237
  function useNavChrome(component) {
220
238
  const ctx = react.useContext(NavChromeContext);
@@ -677,23 +695,21 @@ function useThemePreference() {
677
695
  setValueState(pref);
678
696
  applyThemePreference(pref);
679
697
  }, []);
698
+ const meCtx = react.useContext(NavChromeContext);
680
699
  react.useEffect(() => {
681
- if (!fetchJson || reconciled.current) return;
682
- reconciled.current = true;
683
- fetchJson("me").then((data) => {
684
- const pref = data?.themePreference;
685
- if (isThemePreference(pref)) {
686
- setValueState(pref);
687
- applyThemePreference(pref);
688
- writeThemeCookie(pref);
689
- try {
690
- localStorage.setItem(THEME_STORAGE_KEY, pref);
691
- } catch {
692
- }
700
+ if (reconciled.current) return;
701
+ const pref = meCtx?.me?.themePreference;
702
+ if (isThemePreference(pref)) {
703
+ reconciled.current = true;
704
+ setValueState(pref);
705
+ applyThemePreference(pref);
706
+ writeThemeCookie(pref);
707
+ try {
708
+ localStorage.setItem(THEME_STORAGE_KEY, pref);
709
+ } catch {
693
710
  }
694
- }).catch(() => {
695
- });
696
- }, [fetchJson]);
711
+ }
712
+ }, [meCtx?.me]);
697
713
  react.useEffect(() => {
698
714
  const onStorage = (e) => {
699
715
  if (e.key === THEME_STORAGE_KEY && isThemePreference(e.newValue)) {
@@ -1660,6 +1676,7 @@ exports.envChipClasses = envChipClasses;
1660
1676
  exports.isNavItemActive = isNavItemActive;
1661
1677
  exports.standardPolitogyNav = standardPolitogyNav;
1662
1678
  exports.topBarIconButtonClass = topBarIconButtonClass;
1679
+ exports.useChromeMe = useChromeMe;
1663
1680
  exports.useChromeOrgs = useChromeOrgs;
1664
1681
  exports.useThemePreference = useThemePreference;
1665
1682
  //# sourceMappingURL=native.cjs.map