roamjs-components 0.85.3 → 0.85.4

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.
Files changed (558) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +29 -29
  3. package/components/AutocompleteInput.d.ts +28 -28
  4. package/components/AutocompleteInput.js +120 -120
  5. package/components/BlockErrorBoundary.d.ts +15 -15
  6. package/components/BlockErrorBoundary.js +27 -27
  7. package/components/BlockInput.d.ts +13 -13
  8. package/components/BlockInput.js +55 -55
  9. package/components/ComponentContainer.d.ts +10 -10
  10. package/components/ComponentContainer.js +37 -37
  11. package/components/ConfigPage.d.ts +35 -35
  12. package/components/ConfigPage.js +159 -159
  13. package/components/ConfigPanels/BlockPanel.d.ts +3 -3
  14. package/components/ConfigPanels/BlockPanel.js +42 -42
  15. package/components/ConfigPanels/BlocksPanel.d.ts +3 -3
  16. package/components/ConfigPanels/BlocksPanel.js +58 -58
  17. package/components/ConfigPanels/CustomPanel.d.ts +3 -3
  18. package/components/ConfigPanels/CustomPanel.js +24 -24
  19. package/components/ConfigPanels/FlagPanel.d.ts +3 -3
  20. package/components/ConfigPanels/FlagPanel.js +31 -31
  21. package/components/ConfigPanels/MultiChildPanel.d.ts +9 -9
  22. package/components/ConfigPanels/MultiChildPanel.js +58 -58
  23. package/components/ConfigPanels/MultiTextPanel.d.ts +3 -3
  24. package/components/ConfigPanels/MultiTextPanel.js +14 -14
  25. package/components/ConfigPanels/NumberPanel.d.ts +3 -3
  26. package/components/ConfigPanels/NumberPanel.js +25 -25
  27. package/components/ConfigPanels/OauthPanel.d.ts +3 -3
  28. package/components/ConfigPanels/OauthPanel.js +81 -81
  29. package/components/ConfigPanels/PagesPanel.d.ts +3 -3
  30. package/components/ConfigPanels/PagesPanel.js +11 -11
  31. package/components/ConfigPanels/SelectPanel.d.ts +3 -3
  32. package/components/ConfigPanels/SelectPanel.js +27 -27
  33. package/components/ConfigPanels/TextPanel.d.ts +3 -3
  34. package/components/ConfigPanels/TextPanel.js +28 -28
  35. package/components/ConfigPanels/TimePanel.d.ts +3 -3
  36. package/components/ConfigPanels/TimePanel.js +34 -34
  37. package/components/ConfigPanels/getBrandColors.d.ts +7 -7
  38. package/components/ConfigPanels/getBrandColors.js +28 -28
  39. package/components/ConfigPanels/types.d.ts +84 -84
  40. package/components/ConfigPanels/types.js +2 -2
  41. package/components/ConfigPanels/types.js.map +1 -1
  42. package/components/ConfigPanels/useSingleChildValue.d.ts +13 -13
  43. package/components/ConfigPanels/useSingleChildValue.js +43 -43
  44. package/components/CursorMenu.d.ts +21 -21
  45. package/components/CursorMenu.js +181 -181
  46. package/components/Description.d.ts +5 -5
  47. package/components/Description.js +16 -16
  48. package/components/ExtensionApiContext.d.ts +31 -31
  49. package/components/ExtensionApiContext.js +16 -16
  50. package/components/ExternalLogin.d.ts +18 -18
  51. package/components/ExternalLogin.js +141 -141
  52. package/components/Filter.d.ts +15 -15
  53. package/components/Filter.js +142 -142
  54. package/components/FormDialog.d.ts +55 -55
  55. package/components/FormDialog.js +217 -217
  56. package/components/FormDialog.js.map +1 -1
  57. package/components/Loading.d.ts +4 -4
  58. package/components/Loading.js +35 -35
  59. package/components/MenuItemSelect.d.ts +17 -17
  60. package/components/MenuItemSelect.js +23 -23
  61. package/components/OauthPanel.d.ts +7 -7
  62. package/components/OauthPanel.js +30 -30
  63. package/components/OauthSelect.d.ts +5 -5
  64. package/components/OauthSelect.js +25 -25
  65. package/components/PageInput.d.ts +6 -6
  66. package/components/PageInput.js +13 -13
  67. package/components/PageLink.d.ts +6 -6
  68. package/components/PageLink.js +31 -31
  69. package/components/ProgressDialog.d.ts +11 -11
  70. package/components/ProgressDialog.js +48 -48
  71. package/components/SimpleAlert.d.ts +15 -15
  72. package/components/SimpleAlert.js +47 -47
  73. package/components/Toast.d.ts +15 -15
  74. package/components/Toast.js +50 -50
  75. package/components/index.js +4 -4
  76. package/components/index.js.map +1 -1
  77. package/components.d.ts +5 -5
  78. package/components.js +170 -170
  79. package/date/constants.d.ts +3 -3
  80. package/date/constants.js +19 -19
  81. package/date/constants.js.map +1 -1
  82. package/date/index.d.ts +3 -3
  83. package/date/index.js +9 -9
  84. package/date/index.js.map +1 -1
  85. package/date/parseNlpDate.d.ts +5 -5
  86. package/date/parseNlpDate.js +226 -226
  87. package/date/parseNlpDate.js.map +1 -1
  88. package/date/parseRoamDateUid.d.ts +2 -2
  89. package/date/parseRoamDateUid.js +7 -7
  90. package/date/parseRoamDateUid.js.map +1 -1
  91. package/dom/addBlockCommand.d.ts +5 -5
  92. package/dom/addBlockCommand.js +53 -53
  93. package/dom/addBlockCommand.js.map +1 -1
  94. package/dom/addKeyboardTriggers.d.ts +11 -11
  95. package/dom/addKeyboardTriggers.js +38 -38
  96. package/dom/addKeyboardTriggers.js.map +1 -1
  97. package/dom/addOldRoamJSDependency.d.ts +2 -2
  98. package/dom/addOldRoamJSDependency.js +10 -10
  99. package/dom/addOldRoamJSDependency.js.map +1 -1
  100. package/dom/addRoamJSDependency.d.ts +2 -2
  101. package/dom/addRoamJSDependency.js +8 -8
  102. package/dom/addRoamJSDependency.js.map +1 -1
  103. package/dom/addScriptAsDependency.d.ts +6 -6
  104. package/dom/addScriptAsDependency.js +16 -16
  105. package/dom/addScriptAsDependency.js.map +1 -1
  106. package/dom/addStyle.d.ts +2 -2
  107. package/dom/addStyle.js +14 -14
  108. package/dom/addStyle.js.map +1 -1
  109. package/dom/constants.d.ts +1 -1
  110. package/dom/constants.js +4 -4
  111. package/dom/constants.js.map +1 -1
  112. package/dom/createBlockObserver.d.ts +7 -7
  113. package/dom/createBlockObserver.js +43 -43
  114. package/dom/createBlockObserver.js.map +1 -1
  115. package/dom/createButtonObserver.d.ts +6 -6
  116. package/dom/createButtonObserver.js +21 -21
  117. package/dom/createButtonObserver.js.map +1 -1
  118. package/dom/createDivObserver.d.ts +2 -2
  119. package/dom/createDivObserver.js +13 -13
  120. package/dom/createDivObserver.js.map +1 -1
  121. package/dom/createHTMLObserver.d.ts +8 -8
  122. package/dom/createHTMLObserver.js +24 -24
  123. package/dom/createHTMLObserver.js.map +1 -1
  124. package/dom/createHashtagObserver.d.ts +5 -5
  125. package/dom/createHashtagObserver.js +16 -16
  126. package/dom/createHashtagObserver.js.map +1 -1
  127. package/dom/createIconButton.d.ts +2 -2
  128. package/dom/createIconButton.js +12 -12
  129. package/dom/createIconButton.js.map +1 -1
  130. package/dom/createObserver.d.ts +2 -2
  131. package/dom/createObserver.js +9 -9
  132. package/dom/createObserver.js.map +1 -1
  133. package/dom/createOverlayObserver.d.ts +2 -2
  134. package/dom/createOverlayObserver.js +6 -6
  135. package/dom/createOverlayObserver.js.map +1 -1
  136. package/dom/createPageObserver.d.ts +2 -2
  137. package/dom/createPageObserver.js +34 -34
  138. package/dom/createPageObserver.js.map +1 -1
  139. package/dom/createPageTitleObserver.d.ts +6 -6
  140. package/dom/createPageTitleObserver.js +31 -31
  141. package/dom/createPageTitleObserver.js.map +1 -1
  142. package/dom/elToTitle.d.ts +2 -2
  143. package/dom/elToTitle.js +22 -22
  144. package/dom/elToTitle.js.map +1 -1
  145. package/dom/genericError.d.ts +3 -3
  146. package/dom/genericError.js +11 -11
  147. package/dom/genericError.js.map +1 -1
  148. package/dom/getActiveUids.d.ts +3 -3
  149. package/dom/getActiveUids.js +6 -6
  150. package/dom/getActiveUids.js.map +1 -1
  151. package/dom/getBlockUidFromTarget.d.ts +2 -2
  152. package/dom/getBlockUidFromTarget.js +33 -33
  153. package/dom/getBlockUidFromTarget.js.map +1 -1
  154. package/dom/getCurrentPageUid.d.ts +2 -2
  155. package/dom/getCurrentPageUid.js +8 -8
  156. package/dom/getCurrentPageUid.js.map +1 -1
  157. package/dom/getDomRefs.d.ts +2 -2
  158. package/dom/getDomRefs.js +12 -12
  159. package/dom/getDomRefs.js.map +1 -1
  160. package/dom/getDropUidOffset.d.ts +5 -5
  161. package/dom/getDropUidOffset.js +27 -27
  162. package/dom/getDropUidOffset.js.map +1 -1
  163. package/dom/getMutatedNodes.d.ts +7 -7
  164. package/dom/getMutatedNodes.js +11 -11
  165. package/dom/getMutatedNodes.js.map +1 -1
  166. package/dom/getPageTitleByHtmlElement.d.ts +2 -2
  167. package/dom/getPageTitleByHtmlElement.js +12 -12
  168. package/dom/getPageTitleByHtmlElement.js.map +1 -1
  169. package/dom/getPageTitleValueByHtmlElement.d.ts +2 -2
  170. package/dom/getPageTitleValueByHtmlElement.js +9 -9
  171. package/dom/getPageTitleValueByHtmlElement.js.map +1 -1
  172. package/dom/getReferenceBlockUid.d.ts +2 -2
  173. package/dom/getReferenceBlockUid.js +18 -18
  174. package/dom/getReferenceBlockUid.js.map +1 -1
  175. package/dom/getRoamUrl.d.ts +2 -2
  176. package/dom/getRoamUrl.js +4 -4
  177. package/dom/getRoamUrl.js.map +1 -1
  178. package/dom/getRoamUrlByPage.d.ts +2 -2
  179. package/dom/getRoamUrlByPage.js +10 -10
  180. package/dom/getRoamUrlByPage.js.map +1 -1
  181. package/dom/getUids.d.ts +3 -3
  182. package/dom/getUids.js +8 -8
  183. package/dom/getUids.js.map +1 -1
  184. package/dom/getUidsFromButton.d.ts +3 -3
  185. package/dom/getUidsFromButton.js +8 -8
  186. package/dom/getUidsFromButton.js.map +1 -1
  187. package/dom/getUidsFromId.d.ts +5 -5
  188. package/dom/getUidsFromId.js +15 -15
  189. package/dom/getUidsFromId.js.map +1 -1
  190. package/dom/index.d.ts +30 -30
  191. package/dom/index.js +63 -63
  192. package/dom/index.js.map +1 -1
  193. package/dom/parseRoamBlocksToHtml.d.ts +11 -11
  194. package/dom/parseRoamBlocksToHtml.js +79 -79
  195. package/dom/parseRoamBlocksToHtml.js.map +1 -1
  196. package/dom/resolveRefs.d.ts +2 -2
  197. package/dom/resolveRefs.js +24 -24
  198. package/dom/resolveRefs.js.map +1 -1
  199. package/events/index.d.ts +1 -1
  200. package/events/index.js +8 -8
  201. package/events/index.js.map +1 -1
  202. package/events/watchOnce.d.ts +3 -3
  203. package/events/watchOnce.js +12 -12
  204. package/events/watchOnce.js.map +1 -1
  205. package/hooks/index.d.ts +2 -2
  206. package/hooks/index.js +10 -10
  207. package/hooks/index.js.map +1 -1
  208. package/hooks/useArrowKeyDown.d.ts +10 -10
  209. package/hooks/useArrowKeyDown.js +54 -54
  210. package/hooks/useArrowKeyDown.js.map +1 -1
  211. package/hooks/useSubTree.d.ts +3 -3
  212. package/hooks/useSubTree.js +11 -11
  213. package/hooks/useSubTree.js.map +1 -1
  214. package/marked/index.d.ts +25 -25
  215. package/marked/index.js +567 -567
  216. package/marked/index.js.map +1 -1
  217. package/package.json +116 -116
  218. package/queries/compileDatalog.d.ts +3 -3
  219. package/queries/compileDatalog.js +63 -63
  220. package/queries/compileDatalog.js.map +1 -1
  221. package/queries/getAllBlockUids.d.ts +2 -2
  222. package/queries/getAllBlockUids.js +6 -6
  223. package/queries/getAllBlockUids.js.map +1 -1
  224. package/queries/getAllBlockUidsAndTexts.d.ts +5 -5
  225. package/queries/getAllBlockUidsAndTexts.js +6 -6
  226. package/queries/getAllBlockUidsAndTexts.js.map +1 -1
  227. package/queries/getAllPageNames.d.ts +2 -2
  228. package/queries/getAllPageNames.js +6 -6
  229. package/queries/getAllPageNames.js.map +1 -1
  230. package/queries/getAttributeValueByBlockAndName.d.ts +5 -5
  231. package/queries/getAttributeValueByBlockAndName.js +11 -11
  232. package/queries/getAttributeValueByBlockAndName.js.map +1 -1
  233. package/queries/getBasicTreeByParentUid.d.ts +3 -3
  234. package/queries/getBasicTreeByParentUid.js +13 -13
  235. package/queries/getBasicTreeByParentUid.js.map +1 -1
  236. package/queries/getBlockUidAndTextIncludingText.d.ts +5 -5
  237. package/queries/getBlockUidAndTextIncludingText.js +7 -7
  238. package/queries/getBlockUidAndTextIncludingText.js.map +1 -1
  239. package/queries/getBlockUidByTextOnPage.d.ts +5 -5
  240. package/queries/getBlockUidByTextOnPage.js +7 -7
  241. package/queries/getBlockUidByTextOnPage.js.map +1 -1
  242. package/queries/getBlockUidsAndTextsReferencingPage.d.ts +5 -5
  243. package/queries/getBlockUidsAndTextsReferencingPage.js +9 -9
  244. package/queries/getBlockUidsAndTextsReferencingPage.js.map +1 -1
  245. package/queries/getBlockUidsByPageTitle.d.ts +2 -2
  246. package/queries/getBlockUidsByPageTitle.js +8 -8
  247. package/queries/getBlockUidsByPageTitle.js.map +1 -1
  248. package/queries/getBlockUidsReferencingBlock.d.ts +2 -2
  249. package/queries/getBlockUidsReferencingBlock.js +4 -4
  250. package/queries/getBlockUidsReferencingBlock.js.map +1 -1
  251. package/queries/getBlockUidsReferencingPage.d.ts +2 -2
  252. package/queries/getBlockUidsReferencingPage.js +6 -6
  253. package/queries/getBlockUidsReferencingPage.js.map +1 -1
  254. package/queries/getBlockUidsWithParentUid.d.ts +2 -2
  255. package/queries/getBlockUidsWithParentUid.js +6 -6
  256. package/queries/getBlockUidsWithParentUid.js.map +1 -1
  257. package/queries/getChildrenLengthByPageUid.d.ts +2 -2
  258. package/queries/getChildrenLengthByPageUid.js +8 -8
  259. package/queries/getChildrenLengthByPageUid.js.map +1 -1
  260. package/queries/getChildrenLengthByParentUid.d.ts +2 -2
  261. package/queries/getChildrenLengthByParentUid.js +7 -7
  262. package/queries/getChildrenLengthByParentUid.js.map +1 -1
  263. package/queries/getCreateTimeByBlockUid.d.ts +2 -2
  264. package/queries/getCreateTimeByBlockUid.js +7 -7
  265. package/queries/getCreateTimeByBlockUid.js.map +1 -1
  266. package/queries/getCurrentUser.d.ts +2 -2
  267. package/queries/getCurrentUser.js +11 -11
  268. package/queries/getCurrentUser.js.map +1 -1
  269. package/queries/getCurrentUserDisplayName.d.ts +2 -2
  270. package/queries/getCurrentUserDisplayName.js +10 -10
  271. package/queries/getCurrentUserDisplayName.js.map +1 -1
  272. package/queries/getCurrentUserEmail.d.ts +2 -2
  273. package/queries/getCurrentUserEmail.js +13 -13
  274. package/queries/getCurrentUserEmail.js.map +1 -1
  275. package/queries/getCurrentUserUid.d.ts +2 -2
  276. package/queries/getCurrentUserUid.js +13 -13
  277. package/queries/getCurrentUserUid.js.map +1 -1
  278. package/queries/getDisplayNameByEmail.d.ts +2 -2
  279. package/queries/getDisplayNameByEmail.js +7 -7
  280. package/queries/getDisplayNameByEmail.js.map +1 -1
  281. package/queries/getDisplayNameByUid.d.ts +2 -2
  282. package/queries/getDisplayNameByUid.js +7 -7
  283. package/queries/getDisplayNameByUid.js.map +1 -1
  284. package/queries/getEditTimeByBlockUid.d.ts +2 -2
  285. package/queries/getEditTimeByBlockUid.js +7 -7
  286. package/queries/getEditTimeByBlockUid.js.map +1 -1
  287. package/queries/getEditedUserEmailByBlockUid.d.ts +2 -2
  288. package/queries/getEditedUserEmailByBlockUid.js +7 -7
  289. package/queries/getEditedUserEmailByBlockUid.js.map +1 -1
  290. package/queries/getFirstChildTextByBlockUid.d.ts +2 -2
  291. package/queries/getFirstChildTextByBlockUid.js +7 -7
  292. package/queries/getFirstChildTextByBlockUid.js.map +1 -1
  293. package/queries/getFirstChildUidByBlockUid.d.ts +2 -2
  294. package/queries/getFirstChildUidByBlockUid.js +6 -6
  295. package/queries/getFirstChildUidByBlockUid.js.map +1 -1
  296. package/queries/getFullTreeByParentUid.d.ts +3 -3
  297. package/queries/getFullTreeByParentUid.js +51 -51
  298. package/queries/getFullTreeByParentUid.js.map +1 -1
  299. package/queries/getLinkedPageTitlesUnderUid.d.ts +2 -2
  300. package/queries/getLinkedPageTitlesUnderUid.js +6 -6
  301. package/queries/getLinkedPageTitlesUnderUid.js.map +1 -1
  302. package/queries/getNthChildUidByBlockUid.d.ts +5 -5
  303. package/queries/getNthChildUidByBlockUid.js +7 -7
  304. package/queries/getNthChildUidByBlockUid.js.map +1 -1
  305. package/queries/getOrderByBlockUid.d.ts +2 -2
  306. package/queries/getOrderByBlockUid.js +7 -7
  307. package/queries/getOrderByBlockUid.js.map +1 -1
  308. package/queries/getPageTitleByBlockUid.d.ts +2 -2
  309. package/queries/getPageTitleByBlockUid.js +7 -7
  310. package/queries/getPageTitleByBlockUid.js.map +1 -1
  311. package/queries/getPageTitleByPageUid.d.ts +2 -2
  312. package/queries/getPageTitleByPageUid.js +12 -12
  313. package/queries/getPageTitleByPageUid.js.map +1 -1
  314. package/queries/getPageTitleReferencesByPageTitle.d.ts +2 -2
  315. package/queries/getPageTitleReferencesByPageTitle.js +6 -6
  316. package/queries/getPageTitleReferencesByPageTitle.js.map +1 -1
  317. package/queries/getPageTitlesAndBlockUidsReferencingPage.d.ts +5 -5
  318. package/queries/getPageTitlesAndBlockUidsReferencingPage.js +9 -9
  319. package/queries/getPageTitlesAndBlockUidsReferencingPage.js.map +1 -1
  320. package/queries/getPageTitlesAndUidsDirectlyReferencingPage.d.ts +5 -5
  321. package/queries/getPageTitlesAndUidsDirectlyReferencingPage.js +9 -9
  322. package/queries/getPageTitlesAndUidsDirectlyReferencingPage.js.map +1 -1
  323. package/queries/getPageTitlesReferencingBlockUid.d.ts +2 -2
  324. package/queries/getPageTitlesReferencingBlockUid.js +4 -4
  325. package/queries/getPageTitlesReferencingBlockUid.js.map +1 -1
  326. package/queries/getPageTitlesStartingWithPrefix.d.ts +2 -2
  327. package/queries/getPageTitlesStartingWithPrefix.js +6 -6
  328. package/queries/getPageTitlesStartingWithPrefix.js.map +1 -1
  329. package/queries/getPageUidByBlockUid.d.ts +2 -2
  330. package/queries/getPageUidByBlockUid.js +7 -7
  331. package/queries/getPageUidByBlockUid.js.map +1 -1
  332. package/queries/getPageUidByPageTitle.d.ts +2 -2
  333. package/queries/getPageUidByPageTitle.js +9 -9
  334. package/queries/getPageUidByPageTitle.js.map +1 -1
  335. package/queries/getPageViewType.d.ts +3 -3
  336. package/queries/getPageViewType.js +9 -9
  337. package/queries/getPageViewType.js.map +1 -1
  338. package/queries/getParentTextByBlockUid.d.ts +2 -2
  339. package/queries/getParentTextByBlockUid.js +7 -7
  340. package/queries/getParentTextByBlockUid.js.map +1 -1
  341. package/queries/getParentTextByBlockUidAndTag.d.ts +5 -5
  342. package/queries/getParentTextByBlockUidAndTag.js +7 -7
  343. package/queries/getParentTextByBlockUidAndTag.js.map +1 -1
  344. package/queries/getParentUidByBlockUid.d.ts +2 -2
  345. package/queries/getParentUidByBlockUid.js +7 -7
  346. package/queries/getParentUidByBlockUid.js.map +1 -1
  347. package/queries/getParentUidsOfBlockUid.d.ts +2 -2
  348. package/queries/getParentUidsOfBlockUid.js +4 -4
  349. package/queries/getParentUidsOfBlockUid.js.map +1 -1
  350. package/queries/getSettingsByEmail.d.ts +3 -3
  351. package/queries/getSettingsByEmail.js +7 -7
  352. package/queries/getSettingsByEmail.js.map +1 -1
  353. package/queries/getShallowTreeByParentUid.d.ts +5 -5
  354. package/queries/getShallowTreeByParentUid.js +9 -9
  355. package/queries/getShallowTreeByParentUid.js.map +1 -1
  356. package/queries/getTextByBlockUid.d.ts +2 -2
  357. package/queries/getTextByBlockUid.js +9 -9
  358. package/queries/getTextByBlockUid.js.map +1 -1
  359. package/queries/index.js +4 -4
  360. package/queries/index.js.map +1 -1
  361. package/queries/isLiveBlock.d.ts +2 -2
  362. package/queries/isLiveBlock.js +4 -4
  363. package/queries/isLiveBlock.js.map +1 -1
  364. package/queries/isTagOnPage.d.ts +5 -5
  365. package/queries/isTagOnPage.js +9 -9
  366. package/queries/isTagOnPage.js.map +1 -1
  367. package/queries/normalizePageTitle.d.ts +2 -2
  368. package/queries/normalizePageTitle.js +4 -4
  369. package/queries/normalizePageTitle.js.map +1 -1
  370. package/scripts/index.d.ts +1 -1
  371. package/scripts/index.js +26 -26
  372. package/scripts/index.js.map +1 -1
  373. package/scripts/publishToRoamDepot.d.ts +7 -7
  374. package/scripts/publishToRoamDepot.js +113 -113
  375. package/scripts/publishToRoamDepot.js.map +1 -1
  376. package/testing/mockRoamEnvironment.d.ts +2 -2
  377. package/testing/mockRoamEnvironment.js +1253 -1253
  378. package/testing/mockRoamEnvironment.js.map +1 -1
  379. package/types/index.d.ts +389 -250
  380. package/types/index.js +4 -4
  381. package/types/index.js.map +1 -1
  382. package/types/native.d.ts +405 -402
  383. package/types/native.js +4 -4
  384. package/types/native.js.map +1 -1
  385. package/types/query-builder.d.ts +10 -10
  386. package/types/query-builder.js +2 -2
  387. package/types/query-builder.js.map +1 -1
  388. package/types/smartblocks.d.ts +35 -35
  389. package/types/smartblocks.js +2 -2
  390. package/types/smartblocks.js.map +1 -1
  391. package/util/addInputSetting.d.ts +7 -7
  392. package/util/addInputSetting.js +25 -25
  393. package/util/addInputSetting.js.map +1 -1
  394. package/util/apiDelete.d.ts +2 -2
  395. package/util/apiDelete.js +6 -6
  396. package/util/apiDelete.js.map +1 -1
  397. package/util/apiGet.d.ts +2 -2
  398. package/util/apiGet.js +6 -6
  399. package/util/apiGet.js.map +1 -1
  400. package/util/apiPost.d.ts +2 -2
  401. package/util/apiPost.js +6 -6
  402. package/util/apiPost.js.map +1 -1
  403. package/util/apiPut.d.ts +2 -2
  404. package/util/apiPut.js +6 -6
  405. package/util/apiPut.js.map +1 -1
  406. package/util/createOverlayRender.d.ts +4 -4
  407. package/util/createOverlayRender.js +6 -6
  408. package/util/createOverlayRender.js.map +1 -1
  409. package/util/createTagRegex.d.ts +2 -2
  410. package/util/createTagRegex.js +7 -7
  411. package/util/createTagRegex.js.map +1 -1
  412. package/util/dispatchToRegistry.d.ts +3 -3
  413. package/util/dispatchToRegistry.js +7 -7
  414. package/util/dispatchToRegistry.js.map +1 -1
  415. package/util/env.d.ts +4 -4
  416. package/util/env.js +47 -47
  417. package/util/env.js.map +1 -1
  418. package/util/extensionApiContext.d.ts +29 -29
  419. package/util/extensionApiContext.js +17 -17
  420. package/util/extensionApiContext.js.map +1 -1
  421. package/util/extensionDeprecatedWarning.d.ts +5 -5
  422. package/util/extensionDeprecatedWarning.js +39 -39
  423. package/util/extensionDeprecatedWarning.js.map +1 -1
  424. package/util/extractRef.d.ts +2 -2
  425. package/util/extractRef.js +8 -8
  426. package/util/extractRef.js.map +1 -1
  427. package/util/extractTag.d.ts +2 -2
  428. package/util/extractTag.js +15 -15
  429. package/util/extractTag.js.map +1 -1
  430. package/util/focusMainWindowBlock.d.ts +2 -2
  431. package/util/focusMainWindowBlock.js +12 -12
  432. package/util/focusMainWindowBlock.js.map +1 -1
  433. package/util/getAuthorizationHeader.d.ts +2 -2
  434. package/util/getAuthorizationHeader.js +12 -12
  435. package/util/getAuthorizationHeader.js.map +1 -1
  436. package/util/getLocalStorageKey.d.ts +2 -2
  437. package/util/getLocalStorageKey.js +4 -4
  438. package/util/getLocalStorageKey.js.map +1 -1
  439. package/util/getOauth.d.ts +2 -2
  440. package/util/getOauth.js +52 -52
  441. package/util/getOauth.js.map +1 -1
  442. package/util/getOauthAccounts.d.ts +2 -2
  443. package/util/getOauthAccounts.js +22 -22
  444. package/util/getOauthAccounts.js.map +1 -1
  445. package/util/getRenderRoot.d.ts +2 -2
  446. package/util/getRenderRoot.js +18 -18
  447. package/util/getRenderRoot.js.map +1 -1
  448. package/util/getSettingIntFromTree.d.ts +7 -7
  449. package/util/getSettingIntFromTree.js +11 -11
  450. package/util/getSettingIntFromTree.js.map +1 -1
  451. package/util/getSettingValueFromTree.d.ts +8 -8
  452. package/util/getSettingValueFromTree.js +14 -14
  453. package/util/getSettingValueFromTree.js.map +1 -1
  454. package/util/getSettingValuesFromTree.d.ts +7 -7
  455. package/util/getSettingValuesFromTree.js +12 -12
  456. package/util/getSettingValuesFromTree.js.map +1 -1
  457. package/util/getSubTree.d.ts +8 -8
  458. package/util/getSubTree.js +19 -19
  459. package/util/getSubTree.js.map +1 -1
  460. package/util/getToken.d.ts +2 -2
  461. package/util/getToken.js +10 -10
  462. package/util/getToken.js.map +1 -1
  463. package/util/getTokenFromTree.d.ts +3 -3
  464. package/util/getTokenFromTree.js +4 -4
  465. package/util/getTokenFromTree.js.map +1 -1
  466. package/util/getWorkerClient.d.ts +12 -12
  467. package/util/getWorkerClient.js +41 -41
  468. package/util/getWorkerClient.js.map +1 -1
  469. package/util/handleBodyFetch.d.ts +3 -3
  470. package/util/handleBodyFetch.js +21 -21
  471. package/util/handleBodyFetch.js.map +1 -1
  472. package/util/handleFetch.d.ts +13 -13
  473. package/util/handleFetch.js +40 -40
  474. package/util/handleFetch.js.map +1 -1
  475. package/util/handleUrlFetch.d.ts +3 -3
  476. package/util/handleUrlFetch.js +19 -19
  477. package/util/handleUrlFetch.js.map +1 -1
  478. package/util/idToTitle.d.ts +2 -2
  479. package/util/idToTitle.js +8 -8
  480. package/util/idToTitle.js.map +1 -1
  481. package/util/index.d.ts +24 -24
  482. package/util/index.js +54 -54
  483. package/util/index.js.map +1 -1
  484. package/util/isControl.d.ts +2 -2
  485. package/util/isControl.js +4 -4
  486. package/util/isControl.js.map +1 -1
  487. package/util/localStorageGet.d.ts +2 -2
  488. package/util/localStorageGet.js +8 -8
  489. package/util/localStorageGet.js.map +1 -1
  490. package/util/localStorageRemove.d.ts +2 -2
  491. package/util/localStorageRemove.js +6 -6
  492. package/util/localStorageRemove.js.map +1 -1
  493. package/util/localStorageSet.d.ts +2 -2
  494. package/util/localStorageSet.js +8 -8
  495. package/util/localStorageSet.js.map +1 -1
  496. package/util/registerExperimentalMode.d.ts +6 -6
  497. package/util/registerExperimentalMode.js +65 -65
  498. package/util/registerExperimentalMode.js.map +1 -1
  499. package/util/registerSmartBlocksCommand.d.ts +3 -3
  500. package/util/registerSmartBlocksCommand.js +23 -23
  501. package/util/registerSmartBlocksCommand.js.map +1 -1
  502. package/util/removeFromRegistry.d.ts +3 -3
  503. package/util/removeFromRegistry.js +7 -7
  504. package/util/removeFromRegistry.js.map +1 -1
  505. package/util/renderOverlay.d.ts +12 -12
  506. package/util/renderOverlay.js +48 -48
  507. package/util/renderOverlay.js.map +1 -1
  508. package/util/renderWithUnmount.d.ts +4 -4
  509. package/util/renderWithUnmount.js +44 -44
  510. package/util/renderWithUnmount.js.map +1 -1
  511. package/util/runExtension.d.ts +11 -11
  512. package/util/runExtension.js +174 -174
  513. package/util/runExtension.js.map +1 -1
  514. package/util/setInputSetting.d.ts +7 -7
  515. package/util/setInputSetting.js +37 -37
  516. package/util/setInputSetting.js.map +1 -1
  517. package/util/setInputSettings.d.ts +7 -7
  518. package/util/setInputSettings.js +28 -28
  519. package/util/setInputSettings.js.map +1 -1
  520. package/util/stripUid.d.ts +3 -3
  521. package/util/stripUid.js +10 -10
  522. package/util/stripUid.js.map +1 -1
  523. package/util/toConfigPageName.d.ts +2 -2
  524. package/util/toConfigPageName.js +4 -4
  525. package/util/toConfigPageName.js.map +1 -1
  526. package/util/toFlexRegex.d.ts +2 -2
  527. package/util/toFlexRegex.js +4 -4
  528. package/util/toFlexRegex.js.map +1 -1
  529. package/writes/clearBlockById.d.ts +2 -2
  530. package/writes/clearBlockById.js +17 -17
  531. package/writes/clearBlockById.js.map +1 -1
  532. package/writes/clearBlockByUid.d.ts +2 -2
  533. package/writes/clearBlockByUid.js +16 -16
  534. package/writes/clearBlockByUid.js.map +1 -1
  535. package/writes/createBlock.d.ts +8 -8
  536. package/writes/createBlock.js +28 -28
  537. package/writes/createBlock.js.map +1 -1
  538. package/writes/createPage.d.ts +7 -7
  539. package/writes/createPage.js +20 -20
  540. package/writes/createPage.js.map +1 -1
  541. package/writes/deleteBlock.d.ts +2 -2
  542. package/writes/deleteBlock.js +10 -10
  543. package/writes/deleteBlock.js.map +1 -1
  544. package/writes/index.d.ts +8 -8
  545. package/writes/index.js +22 -22
  546. package/writes/index.js.map +1 -1
  547. package/writes/openBlockInSidebar.d.ts +2 -2
  548. package/writes/openBlockInSidebar.js +13 -13
  549. package/writes/openBlockInSidebar.js.map +1 -1
  550. package/writes/submitActions.d.ts +8 -8
  551. package/writes/submitActions.js +36 -36
  552. package/writes/submitActions.js.map +1 -1
  553. package/writes/updateActiveBlock.d.ts +2 -2
  554. package/writes/updateActiveBlock.js +17 -17
  555. package/writes/updateActiveBlock.js.map +1 -1
  556. package/writes/updateBlock.d.ts +5 -5
  557. package/writes/updateBlock.js +23 -23
  558. package/writes/updateBlock.js.map +1 -1
