@the-portland-company/shell 0.72.1 → 0.73.1

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) {
@@ -1624,7 +1613,10 @@ function SpecOverlayAction({ orgId, orgName } = {}) {
1624
1613
  for (let i = 0; i < 45; i++) {
1625
1614
  await new Promise((r) => setTimeout(r, 3e3));
1626
1615
  if (run !== captureRun.current) return;
1627
- if (!accessRef.current?.allowed) return;
1616
+ if (!accessRef.current?.allowed) {
1617
+ setCapture({ state: "idle" });
1618
+ return;
1619
+ }
1628
1620
  const next = await specOverlayFetchJson(specOverlayStatusPath()).catch(() => null);
1629
1621
  if (next && next.matched && next.live_source === "viewer" && next.finished_at !== before) {
1630
1622
  setStatus(next);
@@ -1837,7 +1829,7 @@ function useThemePreference() {
1837
1829
  }
1838
1830
  const pref = cookie ?? (isThemePreference(ls) ? ls : null) ?? "system";
1839
1831
  setValueState(pref);
1840
- applyThemePreference(pref);
1832
+ applyThemePreference();
1841
1833
  }, []);
1842
1834
  const meCtx = react.useContext(NavChromeContext);
1843
1835
  react.useEffect(() => {
@@ -1846,7 +1838,7 @@ function useThemePreference() {
1846
1838
  if (pending) {
1847
1839
  if (meCtx?.me) reconciled.current = true;
1848
1840
  setValueState(pending);
1849
- applyThemePreference(pending);
1841
+ applyThemePreference();
1850
1842
  writeThemeCookie(pending);
1851
1843
  try {
1852
1844
  localStorage.setItem(THEME_STORAGE_KEY, pending);
@@ -1865,7 +1857,7 @@ function useThemePreference() {
1865
1857
  if (isThemePreference(pref)) {
1866
1858
  reconciled.current = true;
1867
1859
  setValueState(pref);
1868
- applyThemePreference(pref);
1860
+ applyThemePreference();
1869
1861
  writeThemeCookie(pref);
1870
1862
  try {
1871
1863
  localStorage.setItem(THEME_STORAGE_KEY, pref);
@@ -1884,7 +1876,7 @@ function useThemePreference() {
1884
1876
  const cookie = readThemeCookie();
1885
1877
  if (cookie) {
1886
1878
  setValueState((prev) => {
1887
- if (cookie !== prev) applyThemePreference(cookie);
1879
+ if (cookie !== prev) applyThemePreference();
1888
1880
  return cookie;
1889
1881
  });
1890
1882
  }
@@ -1898,22 +1890,10 @@ function useThemePreference() {
1898
1890
  document.removeEventListener("visibilitychange", onWake);
1899
1891
  };
1900
1892
  }, []);
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
1893
  const setValue = react.useCallback(
1914
1894
  (next) => {
1915
1895
  setValueState(next);
1916
- applyThemePreference(next);
1896
+ applyThemePreference();
1917
1897
  writeThemeCookie(next);
1918
1898
  try {
1919
1899
  localStorage.setItem(THEME_STORAGE_KEY, next);