@v1ct0rbr/minivault-web 0.1.0 → 0.2.0

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.
@@ -1760,28 +1760,47 @@ function X() {
1760
1760
  ] });
1761
1761
  }
1762
1762
  //#endregion
1763
+ //#region src/hooks/useAutoTheme.ts
1764
+ function Z() {
1765
+ return typeof document < "u" && document.documentElement.classList.contains("dark");
1766
+ }
1767
+ function Q(e) {
1768
+ let [t, n] = o(Z), [i, a] = o(() => typeof window < "u" && window.matchMedia?.("(prefers-color-scheme: dark)")?.matches === !0);
1769
+ return r(() => {
1770
+ let e = document.documentElement, t = new MutationObserver(() => n(Z()));
1771
+ return t.observe(e, {
1772
+ attributes: !0,
1773
+ attributeFilter: ["class"]
1774
+ }), () => t.disconnect();
1775
+ }, []), r(() => {
1776
+ if (typeof window > "u" || !window.matchMedia) return;
1777
+ let e = window.matchMedia("(prefers-color-scheme: dark)"), t = (e) => a(e.matches);
1778
+ return e.addEventListener("change", t), () => e.removeEventListener("change", t);
1779
+ }, []), e || (t || i ? "dark" : "light");
1780
+ }
1781
+ //#endregion
1763
1782
  //#region src/components/MinivaultModule.tsx
1764
- function Z(e) {
1765
- let { companyAcronym: t = "Minivault", theme: n = "light", refetchIntervalMs: r = 15e3, storageType: i = "LOCAL", ...a } = e, [l] = o(() => new s({ defaultOptions: { queries: {
1783
+ function $(e) {
1784
+ let { companyAcronym: t = "Minivault", theme: n, refetchIntervalMs: r = 15e3, storageType: i = "LOCAL", ...a } = e, l = Q(n), [u] = o(() => new s({ defaultOptions: { queries: {
1766
1785
  refetchInterval: r,
1767
1786
  retry: 1
1768
1787
  } } }));
1769
1788
  return /* @__PURE__ */ p(c, {
1770
- client: l,
1789
+ client: u,
1771
1790
  children: /* @__PURE__ */ p(y, {
1772
1791
  ...a,
1773
1792
  children: /* @__PURE__ */ m("div", {
1774
- className: "minivault-module h-100 w-100 overflow-auto",
1775
- "data-minivault-theme": n,
1776
- children: [/* @__PURE__ */ p(Q, {
1793
+ className: "minivault-module h-full w-full overflow-auto",
1794
+ "data-minivault-theme": l,
1795
+ children: [/* @__PURE__ */ p(ee, {
1777
1796
  companyAcronym: t,
1778
- theme: n
1779
- }), /* @__PURE__ */ p($, { storageType: i })]
1797
+ theme: l
1798
+ }), /* @__PURE__ */ p(te, { storageType: i })]
1780
1799
  })
1781
1800
  })
1782
1801
  });
1783
1802
  }
1784
- function Q({ companyAcronym: e, theme: t }) {
1803
+ function ee({ companyAcronym: e, theme: t }) {
1785
1804
  return /* @__PURE__ */ m("div", {
1786
1805
  className: "d-flex align-items-center justify-content-between flex-wrap gap-2 px-3 py-2 border-bottom",
1787
1806
  style: {
@@ -1810,7 +1829,7 @@ function Q({ companyAcronym: e, theme: t }) {
1810
1829
  })]
1811
1830
  });
1812
1831
  }
1813
- function $({ storageType: e }) {
1832
+ function te({ storageType: e }) {
1814
1833
  let [t, n] = o("backups");
1815
1834
  return /* @__PURE__ */ m("div", {
1816
1835
  className: "p-3",
@@ -1876,4 +1895,4 @@ function $({ storageType: e }) {
1876
1895
  });
1877
1896
  }
1878
1897
  //#endregion
1879
- export { G as BackupsTab, J as CreateBackupTab, H as CredentialsFields, L as DATABASE_TYPE_LABELS, X as ImportDumpTab, g as MinivaultApi, h as MinivaultApiError, y as MinivaultApiProvider, Z as MinivaultModule, U as RestoreModal, I as STATUS_BADGE, F as STATUS_LABELS, R as StatusBadge, Y as StorageExplorerTab, P as formatDate, N as formatFileSize, C as useBackups, w as useCreateBackup, E as useDeleteBackup, O as useDownloadBackup, k as useImportDump, A as useImportFromStorage, b as useMinivaultApi, T as useRestoreBackup };
1898
+ export { G as BackupsTab, J as CreateBackupTab, H as CredentialsFields, L as DATABASE_TYPE_LABELS, X as ImportDumpTab, g as MinivaultApi, h as MinivaultApiError, y as MinivaultApiProvider, $ as MinivaultModule, U as RestoreModal, I as STATUS_BADGE, F as STATUS_LABELS, R as StatusBadge, Y as StorageExplorerTab, P as formatDate, N as formatFileSize, C as useBackups, w as useCreateBackup, E as useDeleteBackup, O as useDownloadBackup, k as useImportDump, A as useImportFromStorage, b as useMinivaultApi, T as useRestoreBackup };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@v1ct0rbr/minivault-web",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Módulo independente de gerenciamento de backups (minivault). Consumível como pacote npm em qualquer app React. Cliente do minivault REST API (acesso tipicamente via proxy autenticado).",
5
5
  "author": "Victor Queiroga (https://www.linkedin.com/in/victor-queiroga)",
6
6
  "license": "MIT",