roamjs-components 0.74.14 → 0.74.16
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/Toast.d.ts +2 -1
- package/components/Toast.js +2 -1
- package/components/Toast.js.map +1 -1
- package/components/TokenDialog.d.ts +1 -1
- package/components.js +2 -0
- package/components.js.map +1 -1
- package/package.json +2 -1
- package/types/index.d.ts +0 -9
- 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;
|
package/components/Toast.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { Intent, ToasterPosition } from "@blueprintjs/core";
|
|
1
|
+
import { Intent, IToastProps, ToasterPosition } from "@blueprintjs/core";
|
|
2
2
|
declare type ToastBaseProps = {
|
|
3
3
|
content?: string;
|
|
4
4
|
timeout?: number;
|
|
5
5
|
intent?: Intent;
|
|
6
|
+
onDismiss?: IToastProps["onDismiss"];
|
|
6
7
|
};
|
|
7
8
|
declare type ToastProps = {
|
|
8
9
|
id: string;
|
package/components/Toast.js
CHANGED
|
@@ -21,13 +21,14 @@ const render = (_a) => {
|
|
|
21
21
|
(window.RoamLazy
|
|
22
22
|
? window.RoamLazy.MarkedReact()
|
|
23
23
|
: Promise.resolve().then(() => tslib_1.__importStar(require("marked-react"))).then((r) => r.default)).then((Markdown) => {
|
|
24
|
-
const Toast = ({ content = "RoamJS Notification", intent = core_1.Intent.PRIMARY, timeout = 5000, }) => {
|
|
24
|
+
const Toast = ({ content = "RoamJS Notification", intent = core_1.Intent.PRIMARY, timeout = 5000, onDismiss, }) => {
|
|
25
25
|
return {
|
|
26
26
|
message: (react_1.default.createElement(react_1.default.Fragment, null,
|
|
27
27
|
react_1.default.createElement("style", null, `.${className} p { margin-bottom: 0; }`),
|
|
28
28
|
react_1.default.createElement(Markdown, null, content))),
|
|
29
29
|
intent,
|
|
30
30
|
timeout,
|
|
31
|
+
onDismiss,
|
|
31
32
|
};
|
|
32
33
|
};
|
|
33
34
|
toaster.show(Toast(props), props.id);
|
package/components/Toast.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toast.js","sourceRoot":"","sources":["../../src/components/Toast.tsx"],"names":[],"mappings":";;;;AAAA,0DAA0B;AAC1B,
|
|
1
|
+
{"version":3,"file":"Toast.js","sourceRoot":"","sources":["../../src/components/Toast.tsx"],"names":[],"mappings":";;;;AAAA,0DAA0B;AAC1B,4CAK2B;AAcpB,MAAM,MAAM,GAAG,CAAC,EAGV,EAAgB,EAAE;QAHR,EACrB,QAAQ,GAAG,KAAK,OAEL,EADR,KAAK,sBAFa,YAGtB,CADS;IAER,MAAM,SAAS,GAAG,gBAAgB,QAAQ,EAAE,CAAC;IAC7C,MAAM,WAAW,GAAG,QAAQ,CAAC,aAAa,CACxC,wBAAwB,SAAS,EAAE,CACpC,CAAC;IACF,IAAI,WAAW,EAAE;QACf,WAAW,CAAC,aAAa,CACvB,IAAI,WAAW,CAAC,cAAc,EAAE,EAAE,MAAM,EAAE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,EAAE,CAAC,CAAC;oBACjC,CAAC,CAAkB,CAAC,CAAC;YACzB,CAAC,EAAE,CAAC,CAAC,CAAC;QACR,CAAC,CAAC,CAAC;QACH,OAAO,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;KACxC;AACH,CAAC,CAAC;AA1DW,QAAA,MAAM,UA0DjB;AAEF,kBAAe,cAAM,CAAC"}
|
|
@@ -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/components.js
CHANGED
|
@@ -7,6 +7,7 @@ const core_1 = require("@blueprintjs/core");
|
|
|
7
7
|
const AutocompleteInput_1 = tslib_1.__importDefault(require("./components/AutocompleteInput"));
|
|
8
8
|
const FormDialog_1 = tslib_1.__importDefault(require("./components/FormDialog"));
|
|
9
9
|
const PageInput_1 = tslib_1.__importDefault(require("./components/PageInput"));
|
|
10
|
+
const Toast_1 = tslib_1.__importDefault(require("./components/Toast"));
|
|
10
11
|
const renderOverlay_1 = tslib_1.__importDefault(require("./util/renderOverlay"));
|
|
11
12
|
const runExtension_1 = tslib_1.__importDefault(require("./util/runExtension"));
|
|
12
13
|
const writes_1 = require("./writes");
|
|
@@ -89,6 +90,7 @@ exports.default = (0, runExtension_1.default)({
|
|
|
89
90
|
AutocompleteInput: AutocompleteInput_1.default,
|
|
90
91
|
FormDialog: FormDialog_1.default,
|
|
91
92
|
PageInput: PageInput_1.default,
|
|
93
|
+
renderToast: Toast_1.default,
|
|
92
94
|
},
|
|
93
95
|
util: {
|
|
94
96
|
renderOverlay: renderOverlay_1.default,
|
package/components.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components.js","sourceRoot":"","sources":["../src/components.tsx"],"names":[],"mappings":";;;AAAA,kEAAiC;AACjC,uDAAiD;AACjD,4CAA2C;AAE3C,+FAA+D;AAC/D,iFAAiD;AACjD,+EAA+C;
|
|
1
|
+
{"version":3,"file":"components.js","sourceRoot":"","sources":["../src/components.tsx"],"names":[],"mappings":";;;AAAA,kEAAiC;AACjC,uDAAiD;AACjD,4CAA2C;AAE3C,+FAA+D;AAC/D,iFAAiD;AACjD,+EAA+C;AAC/C,uEAA6C;AAE7C,iFAAiD;AACjD,+EAA+C;AAE/C,qCAAuC;AAEvC,iDAAiD;AACjD,4DAA4D;AAC5D,4CAA4C;AAC5C,oEAAoE;AACpE,OAAO;AACP,4CAA4C;AAC5C,KAAK;AAEL,MAAM,UAAU,GAAG,CAAC,SAAmB,EAAE,EAAE;IACzC,MAAM,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC;IACrD,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IAC7C,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC,iBAAiB,CAAC,CAAC;IACnD,mBAAQ,CAAC,MAAM,CAAC,8BAAC,SAAS,OAAG,EAAE,MAAM,CAAC,CAAC;AACzC,CAAC,CAAC;AAEF,MAAM,UAAU,GAAG;IACjB;QACE,QAAQ,EAAE,GAAG,EAAE,CACb,UAAU,CAAC,GAAG,EAAE;YACd,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,IAAA,gBAAQ,EAAC,EAAE,CAAC,CAAC;YACvC,MAAM,OAAO,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE,CAAC,CAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC,EAAE,EAAE,CAAC,CAAC;YACjE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,EAAE,KAAK,EAAE,EAAE,EAAE;YACzC,MAAM,CAAC,YAAY,CAAC,EAAE,CAAC,cAAc,CAAC,UAAU,CAAC;gBAC/C,KAAK,EAAE,2BAA2B,KAAK,EAAE;gBACzC,QAAQ;aACT,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QACH,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,SAAS,GAAG;YAClC,UAAU,EAAE;gBACV,iBAAiB,EAAjB,2BAAiB;gBACjB,UAAU,EAAV,oBAAU;gBACV,SAAS,EAAT,mBAAS;gBACT,WAAW,EAAX,eAAW;aACZ;YACD,IAAI,EAAE;gBACJ,aAAa,EAAb,uBAAa;gBACb,YAAY,EAAZ,sBAAY;aACb;SACF,CAAC;QACF,OAAO,EAAE,QAAQ,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC;IACtD,CAAC;CACF,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "roamjs-components",
|
|
3
3
|
"description": "Expansive toolset, utilities, & components for developing RoamJS extensions.",
|
|
4
|
-
"version": "0.74.
|
|
4
|
+
"version": "0.74.16",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
7
7
|
"scripts": {
|
|
@@ -55,6 +55,7 @@
|
|
|
55
55
|
"@testing-library/user-event": "^13.1.9",
|
|
56
56
|
"@types/aws-lambda": "^8.10.89",
|
|
57
57
|
"@types/color": "^3.0.2",
|
|
58
|
+
"@types/mime-types": "^2.1.1",
|
|
58
59
|
"@types/refractor": "^3.0.2",
|
|
59
60
|
"@typescript-eslint/eslint-plugin": "^5.27.1",
|
|
60
61
|
"@typescript-eslint/parser": "^5.27.1",
|
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;
|
|
@@ -198,12 +195,6 @@ declare global {
|
|
|
198
195
|
runQuery: RunQuery;
|
|
199
196
|
listActiveQueries: ListActiveQueries;
|
|
200
197
|
};
|
|
201
|
-
versioning?: {
|
|
202
|
-
switch: (args: {
|
|
203
|
-
id: string;
|
|
204
|
-
currentVersion: string;
|
|
205
|
-
}) => void;
|
|
206
|
-
};
|
|
207
198
|
smartblocks?: {
|
|
208
199
|
registerCommand: RegisterCommand;
|
|
209
200
|
unregisterCommand: UnregisterCommand;
|
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,aAAa,CAAC,KAAK,EAAE,KAAK,CAAC,EACtD,KAAK,GAAG,EAAO,EACf,IAAI,GAAG,MAAM,
|
|
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,YAAY,GAAG,qBAAqB,CAAC;AAE3C,MAAM,aAAa,GAAG,CAAoC,EACxD,EAAE,GAAG,IAAA,gBAAM,GAAE,EACb,OAAO,GAAG,CAAC,KAAK,EAAE,EAAE,CAAC,eAAK,CAAC,aAAa,CAAC,KAAK,EAAE,KAAK,CAAC,EACtD,KAAK,GAAG,EAAO,EACf,IAAI,GAAG,MAAM,MAMX,EAAE,EAA4B,EAAE;;IAClC,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IAC7C,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACnC,MAAM,WAAW,GACf,OAAO,IAAI,KAAK,QAAQ;QACtB,CAAC,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;QACxD,CAAC,CAAC,IAAI,CAAC;IACX,IAAI,WAAW,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,IAAI,MAAM,CAAC,EA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AC;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":""}
|