@arcanejs/toolkit 4.1.0 → 5.0.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.
@@ -24524,7 +24524,7 @@
24524
24524
  }
24525
24525
  });
24526
24526
 
24527
- // ../toolkit-frontend/dist/chunk-E7JSREGM.mjs
24527
+ // ../toolkit-frontend/dist/chunk-PTANIWKR.mjs
24528
24528
  var import_react = __toESM(require_react(), 1);
24529
24529
  var import_react2 = __toESM(require_react(), 1);
24530
24530
  var __defProp2 = Object.defineProperty;
@@ -25947,7 +25947,7 @@
25947
25947
  var St = "__sc-".concat(f, "__");
25948
25948
  "undefined" != typeof window && (window[St] || (window[St] = 0), 1 === window[St] && console.warn("It looks like there are several instances of 'styled-components' initialized in this application. This may cause dynamic styles to not render properly, errors during the rehydration process, a missing theme prop, and makes your application bigger without good reason.\n\nSee https://s-c.sh/2BAXzed for more info."), window[St] += 1);
25949
25949
 
25950
- // ../toolkit-frontend/dist/chunk-MESQQRK3.mjs
25950
+ // ../toolkit-frontend/dist/chunk-GMPDVDSW.mjs
25951
25951
  var import_jsx_runtime = __toESM(require_jsx_runtime(), 1);
25952
25952
  var core_exports = {};
25953
25953
  __export(core_exports, {
@@ -25982,7 +25982,7 @@
25982
25982
  `;
25983
25983
  var TRANSPARENCY_SVG_URI = `data:image/svg+xml,${encodeURIComponent(TRANSPARENCY_SVG)}`;
25984
25984
 
25985
- // ../toolkit-frontend/dist/chunk-BQS6YM6U.mjs
25985
+ // ../toolkit-frontend/dist/chunk-6XOE7F7U.mjs
25986
25986
  var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1);
25987
25987
  var GlobalStyle = ft`
25988
25988
  body {
@@ -27263,7 +27263,57 @@ body {
27263
27263
  var import_react13 = __toESM(require_react());
27264
27264
 
27265
27265
  // ../toolkit-frontend/src/util/index.ts
27266
+ var COLOR_SCHEME_SETTINGS = "arcane-color-scheme-preference";
27267
+ var VALID_COLOR_SCHEME_PREFS2 = ["auto", "dark", "light"];
27268
+ var isValidColorSchemePreference = (value) => {
27269
+ return VALID_COLOR_SCHEME_PREFS2.includes(value);
27270
+ };
27271
+ var useColorSchemePreferences2 = () => {
27272
+ if (typeof window === "undefined") {
27273
+ return {
27274
+ colorSchemePreference: "auto",
27275
+ setColorSchemePreference: () => {
27276
+ }
27277
+ };
27278
+ }
27279
+ const [preference, setPreference] = (0, import_react14.useState)(
27280
+ window.localStorage.getItem(
27281
+ COLOR_SCHEME_SETTINGS
27282
+ ) || "auto"
27283
+ );
27284
+ const setColorSchemePreference = (newPreference) => {
27285
+ if (!isValidColorSchemePreference(newPreference)) {
27286
+ throw new Error(`Invalid color scheme preference: ${newPreference}`);
27287
+ }
27288
+ window.localStorage.setItem(COLOR_SCHEME_SETTINGS, newPreference);
27289
+ window.dispatchEvent(
27290
+ new StorageEvent("storage", {
27291
+ key: COLOR_SCHEME_SETTINGS,
27292
+ newValue: newPreference
27293
+ })
27294
+ );
27295
+ };
27296
+ (0, import_react14.useEffect)(() => {
27297
+ const onStorageChange = (event) => {
27298
+ if (event.key === COLOR_SCHEME_SETTINGS) {
27299
+ const newValue = event.newValue;
27300
+ if (isValidColorSchemePreference(newValue)) {
27301
+ setPreference(newValue);
27302
+ }
27303
+ }
27304
+ };
27305
+ window.addEventListener("storage", onStorageChange);
27306
+ return () => {
27307
+ window.removeEventListener("storage", onStorageChange);
27308
+ };
27309
+ }, []);
27310
+ return {
27311
+ colorSchemePreference: isValidColorSchemePreference(preference) ? preference : "auto",
27312
+ setColorSchemePreference
27313
+ };
27314
+ };
27266
27315
  var usePreferredColorScheme2 = () => {
27316
+ const { colorSchemePreference } = useColorSchemePreferences2();
27267
27317
  const [theme, setTheme] = (0, import_react14.useState)("light");
27268
27318
  (0, import_react14.useEffect)(() => {
27269
27319
  if (typeof window !== "undefined") {
@@ -27278,7 +27328,7 @@ body {
27278
27328
  };
27279
27329
  }
27280
27330
  }, []);
27281
- return theme;
27331
+ return colorSchemePreference === "auto" ? theme : colorSchemePreference;
27282
27332
  };
27283
27333
 
27284
27334
  // ../toolkit-frontend/src/styling.tsx