quirk-ui 0.0.582 → 0.0.583

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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../../assets/index66.css');const c=require("react/jsx-runtime"),u=require("react"),f=require("../../tokens/theme.cjs");function s(e,r=""){const n={};for(const t in e)typeof e[t]=="object"&&e[t]!==null?Object.assign(n,s(e[t],`${r}${t}.`)):n[`${r}${t}`]=e[t];return n}function l(e){return`--color-${e.replace(/\./g,"-")}`}function a({children:e,theme:r=f.defaultTheme}){return u.useEffect(()=>{if(typeof window>"u")return;const n=document.documentElement,t=s(r);Object.entries(t).forEach(([i,o])=>{typeof o=="string"&&n.style.setProperty(l(i),o)}),n.setAttribute("data-theme",r.mode||"light")},[r]),c.jsx(c.Fragment,{children:e})}exports.ThemeProvider=a;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../../assets/index66.css');const i=require("react/jsx-runtime"),l=require("react"),d=require("../../tokens/theme.cjs");function a(e,t){return t.split(".").reduce((r,n)=>{if(r&&typeof r=="object")return r[n]},e)}function c(e,t="",r){const n={},u=r??e;for(const o in e){const s=e[o];if(typeof s=="object"&&s!==null)Object.assign(n,c(e[o],`${t}${o}.`,u));else if(typeof s=="string"&&s.includes(".")){const f=a(u,s);n[`${t}${o}`]=f??s}else n[`${t}${o}`]=s}return n}function m(e){return`--color-${e.replace(/\./g,"-")}`}function y({children:e,theme:t=d.defaultTheme}){return l.useEffect(()=>{if(typeof window>"u")return;const r=document.documentElement,n=c(t);Object.entries(n).forEach(([u,o])=>{typeof o=="string"&&r.style.setProperty(m(u),o)}),r.setAttribute("data-theme",t.mode||"light")},[t]),i.jsx(i.Fragment,{children:e})}exports.ThemeProvider=y;
@@ -1,27 +1,41 @@
1
- import { jsx as s, Fragment as c } from "react/jsx-runtime";
1
+ import { jsx as c, Fragment as l } from "react/jsx-runtime";
2
2
  import { useEffect as m } from "react";
3
- import { defaultTheme as u } from "../../tokens/theme.mjs";
4
- import '../../../assets/index66.css';function f(t, r = "") {
5
- const n = {};
6
- for (const e in t)
7
- typeof t[e] == "object" && t[e] !== null ? Object.assign(n, f(t[e], `${r}${e}.`)) : n[`${r}${e}`] = t[e];
8
- return n;
3
+ import { defaultTheme as d } from "../../tokens/theme.mjs";
4
+ import '../../../assets/index66.css';function a(e, t) {
5
+ return t.split(".").reduce((o, r) => {
6
+ if (o && typeof o == "object")
7
+ return o[r];
8
+ }, e);
9
9
  }
10
- function l(t) {
11
- return `--color-${t.replace(/\./g, "-")}`;
10
+ function i(e, t = "", o) {
11
+ const r = {}, f = o ?? e;
12
+ for (const n in e) {
13
+ const s = e[n];
14
+ if (typeof s == "object" && s !== null)
15
+ Object.assign(r, i(e[n], `${t}${n}.`, f));
16
+ else if (typeof s == "string" && s.includes(".")) {
17
+ const u = a(f, s);
18
+ r[`${t}${n}`] = u ?? s;
19
+ } else
20
+ r[`${t}${n}`] = s;
21
+ }
22
+ return r;
12
23
  }
13
- function y({
14
- children: t,
15
- theme: r = u
24
+ function p(e) {
25
+ return `--color-${e.replace(/\./g, "-")}`;
26
+ }
27
+ function h({
28
+ children: e,
29
+ theme: t = d
16
30
  }) {
17
31
  return m(() => {
18
32
  if (typeof window > "u") return;
19
- const n = document.documentElement, e = f(r);
20
- Object.entries(e).forEach(([i, o]) => {
21
- typeof o == "string" && n.style.setProperty(l(i), o);
22
- }), n.setAttribute("data-theme", r.mode || "light");
23
- }, [r]), /* @__PURE__ */ s(c, { children: t });
33
+ const o = document.documentElement, r = i(t);
34
+ Object.entries(r).forEach(([f, n]) => {
35
+ typeof n == "string" && o.style.setProperty(p(f), n);
36
+ }), o.setAttribute("data-theme", t.mode || "light");
37
+ }, [t]), /* @__PURE__ */ c(l, { children: e });
24
38
  }
25
39
  export {
26
- y as ThemeProvider
40
+ h as ThemeProvider
27
41
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "quirk-ui",
3
3
  "private": false,
4
- "version": "0.0.582",
4
+ "version": "0.0.583",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": {