@riboseinc/anafero-cli 0.0.39 → 0.0.40

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/bootstrap.js CHANGED
@@ -95015,6 +95015,30 @@ schema (${ast._tag}): ${ast}`;
95015
95015
  }
95016
95016
  });
95017
95017
 
95018
+ // ../anafero/path-utils.mts
95019
+ function stripLeadingSlash(aPath) {
95020
+ return aPath.replace(/^\//, "");
95021
+ }
95022
+ function stripTrailingSlash(aPath) {
95023
+ return aPath.replace(/\/$/, "");
95024
+ }
95025
+ function getAllParentPaths(aPath) {
95026
+ let path = aPath;
95027
+ const parents = [];
95028
+ while (path.includes("/")) {
95029
+ const parent = path.slice(0, path.lastIndexOf("/"));
95030
+ parents.push(parent);
95031
+ path = parent;
95032
+ }
95033
+ parents.reverse();
95034
+ return parents;
95035
+ }
95036
+ var init_path_utils = __esm({
95037
+ "../anafero/path-utils.mts"() {
95038
+ "use strict";
95039
+ }
95040
+ });
95041
+
95018
95042
  // ../anafero/index.mts
95019
95043
  var anafero_exports = {};
95020
95044
  __export(anafero_exports, {
@@ -95036,8 +95060,11 @@ schema (${ast._tag}): ${ast}`;
95036
95060
  fillInLocale: () => fillInLocale,
95037
95061
  gatherDescribedResourcesFromJsonifiedProseMirrorNode: () => gatherDescribedResourcesFromJsonifiedProseMirrorNode,
95038
95062
  gatherTextFromJsonifiedProseMirrorNode: () => gatherTextFromJsonifiedProseMirrorNode,
95063
+ getAllParentPaths: () => getAllParentPaths,
95039
95064
  makeDummyInMemoryCache: () => makeDummyInMemoryCache,
95040
95065
  parseModuleRef: () => parseModuleRef,
95066
+ stripLeadingSlash: () => stripLeadingSlash,
95067
+ stripTrailingSlash: () => stripTrailingSlash,
95041
95068
  titleSchema: () => titleSchema
95042
95069
  });
95043
95070
  var init_anafero = __esm({
@@ -95053,6 +95080,7 @@ schema (${ast._tag}): ${ast}`;
95053
95080
  init_ResourceNavigationContext();
95054
95081
  init_moduleRef();
95055
95082
  init_cache();
95083
+ init_path_utils();
95056
95084
  }
95057
95085
  });
95058
95086
 
@@ -129553,6 +129581,7 @@ schema (${ast._tag}): ${ast}`;
129553
129581
  init_anafero();
129554
129582
  init_anafero();
129555
129583
  init_anafero();
129584
+ init_anafero();
129556
129585
 
129557
129586
  // Nav.tsx
129558
129587
  var import_lunr = __toESM(require_lunr(), 1);
@@ -129899,16 +129928,14 @@ schema (${ast._tag}): ${ast}`;
129899
129928
  }
129900
129929
 
129901
129930
  // NavHierarchy2.tsx
129931
+ init_anafero();
129902
129932
  var Hierarchy = import_react204.default.memo(function({ pageMap, getResourceTitle, selected, onSelect, implicitlyExpanded, expanded, onExpand }) {
129903
129933
  const allPaths = (0, import_react204.useMemo)(() => Object.keys(pageMap), [pageMap]);
129904
129934
  const items = (0, import_react204.useMemo)(() => {
129905
129935
  return Object.entries(pageMap).filter(([path]) => {
129906
- const parentPath = path.includes("/") ? `${path.slice(0, path.lastIndexOf("/"))}` : "";
129907
- const parentURI = pageMap[parentPath];
129908
- if (!parentURI) {
129909
- console.warn("Unable to find URI for parent path", parentPath);
129910
- }
129911
- const shouldAppear = !![...expanded.values()].find((expandedURI) => expandedURI === parentURI);
129936
+ const parentPaths = getAllParentPaths(path);
129937
+ const parentURIs = new Set(parentPaths.map((p) => pageMap[p]).filter((p) => p !== void 0));
129938
+ const shouldAppear = parentURIs.isSubsetOf(expanded);
129912
129939
  return shouldAppear;
129913
129940
  }).map(([path, id3]) => {
129914
129941
  const level = path === "" ? 0 : (path.match(/\//g) ?? []).length + 1;
@@ -131047,7 +131074,7 @@ schema (${ast._tag}): ${ast}`;
131047
131074
  ...Array.from(state.expandedResourceURIs),
131048
131075
  ...Array.from(implicitlyExpanded)
131049
131076
  ]);
131050
- }, [implicitlyExpanded, resourceMap, state.expandedResourceURIs, actualSelectedPageResources]);
131077
+ }, [implicitlyExpanded, resourceMap, state.expandedResourceURIs]);
131051
131078
  const routerProps = (0, import_react210.useMemo)(() => ({ router: { navigate } }), [navigate]);
131052
131079
  const isLoading = loadingResources.length > 0;
131053
131080
  (0, import_react210.useLayoutEffect)(() => {
@@ -131359,7 +131386,7 @@ schema (${ast._tag}): ${ast}`;
131359
131386
  function expandResourcePath(rpath) {
131360
131387
  const hasFragment = rpath.indexOf("#") >= 0;
131361
131388
  const [beforeFragment, maybeFragment] = hasFragment ? rpath.split("#") : [rpath.split("#")[0], null];
131362
- const maybeTrailingSlash = beforeFragment !== "" && beforeFragment !== "/" ? "/" : "";
131389
+ const maybeTrailingSlash = beforeFragment !== "" && !beforeFragment.endsWith("/") ? "/" : "";
131363
131390
  const maybeFragmentSeparator = hasFragment ? "#" : "";
131364
131391
  const withTrailing = `${beforeFragment}${maybeTrailingSlash}${maybeFragmentSeparator}${maybeFragment ?? ""}`;
131365
131392
  return [
@@ -131367,12 +131394,6 @@ schema (${ast._tag}): ${ast}`;
131367
131394
  maybeFragment ? `#${maybeFragment}` : null
131368
131395
  ];
131369
131396
  }
131370
- function stripLeadingSlash(aPath) {
131371
- return aPath.replace(/^\//, "");
131372
- }
131373
- function stripTrailingSlash(aPath) {
131374
- return aPath.replace(/\/$/, "");
131375
- }
131376
131397
 
131377
131398
  // lunrPatch.mts
131378
131399
  var import_lunr6 = __toESM(require_lunr(), 1);