roamjs-components 0.53.2 → 0.53.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +154 -154
- package/backend/emailCatch.d.ts +4 -4
- package/backend/emailCatch.js +11 -11
- package/backend/emailError.d.ts +4 -4
- package/backend/emailError.js +56 -56
- package/backend/getRoamJSUser.d.ts +11 -11
- package/backend/getRoamJSUser.js +30 -30
- package/backend/headers.d.ts +5 -5
- package/backend/headers.js +7 -7
- package/backend/index.d.ts +6 -6
- package/backend/index.js +20 -20
- package/backend/meterRoamJSUser.d.ts +4 -4
- package/backend/meterRoamJSUser.js +14 -14
- package/backend/putRoamJSUser.d.ts +10 -10
- package/backend/putRoamJSUser.js +25 -25
- package/components/BlockErrorBoundary.d.ts +15 -15
- package/components/BlockErrorBoundary.js +27 -27
- package/components/BlockInput.d.ts +12 -12
- package/components/BlockInput.js +53 -53
- package/components/ComponentContainer.d.ts +9 -9
- package/components/ComponentContainer.js +46 -46
- package/components/ConfigPage.d.ts +99 -99
- package/components/ConfigPage.js +751 -751
- package/components/CursorMenu.d.ts +21 -21
- package/components/CursorMenu.js +181 -181
- package/components/Description.d.ts +5 -5
- package/components/Description.js +16 -16
- package/components/ExternalLogin.d.ts +18 -18
- package/components/ExternalLogin.js +131 -131
- package/components/Filter.d.ts +14 -14
- package/components/Filter.js +147 -147
- package/components/Loading.d.ts +4 -4
- package/components/Loading.js +33 -33
- package/components/MenuItemSelect.d.ts +10 -10
- package/components/MenuItemSelect.js +13 -13
- package/components/OauthSelect.d.ts +5 -5
- package/components/OauthSelect.js +25 -25
- package/components/PageInput.d.ts +10 -10
- package/components/PageInput.js +69 -69
- package/components/ServiceComponents.d.ts +49 -49
- package/components/ServiceComponents.js +277 -277
- package/components/SimpleAlert.d.ts +12 -12
- package/components/SimpleAlert.js +38 -38
- package/components/Toast.d.ts +10 -10
- package/components/Toast.js +41 -41
- package/components/TokenDialog.d.ts +11 -11
- package/components/TokenDialog.js +100 -100
- package/components/index.d.ts +15 -15
- package/components/index.js +60 -60
- package/date/constants.d.ts +2 -2
- package/date/constants.js +5 -5
- package/date/index.d.ts +5 -5
- package/date/index.js +13 -13
- package/date/parseRoamDate.d.ts +2 -2
- package/date/parseRoamDate.js +6 -6
- package/date/parseRoamDateUid.d.ts +2 -2
- package/date/parseRoamDateUid.js +6 -6
- package/date/toRoamDate.d.ts +2 -2
- package/date/toRoamDate.js +6 -6
- package/date/toRoamDateUid.d.ts +2 -2
- package/date/toRoamDateUid.js +6 -6
- package/dom/addBlockCommand.d.ts +5 -5
- package/dom/addBlockCommand.js +53 -53
- package/dom/addOldRoamJSDependency.d.ts +2 -2
- package/dom/addOldRoamJSDependency.js +10 -10
- package/dom/addRoamJSDependency.d.ts +2 -2
- package/dom/addRoamJSDependency.js +8 -8
- package/dom/addScriptAsDependency.d.ts +6 -6
- package/dom/addScriptAsDependency.js +16 -16
- package/dom/addStyle.d.ts +2 -2
- package/dom/addStyle.js +14 -14
- package/dom/constants.d.ts +1 -1
- package/dom/constants.js +4 -4
- package/dom/createBlockObserver.d.ts +7 -7
- package/dom/createBlockObserver.js +43 -43
- package/dom/createButtonObserver.d.ts +6 -6
- package/dom/createButtonObserver.js +21 -21
- package/dom/createDivObserver.d.ts +2 -2
- package/dom/createDivObserver.js +8 -8
- package/dom/createHTMLObserver.d.ts +8 -8
- package/dom/createHTMLObserver.js +24 -24
- package/dom/createHashtagObserver.d.ts +5 -5
- package/dom/createHashtagObserver.js +16 -16
- package/dom/createIconButton.d.ts +2 -2
- package/dom/createIconButton.js +12 -12
- package/dom/createObserver.d.ts +2 -2
- package/dom/createObserver.js +6 -6
- package/dom/createOverlayObserver.d.ts +2 -2
- package/dom/createOverlayObserver.js +6 -6
- package/dom/createPageObserver.d.ts +2 -2
- package/dom/createPageObserver.js +34 -34
- package/dom/createPageTitleObserver.d.ts +6 -6
- package/dom/createPageTitleObserver.js +29 -29
- package/dom/genericError.d.ts +4 -4
- package/dom/genericError.js +16 -16
- package/dom/getActiveUids.d.ts +3 -3
- package/dom/getActiveUids.js +6 -6
- package/dom/getBlockUidFromTarget.d.ts +2 -2
- package/dom/getBlockUidFromTarget.js +33 -33
- package/dom/getCurrentPageUid.d.ts +2 -2
- package/dom/getCurrentPageUid.js +6 -6
- package/dom/getDomRefs.d.ts +2 -2
- package/dom/getDomRefs.js +12 -12
- package/dom/getDropUidOffset.d.ts +5 -5
- package/dom/getDropUidOffset.js +27 -27
- package/dom/getMutatedNodes.d.ts +7 -7
- package/dom/getMutatedNodes.js +11 -11
- package/dom/getPageTitleByHtmlElement.d.ts +2 -2
- package/dom/getPageTitleByHtmlElement.js +12 -12
- package/dom/getPageTitleValueByHtmlElement.d.ts +2 -2
- package/dom/getPageTitleValueByHtmlElement.js +27 -27
- package/dom/getReferenceBlockUid.d.ts +2 -2
- package/dom/getReferenceBlockUid.js +18 -18
- package/dom/getRoamUrl.d.ts +2 -2
- package/dom/getRoamUrl.js +4 -4
- package/dom/getRoamUrlByPage.d.ts +2 -2
- package/dom/getRoamUrlByPage.js +10 -10
- package/dom/getUids.d.ts +3 -3
- package/dom/getUids.js +8 -8
- package/dom/getUidsFromButton.d.ts +3 -3
- package/dom/getUidsFromButton.js +9 -9
- package/dom/getUidsFromId.d.ts +5 -5
- package/dom/getUidsFromId.js +15 -15
- package/dom/index.d.ts +31 -31
- package/dom/index.js +65 -65
- package/dom/openBlock.d.ts +2 -2
- package/dom/openBlock.js +6 -6
- package/dom/openBlockElement.d.ts +2 -2
- package/dom/openBlockElement.js +16 -16
- package/dom/parseRoamBlocksToHtml.d.ts +9 -9
- package/dom/parseRoamBlocksToHtml.js +75 -75
- package/dom/resolveRefs.d.ts +2 -2
- package/dom/resolveRefs.js +24 -24
- package/events/index.d.ts +1 -1
- package/events/index.js +8 -8
- package/events/watchOnce.d.ts +3 -3
- package/events/watchOnce.js +11 -11
- package/hooks/index.d.ts +3 -3
- package/hooks/index.js +12 -12
- package/hooks/useArrowKeyDown.d.ts +8 -8
- package/hooks/useArrowKeyDown.js +31 -31
- package/hooks/useRoamJSTokenWarning.d.ts +2 -2
- package/hooks/useRoamJSTokenWarning.js +11 -11
- package/hooks/useSubTree.d.ts +3 -3
- package/hooks/useSubTree.js +11 -11
- package/index.d.ts +11 -11
- package/index.js +14 -14
- package/marked/index.d.ts +14 -14
- package/marked/index.js +518 -518
- package/package.json +86 -86
- package/queries/getAllBlockUids.d.ts +2 -2
- package/queries/getAllBlockUids.js +6 -6
- package/queries/getAllBlockUidsAndTexts.d.ts +5 -5
- package/queries/getAllBlockUidsAndTexts.js +6 -6
- package/queries/getAllPageNames.d.ts +2 -2
- package/queries/getAllPageNames.js +6 -6
- package/queries/getAttributeValueByBlockAndName.d.ts +5 -5
- package/queries/getAttributeValueByBlockAndName.js +11 -11
- package/queries/getBasicTreeByParentUid.d.ts +3 -3
- package/queries/getBasicTreeByParentUid.js +13 -13
- package/queries/getBlockUidAndTextIncludingText.d.ts +5 -5
- package/queries/getBlockUidAndTextIncludingText.js +6 -6
- package/queries/getBlockUidByTextOnPage.d.ts +5 -5
- package/queries/getBlockUidByTextOnPage.js +7 -7
- package/queries/getBlockUidsAndTextsReferencingPage.d.ts +5 -5
- package/queries/getBlockUidsAndTextsReferencingPage.js +11 -11
- package/queries/getBlockUidsByPageTitle.d.ts +2 -2
- package/queries/getBlockUidsByPageTitle.js +8 -8
- package/queries/getBlockUidsReferencingBlock.d.ts +2 -2
- package/queries/getBlockUidsReferencingBlock.js +6 -6
- package/queries/getBlockUidsReferencingPage.d.ts +2 -2
- package/queries/getBlockUidsReferencingPage.js +8 -8
- package/queries/getBlockUidsWithParentUid.d.ts +2 -2
- package/queries/getBlockUidsWithParentUid.js +6 -6
- package/queries/getChildrenLengthByPageUid.d.ts +2 -2
- package/queries/getChildrenLengthByPageUid.js +4 -4
- package/queries/getCreateTimeByBlockUid.d.ts +2 -2
- package/queries/getCreateTimeByBlockUid.js +7 -7
- package/queries/getCurrentUser.d.ts +2 -2
- package/queries/getCurrentUser.js +11 -11
- package/queries/getCurrentUserDisplayName.d.ts +2 -2
- package/queries/getCurrentUserDisplayName.js +13 -13
- package/queries/getCurrentUserEmail.d.ts +2 -2
- package/queries/getCurrentUserEmail.js +13 -13
- package/queries/getCurrentUserUid.d.ts +2 -2
- package/queries/getCurrentUserUid.js +13 -13
- package/queries/getDisplayNameByEmail.d.ts +2 -2
- package/queries/getDisplayNameByEmail.js +7 -7
- package/queries/getDisplayNameByUid.d.ts +2 -2
- package/queries/getDisplayNameByUid.js +7 -7
- package/queries/getEditTimeByBlockUid.d.ts +2 -2
- package/queries/getEditTimeByBlockUid.js +7 -7
- package/queries/getEditedUserEmailByBlockUid.d.ts +2 -2
- package/queries/getEditedUserEmailByBlockUid.js +7 -7
- package/queries/getFirstChildTextByBlockUid.d.ts +2 -2
- package/queries/getFirstChildTextByBlockUid.js +7 -7
- package/queries/getFirstChildUidByBlockUid.d.ts +2 -2
- package/queries/getFirstChildUidByBlockUid.js +5 -5
- package/queries/getFullTreeByParentUid.d.ts +3 -3
- package/queries/getFullTreeByParentUid.js +26 -26
- package/queries/getLinkedPageTitlesUnderUid.d.ts +2 -2
- package/queries/getLinkedPageTitlesUnderUid.js +6 -6
- package/queries/getNthChildUidByBlockUid.d.ts +5 -5
- package/queries/getNthChildUidByBlockUid.js +7 -7
- package/queries/getOrderByBlockUid.d.ts +2 -2
- package/queries/getOrderByBlockUid.js +7 -7
- package/queries/getPageTitleByBlockUid.d.ts +2 -2
- package/queries/getPageTitleByBlockUid.js +7 -7
- package/queries/getPageTitleByPageUid.d.ts +2 -2
- package/queries/getPageTitleByPageUid.js +9 -9
- package/queries/getPageTitleReferencesByPageTitle.d.ts +2 -2
- package/queries/getPageTitleReferencesByPageTitle.js +8 -8
- package/queries/getPageTitlesAndBlockUidsReferencingPage.d.ts +5 -5
- package/queries/getPageTitlesAndBlockUidsReferencingPage.js +8 -8
- package/queries/getPageTitlesAndUidsDirectlyReferencingPage.d.ts +5 -5
- package/queries/getPageTitlesAndUidsDirectlyReferencingPage.js +8 -8
- package/queries/getPageTitlesReferencingBlockUid.d.ts +2 -2
- package/queries/getPageTitlesReferencingBlockUid.js +6 -6
- package/queries/getPageTitlesStartingWithPrefix.d.ts +2 -2
- package/queries/getPageTitlesStartingWithPrefix.js +6 -6
- package/queries/getPageUidByPageTitle.d.ts +2 -2
- package/queries/getPageUidByPageTitle.js +9 -9
- package/queries/getPageViewType.d.ts +3 -3
- package/queries/getPageViewType.js +9 -9
- package/queries/getParentTextByBlockUid.d.ts +2 -2
- package/queries/getParentTextByBlockUid.js +7 -7
- package/queries/getParentTextByBlockUidAndTag.d.ts +5 -5
- package/queries/getParentTextByBlockUidAndTag.js +7 -7
- package/queries/getParentUidByBlockUid.d.ts +2 -2
- package/queries/getParentUidByBlockUid.js +7 -7
- package/queries/getParentUidsOfBlockUid.d.ts +2 -2
- package/queries/getParentUidsOfBlockUid.js +6 -6
- package/queries/getSettingsByEmail.d.ts +3 -3
- package/queries/getSettingsByEmail.js +7 -7
- package/queries/getShallowTreeByParentUid.d.ts +5 -5
- package/queries/getShallowTreeByParentUid.js +10 -10
- package/queries/getTextByBlockUid.d.ts +2 -2
- package/queries/getTextByBlockUid.js +7 -7
- package/queries/index.d.ts +45 -45
- package/queries/index.js +96 -96
- package/queries/isTagOnPage.d.ts +5 -5
- package/queries/isTagOnPage.js +9 -9
- package/queries/normalizePageTitle.d.ts +2 -2
- package/queries/normalizePageTitle.js +4 -4
- package/types/index.d.ts +461 -459
- package/types/index.js +2 -2
- package/types/query-builder.d.ts +16 -16
- package/types/query-builder.js +2 -2
- package/util/addInputSetting.d.ts +7 -7
- package/util/addInputSetting.js +25 -25
- package/util/apiDelete.d.ts +2 -2
- package/util/apiDelete.js +9 -9
- package/util/apiGet.d.ts +2 -2
- package/util/apiGet.js +9 -9
- package/util/apiPost.d.ts +2 -2
- package/util/apiPost.js +9 -9
- package/util/apiPut.d.ts +2 -2
- package/util/apiPut.js +9 -9
- package/util/createOverlayRender.d.ts +6 -6
- package/util/createOverlayRender.js +18 -18
- package/util/createTagRegex.d.ts +2 -2
- package/util/createTagRegex.js +4 -4
- package/util/extractRef.d.ts +2 -2
- package/util/extractRef.js +8 -8
- package/util/extractTag.d.ts +2 -2
- package/util/extractTag.js +12 -12
- package/util/getAuthorizationHeader.d.ts +2 -2
- package/util/getAuthorizationHeader.js +12 -12
- package/util/getGraph.d.ts +2 -2
- package/util/getGraph.js +8 -8
- package/util/getLocalStorageKey.d.ts +2 -2
- package/util/getLocalStorageKey.js +6 -6
- package/util/getOauth.d.ts +2 -2
- package/util/getOauth.js +50 -50
- package/util/getOauthAccounts.d.ts +2 -2
- package/util/getOauthAccounts.js +21 -21
- package/util/getRenderRoot.d.ts +2 -2
- package/util/getRenderRoot.js +11 -11
- package/util/getSettingIntFromTree.d.ts +7 -7
- package/util/getSettingIntFromTree.js +11 -11
- package/util/getSettingValueFromTree.d.ts +7 -7
- package/util/getSettingValueFromTree.js +13 -13
- package/util/getSettingValuesFromTree.d.ts +7 -7
- package/util/getSettingValuesFromTree.js +12 -12
- package/util/getSubTree.d.ts +8 -8
- package/util/getSubTree.js +19 -19
- package/util/getToken.d.ts +2 -2
- package/util/getToken.js +9 -9
- package/util/getTokenFromTree.d.ts +2 -2
- package/util/getTokenFromTree.js +5 -5
- package/util/idToTitle.d.ts +2 -2
- package/util/idToTitle.js +8 -8
- package/util/index.d.ts +23 -23
- package/util/index.js +52 -52
- package/util/isControl.d.ts +2 -2
- package/util/isControl.js +6 -6
- package/util/localStorageGet.d.ts +2 -2
- package/util/localStorageGet.js +8 -8
- package/util/localStorageRemove.d.ts +2 -2
- package/util/localStorageRemove.js +6 -6
- package/util/localStorageSet.d.ts +2 -2
- package/util/localStorageSet.js +8 -8
- package/util/registerSmartBlocksCommand.d.ts +8 -8
- package/util/registerSmartBlocksCommand.js +24 -24
- package/util/runExtension.d.ts +4 -4
- package/util/runExtension.js +40 -40
- package/util/setInputSetting.d.ts +7 -7
- package/util/setInputSetting.js +33 -33
- package/util/setInputSettings.d.ts +7 -7
- package/util/setInputSettings.js +28 -28
- package/util/toConfigPageName.d.ts +2 -2
- package/util/toConfigPageName.js +4 -4
- package/util/toFlexRegex.d.ts +2 -2
- package/util/toFlexRegex.js +4 -4
- package/writes/clearBlockById.d.ts +2 -2
- package/writes/clearBlockById.js +11 -11
- package/writes/clearBlockByUid.d.ts +2 -2
- package/writes/clearBlockByUid.js +9 -9
- package/writes/createBlock.d.ts +9 -9
- package/writes/createBlock.js +61 -61
- package/writes/createPage.d.ts +7 -7
- package/writes/createPage.js +18 -18
- package/writes/deleteBlock.d.ts +2 -2
- package/writes/deleteBlock.js +6 -6
- package/writes/index.d.ts +8 -8
- package/writes/index.js +22 -22
- package/writes/openBlockInSidebar.d.ts +2 -2
- package/writes/openBlockInSidebar.js +13 -13
- package/writes/updateActiveBlock.d.ts +2 -2
- package/writes/updateActiveBlock.js +11 -11
- package/writes/updateBlock.d.ts +5 -5
- package/writes/updateBlock.js +17 -17
package/backend/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { default as emailCatch } from "./emailCatch";
|
|
2
|
-
export { default as emailError } from "./emailError";
|
|
3
|
-
export { default as getRoamJSUser, awsGetRoamJSUser } from "./getRoamJSUser";
|
|
4
|
-
export { default as headers } from "./headers";
|
|
5
|
-
export { default as meterRoamJSUser } from "./meterRoamJSUser";
|
|
6
|
-
export { default as putRoamJSUser, awsPutRoamJSUser } from "./putRoamJSUser";
|
|
1
|
+
export { default as emailCatch } from "./emailCatch";
|
|
2
|
+
export { default as emailError } from "./emailError";
|
|
3
|
+
export { default as getRoamJSUser, awsGetRoamJSUser } from "./getRoamJSUser";
|
|
4
|
+
export { default as headers } from "./headers";
|
|
5
|
+
export { default as meterRoamJSUser } from "./meterRoamJSUser";
|
|
6
|
+
export { default as putRoamJSUser, awsPutRoamJSUser } from "./putRoamJSUser";
|
package/backend/index.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.awsPutRoamJSUser = exports.putRoamJSUser = exports.meterRoamJSUser = exports.headers = exports.awsGetRoamJSUser = exports.getRoamJSUser = exports.emailError = exports.emailCatch = void 0;
|
|
7
|
-
var emailCatch_1 = require("./emailCatch");
|
|
8
|
-
Object.defineProperty(exports, "emailCatch", { enumerable: true, get: function () { return __importDefault(emailCatch_1).default; } });
|
|
9
|
-
var emailError_1 = require("./emailError");
|
|
10
|
-
Object.defineProperty(exports, "emailError", { enumerable: true, get: function () { return __importDefault(emailError_1).default; } });
|
|
11
|
-
var getRoamJSUser_1 = require("./getRoamJSUser");
|
|
12
|
-
Object.defineProperty(exports, "getRoamJSUser", { enumerable: true, get: function () { return __importDefault(getRoamJSUser_1).default; } });
|
|
13
|
-
Object.defineProperty(exports, "awsGetRoamJSUser", { enumerable: true, get: function () { return getRoamJSUser_1.awsGetRoamJSUser; } });
|
|
14
|
-
var headers_1 = require("./headers");
|
|
15
|
-
Object.defineProperty(exports, "headers", { enumerable: true, get: function () { return __importDefault(headers_1).default; } });
|
|
16
|
-
var meterRoamJSUser_1 = require("./meterRoamJSUser");
|
|
17
|
-
Object.defineProperty(exports, "meterRoamJSUser", { enumerable: true, get: function () { return __importDefault(meterRoamJSUser_1).default; } });
|
|
18
|
-
var putRoamJSUser_1 = require("./putRoamJSUser");
|
|
19
|
-
Object.defineProperty(exports, "putRoamJSUser", { enumerable: true, get: function () { return __importDefault(putRoamJSUser_1).default; } });
|
|
20
|
-
Object.defineProperty(exports, "awsPutRoamJSUser", { enumerable: true, get: function () { return putRoamJSUser_1.awsPutRoamJSUser; } });
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.awsPutRoamJSUser = exports.putRoamJSUser = exports.meterRoamJSUser = exports.headers = exports.awsGetRoamJSUser = exports.getRoamJSUser = exports.emailError = exports.emailCatch = void 0;
|
|
7
|
+
var emailCatch_1 = require("./emailCatch");
|
|
8
|
+
Object.defineProperty(exports, "emailCatch", { enumerable: true, get: function () { return __importDefault(emailCatch_1).default; } });
|
|
9
|
+
var emailError_1 = require("./emailError");
|
|
10
|
+
Object.defineProperty(exports, "emailError", { enumerable: true, get: function () { return __importDefault(emailError_1).default; } });
|
|
11
|
+
var getRoamJSUser_1 = require("./getRoamJSUser");
|
|
12
|
+
Object.defineProperty(exports, "getRoamJSUser", { enumerable: true, get: function () { return __importDefault(getRoamJSUser_1).default; } });
|
|
13
|
+
Object.defineProperty(exports, "awsGetRoamJSUser", { enumerable: true, get: function () { return getRoamJSUser_1.awsGetRoamJSUser; } });
|
|
14
|
+
var headers_1 = require("./headers");
|
|
15
|
+
Object.defineProperty(exports, "headers", { enumerable: true, get: function () { return __importDefault(headers_1).default; } });
|
|
16
|
+
var meterRoamJSUser_1 = require("./meterRoamJSUser");
|
|
17
|
+
Object.defineProperty(exports, "meterRoamJSUser", { enumerable: true, get: function () { return __importDefault(meterRoamJSUser_1).default; } });
|
|
18
|
+
var putRoamJSUser_1 = require("./putRoamJSUser");
|
|
19
|
+
Object.defineProperty(exports, "putRoamJSUser", { enumerable: true, get: function () { return __importDefault(putRoamJSUser_1).default; } });
|
|
20
|
+
Object.defineProperty(exports, "awsPutRoamJSUser", { enumerable: true, get: function () { return putRoamJSUser_1.awsPutRoamJSUser; } });
|
|
21
21
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const meterRoamJSUser: (user: string, quantity?: number, extensionId?: string, email?: string | undefined, dev?: boolean) => Promise<{
|
|
2
|
-
id: string;
|
|
3
|
-
}>;
|
|
4
|
-
export default meterRoamJSUser;
|
|
1
|
+
declare const meterRoamJSUser: (user: string, quantity?: number, extensionId?: string, email?: string | undefined, dev?: boolean) => Promise<{
|
|
2
|
+
id: string;
|
|
3
|
+
}>;
|
|
4
|
+
export default meterRoamJSUser;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
const axios_1 = (0, tslib_1.__importDefault)(require("axios"));
|
|
5
|
-
const meterRoamJSUser = (user, quantity = 1, extensionId = process.env.ROAMJS_EXTENSION_ID || "", email = process.env.ROAMJS_EMAIL, dev = process.env.NODE_ENV === "development") => axios_1.default
|
|
6
|
-
.post(`https://lambda.roamjs.com/meter`, Object.assign(Object.assign({}, (user.startsWith("user_") ? { id: user } : { email: user })), { quantity }), {
|
|
7
|
-
headers: Object.assign({ Authorization: `Bearer ${Buffer.from(`${email}:${process.env.ROAMJS_DEVELOPER_TOKEN}`).toString("base64")}`, "x-roamjs-extension": extensionId }, (dev
|
|
8
|
-
? {
|
|
9
|
-
"x-roamjs-dev": "true",
|
|
10
|
-
}
|
|
11
|
-
: {})),
|
|
12
|
-
})
|
|
13
|
-
.then((r) => r.data);
|
|
14
|
-
exports.default = meterRoamJSUser;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const axios_1 = (0, tslib_1.__importDefault)(require("axios"));
|
|
5
|
+
const meterRoamJSUser = (user, quantity = 1, extensionId = process.env.ROAMJS_EXTENSION_ID || "", email = process.env.ROAMJS_EMAIL, dev = process.env.NODE_ENV === "development") => axios_1.default
|
|
6
|
+
.post(`https://lambda.roamjs.com/meter`, Object.assign(Object.assign({}, (user.startsWith("user_") ? { id: user } : { email: user })), { quantity }), {
|
|
7
|
+
headers: Object.assign({ Authorization: `Bearer ${Buffer.from(`${email}:${process.env.ROAMJS_DEVELOPER_TOKEN}`).toString("base64")}`, "x-roamjs-extension": extensionId }, (dev
|
|
8
|
+
? {
|
|
9
|
+
"x-roamjs-dev": "true",
|
|
10
|
+
}
|
|
11
|
+
: {})),
|
|
12
|
+
})
|
|
13
|
+
.then((r) => r.data);
|
|
14
|
+
exports.default = meterRoamJSUser;
|
|
15
15
|
//# sourceMappingURL=meterRoamJSUser.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import headers from "./headers";
|
|
2
|
-
declare const putRoamJSUser: (token: string, data: {
|
|
3
|
-
[k: string]: unknown;
|
|
4
|
-
}, extensionId?: string, email?: string | undefined, dev?: boolean) => Promise<any>;
|
|
5
|
-
export declare const awsPutRoamJSUser: (event: {
|
|
6
|
-
headers: {
|
|
7
|
-
[k: string]: string;
|
|
8
|
-
};
|
|
9
|
-
}, data: Record<string, unknown>) => Promise<any>;
|
|
10
|
-
export default putRoamJSUser;
|
|
1
|
+
import headers from "./headers";
|
|
2
|
+
declare const putRoamJSUser: (token: string, data: {
|
|
3
|
+
[k: string]: unknown;
|
|
4
|
+
}, extensionId?: string, email?: string | undefined, dev?: boolean) => Promise<any>;
|
|
5
|
+
export declare const awsPutRoamJSUser: (event: {
|
|
6
|
+
headers: {
|
|
7
|
+
[k: string]: string;
|
|
8
|
+
};
|
|
9
|
+
}, data: Record<string, unknown>) => Promise<any>;
|
|
10
|
+
export default putRoamJSUser;
|
package/backend/putRoamJSUser.js
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.awsPutRoamJSUser = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const axios_1 = (0, tslib_1.__importDefault)(require("axios"));
|
|
6
|
-
const headers_1 = (0, tslib_1.__importDefault)(require("./headers"));
|
|
7
|
-
const putRoamJSUser = (token, data, extensionId = process.env.ROAMJS_EXTENSION_ID || "", email = process.env.ROAMJS_EMAIL, dev = process.env.NODE_ENV === "development") => axios_1.default
|
|
8
|
-
.put(`https://lambda.roamjs.com/user`, data, {
|
|
9
|
-
headers: Object.assign({ Authorization: `Bearer ${Buffer.from(`${email}:${process.env.ROAMJS_DEVELOPER_TOKEN}`).toString("base64")}`, "x-roamjs-token": token, "x-roamjs-extension": extensionId }, (dev
|
|
10
|
-
? {
|
|
11
|
-
"x-roamjs-dev": "true",
|
|
12
|
-
}
|
|
13
|
-
: {})),
|
|
14
|
-
})
|
|
15
|
-
.then((r) => r.data);
|
|
16
|
-
const awsPutRoamJSUser = (event, data) => putRoamJSUser(event.headers.Authorization || event.headers.authorization || "", data).catch((e) => {
|
|
17
|
-
var _a;
|
|
18
|
-
return ({
|
|
19
|
-
statusCode: 401,
|
|
20
|
-
body: (_a = e.response) === null || _a === void 0 ? void 0 : _a.data,
|
|
21
|
-
headers: headers_1.default,
|
|
22
|
-
});
|
|
23
|
-
});
|
|
24
|
-
exports.awsPutRoamJSUser = awsPutRoamJSUser;
|
|
25
|
-
exports.default = putRoamJSUser;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.awsPutRoamJSUser = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const axios_1 = (0, tslib_1.__importDefault)(require("axios"));
|
|
6
|
+
const headers_1 = (0, tslib_1.__importDefault)(require("./headers"));
|
|
7
|
+
const putRoamJSUser = (token, data, extensionId = process.env.ROAMJS_EXTENSION_ID || "", email = process.env.ROAMJS_EMAIL, dev = process.env.NODE_ENV === "development") => axios_1.default
|
|
8
|
+
.put(`https://lambda.roamjs.com/user`, data, {
|
|
9
|
+
headers: Object.assign({ Authorization: `Bearer ${Buffer.from(`${email}:${process.env.ROAMJS_DEVELOPER_TOKEN}`).toString("base64")}`, "x-roamjs-token": token, "x-roamjs-extension": extensionId }, (dev
|
|
10
|
+
? {
|
|
11
|
+
"x-roamjs-dev": "true",
|
|
12
|
+
}
|
|
13
|
+
: {})),
|
|
14
|
+
})
|
|
15
|
+
.then((r) => r.data);
|
|
16
|
+
const awsPutRoamJSUser = (event, data) => putRoamJSUser(event.headers.Authorization || event.headers.authorization || "", data).catch((e) => {
|
|
17
|
+
var _a;
|
|
18
|
+
return ({
|
|
19
|
+
statusCode: 401,
|
|
20
|
+
body: (_a = e.response) === null || _a === void 0 ? void 0 : _a.data,
|
|
21
|
+
headers: headers_1.default,
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
exports.awsPutRoamJSUser = awsPutRoamJSUser;
|
|
25
|
+
exports.default = putRoamJSUser;
|
|
26
26
|
//# sourceMappingURL=putRoamJSUser.js.map
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
declare type BlockErrorBoundaryProps = {
|
|
3
|
-
blockUid: string;
|
|
4
|
-
message: string;
|
|
5
|
-
};
|
|
6
|
-
declare type BlockErrorBoundaryState = {
|
|
7
|
-
hasError: boolean;
|
|
8
|
-
};
|
|
9
|
-
declare class BlockErrorBoundary extends React.Component<BlockErrorBoundaryProps, BlockErrorBoundaryState> {
|
|
10
|
-
constructor(props: BlockErrorBoundaryProps);
|
|
11
|
-
static getDerivedStateFromError(): BlockErrorBoundaryState;
|
|
12
|
-
componentDidCatch(error: Error): void;
|
|
13
|
-
render(): React.ReactNode;
|
|
14
|
-
}
|
|
15
|
-
export default BlockErrorBoundary;
|
|
1
|
+
import React from "react";
|
|
2
|
+
declare type BlockErrorBoundaryProps = {
|
|
3
|
+
blockUid: string;
|
|
4
|
+
message: string;
|
|
5
|
+
};
|
|
6
|
+
declare type BlockErrorBoundaryState = {
|
|
7
|
+
hasError: boolean;
|
|
8
|
+
};
|
|
9
|
+
declare class BlockErrorBoundary extends React.Component<BlockErrorBoundaryProps, BlockErrorBoundaryState> {
|
|
10
|
+
constructor(props: BlockErrorBoundaryProps);
|
|
11
|
+
static getDerivedStateFromError(): BlockErrorBoundaryState;
|
|
12
|
+
componentDidCatch(error: Error): void;
|
|
13
|
+
render(): React.ReactNode;
|
|
14
|
+
}
|
|
15
|
+
export default BlockErrorBoundary;
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
const react_1 = (0, tslib_1.__importDefault)(require("react"));
|
|
5
|
-
const writes_1 = require("../writes");
|
|
6
|
-
class BlockErrorBoundary extends react_1.default.Component {
|
|
7
|
-
constructor(props) {
|
|
8
|
-
super(props);
|
|
9
|
-
this.state = { hasError: false };
|
|
10
|
-
}
|
|
11
|
-
static getDerivedStateFromError() {
|
|
12
|
-
return { hasError: true };
|
|
13
|
-
}
|
|
14
|
-
componentDidCatch(error) {
|
|
15
|
-
(0, writes_1.createBlock)({
|
|
16
|
-
node: { text: this.props.message.replace("{ERROR}", error.message) },
|
|
17
|
-
parentUid: this.props.blockUid,
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
render() {
|
|
21
|
-
if (this.state.hasError) {
|
|
22
|
-
return react_1.default.createElement("div", null, "Component Failed To Load");
|
|
23
|
-
}
|
|
24
|
-
return this.props.children;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
exports.default = BlockErrorBoundary;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const react_1 = (0, tslib_1.__importDefault)(require("react"));
|
|
5
|
+
const writes_1 = require("../writes");
|
|
6
|
+
class BlockErrorBoundary extends react_1.default.Component {
|
|
7
|
+
constructor(props) {
|
|
8
|
+
super(props);
|
|
9
|
+
this.state = { hasError: false };
|
|
10
|
+
}
|
|
11
|
+
static getDerivedStateFromError() {
|
|
12
|
+
return { hasError: true };
|
|
13
|
+
}
|
|
14
|
+
componentDidCatch(error) {
|
|
15
|
+
(0, writes_1.createBlock)({
|
|
16
|
+
node: { text: this.props.message.replace("{ERROR}", error.message) },
|
|
17
|
+
parentUid: this.props.blockUid,
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
render() {
|
|
21
|
+
if (this.state.hasError) {
|
|
22
|
+
return react_1.default.createElement("div", null, "Component Failed To Load");
|
|
23
|
+
}
|
|
24
|
+
return this.props.children;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.default = BlockErrorBoundary;
|
|
28
28
|
//# sourceMappingURL=BlockErrorBoundary.js.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
declare const BlockInput: ({ value, setValue, onBlur, onConfirm, getAllBlocks, }: {
|
|
3
|
-
value: string;
|
|
4
|
-
setValue: (q: string, uid?: string | undefined) => void;
|
|
5
|
-
onBlur?: ((v: string) => void) | undefined;
|
|
6
|
-
onConfirm?: (() => void) | undefined;
|
|
7
|
-
getAllBlocks?: (() => {
|
|
8
|
-
text: string;
|
|
9
|
-
uid: string;
|
|
10
|
-
}[]) | undefined;
|
|
11
|
-
}) => React.ReactElement;
|
|
12
|
-
export default BlockInput;
|
|
1
|
+
import React from "react";
|
|
2
|
+
declare const BlockInput: ({ value, setValue, onBlur, onConfirm, getAllBlocks, }: {
|
|
3
|
+
value: string;
|
|
4
|
+
setValue: (q: string, uid?: string | undefined) => void;
|
|
5
|
+
onBlur?: ((v: string) => void) | undefined;
|
|
6
|
+
onConfirm?: (() => void) | undefined;
|
|
7
|
+
getAllBlocks?: (() => {
|
|
8
|
+
text: string;
|
|
9
|
+
uid: string;
|
|
10
|
+
}[]) | undefined;
|
|
11
|
+
}) => React.ReactElement;
|
|
12
|
+
export default BlockInput;
|
package/components/BlockInput.js
CHANGED
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
const core_1 = require("@blueprintjs/core");
|
|
5
|
-
const react_1 = (0, tslib_1.__importStar)(require("react"));
|
|
6
|
-
const queries_1 = require("../queries");
|
|
7
|
-
const useArrowKeyDown_1 = (0, tslib_1.__importDefault)(require("../hooks/useArrowKeyDown"));
|
|
8
|
-
const searchBlocksByString = (q, blocks) => {
|
|
9
|
-
const regex = new RegExp(q, "i");
|
|
10
|
-
return blocks.filter((a) => regex.test(a.text)).slice(0, 9);
|
|
11
|
-
};
|
|
12
|
-
const BlockInput = ({ value, setValue, onBlur, onConfirm, getAllBlocks = queries_1.getAllBlockUidsAndTexts, }) => {
|
|
13
|
-
const [isOpen, setIsOpen] = (0, react_1.useState)(false);
|
|
14
|
-
const open = (0, react_1.useCallback)(() => setIsOpen(true), [setIsOpen]);
|
|
15
|
-
const close = (0, react_1.useCallback)(() => setIsOpen(false), [setIsOpen]);
|
|
16
|
-
const allBlocks = (0, react_1.useMemo)(getAllBlocks, []);
|
|
17
|
-
const items = (0, react_1.useMemo)(() => (value && isOpen ? searchBlocksByString(value, allBlocks) : []), [value, allBlocks]);
|
|
18
|
-
const inputRef = (0, react_1.useRef)(null);
|
|
19
|
-
const { activeIndex, onKeyDown } = (0, useArrowKeyDown_1.default)({
|
|
20
|
-
onEnter: (value) => {
|
|
21
|
-
if (isOpen) {
|
|
22
|
-
setValue(value.text, value.uid);
|
|
23
|
-
close();
|
|
24
|
-
}
|
|
25
|
-
else if (onConfirm) {
|
|
26
|
-
onConfirm();
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
results: items,
|
|
30
|
-
});
|
|
31
|
-
return (react_1.default.createElement(core_1.Popover, { portalClassName: "roamjs-block-input", targetClassName: "roamjs-block-input-target", captureDismiss: true, isOpen: isOpen, onOpened: open, minimal: true, autoFocus: false, enforceFocus: false, position: core_1.PopoverPosition.BOTTOM_LEFT, modifiers: {
|
|
32
|
-
flip: { enabled: false },
|
|
33
|
-
preventOverflow: { enabled: false },
|
|
34
|
-
}, content: react_1.default.createElement(core_1.Menu, { style: { maxWidth: 400 } }, items.map((t, i) => (react_1.default.createElement(core_1.MenuItem, { text: t.text, active: activeIndex === i, key: t.uid, multiline: true, onClick: () => {
|
|
35
|
-
var _a;
|
|
36
|
-
setValue(t.text, t.uid);
|
|
37
|
-
close();
|
|
38
|
-
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
39
|
-
} })))), target: react_1.default.createElement(core_1.InputGroup, { value: value || "", onChange: (e) => {
|
|
40
|
-
setValue(e.target.value);
|
|
41
|
-
setIsOpen(!!e.target.value);
|
|
42
|
-
}, placeholder: "Search for a block", autoFocus: true, onKeyDown: onKeyDown, onBlur: (e) => {
|
|
43
|
-
var _a, _b;
|
|
44
|
-
if (e.relatedTarget &&
|
|
45
|
-
!((_b = (_a = e.relatedTarget).closest) === null || _b === void 0 ? void 0 : _b.call(_a, ".roamjs-block-input"))) {
|
|
46
|
-
close();
|
|
47
|
-
}
|
|
48
|
-
if (onBlur) {
|
|
49
|
-
onBlur(e.target.value);
|
|
50
|
-
}
|
|
51
|
-
}, inputRef: inputRef }) }));
|
|
52
|
-
};
|
|
53
|
-
exports.default = BlockInput;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const core_1 = require("@blueprintjs/core");
|
|
5
|
+
const react_1 = (0, tslib_1.__importStar)(require("react"));
|
|
6
|
+
const queries_1 = require("../queries");
|
|
7
|
+
const useArrowKeyDown_1 = (0, tslib_1.__importDefault)(require("../hooks/useArrowKeyDown"));
|
|
8
|
+
const searchBlocksByString = (q, blocks) => {
|
|
9
|
+
const regex = new RegExp(q, "i");
|
|
10
|
+
return blocks.filter((a) => regex.test(a.text)).slice(0, 9);
|
|
11
|
+
};
|
|
12
|
+
const BlockInput = ({ value, setValue, onBlur, onConfirm, getAllBlocks = queries_1.getAllBlockUidsAndTexts, }) => {
|
|
13
|
+
const [isOpen, setIsOpen] = (0, react_1.useState)(false);
|
|
14
|
+
const open = (0, react_1.useCallback)(() => setIsOpen(true), [setIsOpen]);
|
|
15
|
+
const close = (0, react_1.useCallback)(() => setIsOpen(false), [setIsOpen]);
|
|
16
|
+
const allBlocks = (0, react_1.useMemo)(getAllBlocks, []);
|
|
17
|
+
const items = (0, react_1.useMemo)(() => (value && isOpen ? searchBlocksByString(value, allBlocks) : []), [value, allBlocks]);
|
|
18
|
+
const inputRef = (0, react_1.useRef)(null);
|
|
19
|
+
const { activeIndex, onKeyDown } = (0, useArrowKeyDown_1.default)({
|
|
20
|
+
onEnter: (value) => {
|
|
21
|
+
if (isOpen) {
|
|
22
|
+
setValue(value.text, value.uid);
|
|
23
|
+
close();
|
|
24
|
+
}
|
|
25
|
+
else if (onConfirm) {
|
|
26
|
+
onConfirm();
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
results: items,
|
|
30
|
+
});
|
|
31
|
+
return (react_1.default.createElement(core_1.Popover, { portalClassName: "roamjs-block-input", targetClassName: "roamjs-block-input-target", captureDismiss: true, isOpen: isOpen, onOpened: open, minimal: true, autoFocus: false, enforceFocus: false, position: core_1.PopoverPosition.BOTTOM_LEFT, modifiers: {
|
|
32
|
+
flip: { enabled: false },
|
|
33
|
+
preventOverflow: { enabled: false },
|
|
34
|
+
}, content: react_1.default.createElement(core_1.Menu, { style: { maxWidth: 400 } }, items.map((t, i) => (react_1.default.createElement(core_1.MenuItem, { text: t.text, active: activeIndex === i, key: t.uid, multiline: true, onClick: () => {
|
|
35
|
+
var _a;
|
|
36
|
+
setValue(t.text, t.uid);
|
|
37
|
+
close();
|
|
38
|
+
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
39
|
+
} })))), target: react_1.default.createElement(core_1.InputGroup, { value: value || "", onChange: (e) => {
|
|
40
|
+
setValue(e.target.value);
|
|
41
|
+
setIsOpen(!!e.target.value);
|
|
42
|
+
}, placeholder: "Search for a block", autoFocus: true, onKeyDown: onKeyDown, onBlur: (e) => {
|
|
43
|
+
var _a, _b;
|
|
44
|
+
if (e.relatedTarget &&
|
|
45
|
+
!((_b = (_a = e.relatedTarget).closest) === null || _b === void 0 ? void 0 : _b.call(_a, ".roamjs-block-input"))) {
|
|
46
|
+
close();
|
|
47
|
+
}
|
|
48
|
+
if (onBlur) {
|
|
49
|
+
onBlur(e.target.value);
|
|
50
|
+
}
|
|
51
|
+
}, inputRef: inputRef }) }));
|
|
52
|
+
};
|
|
53
|
+
exports.default = BlockInput;
|
|
54
54
|
//# sourceMappingURL=BlockInput.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
declare const ComponentContainer: React.FunctionComponent<{
|
|
3
|
-
blockId?: string;
|
|
4
|
-
className?: string;
|
|
5
|
-
}>;
|
|
6
|
-
export declare const createComponentRender: (Fc: (props: {
|
|
7
|
-
blockUid: string;
|
|
8
|
-
}) => React.ReactElement, className?: string | undefined) => (b: HTMLButtonElement) => void;
|
|
9
|
-
export default ComponentContainer;
|
|
1
|
+
import React from "react";
|
|
2
|
+
declare const ComponentContainer: React.FunctionComponent<{
|
|
3
|
+
blockId?: string;
|
|
4
|
+
className?: string;
|
|
5
|
+
}>;
|
|
6
|
+
export declare const createComponentRender: (Fc: (props: {
|
|
7
|
+
blockUid: string;
|
|
8
|
+
}) => React.ReactElement, className?: string | undefined) => (b: HTMLButtonElement) => void;
|
|
9
|
+
export default ComponentContainer;
|
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createComponentRender = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const core_1 = require("@blueprintjs/core");
|
|
6
|
-
const react_1 = (0, tslib_1.__importStar)(require("react"));
|
|
7
|
-
const react_dom_1 = (0, tslib_1.__importDefault)(require("react-dom"));
|
|
8
|
-
const dom_1 = require("../dom");
|
|
9
|
-
const ComponentContainer = ({ blockId, className, children }) => {
|
|
10
|
-
const [showIcons, setShowIcons] = (0, react_1.useState)(false);
|
|
11
|
-
const appear = (0, react_1.useCallback)(() => setShowIcons(true), [setShowIcons]);
|
|
12
|
-
const disappear = (0, react_1.useCallback)(() => setShowIcons(false), [setShowIcons]);
|
|
13
|
-
return (react_1.default.createElement("div", { className: className, onMouseOver: appear, onMouseLeave: disappear, style: { position: "relative", width: "fit-content", minWidth: 300 } },
|
|
14
|
-
showIcons && (react_1.default.createElement("div", { style: { position: "absolute", top: 8, right: 8, zIndex: 1000 } }, blockId && (react_1.default.createElement(core_1.Button, { icon: "edit", minimal: true, onClick: () => (0, dom_1.openBlock)(blockId) })))),
|
|
15
|
-
children));
|
|
16
|
-
};
|
|
17
|
-
const renderWithUnmount = (el, p) => {
|
|
18
|
-
react_dom_1.default.render(el, p);
|
|
19
|
-
const unmountObserver = new MutationObserver((ms) => {
|
|
20
|
-
const parentRemoved = ms
|
|
21
|
-
.flatMap((m) => Array.from(m.removedNodes))
|
|
22
|
-
.some((n) => n === p || n.contains(p));
|
|
23
|
-
if (parentRemoved) {
|
|
24
|
-
unmountObserver.disconnect();
|
|
25
|
-
react_dom_1.default.unmountComponentAtNode(p);
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
unmountObserver.observe(document.body, { childList: true, subtree: true });
|
|
29
|
-
};
|
|
30
|
-
const createComponentRender = (Fc, className) => (b) => {
|
|
31
|
-
var _a, _b;
|
|
32
|
-
if (b.parentElement) {
|
|
33
|
-
b.parentElement.onmousedown = (e) => e.stopPropagation();
|
|
34
|
-
const blockUid = (0, dom_1.getBlockUidFromTarget)(b);
|
|
35
|
-
const possibleBlockId = (_a = b.closest(".roam-block")) === null || _a === void 0 ? void 0 : _a.id;
|
|
36
|
-
const blockId = ((_b = possibleBlockId === null || possibleBlockId === void 0 ? void 0 : possibleBlockId.endsWith) === null || _b === void 0 ? void 0 : _b.call(possibleBlockId, blockUid))
|
|
37
|
-
? possibleBlockId
|
|
38
|
-
: undefined;
|
|
39
|
-
if (blockUid) {
|
|
40
|
-
renderWithUnmount(react_1.default.createElement(ComponentContainer, { blockId: blockId, className: className },
|
|
41
|
-
react_1.default.createElement(Fc, { blockUid: blockUid })), b.parentElement);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
exports.createComponentRender = createComponentRender;
|
|
46
|
-
exports.default = ComponentContainer;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createComponentRender = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const core_1 = require("@blueprintjs/core");
|
|
6
|
+
const react_1 = (0, tslib_1.__importStar)(require("react"));
|
|
7
|
+
const react_dom_1 = (0, tslib_1.__importDefault)(require("react-dom"));
|
|
8
|
+
const dom_1 = require("../dom");
|
|
9
|
+
const ComponentContainer = ({ blockId, className, children }) => {
|
|
10
|
+
const [showIcons, setShowIcons] = (0, react_1.useState)(false);
|
|
11
|
+
const appear = (0, react_1.useCallback)(() => setShowIcons(true), [setShowIcons]);
|
|
12
|
+
const disappear = (0, react_1.useCallback)(() => setShowIcons(false), [setShowIcons]);
|
|
13
|
+
return (react_1.default.createElement("div", { className: className, onMouseOver: appear, onMouseLeave: disappear, style: { position: "relative", width: "fit-content", minWidth: 300 } },
|
|
14
|
+
showIcons && (react_1.default.createElement("div", { style: { position: "absolute", top: 8, right: 8, zIndex: 1000 } }, blockId && (react_1.default.createElement(core_1.Button, { icon: "edit", minimal: true, onClick: () => (0, dom_1.openBlock)(blockId) })))),
|
|
15
|
+
children));
|
|
16
|
+
};
|
|
17
|
+
const renderWithUnmount = (el, p) => {
|
|
18
|
+
react_dom_1.default.render(el, p);
|
|
19
|
+
const unmountObserver = new MutationObserver((ms) => {
|
|
20
|
+
const parentRemoved = ms
|
|
21
|
+
.flatMap((m) => Array.from(m.removedNodes))
|
|
22
|
+
.some((n) => n === p || n.contains(p));
|
|
23
|
+
if (parentRemoved) {
|
|
24
|
+
unmountObserver.disconnect();
|
|
25
|
+
react_dom_1.default.unmountComponentAtNode(p);
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
unmountObserver.observe(document.body, { childList: true, subtree: true });
|
|
29
|
+
};
|
|
30
|
+
const createComponentRender = (Fc, className) => (b) => {
|
|
31
|
+
var _a, _b;
|
|
32
|
+
if (b.parentElement) {
|
|
33
|
+
b.parentElement.onmousedown = (e) => e.stopPropagation();
|
|
34
|
+
const blockUid = (0, dom_1.getBlockUidFromTarget)(b);
|
|
35
|
+
const possibleBlockId = (_a = b.closest(".roam-block")) === null || _a === void 0 ? void 0 : _a.id;
|
|
36
|
+
const blockId = ((_b = possibleBlockId === null || possibleBlockId === void 0 ? void 0 : possibleBlockId.endsWith) === null || _b === void 0 ? void 0 : _b.call(possibleBlockId, blockUid))
|
|
37
|
+
? possibleBlockId
|
|
38
|
+
: undefined;
|
|
39
|
+
if (blockUid) {
|
|
40
|
+
renderWithUnmount(react_1.default.createElement(ComponentContainer, { blockId: blockId, className: className },
|
|
41
|
+
react_1.default.createElement(Fc, { blockUid: blockUid })), b.parentElement);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
exports.createComponentRender = createComponentRender;
|
|
46
|
+
exports.default = ComponentContainer;
|
|
47
47
|
//# sourceMappingURL=ComponentContainer.js.map
|