@riboseinc/anafero-cli 0.0.39 → 0.0.41

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);
@@ -129755,6 +129784,7 @@ schema (${ast._tag}): ${ast}`;
129755
129784
  navListView: "style_navListView",
129756
129785
  browserBar: "style_browserBar",
129757
129786
  browserBarTitle: "style_browserBarTitle",
129787
+ browserBarTitleLink: "style_browserBarTitleLink",
129758
129788
  browserBarToolbar: "style_browserBarToolbar",
129759
129789
  browserBarToolbarGroup: "style_browserBarToolbarGroup",
129760
129790
  progressWrapper: "style_progressWrapper",
@@ -129899,16 +129929,14 @@ schema (${ast._tag}): ${ast}`;
129899
129929
  }
129900
129930
 
129901
129931
  // NavHierarchy2.tsx
129932
+ init_anafero();
129902
129933
  var Hierarchy = import_react204.default.memo(function({ pageMap, getResourceTitle, selected, onSelect, implicitlyExpanded, expanded, onExpand }) {
129903
129934
  const allPaths = (0, import_react204.useMemo)(() => Object.keys(pageMap), [pageMap]);
129904
129935
  const items = (0, import_react204.useMemo)(() => {
129905
129936
  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);
129937
+ const parentPaths = getAllParentPaths(path);
129938
+ const parentURIs = new Set(parentPaths.map((p) => pageMap[p]).filter((p) => p !== void 0));
129939
+ const shouldAppear = parentURIs.isSubsetOf(expanded);
129912
129940
  return shouldAppear;
129913
129941
  }).map(([path, id3]) => {
129914
129942
  const level = path === "" ? 0 : (path.match(/\//g) ?? []).length + 1;
@@ -130120,6 +130148,7 @@ schema (${ast._tag}): ${ast}`;
130120
130148
  var BrowserBar = function({
130121
130149
  providerProps,
130122
130150
  title,
130151
+ rootURL,
130123
130152
  loadProgress,
130124
130153
  activeBrowsingMode,
130125
130154
  onActivateBrowsingMode,
@@ -130134,7 +130163,7 @@ schema (${ast._tag}): ${ast}`;
130134
130163
  (0, import_react207.useEffect)(() => {
130135
130164
  console.debug("Load progress", loadProgress);
130136
130165
  }, [loadProgress]);
130137
- return /* @__PURE__ */ import_react207.default.createElement($7167f8da3cce35e4$export$2881499e37b75b9a, { theme: $bf24a13e98395dd3$export$bca14c5b3b88a9c9, ...providerProps }, /* @__PURE__ */ import_react207.default.createElement("div", { className: style_default.browserBar }, /* @__PURE__ */ import_react207.default.createElement("header", { className: style_default.browserBarTitle }, /* @__PURE__ */ import_react207.default.createElement("h1", null, title)), showToolbar ? /* @__PURE__ */ import_react207.default.createElement(
130166
+ return /* @__PURE__ */ import_react207.default.createElement($7167f8da3cce35e4$export$2881499e37b75b9a, { theme: $bf24a13e98395dd3$export$bca14c5b3b88a9c9, ...providerProps }, /* @__PURE__ */ import_react207.default.createElement("div", { className: style_default.browserBar }, /* @__PURE__ */ import_react207.default.createElement("header", { className: style_default.browserBarTitle }, /* @__PURE__ */ import_react207.default.createElement("h1", null, /* @__PURE__ */ import_react207.default.createElement("a", { href: rootURL, className: style_default.browserBarTitleLink }, title))), showToolbar ? /* @__PURE__ */ import_react207.default.createElement(
130138
130167
  $13c3c67164f4d5be$export$4c260019440d418f,
130139
130168
  {
130140
130169
  "aria-label": "Tools",
@@ -130843,7 +130872,7 @@ schema (${ast._tag}): ${ast}`;
130843
130872
  storedState: restoredState,
130844
130873
  onStoreState: handleStoreState
130845
130874
  }
130846
- ) : /* @__PURE__ */ import_react210.default.createElement(import_react210.default.Fragment, null, /* @__PURE__ */ import_react210.default.createElement(BrowserBar, { title: workspaceTitle, loadProgress }), /* @__PURE__ */ import_react210.default.createElement("main", { id: "resources" }, /* @__PURE__ */ import_react210.default.createElement(
130875
+ ) : /* @__PURE__ */ import_react210.default.createElement(import_react210.default.Fragment, null, /* @__PURE__ */ import_react210.default.createElement(BrowserBar, { rootURL: `${pathPrefix}/`, title: workspaceTitle, loadProgress }), /* @__PURE__ */ import_react210.default.createElement("main", { id: "resources" }, /* @__PURE__ */ import_react210.default.createElement(
130847
130876
  "div",
130848
130877
  {
130849
130878
  dangerouslySetInnerHTML: { __html: "" },
@@ -131047,7 +131076,7 @@ schema (${ast._tag}): ${ast}`;
131047
131076
  ...Array.from(state.expandedResourceURIs),
131048
131077
  ...Array.from(implicitlyExpanded)
131049
131078
  ]);
131050
- }, [implicitlyExpanded, resourceMap, state.expandedResourceURIs, actualSelectedPageResources]);
131079
+ }, [implicitlyExpanded, resourceMap, state.expandedResourceURIs]);
131051
131080
  const routerProps = (0, import_react210.useMemo)(() => ({ router: { navigate } }), [navigate]);
131052
131081
  const isLoading = loadingResources.length > 0;
131053
131082
  (0, import_react210.useLayoutEffect)(() => {
@@ -131178,6 +131207,7 @@ schema (${ast._tag}): ${ast}`;
131178
131207
  providerProps: routerProps,
131179
131208
  versioning,
131180
131209
  activeBrowsingMode: state.browsingMode,
131210
+ rootURL: expandUnversionedPath("/"),
131181
131211
  onActivateBrowsingMode: (0, import_react210.useCallback)((mode) => dispatch({
131182
131212
  type: "activated_browsing_mode",
131183
131213
  mode
@@ -131359,7 +131389,7 @@ schema (${ast._tag}): ${ast}`;
131359
131389
  function expandResourcePath(rpath) {
131360
131390
  const hasFragment = rpath.indexOf("#") >= 0;
131361
131391
  const [beforeFragment, maybeFragment] = hasFragment ? rpath.split("#") : [rpath.split("#")[0], null];
131362
- const maybeTrailingSlash = beforeFragment !== "" && beforeFragment !== "/" ? "/" : "";
131392
+ const maybeTrailingSlash = beforeFragment !== "" && !beforeFragment.endsWith("/") ? "/" : "";
131363
131393
  const maybeFragmentSeparator = hasFragment ? "#" : "";
131364
131394
  const withTrailing = `${beforeFragment}${maybeTrailingSlash}${maybeFragmentSeparator}${maybeFragment ?? ""}`;
131365
131395
  return [
@@ -131367,12 +131397,6 @@ schema (${ast._tag}): ${ast}`;
131367
131397
  maybeFragment ? `#${maybeFragment}` : null
131368
131398
  ];
131369
131399
  }
131370
- function stripLeadingSlash(aPath) {
131371
- return aPath.replace(/^\//, "");
131372
- }
131373
- function stripTrailingSlash(aPath) {
131374
- return aPath.replace(/\/$/, "");
131375
- }
131376
131400
 
131377
131401
  // lunrPatch.mts
131378
131402
  var import_lunr6 = __toESM(require_lunr(), 1);