@papermap/papermap 1.0.1 → 1.0.3
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/dist/index.d.mts +12 -12
- package/dist/index.d.ts +12 -12
- package/dist/index.js +31 -37
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +28 -34
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/readme.md +117 -109
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// src/components/
|
|
1
|
+
// src/components/PaperChat.tsx
|
|
2
2
|
import { useCallback as useCallback5, useEffect as useEffect13, useMemo as useMemo7, useRef as useRef9, useState as useState18 } from "react";
|
|
3
3
|
import { createPortal } from "react-dom";
|
|
4
4
|
import { AnimatePresence as AnimatePresence5, motion as motion8 } from "framer-motion";
|
|
@@ -69,7 +69,7 @@ import { createStore } from "zustand/vanilla";
|
|
|
69
69
|
|
|
70
70
|
// src/api/endpoints.ts
|
|
71
71
|
var API_V1 = "/api/v1";
|
|
72
|
-
var DEFAULT_API_URL = "https://
|
|
72
|
+
var DEFAULT_API_URL = "https://dataapi.papermap.ai";
|
|
73
73
|
var ENDPOINTS = {
|
|
74
74
|
dashboards: `${API_V1}/analytics/dashboards`,
|
|
75
75
|
dashboardLayout: (dashboardId) => `${API_V1}/analytics/dashboards/${dashboardId}/layout`,
|
|
@@ -6627,11 +6627,11 @@ function ModelSelector() {
|
|
|
6627
6627
|
] }) }) });
|
|
6628
6628
|
}
|
|
6629
6629
|
|
|
6630
|
-
// src/components/
|
|
6630
|
+
// src/components/PaperChat.tsx
|
|
6631
6631
|
import { Fragment as Fragment10, jsx as jsx51, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
6632
6632
|
var SPRING = { type: "spring", stiffness: 400, damping: 35, duration: 0.2 };
|
|
6633
6633
|
var EASE2 = [0.23, 1, 0.32, 1];
|
|
6634
|
-
function
|
|
6634
|
+
function PaperChat({
|
|
6635
6635
|
token,
|
|
6636
6636
|
workspaceId,
|
|
6637
6637
|
dashboardId,
|
|
@@ -6649,11 +6649,11 @@ function PapermapChat({
|
|
|
6649
6649
|
if (parentStore) {
|
|
6650
6650
|
if (!resolvedToken || !resolvedWorkspaceId || !resolvedDashboardId) {
|
|
6651
6651
|
throw new Error(
|
|
6652
|
-
"
|
|
6652
|
+
"PaperChat requires token, workspaceId, and dashboardId from props or PapermapProvider."
|
|
6653
6653
|
);
|
|
6654
6654
|
}
|
|
6655
6655
|
return /* @__PURE__ */ jsx51(
|
|
6656
|
-
|
|
6656
|
+
PaperChatInner,
|
|
6657
6657
|
{
|
|
6658
6658
|
onToolbarHeightChange,
|
|
6659
6659
|
showToolbar,
|
|
@@ -6663,7 +6663,7 @@ function PapermapChat({
|
|
|
6663
6663
|
}
|
|
6664
6664
|
if (!resolvedToken || !resolvedWorkspaceId || !resolvedDashboardId) {
|
|
6665
6665
|
throw new Error(
|
|
6666
|
-
"
|
|
6666
|
+
"PaperChat requires token, workspaceId, and dashboardId when used outside PapermapProvider."
|
|
6667
6667
|
);
|
|
6668
6668
|
}
|
|
6669
6669
|
return /* @__PURE__ */ jsx51(
|
|
@@ -6674,7 +6674,7 @@ function PapermapChat({
|
|
|
6674
6674
|
dashboardId: resolvedDashboardId,
|
|
6675
6675
|
apiUrl: resolvedApiUrl,
|
|
6676
6676
|
children: /* @__PURE__ */ jsx51(
|
|
6677
|
-
|
|
6677
|
+
PaperChatInner,
|
|
6678
6678
|
{
|
|
6679
6679
|
onToolbarHeightChange,
|
|
6680
6680
|
showToolbar,
|
|
@@ -6684,7 +6684,7 @@ function PapermapChat({
|
|
|
6684
6684
|
}
|
|
6685
6685
|
);
|
|
6686
6686
|
}
|
|
6687
|
-
function
|
|
6687
|
+
function PaperChatInner({
|
|
6688
6688
|
placeholder = "Ask anything...",
|
|
6689
6689
|
shortcutKey = "k",
|
|
6690
6690
|
autoFade = false,
|
|
@@ -7159,7 +7159,7 @@ function PapermapChatInner({
|
|
|
7159
7159
|
return createPortal(content, document.body);
|
|
7160
7160
|
}
|
|
7161
7161
|
|
|
7162
|
-
// src/components/
|
|
7162
|
+
// src/components/PaperCard.tsx
|
|
7163
7163
|
import { useCallback as useCallback8, useEffect as useEffect16, useMemo as useMemo9, useState as useState21 } from "react";
|
|
7164
7164
|
import {
|
|
7165
7165
|
BarChart3,
|
|
@@ -8329,7 +8329,7 @@ function resolveChartFetchChatId(params) {
|
|
|
8329
8329
|
return link?.chatId;
|
|
8330
8330
|
}
|
|
8331
8331
|
|
|
8332
|
-
// src/components/
|
|
8332
|
+
// src/components/PaperCard.tsx
|
|
8333
8333
|
import { Fragment as Fragment12, jsx as jsx54, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
8334
8334
|
function normalizeLatestChartPayload(result, fallbackChatId) {
|
|
8335
8335
|
const chartData = result?.data ?? result;
|
|
@@ -8387,11 +8387,11 @@ function persistChartLoaded(chart, cardId, workspaceId, dashboardId, onSave) {
|
|
|
8387
8387
|
try {
|
|
8388
8388
|
onSave(chart);
|
|
8389
8389
|
} catch (e) {
|
|
8390
|
-
console.error("
|
|
8390
|
+
console.error("PaperCard onSave:", e);
|
|
8391
8391
|
}
|
|
8392
8392
|
}
|
|
8393
8393
|
}
|
|
8394
|
-
function
|
|
8394
|
+
function PaperCard({
|
|
8395
8395
|
token: tokenProp,
|
|
8396
8396
|
workspaceId: workspaceIdProp,
|
|
8397
8397
|
dashboardId: dashboardIdProp,
|
|
@@ -8420,7 +8420,7 @@ function PapermapChartCard({
|
|
|
8420
8420
|
const apiUrl = apiUrlProp ?? conn?.apiUrl;
|
|
8421
8421
|
if (!token?.trim() || !workspaceId?.trim() || !dashboardId?.trim()) {
|
|
8422
8422
|
throw new Error(
|
|
8423
|
-
"
|
|
8423
|
+
"PaperCard requires token, workspaceId, and dashboardId from props or PapermapProvider."
|
|
8424
8424
|
);
|
|
8425
8425
|
}
|
|
8426
8426
|
const resolvedFetchChatId = useMemo9(
|
|
@@ -8985,7 +8985,7 @@ function useAutoResize(textareaRef, minHeight = 40, maxHeight = 120) {
|
|
|
8985
8985
|
return { resize };
|
|
8986
8986
|
}
|
|
8987
8987
|
|
|
8988
|
-
// src/features/GridDashboard/
|
|
8988
|
+
// src/features/GridDashboard/PaperBoard.tsx
|
|
8989
8989
|
import "react-grid-layout/css/styles.css";
|
|
8990
8990
|
import "react-resizable/css/styles.css";
|
|
8991
8991
|
import { Loader2 as Loader217 } from "lucide-react";
|
|
@@ -10966,16 +10966,10 @@ var GRID_RESIZE_HANDLE_STYLES = `
|
|
|
10966
10966
|
}
|
|
10967
10967
|
`;
|
|
10968
10968
|
|
|
10969
|
-
// src/features/GridDashboard/
|
|
10969
|
+
// src/features/GridDashboard/PaperBoard.tsx
|
|
10970
10970
|
import { Fragment as Fragment15, jsx as jsx68, jsxs as jsxs51 } from "react/jsx-runtime";
|
|
10971
10971
|
var ResponsiveGridLayout = WidthProvider(Responsive);
|
|
10972
|
-
function
|
|
10973
|
-
token,
|
|
10974
|
-
workspaceId,
|
|
10975
|
-
dashboardId,
|
|
10976
|
-
apiUrl,
|
|
10977
|
-
...rest
|
|
10978
|
-
}) {
|
|
10972
|
+
function PaperBoard({ token, workspaceId, dashboardId, apiUrl, ...rest }) {
|
|
10979
10973
|
const parentStore = usePapermapStoreApiOptional();
|
|
10980
10974
|
const connection = usePapermapConnectionOptional();
|
|
10981
10975
|
const resolvedToken = token ?? connection?.token;
|
|
@@ -10984,11 +10978,11 @@ function PapermapGridDashboard({
|
|
|
10984
10978
|
const resolvedApiUrl = apiUrl ?? connection?.apiUrl;
|
|
10985
10979
|
if (!resolvedToken || !resolvedWorkspaceId || !resolvedDashboardId) {
|
|
10986
10980
|
throw new Error(
|
|
10987
|
-
"
|
|
10981
|
+
"PaperBoard requires token, workspaceId, and dashboardId from props or PapermapProvider."
|
|
10988
10982
|
);
|
|
10989
10983
|
}
|
|
10990
10984
|
const inner = /* @__PURE__ */ jsx68(
|
|
10991
|
-
|
|
10985
|
+
PaperBoardInner,
|
|
10992
10986
|
{
|
|
10993
10987
|
...rest,
|
|
10994
10988
|
token: resolvedToken,
|
|
@@ -11009,7 +11003,7 @@ function PapermapGridDashboard({
|
|
|
11009
11003
|
}
|
|
11010
11004
|
);
|
|
11011
11005
|
}
|
|
11012
|
-
function
|
|
11006
|
+
function PaperBoardInner({
|
|
11013
11007
|
token,
|
|
11014
11008
|
workspaceId = "",
|
|
11015
11009
|
dashboardId,
|
|
@@ -11061,7 +11055,7 @@ function GridDashboardInner({
|
|
|
11061
11055
|
const [dashboardTitle, setDashboardTitle] = useState26("");
|
|
11062
11056
|
const [isTakingScreenshotInternal, setIsTakingScreenshotInternal] = useState26(false);
|
|
11063
11057
|
const [isGeneratingInternal, setIsGeneratingInternal] = useState26(false);
|
|
11064
|
-
const [
|
|
11058
|
+
const [paperChatToolbarHeight, setPaperChatToolbarHeight] = useState26(0);
|
|
11065
11059
|
const [themeModalOpen, setThemeModalOpen] = useState26(false);
|
|
11066
11060
|
const [localDashboardTheme, setLocalDashboardTheme] = useState26();
|
|
11067
11061
|
const [workspaceEntity, setWorkspaceEntity] = useState26(null);
|
|
@@ -11528,12 +11522,12 @@ function GridDashboardInner({
|
|
|
11528
11522
|
const themeCSS = useMemo13(() => generateThemeCSS(appliedDashboardTheme), [appliedDashboardTheme]);
|
|
11529
11523
|
const showLoader = isLoading && !charts?.length || isDashboardChanging;
|
|
11530
11524
|
const papermapChat = showChatAssistant ? /* @__PURE__ */ jsx68(
|
|
11531
|
-
|
|
11525
|
+
PaperChat,
|
|
11532
11526
|
{
|
|
11533
11527
|
token,
|
|
11534
11528
|
workspaceId,
|
|
11535
11529
|
dashboardId,
|
|
11536
|
-
onToolbarHeightChange:
|
|
11530
|
+
onToolbarHeightChange: setPaperChatToolbarHeight,
|
|
11537
11531
|
showToolbar: true
|
|
11538
11532
|
}
|
|
11539
11533
|
) : null;
|
|
@@ -11562,7 +11556,7 @@ function GridDashboardInner({
|
|
|
11562
11556
|
),
|
|
11563
11557
|
style: {
|
|
11564
11558
|
...themeStyles,
|
|
11565
|
-
paddingBottom: showChatAssistant ?
|
|
11559
|
+
paddingBottom: showChatAssistant ? paperChatToolbarHeight + 60 : void 0
|
|
11566
11560
|
},
|
|
11567
11561
|
"data-dashboard-theme": appliedDashboardTheme ? "custom" : void 0,
|
|
11568
11562
|
"data-edit-mode": isEditModeInternal || isEditMode ? "true" : "false",
|
|
@@ -11624,7 +11618,7 @@ function GridDashboardInner({
|
|
|
11624
11618
|
(isEditModeInternal || isEditMode) && !isSavingLayout && "drag-handle"
|
|
11625
11619
|
),
|
|
11626
11620
|
children: /* @__PURE__ */ jsx68(
|
|
11627
|
-
|
|
11621
|
+
PaperCard,
|
|
11628
11622
|
{
|
|
11629
11623
|
token,
|
|
11630
11624
|
workspaceId,
|
|
@@ -11681,10 +11675,10 @@ export {
|
|
|
11681
11675
|
LogoStandAlone_default as LogoStandAlone,
|
|
11682
11676
|
ModelSelector,
|
|
11683
11677
|
MorphGradient,
|
|
11684
|
-
|
|
11685
|
-
|
|
11678
|
+
PaperBoard,
|
|
11679
|
+
PaperCard,
|
|
11680
|
+
PaperChat,
|
|
11686
11681
|
PapermapProvider as PapermapConfigProvider,
|
|
11687
|
-
PapermapGridDashboard,
|
|
11688
11682
|
PapermapProvider,
|
|
11689
11683
|
RecentConversations,
|
|
11690
11684
|
SavedMemory,
|