UNPKG

one

Version:

One is a React framework for web, iOS, and Android apps.

1 lines • 1.83 kB
{"version":3,"file":"getRouteInfo.js","names":[],"sources":["esm/router/getRouteInfo.js"],"sourcesContent":["import { getPathDataFromState } from \"../fork/getPathFromState\";\nimport { stripBaseUrl } from \"../fork/getStateFromPath-mods\";\nimport { getNormalizedStatePath } from \"./getNormalizedStatePath\";\nimport { isIndexPath } from \"./isIndexPath\";\nimport { getResolvedLinking } from \"./linkingConfig\";\nimport { stripPathSuffix } from \"./path\";\nfunction getRouteInfo(state) {\n return getRouteInfoFromState(\n (state2, asPath) => {\n return getPathDataFromState(state2, {\n screens: [],\n ...getResolvedLinking()?.config,\n preserveDynamicRoutes: asPath,\n preserveGroups: asPath\n });\n },\n state\n );\n}\nfunction getRouteInfoFromState(getPathFromState, state, baseUrl) {\n const { path } = getPathFromState(state, false);\n const qualified = getPathFromState(state, true);\n return {\n unstable_globalHref: path,\n // a hash href serializes as /page#section; the pathname the router compares\n // against pending navigation and the URL must drop the hash as well as the query\n pathname: stripPathSuffix(stripBaseUrl(path, baseUrl)),\n isIndex: isIndexPath(state),\n ...getNormalizedStatePath(qualified, baseUrl)\n };\n}\nexport {\n getRouteInfo,\n getRouteInfoFromState\n};\n//# sourceMappingURL=getRouteInfo.js.map\n"],"mappings":";;;;;;;;AAMA,SAAS,aAAa,OAAO;CAC3B,OAAO,uBACJ,QAAQ,WAAW;EAClB,OAAO,qBAAqB,QAAQ;GAClC,SAAS,CAAC;GACV,GAAG,mBAAmB,CAAC,EAAE;GACzB,uBAAuB;GACvB,gBAAgB;EAClB,CAAC;CACH,GACA,KACF;AACF;AACA,SAAS,sBAAsB,kBAAkB,OAAO,SAAS;CAC/D,MAAM,EAAE,SAAS,iBAAiB,OAAO,KAAK;CAC9C,MAAM,YAAY,iBAAiB,OAAO,IAAI;CAC9C,OAAO;EACL,qBAAqB;EAGrB,UAAU,gBAAgB,aAAa,MAAM,OAAO,CAAC;EACrD,SAAS,YAAY,KAAK;EAC1B,GAAG,uBAAuB,WAAW,OAAO;CAC9C;AACF"}