@@ -1,23 +1,23 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const getShallowTreeByParentUid_1 = tslib_1.__importDefault(require("../queries/getShallowTreeByParentUid"));
5
- const getPageUidByPageTitle_1 = tslib_1.__importDefault(require("../queries/getPageUidByPageTitle"));
6
- const localStorageGet_1 = tslib_1.__importDefault(require("./localStorageGet"));
7
- const toConfigPageName_1 = tslib_1.__importDefault(require("./toConfigPageName"));
8
- const toFlexRegex_1 = tslib_1.__importDefault(require("./toFlexRegex"));
9
- const getOauthAccounts = (service) => {
10
- const fromStorage = (0, localStorageGet_1.default)(`oauth-${service}`);
11
- if (fromStorage) {
12
- const accounts = JSON.parse(fromStorage);
13
- return accounts.map((a) => a.text);
14
- }
15
- const tree = (0, getShallowTreeByParentUid_1.default)((0, getPageUidByPageTitle_1.default)((0, toConfigPageName_1.default)(service)));
16
- const node = tree.find((s) => (0, toFlexRegex_1.default)("oauth").test(s.text.trim()));
17
- if (!node) {
18
- return [];
19
- }
20
- return (0, getShallowTreeByParentUid_1.default)(node.uid).map((t) => t.text);
21
- };
22
- exports.default = getOauthAccounts;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const getShallowTreeByParentUid_1 = tslib_1.__importDefault(require("../queries/getShallowTreeByParentUid"));
5
+ const getPageUidByPageTitle_1 = tslib_1.__importDefault(require("../queries/getPageUidByPageTitle"));
6
+ const localStorageGet_1 = tslib_1.__importDefault(require("./localStorageGet"));
7
+ const toConfigPageName_1 = tslib_1.__importDefault(require("./toConfigPageName"));
8
+ const toFlexRegex_1 = tslib_1.__importDefault(require("./toFlexRegex"));
9
+ const getOauthAccounts = (service) => {
10
+ const fromStorage = (0, localStorageGet_1.default)(`oauth-${service}`);
11
+ if (fromStorage) {
12
+ const accounts = JSON.parse(fromStorage);
13
+ return accounts.map((a) => a.text);
14
+ }
15
+ const tree = (0, getShallowTreeByParentUid_1.default)((0, getPageUidByPageTitle_1.default)((0, toConfigPageName_1.default)(service)));
16
+ const node = tree.find((s) => (0, toFlexRegex_1.default)("oauth").test(s.text.trim()));
17
+ if (!node) {
18
+ return [];
19
+ }
20
+ return (0, getShallowTreeByParentUid_1.default)(node.uid).map((t) => t.text);
21
+ };
22
+ exports.default = getOauthAccounts;
23
23
  //# sourceMappingURL=getOauthAccounts.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getOauthAccounts.js","sourceRoot":"","sources":["../../src/util/getOauthAccounts.ts"],"names":[],"mappings":";;;AAAA,6GAA6E;AAC7E,qGAAqE;AACrE,gFAAgD;AAChD,kFAAkD;AAClD,wEAAwC;AAExC,MAAM,gBAAgB,GAAG,CAAC,OAAe,EAAY,EAAE;IACrD,MAAM,WAAW,GAAG,IAAA,yBAAe,EAAC,SAAS,OAAO,EAAE,CAAC,CAAC;IACxD,IAAI,WAAW,EAAE;QACf,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAGpC,CAAC;QACJ,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;KACpC;IACD,MAAM,IAAI,GAAG,IAAA,mCAAyB,EACpC,IAAA,+BAAqB,EAAC,IAAA,0BAAgB,EAAC,OAAO,CAAC,CAAC,CACjD,CAAC;IACF,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,qBAAW,EAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IACxE,IAAI,CAAC,IAAI,EAAE;QACT,OAAO,EAAE,CAAC;KACX;IACD,OAAO,IAAA,mCAAyB,EAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AAChE,CAAC,CAAC;AAEF,kBAAe,gBAAgB,CAAC","sourcesContent":["import getShallowTreeByParentUid from \"../queries/getShallowTreeByParentUid\";\r\nimport getPageUidByPageTitle from \"../queries/getPageUidByPageTitle\";\r\nimport localStorageGet from \"./localStorageGet\";\r\nimport toConfigPageName from \"./toConfigPageName\";\r\nimport toFlexRegex from \"./toFlexRegex\";\r\n\r\nconst getOauthAccounts = (service: string): string[] => {\r\n const fromStorage = localStorageGet(`oauth-${service}`);\r\n if (fromStorage) {\r\n const accounts = JSON.parse(fromStorage) as {\r\n text: string;\r\n data: string;\r\n }[];\r\n return accounts.map((a) => a.text);\r\n }\r\n const tree = getShallowTreeByParentUid(\r\n getPageUidByPageTitle(toConfigPageName(service))\r\n );\r\n const node = tree.find((s) => toFlexRegex(\"oauth\").test(s.text.trim()));\r\n if (!node) {\r\n return [];\r\n }\r\n return getShallowTreeByParentUid(node.uid).map((t) => t.text);\r\n};\r\n\r\nexport default getOauthAccounts;\r\n"]}
