roamjs-components 0.85.1 → 1.0.0-beta.1
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/.eslintrc.json +19 -0
- package/.github/workflows/main.yaml +34 -0
- package/LICENSE +21 -21
- package/README.md +29 -29
- package/docs/components.md +32 -0
- package/docs/date.md +13 -0
- package/docs/dom.md +58 -0
- package/docs/events.md +16 -0
- package/docs/hooks.md +15 -0
- package/docs/marked.md +56 -0
- package/docs/queries.md +24 -0
- package/docs/scripts.md +20 -0
- package/docs/types.md +32 -0
- package/docs/util.md +38 -0
- package/docs/writes.md +23 -0
- package/package.json +117 -117
- package/patches/dotenv+16.3.1.patch +12 -0
- package/src/components/AutocompleteInput.tsx +248 -0
- package/src/components/BlockErrorBoundary.tsx +35 -0
- package/src/components/BlockInput.tsx +130 -0
- package/src/components/ComponentContainer.tsx +69 -0
- package/src/components/ConfigPage.tsx +340 -0
- package/src/components/ConfigPanels/BlockPanel.tsx +60 -0
- package/src/components/ConfigPanels/BlocksPanel.tsx +100 -0
- package/src/components/ConfigPanels/CustomPanel.tsx +41 -0
- package/src/components/ConfigPanels/FlagPanel.tsx +48 -0
- package/src/components/ConfigPanels/MultiChildPanel.tsx +108 -0
- package/src/components/ConfigPanels/MultiTextPanel.tsx +23 -0
- package/src/components/ConfigPanels/NumberPanel.tsx +36 -0
- package/src/components/ConfigPanels/OauthPanel.tsx +134 -0
- package/src/components/ConfigPanels/PagesPanel.tsx +19 -0
- package/src/components/ConfigPanels/SelectPanel.tsx +46 -0
- package/src/components/ConfigPanels/TextPanel.tsx +44 -0
- package/src/components/ConfigPanels/TimePanel.tsx +45 -0
- package/src/components/ConfigPanels/getBrandColors.tsx +31 -0
- package/src/components/ConfigPanels/types.ts +111 -0
- package/src/components/ConfigPanels/useSingleChildValue.tsx +80 -0
- package/src/components/CursorMenu.tsx +286 -0
- package/src/components/Description.tsx +31 -0
- package/src/components/ExtensionApiContext.tsx +24 -0
- package/src/components/ExternalLogin.tsx +201 -0
- package/src/components/Filter.tsx +313 -0
- package/src/components/FormDialog.tsx +517 -0
- package/src/components/Loading.tsx +33 -0
- package/src/components/MenuItemSelect.tsx +88 -0
- package/src/components/OauthPanel.tsx +62 -0
- package/src/components/OauthSelect.tsx +49 -0
- package/src/components/PageInput.tsx +31 -0
- package/src/components/PageLink.tsx +50 -0
- package/src/components/ProgressDialog.tsx +85 -0
- package/src/components/SimpleAlert.tsx +103 -0
- package/src/components/Toast.tsx +85 -0
- package/src/components/index.ts +5 -0
- package/src/components.tsx +242 -0
- package/src/date/constants.ts +19 -0
- package/{date/index.d.ts → src/date/index.ts} +3 -3
- package/src/date/parseNlpDate.ts +270 -0
- package/src/date/parseRoamDateUid.ts +6 -0
- package/src/dom/addBlockCommand.ts +59 -0
- package/src/dom/addKeyboardTriggers.ts +52 -0
- package/src/dom/addOldRoamJSDependency.ts +10 -0
- package/src/dom/addRoamJSDependency.ts +7 -0
- package/src/dom/addScriptAsDependency.ts +24 -0
- package/src/dom/addStyle.ts +11 -0
- package/src/dom/constants.ts +1 -0
- package/src/dom/createBlockObserver.ts +44 -0
- package/src/dom/createButtonObserver.ts +31 -0
- package/src/dom/createDivObserver.ts +15 -0
- package/src/dom/createHTMLObserver.ts +44 -0
- package/src/dom/createHashtagObserver.ts +22 -0
- package/src/dom/createIconButton.ts +13 -0
- package/src/dom/createObserver.ts +15 -0
- package/src/dom/createOverlayObserver.ts +7 -0
- package/src/dom/createPageObserver.ts +39 -0
- package/src/dom/createPageTitleObserver.ts +43 -0
- package/src/dom/elToTitle.ts +21 -0
- package/src/dom/genericError.ts +13 -0
- package/src/dom/getActiveUids.ts +6 -0
- package/src/dom/getBlockUidFromTarget.ts +39 -0
- package/src/dom/getCurrentPageUid.ts +5 -0
- package/src/dom/getDomRefs.ts +15 -0
- package/src/dom/getDropUidOffset.ts +36 -0
- package/src/dom/getMutatedNodes.ts +31 -0
- package/src/dom/getPageTitleByHtmlElement.ts +19 -0
- package/src/dom/getPageTitleValueByHtmlElement.ts +8 -0
- package/src/dom/getReferenceBlockUid.ts +22 -0
- package/src/dom/getRoamUrl.ts +6 -0
- package/src/dom/getRoamUrlByPage.ts +9 -0
- package/src/dom/getUids.ts +9 -0
- package/src/dom/getUidsFromButton.ts +9 -0
- package/src/dom/getUidsFromId.ts +13 -0
- package/{dom/index.d.ts → src/dom/index.ts} +30 -30
- package/src/dom/parseRoamBlocksToHtml.ts +118 -0
- package/src/dom/resolveRefs.ts +46 -0
- package/{events/index.d.ts → src/events/index.ts} +1 -1
- package/src/events/watchOnce.ts +17 -0
- package/{hooks/index.d.ts → src/hooks/index.ts} +2 -2
- package/src/hooks/useArrowKeyDown.ts +72 -0
- package/src/hooks/useSubTree.ts +16 -0
- package/src/marked/index.ts +619 -0
- package/src/queries/compileDatalog.ts +81 -0
- package/src/queries/getAllBlockUids.ts +8 -0
- package/src/queries/getAllBlockUidsAndTexts.ts +10 -0
- package/src/queries/getAllPageNames.ts +8 -0
- package/src/queries/getAttributeValueByBlockAndName.ts +20 -0
- package/src/queries/getBasicTreeByParentUid.ts +21 -0
- package/src/queries/getBlockUidAndTextIncludingText.ts +15 -0
- package/src/queries/getBlockUidByTextOnPage.ts +14 -0
- package/src/queries/getBlockUidsAndTextsReferencingPage.ts +18 -0
- package/src/queries/getBlockUidsByPageTitle.ts +12 -0
- package/src/queries/getBlockUidsReferencingBlock.ts +10 -0
- package/src/queries/getBlockUidsReferencingPage.ts +15 -0
- package/src/queries/getBlockUidsWithParentUid.ts +8 -0
- package/src/queries/getChildrenLengthByPageUid.ts +10 -0
- package/src/queries/getChildrenLengthByParentUid.ts +9 -0
- package/src/queries/getCreateTimeByBlockUid.ts +9 -0
- package/src/queries/getCurrentUser.ts +12 -0
- package/src/queries/getCurrentUserDisplayName.ts +9 -0
- package/src/queries/getCurrentUserEmail.ts +12 -0
- package/src/queries/getCurrentUserUid.ts +12 -0
- package/src/queries/getDisplayNameByEmail.ts +8 -0
- package/src/queries/getDisplayNameByUid.ts +8 -0
- package/src/queries/getEditTimeByBlockUid.ts +9 -0
- package/src/queries/getEditedUserEmailByBlockUid.ts +10 -0
- package/src/queries/getFirstChildTextByBlockUid.ts +10 -0
- package/src/queries/getFirstChildUidByBlockUid.ts +6 -0
- package/src/queries/getFullTreeByParentUid.ts +60 -0
- package/src/queries/getLinkedPageTitlesUnderUid.ts +8 -0
- package/src/queries/getNthChildUidByBlockUid.ts +16 -0
- package/src/queries/getOrderByBlockUid.ts +8 -0
- package/src/queries/getPageTitleByBlockUid.ts +8 -0
- package/src/queries/getPageTitleByPageUid.ts +13 -0
- package/src/queries/getPageTitleReferencesByPageTitle.ts +15 -0
- package/src/queries/getPageTitlesAndBlockUidsReferencingPage.ts +18 -0
- package/src/queries/getPageTitlesAndUidsDirectlyReferencingPage.ts +18 -0
- package/src/queries/getPageTitlesReferencingBlockUid.ts +12 -0
- package/src/queries/getPageTitlesStartingWithPrefix.ts +10 -0
- package/src/queries/getPageUidByBlockUid.ts +8 -0
- package/src/queries/getPageUidByPageTitle.ts +10 -0
- package/src/queries/getPageViewType.ts +13 -0
- package/src/queries/getParentTextByBlockUid.ts +8 -0
- package/src/queries/getParentTextByBlockUidAndTag.ts +14 -0
- package/src/queries/getParentUidByBlockUid.ts +10 -0
- package/src/queries/getParentUidsOfBlockUid.ts +10 -0
- package/src/queries/getSettingsByEmail.ts +10 -0
- package/src/queries/getShallowTreeByParentUid.ts +17 -0
- package/src/queries/getTextByBlockUid.ts +10 -0
- package/src/queries/index.ts +5 -0
- package/src/queries/isLiveBlock.ts +9 -0
- package/src/queries/isTagOnPage.ts +20 -0
- package/src/queries/normalizePageTitle.ts +4 -0
- package/src/scripts/index.ts +2 -0
- package/src/scripts/publishToRoamDepot.ts +163 -0
- package/src/testing/mockRoamEnvironment.ts +1489 -0
- package/src/types/index.ts +266 -0
- package/src/types/native.ts +495 -0
- package/src/types/query-builder.ts +10 -0
- package/src/types/smartblocks.ts +39 -0
- package/src/util/addInputSetting.ts +33 -0
- package/src/util/apiDelete.ts +5 -0
- package/src/util/apiGet.ts +5 -0
- package/src/util/apiPost.ts +5 -0
- package/src/util/apiPut.ts +5 -0
- package/src/util/createOverlayRender.ts +12 -0
- package/src/util/createTagRegex.ts +7 -0
- package/src/util/dispatchToRegistry.ts +11 -0
- package/src/util/env.ts +44 -0
- package/src/util/extensionApiContext.ts +17 -0
- package/src/util/extensionDeprecatedWarning.ts +57 -0
- package/src/util/extractRef.ts +8 -0
- package/src/util/extractTag.ts +15 -0
- package/src/util/focusMainWindowBlock.ts +13 -0
- package/src/util/getAuthorizationHeader.ts +11 -0
- package/src/util/getLocalStorageKey.ts +4 -0
- package/src/util/getOauth.ts +57 -0
- package/src/util/getOauthAccounts.ts +26 -0
- package/src/util/getRenderRoot.ts +17 -0
- package/src/util/getSettingIntFromTree.ts +18 -0
- package/src/util/getSettingValueFromTree.ts +23 -0
- package/src/util/getSettingValuesFromTree.ts +20 -0
- package/src/util/getSubTree.ts +31 -0
- package/src/util/getToken.ts +12 -0
- package/src/util/getTokenFromTree.ts +6 -0
- package/src/util/getWorkerClient.ts +55 -0
- package/src/util/handleBodyFetch.ts +38 -0
- package/src/util/handleFetch.ts +70 -0
- package/src/util/handleUrlFetch.ts +30 -0
- package/src/util/idToTitle.ts +8 -0
- package/{util/index.d.ts → src/util/index.ts} +24 -24
- package/src/util/isControl.ts +4 -0
- package/src/util/localStorageGet.ts +6 -0
- package/src/util/localStorageRemove.ts +6 -0
- package/src/util/localStorageSet.ts +6 -0
- package/src/util/registerExperimentalMode.ts +76 -0
- package/src/util/registerSmartBlocksCommand.ts +23 -0
- package/src/util/removeFromRegistry.ts +11 -0
- package/src/util/renderOverlay.ts +69 -0
- package/src/util/renderWithUnmount.ts +50 -0
- package/src/util/runExtension.ts +206 -0
- package/src/util/setInputSetting.ts +46 -0
- package/src/util/setInputSettings.ts +37 -0
- package/src/util/stripUid.ts +10 -0
- package/src/util/toConfigPageName.ts +3 -0
- package/src/util/toFlexRegex.ts +7 -0
- package/src/writes/clearBlockById.ts +17 -0
- package/src/writes/clearBlockByUid.ts +16 -0
- package/src/writes/createBlock.ts +50 -0
- package/src/writes/createPage.ts +30 -0
- package/src/writes/deleteBlock.ts +9 -0
- package/{writes/index.d.ts → src/writes/index.ts} +8 -8
- package/src/writes/openBlockInSidebar.ts +13 -0
- package/src/writes/submitActions.ts +54 -0
- package/src/writes/updateActiveBlock.ts +17 -0
- package/src/writes/updateBlock.ts +33 -0
- package/tests/backend.test.tsx +28 -0
- package/tests/date.test.ts +26 -0
- package/tests/dom.test.tsx +10 -0
- package/tests/index.test.tsx +25 -0
- package/tests/marked.test.ts +474 -0
- package/tests/util/createTagRegex.test.ts +63 -0
- package/tests/util/extractTag.test.ts +17 -0
- package/tests/util/toFlexRegex.test.ts +7 -0
- package/tsconfig.json +26 -0
- package/components/AutocompleteInput.d.ts +0 -28
- package/components/AutocompleteInput.js +0 -121
- package/components/AutocompleteInput.js.map +0 -1
- package/components/BlockErrorBoundary.d.ts +0 -15
- package/components/BlockErrorBoundary.js +0 -28
- package/components/BlockErrorBoundary.js.map +0 -1
- package/components/BlockInput.d.ts +0 -13
- package/components/BlockInput.js +0 -56
- package/components/BlockInput.js.map +0 -1
- package/components/ComponentContainer.d.ts +0 -10
- package/components/ComponentContainer.js +0 -38
- package/components/ComponentContainer.js.map +0 -1
- package/components/ConfigPage.d.ts +0 -35
- package/components/ConfigPage.js +0 -160
- package/components/ConfigPage.js.map +0 -1
- package/components/ConfigPanels/BlockPanel.d.ts +0 -3
- package/components/ConfigPanels/BlockPanel.js +0 -43
- package/components/ConfigPanels/BlockPanel.js.map +0 -1
- package/components/ConfigPanels/BlocksPanel.d.ts +0 -3
- package/components/ConfigPanels/BlocksPanel.js +0 -69
- package/components/ConfigPanels/BlocksPanel.js.map +0 -1
- package/components/ConfigPanels/CustomPanel.d.ts +0 -3
- package/components/ConfigPanels/CustomPanel.js +0 -25
- package/components/ConfigPanels/CustomPanel.js.map +0 -1
- package/components/ConfigPanels/FlagPanel.d.ts +0 -3
- package/components/ConfigPanels/FlagPanel.js +0 -32
- package/components/ConfigPanels/FlagPanel.js.map +0 -1
- package/components/ConfigPanels/MultiChildPanel.d.ts +0 -9
- package/components/ConfigPanels/MultiChildPanel.js +0 -59
- package/components/ConfigPanels/MultiChildPanel.js.map +0 -1
- package/components/ConfigPanels/MultiTextPanel.d.ts +0 -3
- package/components/ConfigPanels/MultiTextPanel.js +0 -15
- package/components/ConfigPanels/MultiTextPanel.js.map +0 -1
- package/components/ConfigPanels/NumberPanel.d.ts +0 -3
- package/components/ConfigPanels/NumberPanel.js +0 -26
- package/components/ConfigPanels/NumberPanel.js.map +0 -1
- package/components/ConfigPanels/OauthPanel.d.ts +0 -3
- package/components/ConfigPanels/OauthPanel.js +0 -82
- package/components/ConfigPanels/OauthPanel.js.map +0 -1
- package/components/ConfigPanels/PagesPanel.d.ts +0 -3
- package/components/ConfigPanels/PagesPanel.js +0 -12
- package/components/ConfigPanels/PagesPanel.js.map +0 -1
- package/components/ConfigPanels/SelectPanel.d.ts +0 -3
- package/components/ConfigPanels/SelectPanel.js +0 -28
- package/components/ConfigPanels/SelectPanel.js.map +0 -1
- package/components/ConfigPanels/TextPanel.d.ts +0 -3
- package/components/ConfigPanels/TextPanel.js +0 -29
- package/components/ConfigPanels/TextPanel.js.map +0 -1
- package/components/ConfigPanels/TimePanel.d.ts +0 -3
- package/components/ConfigPanels/TimePanel.js +0 -35
- package/components/ConfigPanels/TimePanel.js.map +0 -1
- package/components/ConfigPanels/getBrandColors.d.ts +0 -7
- package/components/ConfigPanels/getBrandColors.js +0 -29
- package/components/ConfigPanels/getBrandColors.js.map +0 -1
- package/components/ConfigPanels/types.d.ts +0 -84
- package/components/ConfigPanels/types.js +0 -3
- package/components/ConfigPanels/types.js.map +0 -1
- package/components/ConfigPanels/useSingleChildValue.d.ts +0 -13
- package/components/ConfigPanels/useSingleChildValue.js +0 -44
- package/components/ConfigPanels/useSingleChildValue.js.map +0 -1
- package/components/CursorMenu.d.ts +0 -21
- package/components/CursorMenu.js +0 -182
- package/components/CursorMenu.js.map +0 -1
- package/components/Description.d.ts +0 -5
- package/components/Description.js +0 -17
- package/components/Description.js.map +0 -1
- package/components/ExtensionApiContext.d.ts +0 -31
- package/components/ExtensionApiContext.js +0 -17
- package/components/ExtensionApiContext.js.map +0 -1
- package/components/ExternalLogin.d.ts +0 -18
- package/components/ExternalLogin.js +0 -142
- package/components/ExternalLogin.js.map +0 -1
- package/components/Filter.d.ts +0 -15
- package/components/Filter.js +0 -143
- package/components/Filter.js.map +0 -1
- package/components/FormDialog.d.ts +0 -55
- package/components/FormDialog.js +0 -224
- package/components/FormDialog.js.map +0 -1
- package/components/Loading.d.ts +0 -4
- package/components/Loading.js +0 -36
- package/components/Loading.js.map +0 -1
- package/components/MenuItemSelect.d.ts +0 -17
- package/components/MenuItemSelect.js +0 -24
- package/components/MenuItemSelect.js.map +0 -1
- package/components/OauthPanel.d.ts +0 -7
- package/components/OauthPanel.js +0 -31
- package/components/OauthPanel.js.map +0 -1
- package/components/OauthSelect.d.ts +0 -5
- package/components/OauthSelect.js +0 -26
- package/components/OauthSelect.js.map +0 -1
- package/components/PageInput.d.ts +0 -6
- package/components/PageInput.js +0 -14
- package/components/PageInput.js.map +0 -1
- package/components/PageLink.d.ts +0 -6
- package/components/PageLink.js +0 -32
- package/components/PageLink.js.map +0 -1
- package/components/ProgressDialog.d.ts +0 -11
- package/components/ProgressDialog.js +0 -61
- package/components/ProgressDialog.js.map +0 -1
- package/components/SimpleAlert.d.ts +0 -15
- package/components/SimpleAlert.js +0 -48
- package/components/SimpleAlert.js.map +0 -1
- package/components/Toast.d.ts +0 -15
- package/components/Toast.js +0 -51
- package/components/Toast.js.map +0 -1
- package/components/index.d.ts +0 -0
- package/components/index.js +0 -5
- package/components/index.js.map +0 -1
- package/components.d.ts +0 -5
- package/components.js +0 -171
- package/components.js.map +0 -1
- package/date/constants.d.ts +0 -3
- package/date/constants.js +0 -20
- package/date/constants.js.map +0 -1
- package/date/index.js +0 -10
- package/date/index.js.map +0 -1
- package/date/parseNlpDate.d.ts +0 -5
- package/date/parseNlpDate.js +0 -227
- package/date/parseNlpDate.js.map +0 -1
- package/date/parseRoamDateUid.d.ts +0 -2
- package/date/parseRoamDateUid.js +0 -8
- package/date/parseRoamDateUid.js.map +0 -1
- package/dom/addBlockCommand.d.ts +0 -5
- package/dom/addBlockCommand.js +0 -54
- package/dom/addBlockCommand.js.map +0 -1
- package/dom/addKeyboardTriggers.d.ts +0 -11
- package/dom/addKeyboardTriggers.js +0 -39
- package/dom/addKeyboardTriggers.js.map +0 -1
- package/dom/addOldRoamJSDependency.d.ts +0 -2
- package/dom/addOldRoamJSDependency.js +0 -11
- package/dom/addOldRoamJSDependency.js.map +0 -1
- package/dom/addRoamJSDependency.d.ts +0 -2
- package/dom/addRoamJSDependency.js +0 -9
- package/dom/addRoamJSDependency.js.map +0 -1
- package/dom/addScriptAsDependency.d.ts +0 -6
- package/dom/addScriptAsDependency.js +0 -17
- package/dom/addScriptAsDependency.js.map +0 -1
- package/dom/addStyle.d.ts +0 -2
- package/dom/addStyle.js +0 -15
- package/dom/addStyle.js.map +0 -1
- package/dom/constants.d.ts +0 -1
- package/dom/constants.js +0 -5
- package/dom/constants.js.map +0 -1
- package/dom/createBlockObserver.d.ts +0 -7
- package/dom/createBlockObserver.js +0 -44
- package/dom/createBlockObserver.js.map +0 -1
- package/dom/createButtonObserver.d.ts +0 -6
- package/dom/createButtonObserver.js +0 -22
- package/dom/createButtonObserver.js.map +0 -1
- package/dom/createDivObserver.d.ts +0 -2
- package/dom/createDivObserver.js +0 -14
- package/dom/createDivObserver.js.map +0 -1
- package/dom/createHTMLObserver.d.ts +0 -8
- package/dom/createHTMLObserver.js +0 -25
- package/dom/createHTMLObserver.js.map +0 -1
- package/dom/createHashtagObserver.d.ts +0 -5
- package/dom/createHashtagObserver.js +0 -17
- package/dom/createHashtagObserver.js.map +0 -1
- package/dom/createIconButton.d.ts +0 -2
- package/dom/createIconButton.js +0 -13
- package/dom/createIconButton.js.map +0 -1
- package/dom/createObserver.d.ts +0 -2
- package/dom/createObserver.js +0 -10
- package/dom/createObserver.js.map +0 -1
- package/dom/createOverlayObserver.d.ts +0 -2
- package/dom/createOverlayObserver.js +0 -7
- package/dom/createOverlayObserver.js.map +0 -1
- package/dom/createPageObserver.d.ts +0 -2
- package/dom/createPageObserver.js +0 -35
- package/dom/createPageObserver.js.map +0 -1
- package/dom/createPageTitleObserver.d.ts +0 -6
- package/dom/createPageTitleObserver.js +0 -32
- package/dom/createPageTitleObserver.js.map +0 -1
- package/dom/elToTitle.d.ts +0 -2
- package/dom/elToTitle.js +0 -23
- package/dom/elToTitle.js.map +0 -1
- package/dom/genericError.d.ts +0 -3
- package/dom/genericError.js +0 -12
- package/dom/genericError.js.map +0 -1
- package/dom/getActiveUids.d.ts +0 -3
- package/dom/getActiveUids.js +0 -7
- package/dom/getActiveUids.js.map +0 -1
- package/dom/getBlockUidFromTarget.d.ts +0 -2
- package/dom/getBlockUidFromTarget.js +0 -34
- package/dom/getBlockUidFromTarget.js.map +0 -1
- package/dom/getCurrentPageUid.d.ts +0 -2
- package/dom/getCurrentPageUid.js +0 -9
- package/dom/getCurrentPageUid.js.map +0 -1
- package/dom/getDomRefs.d.ts +0 -2
- package/dom/getDomRefs.js +0 -13
- package/dom/getDomRefs.js.map +0 -1
- package/dom/getDropUidOffset.d.ts +0 -5
- package/dom/getDropUidOffset.js +0 -28
- package/dom/getDropUidOffset.js.map +0 -1
- package/dom/getMutatedNodes.d.ts +0 -7
- package/dom/getMutatedNodes.js +0 -12
- package/dom/getMutatedNodes.js.map +0 -1
- package/dom/getPageTitleByHtmlElement.d.ts +0 -2
- package/dom/getPageTitleByHtmlElement.js +0 -13
- package/dom/getPageTitleByHtmlElement.js.map +0 -1
- package/dom/getPageTitleValueByHtmlElement.d.ts +0 -2
- package/dom/getPageTitleValueByHtmlElement.js +0 -10
- package/dom/getPageTitleValueByHtmlElement.js.map +0 -1
- package/dom/getReferenceBlockUid.d.ts +0 -2
- package/dom/getReferenceBlockUid.js +0 -19
- package/dom/getReferenceBlockUid.js.map +0 -1
- package/dom/getRoamUrl.d.ts +0 -2
- package/dom/getRoamUrl.js +0 -5
- package/dom/getRoamUrl.js.map +0 -1
- package/dom/getRoamUrlByPage.d.ts +0 -2
- package/dom/getRoamUrlByPage.js +0 -11
- package/dom/getRoamUrlByPage.js.map +0 -1
- package/dom/getUids.d.ts +0 -3
- package/dom/getUids.js +0 -9
- package/dom/getUids.js.map +0 -1
- package/dom/getUidsFromButton.d.ts +0 -3
- package/dom/getUidsFromButton.js +0 -9
- package/dom/getUidsFromButton.js.map +0 -1
- package/dom/getUidsFromId.d.ts +0 -5
- package/dom/getUidsFromId.js +0 -16
- package/dom/getUidsFromId.js.map +0 -1
- package/dom/index.js +0 -64
- package/dom/index.js.map +0 -1
- package/dom/parseRoamBlocksToHtml.d.ts +0 -11
- package/dom/parseRoamBlocksToHtml.js +0 -80
- package/dom/parseRoamBlocksToHtml.js.map +0 -1
- package/dom/resolveRefs.d.ts +0 -2
- package/dom/resolveRefs.js +0 -25
- package/dom/resolveRefs.js.map +0 -1
- package/events/index.js +0 -9
- package/events/index.js.map +0 -1
- package/events/watchOnce.d.ts +0 -3
- package/events/watchOnce.js +0 -13
- package/events/watchOnce.js.map +0 -1
- package/hooks/index.js +0 -11
- package/hooks/index.js.map +0 -1
- package/hooks/useArrowKeyDown.d.ts +0 -10
- package/hooks/useArrowKeyDown.js +0 -55
- package/hooks/useArrowKeyDown.js.map +0 -1
- package/hooks/useSubTree.d.ts +0 -3
- package/hooks/useSubTree.js +0 -12
- package/hooks/useSubTree.js.map +0 -1
- package/marked/index.d.ts +0 -25
- package/marked/index.js +0 -568
- package/marked/index.js.map +0 -1
- package/queries/compileDatalog.d.ts +0 -3
- package/queries/compileDatalog.js +0 -64
- package/queries/compileDatalog.js.map +0 -1
- package/queries/getAllBlockUids.d.ts +0 -2
- package/queries/getAllBlockUids.js +0 -7
- package/queries/getAllBlockUids.js.map +0 -1
- package/queries/getAllBlockUidsAndTexts.d.ts +0 -5
- package/queries/getAllBlockUidsAndTexts.js +0 -7
- package/queries/getAllBlockUidsAndTexts.js.map +0 -1
- package/queries/getAllPageNames.d.ts +0 -2
- package/queries/getAllPageNames.js +0 -7
- package/queries/getAllPageNames.js.map +0 -1
- package/queries/getAttributeValueByBlockAndName.d.ts +0 -5
- package/queries/getAttributeValueByBlockAndName.js +0 -12
- package/queries/getAttributeValueByBlockAndName.js.map +0 -1
- package/queries/getBasicTreeByParentUid.d.ts +0 -3
- package/queries/getBasicTreeByParentUid.js +0 -14
- package/queries/getBasicTreeByParentUid.js.map +0 -1
- package/queries/getBlockUidAndTextIncludingText.d.ts +0 -5
- package/queries/getBlockUidAndTextIncludingText.js +0 -8
- package/queries/getBlockUidAndTextIncludingText.js.map +0 -1
- package/queries/getBlockUidByTextOnPage.d.ts +0 -5
- package/queries/getBlockUidByTextOnPage.js +0 -8
- package/queries/getBlockUidByTextOnPage.js.map +0 -1
- package/queries/getBlockUidsAndTextsReferencingPage.d.ts +0 -5
- package/queries/getBlockUidsAndTextsReferencingPage.js +0 -10
- package/queries/getBlockUidsAndTextsReferencingPage.js.map +0 -1
- package/queries/getBlockUidsByPageTitle.d.ts +0 -2
- package/queries/getBlockUidsByPageTitle.js +0 -9
- package/queries/getBlockUidsByPageTitle.js.map +0 -1
- package/queries/getBlockUidsReferencingBlock.d.ts +0 -2
- package/queries/getBlockUidsReferencingBlock.js +0 -5
- package/queries/getBlockUidsReferencingBlock.js.map +0 -1
- package/queries/getBlockUidsReferencingPage.d.ts +0 -2
- package/queries/getBlockUidsReferencingPage.js +0 -7
- package/queries/getBlockUidsReferencingPage.js.map +0 -1
- package/queries/getBlockUidsWithParentUid.d.ts +0 -2
- package/queries/getBlockUidsWithParentUid.js +0 -7
- package/queries/getBlockUidsWithParentUid.js.map +0 -1
- package/queries/getChildrenLengthByPageUid.d.ts +0 -2
- package/queries/getChildrenLengthByPageUid.js +0 -9
- package/queries/getChildrenLengthByPageUid.js.map +0 -1
- package/queries/getChildrenLengthByParentUid.d.ts +0 -2
- package/queries/getChildrenLengthByParentUid.js +0 -8
- package/queries/getChildrenLengthByParentUid.js.map +0 -1
- package/queries/getCreateTimeByBlockUid.d.ts +0 -2
- package/queries/getCreateTimeByBlockUid.js +0 -8
- package/queries/getCreateTimeByBlockUid.js.map +0 -1
- package/queries/getCurrentUser.d.ts +0 -2
- package/queries/getCurrentUser.js +0 -12
- package/queries/getCurrentUser.js.map +0 -1
- package/queries/getCurrentUserDisplayName.d.ts +0 -2
- package/queries/getCurrentUserDisplayName.js +0 -11
- package/queries/getCurrentUserDisplayName.js.map +0 -1
- package/queries/getCurrentUserEmail.d.ts +0 -2
- package/queries/getCurrentUserEmail.js +0 -14
- package/queries/getCurrentUserEmail.js.map +0 -1
- package/queries/getCurrentUserUid.d.ts +0 -2
- package/queries/getCurrentUserUid.js +0 -14
- package/queries/getCurrentUserUid.js.map +0 -1
- package/queries/getDisplayNameByEmail.d.ts +0 -2
- package/queries/getDisplayNameByEmail.js +0 -8
- package/queries/getDisplayNameByEmail.js.map +0 -1
- package/queries/getDisplayNameByUid.d.ts +0 -2
- package/queries/getDisplayNameByUid.js +0 -8
- package/queries/getDisplayNameByUid.js.map +0 -1
- package/queries/getEditTimeByBlockUid.d.ts +0 -2
- package/queries/getEditTimeByBlockUid.js +0 -8
- package/queries/getEditTimeByBlockUid.js.map +0 -1
- package/queries/getEditedUserEmailByBlockUid.d.ts +0 -2
- package/queries/getEditedUserEmailByBlockUid.js +0 -8
- package/queries/getEditedUserEmailByBlockUid.js.map +0 -1
- package/queries/getFirstChildTextByBlockUid.d.ts +0 -2
- package/queries/getFirstChildTextByBlockUid.js +0 -8
- package/queries/getFirstChildTextByBlockUid.js.map +0 -1
- package/queries/getFirstChildUidByBlockUid.d.ts +0 -2
- package/queries/getFirstChildUidByBlockUid.js +0 -7
- package/queries/getFirstChildUidByBlockUid.js.map +0 -1
- package/queries/getFullTreeByParentUid.d.ts +0 -3
- package/queries/getFullTreeByParentUid.js +0 -52
- package/queries/getFullTreeByParentUid.js.map +0 -1
- package/queries/getLinkedPageTitlesUnderUid.d.ts +0 -2
- package/queries/getLinkedPageTitlesUnderUid.js +0 -7
- package/queries/getLinkedPageTitlesUnderUid.js.map +0 -1
- package/queries/getNthChildUidByBlockUid.d.ts +0 -5
- package/queries/getNthChildUidByBlockUid.js +0 -8
- package/queries/getNthChildUidByBlockUid.js.map +0 -1
- package/queries/getOrderByBlockUid.d.ts +0 -2
- package/queries/getOrderByBlockUid.js +0 -8
- package/queries/getOrderByBlockUid.js.map +0 -1
- package/queries/getPageTitleByBlockUid.d.ts +0 -2
- package/queries/getPageTitleByBlockUid.js +0 -8
- package/queries/getPageTitleByBlockUid.js.map +0 -1
- package/queries/getPageTitleByPageUid.d.ts +0 -2
- package/queries/getPageTitleByPageUid.js +0 -13
- package/queries/getPageTitleByPageUid.js.map +0 -1
- package/queries/getPageTitleReferencesByPageTitle.d.ts +0 -2
- package/queries/getPageTitleReferencesByPageTitle.js +0 -7
- package/queries/getPageTitleReferencesByPageTitle.js.map +0 -1
- package/queries/getPageTitlesAndBlockUidsReferencingPage.d.ts +0 -5
- package/queries/getPageTitlesAndBlockUidsReferencingPage.js +0 -10
- package/queries/getPageTitlesAndBlockUidsReferencingPage.js.map +0 -1
- package/queries/getPageTitlesAndUidsDirectlyReferencingPage.d.ts +0 -5
- package/queries/getPageTitlesAndUidsDirectlyReferencingPage.js +0 -10
- package/queries/getPageTitlesAndUidsDirectlyReferencingPage.js.map +0 -1
- package/queries/getPageTitlesReferencingBlockUid.d.ts +0 -2
- package/queries/getPageTitlesReferencingBlockUid.js +0 -5
- package/queries/getPageTitlesReferencingBlockUid.js.map +0 -1
- package/queries/getPageTitlesStartingWithPrefix.d.ts +0 -2
- package/queries/getPageTitlesStartingWithPrefix.js +0 -7
- package/queries/getPageTitlesStartingWithPrefix.js.map +0 -1
- package/queries/getPageUidByBlockUid.d.ts +0 -2
- package/queries/getPageUidByBlockUid.js +0 -8
- package/queries/getPageUidByBlockUid.js.map +0 -1
- package/queries/getPageUidByPageTitle.d.ts +0 -2
- package/queries/getPageUidByPageTitle.js +0 -10
- package/queries/getPageUidByPageTitle.js.map +0 -1
- package/queries/getPageViewType.d.ts +0 -3
- package/queries/getPageViewType.js +0 -10
- package/queries/getPageViewType.js.map +0 -1
- package/queries/getParentTextByBlockUid.d.ts +0 -2
- package/queries/getParentTextByBlockUid.js +0 -8
- package/queries/getParentTextByBlockUid.js.map +0 -1
- package/queries/getParentTextByBlockUidAndTag.d.ts +0 -5
- package/queries/getParentTextByBlockUidAndTag.js +0 -8
- package/queries/getParentTextByBlockUidAndTag.js.map +0 -1
- package/queries/getParentUidByBlockUid.d.ts +0 -2
- package/queries/getParentUidByBlockUid.js +0 -8
- package/queries/getParentUidByBlockUid.js.map +0 -1
- package/queries/getParentUidsOfBlockUid.d.ts +0 -2
- package/queries/getParentUidsOfBlockUid.js +0 -5
- package/queries/getParentUidsOfBlockUid.js.map +0 -1
- package/queries/getSettingsByEmail.d.ts +0 -3
- package/queries/getSettingsByEmail.js +0 -8
- package/queries/getSettingsByEmail.js.map +0 -1
- package/queries/getShallowTreeByParentUid.d.ts +0 -5
- package/queries/getShallowTreeByParentUid.js +0 -10
- package/queries/getShallowTreeByParentUid.js.map +0 -1
- package/queries/getTextByBlockUid.d.ts +0 -2
- package/queries/getTextByBlockUid.js +0 -10
- package/queries/getTextByBlockUid.js.map +0 -1
- package/queries/index.d.ts +0 -0
- package/queries/index.js +0 -5
- package/queries/index.js.map +0 -1
- package/queries/isLiveBlock.d.ts +0 -2
- package/queries/isLiveBlock.js +0 -5
- package/queries/isLiveBlock.js.map +0 -1
- package/queries/isTagOnPage.d.ts +0 -5
- package/queries/isTagOnPage.js +0 -10
- package/queries/isTagOnPage.js.map +0 -1
- package/queries/normalizePageTitle.d.ts +0 -2
- package/queries/normalizePageTitle.js +0 -5
- package/queries/normalizePageTitle.js.map +0 -1
- package/scripts/index.d.ts +0 -1
- package/scripts/index.js +0 -27
- package/scripts/index.js.map +0 -1
- package/scripts/publishToRoamDepot.d.ts +0 -7
- package/scripts/publishToRoamDepot.js +0 -114
- package/scripts/publishToRoamDepot.js.map +0 -1
- package/testing/mockRoamEnvironment.d.ts +0 -2
- package/testing/mockRoamEnvironment.js +0 -1254
- package/testing/mockRoamEnvironment.js.map +0 -1
- package/types/index.d.ts +0 -250
- package/types/index.js +0 -5
- package/types/index.js.map +0 -1
- package/types/native.d.ts +0 -402
- package/types/native.js +0 -5
- package/types/native.js.map +0 -1
- package/types/query-builder.d.ts +0 -10
- package/types/query-builder.js +0 -3
- package/types/query-builder.js.map +0 -1
- package/types/smartblocks.d.ts +0 -35
- package/types/smartblocks.js +0 -3
- package/types/smartblocks.js.map +0 -1
- package/util/addInputSetting.d.ts +0 -7
- package/util/addInputSetting.js +0 -26
- package/util/addInputSetting.js.map +0 -1
- package/util/apiDelete.d.ts +0 -2
- package/util/apiDelete.js +0 -7
- package/util/apiDelete.js.map +0 -1
- package/util/apiGet.d.ts +0 -2
- package/util/apiGet.js +0 -7
- package/util/apiGet.js.map +0 -1
- package/util/apiPost.d.ts +0 -2
- package/util/apiPost.js +0 -7
- package/util/apiPost.js.map +0 -1
- package/util/apiPut.d.ts +0 -2
- package/util/apiPut.js +0 -7
- package/util/apiPut.js.map +0 -1
- package/util/createOverlayRender.d.ts +0 -4
- package/util/createOverlayRender.js +0 -7
- package/util/createOverlayRender.js.map +0 -1
- package/util/createTagRegex.d.ts +0 -2
- package/util/createTagRegex.js +0 -8
- package/util/createTagRegex.js.map +0 -1
- package/util/dispatchToRegistry.d.ts +0 -3
- package/util/dispatchToRegistry.js +0 -8
- package/util/dispatchToRegistry.js.map +0 -1
- package/util/env.d.ts +0 -4
- package/util/env.js +0 -48
- package/util/env.js.map +0 -1
- package/util/extensionApiContext.d.ts +0 -29
- package/util/extensionApiContext.js +0 -18
- package/util/extensionApiContext.js.map +0 -1
- package/util/extensionDeprecatedWarning.d.ts +0 -5
- package/util/extensionDeprecatedWarning.js +0 -40
- package/util/extensionDeprecatedWarning.js.map +0 -1
- package/util/extractRef.d.ts +0 -2
- package/util/extractRef.js +0 -9
- package/util/extractRef.js.map +0 -1
- package/util/extractTag.d.ts +0 -2
- package/util/extractTag.js +0 -16
- package/util/extractTag.js.map +0 -1
- package/util/focusMainWindowBlock.d.ts +0 -2
- package/util/focusMainWindowBlock.js +0 -13
- package/util/focusMainWindowBlock.js.map +0 -1
- package/util/getAuthorizationHeader.d.ts +0 -2
- package/util/getAuthorizationHeader.js +0 -13
- package/util/getAuthorizationHeader.js.map +0 -1
- package/util/getLocalStorageKey.d.ts +0 -2
- package/util/getLocalStorageKey.js +0 -5
- package/util/getLocalStorageKey.js.map +0 -1
- package/util/getOauth.d.ts +0 -2
- package/util/getOauth.js +0 -53
- package/util/getOauth.js.map +0 -1
- package/util/getOauthAccounts.d.ts +0 -2
- package/util/getOauthAccounts.js +0 -23
- package/util/getOauthAccounts.js.map +0 -1
- package/util/getRenderRoot.d.ts +0 -2
- package/util/getRenderRoot.js +0 -19
- package/util/getRenderRoot.js.map +0 -1
- package/util/getSettingIntFromTree.d.ts +0 -7
- package/util/getSettingIntFromTree.js +0 -12
- package/util/getSettingIntFromTree.js.map +0 -1
- package/util/getSettingValueFromTree.d.ts +0 -8
- package/util/getSettingValueFromTree.js +0 -15
- package/util/getSettingValueFromTree.js.map +0 -1
- package/util/getSettingValuesFromTree.d.ts +0 -7
- package/util/getSettingValuesFromTree.js +0 -13
- package/util/getSettingValuesFromTree.js.map +0 -1
- package/util/getSubTree.d.ts +0 -8
- package/util/getSubTree.js +0 -20
- package/util/getSubTree.js.map +0 -1
- package/util/getToken.d.ts +0 -2
- package/util/getToken.js +0 -11
- package/util/getToken.js.map +0 -1
- package/util/getTokenFromTree.d.ts +0 -3
- package/util/getTokenFromTree.js +0 -5
- package/util/getTokenFromTree.js.map +0 -1
- package/util/getWorkerClient.d.ts +0 -12
- package/util/getWorkerClient.js +0 -42
- package/util/getWorkerClient.js.map +0 -1
- package/util/handleBodyFetch.d.ts +0 -3
- package/util/handleBodyFetch.js +0 -22
- package/util/handleBodyFetch.js.map +0 -1
- package/util/handleFetch.d.ts +0 -13
- package/util/handleFetch.js +0 -41
- package/util/handleFetch.js.map +0 -1
- package/util/handleUrlFetch.d.ts +0 -3
- package/util/handleUrlFetch.js +0 -20
- package/util/handleUrlFetch.js.map +0 -1
- package/util/idToTitle.d.ts +0 -2
- package/util/idToTitle.js +0 -9
- package/util/idToTitle.js.map +0 -1
- package/util/index.js +0 -55
- package/util/index.js.map +0 -1
- package/util/isControl.d.ts +0 -2
- package/util/isControl.js +0 -5
- package/util/isControl.js.map +0 -1
- package/util/localStorageGet.d.ts +0 -2
- package/util/localStorageGet.js +0 -9
- package/util/localStorageGet.js.map +0 -1
- package/util/localStorageRemove.d.ts +0 -2
- package/util/localStorageRemove.js +0 -7
- package/util/localStorageRemove.js.map +0 -1
- package/util/localStorageSet.d.ts +0 -2
- package/util/localStorageSet.js +0 -9
- package/util/localStorageSet.js.map +0 -1
- package/util/registerExperimentalMode.d.ts +0 -6
- package/util/registerExperimentalMode.js +0 -66
- package/util/registerExperimentalMode.js.map +0 -1
- package/util/registerSmartBlocksCommand.d.ts +0 -3
- package/util/registerSmartBlocksCommand.js +0 -24
- package/util/registerSmartBlocksCommand.js.map +0 -1
- package/util/removeFromRegistry.d.ts +0 -3
- package/util/removeFromRegistry.js +0 -8
- package/util/removeFromRegistry.js.map +0 -1
- package/util/renderOverlay.d.ts +0 -12
- package/util/renderOverlay.js +0 -49
- package/util/renderOverlay.js.map +0 -1
- package/util/renderWithUnmount.d.ts +0 -4
- package/util/renderWithUnmount.js +0 -45
- package/util/renderWithUnmount.js.map +0 -1
- package/util/runExtension.d.ts +0 -11
- package/util/runExtension.js +0 -175
- package/util/runExtension.js.map +0 -1
- package/util/setInputSetting.d.ts +0 -7
- package/util/setInputSetting.js +0 -38
- package/util/setInputSetting.js.map +0 -1
- package/util/setInputSettings.d.ts +0 -7
- package/util/setInputSettings.js +0 -29
- package/util/setInputSettings.js.map +0 -1
- package/util/stripUid.d.ts +0 -3
- package/util/stripUid.js +0 -11
- package/util/stripUid.js.map +0 -1
- package/util/toConfigPageName.d.ts +0 -2
- package/util/toConfigPageName.js +0 -5
- package/util/toConfigPageName.js.map +0 -1
- package/util/toFlexRegex.d.ts +0 -2
- package/util/toFlexRegex.js +0 -5
- package/util/toFlexRegex.js.map +0 -1
- package/writes/clearBlockById.d.ts +0 -2
- package/writes/clearBlockById.js +0 -18
- package/writes/clearBlockById.js.map +0 -1
- package/writes/clearBlockByUid.d.ts +0 -2
- package/writes/clearBlockByUid.js +0 -17
- package/writes/clearBlockByUid.js.map +0 -1
- package/writes/createBlock.d.ts +0 -8
- package/writes/createBlock.js +0 -29
- package/writes/createBlock.js.map +0 -1
- package/writes/createPage.d.ts +0 -7
- package/writes/createPage.js +0 -21
- package/writes/createPage.js.map +0 -1
- package/writes/deleteBlock.d.ts +0 -2
- package/writes/deleteBlock.js +0 -11
- package/writes/deleteBlock.js.map +0 -1
- package/writes/index.js +0 -23
- package/writes/index.js.map +0 -1
- package/writes/openBlockInSidebar.d.ts +0 -2
- package/writes/openBlockInSidebar.js +0 -14
- package/writes/openBlockInSidebar.js.map +0 -1
- package/writes/submitActions.d.ts +0 -8
- package/writes/submitActions.js +0 -37
- package/writes/submitActions.js.map +0 -1
- package/writes/updateActiveBlock.d.ts +0 -2
- package/writes/updateActiveBlock.js +0 -18
- package/writes/updateActiveBlock.js.map +0 -1
- package/writes/updateBlock.d.ts +0 -5
- package/writes/updateBlock.js +0 -24
- package/writes/updateBlock.js.map +0 -1
package/.eslintrc.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"root": true,
|
|
3
|
+
"parser": "@typescript-eslint/parser",
|
|
4
|
+
"plugins": ["@typescript-eslint"],
|
|
5
|
+
"extends": [
|
|
6
|
+
"eslint:recommended",
|
|
7
|
+
"plugin:@typescript-eslint/eslint-recommended",
|
|
8
|
+
"plugin:@typescript-eslint/recommended"
|
|
9
|
+
],
|
|
10
|
+
"ignorePatterns": "**/dist/*",
|
|
11
|
+
"rules": {
|
|
12
|
+
"@typescript-eslint/no-unused-vars": [
|
|
13
|
+
"error",
|
|
14
|
+
{ "argsIgnorePattern": "_+" }
|
|
15
|
+
],
|
|
16
|
+
"@typescript-eslint/no-empty-function": 0,
|
|
17
|
+
"no-control-regex": 0
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
name: Publish package
|
|
2
|
+
on:
|
|
3
|
+
workflow_dispatch:
|
|
4
|
+
push:
|
|
5
|
+
branches: main
|
|
6
|
+
paths:
|
|
7
|
+
- "package.json"
|
|
8
|
+
- ".github/workflows/main.yaml"
|
|
9
|
+
|
|
10
|
+
env:
|
|
11
|
+
ROAMJS_DEVELOPER_TOKEN: ${{ secrets.ROAMJS_DEVELOPER_TOKEN }}
|
|
12
|
+
ROAMJS_TEST_DEVELOPER_TOKEN: ${{ secrets.ROAMJS_TEST_DEVELOPER_TOKEN }}
|
|
13
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
14
|
+
|
|
15
|
+
jobs:
|
|
16
|
+
deploy:
|
|
17
|
+
runs-on: ubuntu-20.04
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v3
|
|
20
|
+
- name: install
|
|
21
|
+
run: npm install
|
|
22
|
+
- name: authenticate
|
|
23
|
+
run: echo '//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}' > ~/.npmrc
|
|
24
|
+
- name: lint
|
|
25
|
+
run: npm run lint
|
|
26
|
+
- name: build
|
|
27
|
+
run: npx tsc
|
|
28
|
+
# - name: test
|
|
29
|
+
# run: npm t
|
|
30
|
+
- name: prepare
|
|
31
|
+
run: cp LICENSE README.md package.json dist
|
|
32
|
+
- name: publish
|
|
33
|
+
run: npm publish --access public
|
|
34
|
+
working-directory: dist
|
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2021 David Vargas
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 David Vargas
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
# roamjs-components
|
|
2
|
-
|
|
3
|
-
This is a collection of common UI components used by RoamJS extensions made available to make development easier for other Roam developers.
|
|
4
|
-
|
|
5
|
-
The `roamjs-components` repository provides a robust set of tools and components for building extensions and integrations for the Roam Research note-taking application. Engineers can use this repo to streamline the development of Roam extensions by leveraging pre-built React components, utility functions, and custom hooks that interact with the Roam Research API. This repo addresses the real-world problem of efficiently creating and managing Roam Research extensions, enabling developers to focus on building unique features rather than handling boilerplate code.
|
|
6
|
-
|
|
7
|
-
The most important parts of the repo include the Components, utility functions, and database query functions. These components are organized into several directories, each serving a specific purpose:
|
|
8
|
-
|
|
9
|
-
[Components](https://github.com/RoamJS/roamjs-components/blob/main/docs/components.md): Found in the `…/components` directory, these components handle tasks such as configuration management, external authentication, and data visualization. Key components include configuration panels like `BlockPanel`, `BlocksPanel`, and `OauthPanel`, which are detailed in the Configuration Panels section. These components use React hooks and context to manage state and interactions within the Roam Research application.
|
|
10
|
-
|
|
11
|
-
[Date and Time Utilities](https://github.com/RoamJS/roamjs-components/blob/main/docs/date.md): Located in `…/date`, this directory provides functions for parsing and manipulating dates, crucial for working with Roam's daily notes. The `parseNlpDate` function uses the `chrono-node` library to parse natural language dates, while `parseRoamDateUid` converts Roam date UIDs into JavaScript Date objects. More details can be found in the Date and Time Utilities section.
|
|
12
|
-
|
|
13
|
-
[DOM Manipulation](https://github.com/RoamJS/roamjs-components/blob/main/docs/dom.md): The `…/dom` directory contains functions for interacting with the Document Object Model (DOM) within Roam Research. Functions like `addBlockCommand` and `createBlockObserver` are essential for adding new commands and observing changes in the DOM. These utilities are explained in the DOM Manipulation section.
|
|
14
|
-
|
|
15
|
-
[Event Handling](https://github.com/RoamJS/roamjs-components/blob/main/docs/events.md): The `…/events` directory includes the `watchOnce` function, which sets up one-time event listeners in Roam Research. This function is useful for performing actions when specific changes occur in the Roam environment, as detailed in the Event Handling section.
|
|
16
|
-
|
|
17
|
-
[Custom React Hooks](https://github.com/RoamJS/roamjs-components/blob/main/docs/hooks.md): Found in `…/hooks`, these hooks provide reusable functionality for managing user interactions and data structures. The `useArrowKeyDown` hook handles keyboard navigation within lists, while `useSubTree` manages sub-tree data structures. More information is available in the Custom React Hooks section.
|
|
18
|
-
|
|
19
|
-
[Markdown Parsing and Rendering](https://github.com/RoamJS/roamjs-components/blob/main/docs/marked.md): The `…/marked` directory customizes the `marked` library to parse and render Markdown content within Roam Research. This includes handling Roam-specific elements like block references and tags. The Markdown Parsing and Rendering section provides further details.
|
|
20
|
-
|
|
21
|
-
[Database Queries](https://github.com/RoamJS/roamjs-components/blob/main/docs/queries.md): The `…/queries` directory offers utility functions for interacting with the Roam Research database. Functions like `getAllBlockUids`, `getPageTitleByBlockUid`, and `getCurrentUser` retrieve various types of data from the database. These functions are crucial for building data-driven features and are discussed in the Database Queries section.
|
|
22
|
-
|
|
23
|
-
[Script Management](https://github.com/RoamJS/roamjs-components/blob/main/docs/scripts.md): The `…/scripts` directory includes functions for managing scripts in Roam Research. This includes functions for creating and managing script commands, as well as functions for executing scripts.
|
|
24
|
-
|
|
25
|
-
[Type Definitions](https://github.com/RoamJS/roamjs-components/blob/main/docs/types.md): The `…/types` directory contains TypeScript type definitions for various Roam Research components.
|
|
26
|
-
|
|
27
|
-
[Utility Functions](https://github.com/RoamJS/roamjs-components/blob/main/docs/util.md): The `…/util` directory includes utility functions for working with the Roam Research API. These functions are designed to simplify the process of interacting with the API.
|
|
28
|
-
|
|
29
|
-
[Write Operations](https://github.com/RoamJS/roamjs-components/blob/main/docs/writes.md): The `…/writes` directory includes functions for performing write operations in Roam, such as `createBlock`, `deleteBlock`, and `updateActiveBlock`. These functions handle the submission of actions to the Roam API, as detailed in the Write Operations section.
|
|
1
|
+
# roamjs-components
|
|
2
|
+
|
|
3
|
+
This is a collection of common UI components used by RoamJS extensions made available to make development easier for other Roam developers.
|
|
4
|
+
|
|
5
|
+
The `roamjs-components` repository provides a robust set of tools and components for building extensions and integrations for the Roam Research note-taking application. Engineers can use this repo to streamline the development of Roam extensions by leveraging pre-built React components, utility functions, and custom hooks that interact with the Roam Research API. This repo addresses the real-world problem of efficiently creating and managing Roam Research extensions, enabling developers to focus on building unique features rather than handling boilerplate code.
|
|
6
|
+
|
|
7
|
+
The most important parts of the repo include the Components, utility functions, and database query functions. These components are organized into several directories, each serving a specific purpose:
|
|
8
|
+
|
|
9
|
+
[Components](https://github.com/RoamJS/roamjs-components/blob/main/docs/components.md): Found in the `…/components` directory, these components handle tasks such as configuration management, external authentication, and data visualization. Key components include configuration panels like `BlockPanel`, `BlocksPanel`, and `OauthPanel`, which are detailed in the Configuration Panels section. These components use React hooks and context to manage state and interactions within the Roam Research application.
|
|
10
|
+
|
|
11
|
+
[Date and Time Utilities](https://github.com/RoamJS/roamjs-components/blob/main/docs/date.md): Located in `…/date`, this directory provides functions for parsing and manipulating dates, crucial for working with Roam's daily notes. The `parseNlpDate` function uses the `chrono-node` library to parse natural language dates, while `parseRoamDateUid` converts Roam date UIDs into JavaScript Date objects. More details can be found in the Date and Time Utilities section.
|
|
12
|
+
|
|
13
|
+
[DOM Manipulation](https://github.com/RoamJS/roamjs-components/blob/main/docs/dom.md): The `…/dom` directory contains functions for interacting with the Document Object Model (DOM) within Roam Research. Functions like `addBlockCommand` and `createBlockObserver` are essential for adding new commands and observing changes in the DOM. These utilities are explained in the DOM Manipulation section.
|
|
14
|
+
|
|
15
|
+
[Event Handling](https://github.com/RoamJS/roamjs-components/blob/main/docs/events.md): The `…/events` directory includes the `watchOnce` function, which sets up one-time event listeners in Roam Research. This function is useful for performing actions when specific changes occur in the Roam environment, as detailed in the Event Handling section.
|
|
16
|
+
|
|
17
|
+
[Custom React Hooks](https://github.com/RoamJS/roamjs-components/blob/main/docs/hooks.md): Found in `…/hooks`, these hooks provide reusable functionality for managing user interactions and data structures. The `useArrowKeyDown` hook handles keyboard navigation within lists, while `useSubTree` manages sub-tree data structures. More information is available in the Custom React Hooks section.
|
|
18
|
+
|
|
19
|
+
[Markdown Parsing and Rendering](https://github.com/RoamJS/roamjs-components/blob/main/docs/marked.md): The `…/marked` directory customizes the `marked` library to parse and render Markdown content within Roam Research. This includes handling Roam-specific elements like block references and tags. The Markdown Parsing and Rendering section provides further details.
|
|
20
|
+
|
|
21
|
+
[Database Queries](https://github.com/RoamJS/roamjs-components/blob/main/docs/queries.md): The `…/queries` directory offers utility functions for interacting with the Roam Research database. Functions like `getAllBlockUids`, `getPageTitleByBlockUid`, and `getCurrentUser` retrieve various types of data from the database. These functions are crucial for building data-driven features and are discussed in the Database Queries section.
|
|
22
|
+
|
|
23
|
+
[Script Management](https://github.com/RoamJS/roamjs-components/blob/main/docs/scripts.md): The `…/scripts` directory includes functions for managing scripts in Roam Research. This includes functions for creating and managing script commands, as well as functions for executing scripts.
|
|
24
|
+
|
|
25
|
+
[Type Definitions](https://github.com/RoamJS/roamjs-components/blob/main/docs/types.md): The `…/types` directory contains TypeScript type definitions for various Roam Research components.
|
|
26
|
+
|
|
27
|
+
[Utility Functions](https://github.com/RoamJS/roamjs-components/blob/main/docs/util.md): The `…/util` directory includes utility functions for working with the Roam Research API. These functions are designed to simplify the process of interacting with the API.
|
|
28
|
+
|
|
29
|
+
[Write Operations](https://github.com/RoamJS/roamjs-components/blob/main/docs/writes.md): The `…/writes` directory includes functions for performing write operations in Roam, such as `createBlock`, `deleteBlock`, and `updateActiveBlock`. These functions handle the submission of actions to the Roam API, as detailed in the Write Operations section.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Components
|
|
2
|
+
|
|
3
|
+
https://github.com/RoamJS/roamjs-components/tree/main/src/components
|
|
4
|
+
|
|
5
|
+
React components in this codebase provide various functionalities for the Roam Research application, focusing on configuration management, external authentication, user interface elements, and data visualization.
|
|
6
|
+
|
|
7
|
+
## Configuration Panels
|
|
8
|
+
|
|
9
|
+
Configuration panels are managed by components located in `https://github.com/RoamJS/roamjs-components/blob/main/src/components/ConfigPanels`. These components handle various input types such as text, number, time, and selection fields, as well as external authentication. The panels are designed to be modular and reusable, allowing for easy integration and customization within the Roam Research application.
|
|
10
|
+
|
|
11
|
+
[See More](https://wiki.mutable.ai/RoamJS/roamjs-components#configuration-panels)
|
|
12
|
+
|
|
13
|
+
## Extension API Context
|
|
14
|
+
|
|
15
|
+
The [`ExtensionApiContext`](https://github.com/RoamJS/roamjs-components/blob/main/src/components/ExtensionApiContext.tsx#L5) component, found in `https://github.com/RoamJS/roamjs-components/blob/main/src/components/ExtensionApiContext.tsx`, provides a React context for managing the extension API and version information. It exports two custom hooks, [`useExtensionAPI()`](https://github.com/RoamJS/roamjs-components/blob/main/src/components/ExtensionApiContext.tsx#L9) and [`useVersion()`](https://github.com/RoamJS/roamjs-components/blob/main/src/components/ExtensionApiContext.tsx#L11), which allow components to access the extension API and version information, respectively. The [`ExtensionApiContextProvider`](https://github.com/RoamJS/roamjs-components/blob/main/src/util/renderWithUnmount.ts#L3) component wraps the application to provide the necessary context.
|
|
16
|
+
|
|
17
|
+
[See More](https://wiki.mutable.ai/RoamJS/roamjs-components#extension-api-context)
|
|
18
|
+
|
|
19
|
+
## Additional Components
|
|
20
|
+
|
|
21
|
+
- **AutocompleteInput**: Provides an autocomplete input field with fuzzy string matching and customizable options.
|
|
22
|
+
- **BlockErrorBoundary**: A React error boundary that handles errors within a specific block of content.
|
|
23
|
+
- **Loading**: Renders a small loading spinner component and a function to display it in a specific location on the page.
|
|
24
|
+
- **PageLink**: Renders a link to a Roam Research page, handling various user interactions such as opening the page in the sidebar.
|
|
25
|
+
- **MenuItemSelect**: Provides a dropdown menu with selectable items, supporting filtering and custom rendering of menu items.
|
|
26
|
+
- **ExternalLogin**: Handles the authentication flow for various external services and integrates the authentication data into a Roam Research note.
|
|
27
|
+
- **FormDialog**: Provides a reusable dialog box with various input fields for collecting user data.
|
|
28
|
+
- **ProgressDialog**: Displays a progress dialog showing the progress of writing actions to Roam and providing an estimated time for completion.
|
|
29
|
+
- **SimpleAlert**: Renders a customizable alert dialog with options for confirmation, cancellation, and a "Don't show again" checkbox.
|
|
30
|
+
- **Description**: Displays a tooltip with a description text when the user hovers over an information icon.
|
|
31
|
+
|
|
32
|
+
[See More](https://wiki.mutable.ai/RoamJS/roamjs-components#utility-components)
|
package/docs/date.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Date and Time Utilities
|
|
2
|
+
|
|
3
|
+
https://github.com/RoamJS/roamjs-components/blob/main/src/date
|
|
4
|
+
|
|
5
|
+
Utilities for parsing and manipulating dates and times within the Roam Research application are provided in the `https://github.com/RoamJS/roamjs-components/blob/main/src/date` directory. Key functionalities include:
|
|
6
|
+
|
|
7
|
+
- **Natural Language Date Parsing**: The [`parseNlpDate`](https://github.com/RoamJS/roamjs-components/blob/main/src/date/parseNlpDate.ts#L250) function leverages the [`chrono-node`](/roamjs-components/package.json#L32) library to interpret natural language dates (e.g., "yesterday", "next Monday"). Custom parsing and refinement logic enhance its robustness. The [`startOfWeek`](https://github.com/RoamJS/roamjs-components/blob/main/src/date/parseNlpDate.ts#L13), [`endOfWeek`](https://github.com/RoamJS/roamjs-components/blob/main/src/date/parseNlpDate.ts#L21), [`startOfMonth`](https://github.com/RoamJS/roamjs-components/blob/main/src/date/parseNlpDate.ts#L211), [`endOfMonth`](/roamjs-components/tests/date.test.ts#L14), [`startOfYear`](https://github.com/RoamJS/roamjs-components/blob/main/src/date/parseNlpDate.ts#L224), and [`endOfYear`](https://github.com/RoamJS/roamjs-components/blob/main/src/date/parseNlpDate.ts#L8) functions from [`date-fns`](https://github.com/RoamJS/roamjs-components/blob/main/src/date/parseNlpDate.ts#L1) determine the start and end of various periods. The [`ORDINAL_WORD_DICTIONARY`](https://github.com/RoamJS/roamjs-components/blob/main/src/date/parseNlpDate.ts#L29) and [`ORDINAL_REGEX`](https://github.com/RoamJS/roamjs-components/blob/main/src/date/parseNlpDate.ts#L73) assist in parsing ordinal words and numbers. The [`assignDay`](https://github.com/RoamJS/roamjs-components/blob/main/src/date/parseNlpDate.ts#L159) function assigns year, month, and day components to a [`ParsingComponents`](https://github.com/RoamJS/roamjs-components/blob/main/src/date/parseNlpDate.ts#L10) object.
|
|
8
|
+
|
|
9
|
+
- **Roam Date UID Parsing**: The [`parseRoamDateUid`](https://github.com/RoamJS/roamjs-components/blob/main/src/date/parseRoamDateUid.ts#L1) function converts Roam Research date UIDs (formatted as "month-date-year") into JavaScript [`Date`](https://github.com/RoamJS/roamjs-components/blob/main/src/types/index.ts#L98) objects. It splits the input string, converts the components to numbers, and constructs a [`Date`](https://github.com/RoamJS/roamjs-components/blob/main/src/types/index.ts#L98) object, adjusting the month value to match JavaScript's zero-indexed months.
|
|
10
|
+
|
|
11
|
+
- **Constants**: The [`constants.ts`](https://github.com/RoamJS/roamjs-components/blob/main/src/dom/constants.ts#L0) file provides constants like [`MONTHS`](https://github.com/RoamJS/roamjs-components/blob/main/src/date/constants.ts#L1), an array of month names, and regular expressions ([`DAILY_NOTE_PAGE_REGEX`](https://github.com/RoamJS/roamjs-components/blob/main/src/date/constants.ts#L15) and [`DAILY_NOTE_PAGE_TITLE_REGEX`](https://github.com/RoamJS/roamjs-components/blob/main/src/date/constants.ts#L17)) for matching and validating daily note page titles in Roam Research.
|
|
12
|
+
|
|
13
|
+
For detailed discussions on constants and parsing functions, refer to the subsections [Constants](https://wiki.mutable.ai/RoamJS/roamjs-components#constants) and [Date Parsing](https://wiki.mutable.ai/RoamJS/roamjs-components#date-parsing).
|
package/docs/dom.md
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# DOM Manipulation
|
|
2
|
+
|
|
3
|
+
https://github.com/RoamJS/roamjs-components/blob/main/src/dom
|
|
4
|
+
|
|
5
|
+
The `https://github.com/RoamJS/roamjs-components/blob/main/src/dom` directory contains utility functions and constants for interacting with the Document Object Model (DOM) in the context of Roam Research. These utilities facilitate various operations, including adding commands, observing DOM changes, retrieving data, generating URLs, and parsing block content.
|
|
6
|
+
|
|
7
|
+
## Adding Block Commands and Script Dependencies
|
|
8
|
+
|
|
9
|
+
Functions like [`addBlockCommand`](https://github.com/RoamJS/roamjs-components/blob/main/src/dom/addBlockCommand.ts#L11) allow developers to add new block commands to the Roam Research UI. Script dependencies can be managed using [`addOldRoamJSDependency`](https://github.com/RoamJS/roamjs-components/blob/main/src/dom/addOldRoamJSDependency.ts#L3) and [`addRoamJSDependency`](https://github.com/RoamJS/roamjs-components/blob/main/src/dom/addRoamJSDependency.ts#L3). These functions ensure that necessary scripts are loaded into the application.
|
|
10
|
+
|
|
11
|
+
[See More](https://wiki.mutable.ai/RoamJS/roamjs-components#adding-block-commands-and-script-dependencies)
|
|
12
|
+
|
|
13
|
+
## DOM Observation and Manipulation
|
|
14
|
+
|
|
15
|
+
Utilities such as [`createBlockObserver`](https://github.com/RoamJS/roamjs-components/blob/main/src/dom/createBlockObserver.ts#L3) and [`createHTMLObserver`](https://github.com/RoamJS/roamjs-components/blob/main/src/dom/createHTMLObserver.ts#L4) enable observing changes in the DOM. These functions use [`MutationObserver`](https://github.com/RoamJS/roamjs-components/blob/main/src/types/index.ts#L25) to monitor specific elements and execute callbacks when changes occur. For example, [`createBlockObserver`](https://github.com/RoamJS/roamjs-components/blob/main/src/dom/createBlockObserver.ts#L3) observes changes to Roam blocks, while [`createHTMLObserver`](https://github.com/RoamJS/roamjs-components/blob/main/src/dom/createHTMLObserver.ts#L4) can be configured to watch for any HTML element with a specific tag and class.
|
|
16
|
+
|
|
17
|
+
[See More](https://wiki.mutable.ai/RoamJS/roamjs-components#dom-observation-and-manipulation)
|
|
18
|
+
|
|
19
|
+
## Retrieving and Manipulating Roam-Specific Data
|
|
20
|
+
|
|
21
|
+
Functions like [`getCurrentPageUid`](https://github.com/RoamJS/roamjs-components/blob/main/src/dom/getCurrentPageUid.ts#L1), [`getBlockUidFromTarget`](https://github.com/RoamJS/roamjs-components/blob/main/src/dom/getBlockUidFromTarget.ts#L5), and [`getUids`](https://github.com/RoamJS/roamjs-components/blob/main/src/dom/getUids.ts#L3) are used to retrieve unique identifiers (UIDs) for pages and blocks within Roam Research. These UIDs are essential for various operations, such as linking to specific blocks or pages.
|
|
22
|
+
|
|
23
|
+
[See More](https://wiki.mutable.ai/RoamJS/roamjs-components#retrieving-and-manipulating-roamspecific-data)
|
|
24
|
+
|
|
25
|
+
## URL Generation and Reference Resolution
|
|
26
|
+
|
|
27
|
+
The [`getRoamUrl`](https://github.com/RoamJS/roamjs-components/blob/main/src/dom/getRoamUrl.ts#L1) and [`getRoamUrlByPage`](https://github.com/RoamJS/roamjs-components/blob/main/src/dom/getRoamUrlByPage.ts#L4) functions generate URLs for Roam Research pages and blocks. The [`resolveRefs`](https://github.com/RoamJS/roamjs-components/blob/main/src/dom/resolveRefs.ts#L16) function processes text strings to resolve references, such as alias tags and block references, into their corresponding URLs or text content.
|
|
28
|
+
|
|
29
|
+
[See More](https://wiki.mutable.ai/RoamJS/roamjs-components#url-generation-and-reference-resolution)
|
|
30
|
+
|
|
31
|
+
## Parsing Roam Block Content
|
|
32
|
+
|
|
33
|
+
The [`parseRoamBlocksToHtml`](https://github.com/RoamJS/roamjs-components/blob/main/src/dom/parseRoamBlocksToHtml.ts#L111) function converts Roam block content into HTML. This is useful for rendering Roam content in different contexts, such as exporting notes or displaying them in custom views.
|
|
34
|
+
|
|
35
|
+
[See More](https://wiki.mutable.ai/RoamJS/roamjs-components#parsing-roam-block-content)
|
|
36
|
+
|
|
37
|
+
## Constants
|
|
38
|
+
|
|
39
|
+
The [`BLOCK_REF_REGEX`](https://github.com/RoamJS/roamjs-components/blob/main/src/marked/index.ts#L42) constant, defined in `https://github.com/RoamJS/roamjs-components/blob/main/src/dom/constants.ts`, is a regular expression used to match block references in Roam Research. This regex is critical for identifying and manipulating block references within the application.
|
|
40
|
+
|
|
41
|
+
## Utility Functions
|
|
42
|
+
|
|
43
|
+
- **[`getUidsFromId`](https://github.com/RoamJS/roamjs-components/blob/main/src/dom/getUidsFromId.ts#L1)**: Extracts [`blockUid`](https://github.com/RoamJS/roamjs-components/blob/main/src/dom/getUidsFromId.ts#L3) and [`windowId`](https://github.com/RoamJS/roamjs-components/blob/main/src/dom/getUidsFromId.ts#L5) from an [`id`](https://github.com/RoamJS/roamjs-components/blob/main/src/marked/index.ts#L454) string.
|
|
44
|
+
- **[`getPageTitleValueByHtmlElement`](https://github.com/RoamJS/roamjs-components/blob/main/src/dom/getPageTitleValueByHtmlElement.ts#L4)**: Retrieves the page title value associated with an HTML element.
|
|
45
|
+
- **[`getReferenceBlockUid`](https://github.com/RoamJS/roamjs-components/blob/main/src/dom/getReferenceBlockUid.ts#L5)**: Retrieves the UID of a reference block based on an HTML element.
|
|
46
|
+
- **[`addScriptAsDependency`](https://github.com/RoamJS/roamjs-components/blob/main/src/dom/addScriptAsDependency.ts#L1)**: Adds a script tag to the document's head, ensuring it is only added once.
|
|
47
|
+
- **[`createIconButton`](https://github.com/RoamJS/roamjs-components/blob/main/src/dom/createIconButton.ts#L1)**: Creates an HTML [`<span>`](https://github.com/RoamJS/roamjs-components/blob/main/src/marked/index.ts#L28) element representing an icon button.
|
|
48
|
+
- **[`addStyle`](https://github.com/RoamJS/roamjs-components/blob/main/src/dom/addStyle.ts#L1)**: Adds a new style element to the document.
|
|
49
|
+
- **[`createDivObserver`](https://github.com/RoamJS/roamjs-components/blob/main/src/dom/createDivObserver.ts#L3)**: Sets up a [`MutationObserver`](https://github.com/RoamJS/roamjs-components/blob/main/src/types/index.ts#L25) to monitor changes to a specific DOM element.
|
|
50
|
+
- **[`createOverlayObserver`](https://github.com/RoamJS/roamjs-components/blob/main/src/dom/createOverlayObserver.ts#L3)**: Creates a [`MutationObserver`](https://github.com/RoamJS/roamjs-components/blob/main/src/types/index.ts#L25) that observes changes to the [`document.body`](https://github.com/RoamJS/roamjs-components/blob/main/src/util/runExtension.ts#L51) element.
|
|
51
|
+
- **[`createButtonObserver`](https://github.com/RoamJS/roamjs-components/blob/main/src/dom/createButtonObserver.ts#L3)**: Monitors the DOM for changes to HTML [`<span>`](https://github.com/RoamJS/roamjs-components/blob/main/src/marked/index.ts#L28) elements with a specific class.
|
|
52
|
+
- **[`createPageTitleObserver`](https://github.com/RoamJS/roamjs-components/blob/main/src/dom/createPageTitleObserver.ts#L4)**: Observes changes to the title of a specific Roam Research page.
|
|
53
|
+
- **[`getMutatedNodes`](https://github.com/RoamJS/roamjs-components/blob/main/src/dom/getMutatedNodes.ts#L3)**: Finds nodes in a list of mutation records that match specified criteria.
|
|
54
|
+
- **[`getActiveUids`](https://github.com/RoamJS/roamjs-components/blob/main/src/dom/getActiveUids.ts#L3)**: Retrieves the UIDs of the currently active HTML element on the page.
|
|
55
|
+
- **[`elToTitle`](https://github.com/RoamJS/roamjs-components/blob/main/src/dom/elToTitle.ts#L1)**: Converts a DOM [`Node`](https://github.com/RoamJS/roamjs-components/blob/main/src/dom/createHTMLObserver.ts#L17) to a string representing its title or text content.
|
|
56
|
+
- **[`getDropUidOffset`](https://github.com/RoamJS/roamjs-components/blob/main/src/dom/getDropUidOffset.ts#L5)**: Determines the parent UID and offset of a given HTML [`div`](https://github.com/RoamJS/roamjs-components/blob/main/src/components/Filter.tsx#L81) element within its parent container.
|
|
57
|
+
|
|
58
|
+
These utilities streamline interactions with the DOM, making it easier to build and manage extensions and integrations for Roam Research.
|
package/docs/events.md
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Event Handling
|
|
2
|
+
|
|
3
|
+
https://github.com/RoamJS/roamjs-components/blob/main/src/events
|
|
4
|
+
|
|
5
|
+
Utilities for setting up and managing event listeners in the Roam Research application are centralized in `https://github.com/RoamJS/roamjs-components/blob/main/src/events`. The primary function provided is [`watchOnce`](https://github.com/RoamJS/roamjs-components/blob/main/src/events/watchOnce.ts#L3), which allows for one-time event listening.
|
|
6
|
+
|
|
7
|
+
- [`watchOnce`](https://github.com/RoamJS/roamjs-components/blob/main/src/events/watchOnce.ts#L3) is designed to monitor changes in a specific Roam Research block and execute a callback function when a change is detected.
|
|
8
|
+
- It takes three parameters: [`pullPattern`](https://github.com/RoamJS/roamjs-components/blob/main/src/events/watchOnce.ts#L4) (the pattern to watch for), [`entityId`](https://github.com/RoamJS/roamjs-components/blob/main/src/events/watchOnce.ts#L5) (the block ID to watch), and [`callback`](https://github.com/RoamJS/roamjs-components/blob/main/src/types/index.ts#L128) (the function to execute upon detection).
|
|
9
|
+
|
|
10
|
+
The function operates as follows:
|
|
11
|
+
|
|
12
|
+
- Sets up a watcher using [`window.roamAlphaAPI.data.addPullWatch()`](https://github.com/RoamJS/roamjs-components/blob/main/src/events/watchOnce.ts#L14), passing the [`pullPattern`](https://github.com/RoamJS/roamjs-components/blob/main/src/events/watchOnce.ts#L4), [`entityId`](https://github.com/RoamJS/roamjs-components/blob/main/src/events/watchOnce.ts#L5), and a custom watcher function.
|
|
13
|
+
- The custom watcher function invokes the [`callback`](https://github.com/RoamJS/roamjs-components/blob/main/src/types/index.ts#L128) with [`before`](https://github.com/RoamJS/roamjs-components/blob/main/src/util/renderOverlay.ts#L34) and [`after`](https://github.com/RoamJS/roamjs-components/blob/main/src/events/watchOnce.ts#L6) [`PullBlock`](https://github.com/RoamJS/roamjs-components/blob/main/src/types/native.ts#L171) objects.
|
|
14
|
+
- If the [`callback`](https://github.com/RoamJS/roamjs-components/blob/main/src/types/index.ts#L128) returns [`true`](/roamjs-components/tsconfig.json#L9), the watcher is removed using [`window.roamAlphaAPI.data.removePullWatch()`](https://github.com/RoamJS/roamjs-components/blob/main/src/events/watchOnce.ts#L10).
|
|
15
|
+
|
|
16
|
+
This utility is useful for scenarios where an action needs to be performed once upon a block's update, such as updating a visualization or triggering a notification.
|
package/docs/hooks.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Hooks
|
|
2
|
+
|
|
3
|
+
https://github.com/RoamJS/roamjs-components/blob/main/src/hooks
|
|
4
|
+
|
|
5
|
+
Custom React hooks in this codebase manage user interactions and data structures.
|
|
6
|
+
|
|
7
|
+
[`useArrowKeyDown`](https://github.com/RoamJS/roamjs-components/blob/main/src/hooks/useArrowKeyDown.ts#L13) handles keyboard navigation within a list of results. It takes three parameters: [`results`](https://github.com/RoamJS/roamjs-components/blob/main/src/testing/mockRoamEnvironment.ts#L1147), [`onEnter`](https://github.com/RoamJS/roamjs-components/blob/main/src/hooks/useArrowKeyDown.ts#L15), and [`menuRef`](https://github.com/RoamJS/roamjs-components/blob/main/src/components/CursorMenu.tsx#L115). The hook maintains the [`activeIndex`](https://github.com/RoamJS/roamjs-components/blob/main/src/hooks/useArrowKeyDown.ts#L22) state to track the selected item in the list. The [`onKeyDown`](https://github.com/RoamJS/roamjs-components/blob/main/src/hooks/useArrowKeyDown.ts#L23) function processes key presses:
|
|
8
|
+
|
|
9
|
+
- **ArrowDown**: Increments [`activeIndex`](https://github.com/RoamJS/roamjs-components/blob/main/src/hooks/useArrowKeyDown.ts#L22), wrapping to 0 if the end of the list is reached, and ensures the selected element is in view.
|
|
10
|
+
- **ArrowUp**: Decrements [`activeIndex`](https://github.com/RoamJS/roamjs-components/blob/main/src/hooks/useArrowKeyDown.ts#L22), wrapping to the last index if the beginning is reached, and ensures the selected element is in view.
|
|
11
|
+
- **Enter**: Calls [`onEnter`](https://github.com/RoamJS/roamjs-components/blob/main/src/hooks/useArrowKeyDown.ts#L15) with the selected item and resets [`activeIndex`](https://github.com/RoamJS/roamjs-components/blob/main/src/hooks/useArrowKeyDown.ts#L22).
|
|
12
|
+
|
|
13
|
+
[`useSubTree`](https://github.com/RoamJS/roamjs-components/blob/main/src/hooks/useSubTree.ts#L4) manages a sub-tree data structure. It takes [`props`](https://github.com/RoamJS/roamjs-components/blob/main/src/types/native.ts#L187) and uses [`useMemo`](https://github.com/RoamJS/roamjs-components/blob/main/src/components.tsx#L2) to memoize the result of [`getSubTree(props)`](https://github.com/RoamJS/roamjs-components/blob/main/src/hooks/useSubTree.ts#L8), based on the [`parentUid`](https://github.com/RoamJS/roamjs-components/blob/main/src/components/FormDialog.tsx#L97) property. This hook returns the current sub-tree object and a function to update it.
|
|
14
|
+
|
|
15
|
+
Both hooks are exported from `https://github.com/RoamJS/roamjs-components/blob/main/src/hooks/index.ts`.
|
package/docs/marked.md
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# Markdown Parsing and Rendering
|
|
2
|
+
|
|
3
|
+
https://github.com/RoamJS/roamjs-components/blob/main/src/marked
|
|
4
|
+
|
|
5
|
+
Markdown content is parsed and rendered using a custom implementation of the [`marked`](https://github.com/RoamJS/roamjs-components/blob/main/src/marked/index.ts#L14) library, tailored for Roam Research. The main entry point for this functionality is in `https://github.com/RoamJS/roamjs-components/blob/main/src/marked/index.ts`.
|
|
6
|
+
|
|
7
|
+
- **Language Syntax Highlighting**: Various language syntax highlighters from the [`refractor`](https://github.com/RoamJS/roamjs-components/blob/main/src/marked/index.ts#L2) library are registered, including Markdown, YAML, CSS, Bash, Java, Rust, Python, C#, Clojure, and HCL.
|
|
8
|
+
|
|
9
|
+
- **Regular Expressions**: Several regular expressions are defined to match different types of Markdown elements:
|
|
10
|
+
|
|
11
|
+
- [`URL_REGEX`](https://github.com/RoamJS/roamjs-components/blob/main/src/marked/index.ts#L32): Matches URLs
|
|
12
|
+
- [`TODO_REGEX`](https://github.com/RoamJS/roamjs-components/blob/main/src/marked/index.ts#L34): Matches TODO items
|
|
13
|
+
- [`DONE_REGEX`](https://github.com/RoamJS/roamjs-components/blob/main/src/marked/index.ts#L35): Matches DONE items
|
|
14
|
+
- [`IFRAME_REGEX`](https://github.com/RoamJS/roamjs-components/blob/main/src/marked/index.ts#L36): Matches iframes
|
|
15
|
+
- [`BUTTON_REGEX`](https://github.com/RoamJS/roamjs-components/blob/main/src/marked/index.ts#L39): Matches buttons
|
|
16
|
+
- [`TAG_REGEX`](https://github.com/RoamJS/roamjs-components/blob/main/src/marked/index.ts#L41): Matches tags
|
|
17
|
+
- [`BLOCK_REF_REGEX`](https://github.com/RoamJS/roamjs-components/blob/main/src/marked/index.ts#L42): Matches block references
|
|
18
|
+
- [`ALIAS_REGEX`](https://github.com/RoamJS/roamjs-components/blob/main/src/marked/index.ts#L45): Matches aliases
|
|
19
|
+
- [`ALIAS_REF_REGEX`](https://github.com/RoamJS/roamjs-components/blob/main/src/marked/index.ts#L46): Matches alias references
|
|
20
|
+
- [`HASHTAG_REGEX`](https://github.com/RoamJS/roamjs-components/blob/main/src/marked/index.ts#L47): Matches hashtags
|
|
21
|
+
- [`ATTRIBUTE_REGEX`](https://github.com/RoamJS/roamjs-components/blob/main/src/marked/index.ts#L48): Matches attributes
|
|
22
|
+
- [`BOLD_REGEX`](https://github.com/RoamJS/roamjs-components/blob/main/src/marked/index.ts#L49): Matches bold text
|
|
23
|
+
- [`ITALICS_REGEX`](https://github.com/RoamJS/roamjs-components/blob/main/src/marked/index.ts#L50): Matches italicized text
|
|
24
|
+
- [`HIGHLIGHT_REGEX`](https://github.com/RoamJS/roamjs-components/blob/main/src/marked/index.ts#L51): Matches highlighted text
|
|
25
|
+
- [`INLINE_STOP_REGEX`](https://github.com/RoamJS/roamjs-components/blob/main/src/marked/index.ts#L52): Matches various inline elements that should stop the parsing of inline text
|
|
26
|
+
- [`HR_REGEX`](https://github.com/RoamJS/roamjs-components/blob/main/src/marked/index.ts#L54): Matches horizontal rules
|
|
27
|
+
- [`BQ_REGEX`](https://github.com/RoamJS/roamjs-components/blob/main/src/marked/index.ts#L55): Matches blockquotes
|
|
28
|
+
- [`TWEET_STATUS_REGEX`](https://github.com/RoamJS/roamjs-components/blob/main/src/marked/index.ts#L56): Matches Twitter status URLs
|
|
29
|
+
|
|
30
|
+
- **Custom Options ([`opts`](https://github.com/RoamJS/roamjs-components/blob/main/src/marked/index.ts#L121))**: Extends the default [`marked`](https://github.com/RoamJS/roamjs-components/blob/main/src/marked/index.ts#L14) options to handle:
|
|
31
|
+
|
|
32
|
+
- HTML tags
|
|
33
|
+
- Strikethrough text
|
|
34
|
+
- Bold and italicized text
|
|
35
|
+
- Code blocks
|
|
36
|
+
- Inline text
|
|
37
|
+
- Code spans
|
|
38
|
+
|
|
39
|
+
- **Custom Renderer ([`renderer`](https://github.com/RoamJS/roamjs-components/blob/main/src/marked/index.ts#L426))**: Extends the default [`marked`](https://github.com/RoamJS/roamjs-components/blob/main/src/marked/index.ts#L14) renderer to handle:
|
|
40
|
+
|
|
41
|
+
- Different types of links
|
|
42
|
+
- Code spans with syntax highlighting
|
|
43
|
+
- Various HTML elements
|
|
44
|
+
|
|
45
|
+
- **Exported Functions**: Several functions wrap the [`marked`](https://github.com/RoamJS/roamjs-components/blob/main/src/marked/index.ts#L14) library's functionality, allowing for contextual parsing of Markdown text based on a provided [`RoamContext`](https://github.com/RoamJS/roamjs-components/blob/main/src/marked/index.ts#L563) object:
|
|
46
|
+
- [`getInlineLexer`](https://github.com/RoamJS/roamjs-components/blob/main/src/marked/index.ts#L602)
|
|
47
|
+
- [`getLexer`](https://github.com/RoamJS/roamjs-components/blob/main/src/marked/index.ts#L603)
|
|
48
|
+
- [`getParseInline`](https://github.com/RoamJS/roamjs-components/blob/main/src/marked/index.ts#L604)
|
|
49
|
+
- [`getParse`](https://github.com/RoamJS/roamjs-components/blob/main/src/marked/index.ts#L605)
|
|
50
|
+
- [`inlineLexer`](https://github.com/RoamJS/roamjs-components/blob/main/src/marked/index.ts#L615)
|
|
51
|
+
- [`lexer`](https://github.com/RoamJS/roamjs-components/blob/main/src/marked/index.ts#L616)
|
|
52
|
+
- [`parseInline`](https://github.com/RoamJS/roamjs-components/blob/main/src/marked/index.ts#L617)
|
|
53
|
+
- [`parse`](https://github.com/RoamJS/roamjs-components/blob/main/src/date/parseNlpDate.ts#L253)
|
|
54
|
+
- [`default`](https://github.com/RoamJS/roamjs-components/blob/main/src/dom/index.ts#L2) (exports the [`parse`](https://github.com/RoamJS/roamjs-components/blob/main/src/date/parseNlpDate.ts#L253) function)
|
|
55
|
+
|
|
56
|
+
These customizations ensure that Roam-specific elements and formatting are correctly handled within the Markdown content.
|
package/docs/queries.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Queries
|
|
2
|
+
|
|
3
|
+
https://github.com/RoamJS/roamjs-components/blob/main/src/queries
|
|
4
|
+
|
|
5
|
+
Utility functions for interacting with the Roam Research database are provided in the `https://github.com/RoamJS/roamjs-components/blob/main/src/queries` directory. These functions facilitate various operations, including retrieving and manipulating data.
|
|
6
|
+
|
|
7
|
+
- **Datalog Compilation**: The [`compileDatalog`](https://github.com/RoamJS/roamjs-components/blob/main/src/queries/compileDatalog.ts#L5) function in `https://github.com/RoamJS/roamjs-components/blob/main/src/queries/compileDatalog.ts` compiles Datalog-related constructs into string representations. This includes data patterns, source variables, constants, variables, function expressions, predicate expressions, rule expressions, and different types of clauses (not, or, and, not-join, or-join).
|
|
8
|
+
|
|
9
|
+
- **Attribute Retrieval**: The [`getAttributeValueByBlockAndName`](https://github.com/RoamJS/roamjs-components/blob/main/src/queries/getAttributeValueByBlockAndName.ts#L4) function in `https://github.com/RoamJS/roamjs-components/blob/main/src/queries/getAttributeValueByBlockAndName.ts` retrieves the value of an attribute associated with a specific block. It uses a Datalog query to find the block with the given attribute name and parent UID, then extracts and returns the attribute value.
|
|
10
|
+
|
|
11
|
+
- **Utility Functions**:
|
|
12
|
+
- [`isTagOnPage`](https://github.com/RoamJS/roamjs-components/blob/main/src/queries/isTagOnPage.ts#L3) in `https://github.com/RoamJS/roamjs-components/blob/main/src/queries/isTagOnPage.ts` checks if a given tag is present on a specific page. It normalizes the tag and title, then uses a Datalog query to determine if the tag exists on the page.
|
|
13
|
+
- [`normalizePageTitle`](https://github.com/RoamJS/roamjs-components/blob/main/src/queries/normalizePageTitle.ts#L1) in `https://github.com/RoamJS/roamjs-components/blob/main/src/queries/normalizePageTitle.ts` normalizes a page title by replacing backslashes and double quotes with their escaped counterparts.
|
|
14
|
+
|
|
15
|
+
These utility functions are essential for efficiently interacting with the Roam Research database, enabling complex queries and data manipulations. For more detailed information on specific operations, refer to the respective sections on
|
|
16
|
+
|
|
17
|
+
- [Block Retrieval](https://wiki.mutable.ai/RoamJS/roamjs-components#block-retrieval)
|
|
18
|
+
- [Page Retrieval](https://wiki.mutable.ai/RoamJS/roamjs-components#page-retrieval)
|
|
19
|
+
- [User Information](https://wiki.mutable.ai/RoamJS/roamjs-components#user-information)
|
|
20
|
+
- [Block Hierarchy](https://wiki.mutable.ai/RoamJS/roamjs-components#block-hierarchy)
|
|
21
|
+
- [Block Metadata](https://wiki.mutable.ai/RoamJS/roamjs-components#block-metadata)
|
|
22
|
+
- [Attribute Retrieval](https://wiki.mutable.ai/RoamJS/roamjs-components#attribute-retrieval)
|
|
23
|
+
- [Datalog Compilation](https://wiki.mutable.ai/RoamJS/roamjs-components#datalog-compilation)
|
|
24
|
+
- [Utility Functions](https://wiki.mutable.ai/RoamJS/roamjs-components#utility-functions)
|
package/docs/scripts.md
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Script Management
|
|
2
|
+
|
|
3
|
+
https://github.com/RoamJS/roamjs-components/blob/main/src/scripts
|
|
4
|
+
|
|
5
|
+
The `https://github.com/RoamJS/roamjs-components/blob/main/src/scripts` directory contains two main files: [`index.ts`](https://github.com/RoamJS/roamjs-components/blob/main/src/dom/index.ts#L0) and [`publishToRoamDepot.ts`](https://github.com/RoamJS/roamjs-components/blob/main/src/scripts/publishToRoamDepot.ts#L0).
|
|
6
|
+
|
|
7
|
+
- The [`index.ts`](https://github.com/RoamJS/roamjs-components/blob/main/src/dom/index.ts#L0) file serves as an entry point for the `@samepage/scripts/cli` module. This module provides command-line interface (CLI) functionality for the project.
|
|
8
|
+
|
|
9
|
+
- The [`publishToRoamDepot.ts`](https://github.com/RoamJS/roamjs-components/blob/main/src/scripts/publishToRoamDepot.ts#L0) file contains the [`publishToRoamDepot`](https://github.com/RoamJS/roamjs-components/blob/main/src/scripts/publishToRoamDepot.ts#L15) function, which is responsible for publishing a Roam extension to the Roam Depot. The function performs several key tasks:
|
|
10
|
+
- Checks for existing pull requests for the current branch in the Roam Depot repository using the GitHub API.
|
|
11
|
+
- Clones the Roam Depot repository using [`execSync()`](https://github.com/RoamJS/roamjs-components/blob/main/src/scripts/publishToRoamDepot.ts#L5).
|
|
12
|
+
- Determines the path to the extension manifest file based on provided [`proxy`](https://github.com/RoamJS/roamjs-components/blob/main/src/scripts/publishToRoamDepot.ts#L19) and [`repo`](https://github.com/RoamJS/roamjs-components/blob/main/src/scripts/publishToRoamDepot.ts#L17) parameters.
|
|
13
|
+
- Retrieves the author's name and email from the GitHub API or falls back to [`package.json`](/roamjs-components/package.json#L109) if the API call fails.
|
|
14
|
+
- Configures Git user information using [`execSync()`](https://github.com/RoamJS/roamjs-components/blob/main/src/scripts/publishToRoamDepot.ts#L5).
|
|
15
|
+
- Adds the Roam Depot repository as a remote and pulls the latest changes from the [`main`](/roamjs-components/package.json#L5) branch.
|
|
16
|
+
- If an existing pull request is found, it checks out the branch, rebases it against [`main`](/roamjs-components/package.json#L5), updates the [`source_commit`](https://github.com/RoamJS/roamjs-components/blob/main/src/scripts/publishToRoamDepot.ts#L70) field in the manifest file, commits the changes, and pushes the updated branch.
|
|
17
|
+
- If no existing pull request is found, it creates a new branch, creates the extension manifest file if it doesn't exist, populates it with necessary information, commits the changes, and pushes the new branch.
|
|
18
|
+
- Creates a new pull request in the Roam Depot repository using the GitHub API and logs the URL of the created or updated pull request.
|
|
19
|
+
|
|
20
|
+
The [`publishToRoamDepot`](https://github.com/RoamJS/roamjs-components/blob/main/src/scripts/publishToRoamDepot.ts#L15) function uses several utility functions and libraries, such as the GitHub API and [`execSync()`](https://github.com/RoamJS/roamjs-components/blob/main/src/scripts/publishToRoamDepot.ts#L5) from the [`child_process`](https://github.com/RoamJS/roamjs-components/blob/main/src/scripts/publishToRoamDepot.ts#L5) module, to perform its tasks. It handles both the creation of new pull requests and the update of existing ones, making it a versatile tool for publishing Roam extensions.
|
package/docs/types.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
## Type Definitions
|
|
2
|
+
|
|
3
|
+
https://github.com/RoamJS/roamjs-components/blob/main/src/types
|
|
4
|
+
|
|
5
|
+
The `https://github.com/RoamJS/roamjs-components/blob/main/src/types` directory defines the core types and interfaces used throughout the Roam Research extension ecosystem. These types cover a wide range of functionalities, from data structures and queries to user interface components and SmartBlocks.
|
|
6
|
+
|
|
7
|
+
The [`index.ts`](https://github.com/RoamJS/roamjs-components/blob/main/src/dom/index.ts#L0) file serves as the entry point, importing and re-exporting types from other modules such as [`native`](https://github.com/RoamJS/roamjs-components/blob/main/src/types/native.ts#L0), [`query-builder`](https://github.com/RoamJS/roamjs-components/blob/main/src/types/query-builder.ts#L0), and [`smartblocks`](https://github.com/RoamJS/roamjs-components/blob/main/src/types/index.ts#L15). It also defines the [`Registry`](https://github.com/RoamJS/roamjs-components/blob/main/src/types/index.ts#L22) type, which centralizes the storage of various elements, event listeners, and other state used by the extension. Additionally, it extends the global [`Window`](https://github.com/RoamJS/roamjs-components/blob/main/src/types/index.ts#L57) object with Roam Research-specific APIs and utilities, including the [`roamAlphaAPI`](https://github.com/RoamJS/roamjs-components/blob/main/src/types/index.ts#L83) and [`roamjs`](https://github.com/RoamJS/roamjs-components/blob/main/src/types/index.ts#L234) namespaces.
|
|
8
|
+
|
|
9
|
+
The [`native.ts`](https://github.com/RoamJS/roamjs-components/blob/main/src/types/native.ts#L0) file provides a comprehensive set of types for working with the Roam Research application. Key types include:
|
|
10
|
+
|
|
11
|
+
- **Datalog Types**: These types, such as [`DatalogSrcVar`](https://github.com/RoamJS/roamjs-components/blob/main/src/types/native.ts#L6) and [`DatalogVariable`](https://github.com/RoamJS/roamjs-components/blob/main/src/types/native.ts#L11), model the structure of Datalog queries, which are integral to the Roam Research data model.
|
|
12
|
+
- **Roam Research Data Structures**: Types like [`RoamBasicBlock`](https://github.com/RoamJS/roamjs-components/blob/main/src/types/native.ts#L139), [`RoamBasicPage`](https://github.com/RoamJS/roamjs-components/blob/main/src/types/native.ts#L144), and [`RoamBasicNode`](https://github.com/RoamJS/roamjs-components/blob/main/src/types/native.ts#L146) represent the various elements of Roam Research, such as blocks, pages, and nodes.
|
|
13
|
+
- **User Interface Components**: Types such as [`Action`](https://github.com/RoamJS/roamjs-components/blob/main/src/types/native.ts#L447), [`ButtonAction`](https://github.com/RoamJS/roamjs-components/blob/main/src/types/native.ts#L419), and [`SwitchAction`](https://github.com/RoamJS/roamjs-components/blob/main/src/types/native.ts#L425) model the user interface components that can be added to the Roam Research application.
|
|
14
|
+
- **Client-Side Actions**: Types like [`ClientParams`](https://github.com/RoamJS/roamjs-components/blob/main/src/types/native.ts#L324) and [`ActionParams`](https://github.com/RoamJS/roamjs-components/blob/main/src/types/native.ts#L341) represent the parameters for various client-side actions, such as creating or updating blocks and pages.
|
|
15
|
+
- **User Settings**: The [`UserSettings`](https://github.com/RoamJS/roamjs-components/blob/main/src/types/native.ts#L363) type represents the user settings for the Roam Research application.
|
|
16
|
+
- **Sidebar Functionality**: Types like [`SidebarWindowInput`](https://github.com/RoamJS/roamjs-components/blob/main/src/types/native.ts#L376) and [`SidebarBlockWindow`](https://github.com/RoamJS/roamjs-components/blob/main/src/types/native.ts#L381) model the sidebar functionality of the Roam Research application.
|
|
17
|
+
|
|
18
|
+
The [`query-builder.ts`](https://github.com/RoamJS/roamjs-components/blob/main/src/types/query-builder.ts#L0) file defines types related to querying and working with data in [Query Builder](https://github.com/RoamJS/query-builder). Key types include:
|
|
19
|
+
|
|
20
|
+
- **Result**: Represents the result of a query, containing fields like [`text`](https://github.com/RoamJS/roamjs-components/blob/main/src/marked/index.ts#L211) and [`uid`](https://github.com/RoamJS/roamjs-components/blob/main/src/util/getOauth.ts#L45).
|
|
21
|
+
- **RunQuery** and **RunQuerySync**: Function types that execute a query and return the results.
|
|
22
|
+
- **ListActiveQueries**: A function type that returns active queries.
|
|
23
|
+
- **IsDiscourseNode**: A function type that determines if a node is a discourse node.
|
|
24
|
+
|
|
25
|
+
The [`smartblocks.ts`](https://github.com/RoamJS/roamjs-components/blob/main/src/types/smartblocks.ts#L0) file defines types and interfaces used in the [SmartBlocks](https://github.com/RoamJS/smartblocks) extension. Key types include:
|
|
26
|
+
|
|
27
|
+
- **CommandOutput**: Represents the output of a command handler.
|
|
28
|
+
- **CommandHandler**: A function type that handles commands.
|
|
29
|
+
- **SmartBlocksContext**: Represents the context in which a SmartBlock is executed.
|
|
30
|
+
- **RegisterCommand** and **UnregisterCommand**: Function types for registering and unregistering commands.
|
|
31
|
+
|
|
32
|
+
These types are essential for building robust and extensible Roam Research applications and integrations. For more detailed information on specific types, refer to the subsections on [Index Types](https://wiki.mutable.ai/RoamJS/roamjs-components#index-types), [Native Types](https://wiki.mutable.ai/RoamJS/roamjs-components#native-types), [Query Builder Types](https://wiki.mutable.ai/RoamJS/roamjs-components#query-builder-types), and [SmartBlocks Types](https://wiki.mutable.ai/RoamJS/roamjs-components#smartblocks-types).
|
package/docs/util.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
## Utility Functions
|
|
2
|
+
|
|
3
|
+
https://github.com/RoamJS/roamjs-components/blob/main/src/util
|
|
4
|
+
|
|
5
|
+
Utility functions in the RoamJS ecosystem provide essential support for various operations, including API interactions, DOM manipulation, data extraction, settings management, extension management, and miscellaneous tasks.
|
|
6
|
+
|
|
7
|
+
## API Interaction Utilities
|
|
8
|
+
|
|
9
|
+
Functions like [`apiDelete()`](https://github.com/RoamJS/roamjs-components/blob/main/src/util/apiDelete.ts#L3), [`apiGet()`](https://github.com/RoamJS/roamjs-components/blob/main/src/util/apiGet.ts#L3), [`apiPost()`](https://github.com/RoamJS/roamjs-components/blob/main/src/util/apiPost.ts#L3), and [`apiPut()`](https://github.com/RoamJS/roamjs-components/blob/main/src/util/apiPut.ts#L3) standardize HTTP requests, while [`getOauth()`](https://github.com/RoamJS/roamjs-components/blob/main/src/util/getOauth.ts#L8) and [`getOauthAccounts()`](https://github.com/RoamJS/roamjs-components/blob/main/src/util/getOauthAccounts.ts#L7) manage OAuth authentication. For more details, see [API Interaction Utilities](https://wiki.mutable.ai/RoamJS/roamjs-components#api-interaction-utilities).
|
|
10
|
+
|
|
11
|
+
## DOM and Rendering Utilities
|
|
12
|
+
|
|
13
|
+
Utilities such as [`createOverlayRender()`](https://github.com/RoamJS/roamjs-components/blob/main/src/util/createOverlayRender.ts#L4), [`getRenderRoot()`](https://github.com/RoamJS/roamjs-components/blob/main/src/util/getRenderRoot.ts#L3), and [`renderOverlay()`](https://github.com/RoamJS/roamjs-components/blob/main/src/util/renderOverlay.ts#L16) facilitate DOM manipulation and component rendering within the Roam application. For more details, see [DOM and Rendering Utilities](https://wiki.mutable.ai/RoamJS/roamjs-components#dom-and-rendering-utilities).
|
|
14
|
+
|
|
15
|
+
## Data Extraction and Transformation Utilities
|
|
16
|
+
|
|
17
|
+
Functions like [`extractRef()`](https://github.com/RoamJS/roamjs-components/blob/main/src/util/extractRef.ts#L3), [`extractTag()`](https://github.com/RoamJS/roamjs-components/blob/main/src/util/extractTag.ts#L1), and [`createTagRegex()`](https://github.com/RoamJS/roamjs-components/blob/main/src/util/createTagRegex.ts#L1) handle the extraction and transformation of data from Roam page content. For more details, see [Data Extraction and Transformation Utilities](https://wiki.mutable.ai/RoamJS/roamjs-components#setting-and-configuration-utilities).
|
|
18
|
+
|
|
19
|
+
## Setting and Configuration Utilities
|
|
20
|
+
|
|
21
|
+
Utilities such as [`addInputSetting()`](https://github.com/RoamJS/roamjs-components/blob/main/src/util/addInputSetting.ts#L5), [`setInputSetting()`](https://github.com/RoamJS/roamjs-components/blob/main/src/util/setInputSetting.ts#L6), and [`getSettingValueFromTree()`](https://github.com/RoamJS/roamjs-components/blob/main/src/util/getSettingValueFromTree.ts#L5) manage settings and configurations within Roam extensions. For more details, see [Setting and Configuration Utilities](https://wiki.mutable.ai/RoamJS/roamjs-components#extension-management-utilities).
|
|
22
|
+
|
|
23
|
+
## Extension Management Utilities
|
|
24
|
+
|
|
25
|
+
Functions like [`extensionDeprecatedWarning()`](https://github.com/RoamJS/roamjs-components/blob/main/src/util/extensionDeprecatedWarning.ts#L11) and [`runExtension()`](https://github.com/RoamJS/roamjs-components/blob/main/src/util/runExtension.ts#L22) manage and run Roam extensions. For more details, see [Extension Management Utilities](https://wiki.mutable.ai/RoamJS/roamjs-components#extension-management-utilities).
|
|
26
|
+
|
|
27
|
+
## Miscellaneous Utilities
|
|
28
|
+
|
|
29
|
+
Various other utilities include [`isControl()`](https://github.com/RoamJS/roamjs-components/blob/main/src/util/isControl.ts#L1), [`toFlexRegex()`](https://github.com/RoamJS/roamjs-components/blob/main/src/util/toFlexRegex.ts#L1), and [`getWorkerClient()`](https://github.com/RoamJS/roamjs-components/blob/main/src/util/getWorkerClient.ts#L1), which handle tasks like checking DOM elements and interacting with web workers.
|
|
30
|
+
|
|
31
|
+
## Key Design Choices and Important Implementations
|
|
32
|
+
|
|
33
|
+
- **OAuth Management**: [`getOauth()`](https://github.com/RoamJS/roamjs-components/blob/main/src/util/getOauth.ts#L8) retrieves OAuth information from local storage or the Roam Research database, ensuring efficient access to authentication data.
|
|
34
|
+
- **Overlay Rendering**: [`createOverlayRender()`](https://github.com/RoamJS/roamjs-components/blob/main/src/util/createOverlayRender.ts#L4) and [`renderOverlay()`](https://github.com/RoamJS/roamjs-components/blob/main/src/util/renderOverlay.ts#L16) manage the rendering of React components as overlays, providing a flexible way to display modal content.
|
|
35
|
+
- **Extension Lifecycle Management**: [`runExtension()`](https://github.com/RoamJS/roamjs-components/blob/main/src/util/runExtension.ts#L22) handles the setup and cleanup of Roam extensions, including event listeners and registry management.
|
|
36
|
+
- **Settings Management**: [`setInputSetting()`](https://github.com/RoamJS/roamjs-components/blob/main/src/util/setInputSetting.ts#L6) and [`getSettingValueFromTree()`](https://github.com/RoamJS/roamjs-components/blob/main/src/util/getSettingValueFromTree.ts#L5) streamline the process of managing input settings within Roam blocks, ensuring consistent configuration handling.
|
|
37
|
+
|
|
38
|
+
These utilities are designed to be reusable and modular, promoting code organization and maintainability across the RoamJS ecosystem.
|
package/docs/writes.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Write Operations
|
|
2
|
+
|
|
3
|
+
https://github.com/RoamJS/roamjs-components/blob/main/src/writes
|
|
4
|
+
|
|
5
|
+
`https://github.com/RoamJS/roamjs-components/blob/main/src/writes` contains functions that handle various write operations in a Roam. These functions include clearing, creating, updating, and deleting blocks, as well as creating pages and managing sidebar operations.
|
|
6
|
+
|
|
7
|
+
- [`clearBlockById`](https://github.com/RoamJS/roamjs-components/blob/main/src/writes/clearBlockById.ts#L4): Clears the content of a block by its ID. It uses [`getUidsFromId`](https://github.com/RoamJS/roamjs-components/blob/main/src/dom/getUidsFromId.ts#L1) to extract the block UID and then calls [`submitActions`](https://github.com/RoamJS/roamjs-components/blob/main/src/writes/submitActions.ts#L19) to update the block content to an empty string.
|
|
8
|
+
- [`clearBlockByUid`](https://github.com/RoamJS/roamjs-components/blob/main/src/writes/clearBlockByUid.ts#L3): Clears the content of a block by its UID. It directly calls [`submitActions`](https://github.com/RoamJS/roamjs-components/blob/main/src/writes/submitActions.ts#L19) with an update action to set the block content to an empty string.
|
|
9
|
+
- [`createBlock`](https://github.com/RoamJS/roamjs-components/blob/main/src/writes/createBlock.ts#L41): Creates a new block with the provided content and options. It gathers the necessary actions using [`gatherActions`](https://github.com/RoamJS/roamjs-components/blob/main/src/writes/createBlock.ts#L4) and submits them using [`submitActions`](https://github.com/RoamJS/roamjs-components/blob/main/src/writes/submitActions.ts#L19).
|
|
10
|
+
- [`createPage`](https://github.com/RoamJS/roamjs-components/blob/main/src/writes/createPage.ts#L6): Creates a new page with the provided title. It checks if the title matches a daily note pattern and generates a UID if necessary. It then submits actions to create the page and any child blocks using [`submitActions`](https://github.com/RoamJS/roamjs-components/blob/main/src/writes/submitActions.ts#L19).
|
|
11
|
+
- [`deleteBlock`](https://github.com/RoamJS/roamjs-components/blob/main/src/writes/deleteBlock.ts#L3): Deletes a block by its UID. It submits a delete action using [`submitActions`](https://github.com/RoamJS/roamjs-components/blob/main/src/writes/submitActions.ts#L19).
|
|
12
|
+
- [`openBlockInSidebar`](https://github.com/RoamJS/roamjs-components/blob/main/src/writes/openBlockInSidebar.ts#L1): Opens a block in the sidebar. It checks if the block is already open in the sidebar and either opens the sidebar or adds a new window with the block UID.
|
|
13
|
+
- [`updateActiveBlock`](https://github.com/RoamJS/roamjs-components/blob/main/src/writes/updateActiveBlock.ts#L4): Updates the content of the currently active block. It retrieves the active block UID using [`getActiveUids`](https://github.com/RoamJS/roamjs-components/blob/main/src/dom/getActiveUids.ts#L3) and submits an update action using [`submitActions`](https://github.com/RoamJS/roamjs-components/blob/main/src/writes/submitActions.ts#L19).
|
|
14
|
+
- [`updateBlock`](https://github.com/RoamJS/roamjs-components/blob/main/src/writes/updateBlock.ts#L4): Updates the properties of a block, including text, heading, text alignment, view type, and open state. It submits these updates using [`submitActions`](https://github.com/RoamJS/roamjs-components/blob/main/src/writes/submitActions.ts#L19).
|
|
15
|
+
|
|
16
|
+
The [`submitActions`](https://github.com/RoamJS/roamjs-components/blob/main/src/writes/submitActions.ts#L19) function is central to these operations, handling the submission of various actions to the Roam Research API. It manages an action queue and retries actions in case of API errors.
|
|
17
|
+
|
|
18
|
+
For more details on see
|
|
19
|
+
|
|
20
|
+
- [Block Operations](https://wiki.mutable.ai/RoamJS/roamjs-components#block-operations)
|
|
21
|
+
- [Page Operations](https://wiki.mutable.ai/RoamJS/roamjs-components#page-operations)
|
|
22
|
+
- [Sidebar Operations](https://wiki.mutable.ai/RoamJS/roamjs-components#sidebar-operations)
|
|
23
|
+
- [Action Submission](https://wiki.mutable.ai/RoamJS/roamjs-components#action-submission)
|