@lowentry/react-redux 1.15.4 → 2.0.1
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/LICENSE +23 -0
- package/dist/index.d.ts +453 -0
- package/dist/index.js +1456 -0
- package/dist/index.js.map +1 -0
- package/package.json +77 -70
- package/api-extractor.json +0 -43
- package/index.d.ts +0 -3
- package/index.js +0 -1487
- package/index.js.map +0 -1
- package/src/LeRed.jsx +0 -1512
- package/src/index.js +0 -1
- package/tsconfig.d.ts +0 -1
- package/tsconfig.json +0 -39
package/dist/index.js
ADDED
|
@@ -0,0 +1,1456 @@
|
|
|
1
|
+
// src/LeRed.tsx
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import * as ReactDOM from "react-dom";
|
|
4
|
+
import * as ReactRedux from "react-redux";
|
|
5
|
+
import * as Redux from "redux";
|
|
6
|
+
import * as RTK from "@reduxjs/toolkit";
|
|
7
|
+
import * as ReduxSaga from "redux-saga";
|
|
8
|
+
import * as ReduxSagaEffects from "redux-saga/effects";
|
|
9
|
+
import { LeUtils, STRING, ISSET, ARRAY, IS_OBJECT, IS_ARRAY, INT_LAX_ANY } from "@lowentry/utils";
|
|
10
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
11
|
+
var fixEqualsComparator = (equalsComparator, errorMessage) => {
|
|
12
|
+
if (ISSET(equalsComparator)) {
|
|
13
|
+
if (typeof equalsComparator !== "function") {
|
|
14
|
+
console.error(errorMessage);
|
|
15
|
+
console.error(equalsComparator);
|
|
16
|
+
return LeUtils.equals;
|
|
17
|
+
}
|
|
18
|
+
return (a, b) => {
|
|
19
|
+
try {
|
|
20
|
+
return Boolean(equalsComparator(a, b));
|
|
21
|
+
} catch (e) {
|
|
22
|
+
console.error("LeRed: equalsComparator threw an error", e);
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
return LeUtils.equals;
|
|
28
|
+
};
|
|
29
|
+
var useCompareMemoize = (value, equalsComparator) => {
|
|
30
|
+
const ref = React.useRef(null);
|
|
31
|
+
if (!equalsComparator(value, ref.current)) {
|
|
32
|
+
ref.current = value;
|
|
33
|
+
}
|
|
34
|
+
return ref.current;
|
|
35
|
+
};
|
|
36
|
+
var useState2 = React.useState;
|
|
37
|
+
var leRedUseSelector = (selector, equalsComparator) => {
|
|
38
|
+
if (typeof selector !== "function") {
|
|
39
|
+
console.error("LeRed.useSelector() was given an invalid selector:");
|
|
40
|
+
console.error(selector);
|
|
41
|
+
const fallbackSelector = () => void 0;
|
|
42
|
+
selector = fallbackSelector;
|
|
43
|
+
}
|
|
44
|
+
const validatedComparator = fixEqualsComparator(equalsComparator, "LeRed.useSelector() was given an invalid comparator:");
|
|
45
|
+
return ReactRedux.useSelector(selector, validatedComparator);
|
|
46
|
+
};
|
|
47
|
+
var leRedUseLayoutEffect = (callable, comparingValues, equalsComparator) => {
|
|
48
|
+
const validatedComparator = fixEqualsComparator(equalsComparator, "LeRed.useLayoutEffect() was given an invalid comparator:");
|
|
49
|
+
const values = ARRAY(comparingValues);
|
|
50
|
+
const memoizedValues = values.map((value) => useCompareMemoize(value, validatedComparator));
|
|
51
|
+
return React.useLayoutEffect(callable, memoizedValues);
|
|
52
|
+
};
|
|
53
|
+
var leRedUseEffect = (callable, comparingValues, equalsComparator) => {
|
|
54
|
+
const validatedComparator = fixEqualsComparator(equalsComparator, "LeRed.useEffect() was given an invalid comparator:");
|
|
55
|
+
const values = ARRAY(comparingValues);
|
|
56
|
+
const memoizedValues = values.map((value) => useCompareMemoize(value, validatedComparator));
|
|
57
|
+
return React.useEffect(callable, memoizedValues);
|
|
58
|
+
};
|
|
59
|
+
var leRedUseMemo = (callable, comparingValues, equalsComparator) => {
|
|
60
|
+
const validatedComparator = fixEqualsComparator(equalsComparator, "LeRed.useMemo() was given an invalid comparator:");
|
|
61
|
+
const values = ARRAY(comparingValues);
|
|
62
|
+
const memoizedValues = values.map((value) => useCompareMemoize(value, validatedComparator));
|
|
63
|
+
return React.useMemo(callable, memoizedValues);
|
|
64
|
+
};
|
|
65
|
+
var leRedUseCallback = (callable, comparingValues, equalsComparator) => {
|
|
66
|
+
const validatedComparator = fixEqualsComparator(equalsComparator, "LeRed.useCallback() was given an invalid comparator:");
|
|
67
|
+
const values = ARRAY(comparingValues);
|
|
68
|
+
const memoizedValues = values.map((value) => useCompareMemoize(value, validatedComparator));
|
|
69
|
+
return React.useCallback(callable, memoizedValues);
|
|
70
|
+
};
|
|
71
|
+
var useEffect2 = leRedUseEffect;
|
|
72
|
+
var useLayoutEffect2 = leRedUseLayoutEffect;
|
|
73
|
+
var useCallback2 = leRedUseCallback;
|
|
74
|
+
var useMemo2 = leRedUseMemo;
|
|
75
|
+
var useContext2 = React.useContext;
|
|
76
|
+
var useReducer2 = React.useReducer;
|
|
77
|
+
var useRef2 = React.useRef;
|
|
78
|
+
var useDebugValue2 = React.useDebugValue;
|
|
79
|
+
function useImperativeHandle2(ref, createHandle, comparingValues, equalsComparator) {
|
|
80
|
+
const validatedComparator = fixEqualsComparator(equalsComparator, "LeRed.useImperativeHandle() was given an invalid comparator:");
|
|
81
|
+
const values = ARRAY(comparingValues ?? []);
|
|
82
|
+
const memoizedValues = values.map((value) => useCompareMemoize(value, validatedComparator));
|
|
83
|
+
return React.useImperativeHandle(ref, createHandle, memoizedValues);
|
|
84
|
+
}
|
|
85
|
+
function useDeferredValue2(value, equalsComparator) {
|
|
86
|
+
const validatedComparator = fixEqualsComparator(equalsComparator, "LeRed.useDeferredValue() was given an invalid comparator:");
|
|
87
|
+
const stableValue = useCompareMemoize(value, validatedComparator);
|
|
88
|
+
return React.useDeferredValue(stableValue);
|
|
89
|
+
}
|
|
90
|
+
var useTransition2 = React.useTransition;
|
|
91
|
+
var useId2 = React.useId;
|
|
92
|
+
var useInsertionEffect2 = (callable, comparingValues, equalsComparator) => {
|
|
93
|
+
const validatedComparator = fixEqualsComparator(equalsComparator, "LeRed.useInsertionEffect() was given an invalid comparator:");
|
|
94
|
+
const values = ARRAY(comparingValues);
|
|
95
|
+
const memoizedValues = values.map((value) => useCompareMemoize(value, validatedComparator));
|
|
96
|
+
return React.useInsertionEffect(callable, memoizedValues);
|
|
97
|
+
};
|
|
98
|
+
var useSyncExternalStore2 = React.useSyncExternalStore;
|
|
99
|
+
var Children2 = React.Children;
|
|
100
|
+
var createContext2 = React.createContext;
|
|
101
|
+
var createElement2 = React.createElement;
|
|
102
|
+
var cloneElement2 = React.cloneElement;
|
|
103
|
+
var isValidElement2 = React.isValidElement;
|
|
104
|
+
var lazy2 = React.lazy;
|
|
105
|
+
var forwardRef2 = React.forwardRef;
|
|
106
|
+
var leRedMemo = (component, equalsComparator) => {
|
|
107
|
+
const validatedComparator = fixEqualsComparator(equalsComparator, "LeRed.memo() was given an invalid comparator:");
|
|
108
|
+
return React.memo(component, validatedComparator);
|
|
109
|
+
};
|
|
110
|
+
var memo2 = leRedMemo;
|
|
111
|
+
var startTransition2 = React.startTransition;
|
|
112
|
+
var createPortal2 = ReactDOM.createPortal;
|
|
113
|
+
var flushSync2 = ReactDOM.flushSync;
|
|
114
|
+
var createReducer2 = RTK.createReducer;
|
|
115
|
+
var createAsyncThunk2 = RTK.createAsyncThunk;
|
|
116
|
+
var createEntityAdapter2 = RTK.createEntityAdapter;
|
|
117
|
+
var nanoid2 = RTK.nanoid;
|
|
118
|
+
var current2 = (obj) => {
|
|
119
|
+
try {
|
|
120
|
+
return RTK.current(obj);
|
|
121
|
+
} catch {
|
|
122
|
+
}
|
|
123
|
+
return obj;
|
|
124
|
+
};
|
|
125
|
+
var isImmutableDefault2 = RTK.isImmutableDefault;
|
|
126
|
+
var unwrapResult2 = RTK.unwrapResult;
|
|
127
|
+
var createNextState2 = RTK.createNextState;
|
|
128
|
+
var produce = RTK.createNextState;
|
|
129
|
+
var freeze2 = RTK.freeze;
|
|
130
|
+
var isDraft2 = RTK.isDraft;
|
|
131
|
+
var original2 = RTK.original;
|
|
132
|
+
var combineSlices2 = RTK.combineSlices;
|
|
133
|
+
var createListenerMiddleware2 = RTK.createListenerMiddleware;
|
|
134
|
+
var createDynamicMiddleware2 = RTK.createDynamicMiddleware;
|
|
135
|
+
var autoBatchEnhancer2 = RTK.autoBatchEnhancer;
|
|
136
|
+
var isAnyOf2 = RTK.isAnyOf;
|
|
137
|
+
var isAllOf2 = RTK.isAllOf;
|
|
138
|
+
var isPending2 = RTK.isPending;
|
|
139
|
+
var isFulfilled2 = RTK.isFulfilled;
|
|
140
|
+
var isRejected2 = RTK.isRejected;
|
|
141
|
+
var isAsyncThunkAction2 = RTK.isAsyncThunkAction;
|
|
142
|
+
var isRejectedWithValue2 = RTK.isRejectedWithValue;
|
|
143
|
+
var combineReducers2 = Redux.combineReducers;
|
|
144
|
+
var applyMiddleware2 = Redux.applyMiddleware;
|
|
145
|
+
var compose2 = Redux.compose;
|
|
146
|
+
var bindActionCreators2 = Redux.bindActionCreators;
|
|
147
|
+
var configureStore2 = (storeData) => {
|
|
148
|
+
if (!storeData || typeof storeData !== "object") {
|
|
149
|
+
storeData = {
|
|
150
|
+
reducer: (state = {}) => state
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
if (storeData.__lowentry_store__ === true) {
|
|
154
|
+
return storeData;
|
|
155
|
+
}
|
|
156
|
+
try {
|
|
157
|
+
if (ISSET(storeData.slices)) {
|
|
158
|
+
storeData.reducer = storeData.slices;
|
|
159
|
+
delete storeData.slices;
|
|
160
|
+
}
|
|
161
|
+
} catch (e) {
|
|
162
|
+
console.error("Failed to access slices on storeData:", e);
|
|
163
|
+
}
|
|
164
|
+
const sagaListeners = [];
|
|
165
|
+
const initialState = {};
|
|
166
|
+
if (ISSET(storeData.reducer)) {
|
|
167
|
+
let slices = storeData.reducer;
|
|
168
|
+
if (typeof slices === "object" && slices !== null) {
|
|
169
|
+
if ("name" in slices && slices.name || "__lowentry_unfinished_slice" in slices && slices.__lowentry_unfinished_slice) {
|
|
170
|
+
slices = [slices];
|
|
171
|
+
} else {
|
|
172
|
+
const slicesArray = [];
|
|
173
|
+
LeUtils.each(slices, (slice, index) => {
|
|
174
|
+
if (slice && (typeof slice === "object" || typeof slice === "function")) {
|
|
175
|
+
if (typeof slice === "function") {
|
|
176
|
+
slice = {
|
|
177
|
+
name: STRING(index),
|
|
178
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Legacy reducer function type
|
|
179
|
+
state: slice(void 0, { type: "@@INIT" }),
|
|
180
|
+
reducers: {
|
|
181
|
+
[STRING(index)]: slice
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
const recordSlice = slice;
|
|
186
|
+
if (!("name" in recordSlice) || !recordSlice.name) {
|
|
187
|
+
recordSlice.name = STRING(index);
|
|
188
|
+
}
|
|
189
|
+
slicesArray.push(slice);
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
slices = slicesArray;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
slices = ARRAY(slices);
|
|
196
|
+
const reducerArrays = {};
|
|
197
|
+
LeUtils.each(slices, (slice, index) => {
|
|
198
|
+
if (slice && typeof slice === "object") {
|
|
199
|
+
const recordSlice = slice;
|
|
200
|
+
if (!("name" in recordSlice) || !recordSlice.name) {
|
|
201
|
+
recordSlice.name = "slice_" + STRING(index);
|
|
202
|
+
}
|
|
203
|
+
const typedSlice = slice;
|
|
204
|
+
initialState[typedSlice.name] = typeof typedSlice.state === "function" ? typedSlice.state() : typedSlice.state;
|
|
205
|
+
LeUtils.each(typedSlice.reducers, (reducer, reducerName) => {
|
|
206
|
+
const fullReducerName = STRING(reducerName).startsWith("lowentrystore/") ? STRING(reducerName).substring("lowentrystore/".length) : typedSlice.name + "/" + STRING(reducerName);
|
|
207
|
+
if (typeof reducerArrays[fullReducerName] === "undefined") {
|
|
208
|
+
reducerArrays[fullReducerName] = [];
|
|
209
|
+
}
|
|
210
|
+
reducerArrays[fullReducerName].push(reducer);
|
|
211
|
+
});
|
|
212
|
+
LeUtils.each(typedSlice.sagaListeners, (sagaListener, reducerName) => {
|
|
213
|
+
LeUtils.each(LeUtils.flattenArray(sagaListener), (listener) => {
|
|
214
|
+
try {
|
|
215
|
+
if (typeof listener === "function") {
|
|
216
|
+
sagaListeners.push(listener());
|
|
217
|
+
}
|
|
218
|
+
} catch (e) {
|
|
219
|
+
console.error('an error was thrown by your saga code, in slice "' + typedSlice.name + '", action "' + STRING(reducerName) + '":');
|
|
220
|
+
console.error(e);
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
const reducers = {};
|
|
227
|
+
LeUtils.each(reducerArrays, (reducerArray, reducerName) => {
|
|
228
|
+
const flattenedArray = LeUtils.flattenArray(reducerArray);
|
|
229
|
+
const firstReducer = flattenedArray[0];
|
|
230
|
+
if (flattenedArray.length <= 1) {
|
|
231
|
+
if (typeof firstReducer === "function") {
|
|
232
|
+
reducers[STRING(reducerName)] = firstReducer;
|
|
233
|
+
}
|
|
234
|
+
} else {
|
|
235
|
+
reducers[STRING(reducerName)] = (...args) => {
|
|
236
|
+
LeUtils.each(flattenedArray, (reducer) => {
|
|
237
|
+
try {
|
|
238
|
+
if (typeof reducer === "function") {
|
|
239
|
+
reducer(...args);
|
|
240
|
+
}
|
|
241
|
+
} catch (e) {
|
|
242
|
+
console.error(e);
|
|
243
|
+
}
|
|
244
|
+
});
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
storeData.reducer = RTK.createSlice({
|
|
249
|
+
name: "lowentrystore",
|
|
250
|
+
initialState,
|
|
251
|
+
reducers
|
|
252
|
+
}).reducer;
|
|
253
|
+
if (!ISSET(storeData.preloadedState)) {
|
|
254
|
+
storeData.preloadedState = LeUtils.clone(initialState);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
if (ISSET(storeData.state)) {
|
|
258
|
+
storeData.preloadedState = storeData.state;
|
|
259
|
+
delete storeData.state;
|
|
260
|
+
}
|
|
261
|
+
if (ISSET(storeData.preloadedState)) {
|
|
262
|
+
if (!storeData.reducer) {
|
|
263
|
+
storeData.reducer = (state) => state;
|
|
264
|
+
}
|
|
265
|
+
storeData.preloadedState = { reducer: storeData.preloadedState };
|
|
266
|
+
} else {
|
|
267
|
+
if (!storeData.reducer) {
|
|
268
|
+
storeData.reducer = (state) => state;
|
|
269
|
+
}
|
|
270
|
+
storeData.preloadedState = { reducer: LeUtils.clone(initialState) };
|
|
271
|
+
}
|
|
272
|
+
const middleware = ARRAY(storeData.middleware);
|
|
273
|
+
let sagaMiddleware = null;
|
|
274
|
+
if (sagaListeners.length > 0) {
|
|
275
|
+
sagaMiddleware = ReduxSaga.default();
|
|
276
|
+
middleware.push(sagaMiddleware);
|
|
277
|
+
}
|
|
278
|
+
storeData.middleware = (getDefaultMiddleware) => getDefaultMiddleware().concat(...middleware);
|
|
279
|
+
const store = RTK.configureStore({
|
|
280
|
+
...storeData,
|
|
281
|
+
reducer: {
|
|
282
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- RTK reducer type
|
|
283
|
+
reducer: storeData.reducer
|
|
284
|
+
}
|
|
285
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
286
|
+
});
|
|
287
|
+
store.__lowentry_store__ = true;
|
|
288
|
+
store.state = () => store.getState().reducer;
|
|
289
|
+
const dispatch = store.dispatch;
|
|
290
|
+
store.dispatch = ((action) => {
|
|
291
|
+
const typedAction = action;
|
|
292
|
+
typedAction.__lowentry_dispatch__ = true;
|
|
293
|
+
if (STRING(action.type).startsWith("lowentrystore/")) {
|
|
294
|
+
typedAction.__lowentry_dispatch_result__ = [];
|
|
295
|
+
} else {
|
|
296
|
+
delete typedAction.__lowentry_dispatch_result__;
|
|
297
|
+
}
|
|
298
|
+
dispatch(action);
|
|
299
|
+
const result = typedAction.__lowentry_dispatch_result__;
|
|
300
|
+
delete typedAction.__lowentry_dispatch_result__;
|
|
301
|
+
delete typedAction.__lowentry_dispatch__;
|
|
302
|
+
return result;
|
|
303
|
+
});
|
|
304
|
+
if (sagaMiddleware !== null) {
|
|
305
|
+
sagaMiddleware.run(function* () {
|
|
306
|
+
yield ReduxSagaEffects.all(sagaListeners);
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
return store;
|
|
310
|
+
};
|
|
311
|
+
var createSlice2 = (slice) => {
|
|
312
|
+
if (!slice) {
|
|
313
|
+
return { __lowentry_unfinished_slice: true };
|
|
314
|
+
}
|
|
315
|
+
if (Array.isArray(slice)) {
|
|
316
|
+
const e = new Error("the given slice is an array (instead of an object)");
|
|
317
|
+
console.error("an error was thrown by your LeRed.createSlice(...) code:");
|
|
318
|
+
console.error(e);
|
|
319
|
+
throw e;
|
|
320
|
+
}
|
|
321
|
+
if (slice.name) {
|
|
322
|
+
const actions = {};
|
|
323
|
+
const reducers = {};
|
|
324
|
+
const sagas = {};
|
|
325
|
+
const sagaListeners = {};
|
|
326
|
+
LeUtils.each(slice.actions, (reducer, reducerNames) => {
|
|
327
|
+
LeUtils.each(STRING(reducerNames).split(","), (reducerName) => {
|
|
328
|
+
if (STRING(reducerName).length <= 0) {
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
const reducerAction = RTK.createAction((STRING(reducerName).startsWith("lowentrystore/") ? "" : "lowentrystore/" + slice.name + "/") + STRING(reducerName));
|
|
332
|
+
actions[STRING(reducerName)] = reducerAction;
|
|
333
|
+
LeUtils.each(LeUtils.flattenArray(reducer), (innerReducer) => {
|
|
334
|
+
if (LeUtils.isGeneratorFunction(innerReducer)) {
|
|
335
|
+
const sagaListener = function* () {
|
|
336
|
+
yield ReduxSagaEffects.takeEvery(reducerAction, function* (action) {
|
|
337
|
+
let promiseResolve = null;
|
|
338
|
+
let promiseReject = null;
|
|
339
|
+
try {
|
|
340
|
+
const typedAction = action;
|
|
341
|
+
if (typedAction.__lowentry_dispatch__ === true) {
|
|
342
|
+
const promise = new Promise((resolve, reject) => {
|
|
343
|
+
promiseResolve = resolve;
|
|
344
|
+
promiseReject = reject;
|
|
345
|
+
});
|
|
346
|
+
if (Array.isArray(typedAction.__lowentry_dispatch_result__)) {
|
|
347
|
+
if (typeof promise !== "undefined") {
|
|
348
|
+
typedAction.__lowentry_dispatch_result__.push(promise);
|
|
349
|
+
}
|
|
350
|
+
} else {
|
|
351
|
+
typedAction.__lowentry_dispatch_result__ = promise;
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
const result = yield innerReducer.apply(slice, [slice.state, typedAction.payload, typedAction]);
|
|
355
|
+
if (promiseResolve !== null) {
|
|
356
|
+
promiseResolve(result);
|
|
357
|
+
}
|
|
358
|
+
} catch (e) {
|
|
359
|
+
console.error('an error was thrown by your LeRed.createSlice(...) code, by slice "' + slice.name + '", action "' + STRING(reducerName) + '":');
|
|
360
|
+
console.error(e);
|
|
361
|
+
if (promiseReject !== null) {
|
|
362
|
+
try {
|
|
363
|
+
promiseReject(e);
|
|
364
|
+
} catch (e2) {
|
|
365
|
+
console.error(e2);
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
});
|
|
370
|
+
};
|
|
371
|
+
if (IS_ARRAY(sagas[STRING(reducerName)])) {
|
|
372
|
+
sagas[STRING(reducerName)].push(innerReducer);
|
|
373
|
+
} else {
|
|
374
|
+
sagas[STRING(reducerName)] = [innerReducer];
|
|
375
|
+
}
|
|
376
|
+
if (IS_ARRAY(sagaListeners[STRING(reducerName)])) {
|
|
377
|
+
sagaListeners[STRING(reducerName)].push(sagaListener);
|
|
378
|
+
} else {
|
|
379
|
+
sagaListeners[STRING(reducerName)] = [sagaListener];
|
|
380
|
+
}
|
|
381
|
+
} else {
|
|
382
|
+
const reducerFunction = (state, action) => {
|
|
383
|
+
try {
|
|
384
|
+
const typedAction = action;
|
|
385
|
+
if (typeof innerReducer === "function") {
|
|
386
|
+
const result = innerReducer.apply(state, [state[slice.name], typedAction.payload]);
|
|
387
|
+
if (typedAction.__lowentry_dispatch__ === true) {
|
|
388
|
+
if (Array.isArray(typedAction.__lowentry_dispatch_result__)) {
|
|
389
|
+
if (typeof result !== "undefined") {
|
|
390
|
+
typedAction.__lowentry_dispatch_result__.push(result);
|
|
391
|
+
}
|
|
392
|
+
} else {
|
|
393
|
+
typedAction.__lowentry_dispatch_result__ = result;
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
} catch (e) {
|
|
398
|
+
console.error('an error was thrown by your LeRed.createSlice(...) code, by slice "' + slice.name + '", action "' + STRING(reducerName) + '":');
|
|
399
|
+
console.error(e);
|
|
400
|
+
}
|
|
401
|
+
};
|
|
402
|
+
if (ISSET(reducers[STRING(reducerName)])) {
|
|
403
|
+
reducers[STRING(reducerName)].push(reducerFunction);
|
|
404
|
+
} else {
|
|
405
|
+
reducers[STRING(reducerName)] = [reducerFunction];
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
});
|
|
409
|
+
});
|
|
410
|
+
});
|
|
411
|
+
slice.actions = actions;
|
|
412
|
+
slice.reducers = reducers;
|
|
413
|
+
slice.sagas = sagas;
|
|
414
|
+
slice.sagaListeners = sagaListeners;
|
|
415
|
+
const selectors = {};
|
|
416
|
+
LeUtils.each(slice.selectors, (selector, selectorName) => {
|
|
417
|
+
selectors[STRING(selectorName)] = (state) => {
|
|
418
|
+
try {
|
|
419
|
+
if (typeof selector === "function") {
|
|
420
|
+
return selector.apply(state, [state[slice.name]]);
|
|
421
|
+
}
|
|
422
|
+
} catch (e) {
|
|
423
|
+
console.error('an error was thrown by your LeRed.createSlice(...) code, by slice "' + slice.name + '", selector "' + STRING(selectorName) + '":');
|
|
424
|
+
console.error(e);
|
|
425
|
+
return void 0;
|
|
426
|
+
}
|
|
427
|
+
};
|
|
428
|
+
});
|
|
429
|
+
slice.selectors = selectors;
|
|
430
|
+
const getters = {};
|
|
431
|
+
LeUtils.each(slice.getters, (getter, getterName) => {
|
|
432
|
+
getters[STRING(getterName)] = (...params) => {
|
|
433
|
+
try {
|
|
434
|
+
if (typeof getter === "function") {
|
|
435
|
+
const selector = getter(...params);
|
|
436
|
+
return (state) => {
|
|
437
|
+
try {
|
|
438
|
+
if (typeof selector === "function") {
|
|
439
|
+
return selector.apply(state, [state[slice.name]]);
|
|
440
|
+
}
|
|
441
|
+
} catch (e) {
|
|
442
|
+
console.error('an error was thrown by your LeRed.createSlice(...) code, by slice "' + slice.name + '", getter "' + STRING(getterName) + '":');
|
|
443
|
+
console.error(e);
|
|
444
|
+
return void 0;
|
|
445
|
+
}
|
|
446
|
+
};
|
|
447
|
+
}
|
|
448
|
+
} catch (e) {
|
|
449
|
+
console.error('an error was thrown by your LeRed.createSlice(...) code, by slice "' + slice.name + '", getter "' + STRING(getterName) + '":');
|
|
450
|
+
console.error(e);
|
|
451
|
+
return () => void 0;
|
|
452
|
+
}
|
|
453
|
+
return () => void 0;
|
|
454
|
+
};
|
|
455
|
+
});
|
|
456
|
+
slice.getters = getters;
|
|
457
|
+
return slice;
|
|
458
|
+
} else {
|
|
459
|
+
slice.__lowentry_unfinished_slice = true;
|
|
460
|
+
return slice;
|
|
461
|
+
}
|
|
462
|
+
};
|
|
463
|
+
var createFastSlice = (slice) => {
|
|
464
|
+
if (!slice) {
|
|
465
|
+
return {};
|
|
466
|
+
}
|
|
467
|
+
if (Array.isArray(slice)) {
|
|
468
|
+
const e = new Error("the given slice is an array (instead of an object)");
|
|
469
|
+
console.error("an error was thrown by your LeRed.createFastSlice(...) code:");
|
|
470
|
+
console.error(e);
|
|
471
|
+
throw e;
|
|
472
|
+
}
|
|
473
|
+
const actions = {};
|
|
474
|
+
LeUtils.each(slice.actions, (reducer, reducerName) => {
|
|
475
|
+
actions[STRING(reducerName)] = (...params) => {
|
|
476
|
+
if (typeof reducer === "function") {
|
|
477
|
+
return reducer.apply(slice, [slice.state, ...params]);
|
|
478
|
+
}
|
|
479
|
+
return void 0;
|
|
480
|
+
};
|
|
481
|
+
});
|
|
482
|
+
slice.actions = actions;
|
|
483
|
+
const selectors = {};
|
|
484
|
+
LeUtils.each(slice.selectors, (selector, selectorName) => {
|
|
485
|
+
selectors[STRING(selectorName)] = () => {
|
|
486
|
+
if (typeof selector === "function") {
|
|
487
|
+
return selector.apply(slice, [slice.state]);
|
|
488
|
+
}
|
|
489
|
+
return void 0;
|
|
490
|
+
};
|
|
491
|
+
});
|
|
492
|
+
slice.selectors = new Proxy(selectors, {
|
|
493
|
+
get: (target, key) => {
|
|
494
|
+
if (!(key in target)) {
|
|
495
|
+
return void 0;
|
|
496
|
+
}
|
|
497
|
+
const targetRecord = target;
|
|
498
|
+
const getter = targetRecord[key];
|
|
499
|
+
if (typeof getter === "function") {
|
|
500
|
+
return getter();
|
|
501
|
+
}
|
|
502
|
+
return void 0;
|
|
503
|
+
}
|
|
504
|
+
});
|
|
505
|
+
const getters = {};
|
|
506
|
+
LeUtils.each(slice.getters, (selector, selectorName) => {
|
|
507
|
+
getters[STRING(selectorName)] = (...params) => {
|
|
508
|
+
if (typeof selector === "function") {
|
|
509
|
+
return selector.apply(slice, [slice.state, ...params]);
|
|
510
|
+
}
|
|
511
|
+
return void 0;
|
|
512
|
+
};
|
|
513
|
+
});
|
|
514
|
+
slice.getters = getters;
|
|
515
|
+
return slice;
|
|
516
|
+
};
|
|
517
|
+
var leRedCreateAction = (id) => {
|
|
518
|
+
return RTK.createAction("lowentrystore/lowentryaction/" + id);
|
|
519
|
+
};
|
|
520
|
+
var leRedCreateSelector = (selectorsGenerator) => {
|
|
521
|
+
return function(stateOfSlice) {
|
|
522
|
+
const state = this;
|
|
523
|
+
const selectors = selectorsGenerator.apply(state, [stateOfSlice]);
|
|
524
|
+
const selectorArgs = [];
|
|
525
|
+
for (let i = 0; i < selectors.length - 1; i++) {
|
|
526
|
+
let selectorsEntry = selectors[i];
|
|
527
|
+
if (typeof selectorsEntry === "function") {
|
|
528
|
+
const selectorFunc = selectorsEntry;
|
|
529
|
+
selectorsEntry = selectorFunc.apply(state, [state]);
|
|
530
|
+
}
|
|
531
|
+
selectorArgs.push(selectorsEntry);
|
|
532
|
+
}
|
|
533
|
+
let finalSelector = selectors[selectors.length - 1];
|
|
534
|
+
if (typeof finalSelector === "function") {
|
|
535
|
+
const finalSelectorFunc = finalSelector;
|
|
536
|
+
finalSelector = finalSelectorFunc.apply(state, selectorArgs);
|
|
537
|
+
}
|
|
538
|
+
return finalSelector;
|
|
539
|
+
};
|
|
540
|
+
};
|
|
541
|
+
var leRedCreateCachedSelector = (selectorsGenerator, equalsComparator) => {
|
|
542
|
+
const validatedComparator = fixEqualsComparator(equalsComparator, "LeRed.createCachedSelector() was given an invalid comparator:");
|
|
543
|
+
let previousSelectorArgs = null;
|
|
544
|
+
let previousFinalSelectorResult = null;
|
|
545
|
+
return function(stateOfSlice) {
|
|
546
|
+
const state = this;
|
|
547
|
+
const selectors = selectorsGenerator.apply(state, [stateOfSlice]);
|
|
548
|
+
const selectorArgs = [];
|
|
549
|
+
for (let i = 0; i < selectors.length - 1; i++) {
|
|
550
|
+
let selectorsEntry = selectors[i];
|
|
551
|
+
if (typeof selectorsEntry === "function") {
|
|
552
|
+
const selectorFunc = selectorsEntry;
|
|
553
|
+
selectorsEntry = selectorFunc.apply(state, [state]);
|
|
554
|
+
}
|
|
555
|
+
selectorArgs.push(selectorsEntry);
|
|
556
|
+
}
|
|
557
|
+
let finalSelector = selectors[selectors.length - 1];
|
|
558
|
+
if (typeof finalSelector === "function") {
|
|
559
|
+
if (validatedComparator(previousSelectorArgs, selectorArgs) && previousFinalSelectorResult !== null) {
|
|
560
|
+
finalSelector = previousFinalSelectorResult;
|
|
561
|
+
} else {
|
|
562
|
+
const finalSelectorFunc = finalSelector;
|
|
563
|
+
const result = finalSelectorFunc.apply(state, selectorArgs);
|
|
564
|
+
finalSelector = result;
|
|
565
|
+
previousSelectorArgs = selectorArgs;
|
|
566
|
+
previousFinalSelectorResult = finalSelector;
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
return finalSelector;
|
|
570
|
+
};
|
|
571
|
+
};
|
|
572
|
+
var batch2 = ReactRedux.batch;
|
|
573
|
+
var connect2 = ReactRedux.connect;
|
|
574
|
+
var useSelector2 = leRedUseSelector;
|
|
575
|
+
var useDispatch2 = ReactRedux.useDispatch;
|
|
576
|
+
var useStore2 = ReactRedux.useStore;
|
|
577
|
+
var shallowEqual2 = ReactRedux.shallowEqual;
|
|
578
|
+
var eventChannel2 = ReduxSaga.eventChannel;
|
|
579
|
+
var buffers2 = ReduxSaga.buffers;
|
|
580
|
+
var detach2 = ReduxSaga.detach;
|
|
581
|
+
var END2 = ReduxSaga.END;
|
|
582
|
+
var isEnd2 = ReduxSaga.isEnd;
|
|
583
|
+
var channel2 = ReduxSaga.channel;
|
|
584
|
+
var multicastChannel2 = ReduxSaga.multicastChannel;
|
|
585
|
+
var stdChannel2 = ReduxSaga.stdChannel;
|
|
586
|
+
var runSaga2 = ReduxSaga.runSaga;
|
|
587
|
+
var useConfigureStore = (storeData) => {
|
|
588
|
+
return leRedUseMemo(() => configureStore2(storeData), [storeData], LeUtils.equals);
|
|
589
|
+
};
|
|
590
|
+
var useEffectInterval = (callable, comparingValues, intervalMs, fireImmediately, equalsComparator) => {
|
|
591
|
+
const callableRef = React.useRef(callable);
|
|
592
|
+
callableRef.current = callable;
|
|
593
|
+
leRedUseEffect(() => LeUtils.setInterval(() => callableRef.current(), intervalMs, fireImmediately).remove, [comparingValues, intervalMs, fireImmediately, equalsComparator], LeUtils.equals);
|
|
594
|
+
};
|
|
595
|
+
var useEffectAnimationFrameInterval = (callable, comparingValues, intervalFrames, fireImmediately, equalsComparator) => {
|
|
596
|
+
const callableRef = React.useRef(callable);
|
|
597
|
+
callableRef.current = callable;
|
|
598
|
+
leRedUseEffect(() => LeUtils.setAnimationFrameInterval(() => callableRef.current(), intervalFrames, fireImmediately).remove, [comparingValues, intervalFrames, fireImmediately, equalsComparator], LeUtils.equals);
|
|
599
|
+
};
|
|
600
|
+
var useEffectGenerator = (callable, comparingValues, _intervalMs, _fireImmediately, equalsComparator) => {
|
|
601
|
+
const callableRef = React.useRef(callable);
|
|
602
|
+
callableRef.current = callable;
|
|
603
|
+
leRedUseEffect(() => {
|
|
604
|
+
let stop = false;
|
|
605
|
+
(async () => {
|
|
606
|
+
for (const promise of callableRef.current()) {
|
|
607
|
+
if (stop) {
|
|
608
|
+
return;
|
|
609
|
+
}
|
|
610
|
+
await promise;
|
|
611
|
+
if (stop) {
|
|
612
|
+
return;
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
})();
|
|
616
|
+
return () => {
|
|
617
|
+
stop = true;
|
|
618
|
+
};
|
|
619
|
+
}, [comparingValues, equalsComparator], LeUtils.equals);
|
|
620
|
+
};
|
|
621
|
+
var useEffectGeneratorLoop = (callable, comparingValues, _intervalMs, _fireImmediately, equalsComparator) => {
|
|
622
|
+
const callableRef = React.useRef(callable);
|
|
623
|
+
callableRef.current = callable;
|
|
624
|
+
leRedUseEffect(() => {
|
|
625
|
+
let stop = false;
|
|
626
|
+
(async () => {
|
|
627
|
+
while (!stop) {
|
|
628
|
+
for (const promise of callableRef.current()) {
|
|
629
|
+
if (stop) {
|
|
630
|
+
return;
|
|
631
|
+
}
|
|
632
|
+
await promise;
|
|
633
|
+
if (stop) {
|
|
634
|
+
return;
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
})();
|
|
639
|
+
return () => {
|
|
640
|
+
stop = true;
|
|
641
|
+
};
|
|
642
|
+
}, [comparingValues, equalsComparator], LeUtils.equals);
|
|
643
|
+
};
|
|
644
|
+
var useEffectShutdown = (callable, comparingValues, equalsComparator) => {
|
|
645
|
+
leRedUseEffect(() => {
|
|
646
|
+
const run = () => {
|
|
647
|
+
callable();
|
|
648
|
+
};
|
|
649
|
+
globalThis?.addEventListener?.("beforeunload", run, { capture: true });
|
|
650
|
+
return () => {
|
|
651
|
+
globalThis?.removeEventListener?.("beforeunload", run, { capture: true });
|
|
652
|
+
run();
|
|
653
|
+
};
|
|
654
|
+
}, [comparingValues, equalsComparator], LeUtils.equals);
|
|
655
|
+
};
|
|
656
|
+
var useEffectPageFocusLost = (callable, comparingValues, equalsComparator) => {
|
|
657
|
+
const events = ["pagehide", "freeze", "blur", "visibilitychange"];
|
|
658
|
+
leRedUseEffect(() => {
|
|
659
|
+
const run = () => {
|
|
660
|
+
if (globalThis?.document?.visibilityState !== "hidden" && globalThis?.document?.hasFocus?.()) {
|
|
661
|
+
return;
|
|
662
|
+
}
|
|
663
|
+
callable();
|
|
664
|
+
};
|
|
665
|
+
events.forEach((type) => {
|
|
666
|
+
globalThis?.addEventListener?.(type, run, { capture: true });
|
|
667
|
+
});
|
|
668
|
+
return () => {
|
|
669
|
+
events.forEach((type) => {
|
|
670
|
+
globalThis?.removeEventListener?.(type, run, { capture: true });
|
|
671
|
+
});
|
|
672
|
+
};
|
|
673
|
+
}, [comparingValues, equalsComparator], LeUtils.equals);
|
|
674
|
+
};
|
|
675
|
+
var usePrevious = (value, initialValue) => {
|
|
676
|
+
const ref = React.useRef(initialValue);
|
|
677
|
+
leRedUseEffect(() => {
|
|
678
|
+
ref.current = value;
|
|
679
|
+
}, [value], LeUtils.equals);
|
|
680
|
+
return ref.current;
|
|
681
|
+
};
|
|
682
|
+
var useFont = (font) => {
|
|
683
|
+
const fontStr = "12px " + STRING(font).trim();
|
|
684
|
+
const [hasFont, setHasFont] = React.useState(false);
|
|
685
|
+
leRedUseEffect(() => {
|
|
686
|
+
if (!hasFont) {
|
|
687
|
+
if (!globalThis?.document?.fonts?.check) {
|
|
688
|
+
setHasFont(true);
|
|
689
|
+
return;
|
|
690
|
+
}
|
|
691
|
+
const handler = setInterval(() => {
|
|
692
|
+
try {
|
|
693
|
+
if (globalThis.document.fonts.check(fontStr)) {
|
|
694
|
+
clearInterval(handler);
|
|
695
|
+
setHasFont(true);
|
|
696
|
+
}
|
|
697
|
+
} catch (e) {
|
|
698
|
+
console.error(e);
|
|
699
|
+
clearInterval(handler);
|
|
700
|
+
setHasFont(true);
|
|
701
|
+
}
|
|
702
|
+
}, 30);
|
|
703
|
+
}
|
|
704
|
+
}, [hasFont], LeUtils.equals);
|
|
705
|
+
return hasFont;
|
|
706
|
+
};
|
|
707
|
+
var useScript = (url, props = {}) => {
|
|
708
|
+
leRedUseEffect(() => {
|
|
709
|
+
if (!globalThis?.document?.createElement || !globalThis?.document?.head?.appendChild || !globalThis?.document?.head?.removeChild) {
|
|
710
|
+
return;
|
|
711
|
+
}
|
|
712
|
+
const script = globalThis.document.createElement("script");
|
|
713
|
+
script.type = "text/javascript";
|
|
714
|
+
script.src = url;
|
|
715
|
+
LeUtils.each(props, (value, key) => {
|
|
716
|
+
script.setAttribute(STRING(key), STRING(value));
|
|
717
|
+
});
|
|
718
|
+
globalThis.document.head.appendChild(script);
|
|
719
|
+
return () => globalThis.document.head.removeChild(script);
|
|
720
|
+
}, [url, props], LeUtils.equals);
|
|
721
|
+
};
|
|
722
|
+
var mergeRefs = (...refs) => {
|
|
723
|
+
const flattenedRefs = LeUtils.flattenArray(refs);
|
|
724
|
+
if (!flattenedRefs) {
|
|
725
|
+
return null;
|
|
726
|
+
}
|
|
727
|
+
const newRefs = [];
|
|
728
|
+
LeUtils.each(flattenedRefs, (ref) => {
|
|
729
|
+
const isReactRef = (r) => {
|
|
730
|
+
return typeof r === "function" || !!r && typeof r === "object" && "current" in r || r === null;
|
|
731
|
+
};
|
|
732
|
+
if (isReactRef(ref) && ref !== null) {
|
|
733
|
+
newRefs.push(ref);
|
|
734
|
+
}
|
|
735
|
+
});
|
|
736
|
+
if (newRefs.length <= 0) {
|
|
737
|
+
return null;
|
|
738
|
+
}
|
|
739
|
+
const isMutableRefObject = (r) => {
|
|
740
|
+
return !!r && typeof r === "object" && "current" in r;
|
|
741
|
+
};
|
|
742
|
+
if (newRefs.length === 1) {
|
|
743
|
+
const singleRef = newRefs[0];
|
|
744
|
+
if (typeof singleRef === "function") {
|
|
745
|
+
return singleRef;
|
|
746
|
+
}
|
|
747
|
+
return (inst) => {
|
|
748
|
+
if (isMutableRefObject(singleRef)) {
|
|
749
|
+
singleRef.current = inst;
|
|
750
|
+
}
|
|
751
|
+
};
|
|
752
|
+
}
|
|
753
|
+
return (inst) => {
|
|
754
|
+
LeUtils.each(newRefs, (ref) => {
|
|
755
|
+
if (!ref) {
|
|
756
|
+
return;
|
|
757
|
+
}
|
|
758
|
+
try {
|
|
759
|
+
const isCallbackRef = (r) => {
|
|
760
|
+
return typeof r === "function";
|
|
761
|
+
};
|
|
762
|
+
if (isCallbackRef(ref)) {
|
|
763
|
+
ref(inst);
|
|
764
|
+
} else if (isMutableRefObject(ref)) {
|
|
765
|
+
ref.current = inst;
|
|
766
|
+
}
|
|
767
|
+
} catch (e) {
|
|
768
|
+
console.error(e);
|
|
769
|
+
}
|
|
770
|
+
});
|
|
771
|
+
};
|
|
772
|
+
};
|
|
773
|
+
var useTriggerable = (event) => {
|
|
774
|
+
const [[value], setValue] = React.useState([null, LeUtils.uniqueId()]);
|
|
775
|
+
leRedUseEffect(() => {
|
|
776
|
+
const globalObj = globalThis;
|
|
777
|
+
if (!globalObj.addEventListener || !globalObj.removeEventListener) {
|
|
778
|
+
return;
|
|
779
|
+
}
|
|
780
|
+
const callback = (e) => {
|
|
781
|
+
const isCustomEvent = (event2) => {
|
|
782
|
+
return "detail" in event2;
|
|
783
|
+
};
|
|
784
|
+
if (isCustomEvent(e)) {
|
|
785
|
+
setValue([e.detail, LeUtils.uniqueId()]);
|
|
786
|
+
}
|
|
787
|
+
};
|
|
788
|
+
const eventName = "lowentrytriggerable_" + event;
|
|
789
|
+
globalThis.addEventListener(eventName, callback);
|
|
790
|
+
return () => globalThis.removeEventListener(eventName, callback);
|
|
791
|
+
}, [event], LeUtils.equals);
|
|
792
|
+
return value;
|
|
793
|
+
};
|
|
794
|
+
var trigger = (event, value) => {
|
|
795
|
+
if (!globalThis?.dispatchEvent || typeof CustomEvent !== "function") {
|
|
796
|
+
return;
|
|
797
|
+
}
|
|
798
|
+
const eventName = "lowentrytriggerable_" + event;
|
|
799
|
+
globalThis.dispatchEvent(new CustomEvent(eventName, { detail: value }));
|
|
800
|
+
};
|
|
801
|
+
var useTempState = (defaultValue, duration) => {
|
|
802
|
+
const [value, setValue] = React.useState(defaultValue);
|
|
803
|
+
const timeoutHandle = React.useRef(null);
|
|
804
|
+
const defaultValueRef = React.useRef(defaultValue);
|
|
805
|
+
defaultValueRef.current = defaultValue;
|
|
806
|
+
const durationRef = React.useRef(duration);
|
|
807
|
+
durationRef.current = duration;
|
|
808
|
+
leRedUseEffect(() => {
|
|
809
|
+
return () => {
|
|
810
|
+
if (timeoutHandle.current) {
|
|
811
|
+
clearTimeout(timeoutHandle.current);
|
|
812
|
+
}
|
|
813
|
+
};
|
|
814
|
+
}, [], LeUtils.equals);
|
|
815
|
+
return [value, (newValue) => {
|
|
816
|
+
if (timeoutHandle.current) {
|
|
817
|
+
clearTimeout(timeoutHandle.current);
|
|
818
|
+
}
|
|
819
|
+
setValue(newValue);
|
|
820
|
+
timeoutHandle.current = setTimeout(() => {
|
|
821
|
+
timeoutHandle.current = null;
|
|
822
|
+
setValue(defaultValueRef.current);
|
|
823
|
+
}, durationRef.current);
|
|
824
|
+
}];
|
|
825
|
+
};
|
|
826
|
+
var historyStateListeners = [];
|
|
827
|
+
if (typeof globalThis !== "undefined") {
|
|
828
|
+
globalThis?.addEventListener?.("popstate", () => {
|
|
829
|
+
historyStateListeners.pop()?.callback();
|
|
830
|
+
});
|
|
831
|
+
}
|
|
832
|
+
var addHistoryListener = (callback) => {
|
|
833
|
+
const id = LeUtils.uniqueId();
|
|
834
|
+
historyStateListeners.push({ id, callback });
|
|
835
|
+
return id;
|
|
836
|
+
};
|
|
837
|
+
var removeHistoryListener = (id) => {
|
|
838
|
+
if (!id) {
|
|
839
|
+
return;
|
|
840
|
+
}
|
|
841
|
+
historyStateListeners = historyStateListeners.filter((listener) => listener.id !== id);
|
|
842
|
+
};
|
|
843
|
+
var useHistory = (onForward, onBack) => {
|
|
844
|
+
const remaining = React.useRef(0);
|
|
845
|
+
const id = React.useRef(null);
|
|
846
|
+
const onForwardRef = React.useRef(onForward);
|
|
847
|
+
onForwardRef.current = onForward;
|
|
848
|
+
const onBackRef = React.useRef(onBack);
|
|
849
|
+
onBackRef.current = onBack;
|
|
850
|
+
const goBack = leRedUseCallback(() => {
|
|
851
|
+
if (remaining.current <= 0) {
|
|
852
|
+
return;
|
|
853
|
+
}
|
|
854
|
+
remaining.current--;
|
|
855
|
+
if (remaining.current === 0) {
|
|
856
|
+
if (id.current) {
|
|
857
|
+
removeHistoryListener(id.current);
|
|
858
|
+
}
|
|
859
|
+
id.current = null;
|
|
860
|
+
}
|
|
861
|
+
onBackRef.current();
|
|
862
|
+
}, [], LeUtils.equals);
|
|
863
|
+
leRedUseEffect(() => {
|
|
864
|
+
return () => {
|
|
865
|
+
if (id.current) {
|
|
866
|
+
removeHistoryListener(id.current);
|
|
867
|
+
}
|
|
868
|
+
};
|
|
869
|
+
}, [], LeUtils.equals);
|
|
870
|
+
return [
|
|
871
|
+
() => {
|
|
872
|
+
if (typeof window !== "undefined" && window.history) {
|
|
873
|
+
window.history.pushState(null, "", window.location.pathname + window.location.search + "#");
|
|
874
|
+
}
|
|
875
|
+
remaining.current++;
|
|
876
|
+
if (remaining.current === 1) {
|
|
877
|
+
if (id.current) {
|
|
878
|
+
removeHistoryListener(id.current);
|
|
879
|
+
}
|
|
880
|
+
id.current = addHistoryListener(goBack);
|
|
881
|
+
}
|
|
882
|
+
onForwardRef.current();
|
|
883
|
+
},
|
|
884
|
+
() => {
|
|
885
|
+
if (remaining.current > 0) {
|
|
886
|
+
if (typeof window !== "undefined" && window.history) {
|
|
887
|
+
window.history.back();
|
|
888
|
+
}
|
|
889
|
+
}
|
|
890
|
+
}
|
|
891
|
+
];
|
|
892
|
+
};
|
|
893
|
+
var useHistoryState = (initialState) => {
|
|
894
|
+
const [state, setState] = React.useState(!!initialState);
|
|
895
|
+
const [forwards, backwards] = useHistory(() => setState(!initialState), () => setState(!!initialState));
|
|
896
|
+
if (initialState) {
|
|
897
|
+
return [state, backwards, forwards];
|
|
898
|
+
}
|
|
899
|
+
return [state, forwards, backwards];
|
|
900
|
+
};
|
|
901
|
+
var useUrlHashParams = () => {
|
|
902
|
+
const getHashString = () => globalThis?.location?.hash?.trim()?.replace(/^#/, "") ?? "";
|
|
903
|
+
const parseHashParams = (hashString2) => Object.fromEntries(new URLSearchParams(hashString2));
|
|
904
|
+
const [hashString, setHashString] = React.useState(getHashString);
|
|
905
|
+
const hashParams = leRedUseMemo(() => parseHashParams(hashString), [hashString], LeUtils.equals);
|
|
906
|
+
leRedUseEffect(() => {
|
|
907
|
+
const onUrlChanged = () => {
|
|
908
|
+
setHashString(getHashString());
|
|
909
|
+
};
|
|
910
|
+
globalThis?.addEventListener?.("hashchange", onUrlChanged);
|
|
911
|
+
return () => {
|
|
912
|
+
globalThis?.removeEventListener?.("hashchange", onUrlChanged);
|
|
913
|
+
};
|
|
914
|
+
}, [], LeUtils.equals);
|
|
915
|
+
return [hashParams, hashString];
|
|
916
|
+
};
|
|
917
|
+
var useRetryingImageUrl = (url, options) => {
|
|
918
|
+
const normalizedUrl = STRING(url);
|
|
919
|
+
const urlHasQ = normalizedUrl.includes("?");
|
|
920
|
+
const [imageUrl, setImageUrl] = React.useState(normalizedUrl);
|
|
921
|
+
const retries = React.useRef(0);
|
|
922
|
+
const timeout = React.useRef({ remove: () => void 0 });
|
|
923
|
+
leRedUseEffect(() => {
|
|
924
|
+
return () => timeout.current.remove();
|
|
925
|
+
}, [], LeUtils.equals);
|
|
926
|
+
leRedUseEffect(() => {
|
|
927
|
+
timeout.current.remove();
|
|
928
|
+
retries.current = 0;
|
|
929
|
+
setImageUrl(normalizedUrl);
|
|
930
|
+
}, [normalizedUrl], LeUtils.equals);
|
|
931
|
+
const onImageLoadError = leRedUseCallback(() => {
|
|
932
|
+
if (retries.current < INT_LAX_ANY(options?.retries, 30)) {
|
|
933
|
+
const defaultDelay = 100 + 50 * retries.current;
|
|
934
|
+
timeout.current.remove();
|
|
935
|
+
timeout.current = LeUtils.setTimeout(() => {
|
|
936
|
+
setImageUrl(normalizedUrl + (urlHasQ ? "&" : "?") + (options?.queryParam || "lowentryretryingimgversion") + "=" + retries.current++);
|
|
937
|
+
}, typeof options?.delay === "function" ? INT_LAX_ANY(options?.delay(retries.current), defaultDelay) : INT_LAX_ANY(options?.delay, defaultDelay));
|
|
938
|
+
}
|
|
939
|
+
}, [normalizedUrl, options, urlHasQ], LeUtils.equals);
|
|
940
|
+
const onImageLoadErrorIgnored = leRedUseCallback(() => {
|
|
941
|
+
}, [], LeUtils.equals);
|
|
942
|
+
if (!normalizedUrl) {
|
|
943
|
+
return [normalizedUrl, onImageLoadErrorIgnored];
|
|
944
|
+
}
|
|
945
|
+
return [imageUrl, onImageLoadError];
|
|
946
|
+
};
|
|
947
|
+
var usePromises = (callable, comparingValues) => {
|
|
948
|
+
const comparingValuesClone = LeUtils.clone(comparingValues);
|
|
949
|
+
const comparingValuesRef = React.useRef(comparingValuesClone);
|
|
950
|
+
const latestComparingValuesRef = React.useRef(null);
|
|
951
|
+
latestComparingValuesRef.current = comparingValuesClone;
|
|
952
|
+
const callableRef = React.useRef(callable);
|
|
953
|
+
callableRef.current = callable;
|
|
954
|
+
const [data, setData] = React.useState(null);
|
|
955
|
+
const [loading, setLoading] = React.useState(true);
|
|
956
|
+
const [error, setError] = React.useState(null);
|
|
957
|
+
leRedUseEffect(() => {
|
|
958
|
+
setLoading(true);
|
|
959
|
+
setData(null);
|
|
960
|
+
setError(null);
|
|
961
|
+
try {
|
|
962
|
+
const promises = callableRef.current();
|
|
963
|
+
let promisesIsObject = false;
|
|
964
|
+
if (IS_OBJECT(promises)) {
|
|
965
|
+
if ("then" in promises && typeof promises.then === "function") {
|
|
966
|
+
promisesIsObject = false;
|
|
967
|
+
} else {
|
|
968
|
+
promisesIsObject = true;
|
|
969
|
+
}
|
|
970
|
+
}
|
|
971
|
+
const promisesIsArray = IS_ARRAY(promises);
|
|
972
|
+
const promisesKeyed = [];
|
|
973
|
+
if (promisesIsObject || promisesIsArray) {
|
|
974
|
+
LeUtils.each(promises, (promise, key) => {
|
|
975
|
+
if (promise && typeof promise === "object" && "then" in promise && typeof promise.then === "function") {
|
|
976
|
+
promisesKeyed.push({ promise, key });
|
|
977
|
+
}
|
|
978
|
+
});
|
|
979
|
+
} else {
|
|
980
|
+
if (promises && typeof promises === "object" && "then" in promises && typeof promises.then === "function") {
|
|
981
|
+
promisesKeyed.push({ promise: promises, key: void 0 });
|
|
982
|
+
}
|
|
983
|
+
}
|
|
984
|
+
const wrappedPromises = [];
|
|
985
|
+
LeUtils.each(promisesKeyed, (item) => {
|
|
986
|
+
if (item && typeof item === "object" && "promise" in item && "key" in item) {
|
|
987
|
+
const typedItem = item;
|
|
988
|
+
wrappedPromises.push(typedItem.promise.then(async (result) => ({ result, key: typedItem.key })));
|
|
989
|
+
}
|
|
990
|
+
});
|
|
991
|
+
Promise.all(wrappedPromises).then((resultObjects) => {
|
|
992
|
+
if (promisesIsObject) {
|
|
993
|
+
const results = {};
|
|
994
|
+
LeUtils.each(resultObjects, (item) => {
|
|
995
|
+
if (item && typeof item === "object" && "result" in item && "key" in item) {
|
|
996
|
+
const typedItem = item;
|
|
997
|
+
results[STRING(typedItem.key)] = typedItem.result;
|
|
998
|
+
}
|
|
999
|
+
});
|
|
1000
|
+
return results;
|
|
1001
|
+
} else if (promisesIsArray) {
|
|
1002
|
+
const results = [];
|
|
1003
|
+
LeUtils.each(resultObjects, (item) => {
|
|
1004
|
+
if (item && typeof item === "object" && "result" in item && "key" in item) {
|
|
1005
|
+
const typedItem = item;
|
|
1006
|
+
const keyNum = typeof typedItem.key === "number" ? typedItem.key : 0;
|
|
1007
|
+
results[keyNum] = typedItem.result;
|
|
1008
|
+
}
|
|
1009
|
+
});
|
|
1010
|
+
return results;
|
|
1011
|
+
}
|
|
1012
|
+
const lastResult = resultObjects.pop();
|
|
1013
|
+
return lastResult?.result ?? null;
|
|
1014
|
+
}).then((results) => {
|
|
1015
|
+
if (!LeUtils.equals(latestComparingValuesRef.current, comparingValuesClone)) {
|
|
1016
|
+
return;
|
|
1017
|
+
}
|
|
1018
|
+
comparingValuesRef.current = comparingValuesClone;
|
|
1019
|
+
setLoading(false);
|
|
1020
|
+
setData(results);
|
|
1021
|
+
setError(null);
|
|
1022
|
+
}).catch((errorObj) => {
|
|
1023
|
+
if (!LeUtils.equals(latestComparingValuesRef.current, comparingValuesClone)) {
|
|
1024
|
+
return;
|
|
1025
|
+
}
|
|
1026
|
+
comparingValuesRef.current = comparingValuesClone;
|
|
1027
|
+
setLoading(false);
|
|
1028
|
+
setData(null);
|
|
1029
|
+
setError(LeUtils.purgeErrorMessage(errorObj));
|
|
1030
|
+
});
|
|
1031
|
+
return () => {
|
|
1032
|
+
LeUtils.each(wrappedPromises, (promise) => {
|
|
1033
|
+
try {
|
|
1034
|
+
if (promise && typeof promise === "object" && "cancel" in promise && typeof promise.cancel === "function") {
|
|
1035
|
+
promise.cancel();
|
|
1036
|
+
}
|
|
1037
|
+
} catch (e) {
|
|
1038
|
+
console.error("Failed to cancel the given promise:", e);
|
|
1039
|
+
}
|
|
1040
|
+
});
|
|
1041
|
+
};
|
|
1042
|
+
} catch (errorObj) {
|
|
1043
|
+
LeUtils.setAnimationFrameTimeout(() => {
|
|
1044
|
+
if (!LeUtils.equals(latestComparingValuesRef.current, comparingValuesClone)) {
|
|
1045
|
+
return;
|
|
1046
|
+
}
|
|
1047
|
+
comparingValuesRef.current = comparingValuesClone;
|
|
1048
|
+
setLoading(false);
|
|
1049
|
+
setData(null);
|
|
1050
|
+
setError(LeUtils.purgeErrorMessage(errorObj));
|
|
1051
|
+
}, 1);
|
|
1052
|
+
}
|
|
1053
|
+
}, [comparingValuesClone], LeUtils.equals);
|
|
1054
|
+
if (!LeUtils.equals(comparingValuesRef.current, comparingValuesClone)) {
|
|
1055
|
+
return [null, true, null];
|
|
1056
|
+
}
|
|
1057
|
+
return [data, loading, error];
|
|
1058
|
+
};
|
|
1059
|
+
var useExternal = (url, options, responseFunction) => {
|
|
1060
|
+
return usePromises(() => {
|
|
1061
|
+
const createFetch = (urlString) => {
|
|
1062
|
+
const fetchResult = LeUtils.fetch(STRING(urlString), { retries: 3, ...options ?? {} });
|
|
1063
|
+
return new Promise((resolve, reject) => {
|
|
1064
|
+
if (fetchResult && typeof fetchResult === "object" && "then" in fetchResult && typeof fetchResult.then === "function") {
|
|
1065
|
+
fetchResult.then(async (response) => {
|
|
1066
|
+
const data = await responseFunction(response);
|
|
1067
|
+
if (typeof options?.verify === "function") {
|
|
1068
|
+
await options.verify(data, response);
|
|
1069
|
+
}
|
|
1070
|
+
resolve(data);
|
|
1071
|
+
}, reject);
|
|
1072
|
+
} else {
|
|
1073
|
+
reject(new Error("LeUtils.fetch did not return a promise-like object"));
|
|
1074
|
+
}
|
|
1075
|
+
});
|
|
1076
|
+
};
|
|
1077
|
+
if (IS_OBJECT(url)) {
|
|
1078
|
+
const promises = {};
|
|
1079
|
+
LeUtils.each(url, (urlString, key) => {
|
|
1080
|
+
promises[STRING(key)] = createFetch(urlString);
|
|
1081
|
+
});
|
|
1082
|
+
return promises;
|
|
1083
|
+
}
|
|
1084
|
+
if (IS_ARRAY(url)) {
|
|
1085
|
+
const promises = [];
|
|
1086
|
+
LeUtils.each(url, (urlString) => {
|
|
1087
|
+
promises.push(createFetch(urlString));
|
|
1088
|
+
});
|
|
1089
|
+
return promises;
|
|
1090
|
+
}
|
|
1091
|
+
return createFetch(url);
|
|
1092
|
+
}, [url, options, responseFunction]);
|
|
1093
|
+
};
|
|
1094
|
+
var useExternalJson = (url, options) => {
|
|
1095
|
+
const responseFunction = leRedUseCallback((response) => response.json(), [], LeUtils.equals);
|
|
1096
|
+
return useExternal(url, options, responseFunction);
|
|
1097
|
+
};
|
|
1098
|
+
var useExternalBlob = (url, options) => {
|
|
1099
|
+
const responseFunction = leRedUseCallback((response) => response.blob(), [], LeUtils.equals);
|
|
1100
|
+
return useExternal(url, options, responseFunction);
|
|
1101
|
+
};
|
|
1102
|
+
var useExternalArrayBuffer = (url, options) => {
|
|
1103
|
+
const responseFunction = leRedUseCallback((response) => response.arrayBuffer(), [], LeUtils.equals);
|
|
1104
|
+
return useExternal(url, options, responseFunction);
|
|
1105
|
+
};
|
|
1106
|
+
var useExternalString = (url, options) => {
|
|
1107
|
+
const responseFunction = leRedUseCallback((response) => response.text(), [], LeUtils.equals);
|
|
1108
|
+
return useExternal(url, options, responseFunction);
|
|
1109
|
+
};
|
|
1110
|
+
var useExternalFormData = (url, options) => {
|
|
1111
|
+
const responseFunction = leRedUseCallback((response) => response.formData(), [], LeUtils.equals);
|
|
1112
|
+
return useExternal(url, options, responseFunction);
|
|
1113
|
+
};
|
|
1114
|
+
var delayFrames = function* (frames = 1) {
|
|
1115
|
+
yield ReduxSagaEffects.call(() => {
|
|
1116
|
+
return new Promise((resolve, reject) => {
|
|
1117
|
+
try {
|
|
1118
|
+
LeUtils.setAnimationFrameTimeout(() => resolve(), frames);
|
|
1119
|
+
} catch (e) {
|
|
1120
|
+
reject(e);
|
|
1121
|
+
}
|
|
1122
|
+
});
|
|
1123
|
+
});
|
|
1124
|
+
};
|
|
1125
|
+
var interval = function* (callback, intervalMs) {
|
|
1126
|
+
let channelVar = eventChannel2((emitter) => {
|
|
1127
|
+
const intervalHandle = setInterval(() => {
|
|
1128
|
+
emitter({});
|
|
1129
|
+
}, intervalMs);
|
|
1130
|
+
return () => {
|
|
1131
|
+
clearInterval(intervalHandle);
|
|
1132
|
+
};
|
|
1133
|
+
});
|
|
1134
|
+
const stop = () => {
|
|
1135
|
+
try {
|
|
1136
|
+
if (channelVar !== null) {
|
|
1137
|
+
channelVar.close();
|
|
1138
|
+
channelVar = null;
|
|
1139
|
+
}
|
|
1140
|
+
} catch (e) {
|
|
1141
|
+
console.error(e);
|
|
1142
|
+
}
|
|
1143
|
+
};
|
|
1144
|
+
while (channelVar !== null) {
|
|
1145
|
+
try {
|
|
1146
|
+
yield ReduxSagaEffects.take(channelVar);
|
|
1147
|
+
yield callback(stop);
|
|
1148
|
+
} catch (e) {
|
|
1149
|
+
console.error(e);
|
|
1150
|
+
} finally {
|
|
1151
|
+
try {
|
|
1152
|
+
if (yield ReduxSagaEffects.cancelled()) {
|
|
1153
|
+
channelVar.close();
|
|
1154
|
+
channelVar = null;
|
|
1155
|
+
}
|
|
1156
|
+
} catch (e) {
|
|
1157
|
+
console.error(e);
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1160
|
+
}
|
|
1161
|
+
};
|
|
1162
|
+
var effects = {
|
|
1163
|
+
...ReduxSagaEffects,
|
|
1164
|
+
delayFrames,
|
|
1165
|
+
interval
|
|
1166
|
+
};
|
|
1167
|
+
var Root = memo2(({ store, children, ...other }) => {
|
|
1168
|
+
if (ISSET(store)) {
|
|
1169
|
+
const configuredStore = configureStore2(store);
|
|
1170
|
+
return /* @__PURE__ */ jsx(ReactRedux.Provider, { store: configuredStore, children, ...other });
|
|
1171
|
+
}
|
|
1172
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
1173
|
+
}, LeUtils.equals);
|
|
1174
|
+
var PreloadComponent = (load) => {
|
|
1175
|
+
if (typeof window !== "undefined") {
|
|
1176
|
+
const promise = load();
|
|
1177
|
+
return () => promise;
|
|
1178
|
+
}
|
|
1179
|
+
return load;
|
|
1180
|
+
};
|
|
1181
|
+
var LoadComponent = memo2(({ loading, load, ...other }) => {
|
|
1182
|
+
const [Component, setComponent] = React.useState(loading ?? null);
|
|
1183
|
+
leRedUseEffect(() => {
|
|
1184
|
+
(async () => {
|
|
1185
|
+
const LoadedComponent = typeof load === "function" ? await load() : await load;
|
|
1186
|
+
if (!LoadedComponent) {
|
|
1187
|
+
setComponent(null);
|
|
1188
|
+
return;
|
|
1189
|
+
}
|
|
1190
|
+
setComponent(/* @__PURE__ */ jsx(LoadedComponent, { ...other }));
|
|
1191
|
+
})();
|
|
1192
|
+
}, [], LeUtils.equals);
|
|
1193
|
+
return Component;
|
|
1194
|
+
}, LeUtils.equals);
|
|
1195
|
+
var LeRedBase = {
|
|
1196
|
+
// React Hooks
|
|
1197
|
+
useState: useState2,
|
|
1198
|
+
useEffect: useEffect2,
|
|
1199
|
+
useLayoutEffect: useLayoutEffect2,
|
|
1200
|
+
useContext: useContext2,
|
|
1201
|
+
useReducer: useReducer2,
|
|
1202
|
+
useCallback: useCallback2,
|
|
1203
|
+
useMemo: useMemo2,
|
|
1204
|
+
useRef: useRef2,
|
|
1205
|
+
useImperativeHandle: useImperativeHandle2,
|
|
1206
|
+
useDebugValue: useDebugValue2,
|
|
1207
|
+
useDeferredValue: useDeferredValue2,
|
|
1208
|
+
useTransition: useTransition2,
|
|
1209
|
+
useSyncExternalStore: useSyncExternalStore2,
|
|
1210
|
+
useId: useId2,
|
|
1211
|
+
useInsertionEffect: useInsertionEffect2,
|
|
1212
|
+
// React Utils
|
|
1213
|
+
createContext: createContext2,
|
|
1214
|
+
createElement: createElement2,
|
|
1215
|
+
cloneElement: cloneElement2,
|
|
1216
|
+
isValidElement: isValidElement2,
|
|
1217
|
+
lazy: lazy2,
|
|
1218
|
+
forwardRef: forwardRef2,
|
|
1219
|
+
memo: memo2,
|
|
1220
|
+
startTransition: startTransition2,
|
|
1221
|
+
// ReactDOM
|
|
1222
|
+
createPortal: createPortal2,
|
|
1223
|
+
flushSync: flushSync2,
|
|
1224
|
+
// Redux / RTK
|
|
1225
|
+
combineReducers: combineReducers2,
|
|
1226
|
+
applyMiddleware: applyMiddleware2,
|
|
1227
|
+
compose: compose2,
|
|
1228
|
+
bindActionCreators: bindActionCreators2,
|
|
1229
|
+
configureStore: configureStore2,
|
|
1230
|
+
createSlice: createSlice2,
|
|
1231
|
+
createFastSlice,
|
|
1232
|
+
createAction: leRedCreateAction,
|
|
1233
|
+
createReducer: createReducer2,
|
|
1234
|
+
createAsyncThunk: createAsyncThunk2,
|
|
1235
|
+
createEntityAdapter: createEntityAdapter2,
|
|
1236
|
+
createSelector: leRedCreateSelector,
|
|
1237
|
+
createCachedSelector: leRedCreateCachedSelector,
|
|
1238
|
+
createNextState: createNextState2,
|
|
1239
|
+
produce,
|
|
1240
|
+
freeze: freeze2,
|
|
1241
|
+
isDraft: isDraft2,
|
|
1242
|
+
original: original2,
|
|
1243
|
+
combineSlices: combineSlices2,
|
|
1244
|
+
createListenerMiddleware: createListenerMiddleware2,
|
|
1245
|
+
createDynamicMiddleware: createDynamicMiddleware2,
|
|
1246
|
+
autoBatchEnhancer: autoBatchEnhancer2,
|
|
1247
|
+
isAnyOf: isAnyOf2,
|
|
1248
|
+
isAllOf: isAllOf2,
|
|
1249
|
+
isPending: isPending2,
|
|
1250
|
+
isFulfilled: isFulfilled2,
|
|
1251
|
+
isRejected: isRejected2,
|
|
1252
|
+
isAsyncThunkAction: isAsyncThunkAction2,
|
|
1253
|
+
isRejectedWithValue: isRejectedWithValue2,
|
|
1254
|
+
nanoid: nanoid2,
|
|
1255
|
+
current: current2,
|
|
1256
|
+
isImmutableDefault: isImmutableDefault2,
|
|
1257
|
+
unwrapResult: unwrapResult2,
|
|
1258
|
+
// React-Redux
|
|
1259
|
+
useSelector: useSelector2,
|
|
1260
|
+
useDispatch: useDispatch2,
|
|
1261
|
+
useStore: useStore2,
|
|
1262
|
+
shallowEqual: shallowEqual2,
|
|
1263
|
+
batch: batch2,
|
|
1264
|
+
connect: connect2,
|
|
1265
|
+
// Redux-Saga
|
|
1266
|
+
eventChannel: eventChannel2,
|
|
1267
|
+
buffers: buffers2,
|
|
1268
|
+
detach: detach2,
|
|
1269
|
+
channel: channel2,
|
|
1270
|
+
multicastChannel: multicastChannel2,
|
|
1271
|
+
stdChannel: stdChannel2,
|
|
1272
|
+
runSaga: runSaga2,
|
|
1273
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
1274
|
+
END: END2,
|
|
1275
|
+
isEnd: isEnd2,
|
|
1276
|
+
effects,
|
|
1277
|
+
// Custom Hooks
|
|
1278
|
+
useConfigureStore,
|
|
1279
|
+
useEffectInterval,
|
|
1280
|
+
useEffectAnimationFrameInterval,
|
|
1281
|
+
useEffectGenerator,
|
|
1282
|
+
useEffectGeneratorLoop,
|
|
1283
|
+
useEffectShutdown,
|
|
1284
|
+
useEffectPageFocusLost,
|
|
1285
|
+
usePrevious,
|
|
1286
|
+
useFont,
|
|
1287
|
+
useScript,
|
|
1288
|
+
mergeRefs,
|
|
1289
|
+
useTriggerable,
|
|
1290
|
+
trigger,
|
|
1291
|
+
useTempState,
|
|
1292
|
+
useHistory,
|
|
1293
|
+
useHistoryState,
|
|
1294
|
+
useUrlHashParams,
|
|
1295
|
+
useRetryingImageUrl,
|
|
1296
|
+
usePromises,
|
|
1297
|
+
useExternal,
|
|
1298
|
+
useExternalJson,
|
|
1299
|
+
useExternalBlob,
|
|
1300
|
+
useExternalArrayBuffer,
|
|
1301
|
+
useExternalString,
|
|
1302
|
+
useExternalFormData,
|
|
1303
|
+
// Components (React components use PascalCase by convention)
|
|
1304
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
1305
|
+
Root,
|
|
1306
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
1307
|
+
LoadComponent,
|
|
1308
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
1309
|
+
PreloadComponent
|
|
1310
|
+
};
|
|
1311
|
+
var LeRedProxy = new Proxy(LeRedBase, {
|
|
1312
|
+
get: (target, prop) => {
|
|
1313
|
+
if (typeof prop === "string" && !(prop in target)) {
|
|
1314
|
+
if (prop === "set" || prop === "setAll") {
|
|
1315
|
+
console.error(`LeRed.${prop} is no longer supported in current version.`);
|
|
1316
|
+
return void 0;
|
|
1317
|
+
}
|
|
1318
|
+
if (prop === "register" || prop === "navigate" || prop === "graphql") {
|
|
1319
|
+
console.error(`LeRed.${prop} is no longer available. For Gatsby, import from 'gatsby' directly. For Firebase, use the '@lowentry/firebase' package with {LeFirebase}.`);
|
|
1320
|
+
return void 0;
|
|
1321
|
+
}
|
|
1322
|
+
if (prop.startsWith("firebase") || prop.startsWith("useAuth") || prop.startsWith("useDoc") || prop.startsWith("useList") || prop.startsWith("useObject") || prop === "setDocument" || prop === "updateDocument" || prop === "deleteDocument" || prop === "addDocument" || prop === "signOut" || prop === "signIn" || prop === "sendPassword" || prop === "createUser" || prop === "fetchSign" || prop === "trace" || prop === "getPerformance" || prop === "initializeFirestore" || prop === "getDatabase" || prop === "getAuth" || prop === "getAnalytics") {
|
|
1323
|
+
console.error(`LeRed.${prop} is no longer available. Please use {LeFirebase} from '@lowentry/firebase' instead.`);
|
|
1324
|
+
return void 0;
|
|
1325
|
+
}
|
|
1326
|
+
const firstChar = prop.charAt(0);
|
|
1327
|
+
if (firstChar === firstChar.toUpperCase() && firstChar !== firstChar.toLowerCase()) {
|
|
1328
|
+
console.error(`LeRed.${prop} is not available on the LeRed object. Please use the original library (like React or MUI) instead.`);
|
|
1329
|
+
return void 0;
|
|
1330
|
+
} else {
|
|
1331
|
+
console.warn(`LeRed.${prop} is not available. Please use the original library (like React or Redux) instead.`);
|
|
1332
|
+
return void 0;
|
|
1333
|
+
}
|
|
1334
|
+
}
|
|
1335
|
+
if (typeof prop === "symbol") {
|
|
1336
|
+
return target[prop];
|
|
1337
|
+
}
|
|
1338
|
+
return target[prop];
|
|
1339
|
+
}
|
|
1340
|
+
});
|
|
1341
|
+
var LeRed = LeRedProxy;
|
|
1342
|
+
export {
|
|
1343
|
+
Children2 as Children,
|
|
1344
|
+
END2 as END,
|
|
1345
|
+
LeRed,
|
|
1346
|
+
LoadComponent,
|
|
1347
|
+
PreloadComponent,
|
|
1348
|
+
Root,
|
|
1349
|
+
applyMiddleware2 as applyMiddleware,
|
|
1350
|
+
autoBatchEnhancer2 as autoBatchEnhancer,
|
|
1351
|
+
batch2 as batch,
|
|
1352
|
+
bindActionCreators2 as bindActionCreators,
|
|
1353
|
+
buffers2 as buffers,
|
|
1354
|
+
channel2 as channel,
|
|
1355
|
+
cloneElement2 as cloneElement,
|
|
1356
|
+
combineReducers2 as combineReducers,
|
|
1357
|
+
combineSlices2 as combineSlices,
|
|
1358
|
+
compose2 as compose,
|
|
1359
|
+
configureStore2 as configureStore,
|
|
1360
|
+
connect2 as connect,
|
|
1361
|
+
createAsyncThunk2 as createAsyncThunk,
|
|
1362
|
+
createContext2 as createContext,
|
|
1363
|
+
createDynamicMiddleware2 as createDynamicMiddleware,
|
|
1364
|
+
createElement2 as createElement,
|
|
1365
|
+
createEntityAdapter2 as createEntityAdapter,
|
|
1366
|
+
createFastSlice,
|
|
1367
|
+
createListenerMiddleware2 as createListenerMiddleware,
|
|
1368
|
+
createNextState2 as createNextState,
|
|
1369
|
+
createPortal2 as createPortal,
|
|
1370
|
+
createReducer2 as createReducer,
|
|
1371
|
+
createSlice2 as createSlice,
|
|
1372
|
+
current2 as current,
|
|
1373
|
+
delayFrames,
|
|
1374
|
+
detach2 as detach,
|
|
1375
|
+
effects,
|
|
1376
|
+
eventChannel2 as eventChannel,
|
|
1377
|
+
flushSync2 as flushSync,
|
|
1378
|
+
forwardRef2 as forwardRef,
|
|
1379
|
+
freeze2 as freeze,
|
|
1380
|
+
interval,
|
|
1381
|
+
isAllOf2 as isAllOf,
|
|
1382
|
+
isAnyOf2 as isAnyOf,
|
|
1383
|
+
isAsyncThunkAction2 as isAsyncThunkAction,
|
|
1384
|
+
isDraft2 as isDraft,
|
|
1385
|
+
isEnd2 as isEnd,
|
|
1386
|
+
isFulfilled2 as isFulfilled,
|
|
1387
|
+
isImmutableDefault2 as isImmutableDefault,
|
|
1388
|
+
isPending2 as isPending,
|
|
1389
|
+
isRejected2 as isRejected,
|
|
1390
|
+
isRejectedWithValue2 as isRejectedWithValue,
|
|
1391
|
+
isValidElement2 as isValidElement,
|
|
1392
|
+
lazy2 as lazy,
|
|
1393
|
+
leRedCreateAction,
|
|
1394
|
+
leRedCreateCachedSelector,
|
|
1395
|
+
leRedCreateSelector,
|
|
1396
|
+
leRedMemo,
|
|
1397
|
+
leRedUseCallback,
|
|
1398
|
+
leRedUseEffect,
|
|
1399
|
+
leRedUseLayoutEffect,
|
|
1400
|
+
leRedUseMemo,
|
|
1401
|
+
leRedUseSelector,
|
|
1402
|
+
memo2 as memo,
|
|
1403
|
+
mergeRefs,
|
|
1404
|
+
multicastChannel2 as multicastChannel,
|
|
1405
|
+
nanoid2 as nanoid,
|
|
1406
|
+
original2 as original,
|
|
1407
|
+
produce,
|
|
1408
|
+
runSaga2 as runSaga,
|
|
1409
|
+
shallowEqual2 as shallowEqual,
|
|
1410
|
+
startTransition2 as startTransition,
|
|
1411
|
+
stdChannel2 as stdChannel,
|
|
1412
|
+
trigger,
|
|
1413
|
+
unwrapResult2 as unwrapResult,
|
|
1414
|
+
useCallback2 as useCallback,
|
|
1415
|
+
useConfigureStore,
|
|
1416
|
+
useContext2 as useContext,
|
|
1417
|
+
useDebugValue2 as useDebugValue,
|
|
1418
|
+
useDeferredValue2 as useDeferredValue,
|
|
1419
|
+
useDispatch2 as useDispatch,
|
|
1420
|
+
useEffect2 as useEffect,
|
|
1421
|
+
useEffectAnimationFrameInterval,
|
|
1422
|
+
useEffectGenerator,
|
|
1423
|
+
useEffectGeneratorLoop,
|
|
1424
|
+
useEffectInterval,
|
|
1425
|
+
useEffectPageFocusLost,
|
|
1426
|
+
useEffectShutdown,
|
|
1427
|
+
useExternal,
|
|
1428
|
+
useExternalArrayBuffer,
|
|
1429
|
+
useExternalBlob,
|
|
1430
|
+
useExternalFormData,
|
|
1431
|
+
useExternalJson,
|
|
1432
|
+
useExternalString,
|
|
1433
|
+
useFont,
|
|
1434
|
+
useHistory,
|
|
1435
|
+
useHistoryState,
|
|
1436
|
+
useId2 as useId,
|
|
1437
|
+
useImperativeHandle2 as useImperativeHandle,
|
|
1438
|
+
useInsertionEffect2 as useInsertionEffect,
|
|
1439
|
+
useLayoutEffect2 as useLayoutEffect,
|
|
1440
|
+
useMemo2 as useMemo,
|
|
1441
|
+
usePrevious,
|
|
1442
|
+
usePromises,
|
|
1443
|
+
useReducer2 as useReducer,
|
|
1444
|
+
useRef2 as useRef,
|
|
1445
|
+
useRetryingImageUrl,
|
|
1446
|
+
useScript,
|
|
1447
|
+
useSelector2 as useSelector,
|
|
1448
|
+
useState2 as useState,
|
|
1449
|
+
useStore2 as useStore,
|
|
1450
|
+
useSyncExternalStore2 as useSyncExternalStore,
|
|
1451
|
+
useTempState,
|
|
1452
|
+
useTransition2 as useTransition,
|
|
1453
|
+
useTriggerable,
|
|
1454
|
+
useUrlHashParams
|
|
1455
|
+
};
|
|
1456
|
+
//# sourceMappingURL=index.js.map
|