roamjs-components 0.32.1 → 0.32.2
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/README.md +25 -11
- package/date/constants.d.ts +2 -0
- package/date/constants.js +3 -0
- package/date/constants.js.map +1 -0
- package/date/index.d.ts +5 -0
- package/date/index.js +6 -0
- package/date/index.js.map +1 -0
- package/date/parseRoamDate.d.ts +2 -0
- package/date/parseRoamDate.js +4 -0
- package/date/parseRoamDate.js.map +1 -0
- package/date/parseRoamDateUid.d.ts +2 -0
- package/date/parseRoamDateUid.js +4 -0
- package/date/parseRoamDateUid.js.map +1 -0
- package/date/toRoamDate.d.ts +2 -0
- package/date/toRoamDate.js +4 -0
- package/date/toRoamDate.js.map +1 -0
- package/date/toRoamDateUid.d.ts +2 -0
- package/date/toRoamDateUid.js +4 -0
- package/date/toRoamDateUid.js.map +1 -0
- package/dom/addBlockCommand.d.ts +5 -0
- package/dom/addBlockCommand.js +52 -0
- package/dom/addBlockCommand.js.map +1 -0
- package/dom/addOldRoamJSDependency.d.ts +2 -0
- package/dom/addOldRoamJSDependency.js +15 -0
- package/dom/addOldRoamJSDependency.js.map +1 -0
- package/dom/addRoamJSDependency.d.ts +2 -0
- package/dom/addRoamJSDependency.js +6 -0
- package/dom/addRoamJSDependency.js.map +1 -0
- package/dom/addStyle.d.ts +2 -0
- package/dom/addStyle.js +13 -0
- package/dom/addStyle.js.map +1 -0
- package/dom/constants.d.ts +1 -0
- package/dom/constants.js +2 -0
- package/dom/constants.js.map +1 -0
- package/dom/createBlockObserver.d.ts +2 -0
- package/dom/createBlockObserver.js +17 -0
- package/dom/createBlockObserver.js.map +1 -0
- package/dom/createButtonObserver.d.ts +6 -0
- package/dom/createButtonObserver.js +19 -0
- package/dom/createButtonObserver.js.map +1 -0
- package/dom/createDivObserver.d.ts +2 -0
- package/dom/createDivObserver.js +6 -0
- package/dom/createDivObserver.js.map +1 -0
- package/dom/createHTMLObserver.d.ts +8 -0
- package/dom/createHTMLObserver.js +27 -0
- package/dom/createHTMLObserver.js.map +1 -0
- package/dom/createHashtagObserver.d.ts +5 -0
- package/dom/createHashtagObserver.js +14 -0
- package/dom/createHashtagObserver.js.map +1 -0
- package/dom/createIconButton.d.ts +2 -0
- package/dom/createIconButton.js +11 -0
- package/dom/createIconButton.js.map +1 -0
- package/dom/createObserver.d.ts +2 -0
- package/dom/createObserver.js +4 -0
- package/dom/createObserver.js.map +1 -0
- package/dom/createOverlayObserver.d.ts +2 -0
- package/dom/createOverlayObserver.js +4 -0
- package/dom/createOverlayObserver.js.map +1 -0
- package/dom/createPageObserver.d.ts +2 -0
- package/dom/createPageObserver.js +32 -0
- package/dom/createPageObserver.js.map +1 -0
- package/dom/createPageTitleObserver.d.ts +6 -0
- package/dom/createPageTitleObserver.js +27 -0
- package/dom/createPageTitleObserver.js.map +1 -0
- package/dom/genericError.d.ts +4 -0
- package/dom/genericError.js +15 -0
- package/dom/genericError.js.map +1 -0
- package/dom/getActiveUids.d.ts +3 -0
- package/dom/getActiveUids.js +4 -0
- package/dom/getActiveUids.js.map +1 -0
- package/dom/getBlockUidFromTarget.d.ts +2 -0
- package/dom/getBlockUidFromTarget.js +31 -0
- package/dom/getBlockUidFromTarget.js.map +1 -0
- package/dom/getCurrentPageUid.d.ts +2 -0
- package/dom/getCurrentPageUid.js +4 -0
- package/dom/getCurrentPageUid.js.map +1 -0
- package/dom/getDomRefs.d.ts +2 -0
- package/dom/getDomRefs.js +10 -0
- package/dom/getDomRefs.js.map +1 -0
- package/dom/getDropUidOffset.d.ts +5 -0
- package/dom/getDropUidOffset.js +25 -0
- package/dom/getDropUidOffset.js.map +1 -0
- package/dom/getMutatedNodes.d.ts +7 -0
- package/dom/getMutatedNodes.js +10 -0
- package/dom/getMutatedNodes.js.map +1 -0
- package/dom/getPageTitleByHtmlElement.d.ts +2 -0
- package/dom/getPageTitleByHtmlElement.js +11 -0
- package/dom/getPageTitleByHtmlElement.js.map +1 -0
- package/dom/getPageTitleValueByHtmlElement.d.ts +2 -0
- package/dom/getPageTitleValueByHtmlElement.js +25 -0
- package/dom/getPageTitleValueByHtmlElement.js.map +1 -0
- package/dom/getReferenceBlockUid.d.ts +2 -0
- package/dom/getReferenceBlockUid.js +16 -0
- package/dom/getReferenceBlockUid.js.map +1 -0
- package/dom/getRoamUrl.d.ts +2 -0
- package/dom/getRoamUrl.js +3 -0
- package/dom/getRoamUrl.js.map +1 -0
- package/dom/getRoamUrlByPage.d.ts +2 -0
- package/dom/getRoamUrlByPage.js +8 -0
- package/dom/getRoamUrlByPage.js.map +1 -0
- package/dom/getUids.d.ts +3 -0
- package/dom/getUids.js +6 -0
- package/dom/getUids.js.map +1 -0
- package/dom/getUidsFromButton.d.ts +3 -0
- package/dom/getUidsFromButton.js +7 -0
- package/dom/getUidsFromButton.js.map +1 -0
- package/dom/getUidsFromId.d.ts +5 -0
- package/dom/getUidsFromId.js +14 -0
- package/dom/getUidsFromId.js.map +1 -0
- package/dom/index.d.ts +30 -0
- package/dom/index.js +31 -0
- package/dom/index.js.map +1 -0
- package/dom/openBlock.d.ts +2 -0
- package/dom/openBlock.js +4 -0
- package/dom/openBlock.js.map +1 -0
- package/dom/openBlockElement.d.ts +2 -0
- package/dom/openBlockElement.js +15 -0
- package/dom/openBlockElement.js.map +1 -0
- package/dom/parseRoamBlocksToHtml.d.ts +9 -0
- package/dom/parseRoamBlocksToHtml.js +74 -0
- package/dom/parseRoamBlocksToHtml.js.map +1 -0
- package/dom/resolveRefs.d.ts +2 -0
- package/dom/resolveRefs.js +22 -0
- package/dom/resolveRefs.js.map +1 -0
- package/events/watchOnce.d.ts +3 -0
- package/events/watchOnce.js +10 -0
- package/events/watchOnce.js.map +1 -0
- package/marked/index.d.ts +14 -0
- package/marked/index.js +540 -0
- package/marked/index.js.map +1 -0
- package/package.json +9 -2
- package/queries/getAllBlockUids.d.ts +2 -0
- package/queries/getAllBlockUids.js +5 -0
- package/queries/getAllBlockUids.js.map +1 -0
- package/queries/getAllBlockUidsAndTexts.d.ts +5 -0
- package/queries/getAllBlockUidsAndTexts.js +5 -0
- package/queries/getAllBlockUidsAndTexts.js.map +1 -0
- package/queries/getAllPageNames.d.ts +2 -0
- package/queries/getAllPageNames.js +5 -0
- package/queries/getAllPageNames.js.map +1 -0
- package/queries/getBasicTreeByParentUid.d.ts +3 -0
- package/queries/getBasicTreeByParentUid.js +12 -0
- package/queries/getBasicTreeByParentUid.js.map +1 -0
- package/queries/getBlockUidAndTextIncludingText.d.ts +5 -0
- package/queries/getBlockUidAndTextIncludingText.js +5 -0
- package/queries/getBlockUidAndTextIncludingText.js.map +1 -0
- package/queries/getBlockUidByTextOnPage.d.ts +5 -0
- package/queries/getBlockUidByTextOnPage.js +6 -0
- package/queries/getBlockUidByTextOnPage.js.map +1 -0
- package/queries/getBlockUidsAndTextsReferencingPage.d.ts +5 -0
- package/queries/getBlockUidsAndTextsReferencingPage.js +6 -0
- package/queries/getBlockUidsAndTextsReferencingPage.js.map +1 -0
- package/queries/getBlockUidsByPageTitle.d.ts +2 -0
- package/queries/getBlockUidsByPageTitle.js +6 -0
- package/queries/getBlockUidsByPageTitle.js.map +1 -0
- package/queries/getBlockUidsReferencingBlock.d.ts +2 -0
- package/queries/getBlockUidsReferencingBlock.js +5 -0
- package/queries/getBlockUidsReferencingBlock.js.map +1 -0
- package/queries/getBlockUidsReferencingPage.d.ts +2 -0
- package/queries/getBlockUidsReferencingPage.js +6 -0
- package/queries/getBlockUidsReferencingPage.js.map +1 -0
- package/queries/getBlockUidsWithParentUid.d.ts +2 -0
- package/queries/getBlockUidsWithParentUid.js +5 -0
- package/queries/getBlockUidsWithParentUid.js.map +1 -0
- package/queries/getChildrenLengthByPageUid.d.ts +2 -0
- package/queries/getChildrenLengthByPageUid.js +3 -0
- package/queries/getChildrenLengthByPageUid.js.map +1 -0
- package/queries/getCreateTimeByBlockUid.d.ts +2 -0
- package/queries/getCreateTimeByBlockUid.js +6 -0
- package/queries/getCreateTimeByBlockUid.js.map +1 -0
- package/queries/getCurrentUser.d.ts +2 -0
- package/queries/getCurrentUser.js +10 -0
- package/queries/getCurrentUser.js.map +1 -0
- package/queries/getCurrentUserDisplayName.d.ts +2 -0
- package/queries/getCurrentUserDisplayName.js +11 -0
- package/queries/getCurrentUserDisplayName.js.map +1 -0
- package/queries/getCurrentUserEmail.d.ts +2 -0
- package/queries/getCurrentUserEmail.js +11 -0
- package/queries/getCurrentUserEmail.js.map +1 -0
- package/queries/getCurrentUserUid.d.ts +2 -0
- package/queries/getCurrentUserUid.js +11 -0
- package/queries/getCurrentUserUid.js.map +1 -0
- package/queries/getDisplayNameByEmail.d.ts +2 -0
- package/queries/getDisplayNameByEmail.js +6 -0
- package/queries/getDisplayNameByEmail.js.map +1 -0
- package/queries/getDisplayNameByUid.d.ts +2 -0
- package/queries/getDisplayNameByUid.js +6 -0
- package/queries/getDisplayNameByUid.js.map +1 -0
- package/queries/getEditTimeByBlockUid.d.ts +2 -0
- package/queries/getEditTimeByBlockUid.js +6 -0
- package/queries/getEditTimeByBlockUid.js.map +1 -0
- package/queries/getEditedUserEmailByBlockUid.d.ts +2 -0
- package/queries/getEditedUserEmailByBlockUid.js +6 -0
- package/queries/getEditedUserEmailByBlockUid.js.map +1 -0
- package/queries/getFirstChildTextByBlockUid.d.ts +2 -0
- package/queries/getFirstChildTextByBlockUid.js +6 -0
- package/queries/getFirstChildTextByBlockUid.js.map +1 -0
- package/queries/getFirstChildUidByBlockUid.d.ts +2 -0
- package/queries/getFirstChildUidByBlockUid.js +4 -0
- package/queries/getFirstChildUidByBlockUid.js.map +1 -0
- package/queries/getFullTreeByParentUid.d.ts +3 -0
- package/queries/getFullTreeByParentUid.js +39 -0
- package/queries/getFullTreeByParentUid.js.map +1 -0
- package/queries/getLinkedPageTitlesUnderUid.d.ts +2 -0
- package/queries/getLinkedPageTitlesUnderUid.js +5 -0
- package/queries/getLinkedPageTitlesUnderUid.js.map +1 -0
- package/queries/getNthChildUidByBlockUid.d.ts +5 -0
- package/queries/getNthChildUidByBlockUid.js +6 -0
- package/queries/getNthChildUidByBlockUid.js.map +1 -0
- package/queries/getOrderByBlockUid.d.ts +2 -0
- package/queries/getOrderByBlockUid.js +6 -0
- package/queries/getOrderByBlockUid.js.map +1 -0
- package/queries/getPageTitleByBlockUid.d.ts +2 -0
- package/queries/getPageTitleByBlockUid.js +6 -0
- package/queries/getPageTitleByBlockUid.js.map +1 -0
- package/queries/getPageTitleReferencesByPageTitle.d.ts +2 -0
- package/queries/getPageTitleReferencesByPageTitle.js +6 -0
- package/queries/getPageTitleReferencesByPageTitle.js.map +1 -0
- package/queries/getPageTitlesAndBlockUidsReferencingPage.d.ts +5 -0
- package/queries/getPageTitlesAndBlockUidsReferencingPage.js +6 -0
- package/queries/getPageTitlesAndBlockUidsReferencingPage.js.map +1 -0
- package/queries/getPageTitlesAndUidsDirectlyReferencingPage.d.ts +5 -0
- package/queries/getPageTitlesAndUidsDirectlyReferencingPage.js +6 -0
- package/queries/getPageTitlesAndUidsDirectlyReferencingPage.js.map +1 -0
- package/queries/getPageTitlesReferencingBlockUid.d.ts +2 -0
- package/queries/getPageTitlesReferencingBlockUid.js +5 -0
- package/queries/getPageTitlesReferencingBlockUid.js.map +1 -0
- package/queries/getPageTitlesStartingWithPrefix.d.ts +2 -0
- package/queries/getPageTitlesStartingWithPrefix.js +5 -0
- package/queries/getPageTitlesStartingWithPrefix.js.map +1 -0
- package/queries/getPageUidByPageTitle.d.ts +2 -0
- package/queries/getPageUidByPageTitle.js +7 -0
- package/queries/getPageUidByPageTitle.js.map +1 -0
- package/queries/getPageViewType.d.ts +3 -0
- package/queries/getPageViewType.js +7 -0
- package/queries/getPageViewType.js.map +1 -0
- package/queries/getParentTextByBlockUid.d.ts +2 -0
- package/queries/getParentTextByBlockUid.js +6 -0
- package/queries/getParentTextByBlockUid.js.map +1 -0
- package/queries/getParentTextByBlockUidAndTag.d.ts +5 -0
- package/queries/getParentTextByBlockUidAndTag.js +6 -0
- package/queries/getParentTextByBlockUidAndTag.js.map +1 -0
- package/queries/getParentUidByBlockUid.d.ts +2 -0
- package/queries/getParentUidByBlockUid.js +6 -0
- package/queries/getParentUidByBlockUid.js.map +1 -0
- package/queries/getParentUidsOfBlockUid.d.ts +2 -0
- package/queries/getParentUidsOfBlockUid.js +5 -0
- package/queries/getParentUidsOfBlockUid.js.map +1 -0
- package/queries/getSettingsByEmail.d.ts +3 -0
- package/queries/getSettingsByEmail.js +6 -0
- package/queries/getSettingsByEmail.js.map +1 -0
- package/queries/getShallowTreeByParentUid.d.ts +5 -0
- package/queries/getShallowTreeByParentUid.js +9 -0
- package/queries/getShallowTreeByParentUid.js.map +1 -0
- package/queries/getTextByBlockUid.d.ts +2 -0
- package/queries/getTextByBlockUid.js +6 -0
- package/queries/getTextByBlockUid.js.map +1 -0
- package/queries/index.d.ts +43 -0
- package/queries/index.js +44 -0
- package/queries/index.js.map +1 -0
- package/queries/isTagOnPage.d.ts +5 -0
- package/queries/isTagOnPage.js +7 -0
- package/queries/isTagOnPage.js.map +1 -0
- package/queries/normalizePageTitle.d.ts +2 -0
- package/queries/normalizePageTitle.js +3 -0
- package/queries/normalizePageTitle.js.map +1 -0
- package/types/index.d.ts +330 -0
- package/types/index.js +2 -0
- package/types/index.js.map +1 -0
- package/writes/clearBlockById.d.ts +2 -0
- package/writes/clearBlockById.js +9 -0
- package/writes/clearBlockById.js.map +1 -0
- package/writes/clearBlockByUid.d.ts +2 -0
- package/writes/clearBlockByUid.js +8 -0
- package/writes/clearBlockByUid.js.map +1 -0
- package/writes/createBlock.d.ts +7 -0
- package/writes/createBlock.js +19 -0
- package/writes/createBlock.js.map +1 -0
- package/writes/createPage.d.ts +6 -0
- package/writes/createPage.js +14 -0
- package/writes/createPage.js.map +1 -0
- package/writes/deleteBlock.d.ts +2 -0
- package/writes/deleteBlock.js +6 -0
- package/writes/deleteBlock.js.map +1 -0
- package/writes/index.d.ts +8 -0
- package/writes/index.js +9 -0
- package/writes/index.js.map +1 -0
- package/writes/openBlockInSidebar.d.ts +2 -0
- package/writes/openBlockInSidebar.js +12 -0
- package/writes/openBlockInSidebar.js.map +1 -0
- package/writes/updateActiveBlock.d.ts +2 -0
- package/writes/updateActiveBlock.js +9 -0
- package/writes/updateActiveBlock.js.map +1 -0
- package/writes/updateBlock.d.ts +5 -0
- package/writes/updateBlock.js +15 -0
- package/writes/updateBlock.js.map +1 -0
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
const getParentTextByBlockUidAndTag = ({ blockUid, tag, }) => {
|
|
2
|
+
var _a, _b;
|
|
3
|
+
return ((_b = (_a = window.roamAlphaAPI.q(`[:find ?s :where [?t :node/title "${tag}"] [?p :block/refs ?t] [?p :block/string ?s] [?b :block/parents ?p] [?b :block/uid "${blockUid}"]]`)) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b[0]) || "";
|
|
4
|
+
};
|
|
5
|
+
export default getParentTextByBlockUidAndTag;
|
|
6
|
+
//# sourceMappingURL=getParentTextByBlockUidAndTag.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getParentTextByBlockUidAndTag.js","sourceRoot":"","sources":["../src/queries/getParentTextByBlockUidAndTag.ts"],"names":[],"mappings":"AAAA,MAAM,6BAA6B,GAAG,CAAC,EACrC,QAAQ,EACR,GAAG,GAIJ,EAAU,EAAE;;IACX,OAAA,CAAC,MAAA,MAAA,MAAM,CAAC,YAAY,CAAC,CAAC,CACpB,qCAAqC,GAAG,uFAAuF,QAAQ,KAAK,CAC7I,0CAAG,CAAC,CAAC,0CAAG,CAAC,CAAY,KAAI,EAAE,CAAA;CAAA,CAAC;AAE/B,eAAe,6BAA6B,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
const getParentUidByBlockUid = (blockUid) => {
|
|
2
|
+
var _a, _b;
|
|
3
|
+
return (_b = (_a = window.roamAlphaAPI.q(`[:find ?u :where [?p :block/uid ?u] [?p :block/children ?e] [?e :block/uid "${blockUid}"]]`)) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b[0];
|
|
4
|
+
};
|
|
5
|
+
export default getParentUidByBlockUid;
|
|
6
|
+
//# sourceMappingURL=getParentUidByBlockUid.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getParentUidByBlockUid.js","sourceRoot":"","sources":["../src/queries/getParentUidByBlockUid.ts"],"names":[],"mappings":"AAAA,MAAM,sBAAsB,GAAG,CAAC,QAAgB,EAAU,EAAE;;IAC1D,OAAA,MAAA,MAAA,MAAM,CAAC,YAAY,CAAC,CAAC,CACnB,+EAA+E,QAAQ,KAAK,CAC7F,0CAAG,CAAC,CAAC,0CAAG,CAAC,CAAW,CAAA;CAAA,CAAC;AAExB,eAAe,sBAAsB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getParentUidsOfBlockUid.js","sourceRoot":"","sources":["../src/queries/getParentUidsOfBlockUid.ts"],"names":[],"mappings":"AAAA,MAAM,uBAAuB,GAAG,CAAC,GAAW,EAAY,EAAE,CACxD,MAAM,CAAC,YAAY;KAChB,CAAC,CACA,8EAA8E,GAAG,KAAK,CACvF;KACA,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAW,CAAC,CAAC;AAEhC,eAAe,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
const getSettingsByEmail = (email) => {
|
|
2
|
+
var _a, _b;
|
|
3
|
+
return ((_b = (_a = window.roamAlphaAPI.q(`[:find ?settings :where[?e :user/settings ?settings] [?e :user/email "${email}"]]`)) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b[0]) || {};
|
|
4
|
+
};
|
|
5
|
+
export default getSettingsByEmail;
|
|
6
|
+
//# sourceMappingURL=getSettingsByEmail.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getSettingsByEmail.js","sourceRoot":"","sources":["../src/queries/getSettingsByEmail.ts"],"names":[],"mappings":"AAEA,MAAM,kBAAkB,GAAG,CAAC,KAAa,EAAgB,EAAE;;IACzD,OAAA,CAAC,MAAA,MAAA,MAAM,CAAC,YAAY,CAAC,CAAC,CACpB,yEAAyE,KAAK,KAAK,CACpF,0CAAG,CAAC,CAAC,0CAAG,CAAC,CAAkB,KAAI,EAAE,CAAA;CAAA,CAAC;AAErC,eAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const getShallowTreeByParentUid = (parentUid) => window.roamAlphaAPI
|
|
2
|
+
.q(`[:find (pull ?c [:block/uid :block/string :block/order]) :where [?b :block/uid "${parentUid}"] [?b :block/children ?c]]`)
|
|
3
|
+
.sort((a, b) => a[0].order - b[0].order)
|
|
4
|
+
.map(([a]) => ({
|
|
5
|
+
uid: a.uid,
|
|
6
|
+
text: a.string,
|
|
7
|
+
}));
|
|
8
|
+
export default getShallowTreeByParentUid;
|
|
9
|
+
//# sourceMappingURL=getShallowTreeByParentUid.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getShallowTreeByParentUid.js","sourceRoot":"","sources":["../src/queries/getShallowTreeByParentUid.ts"],"names":[],"mappings":"AAAA,MAAM,yBAAyB,GAAG,CAChC,SAAiB,EACgB,EAAE,CACnC,MAAM,CAAC,YAAY;KAChB,CAAC,CACA,mFAAmF,SAAS,6BAA6B,CAC1H;KACA,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;KACvC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAoC,EAAE,EAAE,CAAC,CAAC;IAChD,GAAG,EAAE,CAAC,CAAC,GAAG;IACV,IAAI,EAAE,CAAC,CAAC,MAAM;CACf,CAAC,CAAC,CAAC;AAER,eAAe,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
const getTextByBlockUid = (uid) => {
|
|
2
|
+
var _a, _b, _c;
|
|
3
|
+
return ((_c = (_b = (_a = window.roamAlphaAPI.q(`[:find (pull ?e [:block/string]) :where [?e :block/uid "${uid}"]]`)) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.string) || "";
|
|
4
|
+
};
|
|
5
|
+
export default getTextByBlockUid;
|
|
6
|
+
//# sourceMappingURL=getTextByBlockUid.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getTextByBlockUid.js","sourceRoot":"","sources":["../src/queries/getTextByBlockUid.ts"],"names":[],"mappings":"AAAA,MAAM,iBAAiB,GAAG,CAAC,GAAW,EAAU,EAAE;;IAChD,OAAA,CAAA,MACE,MAAA,MAAA,MAAM,CAAC,YAAY,CAAC,CAAC,CACnB,2DAA2D,GAAG,KAAK,CACpE,0CAAG,CAAC,CAAC,0CAAG,CAAC,CACX,0CAAE,MAAM,KAAI,EAAE,CAAA;CAAA,CAAC;AAElB,eAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export { default as getAllBlockUids } from "./getAllBlockUids";
|
|
2
|
+
export { default as getAllBlockUidsAndTexts } from "./getAllBlockUidsAndTexts";
|
|
3
|
+
export { default as getAllPageNames } from "./getAllPageNames";
|
|
4
|
+
export { default as getBasicTreeByParentUid } from "./getBasicTreeByParentUid";
|
|
5
|
+
export { default as getBlockUidAndTextIncludingText } from "./getBlockUidAndTextIncludingText";
|
|
6
|
+
export { default as getBlockUidByTextOnPage } from "./getBlockUidByTextOnPage";
|
|
7
|
+
export { default as getBlockUidsAndTextsReferencingPage } from "./getBlockUidsAndTextsReferencingPage";
|
|
8
|
+
export { default as getBlockUidsByPageTitle } from "./getBlockUidsByPageTitle";
|
|
9
|
+
export { default as getBlockUidsReferencingBlock } from "./getBlockUidsReferencingBlock";
|
|
10
|
+
export { default as getBlockUidsReferencingPage } from "./getBlockUidsReferencingPage";
|
|
11
|
+
export { default as getBlockUidsWithParentUid } from "./getBlockUidsWithParentUid";
|
|
12
|
+
export { default as getChildrenLengthByPageUid } from "./getChildrenLengthByPageUid";
|
|
13
|
+
export { default as getCurrentUserDisplayName } from "./getCurrentUserDisplayName";
|
|
14
|
+
export { default as getCurrentUserEmail } from "./getCurrentUserEmail";
|
|
15
|
+
export { default as getCurrentUserUid } from "./getCurrentUserUid";
|
|
16
|
+
export { default as getFirstChildTextByBlockUid } from "./getFirstChildTextByBlockUid";
|
|
17
|
+
export { default as getFirstChildUidByBlockUid } from "./getFirstChildUidByBlockUid";
|
|
18
|
+
export { default as getCreateTimeByBlockUid } from "./getCreateTimeByBlockUid";
|
|
19
|
+
export { default as getDisplayNameByEmail } from "./getDisplayNameByEmail";
|
|
20
|
+
export { default as getDisplayNameByUid } from "./getDisplayNameByUid";
|
|
21
|
+
export { default as getEditTimeByBlockUid } from "./getEditTimeByBlockUid";
|
|
22
|
+
export { default as getEditedUserEmailByBlockUid } from "./getEditedUserEmailByBlockUid";
|
|
23
|
+
export { default as getFullTreeByParentUid } from "./getFullTreeByParentUid";
|
|
24
|
+
export { default as getLinkedPageTitlesUnderUid } from "./getLinkedPageTitlesUnderUid";
|
|
25
|
+
export { default as getNthChildUidByBlockUid } from "./getNthChildUidByBlockUid";
|
|
26
|
+
export { default as getOrderByBlockUid } from "./getOrderByBlockUid";
|
|
27
|
+
export { default as getPageTitleByBlockUid } from "./getPageTitleByBlockUid";
|
|
28
|
+
export { default as getPageTitlesAndBlockUidsReferencingPage } from "./getPageTitlesAndBlockUidsReferencingPage";
|
|
29
|
+
export { default as getPageTitlesAndUidsDirectlyReferencingPage } from "./getPageTitlesAndUidsDirectlyReferencingPage";
|
|
30
|
+
export { default as getPageTitleReferencesByPageTitle } from "./getPageTitleReferencesByPageTitle";
|
|
31
|
+
export { default as getPageTitlesReferencingBlockUid } from "./getPageTitlesReferencingBlockUid";
|
|
32
|
+
export { default as getPageTitlesStartingWithPrefix } from "./getPageTitlesStartingWithPrefix";
|
|
33
|
+
export { default as getPageUidByPageTitle } from "./getPageUidByPageTitle";
|
|
34
|
+
export { default as getPageViewType } from "./getPageViewType";
|
|
35
|
+
export { default as getParentTextByBlockUid } from "./getParentTextByBlockUid";
|
|
36
|
+
export { default as getParentTextByBlockUidAndTag } from "./getParentTextByBlockUidAndTag";
|
|
37
|
+
export { default as getParentUidByBlockUid } from "./getParentUidByBlockUid";
|
|
38
|
+
export { default as getParentUidsOfBlockUid } from "./getParentUidsOfBlockUid";
|
|
39
|
+
export { default as getSettingsByEmail } from "./getSettingsByEmail";
|
|
40
|
+
export { default as getShallowTreeByParentUid } from "./getShallowTreeByParentUid";
|
|
41
|
+
export { default as getTextByBlockUid } from "./getTextByBlockUid";
|
|
42
|
+
export { default as isTagOnPage } from "./isTagOnPage";
|
|
43
|
+
export { default as normalizePageTitle } from "./normalizePageTitle";
|
package/queries/index.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export { default as getAllBlockUids } from "./getAllBlockUids";
|
|
2
|
+
export { default as getAllBlockUidsAndTexts } from "./getAllBlockUidsAndTexts";
|
|
3
|
+
export { default as getAllPageNames } from "./getAllPageNames";
|
|
4
|
+
export { default as getBasicTreeByParentUid } from "./getBasicTreeByParentUid";
|
|
5
|
+
export { default as getBlockUidAndTextIncludingText } from "./getBlockUidAndTextIncludingText";
|
|
6
|
+
export { default as getBlockUidByTextOnPage } from "./getBlockUidByTextOnPage";
|
|
7
|
+
export { default as getBlockUidsAndTextsReferencingPage } from "./getBlockUidsAndTextsReferencingPage";
|
|
8
|
+
export { default as getBlockUidsByPageTitle } from "./getBlockUidsByPageTitle";
|
|
9
|
+
export { default as getBlockUidsReferencingBlock } from "./getBlockUidsReferencingBlock";
|
|
10
|
+
export { default as getBlockUidsReferencingPage } from "./getBlockUidsReferencingPage";
|
|
11
|
+
export { default as getBlockUidsWithParentUid } from "./getBlockUidsWithParentUid";
|
|
12
|
+
export { default as getChildrenLengthByPageUid } from "./getChildrenLengthByPageUid";
|
|
13
|
+
export { default as getCurrentUserDisplayName } from "./getCurrentUserDisplayName";
|
|
14
|
+
export { default as getCurrentUserEmail } from "./getCurrentUserEmail";
|
|
15
|
+
export { default as getCurrentUserUid } from "./getCurrentUserUid";
|
|
16
|
+
export { default as getFirstChildTextByBlockUid } from "./getFirstChildTextByBlockUid";
|
|
17
|
+
export { default as getFirstChildUidByBlockUid } from "./getFirstChildUidByBlockUid";
|
|
18
|
+
export { default as getCreateTimeByBlockUid } from "./getCreateTimeByBlockUid";
|
|
19
|
+
export { default as getDisplayNameByEmail } from "./getDisplayNameByEmail";
|
|
20
|
+
export { default as getDisplayNameByUid } from "./getDisplayNameByUid";
|
|
21
|
+
export { default as getEditTimeByBlockUid } from "./getEditTimeByBlockUid";
|
|
22
|
+
export { default as getEditedUserEmailByBlockUid } from "./getEditedUserEmailByBlockUid";
|
|
23
|
+
export { default as getFullTreeByParentUid } from "./getFullTreeByParentUid";
|
|
24
|
+
export { default as getLinkedPageTitlesUnderUid } from "./getLinkedPageTitlesUnderUid";
|
|
25
|
+
export { default as getNthChildUidByBlockUid } from "./getNthChildUidByBlockUid";
|
|
26
|
+
export { default as getOrderByBlockUid } from "./getOrderByBlockUid";
|
|
27
|
+
export { default as getPageTitleByBlockUid } from "./getPageTitleByBlockUid";
|
|
28
|
+
export { default as getPageTitlesAndBlockUidsReferencingPage } from "./getPageTitlesAndBlockUidsReferencingPage";
|
|
29
|
+
export { default as getPageTitlesAndUidsDirectlyReferencingPage } from "./getPageTitlesAndUidsDirectlyReferencingPage";
|
|
30
|
+
export { default as getPageTitleReferencesByPageTitle } from "./getPageTitleReferencesByPageTitle";
|
|
31
|
+
export { default as getPageTitlesReferencingBlockUid } from "./getPageTitlesReferencingBlockUid";
|
|
32
|
+
export { default as getPageTitlesStartingWithPrefix } from "./getPageTitlesStartingWithPrefix";
|
|
33
|
+
export { default as getPageUidByPageTitle } from "./getPageUidByPageTitle";
|
|
34
|
+
export { default as getPageViewType } from "./getPageViewType";
|
|
35
|
+
export { default as getParentTextByBlockUid } from "./getParentTextByBlockUid";
|
|
36
|
+
export { default as getParentTextByBlockUidAndTag } from "./getParentTextByBlockUidAndTag";
|
|
37
|
+
export { default as getParentUidByBlockUid } from "./getParentUidByBlockUid";
|
|
38
|
+
export { default as getParentUidsOfBlockUid } from "./getParentUidsOfBlockUid";
|
|
39
|
+
export { default as getSettingsByEmail } from "./getSettingsByEmail";
|
|
40
|
+
export { default as getShallowTreeByParentUid } from "./getShallowTreeByParentUid";
|
|
41
|
+
export { default as getTextByBlockUid } from "./getTextByBlockUid";
|
|
42
|
+
export { default as isTagOnPage } from "./isTagOnPage";
|
|
43
|
+
export { default as normalizePageTitle } from "./normalizePageTitle";
|
|
44
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/queries/index.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import normalizePageTitle from "./normalizePageTitle";
|
|
2
|
+
const isTagOnPage = ({ tag, title }) => {
|
|
3
|
+
var _a, _b;
|
|
4
|
+
return !!((_b = (_a = window.roamAlphaAPI.q(`[:find ?r :where [?r :node/title "${normalizePageTitle(tag)}"] [?b :block/refs ?r] [?b :block/page ?p] [?p :node/title "${normalizePageTitle(title)}"]]`)) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b[0]);
|
|
5
|
+
};
|
|
6
|
+
export default isTagOnPage;
|
|
7
|
+
//# sourceMappingURL=isTagOnPage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isTagOnPage.js","sourceRoot":"","sources":["../src/queries/isTagOnPage.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AAEtD,MAAM,WAAW,GAAG,CAAC,EAAE,GAAG,EAAE,KAAK,EAAkC,EAAW,EAAE;;IAC9E,OAAA,CAAC,CAAC,CAAA,MAAA,MAAA,MAAM,CAAC,YAAY,CAAC,CAAC,CACrB,qCAAqC,kBAAkB,CACrD,GAAG,CACJ,+DAA+D,kBAAkB,CAChF,KAAK,CACN,KAAK,CACP,0CAAG,CAAC,CAAC,0CAAG,CAAC,CAAC,CAAA,CAAA;CAAA,CAAC;AAEd,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalizePageTitle.js","sourceRoot":"","sources":["../src/queries/normalizePageTitle.ts"],"names":[],"mappings":"AAAA,MAAM,kBAAkB,GAAG,CAAC,KAAa,EAAU,EAAE,CACnD,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AAEnD,eAAe,kBAAkB,CAAC"}
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
export declare type RoamBasicBlock = {
|
|
2
|
+
string: string;
|
|
3
|
+
uid: string;
|
|
4
|
+
};
|
|
5
|
+
export declare type RoamBasicPage = {
|
|
6
|
+
title: string;
|
|
7
|
+
uid: string;
|
|
8
|
+
};
|
|
9
|
+
export declare type RoamBasicNode = {
|
|
10
|
+
text: string;
|
|
11
|
+
uid: string;
|
|
12
|
+
children: RoamBasicNode[];
|
|
13
|
+
};
|
|
14
|
+
export declare type RoamUnorderedBasicNode = {
|
|
15
|
+
text: string;
|
|
16
|
+
uid: string;
|
|
17
|
+
order: number;
|
|
18
|
+
children?: RoamUnorderedBasicNode[];
|
|
19
|
+
};
|
|
20
|
+
export declare type RoamPull = {
|
|
21
|
+
"create/time"?: number;
|
|
22
|
+
"node/title"?: string;
|
|
23
|
+
"log/id"?: number;
|
|
24
|
+
"block/uid"?: string;
|
|
25
|
+
"edit/time"?: number;
|
|
26
|
+
"block/children"?: RoamNode[];
|
|
27
|
+
"block/open"?: boolean;
|
|
28
|
+
"block/order"?: number;
|
|
29
|
+
"block/string"?: string;
|
|
30
|
+
} & RoamNode;
|
|
31
|
+
export declare type PullBlock = {
|
|
32
|
+
":block/children"?: {
|
|
33
|
+
":db/id": number;
|
|
34
|
+
}[];
|
|
35
|
+
":block/string"?: string;
|
|
36
|
+
":block/order"?: number;
|
|
37
|
+
":block/uid"?: string;
|
|
38
|
+
":block/heading"?: number;
|
|
39
|
+
":block/open"?: boolean;
|
|
40
|
+
":block/text-align"?: TextAlignment;
|
|
41
|
+
":children/view-type"?: `:${ViewType}`;
|
|
42
|
+
":edit/time"?: number;
|
|
43
|
+
":block/props"?: {
|
|
44
|
+
":image-size"?: {
|
|
45
|
+
[p: string]: {
|
|
46
|
+
":height": number;
|
|
47
|
+
":width": number;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
":iframe"?: {
|
|
51
|
+
[p: string]: {
|
|
52
|
+
":size": {
|
|
53
|
+
":height": number;
|
|
54
|
+
":width": number;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
export declare type RoamPullResult = RoamPull | null;
|
|
61
|
+
export declare type ViewType = "document" | "bullet" | "numbered";
|
|
62
|
+
export declare type TextAlignment = "left" | "center" | "right";
|
|
63
|
+
export declare type RoamBlock = {
|
|
64
|
+
attrs?: {
|
|
65
|
+
source: string[];
|
|
66
|
+
}[][];
|
|
67
|
+
children?: {
|
|
68
|
+
id: number;
|
|
69
|
+
}[];
|
|
70
|
+
id?: number;
|
|
71
|
+
string?: string;
|
|
72
|
+
title?: string;
|
|
73
|
+
time?: number;
|
|
74
|
+
uid?: string;
|
|
75
|
+
order?: number;
|
|
76
|
+
"view-type"?: ViewType;
|
|
77
|
+
};
|
|
78
|
+
export declare type RoamError = {
|
|
79
|
+
raw: string;
|
|
80
|
+
"status-code": number;
|
|
81
|
+
};
|
|
82
|
+
export declare type TreeNode = {
|
|
83
|
+
text: string;
|
|
84
|
+
order: number;
|
|
85
|
+
children: TreeNode[];
|
|
86
|
+
uid: string;
|
|
87
|
+
heading: number;
|
|
88
|
+
open: boolean;
|
|
89
|
+
viewType: ViewType;
|
|
90
|
+
editTime: Date;
|
|
91
|
+
textAlign: TextAlignment;
|
|
92
|
+
props: {
|
|
93
|
+
imageResize: {
|
|
94
|
+
[link: string]: {
|
|
95
|
+
height: number;
|
|
96
|
+
width: number;
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
iframe: {
|
|
100
|
+
[link: string]: {
|
|
101
|
+
height: number;
|
|
102
|
+
width: number;
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
export declare type TextNode = {
|
|
108
|
+
text: string;
|
|
109
|
+
children: TextNode[];
|
|
110
|
+
};
|
|
111
|
+
export declare type InputTextNode = {
|
|
112
|
+
text: string;
|
|
113
|
+
children?: InputTextNode[];
|
|
114
|
+
uid?: string;
|
|
115
|
+
heading?: number;
|
|
116
|
+
textAlign?: TextAlignment;
|
|
117
|
+
viewType?: ViewType;
|
|
118
|
+
open?: boolean;
|
|
119
|
+
};
|
|
120
|
+
declare type PlusType = [number, string];
|
|
121
|
+
export declare type RoamNode = {
|
|
122
|
+
"db/id": number;
|
|
123
|
+
};
|
|
124
|
+
export declare type RoamQuery = RoamPull & {
|
|
125
|
+
"block/graph"?: RoamNode;
|
|
126
|
+
"node/graph+title"?: PlusType;
|
|
127
|
+
"block/graph+uid"?: PlusType;
|
|
128
|
+
"node/graph"?: RoamNode;
|
|
129
|
+
"edit/email"?: string;
|
|
130
|
+
"entity/graph"?: RoamNode;
|
|
131
|
+
};
|
|
132
|
+
export declare type RoamQueryResult = number & RoamQuery;
|
|
133
|
+
export declare type ClientParams = {
|
|
134
|
+
action: "pull" | "q" | "create-block" | "update-block" | "create-page" | "move-block" | "delete-block" | "delete-page" | "update-page";
|
|
135
|
+
selector?: string;
|
|
136
|
+
uid?: string;
|
|
137
|
+
query?: string;
|
|
138
|
+
inputs?: string[];
|
|
139
|
+
} & ActionParams;
|
|
140
|
+
declare type ActionParams = {
|
|
141
|
+
location?: {
|
|
142
|
+
"parent-uid": string;
|
|
143
|
+
order: number;
|
|
144
|
+
};
|
|
145
|
+
block?: {
|
|
146
|
+
string?: string;
|
|
147
|
+
uid?: string;
|
|
148
|
+
open?: boolean;
|
|
149
|
+
heading?: number;
|
|
150
|
+
"text-align"?: TextAlignment;
|
|
151
|
+
"children-view-type"?: ViewType;
|
|
152
|
+
};
|
|
153
|
+
page?: {
|
|
154
|
+
title?: string;
|
|
155
|
+
uid?: string;
|
|
156
|
+
};
|
|
157
|
+
};
|
|
158
|
+
export declare type WriteAction = (a: ActionParams) => boolean;
|
|
159
|
+
export declare type UserSettings = {
|
|
160
|
+
"global-filters": {
|
|
161
|
+
includes: string[];
|
|
162
|
+
removes: string[];
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
declare type SidebarWindowType = SidebarBlockWindow | SidebarMentionsWindow | SidebarGraphWindow | SidebarOutlineWindow;
|
|
166
|
+
export declare type SidebarWindowInput = {
|
|
167
|
+
"block-uid": string;
|
|
168
|
+
type: SidebarWindowType["type"];
|
|
169
|
+
};
|
|
170
|
+
declare type SidebarBlockWindow = {
|
|
171
|
+
type: "block";
|
|
172
|
+
"block-uid": string;
|
|
173
|
+
};
|
|
174
|
+
declare type SidebarOutlineWindow = {
|
|
175
|
+
type: "outline";
|
|
176
|
+
"page-uid": string;
|
|
177
|
+
};
|
|
178
|
+
declare type SidebarMentionsWindow = {
|
|
179
|
+
type: "mentions";
|
|
180
|
+
"mentions-uid": string;
|
|
181
|
+
};
|
|
182
|
+
declare type SidebarGraphWindow = {
|
|
183
|
+
type: "graph";
|
|
184
|
+
"block-uid": string;
|
|
185
|
+
};
|
|
186
|
+
export declare type SidebarAction = (action: {
|
|
187
|
+
window: SidebarWindowInput;
|
|
188
|
+
}) => boolean;
|
|
189
|
+
export declare type SidebarWindow = {
|
|
190
|
+
"collapsed?": boolean;
|
|
191
|
+
order: number;
|
|
192
|
+
"pinned?": boolean;
|
|
193
|
+
"window-id": string;
|
|
194
|
+
} & SidebarWindowType;
|
|
195
|
+
declare global {
|
|
196
|
+
interface Window {
|
|
197
|
+
roamAlphaAPI: {
|
|
198
|
+
q: (query: string, ...params: unknown[]) => any[][];
|
|
199
|
+
pull: (selector: string, id: number | string) => PullBlock;
|
|
200
|
+
createBlock: WriteAction;
|
|
201
|
+
updateBlock: WriteAction;
|
|
202
|
+
createPage: WriteAction;
|
|
203
|
+
moveBlock: WriteAction;
|
|
204
|
+
deleteBlock: WriteAction;
|
|
205
|
+
updatePage: WriteAction;
|
|
206
|
+
deletePage: WriteAction;
|
|
207
|
+
util: {
|
|
208
|
+
generateUID: () => string;
|
|
209
|
+
};
|
|
210
|
+
data: {
|
|
211
|
+
addPullWatch: (pullPattern: string, entityId: string, callback: (before: PullBlock, after: PullBlock) => void) => boolean;
|
|
212
|
+
block: {
|
|
213
|
+
create: WriteAction;
|
|
214
|
+
update: WriteAction;
|
|
215
|
+
move: WriteAction;
|
|
216
|
+
delete: WriteAction;
|
|
217
|
+
};
|
|
218
|
+
page: {
|
|
219
|
+
create: WriteAction;
|
|
220
|
+
update: WriteAction;
|
|
221
|
+
delete: WriteAction;
|
|
222
|
+
};
|
|
223
|
+
pull: (selector: string, id: number) => PullBlock;
|
|
224
|
+
q: (query: string, ...params: unknown[]) => unknown[][];
|
|
225
|
+
removePullWatch: (pullPattern: string, entityId: string, callback: (before: PullBlock, after: PullBlock) => void) => boolean;
|
|
226
|
+
redo: () => void;
|
|
227
|
+
undo: () => void;
|
|
228
|
+
user: {
|
|
229
|
+
upsert: () => void;
|
|
230
|
+
};
|
|
231
|
+
};
|
|
232
|
+
ui: {
|
|
233
|
+
rightSidebar: {
|
|
234
|
+
open: () => void;
|
|
235
|
+
close: () => void;
|
|
236
|
+
getWindows: () => SidebarWindow[];
|
|
237
|
+
addWindow: SidebarAction;
|
|
238
|
+
setWindowOrder: (action: {
|
|
239
|
+
window: SidebarWindowInput & {
|
|
240
|
+
order: number;
|
|
241
|
+
};
|
|
242
|
+
}) => boolean;
|
|
243
|
+
collapseWindow: SidebarAction;
|
|
244
|
+
pinWindow: SidebarAction;
|
|
245
|
+
expandWindow: SidebarAction;
|
|
246
|
+
removeWindow: SidebarAction;
|
|
247
|
+
unpinWindow: SidebarAction;
|
|
248
|
+
};
|
|
249
|
+
commandPalette: {
|
|
250
|
+
addCommand: (action: {
|
|
251
|
+
label: string;
|
|
252
|
+
callback: () => void;
|
|
253
|
+
}) => void;
|
|
254
|
+
removeCommand: (action: {
|
|
255
|
+
label: string;
|
|
256
|
+
}) => void;
|
|
257
|
+
};
|
|
258
|
+
blockContextMenu: {
|
|
259
|
+
addCommand: (action: {
|
|
260
|
+
label: string;
|
|
261
|
+
callback: (props: {
|
|
262
|
+
"block-string": string;
|
|
263
|
+
"block-uid": string;
|
|
264
|
+
heading: 0 | 1 | 2 | 3 | null;
|
|
265
|
+
"page-uid": string;
|
|
266
|
+
"read-only?": boolean;
|
|
267
|
+
"window-id": string;
|
|
268
|
+
}) => void;
|
|
269
|
+
}) => void;
|
|
270
|
+
removeCommand: (action: {
|
|
271
|
+
label: string;
|
|
272
|
+
}) => void;
|
|
273
|
+
};
|
|
274
|
+
getFocusedBlock: () => null | {
|
|
275
|
+
"window-id": string;
|
|
276
|
+
"block-uid": string;
|
|
277
|
+
};
|
|
278
|
+
components: {
|
|
279
|
+
renderBlock: (args: {
|
|
280
|
+
uid: string;
|
|
281
|
+
el: HTMLElement;
|
|
282
|
+
}) => null;
|
|
283
|
+
};
|
|
284
|
+
mainWindow: {
|
|
285
|
+
openBlock: (p: {
|
|
286
|
+
block: {
|
|
287
|
+
uid: string;
|
|
288
|
+
};
|
|
289
|
+
}) => true;
|
|
290
|
+
openPage: (p: {
|
|
291
|
+
page: {
|
|
292
|
+
uid: string;
|
|
293
|
+
} | {
|
|
294
|
+
title: string;
|
|
295
|
+
};
|
|
296
|
+
}) => true;
|
|
297
|
+
};
|
|
298
|
+
};
|
|
299
|
+
};
|
|
300
|
+
roamDatomicAlphaAPI?: (params: ClientParams) => Promise<RoamBlock & {
|
|
301
|
+
success?: boolean;
|
|
302
|
+
}>;
|
|
303
|
+
roamjs?: {
|
|
304
|
+
loaded: Set<string>;
|
|
305
|
+
extension: {
|
|
306
|
+
[id: string]: {
|
|
307
|
+
[method: string]: (args?: unknown) => void;
|
|
308
|
+
};
|
|
309
|
+
};
|
|
310
|
+
version: {
|
|
311
|
+
[id: string]: string;
|
|
312
|
+
};
|
|
313
|
+
dynamicElements: Set<HTMLElement>;
|
|
314
|
+
};
|
|
315
|
+
roam42?: {
|
|
316
|
+
smartBlocks?: {
|
|
317
|
+
customCommands: {
|
|
318
|
+
key: string;
|
|
319
|
+
icon: "gear";
|
|
320
|
+
value: string;
|
|
321
|
+
processor: (match: string) => Promise<string | void>;
|
|
322
|
+
}[];
|
|
323
|
+
activeWorkflow: {
|
|
324
|
+
outputAdditionalBlock: (text: string) => void;
|
|
325
|
+
};
|
|
326
|
+
};
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
export {};
|
package/types/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/types/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import getUidsFromId from "../dom/getUidsFromId";
|
|
2
|
+
const clearBlockById = (id) => window.roamAlphaAPI.updateBlock({
|
|
3
|
+
block: {
|
|
4
|
+
uid: getUidsFromId(id).blockUid,
|
|
5
|
+
string: "",
|
|
6
|
+
},
|
|
7
|
+
});
|
|
8
|
+
export default clearBlockById;
|
|
9
|
+
//# sourceMappingURL=clearBlockById.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clearBlockById.js","sourceRoot":"","sources":["../src/writes/clearBlockById.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,sBAAsB,CAAC;AAEjD,MAAM,cAAc,GAAG,CAAC,EAAU,EAAW,EAAE,CAC7C,MAAM,CAAC,YAAY,CAAC,WAAW,CAAC;IAC9B,KAAK,EAAE;QACL,GAAG,EAAE,aAAa,CAAC,EAAE,CAAC,CAAC,QAAQ;QAC/B,MAAM,EAAE,EAAE;KACX;CACF,CAAC,CAAC;AAEL,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clearBlockByUid.js","sourceRoot":"","sources":["../src/writes/clearBlockByUid.ts"],"names":[],"mappings":"AAAA,MAAM,eAAe,GAAG,CAAC,GAAW,EAAW,EAAE,CAC/C,MAAM,CAAC,YAAY,CAAC,WAAW,CAAC;IAC9B,KAAK,EAAE;QACL,GAAG;QACH,MAAM,EAAE,EAAE;KACX;CACF,CAAC,CAAC;AAEL,eAAe,eAAe,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { InputTextNode } from "../types";
|
|
2
|
+
declare const createBlock: ({ node: { text, children, uid, heading, viewType, textAlign, open, }, parentUid, order, }: {
|
|
3
|
+
node: InputTextNode;
|
|
4
|
+
parentUid: string;
|
|
5
|
+
order?: number | undefined;
|
|
6
|
+
}) => string;
|
|
7
|
+
export default createBlock;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const createBlock = ({ node: { text, children = [], uid = window.roamAlphaAPI.util.generateUID(), heading, viewType, textAlign, open = true, }, parentUid, order = 0, }) => {
|
|
2
|
+
window.roamAlphaAPI.createBlock({
|
|
3
|
+
location: { "parent-uid": parentUid, order },
|
|
4
|
+
block: {
|
|
5
|
+
uid,
|
|
6
|
+
string: text,
|
|
7
|
+
heading,
|
|
8
|
+
"text-align": textAlign,
|
|
9
|
+
"children-view-type": viewType,
|
|
10
|
+
open,
|
|
11
|
+
},
|
|
12
|
+
});
|
|
13
|
+
children.forEach((n, o) => createBlock({ node: n, parentUid: uid, order: o }));
|
|
14
|
+
if (!open)
|
|
15
|
+
window.roamAlphaAPI.updateBlock({ block: { uid, open: false } }); // Roam doesn't do this for us yet
|
|
16
|
+
return uid;
|
|
17
|
+
};
|
|
18
|
+
export default createBlock;
|
|
19
|
+
//# sourceMappingURL=createBlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createBlock.js","sourceRoot":"","sources":["../src/writes/createBlock.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,GAAG,CAAC,EACnB,IAAI,EAAE,EACJ,IAAI,EACJ,QAAQ,GAAG,EAAE,EACb,GAAG,GAAG,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,WAAW,EAAE,EAC5C,OAAO,EACP,QAAQ,EACR,SAAS,EACT,IAAI,GAAG,IAAI,GACZ,EACD,SAAS,EACT,KAAK,GAAG,CAAC,GAKV,EAAU,EAAE;IACX,MAAM,CAAC,YAAY,CAAC,WAAW,CAAC;QAC9B,QAAQ,EAAE,EAAE,YAAY,EAAE,SAAS,EAAE,KAAK,EAAE;QAC5C,KAAK,EAAE;YACL,GAAG;YACH,MAAM,EAAE,IAAI;YACZ,OAAO;YACP,YAAY,EAAE,SAAS;YACvB,oBAAoB,EAAE,QAAQ;YAC9B,IAAI;SACL;KACF,CAAC,CAAC;IACH,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CACxB,WAAW,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CACnD,CAAC;IACF,IAAI,CAAC,IAAI;QAAE,MAAM,CAAC,YAAY,CAAC,WAAW,CAAC,EAAE,KAAK,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC,kCAAkC;IAC/G,OAAO,GAAG,CAAC;AACb,CAAC,CAAC;AAEF,eAAe,WAAW,CAAC"}
|