roamjs-components 0.32.1 → 0.33.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/components/index.d.ts +12 -0
- package/components/index.js +13 -0
- package/components/index.js.map +1 -0
- 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/index.d.ts +1 -0
- package/events/index.js +2 -0
- package/events/index.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/hooks/index.d.ts +3 -0
- package/hooks/index.js +4 -0
- package/hooks/index.js.map +1 -0
- package/index.js +10 -27
- 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/getPageTitleByPageUid.d.ts +2 -0
- package/queries/getPageTitleByPageUid.js +6 -0
- package/queries/getPageTitleByPageUid.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 +44 -0
- package/queries/index.js +45 -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/util/index.d.ts +18 -0
- package/util/index.js +19 -0
- package/util/index.js.map +1 -0
- package/util/runExtension.d.ts +2 -1
- package/util/runExtension.js +2 -1
- package/util/runExtension.js.map +1 -1
- 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 +9 -0
- package/writes/createBlock.js +52 -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
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":""}
|
package/util/index.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export { default as addInputSetting } from "./addInputSetting";
|
|
2
|
+
export { default as createOverlayRender } from "./createOverlayRender";
|
|
3
|
+
export { default as createTagRegex } from "./createTagRegex";
|
|
4
|
+
export { default as extractRef } from "./extractRef";
|
|
5
|
+
export { default as extractTag } from "./extractTag";
|
|
6
|
+
export { default as getGraph } from "./getGraph";
|
|
7
|
+
export { default as getOauth } from "./getOauth";
|
|
8
|
+
export { default as getOauthAccounts } from "./getOauthAccounts";
|
|
9
|
+
export { default as getRenderRoot } from "./getRenderRoot";
|
|
10
|
+
export { default as getSettingIntFromTree } from "./getSettingIntFromTree";
|
|
11
|
+
export { default as getSettingValueFromTree } from "./getSettingValueFromTree";
|
|
12
|
+
export { default as getSettingValuesFromTree } from "./getSettingValuesFromTree";
|
|
13
|
+
export { default as getSubTree } from "./getSubTree";
|
|
14
|
+
export { default as idToTitle } from "./idToTitle";
|
|
15
|
+
export { default as runExtension } from "./runExtension";
|
|
16
|
+
export { default as setInputSetting } from "./setInputSetting";
|
|
17
|
+
export { default as setInputSettings } from "./setInputSettings";
|
|
18
|
+
export { default as toFlexRegex } from "./toFlexRegex";
|
package/util/index.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export { default as addInputSetting } from "./addInputSetting";
|
|
2
|
+
export { default as createOverlayRender } from "./createOverlayRender";
|
|
3
|
+
export { default as createTagRegex } from "./createTagRegex";
|
|
4
|
+
export { default as extractRef } from "./extractRef";
|
|
5
|
+
export { default as extractTag } from "./extractTag";
|
|
6
|
+
export { default as getGraph } from "./getGraph";
|
|
7
|
+
export { default as getOauth } from "./getOauth";
|
|
8
|
+
export { default as getOauthAccounts } from "./getOauthAccounts";
|
|
9
|
+
export { default as getRenderRoot } from "./getRenderRoot";
|
|
10
|
+
export { default as getSettingIntFromTree } from "./getSettingIntFromTree";
|
|
11
|
+
export { default as getSettingValueFromTree } from "./getSettingValueFromTree";
|
|
12
|
+
export { default as getSettingValuesFromTree } from "./getSettingValuesFromTree";
|
|
13
|
+
export { default as getSubTree } from "./getSubTree";
|
|
14
|
+
export { default as idToTitle } from "./idToTitle";
|
|
15
|
+
export { default as runExtension } from "./runExtension";
|
|
16
|
+
export { default as setInputSetting } from "./setInputSetting";
|
|
17
|
+
export { default as setInputSettings } from "./setInputSettings";
|
|
18
|
+
export { default as toFlexRegex } from "./toFlexRegex";
|
|
19
|
+
//# sourceMappingURL=index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C"}
|
package/util/runExtension.d.ts
CHANGED
package/util/runExtension.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __awaiter } from "tslib";
|
|
2
2
|
import axios from "axios";
|
|
3
3
|
import { addStyle } from "../dom";
|
|
4
|
-
|
|
4
|
+
const runExtension = (extensionId, run, options = {}) => __awaiter(void 0, void 0, void 0, function* () {
|
|
5
5
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
6
6
|
if ((_c = (_b = (_a = window.roamjs) === null || _a === void 0 ? void 0 : _a.loaded) === null || _b === void 0 ? void 0 : _b.has) === null || _c === void 0 ? void 0 : _c.call(_b, extensionId)) {
|
|
7
7
|
return;
|
|
@@ -25,4 +25,5 @@ export const runExtension = (extensionId, run, options = {}) => __awaiter(void 0
|
|
|
25
25
|
}`, "roamjs-default");
|
|
26
26
|
run();
|
|
27
27
|
});
|
|
28
|
+
export default runExtension;
|
|
28
29
|
//# sourceMappingURL=runExtension.js.map
|
package/util/runExtension.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runExtension.js","sourceRoot":"","sources":["../src/util/runExtension.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAElC,MAAM,
|
|
1
|
+
{"version":3,"file":"runExtension.js","sourceRoot":"","sources":["../src/util/runExtension.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAElC,MAAM,YAAY,GAAG,CACnB,WAAmB,EACnB,GAAe,EACf,UAAuC,EAAE,EAC1B,EAAE;;IACjB,IAAI,MAAA,MAAA,MAAA,MAAM,CAAC,MAAM,0CAAE,MAAM,0CAAE,GAAG,mDAAG,WAAW,CAAC,EAAE;QAC7C,OAAO;KACR;IACD,MAAM,CAAC,MAAM,GAAG;QACd,MAAM,EAAE,CAAA,MAAA,MAAM,CAAC,MAAM,0CAAE,MAAM,KAAI,IAAI,GAAG,EAAE;QAC1C,SAAS,EAAE,CAAA,MAAA,MAAM,CAAC,MAAM,0CAAE,SAAS,KAAI,EAAE;QACzC,OAAO,EAAE,CAAA,MAAA,MAAM,CAAC,MAAM,0CAAE,OAAO,KAAI,EAAE;QACrC,eAAe,EAAE,CAAA,MAAA,MAAM,CAAC,MAAM,0CAAE,eAAe,KAAI,IAAI,GAAG,EAAE;KAC7D,CAAC;IACF,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IACtC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,EAAE,CAAC;IAEtE,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE;QAC1B,KAAK,CAAC,IAAI,CAAC,iCAAiC,EAAE;YAC5C,SAAS,EAAE,gBAAgB;YAC3B,UAAU,EAAE,EAAE,WAAW,EAAE;SAC5B,CAAC,CAAC;KACJ;IACD,QAAQ,CACN;;IAEA,EACA,gBAAgB,CACjB,CAAC;IAEF,GAAG,EAAE,CAAC;AACR,CAAC,CAAA,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -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,9 @@
|
|
|
1
|
+
import type { InputTextNode } from "../types";
|
|
2
|
+
declare type ActionParams = Parameters<typeof window.roamAlphaAPI.createBlock>[0];
|
|
3
|
+
declare const gatherActions: ({ node: { text, children, uid, heading, viewType, textAlign, open, }, parentUid, order, }: {
|
|
4
|
+
node: InputTextNode;
|
|
5
|
+
parentUid: string;
|
|
6
|
+
order?: number | undefined;
|
|
7
|
+
}) => ActionParams[];
|
|
8
|
+
declare const createBlock: (params: Parameters<typeof gatherActions>[0]) => string;
|
|
9
|
+
export default createBlock;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { differenceInMilliseconds } from "date-fns";
|
|
2
|
+
const gatherActions = ({ node: { text, children = [], uid = window.roamAlphaAPI.util.generateUID(), heading, viewType, textAlign, open = true, }, parentUid, order = 0, }) => {
|
|
3
|
+
return [
|
|
4
|
+
Object.assign({ location: { "parent-uid": parentUid, order }, block: {
|
|
5
|
+
uid,
|
|
6
|
+
string: text,
|
|
7
|
+
heading,
|
|
8
|
+
"text-align": textAlign,
|
|
9
|
+
"children-view-type": viewType,
|
|
10
|
+
open,
|
|
11
|
+
} }, children.map((node, order) => gatherActions({ node, parentUid: uid, order }))),
|
|
12
|
+
];
|
|
13
|
+
};
|
|
14
|
+
const actionQueue = [];
|
|
15
|
+
const submittedActions = [];
|
|
16
|
+
const ROAM_LIMIT = 300;
|
|
17
|
+
const ROAM_TIMEOUT = 61000; // One minute, plus an extra second to be safe.
|
|
18
|
+
const submitActions = (actions) => {
|
|
19
|
+
actionQueue.push(...actions);
|
|
20
|
+
const processActions = () => {
|
|
21
|
+
if (ROAM_LIMIT > submittedActions.length) {
|
|
22
|
+
const submitNow = actionQueue.splice(0, ROAM_LIMIT - submittedActions.length);
|
|
23
|
+
const submittedNow = submitNow.map((action) => {
|
|
24
|
+
const { params, type } = action;
|
|
25
|
+
window.roamAlphaAPI[type](params);
|
|
26
|
+
return { action, date: new Date() };
|
|
27
|
+
});
|
|
28
|
+
submittedActions.push(...submittedNow);
|
|
29
|
+
}
|
|
30
|
+
if (actionQueue.length) {
|
|
31
|
+
const timeout = ROAM_TIMEOUT -
|
|
32
|
+
differenceInMilliseconds(new Date(), submittedActions[0].date);
|
|
33
|
+
console.log(`Writing to Roam. Actions left: ${actionQueue.length}. Trying again in: ${timeout}`);
|
|
34
|
+
setTimeout(() => {
|
|
35
|
+
const now = new Date();
|
|
36
|
+
const index = submittedActions.findIndex(({ date }) => differenceInMilliseconds(now, date) < ROAM_TIMEOUT);
|
|
37
|
+
submittedActions.splice(0, index);
|
|
38
|
+
console.log("Dequeued", index, "items");
|
|
39
|
+
processActions();
|
|
40
|
+
}, timeout);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
processActions();
|
|
44
|
+
};
|
|
45
|
+
const createBlock = (params) => {
|
|
46
|
+
var _a;
|
|
47
|
+
const actions = gatherActions(params);
|
|
48
|
+
submitActions(actions.map((params) => ({ params, type: "createBlock" })));
|
|
49
|
+
return ((_a = actions[0].block) === null || _a === void 0 ? void 0 : _a.uid) || "";
|
|
50
|
+
};
|
|
51
|
+
export default createB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AAE;;IAC1E,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;IACtC,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC,CAAC,CAAC,CAAC;IAC1E,OAAO,CAAA,MAAA,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,0CAAE,GAAG,KAAI,EAAE,CAAC;AACrC,CAAC,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import createBlock from "./createBlock";
|
|
2
|
+
import { DAILY_NOTE_PAGE_TITLE_REGEX } from "../date";
|
|
3
|
+
import toRoamDateUid from "../date/toRoamDateUid";
|
|
4
|
+
import parseRoamDate from "../date/parseRoamDate";
|
|
5
|
+
const createPage = ({ title, tree = [], }) => {
|
|
6
|
+
const uid = DAILY_NOTE_PAGE_TITLE_REGEX.test(title)
|
|
7
|
+
? toRoamDateUid(parseRoamDate(title))
|
|
8
|
+
: window.roamAlphaAPI.util.generateUID();
|
|
9
|
+
window.roamAlphaAPI.createPage({ page: { title, uid } });
|
|
10
|
+
tree.forEach((node, order) => createBlock({ node, parentUid: uid, order }));
|
|
11
|
+
return uid;
|
|
12
|
+
};
|
|
13
|
+
export default createPage;
|
|
14
|
+
//# sourceMappingURL=createPage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createPage.js","sourceRoot":"","sources":["../src/writes/createPage.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAC;AAEtD,OAAO,aAAa,MAAM,uBAAuB,CAAC;AAClD,OAAO,aAAa,MAAM,uBAAuB,CAAC;AAElD,MAAM,UAAU,GAAG,CAAC,EAClB,KAAK,EACL,IAAI,GAAG,EAAE,GAIV,EAAU,EAAE;IACX,MAAM,GAAG,GAAG,2BAA2B,CAAC,IAAI,CAAC,KAAK,CAAC;QACjD,CAAC,CAAC,aAAa,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QACrC,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;IAC3C,MAAM,CAAC,YAAY,CAAC,UAAU,CAAC,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;IACzD,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,WAAW,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;IAC5E,OAAO,GAAG,CAAC;AACb,CAAC,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deleteBlock.js","sourceRoot":"","sources":["../src/writes/deleteBlock.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,GAAG,CAAC,GAAW,EAAU,EAAE;IAC1C,MAAM,CAAC,YAAY,CAAC,WAAW,CAAC,EAAE,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;IACpD,OAAO,GAAG,CAAC;AACb,CAAC,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { default as clearBlockById } from "./clearBlockById";
|
|
2
|
+
export { default as clearBlockByUid } from "./clearBlockByUid";
|
|
3
|
+
export { default as createBlock } from "./createBlock";
|
|
4
|
+
export { default as createPage } from "./createPage";
|
|
5
|
+
export { default as deleteBlock } from "./deleteBlock";
|
|
6
|
+
export { default as openBlockInSidebar } from "./openBlockInSidebar";
|
|
7
|
+
export { default as updateActiveBlock } from "./updateActiveBlock";
|
|
8
|
+
export { default as updateBlock } from "./updateBlock";
|
package/writes/index.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { default as clearBlockById } from "./clearBlockById";
|
|
2
|
+
export { default as clearBlockByUid } from "./clearBlockByUid";
|
|
3
|
+
export { default as createBlock } from "./createBlock";
|
|
4
|
+
export { default as createPage } from "./createPage";
|
|
5
|
+
export { default as deleteBlock } from "./deleteBlock";
|
|
6
|
+
export { default as openBlockInSidebar } from "./openBlockInSidebar";
|
|
7
|
+
export { default as updateActiveBlock } from "./updateActiveBlock";
|
|
8
|
+
export { default as updateBlock } from "./updateBlock";
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/writes/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const openBlockInSidebar = (blockUid) => window.roamAlphaAPI.ui.rightSidebar
|
|
2
|
+
.getWindows()
|
|
3
|
+
.some((w) => w.type === "block" && w["block-uid"] === blockUid)
|
|
4
|
+
? window.roamAlphaAPI.ui.rightSidebar.open()
|
|
5
|
+
: window.roamAlphaAPI.ui.rightSidebar.addWindow({
|
|
6
|
+
window: {
|
|
7
|
+
type: "block",
|
|
8
|
+
"block-uid": blockUid,
|
|
9
|
+
},
|
|
10
|
+
});
|
|
11
|
+
export default openBlockInSidebar;
|
|
12
|
+
//# sourceMappingURL=openBlockInSidebar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openBlockInSidebar.js","sourceRoot":"","sources":["../src/writes/openBlockInSidebar.ts"],"names":[],"mappings":"AAAA,MAAM,kBAAkB,GAAG,CAAC,QAAgB,EAAkB,EAAE,CAC9D,MAAM,CAAC,YAAY,CAAC,EAAE,CAAC,YAAY;KAChC,UAAU,EAAE;KACZ,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,OAAO,IAAI,CAAC,CAAC,WAAW,CAAC,KAAK,QAAQ,CAAC;IAC/D,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE;IAC5C,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE,CAAC,YAAY,CAAC,SAAS,CAAC;QAC5C,MAAM,EAAE;YACN,IAAI,EAAE,OAAO;YACb,WAAW,EAAE,QAAQ;SACtB;KACF,CAAC,CAAC;AAET,eAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import getActiveUids from "../dom/getActiveUids";
|
|
2
|
+
const updateActiveBlock = (text) => window.roamAlphaAPI.updateBlock({
|
|
3
|
+
block: {
|
|
4
|
+
uid: getActiveUids().blockUid,
|
|
5
|
+
string: text,
|
|
6
|
+
},
|
|
7
|
+
});
|
|
8
|
+
export default updateActiveBlock;
|
|
9
|
+
//# sourceMappingURL=updateActiveBlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"updateActiveBlock.js","sourceRoot":"","sources":["../src/writes/updateActiveBlock.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,sBAAsB,CAAC;AAEjD,MAAM,iBAAiB,GAAG,CAAC,IAAY,EAAW,EAAE,CAClD,MAAM,CAAC,YAAY,CAAC,WAAW,CAAC;IAC9B,KAAK,EAAE;QACL,GAAG,EAAE,aAAa,EAAE,CAAC,QAAQ;QAC7B,MAAM,EAAE,IAAI;KACb;CACF,CAAC,CAAC;AAEL,eAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const updateBlock = ({ text, uid, heading, textAlign, viewType, open, }) => {
|
|
2
|
+
window.roamAlphaAPI.updateBlock({
|
|
3
|
+
block: {
|
|
4
|
+
string: text,
|
|
5
|
+
uid,
|
|
6
|
+
heading,
|
|
7
|
+
"text-align": textAlign,
|
|
8
|
+
"children-view-type": viewType,
|
|
9
|
+
open,
|
|
10
|
+
},
|
|
11
|
+
});
|
|
12
|
+
return uid;
|
|
13
|
+
};
|
|
14
|
+
export default updateBlock;
|
|
15
|
+
//# sourceMappingURL=updateBlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"updateBlock.js","sourceRoot":"","sources":["../src/writes/updateBlock.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,GAAG,CAAC,EACnB,IAAI,EACJ,GAAG,EACH,OAAO,EACP,SAAS,EACT,QAAQ,EACR,IAAI,GAC8C,EAAU,EAAE;IAC9D,MAAM,CAAC,YAAY,CAAC,WAAW,CAAC;QAC9B,KAAK,EAAE;YACL,MAAM,EAAE,IAAI;YACZ,GAAG;YACH,OAAO;YACP,YAAY,EAAE,SAAS;YACvB,oBAAoB,EAAE,QAAQ;YAC9B,IAAI;SACL;KACF,CAAC,CAAC;IACH,OAAO,GAAG,CAAC;AACb,CAAC,CAAC;AAEF,eAAe,WAAW,CAAC"}
|