@trackunit/react-core-contexts-test 0.1.77 → 0.1.78
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/HookRenderer.cjs +1 -0
- package/HookRenderer.js +1 -0
- package/index.cjs +1 -0
- package/index.js +1 -0
- package/index2.cjs +2 -520
- package/index2.js +1 -519
- package/package.json +3 -3
package/HookRenderer.cjs
CHANGED
|
@@ -10,6 +10,7 @@ require('@trackunit/react-core-contexts-api');
|
|
|
10
10
|
require('util');
|
|
11
11
|
require('@trackunit/react-core-hooks');
|
|
12
12
|
require('@trackunit/tailwind-styled-components');
|
|
13
|
+
require('react-router-dom');
|
|
13
14
|
|
|
14
15
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
15
16
|
|
package/HookRenderer.js
CHANGED
package/index.cjs
CHANGED
package/index.js
CHANGED
package/index2.cjs
CHANGED
|
@@ -9,6 +9,7 @@ var ReactDOMClient = require('react-dom/client');
|
|
|
9
9
|
var require$$0 = require('util');
|
|
10
10
|
var reactCoreHooks = require('@trackunit/react-core-hooks');
|
|
11
11
|
var tailwindStyledComponents = require('@trackunit/tailwind-styled-components');
|
|
12
|
+
var reactRouterDom = require('react-router-dom');
|
|
12
13
|
|
|
13
14
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
14
15
|
|
|
@@ -33698,525 +33699,6 @@ var lodash = {exports: {}};
|
|
|
33698
33699
|
}.call(commonjsGlobal));
|
|
33699
33700
|
}(lodash, lodash.exports));
|
|
33700
33701
|
|
|
33701
|
-
/**
|
|
33702
|
-
* @remix-run/router v1.6.2
|
|
33703
|
-
*
|
|
33704
|
-
* Copyright (c) Remix Software Inc.
|
|
33705
|
-
*
|
|
33706
|
-
* This source code is licensed under the MIT license found in the
|
|
33707
|
-
* LICENSE.md file in the root directory of this source tree.
|
|
33708
|
-
*
|
|
33709
|
-
* @license MIT
|
|
33710
|
-
*/
|
|
33711
|
-
function _extends() {
|
|
33712
|
-
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
33713
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
33714
|
-
var source = arguments[i];
|
|
33715
|
-
|
|
33716
|
-
for (var key in source) {
|
|
33717
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
33718
|
-
target[key] = source[key];
|
|
33719
|
-
}
|
|
33720
|
-
}
|
|
33721
|
-
}
|
|
33722
|
-
|
|
33723
|
-
return target;
|
|
33724
|
-
};
|
|
33725
|
-
return _extends.apply(this, arguments);
|
|
33726
|
-
}
|
|
33727
|
-
|
|
33728
|
-
////////////////////////////////////////////////////////////////////////////////
|
|
33729
|
-
//#region Types and Constants
|
|
33730
|
-
////////////////////////////////////////////////////////////////////////////////
|
|
33731
|
-
|
|
33732
|
-
/**
|
|
33733
|
-
* Actions represent the type of change to a location value.
|
|
33734
|
-
*/
|
|
33735
|
-
var Action;
|
|
33736
|
-
|
|
33737
|
-
(function (Action) {
|
|
33738
|
-
/**
|
|
33739
|
-
* A POP indicates a change to an arbitrary index in the history stack, such
|
|
33740
|
-
* as a back or forward navigation. It does not describe the direction of the
|
|
33741
|
-
* navigation, only that the current index changed.
|
|
33742
|
-
*
|
|
33743
|
-
* Note: This is the default action for newly created history objects.
|
|
33744
|
-
*/
|
|
33745
|
-
Action["Pop"] = "POP";
|
|
33746
|
-
/**
|
|
33747
|
-
* A PUSH indicates a new entry being added to the history stack, such as when
|
|
33748
|
-
* a link is clicked and a new page loads. When this happens, all subsequent
|
|
33749
|
-
* entries in the stack are lost.
|
|
33750
|
-
*/
|
|
33751
|
-
|
|
33752
|
-
Action["Push"] = "PUSH";
|
|
33753
|
-
/**
|
|
33754
|
-
* A REPLACE indicates the entry at the current index in the history stack
|
|
33755
|
-
* being replaced by a new one.
|
|
33756
|
-
*/
|
|
33757
|
-
|
|
33758
|
-
Action["Replace"] = "REPLACE";
|
|
33759
|
-
})(Action || (Action = {}));
|
|
33760
|
-
/**
|
|
33761
|
-
* Memory history stores the current location in memory. It is designed for use
|
|
33762
|
-
* in stateful non-browser environments like tests and React Native.
|
|
33763
|
-
*/
|
|
33764
|
-
|
|
33765
|
-
function createMemoryHistory(options) {
|
|
33766
|
-
if (options === void 0) {
|
|
33767
|
-
options = {};
|
|
33768
|
-
}
|
|
33769
|
-
|
|
33770
|
-
let {
|
|
33771
|
-
initialEntries = ["/"],
|
|
33772
|
-
initialIndex,
|
|
33773
|
-
v5Compat = false
|
|
33774
|
-
} = options;
|
|
33775
|
-
let entries; // Declare so we can access from createMemoryLocation
|
|
33776
|
-
|
|
33777
|
-
entries = initialEntries.map((entry, index) => createMemoryLocation(entry, typeof entry === "string" ? null : entry.state, index === 0 ? "default" : undefined));
|
|
33778
|
-
let index = clampIndex(initialIndex == null ? entries.length - 1 : initialIndex);
|
|
33779
|
-
let action = Action.Pop;
|
|
33780
|
-
let listener = null;
|
|
33781
|
-
|
|
33782
|
-
function clampIndex(n) {
|
|
33783
|
-
return Math.min(Math.max(n, 0), entries.length - 1);
|
|
33784
|
-
}
|
|
33785
|
-
|
|
33786
|
-
function getCurrentLocation() {
|
|
33787
|
-
return entries[index];
|
|
33788
|
-
}
|
|
33789
|
-
|
|
33790
|
-
function createMemoryLocation(to, state, key) {
|
|
33791
|
-
if (state === void 0) {
|
|
33792
|
-
state = null;
|
|
33793
|
-
}
|
|
33794
|
-
|
|
33795
|
-
let location = createLocation(entries ? getCurrentLocation().pathname : "/", to, state, key);
|
|
33796
|
-
warning(location.pathname.charAt(0) === "/", "relative pathnames are not supported in memory history: " + JSON.stringify(to));
|
|
33797
|
-
return location;
|
|
33798
|
-
}
|
|
33799
|
-
|
|
33800
|
-
function createHref(to) {
|
|
33801
|
-
return typeof to === "string" ? to : createPath(to);
|
|
33802
|
-
}
|
|
33803
|
-
|
|
33804
|
-
let history = {
|
|
33805
|
-
get index() {
|
|
33806
|
-
return index;
|
|
33807
|
-
},
|
|
33808
|
-
|
|
33809
|
-
get action() {
|
|
33810
|
-
return action;
|
|
33811
|
-
},
|
|
33812
|
-
|
|
33813
|
-
get location() {
|
|
33814
|
-
return getCurrentLocation();
|
|
33815
|
-
},
|
|
33816
|
-
|
|
33817
|
-
createHref,
|
|
33818
|
-
|
|
33819
|
-
createURL(to) {
|
|
33820
|
-
return new URL(createHref(to), "http://localhost");
|
|
33821
|
-
},
|
|
33822
|
-
|
|
33823
|
-
encodeLocation(to) {
|
|
33824
|
-
let path = typeof to === "string" ? parsePath(to) : to;
|
|
33825
|
-
return {
|
|
33826
|
-
pathname: path.pathname || "",
|
|
33827
|
-
search: path.search || "",
|
|
33828
|
-
hash: path.hash || ""
|
|
33829
|
-
};
|
|
33830
|
-
},
|
|
33831
|
-
|
|
33832
|
-
push(to, state) {
|
|
33833
|
-
action = Action.Push;
|
|
33834
|
-
let nextLocation = createMemoryLocation(to, state);
|
|
33835
|
-
index += 1;
|
|
33836
|
-
entries.splice(index, entries.length, nextLocation);
|
|
33837
|
-
|
|
33838
|
-
if (v5Compat && listener) {
|
|
33839
|
-
listener({
|
|
33840
|
-
action,
|
|
33841
|
-
location: nextLocation,
|
|
33842
|
-
delta: 1
|
|
33843
|
-
});
|
|
33844
|
-
}
|
|
33845
|
-
},
|
|
33846
|
-
|
|
33847
|
-
replace(to, state) {
|
|
33848
|
-
action = Action.Replace;
|
|
33849
|
-
let nextLocation = createMemoryLocation(to, state);
|
|
33850
|
-
entries[index] = nextLocation;
|
|
33851
|
-
|
|
33852
|
-
if (v5Compat && listener) {
|
|
33853
|
-
listener({
|
|
33854
|
-
action,
|
|
33855
|
-
location: nextLocation,
|
|
33856
|
-
delta: 0
|
|
33857
|
-
});
|
|
33858
|
-
}
|
|
33859
|
-
},
|
|
33860
|
-
|
|
33861
|
-
go(delta) {
|
|
33862
|
-
action = Action.Pop;
|
|
33863
|
-
let nextIndex = clampIndex(index + delta);
|
|
33864
|
-
let nextLocation = entries[nextIndex];
|
|
33865
|
-
index = nextIndex;
|
|
33866
|
-
|
|
33867
|
-
if (listener) {
|
|
33868
|
-
listener({
|
|
33869
|
-
action,
|
|
33870
|
-
location: nextLocation,
|
|
33871
|
-
delta
|
|
33872
|
-
});
|
|
33873
|
-
}
|
|
33874
|
-
},
|
|
33875
|
-
|
|
33876
|
-
listen(fn) {
|
|
33877
|
-
listener = fn;
|
|
33878
|
-
return () => {
|
|
33879
|
-
listener = null;
|
|
33880
|
-
};
|
|
33881
|
-
}
|
|
33882
|
-
|
|
33883
|
-
};
|
|
33884
|
-
return history;
|
|
33885
|
-
}
|
|
33886
|
-
function invariant$2(value, message) {
|
|
33887
|
-
if (value === false || value === null || typeof value === "undefined") {
|
|
33888
|
-
throw new Error(message);
|
|
33889
|
-
}
|
|
33890
|
-
}
|
|
33891
|
-
function warning(cond, message) {
|
|
33892
|
-
if (!cond) {
|
|
33893
|
-
// eslint-disable-next-line no-console
|
|
33894
|
-
if (typeof console !== "undefined") console.warn(message);
|
|
33895
|
-
|
|
33896
|
-
try {
|
|
33897
|
-
// Welcome to debugging history!
|
|
33898
|
-
//
|
|
33899
|
-
// This error is thrown as a convenience so you can more easily
|
|
33900
|
-
// find the source for a warning that appears in the console by
|
|
33901
|
-
// enabling "pause on exceptions" in your JavaScript debugger.
|
|
33902
|
-
throw new Error(message); // eslint-disable-next-line no-empty
|
|
33903
|
-
} catch (e) {}
|
|
33904
|
-
}
|
|
33905
|
-
}
|
|
33906
|
-
|
|
33907
|
-
function createKey() {
|
|
33908
|
-
return Math.random().toString(36).substr(2, 8);
|
|
33909
|
-
}
|
|
33910
|
-
/**
|
|
33911
|
-
* Creates a Location object with a unique key from the given Path
|
|
33912
|
-
*/
|
|
33913
|
-
|
|
33914
|
-
|
|
33915
|
-
function createLocation(current, to, state, key) {
|
|
33916
|
-
if (state === void 0) {
|
|
33917
|
-
state = null;
|
|
33918
|
-
}
|
|
33919
|
-
|
|
33920
|
-
let location = _extends({
|
|
33921
|
-
pathname: typeof current === "string" ? current : current.pathname,
|
|
33922
|
-
search: "",
|
|
33923
|
-
hash: ""
|
|
33924
|
-
}, typeof to === "string" ? parsePath(to) : to, {
|
|
33925
|
-
state,
|
|
33926
|
-
// TODO: This could be cleaned up. push/replace should probably just take
|
|
33927
|
-
// full Locations now and avoid the need to run through this flow at all
|
|
33928
|
-
// But that's a pretty big refactor to the current test suite so going to
|
|
33929
|
-
// keep as is for the time being and just let any incoming keys take precedence
|
|
33930
|
-
key: to && to.key || key || createKey()
|
|
33931
|
-
});
|
|
33932
|
-
|
|
33933
|
-
return location;
|
|
33934
|
-
}
|
|
33935
|
-
/**
|
|
33936
|
-
* Creates a string URL path from the given pathname, search, and hash components.
|
|
33937
|
-
*/
|
|
33938
|
-
|
|
33939
|
-
function createPath(_ref) {
|
|
33940
|
-
let {
|
|
33941
|
-
pathname = "/",
|
|
33942
|
-
search = "",
|
|
33943
|
-
hash = ""
|
|
33944
|
-
} = _ref;
|
|
33945
|
-
if (search && search !== "?") pathname += search.charAt(0) === "?" ? search : "?" + search;
|
|
33946
|
-
if (hash && hash !== "#") pathname += hash.charAt(0) === "#" ? hash : "#" + hash;
|
|
33947
|
-
return pathname;
|
|
33948
|
-
}
|
|
33949
|
-
/**
|
|
33950
|
-
* Parses a string URL path into its separate pathname, search, and hash components.
|
|
33951
|
-
*/
|
|
33952
|
-
|
|
33953
|
-
function parsePath(path) {
|
|
33954
|
-
let parsedPath = {};
|
|
33955
|
-
|
|
33956
|
-
if (path) {
|
|
33957
|
-
let hashIndex = path.indexOf("#");
|
|
33958
|
-
|
|
33959
|
-
if (hashIndex >= 0) {
|
|
33960
|
-
parsedPath.hash = path.substr(hashIndex);
|
|
33961
|
-
path = path.substr(0, hashIndex);
|
|
33962
|
-
}
|
|
33963
|
-
|
|
33964
|
-
let searchIndex = path.indexOf("?");
|
|
33965
|
-
|
|
33966
|
-
if (searchIndex >= 0) {
|
|
33967
|
-
parsedPath.search = path.substr(searchIndex);
|
|
33968
|
-
path = path.substr(0, searchIndex);
|
|
33969
|
-
}
|
|
33970
|
-
|
|
33971
|
-
if (path) {
|
|
33972
|
-
parsedPath.pathname = path;
|
|
33973
|
-
}
|
|
33974
|
-
}
|
|
33975
|
-
|
|
33976
|
-
return parsedPath;
|
|
33977
|
-
}
|
|
33978
|
-
|
|
33979
|
-
var ResultType;
|
|
33980
|
-
|
|
33981
|
-
(function (ResultType) {
|
|
33982
|
-
ResultType["data"] = "data";
|
|
33983
|
-
ResultType["deferred"] = "deferred";
|
|
33984
|
-
ResultType["redirect"] = "redirect";
|
|
33985
|
-
ResultType["error"] = "error";
|
|
33986
|
-
})(ResultType || (ResultType = {}));
|
|
33987
|
-
/**
|
|
33988
|
-
* @private
|
|
33989
|
-
*/
|
|
33990
|
-
|
|
33991
|
-
|
|
33992
|
-
function stripBasename(pathname, basename) {
|
|
33993
|
-
if (basename === "/") return pathname;
|
|
33994
|
-
|
|
33995
|
-
if (!pathname.toLowerCase().startsWith(basename.toLowerCase())) {
|
|
33996
|
-
return null;
|
|
33997
|
-
} // We want to leave trailing slash behavior in the user's control, so if they
|
|
33998
|
-
// specify a basename with a trailing slash, we should support it
|
|
33999
|
-
|
|
34000
|
-
|
|
34001
|
-
let startIndex = basename.endsWith("/") ? basename.length - 1 : basename.length;
|
|
34002
|
-
let nextChar = pathname.charAt(startIndex);
|
|
34003
|
-
|
|
34004
|
-
if (nextChar && nextChar !== "/") {
|
|
34005
|
-
// pathname does not start with basename/
|
|
34006
|
-
return null;
|
|
34007
|
-
}
|
|
34008
|
-
|
|
34009
|
-
return pathname.slice(startIndex) || "/";
|
|
34010
|
-
}
|
|
34011
|
-
|
|
34012
|
-
const validMutationMethodsArr = ["post", "put", "patch", "delete"];
|
|
34013
|
-
["get", ...validMutationMethodsArr];
|
|
34014
|
-
|
|
34015
|
-
/**
|
|
34016
|
-
* React Router v6.11.2
|
|
34017
|
-
*
|
|
34018
|
-
* Copyright (c) Remix Software Inc.
|
|
34019
|
-
*
|
|
34020
|
-
* This source code is licensed under the MIT license found in the
|
|
34021
|
-
* LICENSE.md file in the root directory of this source tree.
|
|
34022
|
-
*
|
|
34023
|
-
* @license MIT
|
|
34024
|
-
*/
|
|
34025
|
-
|
|
34026
|
-
const DataRouterContext = /*#__PURE__*/React__namespace.createContext(null);
|
|
34027
|
-
|
|
34028
|
-
if (process.env.NODE_ENV !== "production") {
|
|
34029
|
-
DataRouterContext.displayName = "DataRouter";
|
|
34030
|
-
}
|
|
34031
|
-
|
|
34032
|
-
const DataRouterStateContext = /*#__PURE__*/React__namespace.createContext(null);
|
|
34033
|
-
|
|
34034
|
-
if (process.env.NODE_ENV !== "production") {
|
|
34035
|
-
DataRouterStateContext.displayName = "DataRouterState";
|
|
34036
|
-
}
|
|
34037
|
-
|
|
34038
|
-
const AwaitContext = /*#__PURE__*/React__namespace.createContext(null);
|
|
34039
|
-
|
|
34040
|
-
if (process.env.NODE_ENV !== "production") {
|
|
34041
|
-
AwaitContext.displayName = "Await";
|
|
34042
|
-
}
|
|
34043
|
-
|
|
34044
|
-
const NavigationContext = /*#__PURE__*/React__namespace.createContext(null);
|
|
34045
|
-
|
|
34046
|
-
if (process.env.NODE_ENV !== "production") {
|
|
34047
|
-
NavigationContext.displayName = "Navigation";
|
|
34048
|
-
}
|
|
34049
|
-
|
|
34050
|
-
const LocationContext = /*#__PURE__*/React__namespace.createContext(null);
|
|
34051
|
-
|
|
34052
|
-
if (process.env.NODE_ENV !== "production") {
|
|
34053
|
-
LocationContext.displayName = "Location";
|
|
34054
|
-
}
|
|
34055
|
-
|
|
34056
|
-
const RouteContext = /*#__PURE__*/React__namespace.createContext({
|
|
34057
|
-
outlet: null,
|
|
34058
|
-
matches: [],
|
|
34059
|
-
isDataRoute: false
|
|
34060
|
-
});
|
|
34061
|
-
|
|
34062
|
-
if (process.env.NODE_ENV !== "production") {
|
|
34063
|
-
RouteContext.displayName = "Route";
|
|
34064
|
-
}
|
|
34065
|
-
|
|
34066
|
-
const RouteErrorContext = /*#__PURE__*/React__namespace.createContext(null);
|
|
34067
|
-
|
|
34068
|
-
if (process.env.NODE_ENV !== "production") {
|
|
34069
|
-
RouteErrorContext.displayName = "RouteError";
|
|
34070
|
-
}
|
|
34071
|
-
/**
|
|
34072
|
-
* Returns true if this component is a descendant of a <Router>.
|
|
34073
|
-
*
|
|
34074
|
-
* @see https://reactrouter.com/hooks/use-in-router-context
|
|
34075
|
-
*/
|
|
34076
|
-
|
|
34077
|
-
function useInRouterContext() {
|
|
34078
|
-
return React__namespace.useContext(LocationContext) != null;
|
|
34079
|
-
}
|
|
34080
|
-
var DataRouterHook;
|
|
34081
|
-
|
|
34082
|
-
(function (DataRouterHook) {
|
|
34083
|
-
DataRouterHook["UseBlocker"] = "useBlocker";
|
|
34084
|
-
DataRouterHook["UseRevalidator"] = "useRevalidator";
|
|
34085
|
-
DataRouterHook["UseNavigateStable"] = "useNavigate";
|
|
34086
|
-
})(DataRouterHook || (DataRouterHook = {}));
|
|
34087
|
-
|
|
34088
|
-
var DataRouterStateHook;
|
|
34089
|
-
|
|
34090
|
-
(function (DataRouterStateHook) {
|
|
34091
|
-
DataRouterStateHook["UseBlocker"] = "useBlocker";
|
|
34092
|
-
DataRouterStateHook["UseLoaderData"] = "useLoaderData";
|
|
34093
|
-
DataRouterStateHook["UseActionData"] = "useActionData";
|
|
34094
|
-
DataRouterStateHook["UseRouteError"] = "useRouteError";
|
|
34095
|
-
DataRouterStateHook["UseNavigation"] = "useNavigation";
|
|
34096
|
-
DataRouterStateHook["UseRouteLoaderData"] = "useRouteLoaderData";
|
|
34097
|
-
DataRouterStateHook["UseMatches"] = "useMatches";
|
|
34098
|
-
DataRouterStateHook["UseRevalidator"] = "useRevalidator";
|
|
34099
|
-
DataRouterStateHook["UseNavigateStable"] = "useNavigate";
|
|
34100
|
-
DataRouterStateHook["UseRouteId"] = "useRouteId";
|
|
34101
|
-
})(DataRouterStateHook || (DataRouterStateHook = {}));
|
|
34102
|
-
|
|
34103
|
-
/**
|
|
34104
|
-
* A <Router> that stores all entries in memory.
|
|
34105
|
-
*
|
|
34106
|
-
* @see https://reactrouter.com/router-components/memory-router
|
|
34107
|
-
*/
|
|
34108
|
-
function MemoryRouter(_ref3) {
|
|
34109
|
-
let {
|
|
34110
|
-
basename,
|
|
34111
|
-
children,
|
|
34112
|
-
initialEntries,
|
|
34113
|
-
initialIndex
|
|
34114
|
-
} = _ref3;
|
|
34115
|
-
let historyRef = React__namespace.useRef();
|
|
34116
|
-
|
|
34117
|
-
if (historyRef.current == null) {
|
|
34118
|
-
historyRef.current = createMemoryHistory({
|
|
34119
|
-
initialEntries,
|
|
34120
|
-
initialIndex,
|
|
34121
|
-
v5Compat: true
|
|
34122
|
-
});
|
|
34123
|
-
}
|
|
34124
|
-
|
|
34125
|
-
let history = historyRef.current;
|
|
34126
|
-
let [state, setState] = React__namespace.useState({
|
|
34127
|
-
action: history.action,
|
|
34128
|
-
location: history.location
|
|
34129
|
-
});
|
|
34130
|
-
React__namespace.useLayoutEffect(() => history.listen(setState), [history]);
|
|
34131
|
-
return /*#__PURE__*/React__namespace.createElement(Router, {
|
|
34132
|
-
basename: basename,
|
|
34133
|
-
children: children,
|
|
34134
|
-
location: state.location,
|
|
34135
|
-
navigationType: state.action,
|
|
34136
|
-
navigator: history
|
|
34137
|
-
});
|
|
34138
|
-
}
|
|
34139
|
-
|
|
34140
|
-
/**
|
|
34141
|
-
* Provides location context for the rest of the app.
|
|
34142
|
-
*
|
|
34143
|
-
* Note: You usually won't render a <Router> directly. Instead, you'll render a
|
|
34144
|
-
* router that is more specific to your environment such as a <BrowserRouter>
|
|
34145
|
-
* in web browsers or a <StaticRouter> for server rendering.
|
|
34146
|
-
*
|
|
34147
|
-
* @see https://reactrouter.com/router-components/router
|
|
34148
|
-
*/
|
|
34149
|
-
function Router(_ref5) {
|
|
34150
|
-
let {
|
|
34151
|
-
basename: basenameProp = "/",
|
|
34152
|
-
children = null,
|
|
34153
|
-
location: locationProp,
|
|
34154
|
-
navigationType = Action.Pop,
|
|
34155
|
-
navigator,
|
|
34156
|
-
static: staticProp = false
|
|
34157
|
-
} = _ref5;
|
|
34158
|
-
!!useInRouterContext() ? process.env.NODE_ENV !== "production" ? invariant$2(false, "You cannot render a <Router> inside another <Router>." + " You should never have more than one in your app.") : invariant$2(false) : void 0; // Preserve trailing slashes on basename, so we can let the user control
|
|
34159
|
-
// the enforcement of trailing slashes throughout the app
|
|
34160
|
-
|
|
34161
|
-
let basename = basenameProp.replace(/^\/*/, "/");
|
|
34162
|
-
let navigationContext = React__namespace.useMemo(() => ({
|
|
34163
|
-
basename,
|
|
34164
|
-
navigator,
|
|
34165
|
-
static: staticProp
|
|
34166
|
-
}), [basename, navigator, staticProp]);
|
|
34167
|
-
|
|
34168
|
-
if (typeof locationProp === "string") {
|
|
34169
|
-
locationProp = parsePath(locationProp);
|
|
34170
|
-
}
|
|
34171
|
-
|
|
34172
|
-
let {
|
|
34173
|
-
pathname = "/",
|
|
34174
|
-
search = "",
|
|
34175
|
-
hash = "",
|
|
34176
|
-
state = null,
|
|
34177
|
-
key = "default"
|
|
34178
|
-
} = locationProp;
|
|
34179
|
-
let locationContext = React__namespace.useMemo(() => {
|
|
34180
|
-
let trailingPathname = stripBasename(pathname, basename);
|
|
34181
|
-
|
|
34182
|
-
if (trailingPathname == null) {
|
|
34183
|
-
return null;
|
|
34184
|
-
}
|
|
34185
|
-
|
|
34186
|
-
return {
|
|
34187
|
-
location: {
|
|
34188
|
-
pathname: trailingPathname,
|
|
34189
|
-
search,
|
|
34190
|
-
hash,
|
|
34191
|
-
state,
|
|
34192
|
-
key
|
|
34193
|
-
},
|
|
34194
|
-
navigationType
|
|
34195
|
-
};
|
|
34196
|
-
}, [basename, pathname, search, hash, state, key, navigationType]);
|
|
34197
|
-
process.env.NODE_ENV !== "production" ? warning(locationContext != null, "<Router basename=\"" + basename + "\"> is not able to match the URL " + ("\"" + pathname + search + hash + "\" because it does not start with the ") + "basename, so the <Router> won't render anything.") : void 0;
|
|
34198
|
-
|
|
34199
|
-
if (locationContext == null) {
|
|
34200
|
-
return null;
|
|
34201
|
-
}
|
|
34202
|
-
|
|
34203
|
-
return /*#__PURE__*/React__namespace.createElement(NavigationContext.Provider, {
|
|
34204
|
-
value: navigationContext
|
|
34205
|
-
}, /*#__PURE__*/React__namespace.createElement(LocationContext.Provider, {
|
|
34206
|
-
children: children,
|
|
34207
|
-
value: locationContext
|
|
34208
|
-
}));
|
|
34209
|
-
}
|
|
34210
|
-
var AwaitRenderStatus;
|
|
34211
|
-
|
|
34212
|
-
(function (AwaitRenderStatus) {
|
|
34213
|
-
AwaitRenderStatus[AwaitRenderStatus["pending"] = 0] = "pending";
|
|
34214
|
-
AwaitRenderStatus[AwaitRenderStatus["success"] = 1] = "success";
|
|
34215
|
-
AwaitRenderStatus[AwaitRenderStatus["error"] = 2] = "error";
|
|
34216
|
-
})(AwaitRenderStatus || (AwaitRenderStatus = {}));
|
|
34217
|
-
|
|
34218
|
-
new Promise(() => {});
|
|
34219
|
-
|
|
34220
33702
|
var genericMessage = "Invariant Violation";
|
|
34221
33703
|
var _a$3 = Object.setPrototypeOf, setPrototypeOf = _a$3 === void 0 ? function (obj, proto) {
|
|
34222
33704
|
obj.__proto__ = proto;
|
|
@@ -44382,7 +43864,7 @@ class TrackunitProvidersMockBuilder {
|
|
|
44382
43864
|
* @param addTestRootContainer - if you want to add a root container to the test.
|
|
44383
43865
|
*/
|
|
44384
43866
|
getMockedCompositionRoot(testChildren, addTestRootContainer = true) {
|
|
44385
|
-
return (jsxRuntime.jsx(reactCoreHooks.EnvironmentContextProvider, { value: this.selectedEnvironmentContext, children: jsxRuntime.jsx(MemoryRouter, Object.assign({}, this.selectedRouterProps, { children: jsxRuntime.jsx(reactCoreHooks.CurrentUserProvider, { value: this.selectedCurrentUserContext, children: jsxRuntime.jsx(reactCoreHooks.AnalyticsContext.Provider, { value: this.selectedAnalyticsContext, children: jsxRuntime.jsx(reactCoreHooks.UserSubscriptionProvider, { value: this.selectedUserSubscriptionContext, children: jsxRuntime.jsx(reactCoreHooks.OemBrandingContextProvider, { value: this.selectedOemBrandingContext, children: jsxRuntime.jsx(reactCoreHooks.TokenProvider, { value: this.selectedTokenContext, children: jsxRuntime.jsx(reactCoreHooks.ToastProvider, { value: this.selectedToastContext, children: jsxRuntime.jsx(reactCoreHooks.GlobalSelectionProvider, { value: this.selectedGlobalSelection, children: jsxRuntime.jsx(reactCoreHooks.AssetSortingProvider, { value: this.selectedAssetSortingContext, children: jsxRuntime.jsx(ApolloMockedProviderWithError, { mocks: this.selectedApolloMocks, addTypename: false, children: addTestRootContainer ? (jsxRuntime.jsx(TestRoot, { "data-testid": "testRoot", children: testChildren })) : (jsxRuntime.jsx("div", { children: testChildren })) }) }) }) }) }) }) }) }) }) })) }));
|
|
43867
|
+
return (jsxRuntime.jsx(reactCoreHooks.EnvironmentContextProvider, { value: this.selectedEnvironmentContext, children: jsxRuntime.jsx(reactRouterDom.MemoryRouter, Object.assign({}, this.selectedRouterProps, { children: jsxRuntime.jsx(reactCoreHooks.CurrentUserProvider, { value: this.selectedCurrentUserContext, children: jsxRuntime.jsx(reactCoreHooks.AnalyticsContext.Provider, { value: this.selectedAnalyticsContext, children: jsxRuntime.jsx(reactCoreHooks.UserSubscriptionProvider, { value: this.selectedUserSubscriptionContext, children: jsxRuntime.jsx(reactCoreHooks.OemBrandingContextProvider, { value: this.selectedOemBrandingContext, children: jsxRuntime.jsx(reactCoreHooks.TokenProvider, { value: this.selectedTokenContext, children: jsxRuntime.jsx(reactCoreHooks.ToastProvider, { value: this.selectedToastContext, children: jsxRuntime.jsx(reactCoreHooks.GlobalSelectionProvider, { value: this.selectedGlobalSelection, children: jsxRuntime.jsx(reactCoreHooks.AssetSortingProvider, { value: this.selectedAssetSortingContext, children: jsxRuntime.jsx(ApolloMockedProviderWithError, { mocks: this.selectedApolloMocks, addTypename: false, children: addTestRootContainer ? (jsxRuntime.jsx(TestRoot, { "data-testid": "testRoot", children: testChildren })) : (jsxRuntime.jsx("div", { children: testChildren })) }) }) }) }) }) }) }) }) }) })) }));
|
|
44386
43868
|
}
|
|
44387
43869
|
/**
|
|
44388
43870
|
* This will return the mocked composition root.
|
package/index2.js
CHANGED
|
@@ -8,6 +8,7 @@ import * as ReactDOMClient from 'react-dom/client';
|
|
|
8
8
|
import require$$0 from 'util';
|
|
9
9
|
import { EnvironmentContextProvider, CurrentUserProvider, AnalyticsContext, UserSubscriptionProvider, OemBrandingContextProvider, TokenProvider, ToastProvider, GlobalSelectionProvider, AssetSortingProvider } from '@trackunit/react-core-hooks';
|
|
10
10
|
import { tw } from '@trackunit/tailwind-styled-components';
|
|
11
|
+
import { MemoryRouter } from 'react-router-dom';
|
|
11
12
|
|
|
12
13
|
function _mergeNamespaces(n, m) {
|
|
13
14
|
m.forEach(function (e) {
|
|
@@ -33670,525 +33671,6 @@ var lodash = {exports: {}};
|
|
|
33670
33671
|
}.call(commonjsGlobal));
|
|
33671
33672
|
}(lodash, lodash.exports));
|
|
33672
33673
|
|
|
33673
|
-
/**
|
|
33674
|
-
* @remix-run/router v1.6.2
|
|
33675
|
-
*
|
|
33676
|
-
* Copyright (c) Remix Software Inc.
|
|
33677
|
-
*
|
|
33678
|
-
* This source code is licensed under the MIT license found in the
|
|
33679
|
-
* LICENSE.md file in the root directory of this source tree.
|
|
33680
|
-
*
|
|
33681
|
-
* @license MIT
|
|
33682
|
-
*/
|
|
33683
|
-
function _extends() {
|
|
33684
|
-
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
33685
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
33686
|
-
var source = arguments[i];
|
|
33687
|
-
|
|
33688
|
-
for (var key in source) {
|
|
33689
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
33690
|
-
target[key] = source[key];
|
|
33691
|
-
}
|
|
33692
|
-
}
|
|
33693
|
-
}
|
|
33694
|
-
|
|
33695
|
-
return target;
|
|
33696
|
-
};
|
|
33697
|
-
return _extends.apply(this, arguments);
|
|
33698
|
-
}
|
|
33699
|
-
|
|
33700
|
-
////////////////////////////////////////////////////////////////////////////////
|
|
33701
|
-
//#region Types and Constants
|
|
33702
|
-
////////////////////////////////////////////////////////////////////////////////
|
|
33703
|
-
|
|
33704
|
-
/**
|
|
33705
|
-
* Actions represent the type of change to a location value.
|
|
33706
|
-
*/
|
|
33707
|
-
var Action;
|
|
33708
|
-
|
|
33709
|
-
(function (Action) {
|
|
33710
|
-
/**
|
|
33711
|
-
* A POP indicates a change to an arbitrary index in the history stack, such
|
|
33712
|
-
* as a back or forward navigation. It does not describe the direction of the
|
|
33713
|
-
* navigation, only that the current index changed.
|
|
33714
|
-
*
|
|
33715
|
-
* Note: This is the default action for newly created history objects.
|
|
33716
|
-
*/
|
|
33717
|
-
Action["Pop"] = "POP";
|
|
33718
|
-
/**
|
|
33719
|
-
* A PUSH indicates a new entry being added to the history stack, such as when
|
|
33720
|
-
* a link is clicked and a new page loads. When this happens, all subsequent
|
|
33721
|
-
* entries in the stack are lost.
|
|
33722
|
-
*/
|
|
33723
|
-
|
|
33724
|
-
Action["Push"] = "PUSH";
|
|
33725
|
-
/**
|
|
33726
|
-
* A REPLACE indicates the entry at the current index in the history stack
|
|
33727
|
-
* being replaced by a new one.
|
|
33728
|
-
*/
|
|
33729
|
-
|
|
33730
|
-
Action["Replace"] = "REPLACE";
|
|
33731
|
-
})(Action || (Action = {}));
|
|
33732
|
-
/**
|
|
33733
|
-
* Memory history stores the current location in memory. It is designed for use
|
|
33734
|
-
* in stateful non-browser environments like tests and React Native.
|
|
33735
|
-
*/
|
|
33736
|
-
|
|
33737
|
-
function createMemoryHistory(options) {
|
|
33738
|
-
if (options === void 0) {
|
|
33739
|
-
options = {};
|
|
33740
|
-
}
|
|
33741
|
-
|
|
33742
|
-
let {
|
|
33743
|
-
initialEntries = ["/"],
|
|
33744
|
-
initialIndex,
|
|
33745
|
-
v5Compat = false
|
|
33746
|
-
} = options;
|
|
33747
|
-
let entries; // Declare so we can access from createMemoryLocation
|
|
33748
|
-
|
|
33749
|
-
entries = initialEntries.map((entry, index) => createMemoryLocation(entry, typeof entry === "string" ? null : entry.state, index === 0 ? "default" : undefined));
|
|
33750
|
-
let index = clampIndex(initialIndex == null ? entries.length - 1 : initialIndex);
|
|
33751
|
-
let action = Action.Pop;
|
|
33752
|
-
let listener = null;
|
|
33753
|
-
|
|
33754
|
-
function clampIndex(n) {
|
|
33755
|
-
return Math.min(Math.max(n, 0), entries.length - 1);
|
|
33756
|
-
}
|
|
33757
|
-
|
|
33758
|
-
function getCurrentLocation() {
|
|
33759
|
-
return entries[index];
|
|
33760
|
-
}
|
|
33761
|
-
|
|
33762
|
-
function createMemoryLocation(to, state, key) {
|
|
33763
|
-
if (state === void 0) {
|
|
33764
|
-
state = null;
|
|
33765
|
-
}
|
|
33766
|
-
|
|
33767
|
-
let location = createLocation(entries ? getCurrentLocation().pathname : "/", to, state, key);
|
|
33768
|
-
warning(location.pathname.charAt(0) === "/", "relative pathnames are not supported in memory history: " + JSON.stringify(to));
|
|
33769
|
-
return location;
|
|
33770
|
-
}
|
|
33771
|
-
|
|
33772
|
-
function createHref(to) {
|
|
33773
|
-
return typeof to === "string" ? to : createPath(to);
|
|
33774
|
-
}
|
|
33775
|
-
|
|
33776
|
-
let history = {
|
|
33777
|
-
get index() {
|
|
33778
|
-
return index;
|
|
33779
|
-
},
|
|
33780
|
-
|
|
33781
|
-
get action() {
|
|
33782
|
-
return action;
|
|
33783
|
-
},
|
|
33784
|
-
|
|
33785
|
-
get location() {
|
|
33786
|
-
return getCurrentLocation();
|
|
33787
|
-
},
|
|
33788
|
-
|
|
33789
|
-
createHref,
|
|
33790
|
-
|
|
33791
|
-
createURL(to) {
|
|
33792
|
-
return new URL(createHref(to), "http://localhost");
|
|
33793
|
-
},
|
|
33794
|
-
|
|
33795
|
-
encodeLocation(to) {
|
|
33796
|
-
let path = typeof to === "string" ? parsePath(to) : to;
|
|
33797
|
-
return {
|
|
33798
|
-
pathname: path.pathname || "",
|
|
33799
|
-
search: path.search || "",
|
|
33800
|
-
hash: path.hash || ""
|
|
33801
|
-
};
|
|
33802
|
-
},
|
|
33803
|
-
|
|
33804
|
-
push(to, state) {
|
|
33805
|
-
action = Action.Push;
|
|
33806
|
-
let nextLocation = createMemoryLocation(to, state);
|
|
33807
|
-
index += 1;
|
|
33808
|
-
entries.splice(index, entries.length, nextLocation);
|
|
33809
|
-
|
|
33810
|
-
if (v5Compat && listener) {
|
|
33811
|
-
listener({
|
|
33812
|
-
action,
|
|
33813
|
-
location: nextLocation,
|
|
33814
|
-
delta: 1
|
|
33815
|
-
});
|
|
33816
|
-
}
|
|
33817
|
-
},
|
|
33818
|
-
|
|
33819
|
-
replace(to, state) {
|
|
33820
|
-
action = Action.Replace;
|
|
33821
|
-
let nextLocation = createMemoryLocation(to, state);
|
|
33822
|
-
entries[index] = nextLocation;
|
|
33823
|
-
|
|
33824
|
-
if (v5Compat && listener) {
|
|
33825
|
-
listener({
|
|
33826
|
-
action,
|
|
33827
|
-
location: nextLocation,
|
|
33828
|
-
delta: 0
|
|
33829
|
-
});
|
|
33830
|
-
}
|
|
33831
|
-
},
|
|
33832
|
-
|
|
33833
|
-
go(delta) {
|
|
33834
|
-
action = Action.Pop;
|
|
33835
|
-
let nextIndex = clampIndex(index + delta);
|
|
33836
|
-
let nextLocation = entries[nextIndex];
|
|
33837
|
-
index = nextIndex;
|
|
33838
|
-
|
|
33839
|
-
if (listener) {
|
|
33840
|
-
listener({
|
|
33841
|
-
action,
|
|
33842
|
-
location: nextLocation,
|
|
33843
|
-
delta
|
|
33844
|
-
});
|
|
33845
|
-
}
|
|
33846
|
-
},
|
|
33847
|
-
|
|
33848
|
-
listen(fn) {
|
|
33849
|
-
listener = fn;
|
|
33850
|
-
return () => {
|
|
33851
|
-
listener = null;
|
|
33852
|
-
};
|
|
33853
|
-
}
|
|
33854
|
-
|
|
33855
|
-
};
|
|
33856
|
-
return history;
|
|
33857
|
-
}
|
|
33858
|
-
function invariant$2(value, message) {
|
|
33859
|
-
if (value === false || value === null || typeof value === "undefined") {
|
|
33860
|
-
throw new Error(message);
|
|
33861
|
-
}
|
|
33862
|
-
}
|
|
33863
|
-
function warning(cond, message) {
|
|
33864
|
-
if (!cond) {
|
|
33865
|
-
// eslint-disable-next-line no-console
|
|
33866
|
-
if (typeof console !== "undefined") console.warn(message);
|
|
33867
|
-
|
|
33868
|
-
try {
|
|
33869
|
-
// Welcome to debugging history!
|
|
33870
|
-
//
|
|
33871
|
-
// This error is thrown as a convenience so you can more easily
|
|
33872
|
-
// find the source for a warning that appears in the console by
|
|
33873
|
-
// enabling "pause on exceptions" in your JavaScript debugger.
|
|
33874
|
-
throw new Error(message); // eslint-disable-next-line no-empty
|
|
33875
|
-
} catch (e) {}
|
|
33876
|
-
}
|
|
33877
|
-
}
|
|
33878
|
-
|
|
33879
|
-
function createKey() {
|
|
33880
|
-
return Math.random().toString(36).substr(2, 8);
|
|
33881
|
-
}
|
|
33882
|
-
/**
|
|
33883
|
-
* Creates a Location object with a unique key from the given Path
|
|
33884
|
-
*/
|
|
33885
|
-
|
|
33886
|
-
|
|
33887
|
-
function createLocation(current, to, state, key) {
|
|
33888
|
-
if (state === void 0) {
|
|
33889
|
-
state = null;
|
|
33890
|
-
}
|
|
33891
|
-
|
|
33892
|
-
let location = _extends({
|
|
33893
|
-
pathname: typeof current === "string" ? current : current.pathname,
|
|
33894
|
-
search: "",
|
|
33895
|
-
hash: ""
|
|
33896
|
-
}, typeof to === "string" ? parsePath(to) : to, {
|
|
33897
|
-
state,
|
|
33898
|
-
// TODO: This could be cleaned up. push/replace should probably just take
|
|
33899
|
-
// full Locations now and avoid the need to run through this flow at all
|
|
33900
|
-
// But that's a pretty big refactor to the current test suite so going to
|
|
33901
|
-
// keep as is for the time being and just let any incoming keys take precedence
|
|
33902
|
-
key: to && to.key || key || createKey()
|
|
33903
|
-
});
|
|
33904
|
-
|
|
33905
|
-
return location;
|
|
33906
|
-
}
|
|
33907
|
-
/**
|
|
33908
|
-
* Creates a string URL path from the given pathname, search, and hash components.
|
|
33909
|
-
*/
|
|
33910
|
-
|
|
33911
|
-
function createPath(_ref) {
|
|
33912
|
-
let {
|
|
33913
|
-
pathname = "/",
|
|
33914
|
-
search = "",
|
|
33915
|
-
hash = ""
|
|
33916
|
-
} = _ref;
|
|
33917
|
-
if (search && search !== "?") pathname += search.charAt(0) === "?" ? search : "?" + search;
|
|
33918
|
-
if (hash && hash !== "#") pathname += hash.charAt(0) === "#" ? hash : "#" + hash;
|
|
33919
|
-
return pathname;
|
|
33920
|
-
}
|
|
33921
|
-
/**
|
|
33922
|
-
* Parses a string URL path into its separate pathname, search, and hash components.
|
|
33923
|
-
*/
|
|
33924
|
-
|
|
33925
|
-
function parsePath(path) {
|
|
33926
|
-
let parsedPath = {};
|
|
33927
|
-
|
|
33928
|
-
if (path) {
|
|
33929
|
-
let hashIndex = path.indexOf("#");
|
|
33930
|
-
|
|
33931
|
-
if (hashIndex >= 0) {
|
|
33932
|
-
parsedPath.hash = path.substr(hashIndex);
|
|
33933
|
-
path = path.substr(0, hashIndex);
|
|
33934
|
-
}
|
|
33935
|
-
|
|
33936
|
-
let searchIndex = path.indexOf("?");
|
|
33937
|
-
|
|
33938
|
-
if (searchIndex >= 0) {
|
|
33939
|
-
parsedPath.search = path.substr(searchIndex);
|
|
33940
|
-
path = path.substr(0, searchIndex);
|
|
33941
|
-
}
|
|
33942
|
-
|
|
33943
|
-
if (path) {
|
|
33944
|
-
parsedPath.pathname = path;
|
|
33945
|
-
}
|
|
33946
|
-
}
|
|
33947
|
-
|
|
33948
|
-
return parsedPath;
|
|
33949
|
-
}
|
|
33950
|
-
|
|
33951
|
-
var ResultType;
|
|
33952
|
-
|
|
33953
|
-
(function (ResultType) {
|
|
33954
|
-
ResultType["data"] = "data";
|
|
33955
|
-
ResultType["deferred"] = "deferred";
|
|
33956
|
-
ResultType["redirect"] = "redirect";
|
|
33957
|
-
ResultType["error"] = "error";
|
|
33958
|
-
})(ResultType || (ResultType = {}));
|
|
33959
|
-
/**
|
|
33960
|
-
* @private
|
|
33961
|
-
*/
|
|
33962
|
-
|
|
33963
|
-
|
|
33964
|
-
function stripBasename(pathname, basename) {
|
|
33965
|
-
if (basename === "/") return pathname;
|
|
33966
|
-
|
|
33967
|
-
if (!pathname.toLowerCase().startsWith(basename.toLowerCase())) {
|
|
33968
|
-
return null;
|
|
33969
|
-
} // We want to leave trailing slash behavior in the user's control, so if they
|
|
33970
|
-
// specify a basename with a trailing slash, we should support it
|
|
33971
|
-
|
|
33972
|
-
|
|
33973
|
-
let startIndex = basename.endsWith("/") ? basename.length - 1 : basename.length;
|
|
33974
|
-
let nextChar = pathname.charAt(startIndex);
|
|
33975
|
-
|
|
33976
|
-
if (nextChar && nextChar !== "/") {
|
|
33977
|
-
// pathname does not start with basename/
|
|
33978
|
-
return null;
|
|
33979
|
-
}
|
|
33980
|
-
|
|
33981
|
-
return pathname.slice(startIndex) || "/";
|
|
33982
|
-
}
|
|
33983
|
-
|
|
33984
|
-
const validMutationMethodsArr = ["post", "put", "patch", "delete"];
|
|
33985
|
-
["get", ...validMutationMethodsArr];
|
|
33986
|
-
|
|
33987
|
-
/**
|
|
33988
|
-
* React Router v6.11.2
|
|
33989
|
-
*
|
|
33990
|
-
* Copyright (c) Remix Software Inc.
|
|
33991
|
-
*
|
|
33992
|
-
* This source code is licensed under the MIT license found in the
|
|
33993
|
-
* LICENSE.md file in the root directory of this source tree.
|
|
33994
|
-
*
|
|
33995
|
-
* @license MIT
|
|
33996
|
-
*/
|
|
33997
|
-
|
|
33998
|
-
const DataRouterContext = /*#__PURE__*/React.createContext(null);
|
|
33999
|
-
|
|
34000
|
-
if (process.env.NODE_ENV !== "production") {
|
|
34001
|
-
DataRouterContext.displayName = "DataRouter";
|
|
34002
|
-
}
|
|
34003
|
-
|
|
34004
|
-
const DataRouterStateContext = /*#__PURE__*/React.createContext(null);
|
|
34005
|
-
|
|
34006
|
-
if (process.env.NODE_ENV !== "production") {
|
|
34007
|
-
DataRouterStateContext.displayName = "DataRouterState";
|
|
34008
|
-
}
|
|
34009
|
-
|
|
34010
|
-
const AwaitContext = /*#__PURE__*/React.createContext(null);
|
|
34011
|
-
|
|
34012
|
-
if (process.env.NODE_ENV !== "production") {
|
|
34013
|
-
AwaitContext.displayName = "Await";
|
|
34014
|
-
}
|
|
34015
|
-
|
|
34016
|
-
const NavigationContext = /*#__PURE__*/React.createContext(null);
|
|
34017
|
-
|
|
34018
|
-
if (process.env.NODE_ENV !== "production") {
|
|
34019
|
-
NavigationContext.displayName = "Navigation";
|
|
34020
|
-
}
|
|
34021
|
-
|
|
34022
|
-
const LocationContext = /*#__PURE__*/React.createContext(null);
|
|
34023
|
-
|
|
34024
|
-
if (process.env.NODE_ENV !== "production") {
|
|
34025
|
-
LocationContext.displayName = "Location";
|
|
34026
|
-
}
|
|
34027
|
-
|
|
34028
|
-
const RouteContext = /*#__PURE__*/React.createContext({
|
|
34029
|
-
outlet: null,
|
|
34030
|
-
matches: [],
|
|
34031
|
-
isDataRoute: false
|
|
34032
|
-
});
|
|
34033
|
-
|
|
34034
|
-
if (process.env.NODE_ENV !== "production") {
|
|
34035
|
-
RouteContext.displayName = "Route";
|
|
34036
|
-
}
|
|
34037
|
-
|
|
34038
|
-
const RouteErrorContext = /*#__PURE__*/React.createContext(null);
|
|
34039
|
-
|
|
34040
|
-
if (process.env.NODE_ENV !== "production") {
|
|
34041
|
-
RouteErrorContext.displayName = "RouteError";
|
|
34042
|
-
}
|
|
34043
|
-
/**
|
|
34044
|
-
* Returns true if this component is a descendant of a <Router>.
|
|
34045
|
-
*
|
|
34046
|
-
* @see https://reactrouter.com/hooks/use-in-router-context
|
|
34047
|
-
*/
|
|
34048
|
-
|
|
34049
|
-
function useInRouterContext() {
|
|
34050
|
-
return React.useContext(LocationContext) != null;
|
|
34051
|
-
}
|
|
34052
|
-
var DataRouterHook;
|
|
34053
|
-
|
|
34054
|
-
(function (DataRouterHook) {
|
|
34055
|
-
DataRouterHook["UseBlocker"] = "useBlocker";
|
|
34056
|
-
DataRouterHook["UseRevalidator"] = "useRevalidator";
|
|
34057
|
-
DataRouterHook["UseNavigateStable"] = "useNavigate";
|
|
34058
|
-
})(DataRouterHook || (DataRouterHook = {}));
|
|
34059
|
-
|
|
34060
|
-
var DataRouterStateHook;
|
|
34061
|
-
|
|
34062
|
-
(function (DataRouterStateHook) {
|
|
34063
|
-
DataRouterStateHook["UseBlocker"] = "useBlocker";
|
|
34064
|
-
DataRouterStateHook["UseLoaderData"] = "useLoaderData";
|
|
34065
|
-
DataRouterStateHook["UseActionData"] = "useActionData";
|
|
34066
|
-
DataRouterStateHook["UseRouteError"] = "useRouteError";
|
|
34067
|
-
DataRouterStateHook["UseNavigation"] = "useNavigation";
|
|
34068
|
-
DataRouterStateHook["UseRouteLoaderData"] = "useRouteLoaderData";
|
|
34069
|
-
DataRouterStateHook["UseMatches"] = "useMatches";
|
|
34070
|
-
DataRouterStateHook["UseRevalidator"] = "useRevalidator";
|
|
34071
|
-
DataRouterStateHook["UseNavigateStable"] = "useNavigate";
|
|
34072
|
-
DataRouterStateHook["UseRouteId"] = "useRouteId";
|
|
34073
|
-
})(DataRouterStateHook || (DataRouterStateHook = {}));
|
|
34074
|
-
|
|
34075
|
-
/**
|
|
34076
|
-
* A <Router> that stores all entries in memory.
|
|
34077
|
-
*
|
|
34078
|
-
* @see https://reactrouter.com/router-components/memory-router
|
|
34079
|
-
*/
|
|
34080
|
-
function MemoryRouter(_ref3) {
|
|
34081
|
-
let {
|
|
34082
|
-
basename,
|
|
34083
|
-
children,
|
|
34084
|
-
initialEntries,
|
|
34085
|
-
initialIndex
|
|
34086
|
-
} = _ref3;
|
|
34087
|
-
let historyRef = React.useRef();
|
|
34088
|
-
|
|
34089
|
-
if (historyRef.current == null) {
|
|
34090
|
-
historyRef.current = createMemoryHistory({
|
|
34091
|
-
initialEntries,
|
|
34092
|
-
initialIndex,
|
|
34093
|
-
v5Compat: true
|
|
34094
|
-
});
|
|
34095
|
-
}
|
|
34096
|
-
|
|
34097
|
-
let history = historyRef.current;
|
|
34098
|
-
let [state, setState] = React.useState({
|
|
34099
|
-
action: history.action,
|
|
34100
|
-
location: history.location
|
|
34101
|
-
});
|
|
34102
|
-
React.useLayoutEffect(() => history.listen(setState), [history]);
|
|
34103
|
-
return /*#__PURE__*/React.createElement(Router, {
|
|
34104
|
-
basename: basename,
|
|
34105
|
-
children: children,
|
|
34106
|
-
location: state.location,
|
|
34107
|
-
navigationType: state.action,
|
|
34108
|
-
navigator: history
|
|
34109
|
-
});
|
|
34110
|
-
}
|
|
34111
|
-
|
|
34112
|
-
/**
|
|
34113
|
-
* Provides location context for the rest of the app.
|
|
34114
|
-
*
|
|
34115
|
-
* Note: You usually won't render a <Router> directly. Instead, you'll render a
|
|
34116
|
-
* router that is more specific to your environment such as a <BrowserRouter>
|
|
34117
|
-
* in web browsers or a <StaticRouter> for server rendering.
|
|
34118
|
-
*
|
|
34119
|
-
* @see https://reactrouter.com/router-components/router
|
|
34120
|
-
*/
|
|
34121
|
-
function Router(_ref5) {
|
|
34122
|
-
let {
|
|
34123
|
-
basename: basenameProp = "/",
|
|
34124
|
-
children = null,
|
|
34125
|
-
location: locationProp,
|
|
34126
|
-
navigationType = Action.Pop,
|
|
34127
|
-
navigator,
|
|
34128
|
-
static: staticProp = false
|
|
34129
|
-
} = _ref5;
|
|
34130
|
-
!!useInRouterContext() ? process.env.NODE_ENV !== "production" ? invariant$2(false, "You cannot render a <Router> inside another <Router>." + " You should never have more than one in your app.") : invariant$2(false) : void 0; // Preserve trailing slashes on basename, so we can let the user control
|
|
34131
|
-
// the enforcement of trailing slashes throughout the app
|
|
34132
|
-
|
|
34133
|
-
let basename = basenameProp.replace(/^\/*/, "/");
|
|
34134
|
-
let navigationContext = React.useMemo(() => ({
|
|
34135
|
-
basename,
|
|
34136
|
-
navigator,
|
|
34137
|
-
static: staticProp
|
|
34138
|
-
}), [basename, navigator, staticProp]);
|
|
34139
|
-
|
|
34140
|
-
if (typeof locationProp === "string") {
|
|
34141
|
-
locationProp = parsePath(locationProp);
|
|
34142
|
-
}
|
|
34143
|
-
|
|
34144
|
-
let {
|
|
34145
|
-
pathname = "/",
|
|
34146
|
-
search = "",
|
|
34147
|
-
hash = "",
|
|
34148
|
-
state = null,
|
|
34149
|
-
key = "default"
|
|
34150
|
-
} = locationProp;
|
|
34151
|
-
let locationContext = React.useMemo(() => {
|
|
34152
|
-
let trailingPathname = stripBasename(pathname, basename);
|
|
34153
|
-
|
|
34154
|
-
if (trailingPathname == null) {
|
|
34155
|
-
return null;
|
|
34156
|
-
}
|
|
34157
|
-
|
|
34158
|
-
return {
|
|
34159
|
-
location: {
|
|
34160
|
-
pathname: trailingPathname,
|
|
34161
|
-
search,
|
|
34162
|
-
hash,
|
|
34163
|
-
state,
|
|
34164
|
-
key
|
|
34165
|
-
},
|
|
34166
|
-
navigationType
|
|
34167
|
-
};
|
|
34168
|
-
}, [basename, pathname, search, hash, state, key, navigationType]);
|
|
34169
|
-
process.env.NODE_ENV !== "production" ? warning(locationContext != null, "<Router basename=\"" + basename + "\"> is not able to match the URL " + ("\"" + pathname + search + hash + "\" because it does not start with the ") + "basename, so the <Router> won't render anything.") : void 0;
|
|
34170
|
-
|
|
34171
|
-
if (locationContext == null) {
|
|
34172
|
-
return null;
|
|
34173
|
-
}
|
|
34174
|
-
|
|
34175
|
-
return /*#__PURE__*/React.createElement(NavigationContext.Provider, {
|
|
34176
|
-
value: navigationContext
|
|
34177
|
-
}, /*#__PURE__*/React.createElement(LocationContext.Provider, {
|
|
34178
|
-
children: children,
|
|
34179
|
-
value: locationContext
|
|
34180
|
-
}));
|
|
34181
|
-
}
|
|
34182
|
-
var AwaitRenderStatus;
|
|
34183
|
-
|
|
34184
|
-
(function (AwaitRenderStatus) {
|
|
34185
|
-
AwaitRenderStatus[AwaitRenderStatus["pending"] = 0] = "pending";
|
|
34186
|
-
AwaitRenderStatus[AwaitRenderStatus["success"] = 1] = "success";
|
|
34187
|
-
AwaitRenderStatus[AwaitRenderStatus["error"] = 2] = "error";
|
|
34188
|
-
})(AwaitRenderStatus || (AwaitRenderStatus = {}));
|
|
34189
|
-
|
|
34190
|
-
new Promise(() => {});
|
|
34191
|
-
|
|
34192
33674
|
var genericMessage = "Invariant Violation";
|
|
34193
33675
|
var _a$3 = Object.setPrototypeOf, setPrototypeOf = _a$3 === void 0 ? function (obj, proto) {
|
|
34194
33676
|
obj.__proto__ = proto;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-core-contexts-test",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.78",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"engines": {
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
"types": "./src/index.d.ts",
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"@apollo/client": "3.7.10",
|
|
15
|
-
"@trackunit/react-core-contexts-api": "0.2.
|
|
16
|
-
"@trackunit/react-core-hooks": "0.2.
|
|
15
|
+
"@trackunit/react-core-contexts-api": "0.2.42",
|
|
16
|
+
"@trackunit/react-core-hooks": "0.2.66",
|
|
17
17
|
"@trackunit/tailwind-styled-components": "0.0.58",
|
|
18
18
|
"graphql": "15.8.0",
|
|
19
19
|
"lodash": "4.17.21",
|