@elice/material-shared-utils 1.260128.0-rc.0 → 1.260129.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.
Files changed (46) hide show
  1. package/cjs/hooks/useHelpyLogo.js +2 -2
  2. package/es/hooks/useCallbackProp.js +3 -3
  3. package/es/hooks/useDeepClonedCompareEffect.js +2 -2
  4. package/es/hooks/useHelpyLogo.js +1 -1
  5. package/es/material-config/MaterialConfigProvider.js +5 -5
  6. package/package.json +5 -3
  7. package/cjs/_virtual/index.js +0 -5
  8. package/cjs/_virtual/use-sync-external-store-shim.production.js +0 -5
  9. package/cjs/node_modules/@tanstack/query-core/build/lib/focusManager.js +0 -93
  10. package/cjs/node_modules/@tanstack/query-core/build/lib/notifyManager.js +0 -101
  11. package/cjs/node_modules/@tanstack/query-core/build/lib/onlineManager.js +0 -95
  12. package/cjs/node_modules/@tanstack/query-core/build/lib/queryObserver.js +0 -571
  13. package/cjs/node_modules/@tanstack/query-core/build/lib/retryer.js +0 -21
  14. package/cjs/node_modules/@tanstack/query-core/build/lib/subscribable.js +0 -33
  15. package/cjs/node_modules/@tanstack/query-core/build/lib/utils.js +0 -154
  16. package/cjs/node_modules/@tanstack/react-query/build/lib/QueryClientProvider.js +0 -65
  17. package/cjs/node_modules/@tanstack/react-query/build/lib/QueryErrorResetBoundary.js +0 -46
  18. package/cjs/node_modules/@tanstack/react-query/build/lib/errorBoundaryUtils.js +0 -52
  19. package/cjs/node_modules/@tanstack/react-query/build/lib/isRestoring.js +0 -31
  20. package/cjs/node_modules/@tanstack/react-query/build/lib/suspense.js +0 -39
  21. package/cjs/node_modules/@tanstack/react-query/build/lib/useBaseQuery.js +0 -94
  22. package/cjs/node_modules/@tanstack/react-query/build/lib/useQuery.js +0 -14
  23. package/cjs/node_modules/@tanstack/react-query/build/lib/useSyncExternalStore.js +0 -9
  24. package/cjs/node_modules/@tanstack/react-query/build/lib/utils.js +0 -12
  25. package/cjs/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js +0 -77
  26. package/cjs/node_modules/use-sync-external-store/shim/index.js +0 -13
  27. package/es/_virtual/index.js +0 -3
  28. package/es/_virtual/use-sync-external-store-shim.production.js +0 -3
  29. package/es/node_modules/@tanstack/query-core/build/lib/focusManager.js +0 -90
  30. package/es/node_modules/@tanstack/query-core/build/lib/notifyManager.js +0 -98
  31. package/es/node_modules/@tanstack/query-core/build/lib/onlineManager.js +0 -92
  32. package/es/node_modules/@tanstack/query-core/build/lib/queryObserver.js +0 -569
  33. package/es/node_modules/@tanstack/query-core/build/lib/retryer.js +0 -17
  34. package/es/node_modules/@tanstack/query-core/build/lib/subscribable.js +0 -31
  35. package/es/node_modules/@tanstack/query-core/build/lib/utils.js +0 -140
  36. package/es/node_modules/@tanstack/react-query/build/lib/QueryClientProvider.js +0 -42
  37. package/es/node_modules/@tanstack/react-query/build/lib/QueryErrorResetBoundary.js +0 -24
  38. package/es/node_modules/@tanstack/react-query/build/lib/errorBoundaryUtils.js +0 -28
  39. package/es/node_modules/@tanstack/react-query/build/lib/isRestoring.js +0 -9
  40. package/es/node_modules/@tanstack/react-query/build/lib/suspense.js +0 -34
  41. package/es/node_modules/@tanstack/react-query/build/lib/useBaseQuery.js +0 -72
  42. package/es/node_modules/@tanstack/react-query/build/lib/useQuery.js +0 -12
  43. package/es/node_modules/@tanstack/react-query/build/lib/useSyncExternalStore.js +0 -7
  44. package/es/node_modules/@tanstack/react-query/build/lib/utils.js +0 -10
  45. package/es/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js +0 -69
  46. package/es/node_modules/use-sync-external-store/shim/index.js +0 -11
