@riboseinc/anafero-cli 0.0.5 → 0.0.7

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/CLI.tsx CHANGED
@@ -138,9 +138,9 @@ function ({ task, progress, error, subtasks }) {
138
138
  <Box height={hasProgressEstimate ? 2 : 1} flexDirection="column">
139
139
  {progress
140
140
  ? <>
141
- <Box height={1} gap={2} flexGrow={0}>
141
+ <Box height={2} gap={2} flexGrow={0}>
142
142
  <Spinner label={task} />
143
- <Box flexGrow={0}>
143
+ <Box flexGrow={0} height={2}>
144
144
  <Text>{progress.state ?? 'working…'}</Text>
145
145
  </Box>
146
146
  </Box>
package/bootstrap.js CHANGED
@@ -80794,102 +80794,12 @@ var init_dist2 = __esm({
80794
80794
  }
80795
80795
  });
80796
80796
 
80797
- // ../anafero/ResourceReader.mts
80798
- var ResourceRelationSchema;
80799
- var init_ResourceReader = __esm({
80800
- "../anafero/ResourceReader.mts"() {
80801
- "use strict";
80802
- init_Schema2();
80803
- init_relations();
80804
- ResourceRelationSchema = Struct2({
80805
- /**
80806
- * Describes the type of relation.
80807
- * Currently, a plain descriptive label.
80808
- * In future may be a URI resolved to relation metadata.
80809
- *
80810
- * An example can be “hasPart”.
80811
- *
80812
- * “hasPart” relation is respected for the purposes of generating
80813
- * a hierarchy of resources.
80814
- */
80815
- predicate: String$2.pipe(nonEmptyString3()),
80816
- /**
80817
- * Object of the relation.
80818
- * Could be a root-relative slash-prepended path to another resource,
80819
- * or an URI.
80820
- *
80821
- * It could be a `file:` URI if relation points to another local file.
80822
- */
80823
- target: String$2.pipe(nonEmptyString3())
80824
- // /**
80825
- // * A reader can output relations that are not encoded in the source
80826
- // * but were computed by the adapter. Example: hasNext, seeAlso.
80827
- // */
80828
- // synthetic: S.Boolean.pipe(S.optional),
80829
- });
80830
- }
80831
- });
80832
-
80833
- // ../anafero/relations.mts
80834
- function dedupeGraph(graph) {
80835
- const seen = /* @__PURE__ */ new Set();
80836
- const newGraph = [];
80837
- for (const triple of graph) {
80838
- const key = triple.join(" ");
80839
- if (!seen.has(key)) {
80840
- seen.add(key);
80841
- if (triple[0] !== triple[2]) {
80842
- newGraph.push(triple);
80843
- }
80844
- } else {
80845
- }
80846
- }
80847
- return newGraph;
80848
- }
80849
- function dedupeResourceRelationList(rels) {
80850
- const seen = /* @__PURE__ */ new Set();
80851
- const newRels = [];
80852
- for (const rel of rels) {
80853
- const key = JSON.stringify(rel);
80854
- if (!seen.has(key)) {
80855
- seen.add(key);
80856
- newRels.push(rel);
80857
- } else {
80858
- }
80859
- }
80860
- return newRels;
80861
- }
80862
- var ROOT_SUBJECT, RelationTripleSchema, RelationGraphAsListSchema;
80863
- var init_relations = __esm({
80864
- "../anafero/relations.mts"() {
80865
- "use strict";
80866
- init_Schema2();
80867
- init_ResourceReader();
80868
- ROOT_SUBJECT = "_:root";
80869
- RelationTripleSchema = Tuple2(
80870
- // TODO: Named tuple elements with Effect Schema—possible?
80871
- // These annotations do not carry to typing hints.
80872
- element2(String$2.pipe(nonEmptyString3())).annotations({
80873
- title: "Object being described (subject of the relation)"
80874
- }),
80875
- element2(String$2.pipe(nonEmptyString3())).annotations({
80876
- title: "Predicate of the relation (property name)"
80877
- }),
80878
- element2(String$2).annotations({
80879
- title: "Object or target of the relation (property value)"
80880
- })
80881
- );
80882
- RelationGraphAsListSchema = mutable4(Array$2(RelationTripleSchema));
80883
- }
80884
- });
80885
-
80886
80797
  // ../anafero/Layout.mts
80887
80798
  var NavLinkSchema, ResourceNavSchema;
80888
80799
  var init_Layout = __esm({
80889
80800
  "../anafero/Layout.mts"() {
80890
80801
  "use strict";
80891
80802
  init_Schema2();
80892
- init_relations();
80893
80803
  NavLinkSchema = Struct2({
80894
80804
  path: String$2,
80895
80805
  plainTitle: String$2
@@ -92068,7 +91978,96 @@ var init_esm = __esm({
92068
91978
  }
92069
91979
  });
92070
91980
 
92071
- // ../anafero/ContentGenerator.mts
91981
+ // ../anafero/relations.mts
91982
+ function dedupeGraph(graph) {
91983
+ const seen = /* @__PURE__ */ new Set();
91984
+ const newGraph = [];
91985
+ for (const triple of graph) {
91986
+ const key = triple.join(" ");
91987
+ if (!seen.has(key)) {
91988
+ seen.add(key);
91989
+ if (triple[0] !== triple[2]) {
91990
+ newGraph.push(triple);
91991
+ }
91992
+ } else {
91993
+ }
91994
+ }
91995
+ return newGraph;
91996
+ }
91997
+ function dedupeResourceRelationList(rels) {
91998
+ const seen = /* @__PURE__ */ new Set();
91999
+ const newRels = [];
92000
+ for (const rel of rels) {
92001
+ const key = JSON.stringify(rel);
92002
+ if (!seen.has(key)) {
92003
+ seen.add(key);
92004
+ newRels.push(rel);
92005
+ } else {
92006
+ }
92007
+ }
92008
+ return newRels;
92009
+ }
92010
+ var ROOT_SUBJECT, RelationTripleSchema, RelationGraphAsListSchema;
92011
+ var init_relations = __esm({
92012
+ "../anafero/relations.mts"() {
92013
+ "use strict";
92014
+ init_Schema2();
92015
+ init_StoreAdapter();
92016
+ ROOT_SUBJECT = "_:root";
92017
+ RelationTripleSchema = Tuple2(
92018
+ // TODO: Named tuple elements with Effect Schema—possible?
92019
+ // These annotations do not carry to typing hints.
92020
+ element2(String$2.pipe(nonEmptyString3())).annotations({
92021
+ title: "Object being described (subject of the relation)"
92022
+ }),
92023
+ element2(String$2.pipe(nonEmptyString3())).annotations({
92024
+ title: "Predicate of the relation (property name)"
92025
+ }),
92026
+ element2(String$2).annotations({
92027
+ title: "Object or target of the relation (property value)"
92028
+ })
92029
+ );
92030
+ RelationGraphAsListSchema = mutable4(Array$2(RelationTripleSchema));
92031
+ }
92032
+ });
92033
+
92034
+ // ../anafero/StoreAdapter.mts
92035
+ var ResourceRelationSchema;
92036
+ var init_StoreAdapter = __esm({
92037
+ "../anafero/StoreAdapter.mts"() {
92038
+ "use strict";
92039
+ init_Schema2();
92040
+ init_relations();
92041
+ ResourceRelationSchema = Struct2({
92042
+ /**
92043
+ * Describes the type of relation.
92044
+ * Currently, a plain descriptive label.
92045
+ * In future may be a URI resolved to relation metadata.
92046
+ *
92047
+ * An example can be “hasPart”.
92048
+ *
92049
+ * “hasPart” relation is respected for the purposes of generating
92050
+ * a hierarchy of resources.
92051
+ */
92052
+ predicate: String$2.pipe(nonEmptyString3()),
92053
+ /**
92054
+ * Object of the relation.
92055
+ * Could be a root-relative slash-prepended path to another resource,
92056
+ * or an URI.
92057
+ *
92058
+ * It could be a `file:` URI if relation points to another local file.
92059
+ */
92060
+ target: String$2.pipe(nonEmptyString3())
92061
+ // /**
92062
+ // * A reader can output relations that are not encoded in the source
92063
+ // * but were computed by the adapter. Example: hasNext, seeAlso.
92064
+ // */
92065
+ // synthetic: S.Boolean.pipe(S.optional),
92066
+ });
92067
+ }
92068
+ });
92069
+
92070
+ // ../anafero/ContentAdapter.mts
92072
92071
  function gatherDescribedResourcesFromJsonifiedProseMirrorNode(jsonifiedNode, _accum) {
92073
92072
  const accumulator = _accum ?? /* @__PURE__ */ new Set();
92074
92073
  const maybeResourceID = jsonifiedNode?.attrs?.resourceID;
@@ -92092,12 +92091,12 @@ function fillInLocale(langID) {
92092
92091
  }
92093
92092
  }
92094
92093
  var ResourceMetadataSchema, DEFAULT_LOCALE, ResourceContentSchema, AdapterGeneratedResourceContentSchema;
92095
- var init_ContentGenerator = __esm({
92096
- "../anafero/ContentGenerator.mts"() {
92094
+ var init_ContentAdapter = __esm({
92095
+ "../anafero/ContentAdapter.mts"() {
92097
92096
  "use strict";
92098
92097
  init_Schema2();
92099
92098
  init_esm();
92100
- init_ResourceReader();
92099
+ init_StoreAdapter();
92101
92100
  init_relations();
92102
92101
  ResourceMetadataSchema = mutable4(Struct2({
92103
92102
  // TODO: rich ProseMirror labels?
@@ -92199,8 +92198,8 @@ var init_Config2 = __esm({
92199
92198
  "../anafero/Config.mts"() {
92200
92199
  "use strict";
92201
92200
  init_Schema2();
92202
- init_ResourceReader();
92203
- init_ContentGenerator();
92201
+ init_StoreAdapter();
92202
+ init_ContentAdapter();
92204
92203
  init_Layout();
92205
92204
  BuildConfigSchema = Struct2({
92206
92205
  version: Literal4("0.1"),
@@ -95202,8 +95201,8 @@ var init_anafero = __esm({
95202
95201
  init_Layout();
95203
95202
  init_search();
95204
95203
  init_TitleSchema();
95205
- init_ContentGenerator();
95206
- init_ResourceReader();
95204
+ init_ContentAdapter();
95205
+ init_StoreAdapter();
95207
95206
  init_relations();
95208
95207
  init_versioning();
95209
95208
  init_Config2();
@@ -131496,7 +131495,7 @@ init_dist4();
131496
131495
  init_esm();
131497
131496
  init_Config2();
131498
131497
  init_relations();
131499
- init_ContentGenerator();
131498
+ init_ContentAdapter();
131500
131499
  init_Layout();
131501
131500
  init_ResourceNavigationContext();
131502
131501
 
@@ -131530,7 +131529,6 @@ var Resource = import_react213.default.forwardRef(function({
131530
131529
  "aria-selected": ariaSelected
131531
131530
  }, ref) {
131532
131531
  const adapter2 = useDependency(content.adapterID);
131533
- const categorizedRelations = useCategorizedRelations(graph, adapter2);
131534
131532
  const schema = useProseMirrorSchema(
131535
131533
  content.content?.contentSchemaID ?? "",
131536
131534
  adapter2
@@ -131674,7 +131672,6 @@ var Resource = import_react213.default.forwardRef(function({
131674
131672
  ref: layoutRef,
131675
131673
  ResourceLink: () => "",
131676
131674
  nav: resourceNav,
131677
- relations: categorizedRelations.nonContent,
131678
131675
  locateResource,
131679
131676
  resourceTitle: ""
131680
131677
  },
@@ -131695,26 +131692,6 @@ var Resource = import_react213.default.forwardRef(function({
131695
131692
  )
131696
131693
  );
131697
131694
  });
131698
- function useCategorizedRelations(relations, adapter2) {
131699
- return (0, import_react213.useMemo)(() => {
131700
- if (relations.length < 1 || !adapter2) {
131701
- return { content: [], nonContent: [] };
131702
- }
131703
- return relations.map(([subj, predicate, target]) => [
131704
- [subj, predicate, target],
131705
- adapter2.contributesToContent(
131706
- { predicate, target },
131707
- relations.filter(([s]) => s === target)
131708
- )
131709
- ]).reduce((accumulator, [rel, isContent]) => ({
131710
- content: isContent ? [...accumulator.content, rel] : accumulator.content,
131711
- nonContent: !isContent ? [...accumulator.nonContent, rel] : accumulator.nonContent
131712
- }), {
131713
- content: [],
131714
- nonContent: []
131715
- });
131716
- }, [adapter2, relations]);
131717
- }
131718
131695
  function useProseMirrorSchema(schemaID, adapter2) {
131719
131696
  return (0, import_react213.useMemo)(() => {
131720
131697
  if (!adapter2) {
@@ -132354,7 +132331,7 @@ var AppLoader = function() {
132354
132331
  });
132355
132332
  }, [nonCurrentActiveVersionID, sharedDeps?.["/versions.json"]]);
132356
132333
  const versionPrefix = nonCurrentActiveVersionID === void 0 ? void 0 : nonCurrentActiveVersionID ? `/${nonCurrentActiveVersionID}` : "";
132357
- const getVersionedPath = (0, import_react217.useMemo)(() => versionPrefix !== void 0 ? function(slashPrependedPath) {
132334
+ const getVersionedPath = (0, import_react217.useMemo)(() => versionPrefix !== void 0 || pathPrefix !== "" ? function(slashPrependedPath) {
132358
132335
  const versioned = `${pathPrefix}${versionPrefix}${slashPrependedPath}`;
132359
132336
  return versioned;
132360
132337
  } : void 0, [pathPrefix, versionPrefix]);
@@ -132403,7 +132380,7 @@ var AppLoader = function() {
132403
132380
  if (rpath.includes("#")) {
132404
132381
  throw new Error("Will not return data asset paths for a resource that does not have its own page");
132405
132382
  }
132406
- return Object.entries(RESOURCE_DATA_PATHS).map(([propID, path]) => ({ [propID]: `${rpath}/${path}` })).reduce(
132383
+ return Object.entries(RESOURCE_DATA_PATHS).map(([propID, path]) => ({ [propID]: [rpath === "/" ? "" : rpath, path].join("/") })).reduce(
132407
132384
  (prev, curr) => ({ ...prev, ...curr }),
132408
132385
  {}
132409
132386
  );
@@ -132613,7 +132590,7 @@ var VersionWorkspace = function({
132613
132590
  }, [dependencies]);
132614
132591
  const expandResourcePath = (0, import_react217.useCallback)((rpath) => {
132615
132592
  const hasFragment = rpath.indexOf("#") >= 1;
132616
- const withTrailing = `${rpath}${rpath !== "" ? "/" : ""}`;
132593
+ const withTrailing = `${rpath}${rpath !== "" && rpath !== "/" ? "/" : ""}`;
132617
132594
  return [
132618
132595
  withTrailing,
132619
132596
  hasFragment ? `#${rpath.split("#")[1]}` : null