roamjs-components 0.74.14 → 0.74.15
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/components/ExtensionApiContext.d.ts +1 -19
- package/components/FormDialog.d.ts +1 -1
- package/components/ProgressDialog.d.ts +1 -1
- package/components/SimpleAlert.d.ts +1 -1
- package/components/TokenDialog.d.ts +1 -1
- package/package.json +1 -1
- package/types/index.d.ts +0 -3
- package/types/index.js.map +1 -1
- package/types/native.d.ts +2 -1
- package/util/createOverlayRender.d.ts +1 -1
- package/util/renderOverlay.d.ts +2 -3
- package/util/renderOverlay.js +16 -7
- package/util/renderOverlay.js.map +1 -1
- package/types/samepage.d.ts +0 -22
- package/types/samepage.js +0 -3
- package/types/samepage.js.map +0 -1
|
@@ -11,25 +11,7 @@ export declare const useExtensionAPI: () => {
|
|
|
11
11
|
id: string;
|
|
12
12
|
name: string;
|
|
13
13
|
description: string;
|
|
14
|
-
action:
|
|
15
|
-
type: "button";
|
|
16
|
-
onClick?: ((e: MouseEvent) => void) | undefined;
|
|
17
|
-
content: string;
|
|
18
|
-
} | {
|
|
19
|
-
type: "switch";
|
|
20
|
-
onChange?: ((e: React.ChangeEvent<HTMLInputElement>) => void) | undefined;
|
|
21
|
-
} | {
|
|
22
|
-
type: "input";
|
|
23
|
-
placeholder: string;
|
|
24
|
-
onChange?: ((e: React.ChangeEvent<HTMLInputElement>) => void) | undefined;
|
|
25
|
-
} | {
|
|
26
|
-
type: "select";
|
|
27
|
-
items: string[];
|
|
28
|
-
onChange?: ((e: React.ChangeEvent<HTMLInputElement>) => void) | undefined;
|
|
29
|
-
} | {
|
|
30
|
-
type: "reactComponent";
|
|
31
|
-
component: React.FC<{}>;
|
|
32
|
-
};
|
|
14
|
+
action: import("../types").Action;
|
|
33
15
|
}[];
|
|
34
16
|
}) => void;
|
|
35
17
|
};
|
|
@@ -28,7 +28,7 @@ declare type Props<T> = {
|
|
|
28
28
|
}>;
|
|
29
29
|
};
|
|
30
30
|
declare const FormDialog: <T extends Record<string, unknown>>({ title, content, isOpen, onClose, onSubmit, fields, }: RoamOverlayProps<Props<T>>) => JSX.Element;
|
|
31
|
-
export declare const render: (props: Props<Record<string, unknown>>) =>
|
|
31
|
+
export declare const render: (props: Props<Record<string, unknown>>) => (() => void) | undefined;
|
|
32
32
|
export declare const prompt: ({ defaultAnswer, question, title, }: {
|
|
33
33
|
title: string;
|
|
34
34
|
question: string;
|
|
@@ -7,5 +7,5 @@ export declare const ID = "roamjs-progress-dialog-root";
|
|
|
7
7
|
declare const ProgressDialog: ({ onClose, ...props }: {
|
|
8
8
|
onClose: () => void;
|
|
9
9
|
} & Props) => JSX.Element;
|
|
10
|
-
export declare const render: (props: Props) =>
|
|
10
|
+
export declare const render: (props: Props) => (() => void) | undefined;
|
|
11
11
|
export default ProgressDialog;
|
|
@@ -11,5 +11,5 @@ declare type Props = {
|
|
|
11
11
|
declare const SimpleAlert: (Markdown: typeof Marked) => ({ onClose, content, onConfirm, onCancel, externalLink, confirmText, dontShowAgain, }: Props & {
|
|
12
12
|
onClose: () => void;
|
|
13
13
|
}) => React.ReactElement;
|
|
14
|
-
export declare const render: (props: Props) => Promise<
|
|
14
|
+
export declare const render: (props: Props) => Promise<(() => void) | undefined>;
|
|
15
15
|
export default SimpleAlert;
|
|
@@ -5,7 +5,7 @@ declare type Props = {
|
|
|
5
5
|
declare const TokenDialog: ({ onClose, onEnter }: {
|
|
6
6
|
onClose: () => void;
|
|
7
7
|
} & Props) => JSX.Element;
|
|
8
|
-
export declare const render: (props: Props) =>
|
|
8
|
+
export declare const render: (props: Props) => (() => void) | undefined;
|
|
9
9
|
export declare const addTokenDialogCommand: (props?: Props) => void;
|
|
10
10
|
export declare const checkRoamJSTokenWarning: () => Promise<string>;
|
|
11
11
|
export default TokenDialog;
|
package/package.json
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { AddPullWatch, PullBlock, SidebarAction, SidebarWindow, SidebarWindowInput, WriteAction } from "./native";
|
|
2
2
|
import { RegisterSelection, ParseQuery, FireQuery, ConditionToDatalog, RegisterDatalogTranslator, ResultsViewComponent, QueryEditorComponent, ExportDialogComponent, QueryPageComponent, RunQuery, ListActiveQueries } from "./query-builder";
|
|
3
|
-
import { SamePageApi } from "./samepage";
|
|
4
3
|
import { RegisterCommand, UnregisterCommand } from "./smartblocks";
|
|
5
4
|
import type marked from "marked";
|
|
6
5
|
import type Markdown from "marked-react";
|
|
@@ -179,8 +178,6 @@ declare global {
|
|
|
179
178
|
roamjs: {
|
|
180
179
|
loaded: Set<string>;
|
|
181
180
|
extension: {
|
|
182
|
-
multiplayer?: SamePageApi;
|
|
183
|
-
samepage?: SamePageApi;
|
|
184
181
|
queryBuilder?: {
|
|
185
182
|
ExportDialog: ExportDialogComponent;
|
|
186
183
|
QueryEditor: QueryEditorComponent;
|
package/types/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;AAyBA,mDAAyB"}
|
package/types/native.d.ts
CHANGED
|
@@ -346,13 +346,14 @@ declare type CustomAction = {
|
|
|
346
346
|
type: "reactComponent";
|
|
347
347
|
component: React.FC;
|
|
348
348
|
};
|
|
349
|
+
export declare type Action = ButtonAction | SwitchAction | InputAction | SelectAction | CustomAction;
|
|
349
350
|
declare type PanelConfig = {
|
|
350
351
|
tabTitle: string;
|
|
351
352
|
settings: {
|
|
352
353
|
id: string;
|
|
353
354
|
name: string;
|
|
354
355
|
description: string;
|
|
355
|
-
action:
|
|
356
|
+
action: Action;
|
|
356
357
|
}[];
|
|
357
358
|
};
|
|
358
359
|
export declare type OnloadArgs = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { RoamOverlayProps } from "./renderOverlay";
|
|
3
|
-
declare const createOverlayRender: <T extends Record<string, unknown>>(id: string, Overlay: (props: RoamOverlayProps<T>) => React.ReactElement) => (props: T) =>
|
|
3
|
+
declare const createOverlayRender: <T extends Record<string, unknown>>(id: string, Overlay: (props: RoamOverlayProps<T>) => React.ReactElement) => (props: T) => (() => void) | undefined;
|
|
4
4
|
export default createOverlayRender;
|
package/util/renderOverlay.d.ts
CHANGED
|
@@ -3,11 +3,10 @@ export declare type RoamOverlayProps<T extends Record<string, unknown> = Record<
|
|
|
3
3
|
onClose: () => void;
|
|
4
4
|
isOpen: boolean;
|
|
5
5
|
} & T;
|
|
6
|
-
declare const renderOverlay: <T extends Record<string, unknown>>({ id, Overlay, props, path,
|
|
6
|
+
declare const renderOverlay: <T extends Record<string, unknown>>({ id, Overlay, props, path, }?: {
|
|
7
7
|
id?: string | undefined;
|
|
8
8
|
Overlay?: ((props: RoamOverlayProps<T>) => React.ReactElement) | undefined;
|
|
9
9
|
props?: T | undefined;
|
|
10
10
|
path?: string | HTMLElement | null | undefined;
|
|
11
|
-
|
|
12
|
-
}) => (() => void) | void;
|
|
11
|
+
}) => (() => void) | undefined;
|
|
13
12
|
export default renderOverlay;
|
package/util/renderOverlay.js
CHANGED
|
@@ -6,19 +6,27 @@ const react_1 = tslib_1.__importDefault(require("react"));
|
|
|
6
6
|
const react_dom_1 = tslib_1.__importDefault(require("react-dom"));
|
|
7
7
|
const dispatchToRegistry_1 = tslib_1.__importDefault(require("./dispatchToRegistry"));
|
|
8
8
|
const removeFromRegistry_1 = tslib_1.__importDefault(require("./removeFromRegistry"));
|
|
9
|
-
const
|
|
9
|
+
const BEFORE_REGEX = /::before\([\w.]+\)$/;
|
|
10
|
+
const renderOverlay = ({ id = (0, nanoid_1.default)(), Overlay = (props) => react_1.default.createElement("div", props), props = {}, path = "body", } = {}) => {
|
|
11
|
+
var _a;
|
|
10
12
|
const parent = document.createElement("div");
|
|
11
13
|
parent.id = id.replace(/^\d*/, "");
|
|
12
|
-
const pathElement = typeof path === "string"
|
|
14
|
+
const pathElement = typeof path === "string"
|
|
15
|
+
? document.querySelector(path.replace(BEFORE_REGEX, ""))
|
|
16
|
+
: path;
|
|
13
17
|
if (pathElement && !pathElement.querySelector(`#${parent.id}`)) {
|
|
14
|
-
|
|
15
|
-
|
|
18
|
+
const before = typeof path === "string" ? (_a = BEFORE_REGEX.exec(path)) === null || _a === void 0 ? void 0 : _a[1] : undefined;
|
|
19
|
+
if (!before) {
|
|
20
|
+
pathElement.appendChild(parent);
|
|
21
|
+
}
|
|
22
|
+
else if (!Number.isNaN(Number(before))) {
|
|
23
|
+
pathElement.insertBefore(parent, pathElement.children[Number(before)]);
|
|
16
24
|
}
|
|
17
|
-
else if (
|
|
18
|
-
pathElement.insertBefore(parent, before);
|
|
25
|
+
else if (pathElement.querySelector(before)) {
|
|
26
|
+
pathElement.insertBefore(parent, pathElement.querySelector(before));
|
|
19
27
|
}
|
|
20
28
|
else {
|
|
21
|
-
|
|
29
|
+
return undefined;
|
|
22
30
|
}
|
|
23
31
|
const onClose = () => {
|
|
24
32
|
if (typeof props.onClose === "function")
|
|
@@ -35,6 +43,7 @@ const renderOverlay = ({ id = (0, nanoid_1.default)(), Overlay = (props) => reac
|
|
|
35
43
|
});
|
|
36
44
|
return onClose;
|
|
37
45
|
}
|
|
46
|
+
return undefined;
|
|
38
47
|
};
|
|
39
48
|
exports.default = renderOverlay;
|
|
40
49
|
//# sourceMappingURL=renderOverlay.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderOverlay.js","sourceRoot":"","sources":["../../src/util/renderOverlay.ts"],"names":[],"mappings":";;;AAAA,4DAA4B;AAC5B,0DAA0B;AAC1B,kEAAiC;AACjC,sFAAsD;AACtD,sFAAsD;AAStD,MAAM,aAAa,GAAG,CAAoC,EACxD,EAAE,GAAG,IAAA,gBAAM,GAAE,EACb,OAAO,GAAG,CAAC,KAAK,EAAE,EAAE,CAAC,eAAK,CAAC,aAA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CAAC,MAAM,CAAC,CAAC,EAAE;YACxC,WAAW,CAAC,YAAY,CAAC,MAAM,EAAE,WAAW,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;SACxE;aAAM,IAAI,WAAW,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE;YAC5C,WAAW,CAAC,YAAY,CAAC,MAAM,EAAE,WAAW,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC;SACrE;aAAM;YACL,OAAO,SAAS,CAAC;SAClB;QACD,MAAM,OAAO,GAAG,GAAG,EAAE;YACnB,IAAI,OAAO,KAAK,CAAC,OAAO,KAAK,UAAU;gBAAE,KAAK,CAAC,OAAO,EAAE,CAAC;YACzD,mBAAQ,CAAC,sBAAsB,CAAC,MAAM,CAAC,CAAC;YACxC,MAAM,CAAC,MAAM,EAAE,CAAC;YAChB,IAAA,4BAAkB,EAAC;gBACjB,UAAU,EAAE,CAAC,MAAM,CAAC;aACrB,CAAC,CAAC;QACL,CAAC,CAAC;QACF,mBAAQ,CAAC,MAAM,CACb,eAAK,CAAC,aAAa,CAAC,OAAO,kCACtB,KAAK,KACR,MAAM,EAAE,IAAI,EACZ,OAAO,IACP,EACF,MAAM,CACP,CAAC;QACF,IAAA,4BAAkB,EAAC;YACjB,UAAU,EAAE,CAAC,MAAM,CAAC;SACrB,CAAC,CAAC;QACH,OAAO,OAAO,CAAC;KAChB;IACD,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AAEF,kBAAe,aAAa,CAAC"}
|
package/types/samepage.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
declare type json = string | number | boolean | null | {
|
|
2
|
-
toJSON: () => string;
|
|
3
|
-
} | json[] | {
|
|
4
|
-
[key: string]: json;
|
|
5
|
-
};
|
|
6
|
-
export declare type SamePageApi = {
|
|
7
|
-
addGraphListener: (args: {
|
|
8
|
-
operation: string;
|
|
9
|
-
handler: (e: json, graph: string) => void;
|
|
10
|
-
}) => void;
|
|
11
|
-
removeGraphListener: (args: {
|
|
12
|
-
operation: string;
|
|
13
|
-
}) => void;
|
|
14
|
-
sendToGraph: (args: {
|
|
15
|
-
graph: string;
|
|
16
|
-
operation: string;
|
|
17
|
-
data?: {
|
|
18
|
-
[k: string]: json;
|
|
19
|
-
};
|
|
20
|
-
}) => void;
|
|
21
|
-
};
|
|
22
|
-
export {};
|
package/types/samepage.js
DELETED
package/types/samepage.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"samepage.js","sourceRoot":"","sources":["../../src/types/samepage.ts"],"names":[],"mappings":""}
|