@@ -1,140 +0,0 @@
1
- // TYPES
2
- // UTILS
3
- const isServer = typeof window === 'undefined' || 'Deno' in window;
4
- function noop() {
5
- return undefined;
6
- }
7
- function isValidTimeout(value) {
8
- return typeof value === 'number' && value >= 0 && value !== Infinity;
9
- }
10
- function timeUntilStale(updatedAt, staleTime) {
11
- return Math.max(updatedAt + (staleTime || 0) - Date.now(), 0);
12
- }
13
- function parseQueryArgs(arg1, arg2, arg3) {
14
- if (!isQueryKey(arg1)) {
15
- return arg1;
16
- }
17
-
18
- return { ...arg2,
19
- queryKey: arg1
20
- };
21
- }
22
- /**
23
- * This function returns `a` if `b` is deeply equal.
24
- * If not, it will replace any deeply equal children of `b` with those of `a`.
25
- * This can be used for structural sharing between JSON values for example.
26
- */
27
-
28
- function replaceEqualDeep(a, b, depth = 0) {
29
- if (a === b) {
30
- return a;
31
- }
32
-
33
- if (depth > 500) return b;
34
- const array = isPlainArray(a) && isPlainArray(b);
35
-
36
- if (array || isPlainObject(a) && isPlainObject(b)) {
37
- const aSize = array ? a.length : Object.keys(a).length;
38
- const bItems = array ? b : Object.keys(b);
39
- const bSize = bItems.length;
40
- const copy = array ? [] : {};
41
- let equalItems = 0;
42
-
43
- for (let i = 0; i < bSize; i++) {
44
- const key = array ? i : bItems[i];
45
- copy[key] = replaceEqualDeep(a[key], b[key], depth + 1);
46
-
47
- if (copy[key] === a[key]) {
48
- equalItems++;
49
- }
50
- }
51
-
52
- return aSize === bSize && equalItems === aSize ? a : copy;
53
- }
54
-
55
- return b;
56
- }
57
- /**
58
- * Shallow compare objects. Only works with objects that always have the same properties.
59
- */
60
-
61
- function shallowEqualObjects(a, b) {
62
- if (a && !b || b && !a) {
63
- return false;
64
- }
65
-
66
- for (const key in a) {
67
- if (a[key] !== b[key]) {
68
- return false;
69
- }
70
- }
71
-
72
- return true;
73
- }
74
- function isPlainArray(value) {
75
- return Array.isArray(value) && value.length === Object.keys(value).length;
76
- } // Copied from: https://github.com/jonschlinkert/is-plain-object
77
-
78
- function isPlainObject(o) {
79
- if (!hasObjectPrototype(o)) {
80
- return false;
81
- } // If has modified constructor
82
-
83
-
84
- const ctor = o.constructor;
85
-
86
- if (typeof ctor === 'undefined') {
87
- return true;
88
- } // If has modified prototype
89
-
90
-
91
- const prot = ctor.prototype;
92
-
93
- if (!hasObjectPrototype(prot)) {
94
- return false;
95
- } // If constructor does not have an Object-specific method
96
-
97
-
98
- if (!prot.hasOwnProperty('isPrototypeOf')) {
99
- return false;
100
- } // Most likely a plain Object
101
-
102
-
103
- return true;
104
- }
105
-
106
- function hasObjectPrototype(o) {
107
- return Object.prototype.toString.call(o) === '[object Object]';
108
- }
109
-
110
- function isQueryKey(value) {
111
- return Array.isArray(value);
112
- }
113
- function sleep(timeout) {
114
- return new Promise(resolve => {
115
- setTimeout(resolve, timeout);
116
- });
117
- }
118
- /**
119
- * Schedules a microtask.
120
- * This can be useful to schedule state updates after rendering.
121
- */
122
-
123
- function scheduleMicrotask(callback) {
124
- sleep(0).then(callback);
125
- }
126
- function replaceData(prevData, data, options) {
127
- // Use prev data if an isDataEqual function is defined and returns `true`
128
- if (options.isDataEqual != null && options.isDataEqual(prevData, data)) {
129
- return prevData;
130
- } else if (typeof options.structuralSharing === 'function') {
131
- return options.structuralSharing(prevData, data);
132
- } else if (options.structuralSharing !== false) {
133
- // Structurally share data between prev and new data if needed
134
- return replaceEqualDeep(prevData, data);
135
- }
136
-
137
- return data;
138
- }
139
-
140
- export { isPlainArray, isPlainObject, isQueryKey, isServer, isValidTimeout, noop, parseQueryArgs, replaceData, replaceEqualDeep, scheduleMicrotask, shallowEqualObjects, sleep, timeUntilStale };
@@ -1,42 +0,0 @@
1
- 'use client';
2
-
3
- import * as React from 'react';
4
-
5
- const defaultContext = /*#__PURE__*/React.createContext(undefined);
6
- const QueryClientSharingContext = /*#__PURE__*/React.createContext(false); // If we are given a context, we will use it.
7
- // Otherwise, if contextSharing is on, we share the first and at least one
8
- // instance of the context across the window
9
- // to ensure that if React Query is used across
10
- // different bundles or microfrontends they will
11
- // all use the same **instance** of context, regardless
12
- // of module scoping.
13
-
14
- function getQueryClientContext(context, contextSharing) {
15
- if (context) {
16
- return context;
17
- }
18
-
19
- if (contextSharing && typeof window !== 'undefined') {
20
- if (!window.ReactQueryClientContext) {
21
- window.ReactQueryClientContext = defaultContext;
22
- }
23
-
24
- return window.ReactQueryClientContext;
25
- }
26
-
27
- return defaultContext;
28
- }
29
-
30
- const useQueryClient = ({
31
- context
32
- } = {}) => {
33
- const queryClient = React.useContext(getQueryClientContext(context, React.useContext(QueryClientSharingContext)));
34
-
35
- if (!queryClient) {
36
- throw new Error('No QueryClient set, use QueryClientProvider to set one');
37
- }
38
-
39
- return queryClient;
40
- };
41
-
42
- export { defaultContext, useQueryClient };
@@ -1,24 +0,0 @@
1
- 'use client';
2
-
3
- import * as React from 'react';
4
-
5
- function createValue() {
6
- let isReset = false;
7
- return {
8
- clearReset: () => {
9
- isReset = false;
10
- },
11
- reset: () => {
12
- isReset = true;
13
- },
14
- isReset: () => {
15
- return isReset;
16
- }
17
- };
18
- }
19
-
20
- const QueryErrorResetBoundaryContext = /*#__PURE__*/React.createContext(createValue()); // HOOK
21
-
22
- const useQueryErrorResetBoundary = () => React.useContext(QueryErrorResetBoundaryContext); // COMPONENT
23
-
24
- export { useQueryErrorResetBoundary };
@@ -1,28 +0,0 @@
1
- 'use client';
2
-
3
- import * as React from 'react';
4
- import { shouldThrowError } from './utils.js';
5
-
6
- const ensurePreventErrorBoundaryRetry = (options, errorResetBoundary) => {
7
- if (options.suspense || options.useErrorBoundary) {
8
- // Prevent retrying failed query if the error boundary has not been reset yet
9
- if (!errorResetBoundary.isReset()) {
10
- options.retryOnMount = false;
11
- }
12
- }
13
- };
14
- const useClearResetErrorBoundary = errorResetBoundary => {
15
- React.useEffect(() => {
16
- errorResetBoundary.clearReset();
17
- }, [errorResetBoundary]);
18
- };
19
- const getHasError = ({
20
- result,
21
- errorResetBoundary,
22
- useErrorBoundary,
23
- query
24
- }) => {
25
- return result.isError && !errorResetBoundary.isReset() && !result.isFetching && shouldThrowError(useErrorBoundary, [result.error, query]);
26
- };
27
-
28
- export { ensurePreventErrorBoundaryRetry, getHasError, useClearResetErrorBoundary };
@@ -1,9 +0,0 @@
1
- 'use client';
2
-
3
- import * as React from 'react';
4
-
5
- const IsRestoringContext = /*#__PURE__*/React.createContext(false);
6
- const useIsRestoring = () => React.useContext(IsRestoringContext);
7
- IsRestoringContext.Provider;
8
-
9
- export { useIsRestoring };
@@ -1,34 +0,0 @@
1
- /**
2
- * Ensures minimum staleTime and cacheTime values when suspense is enabled.
3
- * Despite the name, this function guards both staleTime and cacheTime to prevent
4
- * infinite re-render loops with synchronous queries.
5
- *
6
- * @deprecated in v5 - replaced by ensureSuspenseTimers
7
- */
8
- const ensureStaleTime = defaultedOptions => {
9
- if (defaultedOptions.suspense) {
10
- // Always set stale time when using suspense to prevent
11
- // fetching again when directly mounting after suspending
12
- if (typeof defaultedOptions.staleTime !== 'number') {
13
- defaultedOptions.staleTime = 1000;
14
- }
15
-
16
- if (typeof defaultedOptions.cacheTime === 'number') {
17
- defaultedOptions.cacheTime = Math.max(defaultedOptions.cacheTime, 1000);
18
- }
19
- }
20
- };
21
- const willFetch = (result, isRestoring) => result.isLoading && result.isFetching && !isRestoring;
22
- const shouldSuspend = (defaultedOptions, result, isRestoring) => (defaultedOptions == null ? void 0 : defaultedOptions.suspense) && willFetch(result, isRestoring);
23
- const fetchOptimistic = (defaultedOptions, observer, errorResetBoundary) => observer.fetchOptimistic(defaultedOptions).then(({
24
- data
25
- }) => {
26
- defaultedOptions.onSuccess == null ? void 0 : defaultedOptions.onSuccess(data);
27
- defaultedOptions.onSettled == null ? void 0 : defaultedOptions.onSettled(data, null);
28
- }).catch(error => {
29
- errorResetBoundary.clearReset();
30
- defaultedOptions.onError == null ? void 0 : defaultedOptions.onError(error);
31
- defaultedOptions.onSettled == null ? void 0 : defaultedOptions.onSettled(undefined, error);
32
- });
33
-
34
- export { ensureStaleTime, fetchOptimistic, shouldSuspend, willFetch };
@@ -1,72 +0,0 @@
1
- 'use client';
2
-
3
- import * as React from 'react';
4
- import { useSyncExternalStore } from './useSyncExternalStore.js';
5
- import { useQueryErrorResetBoundary } from './QueryErrorResetBoundary.js';
6
- import { useQueryClient } from './QueryClientProvider.js';
7
- import { useIsRestoring } from './isRestoring.js';
8
- import { ensurePreventErrorBoundaryRetry, useClearResetErrorBoundary, getHasError } from './errorBoundaryUtils.js';
9
- import { ensureStaleTime, shouldSuspend, fetchOptimistic } from './suspense.js';
10
- import { notifyManager } from '../../../query-core/build/lib/notifyManager.js';
11
-
12
- function useBaseQuery(options, Observer) {
13
- const queryClient = useQueryClient({
14
- context: options.context
15
- });
16
- const isRestoring = useIsRestoring();
17
- const errorResetBoundary = useQueryErrorResetBoundary();
18
- const defaultedOptions = queryClient.defaultQueryOptions(options); // Make sure results are optimistically set in fetching state before subscribing or updating options
19
-
20
- defaultedOptions._optimisticResults = isRestoring ? 'isRestoring' : 'optimistic'; // Include callbacks in batch renders
21
-
22
- if (defaultedOptions.onError) {
23
- defaultedOptions.onError = notifyManager.batchCalls(defaultedOptions.onError);
24
- }
25
-
26
- if (defaultedOptions.onSuccess) {
27
- defaultedOptions.onSuccess = notifyManager.batchCalls(defaultedOptions.onSuccess);
28
- }
29
-
30
- if (defaultedOptions.onSettled) {
31
- defaultedOptions.onSettled = notifyManager.batchCalls(defaultedOptions.onSettled);
32
- }
33
-
34
- ensureStaleTime(defaultedOptions);
35
- ensurePreventErrorBoundaryRetry(defaultedOptions, errorResetBoundary);
36
- useClearResetErrorBoundary(errorResetBoundary);
37
- const [observer] = React.useState(() => new Observer(queryClient, defaultedOptions));
38
- const result = observer.getOptimisticResult(defaultedOptions);
39
- useSyncExternalStore(React.useCallback(onStoreChange => {
40
- const unsubscribe = isRestoring ? () => undefined : observer.subscribe(notifyManager.batchCalls(onStoreChange)); // Update result to make sure we did not miss any query updates
41
- // between creating the observer and subscribing to it.
42
-
43
- observer.updateResult();
44
- return unsubscribe;
45
- }, [observer, isRestoring]), () => observer.getCurrentResult(), () => observer.getCurrentResult());
46
- React.useEffect(() => {
47
- // Do not notify on updates because of changes in the options because
48
- // these changes should already be reflected in the optimistic result.
49
- observer.setOptions(defaultedOptions, {
50
- listeners: false
51
- });
52
- }, [defaultedOptions, observer]); // Handle suspense
53
-
54
- if (shouldSuspend(defaultedOptions, result, isRestoring)) {
55
- throw fetchOptimistic(defaultedOptions, observer, errorResetBoundary);
56
- } // Handle error boundary
57
-
58
-
59
- if (getHasError({
60
- result,
61
- errorResetBoundary,
62
- useErrorBoundary: defaultedOptions.useErrorBoundary,
63
- query: observer.getCurrentQuery()
64
- })) {
65
- throw result.error;
66
- } // Handle result property usage tracking
67
-
68
-
69
- return !defaultedOptions.notifyOnChangeProps ? observer.trackResult(result) : result;
70
- }
71
-
72
- export { useBaseQuery };
@@ -1,12 +0,0 @@
1
- 'use client';
2
-
3
- import { useBaseQuery } from './useBaseQuery.js';
4
- import { parseQueryArgs } from '../../../query-core/build/lib/utils.js';
5
- import { QueryObserver } from '../../../query-core/build/lib/queryObserver.js';
6
-
7
- function useQuery(arg1, arg2, arg3) {
8
- const parsedOptions = parseQueryArgs(arg1, arg2);
9
- return useBaseQuery(parsedOptions, QueryObserver);
10
- }
11
-
12
- export { useQuery };
@@ -1,7 +0,0 @@
1
- 'use client';
2
-
3
- import { s as shimExports } from '../../../../use-sync-external-store/shim/index.js';
4
-
5
- const useSyncExternalStore = shimExports.useSyncExternalStore;
6
-
7
- export { useSyncExternalStore };
@@ -1,10 +0,0 @@
1
- function shouldThrowError(_useErrorBoundary, params) {
2
- // Allow useErrorBoundary function to override throwing behavior on a per-error basis
3
- if (typeof _useErrorBoundary === 'function') {
4
- return _useErrorBoundary(...params);
5
- }
6
-
7
- return !!_useErrorBoundary;
8
- }
9
-
10
- export { shouldThrowError };
@@ -1,69 +0,0 @@
1
- import { __exports as useSyncExternalStoreShim_production } from '../../../_virtual/use-sync-external-store-shim.production.js';
2
- import React__default from 'react';
3
-
4
- /**
5
- * @license React
6
- * use-sync-external-store-shim.production.js
7
- *
8
- * Copyright (c) Meta Platforms, Inc. and affiliates.
9
- *
10
- * This source code is licensed under the MIT license found in the
11
- * LICENSE file in the root directory of this source tree.
12
- */
13
- var React = React__default;
14
- function is(x, y) {
15
- return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y);
16
- }
17
- var objectIs = "function" === typeof Object.is ? Object.is : is,
18
- useState = React.useState,
19
- useEffect = React.useEffect,
20
- useLayoutEffect = React.useLayoutEffect,
21
- useDebugValue = React.useDebugValue;
22
- function useSyncExternalStore$2(subscribe, getSnapshot) {
23
- var value = getSnapshot(),
24
- _useState = useState({ inst: { value: value, getSnapshot: getSnapshot } }),
25
- inst = _useState[0].inst,
26
- forceUpdate = _useState[1];
27
- useLayoutEffect(
28
- function () {
29
- inst.value = value;
30
- inst.getSnapshot = getSnapshot;
31
- checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });
32
- },
33
- [subscribe, value, getSnapshot]
34
- );
35
- useEffect(
36
- function () {
37
- checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });
38
- return subscribe(function () {
39
- checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });
40
- });
41
- },
42
- [subscribe]
43
- );
44
- useDebugValue(value);
45
- return value;
46
- }
47
- function checkIfSnapshotChanged(inst) {
48
- var latestGetSnapshot = inst.getSnapshot;
49
- inst = inst.value;
50
- try {
51
- var nextValue = latestGetSnapshot();
52
- return !objectIs(inst, nextValue);
53
- } catch (error) {
54
- return true;
55
- }
56
- }
57
- function useSyncExternalStore$1(subscribe, getSnapshot) {
58
- return getSnapshot();
59
- }
60
- var shim =
61
- "undefined" === typeof window ||
62
- "undefined" === typeof window.document ||
63
- "undefined" === typeof window.document.createElement
64
- ? useSyncExternalStore$1
65
- : useSyncExternalStore$2;
66
- useSyncExternalStoreShim_production.useSyncExternalStore =
67
- void 0 !== React.useSyncExternalStore ? React.useSyncExternalStore : shim;
68
-
69
- export { useSyncExternalStoreShim_production as default };
@@ -1,11 +0,0 @@
1
- import { __module as shim } from '../../../_virtual/index.js';
2
- import '../cjs/use-sync-external-store-shim.production.js';
3
- import { __exports as useSyncExternalStoreShim_production } from '../../../_virtual/use-sync-external-store-shim.production.js';
4
-
5
- {
6
- shim.exports = useSyncExternalStoreShim_production;
7
- }
8
-
9
- var shimExports = shim.exports;
10
-
11
- export { shimExports as s };