@riboseinc/anafero-cli 0.0.51 → 0.0.53

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
@@ -73900,6 +73900,47 @@ schema (${ast._tag}): ${ast}`;
73900
73900
  }
73901
73901
  });
73902
73902
 
73903
+ // ../anafero/util/graph-query.mts
73904
+ function resolveChain(relations, chain, subj_) {
73905
+ if (chain.length === 1) {
73906
+ return relations.filter((rel) => rel[1] === chain[0] && (!subj_ || rel[0] === subj_)).map((rel) => [rel[0], rel[2]]);
73907
+ } else {
73908
+ return relations.filter((rel) => rel[1] === chain[0] && (!subj_ || rel[0] === subj_)).map((rel) => resolveChain(
73909
+ relations,
73910
+ chain.slice(1),
73911
+ rel[2]
73912
+ )).flat();
73913
+ }
73914
+ }
73915
+ function getTextContent(graph, subject, partPredicate) {
73916
+ const allSubparts = (
73917
+ // TODO: subject is really only used to resolve relations,
73918
+ // maybe this can be refactored out of this function.
73919
+ resolveChain(graph, ["hasPart"], subject).flatMap(([partID, partValue]) => {
73920
+ if (!isURIString(partValue)) {
73921
+ if (partValue.startsWith("data:")) {
73922
+ return [""];
73923
+ } else if (partPredicate && !partPredicate(partValue)) {
73924
+ return [""];
73925
+ } else if (partValue.trim() === "") {
73926
+ return [""];
73927
+ } else {
73928
+ return [partValue];
73929
+ }
73930
+ } else {
73931
+ return getTextContent(graph, partValue, partPredicate);
73932
+ }
73933
+ })
73934
+ );
73935
+ return allSubparts;
73936
+ }
73937
+ var init_graph_query = __esm({
73938
+ "../anafero/util/graph-query.mts"() {
73939
+ "use strict";
73940
+ init_URI();
73941
+ }
73942
+ });
73943
+
73903
73944
  // ../anafero/index.mts
73904
73945
  var anafero_exports = {};
73905
73946
  __export(anafero_exports, {
@@ -73922,9 +73963,11 @@ schema (${ast._tag}): ${ast}`;
73922
73963
  gatherDescribedResourcesFromJsonifiedProseMirrorNode: () => gatherDescribedResourcesFromJsonifiedProseMirrorNode,
73923
73964
  gatherTextFromJsonifiedProseMirrorNode: () => gatherTextFromJsonifiedProseMirrorNode,
73924
73965
  getAllParentPaths: () => getAllParentPaths,
73966
+ getTextContent: () => getTextContent,
73925
73967
  isURIString: () => isURIString,
73926
73968
  makeDummyInMemoryCache: () => makeDummyInMemoryCache,
73927
73969
  parseModuleRef: () => parseModuleRef,
73970
+ resolveChain: () => resolveChain,
73928
73971
  stripLeadingSlash: () => stripLeadingSlash,
73929
73972
  stripTrailingSlash: () => stripTrailingSlash,
73930
73973
  titleSchema: () => titleSchema
@@ -73943,6 +73986,7 @@ schema (${ast._tag}): ${ast}`;
73943
73986
  init_moduleRef();
73944
73987
  init_cache();
73945
73988
  init_path_utils();
73989
+ init_graph_query();
73946
73990
  init_URI();
73947
73991
  }
73948
73992
  });
@@ -109522,7 +109566,7 @@ schema (${ast._tag}): ${ast}`;
109522
109566
  "is-disabled": "style_is-disabled",
109523
109567
  resourceBreadcrumbsNav: "style_resourceBreadcrumbsNav",
109524
109568
  navListView: "style_navListView",
109525
- navListViewItemLink: "style_navListViewItemLink",
109569
+ navListViewItemWithLink: "style_navListViewItemWithLink",
109526
109570
  browserBar: "style_browserBar",
109527
109571
  browserBarTitle: "style_browserBarTitle",
109528
109572
  browserBarTitleLink: "style_browserBarTitleLink",
@@ -109612,11 +109656,10 @@ schema (${ast._tag}): ${ast}`;
109612
109656
  return /* @__PURE__ */ import_react204.default.createElement(
109613
109657
  $c1d7fb2ec91bae71$export$6d08773d2e66f8f2,
109614
109658
  {
109615
- href: locateResource(result.ref),
109616
109659
  key: result.ref,
109617
109660
  textValue: title
109618
109661
  },
109619
- /* @__PURE__ */ import_react204.default.createElement($cd449e8defa988f0$export$5f1af8db9871e1d6, null, title, " "),
109662
+ /* @__PURE__ */ import_react204.default.createElement($cd449e8defa988f0$export$5f1af8db9871e1d6, { UNSAFE_className: style_default.navListViewItemWithLink }, /* @__PURE__ */ import_react204.default.createElement($3c5235ac12f2c9bb$export$a6c7ac8248d6e38a, { href: locateResource(result.ref) }, title)),
109620
109663
  /* @__PURE__ */ import_react204.default.createElement($cd449e8defa988f0$export$5f1af8db9871e1d6, { slot: "description" }, getPlainTitle(getContainingPageURI(result.ref)))
109621
109664
  );
109622
109665
  }, [showMore, getPlainTitle, getContainingPageURI]);
@@ -109724,13 +109767,12 @@ schema (${ast._tag}): ${ast}`;
109724
109767
  textValue: item.title
109725
109768
  },
109726
109769
  /* @__PURE__ */ import_react206.default.createElement(
109727
- $3c5235ac12f2c9bb$export$a6c7ac8248d6e38a,
109770
+ $cd449e8defa988f0$export$5f1af8db9871e1d6,
109728
109771
  {
109729
- href: `/${item.path}`,
109730
- UNSAFE_className: style_default.navListViewItemLink,
109772
+ UNSAFE_className: style_default.navListViewItemWithLink,
109731
109773
  UNSAFE_style: { marginLeft: `${item.level * 1}em` }
109732
109774
  },
109733
- item.title
109775
+ /* @__PURE__ */ import_react206.default.createElement($3c5235ac12f2c9bb$export$a6c7ac8248d6e38a, { href: `/${item.path}` }, item.title)
109734
109776
  ),
109735
109777
  item.hasChildren ? /* @__PURE__ */ import_react206.default.createElement(
109736
109778
  $042ad0b3a4a55b33$export$cfc7921d29ef7b80,