1
+ {"version":3,"file":"getOauthAccounts.js","sourceRoot":"","sources":["../../src/util/getOauthAccounts.ts"],"names":[],"mappings":";;;AAAA,6GAA6E;AAC7E,qGAAqE;AACrE,gFAAgD;AAChD,kFAAkD;AAClD,wEAAwC;AAExC,MAAM,gBAAgB,GAAG,CAAC,OAAe,EAAY,EAAE;IACrD,MAAM,WAAW,GAAG,IAAA,yBAAe,EAAC,SAAS,OAAO,EAAE,CAAC,CAAC;IACxD,IAAI,WAAW,EAAE;QACf,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAGpC,CAAC;QACJ,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;KACpC;IACD,MAAM,IAAI,GAAG,IAAA,mCAAyB,EACpC,IAAA,+BAAqB,EAAC,IAAA,0BAAgB,EAAC,OAAO,CAAC,CAAC,CACjD,CAAC;IACF,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,qBAAW,EAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IACxE,IAAI,CAAC,IAAI,EAAE;QACT,OAAO,EAAE,CAAC;KACX;IACD,OAAO,IAAA,mCAAyB,EAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AAChE,CAAC,CAAC;AAEF,kBAAe,gBAAgB,CAAC","sourcesContent":["import getShallowTreeByParentUid from \"../queries/getShallowTreeByParentUid\";\nimport getPageUidByPageTitle from \"../queries/getPageUidByPageTitle\";\nimport localStorageGet from \"./localStorageGet\";\nimport toConfigPageName from \"./toConfigPageName\";\nimport toFlexRegex from \"./toFlexRegex\";\n\nconst getOauthAccounts = (service: string): string[] => {\n const fromStorage = localStorageGet(`oauth-${service}`);\n if (fromStorage) {\n const accounts = JSON.parse(fromStorage) as {\n text: string;\n data: string;\n }[];\n return accounts.map((a) => a.text);\n }\n const tree = getShallowTreeByParentUid(\n getPageUidByPageTitle(toConfigPageName(service))\n );\n const node = tree.find((s) => toFlexRegex(\"oauth\").test(s.text.trim()));\n if (!node) {\n return [];\n }\n return getShallowTreeByParentUid(node.uid).map((t) => t.text);\n};\n\nexport default getOauthAccounts;\n"]}
@@ -1,2 +1,2 @@
1
- declare const getRenderRoot: (id: string) => HTMLDivElement;
2
- export default getRenderRoot;
1
+ declare const getRenderRoot: (id: string) => HTMLDivElement;
2
+ export default getRenderRoot;
@@ -1,19 +1,19 @@
1
- "use strict";
2
- // @DEPRECATED
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- const getRenderRoot = (id) => {
5
- var _a;
6
- const rootId = `roamjs-${id}-root`;
7
- const existing = document.getElementById(rootId);
8
- if (existing) {
9
- existing.setAttribute("data-existing", "true");
10
- return existing;
11
- }
12
- const app = document.getElementById("app");
13
- const newRoot = document.createElement("div");
14
- newRoot.id = rootId;
15
- (_a = app === null || app === void 0 ? void 0 : app.parentElement) === null || _a === void 0 ? void 0 : _a.appendChild(newRoot);
16
- return newRoot;
17
- };
18
- exports.default = getRenderRoot;
1
+ "use strict";
2
+ // @DEPRECATED
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ const getRenderRoot = (id) => {
5
+ var _a;
6
+ const rootId = `roamjs-${id}-root`;
7
+ const existing = document.getElementById(rootId);
8
+ if (existing) {
9
+ existing.setAttribute("data-existing", "true");
10
+ return existing;
11
+ }
12
+ const app = document.getElementById("app");
13
+ const newRoot = document.createElement("div");
14
+ newRoot.id = rootId;
15
+ (_a = app === null || app === void 0 ? void 0 : app.parentElement) === null || _a === void 0 ? void 0 : _a.appendChild(newRoot);
16
+ return newRoot;
17
+ };
18
+ exports.default = getRenderRoot;
19
19
  //# sourceMappingURL=getRenderRoot.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getRenderRoot.js","sourceRoot":"","sources":["../../src/util/getRenderRoot.ts"],"names":[],"mappings":";AAAA,cAAc;;AAEd,MAAM,aAAa,GAAG,CAAC,EAAU,EAAkB,EAAE;;IACnD,MAAM,MAAM,GAAG,UAAU,EAAE,OAAO,CAAC;IACnC,MAAM,QAAQ,GAAG,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAmB,CAAC;IACnE,IAAI,QAAQ,EAAE;QACZ,QAAQ,CAAC,YAAY,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC;QAC/C,OAAO,QAAQ,CAAC;KACjB;IACD,MAAM,GAAG,GAAG,QAAQ,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IAC3C,MAAM,OAAO,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IAC9C,OAAO,CAAC,EAAE,GAAG,MAAM,CAAC;IACpB,MAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,aAAa,0CAAE,WAAW,CAAC,OAAO,CAAC,CAAC;IACzC,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAEF,kBAAe,aAAa,CAAC","sourcesContent":["// @DEPRECATED\r\n\r\nconst getRenderRoot = (id: string): HTMLDivElement => {\r\n const rootId = `roamjs-${id}-root`;\r\n const existing = document.getElementById(rootId) as HTMLDivElement;\r\n if (existing) {\r\n existing.setAttribute(\"data-existing\", \"true\");\r\n return existing;\r\n }\r\n const app = document.getElementById(\"app\");\r\n const newRoot = document.createElement(\"div\");\r\n newRoot.id = rootId;\r\n app?.parentElement?.appendChild(newRoot);\r\n return newRoot;\r\n};\r\n\r\nexport default getRenderRoot;\r\n"]}
