@the-portland-company/shell 0.72.1 → 0.73.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.
@@ -244,21 +244,12 @@ function readPendingThemeChoice() {
244
244
  function clearPendingThemeChoice() {
245
245
  writeSharedCookie(THEME_PENDING_COOKIE, "", 0);
246
246
  }
247
- function resolveTheme(pref) {
248
- if (pref === "dark") return "dark";
249
- if (pref === "system") {
250
- try {
251
- if (typeof window !== "undefined" && typeof window.matchMedia === "function") {
252
- return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
253
- }
254
- } catch {
255
- }
256
- }
247
+ function resolveTheme(_pref) {
257
248
  return "light";
258
249
  }
259
250
  function applyThemePreference(pref) {
260
251
  if (typeof document === "undefined") return;
261
- const resolved = resolveTheme(pref);
252
+ const resolved = resolveTheme();
262
253
  const d = document.documentElement;
263
254
  d.classList.toggle("dark", resolved === "dark");
264
255
  try {
@@ -276,7 +267,7 @@ var ls=null;try{ls=localStorage.getItem(KEY);}catch(e){}
276
267
  var pref=cookie||ls||"system";
277
268
  if(VALID.indexOf(pref)===-1)pref="system";
278
269
  if(cookie&&cookie!==ls){try{localStorage.setItem(KEY,cookie);}catch(e){}}
279
- var dark=pref==="dark"||(pref==="system"&&!!(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches));
270
+ var dark=false;
280
271
  var d=document.documentElement;
281
272
  if(dark)d.classList.add("dark");else d.classList.remove("dark");
282
273
  try{d.setAttribute("data-theme",dark?"dark":"light");d.style.colorScheme=dark?"dark":"light";}catch(e){}
@@ -374,9 +365,7 @@ function TopBarWidgetSlot({
374
365
  ] });
375
366
  }
376
367
  var THEME_OPTIONS = [
377
- { value: "light", label: "Light" },
378
- { value: "system", label: "System" },
379
- { value: "dark", label: "Dark" }
368
+ { value: "light", label: "Light" }
380
369
  ];
381
370
  function NavThemeControl({
382
371
  value,
@@ -1504,7 +1493,7 @@ function currentChromeTheme() {
1504
1493
  const root = document.documentElement;
1505
1494
  if (root.classList.contains("dark") || root.getAttribute("data-theme") === "dark") return "dark";
1506
1495
  if (root.classList.contains("light") || root.getAttribute("data-theme") === "light") return "light";
1507
- return window.matchMedia?.("(prefers-color-scheme: dark)").matches ? "dark" : "light";
1496
+ return "light";
1508
1497
  }
1509
1498
  var SPEC_OVERLAY_ROOT_ATTR = "data-spec-overlay-root";
1510
1499
  async function captureMyView(status, orgId, orgName) {
@@ -1837,7 +1826,7 @@ function useThemePreference() {
1837
1826
  }
1838
1827
  const pref = cookie ?? (isThemePreference(ls) ? ls : null) ?? "system";
1839
1828
  setValueState(pref);
1840
- applyThemePreference(pref);
1829
+ applyThemePreference();
1841
1830
  }, []);
1842
1831
  const meCtx = react.useContext(NavChromeContext);
1843
1832
  react.useEffect(() => {
@@ -1846,7 +1835,7 @@ function useThemePreference() {
1846
1835
  if (pending) {
1847
1836
  if (meCtx?.me) reconciled.current = true;
1848
1837
  setValueState(pending);
1849
- applyThemePreference(pending);
1838
+ applyThemePreference();
1850
1839
  writeThemeCookie(pending);
1851
1840
  try {
1852
1841
  localStorage.setItem(THEME_STORAGE_KEY, pending);
@@ -1865,7 +1854,7 @@ function useThemePreference() {
1865
1854
  if (isThemePreference(pref)) {
1866
1855
  reconciled.current = true;
1867
1856
  setValueState(pref);
1868
- applyThemePreference(pref);
1857
+ applyThemePreference();
1869
1858
  writeThemeCookie(pref);
1870
1859
  try {
1871
1860
  localStorage.setItem(THEME_STORAGE_KEY, pref);
@@ -1884,7 +1873,7 @@ function useThemePreference() {
1884
1873
  const cookie = readThemeCookie();
1885
1874
  if (cookie) {
1886
1875
  setValueState((prev) => {
1887
- if (cookie !== prev) applyThemePreference(cookie);
1876
+ if (cookie !== prev) applyThemePreference();
1888
1877
  return cookie;
1889
1878
  });
1890
1879
  }
@@ -1898,22 +1887,10 @@ function useThemePreference() {
1898
1887
  document.removeEventListener("visibilitychange", onWake);
1899
1888
  };
1900
1889
  }, []);
1901
- react.useEffect(() => {
1902
- if (value !== "system") return;
1903
- let mq;
1904
- try {
1905
- mq = window.matchMedia("(prefers-color-scheme: dark)");
1906
- } catch {
1907
- return;
1908
- }
1909
- const onChange = () => applyThemePreference("system");
1910
- mq.addEventListener("change", onChange);
1911
- return () => mq.removeEventListener("change", onChange);
1912
- }, [value]);
1913
1890
  const setValue = react.useCallback(
1914
1891
  (next) => {
1915
1892
  setValueState(next);
1916
- applyThemePreference(next);
1893
+ applyThemePreference();
1917
1894
  writeThemeCookie(next);
1918
1895
  try {
1919
1896
  localStorage.setItem(THEME_STORAGE_KEY, next);