roamjs-components 0.74.20 → 0.74.21

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "roamjs-components",
3
3
  "description": "Expansive toolset, utilities, & components for developing RoamJS extensions.",
4
- "version": "0.74.20",
4
+ "version": "0.74.21",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
7
7
  "scripts": {
@@ -1,14 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
3
  const sortBasicNodes = (c) => c
5
- .sort(({ order: a }, { order: b }) => a - b)
6
- .map((_a) => {
7
- var { order: _, children = [] } = _a, node = tslib_1.__rest(_a, ["order", "children"]);
8
- return (Object.assign({ children: sortBasicNodes(children) }, node));
9
- });
10
- const getBasicTreeByParentUid = (uid) => sortBasicNodes(window.roamAlphaAPI
11
- .q(`[:find (pull ?c [[:block/string :as "text"] :block/uid :block/order {:block/children ...}]) :where [?b :block/uid "${uid}"] [?b :block/children ?c]]`)
4
+ .sort((a, b) => (a[":block/order"] || 0) - (b[":block/order"] || 0))
5
+ .map((node) => ({
6
+ children: sortBasicNodes(node[":block/children"] || []),
7
+ uid: node[":block/uid"] || "",
8
+ text: node[":block/string"] || "",
9
+ }));
10
+ const getBasicTreeByParentUid = (uid) => sortBasicNodes(window.roamAlphaAPI.data.fast
11
+ .q(`[:find (pull ?c [:block/string :block/uid :block/order {:block/children ...}]) :where [?b :block/uid "${uid}"] [?b :block/children ?c]]`)
12
12
  .map((a) => a[0]));
13
13
  exports.default = getBasicTreeByParentUid;
14
14
  //# sourceMappingURL=getBasicTreeByParentUid.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getBasicTreeByParentUid.js","sourceRoot":"","sources":["../../src/queries/getBasicTreeByParentUid.ts"],"names":[],"mappings":";;;AAEA,MAAM,cAAc,GAAG,CAAC,CAA2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CAAC,CAAC;AAER,MAAM,uBAAuB,GAAG,CAAC,GAAW,EAAmB,EAAE,CAC/D,cAAc,CACZ,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI;KAC1B,CAAC,CACA,yGAAyG,GAAG,6BAA6B,CAC1I;KACA,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAc,CAAC,CACjC,CAAC;AAEJ,kBAAe,uBAAuB,CAAC"}
package/types/native.d.ts CHANGED
@@ -100,12 +100,6 @@ export declare type RoamBasicNode = {
100
100
  uid: string;
101
101
  children: RoamBasicNode[];
102
102
  };
103
- export declare type RoamUnorderedBasicNode = {
104
- text: string;
105
- uid: string;
106
- order: number;
107
- children?: RoamUnorderedBasicNode[];
108
- };
109
103
  export declare type RoamPull = {
110
104
  "block/children"?: RoamNode[];
111
105
  "block/heading"?: number;
@@ -125,9 +119,9 @@ export declare type RoamPull = {
125
119
  "node/title"?: string;
126
120
  } & RoamNode;
127
121
  export declare type PullBlock = {
128
- ":block/children"?: {
122
+ ":block/children"?: ({
129
123
  ":db/id": number;
130
- }[];
124
+ } | PullBlock)[];
131
125
  ":block/heading"?: number;
132
126
  ":block/open"?: boolean;
133
127
  ":block/order"?: number;