@imfusion/web-ui 0.6.4-dev.23.gc1cc4132 → 0.6.4-dev.29.g527b8ff6

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
@@ -1927,10 +1927,13 @@ function Zi({ value: e } = {}) {
1927
1927
  document.documentElement.setAttribute(W.colorScheme.attr, i), o(i);
1928
1928
  return;
1929
1929
  }
1930
- document.documentElement.removeAttribute(W.colorScheme.attr), o(Ji());
1931
- let e = window.matchMedia("(prefers-color-scheme: dark)"), t = (e) => o(e.matches ? "dark" : "light");
1932
- return e.addEventListener("change", t), function() {
1933
- e.removeEventListener("change", t);
1930
+ let e = window.matchMedia("(prefers-color-scheme: dark)"), t = (e) => {
1931
+ document.documentElement.setAttribute(W.colorScheme.attr, e), o(e);
1932
+ };
1933
+ t(Ji());
1934
+ let n = (e) => t(e.matches ? "dark" : "light");
1935
+ return e.addEventListener("change", n), function() {
1936
+ e.removeEventListener("change", n);
1934
1937
  };
1935
1938
  }, [i]);
1936
1939
  function s(e) {
@@ -2891,8 +2894,8 @@ function Vo({ children: e, value: t }) {
2891
2894
  Vo.displayName = "IconConfig.Provider";
2892
2895
  //#endregion
2893
2896
  //#region src/provider/web-ui-provider.tsx
2894
- function Ho({ children: e, icons: t }) {
2895
- return /* @__PURE__ */ _(Vo, {
2897
+ function Ho({ children: e, icons: t, colorScheme: n }) {
2898
+ return Zi({ value: n }), /* @__PURE__ */ _(Vo, {
2896
2899
  value: t,
2897
2900
  children: /* @__PURE__ */ v(Ja, { children: [e, " "] })
2898
2901
  });
@@ -1,9 +1,12 @@
1
1
  import { ReactNode } from 'react';
2
+ import { ColorSchemePreference } from '../types/theme';
2
3
  import * as IconConfig from '../icons/icon-config';
3
4
  interface Props {
4
5
  children: ReactNode;
5
6
  /** SVG defaults for icons in this provider's subtree; omitted fields use the defaults from icon-config.tsx. */
6
7
  icons?: React.ComponentProps<typeof IconConfig.Provider>["value"];
8
+ /** Color scheme preference; omit to follow the OS and persist a choice in localStorage. A value pins the scheme and bypasses localStorage. */
9
+ colorScheme?: ColorSchemePreference;
7
10
  }
8
- export declare function WebUIProvider({ children, icons }: Props): import("react/jsx-runtime").JSX.Element;
11
+ export declare function WebUIProvider({ children, icons, colorScheme }: Props): import("react/jsx-runtime").JSX.Element;
9
12
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@imfusion/web-ui",
3
- "version": "0.6.4-dev.23.gc1cc4132",
3
+ "version": "0.6.4-dev.29.g527b8ff6",
4
4
  "description": "The official Web UI component library for ImFusion web apps",
5
5
  "author": "ImFusion GmbH",
6
6
  "homepage": "https://imfusion.com",