@companix/uikit 0.1.34 → 0.1.36

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.
@@ -6,6 +6,7 @@ export interface UseColorSchemeProps {
6
6
  }
7
7
  export declare const useTheme: () => UseColorSchemeProps;
8
8
  export interface ThemeProviderProps extends React.PropsWithChildren {
9
+ fixed?: BooleanConstructor;
9
10
  storageKey?: string;
10
11
  defaultColorScheme?: ColorSchemeExtendedType;
11
12
  }
@@ -1,6 +1,6 @@
1
- import { jsxs as b, jsx as r } from "react/jsx-runtime";
1
+ import { jsxs as b, jsx as i } from "react/jsx-runtime";
2
2
  import y from "classnames";
3
- import { useRef as F, useMemo as I, useState as i } from "react";
3
+ import { useRef as F, useMemo as I, useState as o } from "react";
4
4
  const C = (a) => {
5
5
  const {
6
6
  previewSrc: e,
@@ -12,19 +12,19 @@ const C = (a) => {
12
12
  enableAspectRatio: g,
13
13
  imgAttrs: p,
14
14
  ...f
15
- } = a, h = F(null), u = I(() => N(t, s), [t, s]), [o, v] = i(!1), [x, n] = i(!1), [w, c] = i(!1), $ = () => {
15
+ } = a, h = F(null), u = I(() => N(t, s), [t, s]), [r, v] = o(!1), [x, n] = o(!1), [w, c] = o(!1), $ = () => {
16
16
  x && (n(!1), c(!1));
17
17
  };
18
- return console.log({ isLoaded: o }), /* @__PURE__ */ b(
18
+ return /* @__PURE__ */ b(
19
19
  "div",
20
20
  {
21
- className: y("image-base", { "image-base-loading": !o }, m),
21
+ className: y("image-base", { "image-base-loading": !r }, m),
22
22
  style: g ? { aspectRatio: t / s } : {},
23
23
  onClickCapture: $,
24
24
  ...f,
25
25
  children: [
26
- !o && /* @__PURE__ */ r("img", { className: "image-base-placeholder", src: u, alt: "" }),
27
- e && e !== l && !o && !w && /* @__PURE__ */ r(
26
+ !r && /* @__PURE__ */ i("img", { className: "image-base-placeholder", src: u, alt: "" }),
27
+ e && e !== l && !r && !w && /* @__PURE__ */ i(
28
28
  "img",
29
29
  {
30
30
  className: "image-base-preview",
@@ -36,7 +36,7 @@ const C = (a) => {
36
36
  alt: ""
37
37
  }
38
38
  ),
39
- /* @__PURE__ */ r(
39
+ /* @__PURE__ */ i(
40
40
  "img",
41
41
  {
42
42
  ref: h,
@@ -1,14 +1,14 @@
1
- import { jsx as u } from "react/jsx-runtime";
2
- import { useState as h, useEffect as c, createContext as f, useContext as w } from "react";
3
- import { getColorScheme as v, updateDOM as m } from "./bundle.es81.js";
4
- const i = f({
1
+ import { jsx as h } from "react/jsx-runtime";
2
+ import { useState as f, useEffect as i, createContext as w, useContext as v } from "react";
3
+ import { getColorScheme as S, updateDOM as m } from "./bundle.es81.js";
4
+ const d = w({
5
5
  setColorScheme: () => {
6
6
  }
7
- }), y = () => w(i), p = (d) => {
8
- const { defaultColorScheme: o = "system", storageKey: n = "theme", children: l } = d, [r, a] = h(() => v(n, o)), s = (e) => {
9
- a(e), localStorage.setItem(n, e);
7
+ }), p = () => v(d), x = (u) => {
8
+ const { fixed: c, defaultColorScheme: o = "system", storageKey: n = "theme", children: l } = u, [r, a] = f(() => c ? o : S(n, o)), s = (e) => {
9
+ c || (a(e), localStorage.setItem(n, e));
10
10
  };
11
- return c(() => {
11
+ return i(() => {
12
12
  const e = window ? window.matchMedia("(prefers-color-scheme: dark)") : void 0;
13
13
  if (!e)
14
14
  return;
@@ -18,7 +18,7 @@ const i = f({
18
18
  return e.addEventListener?.("change", t), t(), () => {
19
19
  e.removeEventListener?.("change", t);
20
20
  };
21
- }, [r]), c(() => {
21
+ }, [r]), i(() => {
22
22
  if (!window)
23
23
  return;
24
24
  const e = (t) => {
@@ -27,11 +27,11 @@ const i = f({
27
27
  return window.addEventListener("storage", e), () => {
28
28
  window.removeEventListener("storage", e);
29
29
  };
30
- }, [s, o]), c(() => {
30
+ }, [s, o]), i(() => {
31
31
  m(r);
32
- }, [r]), /* @__PURE__ */ u(i.Provider, { value: { colorScheme: r, setColorScheme: s }, children: l });
32
+ }, [r]), /* @__PURE__ */ h(d.Provider, { value: { colorScheme: r, setColorScheme: s }, children: l });
33
33
  };
34
34
  export {
35
- p as ThemeProvider,
36
- y as useTheme
35
+ x as ThemeProvider,
36
+ p as useTheme
37
37
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@companix/uikit",
3
- "version": "0.1.34",
3
+ "version": "0.1.36",
4
4
  "main": "./dist/bundle.es.js",
5
5
  "module": "./dist/bundle.es.js",
6
6
  "types": "./dist/index.d.ts",