@weasel-js/labkit 1.0.0 → 1.0.2

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/index.js CHANGED
@@ -1,6 +1,6 @@
1
- export { LayerStack } from './chunk-HNXVLKBG.js';
2
- import { p, F } from './chunk-FP5LYDVX.js';
3
- import './chunk-XVBXYKFJ.js';
1
+ export { LayerStack } from './chunk-2ZRE7WGQ.js';
2
+ import { p, F } from './chunk-R4TACNW7.js';
3
+ import './chunk-3P56ZCCJ.js';
4
4
  import { Sidebar, StatusBar, Toolbar } from './chunk-HXZHVU4G.js';
5
5
  export { FpsMeter, ScaleIndicator, Sidebar, StatusBar, Toolbar } from './chunk-HXZHVU4G.js';
6
6
  import { LabStoreContext, createLabStore, noneAdapter } from './chunk-53XSBIUK.js';
@@ -15,8 +15,8 @@ export { LayerList } from './chunk-2QNYYL3V.js';
15
15
  import { createEventBus, redo, undo, pushSnapshot } from './chunk-7BKDG73Z.js';
16
16
  export { clearUndo, createEventBus, emptyStack, pushSnapshot, redo, undo } from './chunk-7BKDG73Z.js';
17
17
  import { createContext, useContext, useMemo, useRef, useState, Children, useEffect, useCallback, useLayoutEffect } from 'react';
18
- import { useStore } from 'zustand/react';
19
18
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
19
+ import { useStore } from 'zustand/react';
20
20
  import { createPortal } from 'react-dom';
21
21
 
22
22
  // src/instrument/capabilityDetector.ts
@@ -815,24 +815,6 @@ var interstellar_tokens_default = {
815
815
 
816
816
  // src/theme/interstellar.ts
817
817
  var interstellarTheme = loadDTCG(interstellar_tokens_default);
818
- function query() {
819
- if (typeof window === "undefined" || !window.matchMedia) return null;
820
- return window.matchMedia("(prefers-color-scheme: light)");
821
- }
822
- function useResolvedMode(mode) {
823
- const [system, setSystem] = useState(
824
- () => query()?.matches ? "light" : "dark"
825
- );
826
- useEffect(() => {
827
- if (mode !== "auto") return;
828
- const mq = query();
829
- if (!mq) return;
830
- const onChange = (e) => setSystem(e.matches ? "light" : "dark");
831
- mq.addEventListener("change", onChange);
832
- return () => mq.removeEventListener("change", onChange);
833
- }, [mode]);
834
- return mode === "auto" ? system : mode;
835
- }
836
818
  function DragGhost({ item, screenPos }) {
837
819
  const [mounted, setMounted] = useState(false);
838
820
  useEffect(() => setMounted(true), []);
@@ -1408,6 +1390,24 @@ function resetWorkspace(workspaces, id, instruments) {
1408
1390
  };
1409
1391
  return [...workspaces.slice(0, idx), reset, ...workspaces.slice(idx + 1)];
1410
1392
  }
1393
+ function query() {
1394
+ if (typeof window === "undefined" || !window.matchMedia) return null;
1395
+ return window.matchMedia("(prefers-color-scheme: light)");
1396
+ }
1397
+ function useResolvedMode(mode) {
1398
+ const [system, setSystem] = useState(
1399
+ () => query()?.matches ? "light" : "dark"
1400
+ );
1401
+ useEffect(() => {
1402
+ if (mode !== "auto") return;
1403
+ const mq = query();
1404
+ if (!mq) return;
1405
+ const onChange = (e) => setSystem(e.matches ? "light" : "dark");
1406
+ mq.addEventListener("change", onChange);
1407
+ return () => mq.removeEventListener("change", onChange);
1408
+ }, [mode]);
1409
+ return mode === "auto" ? system : mode;
1410
+ }
1411
1411
  function LabShell({ title, children, header, footer, mode = "auto" }) {
1412
1412
  const resolved = useResolvedMode(mode);
1413
1413
  const outer = useThemeOptional();