1
+ {"version":3,"file":"getRenderRoot.js","sourceRoot":"","sources":["../../src/util/getRenderRoot.ts"],"names":[],"mappings":";AAAA,cAAc;;AAEd,MAAM,aAAa,GAAG,CAAC,EAAU,EAAkB,EAAE;;IACnD,MAAM,MAAM,GAAG,UAAU,EAAE,OAAO,CAAC;IACnC,MAAM,QAAQ,GAAG,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAmB,CAAC;IACnE,IAAI,QAAQ,EAAE;QACZ,QAAQ,CAAC,YAAY,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC;QAC/C,OAAO,QAAQ,CAAC;KACjB;IACD,MAAM,GAAG,GAAG,QAAQ,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IAC3C,MAAM,OAAO,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IAC9C,OAAO,CAAC,EAAE,GAAG,MAAM,CAAC;IACpB,MAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,aAAa,0CAAE,WAAW,CAAC,OAAO,CAAC,CAAC;IACzC,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAEF,kBAAe,aAAa,CAAC","sourcesContent":["// @DEPRECATED\n\nconst getRenderRoot = (id: string): HTMLDivElement => {\n const rootId = `roamjs-${id}-root`;\n const existing = document.getElementById(rootId) as HTMLDivElement;\n if (existing) {\n existing.setAttribute(\"data-existing\", \"true\");\n return existing;\n }\n const app = document.getElementById(\"app\");\n const newRoot = document.createElement(\"div\");\n newRoot.id = rootId;\n app?.parentElement?.appendChild(newRoot);\n return newRoot;\n};\n\nexport default getRenderRoot;\n"]}
@@ -1,7 +1,7 @@
1
- import type { InputTextNode } from "../types";
2
- declare const getSettingIntFromTree: ({ tree, key, defaultValue, }: {
3
- tree: InputTextNode[];
4
- key: string;
5
- defaultValue?: number | undefined;
6
- }) => number;
7
- export default getSettingIntFromTree;
1
+ import type { InputTextNode } from "../types";
2
+ declare const getSettingIntFromTree: ({ tree, key, defaultValue, }: {
3
+ tree: InputTextNode[];
4
+ key: string;
5
+ defaultValue?: number | undefined;
6
+ }) => number;
7
+ export default getSettingIntFromTree;
@@ -1,12 +1,12 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const toFlexRegex_1 = tslib_1.__importDefault(require("./toFlexRegex"));
5
- const getSettingIntFromTree = ({ tree, key, defaultValue = 0, }) => {
6
- var _a, _b, _c, _d;
7
- const node = tree.find((s) => (0, toFlexRegex_1.default)(key).test(s.text.trim()));
8
- const value = ((_d = (_c = (_b = (_a = node === null || node === void 0 ? void 0 : node.children) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.text) === null || _c === void 0 ? void 0 : _c.trim) === null || _d === void 0 ? void 0 : _d.call(_c)) || "";
9
- return !value || isNaN(Number(value)) ? defaultValue : Number(value);
10
- };
11
- exports.default = getSettingIntFromTree;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const toFlexRegex_1 = tslib_1.__importDefault(require("./toFlexRegex"));
5
+ const getSettingIntFromTree = ({ tree, key, defaultValue = 0, }) => {
6
+ var _a, _b, _c, _d;
7
+ const node = tree.find((s) => (0, toFlexRegex_1.default)(key).test(s.text.trim()));
8
+ const value = ((_d = (_c = (_b = (_a = node === null || node === void 0 ? void 0 : node.children) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.text) === null || _c === void 0 ? void 0 : _c.trim) === null || _d === void 0 ? void 0 : _d.call(_c)) || "";
9
+ return !value || isNaN(Number(value)) ? defaultValue : Number(value);
10
+ };
11
+ exports.default = getSettingIntFromTree;
12
12
  //# sourceMappingURL=getSettingIntFromTree.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getSettingIntFromTree.js","sourceRoot":"","sources":["../../src/util/getSettingIntFromTree.ts"],"names":[],"mappings":";;;AACA,wEAAwC;AAExC,MAAM,qBAAqB,GAAG,CAAC,EAC7B,IAAI,EACJ,GAAG,EACH,YAAY,GAAG,CAAC,GAKjB,EAAU,EAAE;;IACX,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,qBAAW,EAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IACpE,MAAM,KAAK,GAAG,CAAA,MAAA,MAAA,MAAA,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,QAAQ,0CAAG,CAAC,CAAC,0CAAE,IAAI,0CAAE,IAAI,kDAAI,KAAI,EAAE,CAAC;IACxD,OAAO,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACvE,CAAC,CAAC;AAEF,kBAAe,qBAAqB,CAAC","sourcesContent":["import type { InputTextNode } from \"../types\";\r\nimport toFlexRegex from \"./toFlexRegex\";\r\n\r\nconst getSettingIntFromTree = ({\r\n tree,\r\n key,\r\n defaultValue = 0,\r\n}: {\r\n tree: InputTextNode[];\r\n key: string;\r\n defaultValue?: number;\r\n}): number => {\r\n const node = tree.find((s) => toFlexRegex(key).test(s.text.trim()));\r\n const value = node?.children?.[0]?.text?.trim?.() || \"\";\r\n return !value || isNaN(Number(value)) ? defaultValue : Number(value);\r\n};\r\n\r\nexport default getSettingIntFromTree;\r\n"]}
1
+ {"version":3,"file":"getSettingIntFromTree.js","sourceRoot":"","sources":["../../src/util/getSettingIntFromTree.ts"],"names":[],"mappings":";;;AACA,wEAAwC;AAExC,MAAM,qBAAqB,GAAG,CAAC,EAC7B,IAAI,EACJ,GAAG,EACH,YAAY,GAAG,CAAC,GAKjB,EAAU,EAAE;;IACX,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,qBAAW,EAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IACpE,MAAM,KAAK,GAAG,CAAA,MAAA,MAAA,MAAA,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,QAAQ,0CAAG,CAAC,CAAC,0CAAE,IAAI,0CAAE,IAAI,kDAAI,KAAI,EAAE,CAAC;IACxD,OAAO,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACvE,CAAC,CAAC;AAEF,kBAAe,qBAAqB,CAAC","sourcesContent":["import type { InputTextNode } from \"../types\";\nimport toFlexRegex from \"./toFlexRegex\";\n\nconst getSettingIntFromTree = ({\n tree,\n key,\n defaultValue = 0,\n}: {\n tree: InputTextNode[];\n key: string;\n defaultValue?: number;\n}): number => {\n const node = tree.find((s) => toFlexRegex(key).test(s.text.trim()));\n const value = node?.children?.[0]?.text?.trim?.() || \"\";\n return !value || isNaN(Number(value)) ? defaultValue : Number(value);\n};\n\nexport default getSettingIntFromTree;\n"]}
@@ -1,8 +1,8 @@
1
- import type { InputTextNode } from "../types";
2
- declare const getSettingValueFromTree: ({ parentUid, tree, key, defaultValue, }: {
3
- parentUid?: string | undefined;
4
- tree?: InputTextNode[] | undefined;
5
- key: string;
6
- defaultValue?: string | undefined;
7
- }) => string;
8
- export default getSettingValueFromTree;
1
+ import type { InputTextNode } from "../types";
2
+ declare const getSettingValueFromTree: ({ parentUid, tree, key, defaultValue, }: {
3
+ parentUid?: string | undefined;
4
+ tree?: InputTextNode[] | undefined;
5
+ key: string;
6
+ defaultValue?: string | undefined;
7
+ }) => string;
8
+ export default getSettingValueFromTree;
@@ -1,15 +1,15 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const getBasicTreeByParentUid_1 = tslib_1.__importDefault(require("../queries/getBasicTreeByParentUid"));
5
- const toFlexRegex_1 = tslib_1.__importDefault(require("./toFlexRegex"));
6
- const getSettingValueFromTree = ({ parentUid = "", tree = (0, getBasicTreeByParentUid_1.default)(parentUid), key, defaultValue = "", }) => {
7
- var _a, _b;
8
- const node = tree.find((s) => (0, toFlexRegex_1.default)(key).test(s.text.trim()));
9
- const value = ((_a = node === null || node === void 0 ? void 0 : node.children) === null || _a === void 0 ? void 0 : _a[0])
10
- ? (_b = node === null || node === void 0 ? void 0 : node.children) === null || _b === void 0 ? void 0 : _b[0].text.trim()
11
- : defaultValue;
12
- return value;
13
- };
14
- exports.default = getSettingValueFromTree;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const getBasicTreeByParentUid_1 = tslib_1.__importDefault(require("../queries/getBasicTreeByParentUid"));
5
+ const toFlexRegex_1 = tslib_1.__importDefault(require("./toFlexRegex"));
6
+ const getSettingValueFromTree = ({ parentUid = "", tree = (0, getBasicTreeByParentUid_1.default)(parentUid), key, defaultValue = "", }) => {
7
+ var _a, _b;
8
+ const node = tree.find((s) => (0, toFlexRegex_1.default)(key).test(s.text.trim()));
9
+ const value = ((_a = node === null || node === void 0 ? void 0 : node.children) === null || _a === void 0 ? void 0 : _a[0])
10
+ ? (_b = node === null || node === void 0 ? void 0 : node.children) === null || _b === void 0 ? void 0 : _b[0].text.trim()
11
+ : defaultValue;
12
+ return value;
13
+ };
14
+ exports.default = getSettingValueFromTree;
15
15
  //# sourceMappingURL=getSettingValueFromTree.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getSettingValueFromTree.js","sourceRoot":"","sources":["../../src/util/getSettingValueFromTree.ts"],"names":[],"mappings":";;;AAAA,yGAAyE;AAEzE,wEAAwC;AAExC,MAAM,uBAAuB,GAAG,CAAC,EAC/B,SAAS,GAAG,EAAE,EACd,IAAI,GAAG,IAAA,iCAAuB,EAAC,SAAS,CAAC,EACzC,GAAG,EACH,YAAY,GAAG,EAAE,GAMlB,EAAU,EAAE;;IACX,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,qBAAW,EAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IACpE,MAAM,KAAK,GAAG,CAAA,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,QAAQ,0CAAG,CAAC,CAAC;QAC/B,CAAC,CAAC,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,QAAQ,0CAAG,CAAC,EAAE,IAAI,CAAC,IAAI,EAAE;QACjC,CAAC,CAAC,YAAY,CAAC;IACjB,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF,kBAAe,uBAAuB,CAAC","sourcesContent":["import getBasicTreeByParentUid from \"../queries/getBasicTreeByParentUid\";\r\nimport type { InputTextNode } from \"../types\";\r\nimport toFlexRegex from \"./toFlexRegex\";\r\n\r\nconst getSettingValueFromTree = ({\r\n parentUid = \"\",\r\n tree = getBasicTreeByParentUid(parentUid),\r\n key,\r\n defaultValue = \"\",\r\n}: {\r\n parentUid?: string;\r\n tree?: InputTextNode[];\r\n key: string;\r\n defaultValue?: string;\r\n}): string => {\r\n const node = tree.find((s) => toFlexRegex(key).test(s.text.trim()));\r\n const value = node?.children?.[0]\r\n ? node?.children?.[0].text.trim()\r\n : defaultValue;\r\n return value;\r\n};\r\n\r\nexport default getSettingValueFromTree;\r\n"]}
1
+ {"version":3,"file":"getSettingValueFromTree.js","sourceRoot":"","sources":["../../src/util/getSettingValueFromTree.ts"],"names":[],"mappings":";;;AAAA,yGAAyE;AAEzE,wEAAwC;AAExC,MAAM,uBAAuB,GAAG,CAAC,EAC/B,SAAS,GAAG,EAAE,EACd,IAAI,GAAG,IAAA,iCAAuB,EAAC,SAAS,CAAC,EACzC,GAAG,EACH,YAAY,GAAG,EAAE,GAMlB,EAAU,EAAE;;IACX,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,qBAAW,EAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IACpE,MAAM,KAAK,GAAG,CAAA,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,QAAQ,0CAAG,CAAC,CAAC;QAC/B,CAAC,CAAC,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,QAAQ,0CAAG,CAAC,EAAE,IAAI,CAAC,IAAI,EAAE;QACjC,CAAC,CAAC,YAAY,CAAC;IACjB,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF,kBAAe,uBAAuB,CAAC","sourcesContent":["import getBasicTreeByParentUid from \"../queries/getBasicTreeByParentUid\";\nimport type { InputTextNode } from \"../types\";\nimport toFlexRegex from \"./toFlexRegex\";\n\nconst getSettingValueFromTree = ({\n parentUid = \"\",\n tree = getBasicTreeByParentUid(parentUid),\n key,\n defaultValue = \"\",\n}: {\n parentUid?: string;\n tree?: InputTextNode[];\n key: string;\n defaultValue?: string;\n}): string => {\n const node = tree.find((s) => toFlexRegex(key).test(s.text.trim()));\n const value = node?.children?.[0]\n ? node?.children?.[0].text.trim()\n : defaultValue;\n return value;\n};\n\nexport default getSettingValueFromTree;\n"]}
@@ -1,7 +1,7 @@
1
- import type { InputTextNode } from "../types";
2
- declare const getSettingValuesFromTree: ({ tree, key, defaultValue, }: {
3
- tree: InputTextNode[];
4
- key: string;
5
- defaultValue?: string[] | undefined;
6
- }) => string[];
7
- export default getSettingValuesFromTree;
1
+ import type { InputTextNode } from "../types";
2
+ declare const getSettingValuesFromTree: ({ tree, key, defaultValue, }: {
3
+ tree: InputTextNode[];
4
+ key: string;
5
+ defaultValue?: string[] | undefined;
6
+ }) => string[];
7
+ export default getSettingValuesFromTree;
@@ -1,13 +1,13 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const toFlexRegex_1 = tslib_1.__importDefault(require("./toFlexRegex"));
5
- const getSettingValuesFromTree = ({ tree, key, defaultValue = [], }) => {
6
- const node = tree.find((s) => (0, toFlexRegex_1.default)(key).test(s.text.trim()));
7
- const value = (node === null || node === void 0 ? void 0 : node.children)
8
- ? node.children.map((t) => t.text.trim())
9
- : defaultValue;
10
- return value;
11
- };
12
- exports.default = getSettingValuesFromTree;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const toFlexRegex_1 = tslib_1.__importDefault(require("./toFlexRegex"));
5
+ const getSettingValuesFromTree = ({ tree, key, defaultValue = [], }) => {
6
+ const node = tree.find((s) => (0, toFlexRegex_1.default)(key).test(s.text.trim()));
7
+ const value = (node === null || node === void 0 ? void 0 : node.children)
8
+ ? node.children.map((t) => t.text.trim())
9
+ : defaultValue;
10
+ return value;
11
+ };
12
+ exports.default = getSettingValuesFromTree;
13
13
  //# sourceMappingURL=getSettingValuesFromTree.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getSettingValuesFromTree.js","sourceRoot":"","sources":["../../src/util/getSettingValuesFromTree.ts"],"names":[],"mappings":";;;AACA,wEAAwC;AAExC,MAAM,wBAAwB,GAAG,CAAC,EAChC,IAAI,EACJ,GAAG,EACH,YAAY,GAAG,EAAE,GAKlB,EAAY,EAAE;IACb,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,qBAAW,EAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IACpE,MAAM,KAAK,GAAG,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,QAAQ;QAC1B,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;QACzC,CAAC,CAAC,YAAY,CAAC;IACjB,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF,kBAAe,wBAAwB,CAAC","sourcesContent":["import type { InputTextNode } from \"../types\";\r\nimport toFlexRegex from \"./toFlexRegex\";\r\n\r\nconst getSettingValuesFromTree = ({\r\n tree,\r\n key,\r\n defaultValue = [],\r\n}: {\r\n tree: InputTextNode[];\r\n key: string;\r\n defaultValue?: string[];\r\n}): string[] => {\r\n const node = tree.find((s) => toFlexRegex(key).test(s.text.trim()));\r\n const value = node?.children\r\n ? node.children.map((t) => t.text.trim())\r\n : defaultValue;\r\n return value;\r\n};\r\n\r\nexport default getSettingValuesFromTree;\r\n"]}
1
+ {"version":3,"file":"getSettingValuesFromTree.js","sourceRoot":"","sources":["../../src/util/getSettingValuesFromTree.ts"],"names":[],"mappings":";;;AACA,wEAAwC;AAExC,MAAM,wBAAwB,GAAG,CAAC,EAChC,IAAI,EACJ,GAAG,EACH,YAAY,GAAG,EAAE,GAKlB,EAAY,EAAE;IACb,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,qBAAW,EAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IACpE,MAAM,KAAK,GAAG,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,QAAQ;QAC1B,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;QACzC,CAAC,CAAC,YAAY,CAAC;IACjB,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF,kBAAe,wBAAwB,CAAC","sourcesContent":["import type { InputTextNode } from \"../types\";\nimport toFlexRegex from \"./toFlexRegex\";\n\nconst getSettingValuesFromTree = ({\n tree,\n key,\n defaultValue = [],\n}: {\n tree: InputTextNode[];\n key: string;\n defaultValue?: string[];\n}): string[] => {\n const node = tree.find((s) => toFlexRegex(key).test(s.text.trim()));\n const value = node?.children\n ? node.children.map((t) => t.text.trim())\n : defaultValue;\n return value;\n};\n\nexport default getSettingValuesFromTree;\n"]}
@@ -1,8 +1,8 @@
1
- import type { RoamBasicNode } from "../types/native";
2
- declare const getSubTree: ({ key, parentUid, order, tree, }: {
3
- key: string;
4
- parentUid?: string | undefined;
5
- tree?: RoamBasicNode[] | undefined;
6
- order?: number | undefined;
7
- }) => RoamBasicNode;
8
- export default getSubTree;
1
+ import type { RoamBasicNode } from "../types/native";
2
+ declare const getSubTree: ({ key, parentUid, order, tree, }: {
3
+ key: string;
4
+ parentUid?: string | undefined;
5
+ tree?: RoamBasicNode[] | undefined;
6
+ order?: number | undefined;
7
+ }) => RoamBasicNode;
8
+ export default getSubTree;
@@ -1,20 +1,20 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const getBasicTreeByParentUid_1 = tslib_1.__importDefault(require("../queries/getBasicTreeByParentUid"));
5
- const createBlock_1 = tslib_1.__importDefault(require("../writes/createBlock"));
6
- const toFlexRegex_1 = tslib_1.__importDefault(require("./toFlexRegex"));
7
- const getSubTree = ({ key, parentUid, order = 0, tree = parentUid ? (0, getBasicTreeByParentUid_1.default)(parentUid) : [], }) => {
8
- const node = tree.find((s) => (0, toFlexRegex_1.default)(key).test(s.text.trim()));
9
- if (node)
10
- return node;
11
- const defaultNode = { text: "", children: [] };
12
- if (parentUid) {
13
- const uid = window.roamAlphaAPI.util.generateUID();
14
- (0, createBlock_1.default)({ node: { text: key, uid }, parentUid, order });
15
- return Object.assign({ uid }, defaultNode);
16
- }
17
- return Object.assign({ uid: "" }, defaultNode);
18
- };
19
- exports.default = getSubTree;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const getBasicTreeByParentUid_1 = tslib_1.__importDefault(require("../queries/getBasicTreeByParentUid"));
5
+ const createBlock_1 = tslib_1.__importDefault(require("../writes/createBlock"));
6
+ const toFlexRegex_1 = tslib_1.__importDefault(require("./toFlexRegex"));
7
+ const getSubTree = ({ key, parentUid, order = 0, tree = parentUid ? (0, getBasicTreeByParentUid_1.default)(parentUid) : [], }) => {
8
+ const node = tree.find((s) => (0, toFlexRegex_1.default)(key).test(s.text.trim()));
9
+ if (node)
10
+ return node;
11
+ const defaultNode = { text: "", children: [] };
12
+ if (parentUid) {
13
+ const uid = window.roamAlphaAPI.util.generateUID();
14
+ (0, createBlock_1.default)({ node: { text: key, uid }, parentUid, order });
15
+ return Object.assign({ uid }, defaultNode);
16
+ }
17
+ return Object.assign({ uid: "" }, defaultNode);
18
+ };
19
+ exports.default = getSubTree;
20
20
  //# sourceMappingURL=getSubTree.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getSubTree.js","sourceRoot":"","sources":["../../src/util/getSubTree.ts"],"names":[],"mappings":";;;AAAA,yGAAyE;AAEzE,gFAAgD;AAChD,wEAAwC;AAExC,MAAM,UAAU,GAAG,CAAC,EAClB,GAAG,EACH,SAAS,EACT,KAAK,GAAG,CAAC,EACT,IAAI,GAAG,SAAS,CAAC,CAAC,CAAC,IAAA,iCAAuB,EAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,GAM3D,EAAiB,EAAE;IAClB,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,qBAAW,EAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IACpE,IAAI,IAAI;QAAE,OAAO,IAAI,CAAC;IACtB,MAAM,WAAW,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;IAC/C,IAAI,SAAS,EAAE;QACb,MAAM,GAAG,GAAG,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;QACnD,IAAA,qBAAW,EAAC,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,CAAC;QAC5D,uBACE,GAAG,IACA,WAAW,EACd;KACH;IACD,uBAAS,GAAG,EAAE,EAAE,IAAK,WAAW,EAAG;AACrC,CAAC,CAAC;AAEF,kBAAe,UAAU,CAAC","sourcesContent":["import getBasicTreeByParentUid from \"../queries/getBasicTreeByParentUid\";\r\nimport type { RoamBasicNode } from \"../types/native\";\r\nimport createBlock from \"../writes/createBlock\";\r\nimport toFlexRegex from \"./toFlexRegex\";\r\n\r\nconst getSubTree = ({\r\n key,\r\n parentUid,\r\n order = 0,\r\n tree = parentUid ? getBasicTreeByParentUid(parentUid) : [],\r\n}: {\r\n key: string;\r\n parentUid?: string;\r\n tree?: RoamBasicNode[];\r\n order?: number;\r\n}): RoamBasicNode => {\r\n const node = tree.find((s) => toFlexRegex(key).test(s.text.trim()));\r\n if (node) return node;\r\n const defaultNode = { text: \"\", children: [] };\r\n if (parentUid) {\r\n const uid = window.roamAlphaAPI.util.generateUID();\r\n createBlock({ node: { text: key, uid }, parentUid, order });\r\n return {\r\n uid,\r\n ...defaultNode,\r\n };\r\n }\r\n return { uid: \"\", ...defaultNode };\r\n};\r\n\r\nexport default getSubTree;\r\n"]}
1
+ {"version":3,"file":"getSubTree.js","sourceRoot":"","sources":["../../src/util/getSubTree.ts"],"names":[],"mappings":";;;AAAA,yGAAyE;AAEzE,gFAAgD;AAChD,wEAAwC;AAExC,MAAM,UAAU,GAAG,CAAC,EAClB,GAAG,EACH,SAAS,EACT,KAAK,GAAG,CAAC,EACT,IAAI,GAAG,SAAS,CAAC,CAAC,CAAC,IAAA,iCAAuB,EAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,GAM3D,EAAiB,EAAE;IAClB,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,qBAAW,EAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IACpE,IAAI,IAAI;QAAE,OAAO,IAAI,CAAC;IACtB,MAAM,WAAW,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;IAC/C,IAAI,SAAS,EAAE;QACb,MAAM,GAAG,GAAG,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;QACnD,IAAA,qBAAW,EAAC,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,CAAC;QAC5D,uBACE,GAAG,IACA,WAAW,EACd;KACH;IACD,uBAAS,GAAG,EAAE,EAAE,IAAK,WAAW,EAAG;AACrC,CAAC,CAAC;AAEF,kBAAe,UAAU,CAAC","sourcesContent":["import getBasicTreeByParentUid from \"../queries/getBasicTreeByParentUid\";\nimport type { RoamBasicNode } from \"../types/native\";\nimport createBlock from \"../writes/createBlock\";\nimport toFlexRegex from \"./toFlexRegex\";\n\nconst getSubTree = ({\n key,\n parentUid,\n order = 0,\n tree = parentUid ? getBasicTreeByParentUid(parentUid) : [],\n}: {\n key: string;\n parentUid?: string;\n tree?: RoamBasicNode[];\n order?: number;\n}): RoamBasicNode => {\n const node = tree.find((s) => toFlexRegex(key).test(s.text.trim()));\n if (node) return node;\n const defaultNode = { text: \"\", children: [] };\n if (parentUid) {\n const uid = window.roamAlphaAPI.util.generateUID();\n createBlock({ node: { text: key, uid }, parentUid, order });\n return {\n uid,\n ...defaultNode,\n };\n }\n return { uid: \"\", ...defaultNode };\n};\n\nexport default getSubTree;\n"]}
@@ -1,2 +1,2 @@
1
- declare const getToken: (service?: string) => string;
2
- export default getToken;
1
+ declare const getToken: (service?: string) => string;
2
+ export default getToken;
package/util/getToken.js CHANGED
@@ -1,11 +1,11 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const getBasicTreeByParentUid_1 = tslib_1.__importDefault(require("../queries/getBasicTreeByParentUid"));
5
- const getPageUidByPageTitle_1 = tslib_1.__importDefault(require("../queries/getPageUidByPageTitle"));
6
- const getTokenFromTree_1 = tslib_1.__importDefault(require("./getTokenFromTree"));
7
- const localStorageGet_1 = tslib_1.__importDefault(require("./localStorageGet"));
8
- const getToken = (service = "roamjs") => (0, localStorageGet_1.default)(`token${service === "roamjs" ? "" : `-${service}`}`) ||
9
- (0, getTokenFromTree_1.default)((0, getBasicTreeByParentUid_1.default)((0, getPageUidByPageTitle_1.default)(`roam/js/${service}`)));
10
- exports.default = getToken;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const getBasicTreeByParentUid_1 = tslib_1.__importDefault(require("../queries/getBasicTreeByParentUid"));
5
+ const getPageUidByPageTitle_1 = tslib_1.__importDefault(require("../queries/getPageUidByPageTitle"));
6
+ const getTokenFromTree_1 = tslib_1.__importDefault(require("./getTokenFromTree"));
7
+ const localStorageGet_1 = tslib_1.__importDefault(require("./localStorageGet"));
8
+ const getToken = (service = "roamjs") => (0, localStorageGet_1.default)(`token${service === "roamjs" ? "" : `-${service}`}`) ||
9
+ (0, getTokenFromTree_1.default)((0, getBasicTreeByParentUid_1.default)((0, getPageUidByPageTitle_1.default)(`roam/js/${service}`)));
10
+ exports.default = getToken;
11
11
  //# sourceMappingURL=getToken.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getToken.js","sourceRoot":"","sources":["../../src/util/getToken.ts"],"names":[],"mappings":";;;AAAA,yGAAyE;AACzE,qGAAqE;AACrE,kFAAkD;AAClD,gFAAgD;AAEhD,MAAM,QAAQ,GAAG,CAAC,OAAO,GAAG,QAAQ,EAAU,EAAE,CAC9C,IAAA,yBAAe,EAAC,QAAQ,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,OAAO,EAAE,EAAE,CAAC;IACpE,IAAA,0BAAgB,EACd,IAAA,iCAAuB,EAAC,IAAA,+BAAqB,EAAC,WAAW,OAAO,EAAE,CAAC,CAAC,CACrE,CAAC;AAEJ,kBAAe,QAAQ,CAAC","sourcesContent":["import getBasicTreeByParentUid from \"../queries/getBasicTreeByParentUid\";\r\nimport getPageUidByPageTitle from \"../queries/getPageUidByPageTitle\";\r\nimport getTokenFromTree from \"./getTokenFromTree\";\r\nimport localStorageGet from \"./localStorageGet\";\r\n\r\nconst getToken = (service = \"roamjs\"): string =>\r\n localStorageGet(`token${service === \"roamjs\" ? \"\" : `-${service}`}`) ||\r\n getTokenFromTree(\r\n getBasicTreeByParentUid(getPageUidByPageTitle(`roam/js/${service}`))\r\n );\r\n\r\nexport default getToken;\r\n"]}
1
+ {"version":3,"file":"getToken.js","sourceRoot":"","sources":["../../src/util/getToken.ts"],"names":[],"mappings":";;;AAAA,yGAAyE;AACzE,qGAAqE;AACrE,kFAAkD;AAClD,gFAAgD;AAEhD,MAAM,QAAQ,GAAG,CAAC,OAAO,GAAG,QAAQ,EAAU,EAAE,CAC9C,IAAA,yBAAe,EAAC,QAAQ,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,OAAO,EAAE,EAAE,CAAC;IACpE,IAAA,0BAAgB,EACd,IAAA,iCAAuB,EAAC,IAAA,+BAAqB,EAAC,WAAW,OAAO,EAAE,CAAC,CAAC,CACrE,CAAC;AAEJ,kBAAe,QAAQ,CAAC","sourcesContent":["import getBasicTreeByParentUid from \"../queries/getBasicTreeByParentUid\";\nimport getPageUidByPageTitle from \"../queries/getPageUidByPageTitle\";\nimport getTokenFromTree from \"./getTokenFromTree\";\nimport localStorageGet from \"./localStorageGet\";\n\nconst getToken = (service = \"roamjs\"): string =>\n localStorageGet(`token${service === \"roamjs\" ? \"\" : `-${service}`}`) ||\n getTokenFromTree(\n getBasicTreeByParentUid(getPageUidByPageTitle(`roam/js/${service}`))\n );\n\nexport default getToken;\n"]}
@@ -1,3 +1,3 @@
1
- import type { RoamBasicNode } from "../types";
2
- declare const getTokenFromTree: (tree: RoamBasicNode[]) => string;
3
- export default getTokenFromTree;
1
+ import type { RoamBasicNode } from "../types";
2
+ declare const getTokenFromTree: (tree: RoamBasicNode[]) => string;
3
+ export default getTokenFromTree;
@@ -1,5 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const getTokenFromTree = (tree) => { var _a, _b, _c; return ((_c = (_b = (_a = tree.find((t) => /token/i.test(t.text))) === null || _a === void 0 ? void 0 : _a.children) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.text) || ""; };
4
- exports.default = getTokenFromTree;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const getTokenFromTree = (tree) => { var _a, _b, _c; return ((_c = (_b = (_a = tree.find((t) => /token/i.test(t.text))) === null || _a === void 0 ? void 0 : _a.children) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.text) || ""; };
4
+ exports.default = getTokenFromTree;
5
5
  //# sourceMappingURL=getTokenFromTree.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getTokenFromTree.js","sourceRoot":"","sources":["../../src/util/getTokenFromTree.ts"],"names":[],"mappings":";;AAEA,MAAM,gBAAgB,GAAG,CAAC,IAAqB,EAAU,EAAE,mBACzD,OAAA,CAAA,MAAA,MAAA,MAAA,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,0CAAE,QAAQ,0CAAG,CAAC,CAAC,0CAAE,IAAI,KAAI,EAAE,CAAA,EAAA,CAAC;AAErE,kBAAe,gBAAgB,CAAC","sourcesContent":["import type { RoamBasicNode } from \"../types\";\r\n\r\nconst getTokenFromTree = (tree: RoamBasicNode[]): string =>\r\n tree.find((t) => /token/i.test(t.text))?.children?.[0]?.text || \"\";\r\n\r\nexport default getTokenFromTree;\r\n"]}
1
+ {"version":3,"file":"getTokenFromTree.js","sourceRoot":"","sources":["../../src/util/getTokenFromTree.ts"],"names":[],"mappings":";;AAEA,MAAM,gBAAgB,GAAG,CAAC,IAAqB,EAAU,EAAE,mBACzD,OAAA,CAAA,MAAA,MAAA,MAAA,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,0CAAE,QAAQ,0CAAG,CAAC,CAAC,0CAAE,IAAI,KAAI,EAAE,CAAA,EAAA,CAAC;AAErE,kBAAe,gBAAgB,CAAC","sourcesContent":["import type { RoamBasicNode } from \"../types\";\n\nconst getTokenFromTree = (tree: RoamBasicNode[]): string =>\n tree.find((t) => /token/i.test(t.text))?.children?.[0]?.text || \"\";\n\nexport default getTokenFromTree;\n"]}
@@ -1,12 +1,12 @@
1
- declare const getWorkerClient: ({ name, onLoad, }: {
2
- name: string;
3
- onLoad?: (() => Promise<void>) | undefined;
4
- }) => {
5
- getWorker: () => Promise<Worker>;
6
- terminateWorker: () => void;
7
- initializeWorker: () => Promise<Worker | undefined>;
8
- listeners: {
9
- [name: string]: (a: unknown) => void;
10
- };
11
- };
12
- export default getWorkerClient;
1
+ declare const getWorkerClient: ({ name, onLoad, }: {
2
+ name: string;
3
+ onLoad?: (() => Promise<void>) | undefined;
4
+ }) => {
5
+ getWorker: () => Promise<Worker>;
6
+ terminateWorker: () => void;
7
+ initializeWorker: () => Promise<Worker | undefined>;
8
+ listeners: {
9
+ [name: string]: (a: unknown) => void;
10
+ };
11
+ };
12
+ export default getWorkerClient;
@@ -1,42 +1,42 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const getWorkerClient = ({ name, onLoad, }) => {
5
- const workerUrl = document.currentScript.src.replace(/\/main\.js$/, `/${name}.js`);
6
- const worker = {
7
- current: undefined,
8
- init: false,
9
- };
10
- const listeners = {};
11
- const initializeWorker = () => fetch(workerUrl)
12
- .then((r) => r.blob())
13
- .then((r) => {
14
- worker.current = new Worker(window.URL.createObjectURL(r));
15
- worker.current.onmessage = (e) => {
16
- var _a;
17
- const _b = e.data, { method } = _b, data = tslib_1.__rest(_b, ["method"]);
18
- (_a = listeners[method]) === null || _a === void 0 ? void 0 : _a.call(listeners, data);
19
- };
20
- return onLoad ? onLoad() : Promise.resolve();
21
- })
22
- .then(() => {
23
- worker.init = true;
24
- document.body.dispatchEvent(new Event(`roamjs:${name}-worker:init`));
25
- return worker.current;
26
- });
27
- const terminateWorker = () => {
28
- var _a;
29
- (_a = worker.current) === null || _a === void 0 ? void 0 : _a.terminate();
30
- };
31
- const getWorker = () => worker.current && worker.init
32
- ? Promise.resolve(worker.current)
33
- : new Promise((resolve) => document.body.addEventListener(`roamjs:${name}-worker:init`, () => worker.current && resolve(worker.current)));
34
- return {
35
- getWorker,
36
- terminateWorker,
37
- initializeWorker,
38
- listeners,
39
- };
40
- };
41
- exports.default = getWorkerClient;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const getWorkerClient = ({ name, onLoad, }) => {
5
+ const workerUrl = document.currentScript.src.replace(/\/main\.js$/, `/${name}.js`);
6
+ const worker = {
7
+ current: undefined,
8
+ init: false,
9
+ };
10
+ const listeners = {};
11
+ const initializeWorker = () => fetch(workerUrl)
12
+ .then((r) => r.blob())
13
+ .then((r) => {
14
+ worker.current = new Worker(window.URL.createObjectURL(r));
15
+ worker.current.onmessage = (e) => {
16
+ var _a;
17
+ const _b = e.data, { method } = _b, data = tslib_1.__rest(_b, ["method"]);
18
+ (_a = listeners[method]) === null || _a === void 0 ? void 0 : _a.call(listeners, data);
19
+ };
20
+ return onLoad ? onLoad() : Promise.resolve();
21
+ })
22
+ .then(() => {
23
+ worker.init = true;
24
+ document.body.dispatchEvent(new Event(`roamjs:${name}-worker:init`));
25
+ return worker.current;
26
+ });
27
+ const terminateWorker = () => {
28
+ var _a;
29
+ (_a = worker.current) === null || _a === void 0 ? void 0 : _a.terminate();
30
+ };
31
+ const getWorker = () => worker.current && worker.init
32
+ ? Promise.resolve(worker.current)
33
+ : new Promise((resolve) => document.body.addEventListener(`roamjs:${name}-worker:init`, () => worker.current && resolve(worker.current)));
34
+ return {
35
+ getWorker,
36
+ terminateWorker,
37
+ initializeWorker,
38
+ listeners,
39
+ };
40
+ };
41
+ exports.default = getWorkerClient;
42
42
  //# sourceMappingURL=getWorkerClient.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getWorkerClient.js","sourceRoot":"","sources":["../../src/util/getWorkerClient.ts"],"names":[],"mappings":";;;AAAA,MAAM,eAAe,GAAG,CAAC,EACvB,IAAI,EACJ,MAAM,GAIP,EAAE,EAAE;IACH,MAAM,SAAS,GAAI,QAAQ,CAAC,aAAmC,CAAC,GAAG,CAAC,OAAO,CACzE,aAAa,EACb,IAAI,IAAI,KAAK,CACd,CAAC;IAEF,MAAM,MAAM,GAAwC;QAClD,OAAO,EAAE,SAAS;QAClB,IAAI,EAAE,KAAK;KACZ,CAAC;IAEF,MAAM,SAAS,GAA6C,EAAE,CAAC;IAC/D,MAAM,gBAAgB,GAAG,GAAG,EAAE,CAC5B,KAAK,CAAC,SAAS,CAAC;SACb,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;SACrB,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE;QACV,MAAM,CAAC,OAAO,GAAG,IAAI,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC;QAC3D,MAAM,CAAC,OAAO,CAAC,SAAS,GAAG,CAAC,CAAC,EAAE,EAAE;;YAC/B,MAAM,KAAsB,CAAC,CAAC,IAAI,EAA5B,EAAE,MAAM,OAAoB,EAAf,IAAI,sBAAjB,UAAmB,CAAS,CAAC;YACnC,MAAA,SAAS,CAAC,MAAM,CAAC,0DAAG,IAAI,CAAC,CAAC;QAC5B,CAAC,CAAC;QACF,OAAO,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;IAC/C,CAAC,CAAC;SACD,IAAI,CAAC,GAAG,EAAE;QACT,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC;QACnB,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,KAAK,CAAC,UAAU,IAAI,cAAc,CAAC,CAAC,CAAC;QACrE,OAAO,MAAM,CAAC,OAAO,CAAC;IACxB,CAAC,CAAC,CAAC;IACP,MAAM,eAAe,GAAG,GAAG,EAAE;;QAC3B,MAAA,MAAM,CAAC,OAAO,0CAAE,SAAS,EAAE,CAAC;IAC9B,CAAC,CAAC;IACF,MAAM,SAAS,GAAG,GAAoB,EAAE,CACtC,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,IAAI;QAC3B,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC;QACjC,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CACtB,QAAQ,CAAC,IAAI,CAAC,gBAAgB,CAC5B,UAAU,IAAI,cAAc,EAC5B,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAChD,CACF,CAAC;IACR,OAAO;QACL,SAAS;QACT,eAAe;QACf,gBAAgB;QAChB,SAAS;KACV,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,eAAe,CAAC","sourcesContent":["const getWorkerClient = ({\r\n name,\r\n onLoad,\r\n}: {\r\n name: string;\r\n onLoad?: () => Promise<void>;\r\n}) => {\r\n const workerUrl = (document.currentScript as HTMLScriptElement).src.replace(\r\n /\\/main\\.js$/,\r\n `/${name}.js`\r\n );\r\n\r\n const worker: { current?: Worker; init: boolean } = {\r\n current: undefined,\r\n init: false,\r\n };\r\n\r\n const listeners: { [name: string]: (a: unknown) => void } = {};\r\n const initializeWorker = () =>\r\n fetch(workerUrl)\r\n .then((r) => r.blob())\r\n .then((r) => {\r\n worker.current = new Worker(window.URL.createObjectURL(r));\r\n worker.current.onmessage = (e) => {\r\n const { method, ...data } = e.data;\r\n listeners[method]?.(data);\r\n };\r\n return onLoad ? onLoad() : Promise.resolve();\r\n })\r\n .then(() => {\r\n worker.init = true;\r\n document.body.dispatchEvent(new Event(`roamjs:${name}-worker:init`));\r\n return worker.current;\r\n });\r\n const terminateWorker = () => {\r\n worker.current?.terminate();\r\n };\r\n const getWorker = (): Promise<Worker> =>\r\n worker.current && worker.init\r\n ? Promise.resolve(worker.current)\r\n : new Promise((resolve) =>\r\n document.body.addEventListener(\r\n `roamjs:${name}-worker:init`,\r\n () => worker.current && resolve(worker.current)\r\n )\r\n );\r\n return {\r\n getWorker,\r\n terminateWorker,\r\n initializeWorker,\r\n listeners,\r\n };\r\n};\r\n\r\nexport default getWorkerClient;\r\n"]}
1
+ {"version":3,"file":"getWorkerClient.js","sourceRoot":"","sources":["../../src/util/getWorkerClient.ts"],"names":[],"mappings":";;;AAAA,MAAM,eAAe,GAAG,CAAC,EACvB,IAAI,EACJ,MAAM,GAIP,EAAE,EAAE;IACH,MAAM,SAAS,GAAI,QAAQ,CAAC,aAAmC,CAAC,GAAG,CAAC,OAAO,CACzE,aAAa,EACb,IAAI,IAAI,KAAK,CACd,CAAC;IAEF,MAAM,MAAM,GAAwC;QAClD,OAAO,EAAE,SAAS;QAClB,IAAI,EAAE,KAAK;KACZ,CAAC;IAEF,MAAM,SAAS,GAA6C,EAAE,CAAC;IAC/D,MAAM,gBAAgB,GAAG,GAAG,EAAE,CAC5B,KAAK,CAAC,SAAS,CAAC;SACb,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;SACrB,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE;QACV,MAAM,CAAC,OAAO,GAAG,IAAI,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC;QAC3D,MAAM,CAAC,OAAO,CAAC,SAAS,GAAG,CAAC,CAAC,EAAE,EAAE;;YAC/B,MAAM,KAAsB,CAAC,CAAC,IAAI,EAA5B,EAAE,MAAM,OAAoB,EAAf,IAAI,sBAAjB,UAAmB,CAAS,CAAC;YACnC,MAAA,SAAS,CAAC,MAAM,CAAC,0DAAG,IAAI,CAAC,CAAC;QAC5B,CAAC,CAAC;QACF,OAAO,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;IAC/C,CAAC,CAAC;SACD,IAAI,CAAC,GAAG,EAAE;QACT,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC;QACnB,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,KAAK,CAAC,UAAU,IAAI,cAAc,CAAC,CAAC,CAAC;QACrE,OAAO,MAAM,CAAC,OAAO,CAAC;IACxB,CAAC,CAAC,CAAC;IACP,MAAM,eAAe,GAAG,GAAG,EAAE;;QAC3B,MAAA,MAAM,CAAC,OAAO,0CAAE,SAAS,EAAE,CAAC;IAC9B,CAAC,CAAC;IACF,MAAM,SAAS,GAAG,GAAoB,EAAE,CACtC,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,IAAI;QAC3B,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC;QACjC,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CACtB,QAAQ,CAAC,IAAI,CAAC,gBAAgB,CAC5B,UAAU,IAAI,cAAc,EAC5B,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAChD,CACF,CAAC;IACR,OAAO;QACL,SAAS;QACT,eAAe;QACf,gBAAgB;QAChB,SAAS;KACV,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,eAAe,CAAC","sourcesContent":["const getWorkerClient = ({\n name,\n onLoad,\n}: {\n name: string;\n onLoad?: () => Promise<void>;\n}) => {\n const workerUrl = (document.currentScript as HTMLScriptElement).src.replace(\n /\\/main\\.js$/,\n `/${name}.js`\n );\n\n const worker: { current?: Worker; init: boolean } = {\n current: undefined,\n init: false,\n };\n\n const listeners: { [name: string]: (a: unknown) => void } = {};\n const initializeWorker = () =>\n fetch(workerUrl)\n .then((r) => r.blob())\n .then((r) => {\n worker.current = new Worker(window.URL.createObjectURL(r));\n worker.current.onmessage = (e) => {\n const { method, ...data } = e.data;\n listeners[method]?.(data);\n };\n return onLoad ? onLoad() : Promise.resolve();\n })\n .then(() => {\n worker.init = true;\n document.body.dispatchEvent(new Event(`roamjs:${name}-worker:init`));\n return worker.current;\n });\n const terminateWorker = () => {\n worker.current?.terminate();\n };\n const getWorker = (): Promise<Worker> =>\n worker.current && worker.init\n ? Promise.resolve(worker.current)\n : new Promise((resolve) =>\n document.body.addEventListener(\n `roamjs:${name}-worker:init`,\n () => worker.current && resolve(worker.current)\n )\n );\n return {\n getWorker,\n terminateWorker,\n initializeWorker,\n listeners,\n };\n};\n\nexport default getWorkerClient;\n"]}
@@ -1,3 +1,3 @@
1
- import { HandleFetchArgs } from "./handleFetch";
2
- declare const handleBodyFetch: (method: "POST" | "PUT") => <T extends ArrayBuffer | Record<string, unknown> = Record<string, never>>(args: string | HandleFetchArgs, _data?: Record<string, unknown>) => Promise<T>;
3
- export default handleBodyFetch;
1
+ import { HandleFetchArgs } from "./handleFetch";
2
+ declare const handleBodyFetch: (method: "POST" | "PUT") => <T extends ArrayBuffer | Record<string, unknown> = Record<string, never>>(args: string | HandleFetchArgs, _data?: Record<string, unknown>) => Promise<T>;
3
+ export default handleBodyFetch;
@@ -1,22 +1,22 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const env_1 = require("./env");
5
- const handleFetch_1 = tslib_1.__importDefault(require("./handleFetch"));
6
- const handleBodyFetch = (method) => (args, _data) => {
7
- const _a = typeof args === "string" ? { path: args, data: _data } : args, { data } = _a, fetchArgs = tslib_1.__rest(_a, ["data"]);
8
- return (0, handleFetch_1.default)((url, init) => {
9
- const body = data instanceof Uint8Array
10
- ? data
11
- : (0, env_1.getNodeEnv)() === "development" &&
12
- /(localhost|roamjs)/.test(url.toString())
13
- ? JSON.stringify(Object.assign({ dev: true }, data))
14
- : JSON.stringify(data || {});
15
- return [
16
- url,
17
- Object.assign(Object.assign({}, init), { body, headers: Object.fromEntries(Object.entries(Object.assign({ "Content-Type": "application/json" }, init === null || init === void 0 ? void 0 : init.headers)).filter((h) => !!h[1])), method }),
18
- ];
19
- }, fetchArgs);
20
- };
21
- exports.default = handleBodyFetch;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const env_1 = require("./env");
5
+ const handleFetch_1 = tslib_1.__importDefault(require("./handleFetch"));
6
+ const handleBodyFetch = (method) => (args, _data) => {
7
+ const _a = typeof args === "string" ? { path: args, data: _data } : args, { data } = _a, fetchArgs = tslib_1.__rest(_a, ["data"]);
8
+ return (0, handleFetch_1.default)((url, init) => {
9
+ const body = data instanceof Uint8Array
10
+ ? data
11
+ : (0, env_1.getNodeEnv)() === "development" &&
12
+ /(localhost|roamjs)/.test(url.toString())
13
+ ? JSON.stringify(Object.assign({ dev: true }, data))
14
+ : JSON.stringify(data || {});
15
+ return [
16
+ url,
17
+ Object.assign(Object.assign({}, init), { body, headers: Object.fromEntries(Object.entries(Object.assign({ "Content-Type": "application/json" }, init === null || init === void 0 ? void 0 : init.headers)).filter((h) => !!h[1])), method }),
18
+ ];
19
+ }, fetchArgs);
20
+ };
21
+ exports.default = handleBodyFetch;
22
22
  //# sourceMappingURL=handleBodyFetch.js.map