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.
- package/LICENSE +21 -21
- package/README.md +29 -29
- package/components/AutocompleteInput.d.ts +28 -28
- package/components/AutocompleteInput.js +120 -120
- package/components/BlockErrorBoundary.d.ts +15 -15
- package/components/BlockErrorBoundary.js +27 -27
- package/components/BlockInput.d.ts +13 -13
- package/components/BlockInput.js +55 -55
- package/components/ComponentContainer.d.ts +10 -10
- package/components/ComponentContainer.js +37 -37
- package/components/ConfigPage.d.ts +35 -35
- package/components/ConfigPage.js +159 -159
- package/components/ConfigPanels/BlockPanel.d.ts +3 -3
- package/components/ConfigPanels/BlockPanel.js +42 -42
- package/components/ConfigPanels/BlocksPanel.d.ts +3 -3
- package/components/ConfigPanels/BlocksPanel.js +58 -58
- package/components/ConfigPanels/CustomPanel.d.ts +3 -3
- package/components/ConfigPanels/CustomPanel.js +24 -24
- package/components/ConfigPanels/FlagPanel.d.ts +3 -3
- package/components/ConfigPanels/FlagPanel.js +31 -31
- package/components/ConfigPanels/MultiChildPanel.d.ts +9 -9
- package/components/ConfigPanels/MultiChildPanel.js +58 -58
- package/components/ConfigPanels/MultiTextPanel.d.ts +3 -3
- package/components/ConfigPanels/MultiTextPanel.js +14 -14
- package/components/ConfigPanels/NumberPanel.d.ts +3 -3
- package/components/ConfigPanels/NumberPanel.js +25 -25
- package/components/ConfigPanels/OauthPanel.d.ts +3 -3
- package/components/ConfigPanels/OauthPanel.js +81 -81
- package/components/ConfigPanels/PagesPanel.d.ts +3 -3
- package/components/ConfigPanels/PagesPanel.js +11 -11
- package/components/ConfigPanels/SelectPanel.d.ts +3 -3
- package/components/ConfigPanels/SelectPanel.js +27 -27
- package/components/ConfigPanels/TextPanel.d.ts +3 -3
- package/components/ConfigPanels/TextPanel.js +28 -28
- package/components/ConfigPanels/TimePanel.d.ts +3 -3
- package/components/ConfigPanels/TimePanel.js +34 -34
- package/components/ConfigPanels/getBrandColors.d.ts +7 -7
- package/components/ConfigPanels/getBrandColors.js +28 -28
- package/components/ConfigPanels/types.d.ts +84 -84
- package/components/ConfigPanels/types.js +2 -2
- package/components/ConfigPanels/types.js.map +1 -1
- package/components/ConfigPanels/useSingleChildValue.d.ts +13 -13
- package/components/ConfigPanels/useSingleChildValue.js +43 -43
- package/components/CursorMenu.d.ts +21 -21
- package/components/CursorMenu.js +181 -181
- package/components/Description.d.ts +5 -5
- package/components/Description.js +16 -16
- package/components/ExtensionApiContext.d.ts +31 -31
- package/components/ExtensionApiContext.js +16 -16
- package/components/ExternalLogin.d.ts +18 -18
- package/components/ExternalLogin.js +141 -141
- package/components/Filter.d.ts +15 -15
- package/components/Filter.js +142 -142
- package/components/FormDialog.d.ts +55 -55
- package/components/FormDialog.js +217 -217
- package/components/FormDialog.js.map +1 -1
- package/components/Loading.d.ts +4 -4
- package/components/Loading.js +35 -35
- package/components/MenuItemSelect.d.ts +17 -17
- package/components/MenuItemSelect.js +23 -23
- package/components/OauthPanel.d.ts +7 -7
- package/components/OauthPanel.js +30 -30
- package/components/OauthSelect.d.ts +5 -5
- package/components/OauthSelect.js +25 -25
- package/components/PageInput.d.ts +6 -6
- package/components/PageInput.js +13 -13
- package/components/PageLink.d.ts +6 -6
- package/components/PageLink.js +31 -31
- package/components/ProgressDialog.d.ts +11 -11
- package/components/ProgressDialog.js +48 -48
- package/components/SimpleAlert.d.ts +15 -15
- package/components/SimpleAlert.js +47 -47
- package/components/Toast.d.ts +15 -15
- package/components/Toast.js +50 -50
- package/components/index.js +4 -4
- package/components/index.js.map +1 -1
- package/components.d.ts +5 -5
- package/components.js +170 -170
- package/date/constants.d.ts +3 -3
- package/date/constants.js +19 -19
- package/date/constants.js.map +1 -1
- package/date/index.d.ts +3 -3
- package/date/index.js +9 -9
- package/date/index.js.map +1 -1
- package/date/parseNlpDate.d.ts +5 -5
- package/date/parseNlpDate.js +226 -226
- package/date/parseNlpDate.js.map +1 -1
- package/date/parseRoamDateUid.d.ts +2 -2
- package/date/parseRoamDateUid.js +7 -7
- package/date/parseRoamDateUid.js.map +1 -1
- package/dom/addBlockCommand.d.ts +5 -5
- package/dom/addBlockCommand.js +53 -53
- package/dom/addBlockCommand.js.map +1 -1
- package/dom/addKeyboardTriggers.d.ts +11 -11
- package/dom/addKeyboardTriggers.js +38 -38
- package/dom/addKeyboardTriggers.js.map +1 -1
- package/dom/addOldRoamJSDependency.d.ts +2 -2
- package/dom/addOldRoamJSDependency.js +10 -10
- package/dom/addOldRoamJSDependency.js.map +1 -1
- package/dom/addRoamJSDependency.d.ts +2 -2
- package/dom/addRoamJSDependency.js +8 -8
- package/dom/addRoamJSDependency.js.map +1 -1
- package/dom/addScriptAsDependency.d.ts +6 -6
- package/dom/addScriptAsDependency.js +16 -16
- package/dom/addScriptAsDependency.js.map +1 -1
- package/dom/addStyle.d.ts +2 -2
- package/dom/addStyle.js +14 -14
- package/dom/addStyle.js.map +1 -1
- package/dom/constants.d.ts +1 -1
- package/dom/constants.js +4 -4
- package/dom/constants.js.map +1 -1
- package/dom/createBlockObserver.d.ts +7 -7
- package/dom/createBlockObserver.js +43 -43
- package/dom/createBlockObserver.js.map +1 -1
- package/dom/createButtonObserver.d.ts +6 -6
- package/dom/createButtonObserver.js +21 -21
- package/dom/createButtonObserver.js.map +1 -1
- package/dom/createDivObserver.d.ts +2 -2
- package/dom/createDivObserver.js +13 -13
- package/dom/createDivObserver.js.map +1 -1
- package/dom/createHTMLObserver.d.ts +8 -8
- package/dom/createHTMLObserver.js +24 -24
- package/dom/createHTMLObserver.js.map +1 -1
- package/dom/createHashtagObserver.d.ts +5 -5
- package/dom/createHashtagObserver.js +16 -16
- package/dom/createHashtagObserver.js.map +1 -1
- package/dom/createIconButton.d.ts +2 -2
- package/dom/createIconButton.js +12 -12
- package/dom/createIconButton.js.map +1 -1
- package/dom/createObserver.d.ts +2 -2
- package/dom/createObserver.js +9 -9
- package/dom/createObserver.js.map +1 -1
- package/dom/createOverlayObserver.d.ts +2 -2
- package/dom/createOverlayObserver.js +6 -6
- package/dom/createOverlayObserver.js.map +1 -1
- package/dom/createPageObserver.d.ts +2 -2
- package/dom/createPageObserver.js +34 -34
- package/dom/createPageObserver.js.map +1 -1
- package/dom/createPageTitleObserver.d.ts +6 -6
- package/dom/createPageTitleObserver.js +31 -31
- package/dom/createPageTitleObserver.js.map +1 -1
- package/dom/elToTitle.d.ts +2 -2
- package/dom/elToTitle.js +22 -22
- package/dom/elToTitle.js.map +1 -1
- package/dom/genericError.d.ts +3 -3
- package/dom/genericError.js +11 -11
- package/dom/genericError.js.map +1 -1
- package/dom/getActiveUids.d.ts +3 -3
- package/dom/getActiveUids.js +6 -6
- package/dom/getActiveUids.js.map +1 -1
- package/dom/getBlockUidFromTarget.d.ts +2 -2
- package/dom/getBlockUidFromTarget.js +33 -33
- package/dom/getBlockUidFromTarget.js.map +1 -1
- package/dom/getCurrentPageUid.d.ts +2 -2
- package/dom/getCurrentPageUid.js +8 -8
- package/dom/getCurrentPageUid.js.map +1 -1
- package/dom/getDomRefs.d.ts +2 -2
- package/dom/getDomRefs.js +12 -12
- package/dom/getDomRefs.js.map +1 -1
- package/dom/getDropUidOffset.d.ts +5 -5
- package/dom/getDropUidOffset.js +27 -27
- package/dom/getDropUidOffset.js.map +1 -1
- package/dom/getMutatedNodes.d.ts +7 -7
- package/dom/getMutatedNodes.js +11 -11
- package/dom/getMutatedNodes.js.map +1 -1
- package/dom/getPageTitleByHtmlElement.d.ts +2 -2
- package/dom/getPageTitleByHtmlElement.js +12 -12
- package/dom/getPageTitleByHtmlElement.js.map +1 -1
- package/dom/getPageTitleValueByHtmlElement.d.ts +2 -2
- package/dom/getPageTitleValueByHtmlElement.js +9 -9
- package/dom/getPageTitleValueByHtmlElement.js.map +1 -1
- package/dom/getReferenceBlockUid.d.ts +2 -2
- package/dom/getReferenceBlockUid.js +18 -18
- package/dom/getReferenceBlockUid.js.map +1 -1
- package/dom/getRoamUrl.d.ts +2 -2
- package/dom/getRoamUrl.js +4 -4
- package/dom/getRoamUrl.js.map +1 -1
- package/dom/getRoamUrlByPage.d.ts +2 -2
- package/dom/getRoamUrlByPage.js +10 -10
- package/dom/getRoamUrlByPage.js.map +1 -1
- package/dom/getUids.d.ts +3 -3
- package/dom/getUids.js +8 -8
- package/dom/getUids.js.map +1 -1
- package/dom/getUidsFromButton.d.ts +3 -3
- package/dom/getUidsFromButton.js +8 -8
- package/dom/getUidsFromButton.js.map +1 -1
- package/dom/getUidsFromId.d.ts +5 -5
- package/dom/getUidsFromId.js +15 -15
- package/dom/getUidsFromId.js.map +1 -1
- package/dom/index.d.ts +30 -30
- package/dom/index.js +63 -63
- package/dom/index.js.map +1 -1
- package/dom/parseRoamBlocksToHtml.d.ts +11 -11
- package/dom/parseRoamBlocksToHtml.js +79 -79
- package/dom/parseRoamBlocksToHtml.js.map +1 -1
- package/dom/resolveRefs.d.ts +2 -2
- package/dom/resolveRefs.js +24 -24
- package/dom/resolveRefs.js.map +1 -1
- package/events/index.d.ts +1 -1
- package/events/index.js +8 -8
- package/events/index.js.map +1 -1
- package/events/watchOnce.d.ts +3 -3
- package/events/watchOnce.js +12 -12
- package/events/watchOnce.js.map +1 -1
- package/hooks/index.d.ts +2 -2
- package/hooks/index.js +10 -10
- package/hooks/index.js.map +1 -1
- package/hooks/useArrowKeyDown.d.ts +10 -10
- package/hooks/useArrowKeyDown.js +54 -54
- package/hooks/useArrowKeyDown.js.map +1 -1
- package/hooks/useSubTree.d.ts +3 -3
- package/hooks/useSubTree.js +11 -11
- package/hooks/useSubTree.js.map +1 -1
- package/marked/index.d.ts +25 -25
- package/marked/index.js +567 -567
- package/marked/index.js.map +1 -1
- package/package.json +116 -116
- package/queries/compileDatalog.d.ts +3 -3
- package/queries/compileDatalog.js +63 -63
- package/queries/compileDatalog.js.map +1 -1
- package/queries/getAllBlockUids.d.ts +2 -2
- package/queries/getAllBlockUids.js +6 -6
- package/queries/getAllBlockUids.js.map +1 -1
- package/queries/getAllBlockUidsAndTexts.d.ts +5 -5
- package/queries/getAllBlockUidsAndTexts.js +6 -6
- package/queries/getAllBlockUidsAndTexts.js.map +1 -1
- package/queries/getAllPageNames.d.ts +2 -2
- package/queries/getAllPageNames.js +6 -6
- package/queries/getAllPageNames.js.map +1 -1
- package/queries/getAttributeValueByBlockAndName.d.ts +5 -5
- package/queries/getAttributeValueByBlockAndName.js +11 -11
- package/queries/getAttributeValueByBlockAndName.js.map +1 -1
- package/queries/getBasicTreeByParentUid.d.ts +3 -3
- package/queries/getBasicTreeByParentUid.js +13 -13
- package/queries/getBasicTreeByParentUid.js.map +1 -1
- package/queries/getBlockUidAndTextIncludingText.d.ts +5 -5
- package/queries/getBlockUidAndTextIncludingText.js +7 -7
- package/queries/getBlockUidAndTextIncludingText.js.map +1 -1
- package/queries/getBlockUidByTextOnPage.d.ts +5 -5
- package/queries/getBlockUidByTextOnPage.js +7 -7
- package/queries/getBlockUidByTextOnPage.js.map +1 -1
- package/queries/getBlockUidsAndTextsReferencingPage.d.ts +5 -5
- package/queries/getBlockUidsAndTextsReferencingPage.js +9 -9
- package/queries/getBlockUidsAndTextsReferencingPage.js.map +1 -1
- package/queries/getBlockUidsByPageTitle.d.ts +2 -2
- package/queries/getBlockUidsByPageTitle.js +8 -8
- package/queries/getBlockUidsByPageTitle.js.map +1 -1
- package/queries/getBlockUidsReferencingBlock.d.ts +2 -2
- package/queries/getBlockUidsReferencingBlock.js +4 -4
- package/queries/getBlockUidsReferencingBlock.js.map +1 -1
- package/queries/getBlockUidsReferencingPage.d.ts +2 -2
- package/queries/getBlockUidsReferencingPage.js +6 -6
- package/queries/getBlockUidsReferencingPage.js.map +1 -1
- package/queries/getBlockUidsWithParentUid.d.ts +2 -2
- package/queries/getBlockUidsWithParentUid.js +6 -6
- package/queries/getBlockUidsWithParentUid.js.map +1 -1
- package/queries/getChildrenLengthByPageUid.d.ts +2 -2
- package/queries/getChildrenLengthByPageUid.js +8 -8
- package/queries/getChildrenLengthByPageUid.js.map +1 -1
- package/queries/getChildrenLengthByParentUid.d.ts +2 -2
- package/queries/getChildrenLengthByParentUid.js +7 -7
- package/queries/getChildrenLengthByParentUid.js.map +1 -1
- package/queries/getCreateTimeByBlockUid.d.ts +2 -2
- package/queries/getCreateTimeByBlockUid.js +7 -7
- package/queries/getCreateTimeByBlockUid.js.map +1 -1
- package/queries/getCurrentUser.d.ts +2 -2
- package/queries/getCurrentUser.js +11 -11
- package/queries/getCurrentUser.js.map +1 -1
- package/queries/getCurrentUserDisplayName.d.ts +2 -2
- package/queries/getCurrentUserDisplayName.js +10 -10
- package/queries/getCurrentUserDisplayName.js.map +1 -1
- package/queries/getCurrentUserEmail.d.ts +2 -2
- package/queries/getCurrentUserEmail.js +13 -13
- package/queries/getCurrentUserEmail.js.map +1 -1
- package/queries/getCurrentUserUid.d.ts +2 -2
- package/queries/getCurrentUserUid.js +13 -13
- package/queries/getCurrentUserUid.js.map +1 -1
- package/queries/getDisplayNameByEmail.d.ts +2 -2
- package/queries/getDisplayNameByEmail.js +7 -7
- package/queries/getDisplayNameByEmail.js.map +1 -1
- package/queries/getDisplayNameByUid.d.ts +2 -2
- package/queries/getDisplayNameByUid.js +7 -7
- package/queries/getDisplayNameByUid.js.map +1 -1
- package/queries/getEditTimeByBlockUid.d.ts +2 -2
- package/queries/getEditTimeByBlockUid.js +7 -7
- package/queries/getEditTimeByBlockUid.js.map +1 -1
- package/queries/getEditedUserEmailByBlockUid.d.ts +2 -2
- package/queries/getEditedUserEmailByBlockUid.js +7 -7
- package/queries/getEditedUserEmailByBlockUid.js.map +1 -1
- package/queries/getFirstChildTextByBlockUid.d.ts +2 -2
- package/queries/getFirstChildTextByBlockUid.js +7 -7
- package/queries/getFirstChildTextByBlockUid.js.map +1 -1
- package/queries/getFirstChildUidByBlockUid.d.ts +2 -2
- package/queries/getFirstChildUidByBlockUid.js +6 -6
- package/queries/getFirstChildUidByBlockUid.js.map +1 -1
- package/queries/getFullTreeByParentUid.d.ts +3 -3
- package/queries/getFullTreeByParentUid.js +51 -51
- package/queries/getFullTreeByParentUid.js.map +1 -1
- package/queries/getLinkedPageTitlesUnderUid.d.ts +2 -2
- package/queries/getLinkedPageTitlesUnderUid.js +6 -6
- package/queries/getLinkedPageTitlesUnderUid.js.map +1 -1
- package/queries/getNthChildUidByBlockUid.d.ts +5 -5
- package/queries/getNthChildUidByBlockUid.js +7 -7
- package/queries/getNthChildUidByBlockUid.js.map +1 -1
- package/queries/getOrderByBlockUid.d.ts +2 -2
- package/queries/getOrderByBlockUid.js +7 -7
- package/queries/getOrderByBlockUid.js.map +1 -1
- package/queries/getPageTitleByBlockUid.d.ts +2 -2
- package/queries/getPageTitleByBlockUid.js +7 -7
- package/queries/getPageTitleByBlockUid.js.map +1 -1
- package/queries/getPageTitleByPageUid.d.ts +2 -2
- package/queries/getPageTitleByPageUid.js +12 -12
- package/queries/getPageTitleByPageUid.js.map +1 -1
- package/queries/getPageTitleReferencesByPageTitle.d.ts +2 -2
- package/queries/getPageTitleReferencesByPageTitle.js +6 -6
- package/queries/getPageTitleReferencesByPageTitle.js.map +1 -1
- package/queries/getPageTitlesAndBlockUidsReferencingPage.d.ts +5 -5
- package/queries/getPageTitlesAndBlockUidsReferencingPage.js +9 -9
- package/queries/getPageTitlesAndBlockUidsReferencingPage.js.map +1 -1
- package/queries/getPageTitlesAndUidsDirectlyReferencingPage.d.ts +5 -5
- package/queries/getPageTitlesAndUidsDirectlyReferencingPage.js +9 -9
- package/queries/getPageTitlesAndUidsDirectlyReferencingPage.js.map +1 -1
- package/queries/getPageTitlesReferencingBlockUid.d.ts +2 -2
- package/queries/getPageTitlesReferencingBlockUid.js +4 -4
- package/queries/getPageTitlesReferencingBlockUid.js.map +1 -1
- package/queries/getPageTitlesStartingWithPrefix.d.ts +2 -2
- package/queries/getPageTitlesStartingWithPrefix.js +6 -6
- package/queries/getPageTitlesStartingWithPrefix.js.map +1 -1
- package/queries/getPageUidByBlockUid.d.ts +2 -2
- package/queries/getPageUidByBlockUid.js +7 -7
- package/queries/getPageUidByBlockUid.js.map +1 -1
- package/queries/getPageUidByPageTitle.d.ts +2 -2
- package/queries/getPageUidByPageTitle.js +9 -9
- package/queries/getPageUidByPageTitle.js.map +1 -1
- package/queries/getPageViewType.d.ts +3 -3
- package/queries/getPageViewType.js +9 -9
- package/queries/getPageViewType.js.map +1 -1
- package/queries/getParentTextByBlockUid.d.ts +2 -2
- package/queries/getParentTextByBlockUid.js +7 -7
- package/queries/getParentTextByBlockUid.js.map +1 -1
- package/queries/getParentTextByBlockUidAndTag.d.ts +5 -5
- package/queries/getParentTextByBlockUidAndTag.js +7 -7
- package/queries/getParentTextByBlockUidAndTag.js.map +1 -1
- package/queries/getParentUidByBlockUid.d.ts +2 -2
- package/queries/getParentUidByBlockUid.js +7 -7
- package/queries/getParentUidByBlockUid.js.map +1 -1
- package/queries/getParentUidsOfBlockUid.d.ts +2 -2
- package/queries/getParentUidsOfBlockUid.js +4 -4
- package/queries/getParentUidsOfBlockUid.js.map +1 -1
- package/queries/getSettingsByEmail.d.ts +3 -3
- package/queries/getSettingsByEmail.js +7 -7
- package/queries/getSettingsByEmail.js.map +1 -1
- package/queries/getShallowTreeByParentUid.d.ts +5 -5
- package/queries/getShallowTreeByParentUid.js +9 -9
- package/queries/getShallowTreeByParentUid.js.map +1 -1
- package/queries/getTextByBlockUid.d.ts +2 -2
- package/queries/getTextByBlockUid.js +9 -9
- package/queries/getTextByBlockUid.js.map +1 -1
- package/queries/index.js +4 -4
- package/queries/index.js.map +1 -1
- package/queries/isLiveBlock.d.ts +2 -2
- package/queries/isLiveBlock.js +4 -4
- package/queries/isLiveBlock.js.map +1 -1
- package/queries/isTagOnPage.d.ts +5 -5
- package/queries/isTagOnPage.js +9 -9
- package/queries/isTagOnPage.js.map +1 -1
- package/queries/normalizePageTitle.d.ts +2 -2
- package/queries/normalizePageTitle.js +4 -4
- package/queries/normalizePageTitle.js.map +1 -1
- package/scripts/index.d.ts +1 -1
- package/scripts/index.js +26 -26
- package/scripts/index.js.map +1 -1
- package/scripts/publishToRoamDepot.d.ts +7 -7
- package/scripts/publishToRoamDepot.js +113 -113
- package/scripts/publishToRoamDepot.js.map +1 -1
- package/testing/mockRoamEnvironment.d.ts +2 -2
- package/testing/mockRoamEnvironment.js +1253 -1253
- package/testing/mockRoamEnvironment.js.map +1 -1
- package/types/index.d.ts +389 -250
- package/types/index.js +4 -4
- package/types/index.js.map +1 -1
- package/types/native.d.ts +405 -402
- package/types/native.js +4 -4
- package/types/native.js.map +1 -1
- package/types/query-builder.d.ts +10 -10
- package/types/query-builder.js +2 -2
- package/types/query-builder.js.map +1 -1
- package/types/smartblocks.d.ts +35 -35
- package/types/smartblocks.js +2 -2
- package/types/smartblocks.js.map +1 -1
- package/util/addInputSetting.d.ts +7 -7
- package/util/addInputSetting.js +25 -25
- package/util/addInputSetting.js.map +1 -1
- package/util/apiDelete.d.ts +2 -2
- package/util/apiDelete.js +6 -6
- package/util/apiDelete.js.map +1 -1
- package/util/apiGet.d.ts +2 -2
- package/util/apiGet.js +6 -6
- package/util/apiGet.js.map +1 -1
- package/util/apiPost.d.ts +2 -2
- package/util/apiPost.js +6 -6
- package/util/apiPost.js.map +1 -1
- package/util/apiPut.d.ts +2 -2
- package/util/apiPut.js +6 -6
- package/util/apiPut.js.map +1 -1
- package/util/createOverlayRender.d.ts +4 -4
- package/util/createOverlayRender.js +6 -6
- package/util/createOverlayRender.js.map +1 -1
- package/util/createTagRegex.d.ts +2 -2
- package/util/createTagRegex.js +7 -7
- package/util/createTagRegex.js.map +1 -1
- package/util/dispatchToRegistry.d.ts +3 -3
- package/util/dispatchToRegistry.js +7 -7
- package/util/dispatchToRegistry.js.map +1 -1
- package/util/env.d.ts +4 -4
- package/util/env.js +47 -47
- package/util/env.js.map +1 -1
- package/util/extensionApiContext.d.ts +29 -29
- package/util/extensionApiContext.js +17 -17
- package/util/extensionApiContext.js.map +1 -1
- package/util/extensionDeprecatedWarning.d.ts +5 -5
- package/util/extensionDeprecatedWarning.js +39 -39
- package/util/extensionDeprecatedWarning.js.map +1 -1
- package/util/extractRef.d.ts +2 -2
- package/util/extractRef.js +8 -8
- package/util/extractRef.js.map +1 -1
- package/util/extractTag.d.ts +2 -2
- package/util/extractTag.js +15 -15
- package/util/extractTag.js.map +1 -1
- package/util/focusMainWindowBlock.d.ts +2 -2
- package/util/focusMainWindowBlock.js +12 -12
- package/util/focusMainWindowBlock.js.map +1 -1
- package/util/getAuthorizationHeader.d.ts +2 -2
- package/util/getAuthorizationHeader.js +12 -12
- package/util/getAuthorizationHeader.js.map +1 -1
- package/util/getLocalStorageKey.d.ts +2 -2
- package/util/getLocalStorageKey.js +4 -4
- package/util/getLocalStorageKey.js.map +1 -1
- package/util/getOauth.d.ts +2 -2
- package/util/getOauth.js +52 -52
- package/util/getOauth.js.map +1 -1
- package/util/getOauthAccounts.d.ts +2 -2
- package/util/getOauthAccounts.js +22 -22
- package/util/getOauthAccounts.js.map +1 -1
- package/util/getRenderRoot.d.ts +2 -2
- package/util/getRenderRoot.js +18 -18
- package/util/getRenderRoot.js.map +1 -1
- package/util/getSettingIntFromTree.d.ts +7 -7
- package/util/getSettingIntFromTree.js +11 -11
- package/util/getSettingIntFromTree.js.map +1 -1
- package/util/getSettingValueFromTree.d.ts +8 -8
- package/util/getSettingValueFromTree.js +14 -14
- package/util/getSettingValueFromTree.js.map +1 -1
- package/util/getSettingValuesFromTree.d.ts +7 -7
- package/util/getSettingValuesFromTree.js +12 -12
- package/util/getSettingValuesFromTree.js.map +1 -1
- package/util/getSubTree.d.ts +8 -8
- package/util/getSubTree.js +19 -19
- package/util/getSubTree.js.map +1 -1
- package/util/getToken.d.ts +2 -2
- package/util/getToken.js +10 -10
- package/util/getToken.js.map +1 -1
- package/util/getTokenFromTree.d.ts +3 -3
- package/util/getTokenFromTree.js +4 -4
- package/util/getTokenFromTree.js.map +1 -1
- package/util/getWorkerClient.d.ts +12 -12
- package/util/getWorkerClient.js +41 -41
- package/util/getWorkerClient.js.map +1 -1
- package/util/handleBodyFetch.d.ts +3 -3
- package/util/handleBodyFetch.js +21 -21
- package/util/handleBodyFetch.js.map +1 -1
- package/util/handleFetch.d.ts +13 -13
- package/util/handleFetch.js +40 -40
- package/util/handleFetch.js.map +1 -1
- package/util/handleUrlFetch.d.ts +3 -3
- package/util/handleUrlFetch.js +19 -19
- package/util/handleUrlFetch.js.map +1 -1
- package/util/idToTitle.d.ts +2 -2
- package/util/idToTitle.js +8 -8
- package/util/idToTitle.js.map +1 -1
- package/util/index.d.ts +24 -24
- package/util/index.js +54 -54
- package/util/index.js.map +1 -1
- package/util/isControl.d.ts +2 -2
- package/util/isControl.js +4 -4
- package/util/isControl.js.map +1 -1
- package/util/localStorageGet.d.ts +2 -2
- package/util/localStorageGet.js +8 -8
- package/util/localStorageGet.js.map +1 -1
- package/util/localStorageRemove.d.ts +2 -2
- package/util/localStorageRemove.js +6 -6
- package/util/localStorageRemove.js.map +1 -1
- package/util/localStorageSet.d.ts +2 -2
- package/util/localStorageSet.js +8 -8
- package/util/localStorageSet.js.map +1 -1
- package/util/registerExperimentalMode.d.ts +6 -6
- package/util/registerExperimentalMode.js +65 -65
- package/util/registerExperimentalMode.js.map +1 -1
- package/util/registerSmartBlocksCommand.d.ts +3 -3
- package/util/registerSmartBlocksCommand.js +23 -23
- package/util/registerSmartBlocksCommand.js.map +1 -1
- package/util/removeFromRegistry.d.ts +3 -3
- package/util/removeFromRegistry.js +7 -7
- package/util/removeFromRegistry.js.map +1 -1
- package/util/renderOverlay.d.ts +12 -12
- package/util/renderOverlay.js +48 -48
- package/util/renderOverlay.js.map +1 -1
- package/util/renderWithUnmount.d.ts +4 -4
- package/util/renderWithUnmount.js +44 -44
- package/util/renderWithUnmount.js.map +1 -1
- package/util/runExtension.d.ts +11 -11
- package/util/runExtension.js +174 -174
- package/util/runExtension.js.map +1 -1
- package/util/setInputSetting.d.ts +7 -7
- package/util/setInputSetting.js +37 -37
- package/util/setInputSetting.js.map +1 -1
- package/util/setInputSettings.d.ts +7 -7
- package/util/setInputSettings.js +28 -28
- package/util/setInputSettings.js.map +1 -1
- package/util/stripUid.d.ts +3 -3
- package/util/stripUid.js +10 -10
- package/util/stripUid.js.map +1 -1
- package/util/toConfigPageName.d.ts +2 -2
- package/util/toConfigPageName.js +4 -4
- package/util/toConfigPageName.js.map +1 -1
- package/util/toFlexRegex.d.ts +2 -2
- package/util/toFlexRegex.js +4 -4
- package/util/toFlexRegex.js.map +1 -1
- package/writes/clearBlockById.d.ts +2 -2
- package/writes/clearBlockById.js +17 -17
- package/writes/clearBlockById.js.map +1 -1
- package/writes/clearBlockByUid.d.ts +2 -2
- package/writes/clearBlockByUid.js +16 -16
- package/writes/clearBlockByUid.js.map +1 -1
- package/writes/createBlock.d.ts +8 -8
- package/writes/createBlock.js +28 -28
- package/writes/createBlock.js.map +1 -1
- package/writes/createPage.d.ts +7 -7
- package/writes/createPage.js +20 -20
- package/writes/createPage.js.map +1 -1
- package/writes/deleteBlock.d.ts +2 -2
- package/writes/deleteBlock.js +10 -10
- package/writes/deleteBlock.js.map +1 -1
- package/writes/index.d.ts +8 -8
- package/writes/index.js +22 -22
- package/writes/index.js.map +1 -1
- package/writes/openBlockInSidebar.d.ts +2 -2
- package/writes/openBlockInSidebar.js +13 -13
- package/writes/openBlockInSidebar.js.map +1 -1
- package/writes/submitActions.d.ts +8 -8
- package/writes/submitActions.js +36 -36
- package/writes/submitActions.js.map +1 -1
- package/writes/updateActiveBlock.d.ts +2 -2
- package/writes/updateActiveBlock.js +17 -17
- package/writes/updateActiveBlock.js.map +1 -1
- package/writes/updateBlock.d.ts +5 -5
- package/writes/updateBlock.js +23 -23
- package/writes/updateBlock.js.map +1 -1
package/util/getOauthAccounts.js
CHANGED
|
@@ -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\";\
|
|
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"]}
|
package/util/getRenderRoot.d.ts
CHANGED
|
@@ -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;
|
package/util/getRenderRoot.js
CHANGED
|
@@ -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\
|
|
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\";\
|
|
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\";\
|
|
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\";\
|
|
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"]}
|
package/util/getSubTree.d.ts
CHANGED
|
@@ -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;
|
package/util/getSubTree.js
CHANGED
|
@@ -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
|
package/util/getSubTree.js.map
CHANGED
|
@@ -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\";\
|
|
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"]}
|
package/util/getToken.d.ts
CHANGED
|
@@ -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
|
package/util/getToken.js.map
CHANGED
|
@@ -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\";\
|
|
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;
|
package/util/getTokenFromTree.js
CHANGED
|
@@ -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\";\
|
|
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;
|
package/util/getWorkerClient.js
CHANGED
|
@@ -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 = ({\
|
|
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;
|
package/util/handleBodyFetch.js
CHANGED
|
@@ -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
|