@hairy/react-lib 1.29.0 → 1.33.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.
package/dist/index.cjs CHANGED
@@ -276,7 +276,7 @@ function Switch(props) {
276
276
  if (!(0, import_react3.isValidElement)(child) || matchingCase)
277
277
  return;
278
278
  if (child.type === Case) {
279
- const cond = child.props.cond;
279
+ const cond = child?.props?.cond;
280
280
  if (isUseValue ? props.value === cond : cond) {
281
281
  matchingCase = child;
282
282
  return;
@@ -465,7 +465,7 @@ var import_mitt = __toESM(require("mitt"), 1);
465
465
  var import_react16 = require("react");
466
466
  var emitter = (0, import_mitt.default)();
467
467
  function useEventBus(key) {
468
- const onRef = (0, import_react16.useRef)();
468
+ const onRef = (0, import_react16.useRef)(void 0);
469
469
  function on(listener) {
470
470
  emitter.on(key, listener);
471
471
  onRef.current = listener;
@@ -491,14 +491,14 @@ function useEventBus(key) {
491
491
  };
492
492
  }
493
493
 
494
- // ../../node_modules/.pnpm/react-use@17.6.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/react-use/esm/useEffectOnce.js
494
+ // ../../node_modules/.pnpm/react-use@17.6.0_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/react-use/esm/useEffectOnce.js
495
495
  var import_react17 = require("react");
496
496
  var useEffectOnce = function(effect) {
497
497
  (0, import_react17.useEffect)(effect, []);
498
498
  };
499
499
  var useEffectOnce_default = useEffectOnce;
500
500
 
501
- // ../../node_modules/.pnpm/react-use@17.6.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/react-use/esm/useMount.js
501
+ // ../../node_modules/.pnpm/react-use@17.6.0_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/react-use/esm/useMount.js
502
502
  var useMount = function(fn) {
503
503
  useEffectOnce_default(function() {
504
504
  fn();
@@ -518,7 +518,7 @@ function fetchResponseIntercept(intercept) {
518
518
  window.fetch = async (...args) => {
519
519
  const [resource, config] = args;
520
520
  const response = await originalFetch(resource, config);
521
- return intercept(response);
521
+ return intercept(response, config);
522
522
  };
523
523
  }
524
524
  function fetchRequestIntercept(intercept) {
@@ -541,7 +541,7 @@ function useMounted() {
541
541
  var import_react19 = require("react");
542
542
  function useWatch(source, callback, options = {}) {
543
543
  const firstUpdate = (0, import_react19.useRef)(false);
544
- const then = (0, import_react19.useRef)();
544
+ const then = (0, import_react19.useRef)(void 0);
545
545
  const deps = (0, import_react19.useMemo)(
546
546
  () => Array.isArray(source) ? source : [source],
547
547
  [source]
package/dist/index.d.ts CHANGED
@@ -62,7 +62,7 @@ declare function Else<Tag extends WrapperTag>(props: ElseProps<Tag>): react.Reac
62
62
  interface SwitchProps extends PropsWithChildren {
63
63
  value?: BooleanLike;
64
64
  }
65
- declare function Switch(props: SwitchProps): ReactElement<any, string | react.JSXElementConstructor<any>> | null;
65
+ declare function Switch(props: SwitchProps): ReactElement<unknown, string | react.JSXElementConstructor<any>> | null;
66
66
 
67
67
  type ThenProps<Tag> = IfProps<Tag>;
68
68
  declare function Then<Tag extends WrapperTag>(props: ThenProps<Tag>): react.ReactNode;
@@ -115,7 +115,7 @@ declare function Trigger(): ReactNode[];
115
115
  declare namespace Trigger {
116
116
  var id: number;
117
117
  var tasks: Map<number, Exposer> & {
118
- $$valtioSnapshot: Omit<Map<number, Exposer>, "set" | "delete" | "clear">;
118
+ $$valtioSnapshot: Omit<Map<number, Exposer>, "clear" | "set" | "delete">;
119
119
  };
120
120
  }
121
121
 
@@ -181,7 +181,7 @@ declare function useEventBus<T>(key: string): {
181
181
  };
182
182
 
183
183
  interface FetchResponseInterceptCallback {
184
- (response: Response): Response | Promise<Response>;
184
+ (response: Response, init: RequestInit | undefined): Response | Promise<Response>;
185
185
  }
186
186
  interface FetchRequestInterceptCallback {
187
187
  (fetch: typeof window.fetch, input: RequestInfo | URL, init?: RequestInit | undefined): Response | Promise<Response>;
@@ -439,7 +439,7 @@ var LibReact = (() => {
439
439
  return list;
440
440
  };
441
441
 
442
- // ../../node_modules/.pnpm/valtio@2.1.4_@types+react@18.3.18_react@18.3.1/node_modules/valtio/esm/vanilla.mjs
442
+ // ../../node_modules/.pnpm/valtio@2.1.4_@types+react@19.1.6_react@19.1.0/node_modules/valtio/esm/vanilla.mjs
443
443
  var import_meta = {};
444
444
  var isObject3 = (x) => typeof x === "object" && x !== null;
445
445
  var canProxyDefault = (x) => isObject3(x) && !refSet.has(x) && (Array.isArray(x) || !(Symbol.iterator in x)) && !(x instanceof WeakMap) && !(x instanceof WeakSet) && !(x instanceof Error) && !(x instanceof Number) && !(x instanceof Date) && !(x instanceof String) && !(x instanceof RegExp) && !(x instanceof ArrayBuffer) && !(x instanceof Promise);
@@ -673,7 +673,7 @@ var LibReact = (() => {
673
673
  };
674
674
  }
675
675
 
676
- // ../../node_modules/.pnpm/valtio@2.1.4_@types+react@18.3.18_react@18.3.1/node_modules/valtio/esm/react.mjs
676
+ // ../../node_modules/.pnpm/valtio@2.1.4_@types+react@19.1.6_react@19.1.0/node_modules/valtio/esm/react.mjs
677
677
  var import_react = __toESM(require_react(), 1);
678
678
  var import_meta2 = {};
679
679
  var useAffectedDebugValue = (state, affected) => {
@@ -792,7 +792,7 @@ var LibReact = (() => {
792
792
  if (!(0, import_react4.isValidElement)(child) || matchingCase)
793
793
  return;
794
794
  if (child.type === Case) {
795
- const cond = child.props.cond;
795
+ const cond = child?.props?.cond;
796
796
  if (isUseValue ? props.value === cond : cond) {
797
797
  matchingCase = child;
798
798
  return;
@@ -834,7 +834,7 @@ var LibReact = (() => {
834
834
  // src/components/utils/Trigger.ts
835
835
  var import_react7 = __toESM(require_react(), 1);
836
836
 
837
- // ../../node_modules/.pnpm/valtio@2.1.4_@types+react@18.3.18_react@18.3.1/node_modules/valtio/esm/vanilla/utils.mjs
837
+ // ../../node_modules/.pnpm/valtio@2.1.4_@types+react@19.1.6_react@19.1.0/node_modules/valtio/esm/vanilla/utils.mjs
838
838
  var currentCleanups;
839
839
  function watch(callback, options) {
840
840
  let alive = true;
@@ -1195,7 +1195,7 @@ var LibReact = (() => {
1195
1195
  var import_react17 = __toESM(require_react(), 1);
1196
1196
  var emitter = mitt_default();
1197
1197
  function useEventBus(key) {
1198
- const onRef = (0, import_react17.useRef)();
1198
+ const onRef = (0, import_react17.useRef)(void 0);
1199
1199
  function on(listener) {
1200
1200
  emitter.on(key, listener);
1201
1201
  onRef.current = listener;
@@ -1221,14 +1221,14 @@ var LibReact = (() => {
1221
1221
  };
1222
1222
  }
1223
1223
 
1224
- // ../../node_modules/.pnpm/react-use@17.6.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/react-use/esm/useEffectOnce.js
1224
+ // ../../node_modules/.pnpm/react-use@17.6.0_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/react-use/esm/useEffectOnce.js
1225
1225
  var import_react18 = __toESM(require_react());
1226
1226
  var useEffectOnce = function(effect) {
1227
1227
  (0, import_react18.useEffect)(effect, []);
1228
1228
  };
1229
1229
  var useEffectOnce_default = useEffectOnce;
1230
1230
 
1231
- // ../../node_modules/.pnpm/react-use@17.6.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/react-use/esm/useMount.js
1231
+ // ../../node_modules/.pnpm/react-use@17.6.0_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/react-use/esm/useMount.js
1232
1232
  var useMount = function(fn) {
1233
1233
  useEffectOnce_default(function() {
1234
1234
  fn();
@@ -1248,7 +1248,7 @@ var LibReact = (() => {
1248
1248
  window.fetch = async (...args) => {
1249
1249
  const [resource, config] = args;
1250
1250
  const response = await originalFetch(resource, config);
1251
- return intercept(response);
1251
+ return intercept(response, config);
1252
1252
  };
1253
1253
  }
1254
1254
  function fetchRequestIntercept(intercept) {
@@ -1271,7 +1271,7 @@ var LibReact = (() => {
1271
1271
  var import_react20 = __toESM(require_react(), 1);
1272
1272
  function useWatch(source, callback, options = {}) {
1273
1273
  const firstUpdate = (0, import_react20.useRef)(false);
1274
- const then = (0, import_react20.useRef)();
1274
+ const then = (0, import_react20.useRef)(void 0);
1275
1275
  const deps = (0, import_react20.useMemo)(
1276
1276
  () => Array.isArray(source) ? source : [source],
1277
1277
  [source]
package/dist/index.js CHANGED
@@ -207,7 +207,7 @@ function Switch(props) {
207
207
  if (!isValidElement(child) || matchingCase)
208
208
  return;
209
209
  if (child.type === Case) {
210
- const cond = child.props.cond;
210
+ const cond = child?.props?.cond;
211
211
  if (isUseValue ? props.value === cond : cond) {
212
212
  matchingCase = child;
213
213
  return;
@@ -396,7 +396,7 @@ import mitt from "mitt";
396
396
  import { useEffect as useEffect4, useRef as useRef2 } from "react";
397
397
  var emitter = mitt();
398
398
  function useEventBus(key) {
399
- const onRef = useRef2();
399
+ const onRef = useRef2(void 0);
400
400
  function on(listener) {
401
401
  emitter.on(key, listener);
402
402
  onRef.current = listener;
@@ -422,14 +422,14 @@ function useEventBus(key) {
422
422
  };
423
423
  }
424
424
 
425
- // ../../node_modules/.pnpm/react-use@17.6.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/react-use/esm/useEffectOnce.js
425
+ // ../../node_modules/.pnpm/react-use@17.6.0_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/react-use/esm/useEffectOnce.js
426
426
  import { useEffect as useEffect5 } from "react";
427
427
  var useEffectOnce = function(effect) {
428
428
  useEffect5(effect, []);
429
429
  };
430
430
  var useEffectOnce_default = useEffectOnce;
431
431
 
432
- // ../../node_modules/.pnpm/react-use@17.6.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/react-use/esm/useMount.js
432
+ // ../../node_modules/.pnpm/react-use@17.6.0_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/react-use/esm/useMount.js
433
433
  var useMount = function(fn) {
434
434
  useEffectOnce_default(function() {
435
435
  fn();
@@ -449,7 +449,7 @@ function fetchResponseIntercept(intercept) {
449
449
  window.fetch = async (...args) => {
450
450
  const [resource, config] = args;
451
451
  const response = await originalFetch(resource, config);
452
- return intercept(response);
452
+ return intercept(response, config);
453
453
  };
454
454
  }
455
455
  function fetchRequestIntercept(intercept) {
@@ -472,7 +472,7 @@ function useMounted() {
472
472
  import { useEffect as useEffect7, useMemo as useMemo2, useRef as useRef3 } from "react";
473
473
  function useWatch(source, callback, options = {}) {
474
474
  const firstUpdate = useRef3(false);
475
- const then = useRef3();
475
+ const then = useRef3(void 0);
476
476
  const deps = useMemo2(
477
477
  () => Array.isArray(source) ? source : [source],
478
478
  [source]
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hairy/react-lib",
3
3
  "type": "module",
4
- "version": "1.29.0",
4
+ "version": "1.33.0",
5
5
  "description": "Library for react",
6
6
  "author": "Hairyf <wwu710632@gmail.com>",
7
7
  "license": "MIT",
@@ -32,13 +32,13 @@
32
32
  "valtio": "^2"
33
33
  },
34
34
  "devDependencies": {
35
- "@types/react": "^18.2.43",
36
- "@types/react-dom": "^18.2.17",
37
- "react": "^18.2.0",
38
- "react-dom": "^18.2.0",
35
+ "@types/react": "^19.1.3",
36
+ "@types/react-dom": "^19.1.3",
37
+ "react": "^19.1.0",
38
+ "react-dom": "^19.1.0",
39
39
  "react-i18next": "^14.1.2",
40
40
  "react-use": "^17.6.0",
41
- "@hairy/utils": "1.29.0"
41
+ "@hairy/utils": "1.33.0"
42
42
  },
43
43
  "scripts": {
44
44
  "build": "tsup",